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

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.23    ! wiz        22:           <h1 class="title"><a name="id2510578" id=
        !            23:           "id2510578"></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">
        !            69:           <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.4
        !            70:           2005/05/07 22:28:47 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.23    ! wiz        96:             <dt><span class="sect1"><a href="#id2623536">1.1.
1.1       grant      97:             Introduction</a></span></dt>
                     98: 
                     99:             <dt><span class="sect1"><a href="#overview">1.2.
                    100:             Overview</a></span></dt>
                    101: 
                    102:             <dt><span class="sect1"><a href="#terminology">1.3.
                    103:             Terminology</a></span></dt>
                    104: 
                    105:             <dt><span class="sect1"><a href="#typography">1.4.
                    106:             Typography</a></span></dt>
                    107:           </dl>
                    108:         </dd>
                    109: 
1.2       hubertf   110:         <dt><span class="part"><a href="#users-guide">I. The pkgsrc
1.1       grant     111:         user's guide</a></span></dt>
                    112: 
                    113:         <dd>
                    114:           <dl>
                    115:             <dt><span class="chapter"><a href="#getting">2. Where
                    116:             to get pkgsrc</a></span></dt>
                    117: 
                    118:             <dd>
                    119:               <dl>
1.23    ! wiz       120:                 <dt><span class="sect1"><a href="#id2569303">2.1.
1.1       grant     121:                 As tar file</a></span></dt>
                    122: 
1.23    ! wiz       123:                 <dt><span class="sect1"><a href="#id2569319">2.2.
1.1       grant     124:                 Via SUP</a></span></dt>
                    125: 
1.23    ! wiz       126:                 <dt><span class="sect1"><a href="#id2569351">2.3.
1.1       grant     127:                 Via CVS</a></span></dt>
                    128:               </dl>
                    129:             </dd>
                    130: 
                    131:             <dt><span class="chapter"><a href="#platforms">3. Using
                    132:             pkgsrc on systems other than NetBSD</a></span></dt>
                    133: 
                    134:             <dd>
                    135:               <dl>
1.23    ! wiz       136:                 <dt><span class="sect1"><a href="#id2569529">3.1.
1.1       grant     137:                 Bootstrapping pkgsrc</a></span></dt>
                    138: 
1.23    ! wiz       139:                 <dt><span class="sect1"><a href="#id2569710">3.2.
1.1       grant     140:                 Platform specific notes</a></span></dt>
                    141: 
                    142:                 <dd>
                    143:                   <dl>
                    144:                     <dt><span class="sect2"><a href=
1.23    ! wiz       145:                     "#id2569717">3.2.1. Darwin (Mac OS
1.1       grant     146:                     X)</a></span></dt>
                    147: 
                    148:                     <dt><span class="sect2"><a href=
1.23    ! wiz       149:                     "#id2569879">3.2.2. FreeBSD</a></span></dt>
1.1       grant     150: 
                    151:                     <dt><span class="sect2"><a href=
1.23    ! wiz       152:                     "#id2570459">3.2.3. Interix</a></span></dt>
1.1       grant     153: 
                    154:                     <dt><span class="sect2"><a href=
1.23    ! wiz       155:                     "#id2570693">3.2.4. IRIX</a></span></dt>
1.1       grant     156: 
                    157:                     <dt><span class="sect2"><a href=
1.23    ! wiz       158:                     "#id2570777">3.2.5. Linux</a></span></dt>
1.1       grant     159: 
                    160:                     <dt><span class="sect2"><a href=
1.23    ! wiz       161:                     "#id2570838">3.2.6. OpenBSD</a></span></dt>
1.22      tv        162: 
                    163:                     <dt><span class="sect2"><a href=
1.23    ! wiz       164:                     "#id2570950">3.2.7. Solaris</a></span></dt>
1.1       grant     165:                   </dl>
                    166:                 </dd>
                    167:               </dl>
                    168:             </dd>
                    169: 
                    170:             <dt><span class="chapter"><a href="#using">4. Using
                    171:             pkgsrc</a></span></dt>
                    172: 
                    173:             <dd>
                    174:               <dl>
                    175:                 <dt><span class="sect1"><a href=
                    176:                 "#getting-started">4.1. Working with binary
                    177:                 packages</a></span></dt>
                    178: 
                    179:                 <dd>
                    180:                   <dl>
                    181:                     <dt><span class="sect2"><a href=
1.23    ! wiz       182:                     "#id2571155">4.1.1. Where to get binary
1.1       grant     183:                     packages</a></span></dt>
                    184: 
                    185:                     <dt><span class="sect2"><a href=
1.23    ! wiz       186:                     "#id2571264">4.1.2. How to use binary
1.1       grant     187:                     packages</a></span></dt>
                    188: 
                    189:                     <dt><span class="sect2"><a href=
1.23    ! wiz       190:                     "#id2571371">4.1.3. A word of
1.1       grant     191:                     warning</a></span></dt>
                    192:                   </dl>
                    193:                 </dd>
                    194: 
1.23    ! wiz       195:                 <dt><span class="sect1"><a href="#id2571383">4.2.
1.1       grant     196:                 Building packages from source</a></span></dt>
                    197: 
                    198:                 <dd>
                    199:                   <dl>
                    200:                     <dt><span class="sect2"><a href=
1.23    ! wiz       201:                     "#id2571393">4.2.1.
1.1       grant     202:                     Requirements</a></span></dt>
                    203: 
                    204:                     <dt><span class="sect2"><a href=
1.23    ! wiz       205:                     "#id2571822">4.2.2. Fetching
1.1       grant     206:                     distfiles</a></span></dt>
                    207: 
                    208:                     <dt><span class="sect2"><a href=
1.23    ! wiz       209:                     "#id2571875">4.2.3. How to build and
1.1       grant     210:                     install</a></span></dt>
                    211: 
                    212:                     <dt><span class="sect2"><a href=
1.23    ! wiz       213:                     "#id2623810">4.2.4. Selecting the
1.1       grant     214:                     compiler</a></span></dt>
                    215:                   </dl>
                    216:                 </dd>
                    217:               </dl>
                    218:             </dd>
                    219: 
                    220:             <dt><span class="chapter"><a href="#binary">5. Creating
                    221:             binary packages</a></span></dt>
                    222: 
                    223:             <dd>
                    224:               <dl>
1.23    ! wiz       225:                 <dt><span class="sect1"><a href="#id2623896">5.1.
1.1       grant     226:                 Building a single binary package</a></span></dt>
                    227: 
1.23    ! wiz       228:                 <dt><span class="sect1"><a href="#id2623974">5.2.
1.1       grant     229:                 Settings for creation of binary
                    230:                 packages</a></span></dt>
                    231: 
                    232:                 <dt><span class="sect1"><a href="#bulkbuild">5.3.
                    233:                 Doing a bulk build of all packages</a></span></dt>
                    234: 
                    235:                 <dd>
                    236:                   <dl>
                    237:                     <dt><span class="sect2"><a href=
                    238:                     "#binary.configuration">5.3.1.
                    239:                     Configuration</a></span></dt>
                    240: 
                    241:                     <dt><span class="sect2"><a href=
1.23    ! wiz       242:                     "#id2624115">5.3.2. Other environmental
1.1       grant     243:                     considerations</a></span></dt>
                    244: 
                    245:                     <dt><span class="sect2"><a href=
1.23    ! wiz       246:                     "#id2624155">5.3.3. Operation</a></span></dt>
1.1       grant     247: 
                    248:                     <dt><span class="sect2"><a href=
1.23    ! wiz       249:                     "#id2624225">5.3.4. What it
1.1       grant     250:                     does</a></span></dt>
                    251: 
                    252:                     <dt><span class="sect2"><a href=
1.23    ! wiz       253:                     "#id2624281">5.3.5. Disk space
1.1       grant     254:                     requirements</a></span></dt>
                    255: 
                    256:                     <dt><span class="sect2"><a href=
1.23    ! wiz       257:                     "#id2624308">5.3.6. Setting up a sandbox for
1.1       grant     258:                     chroot'ed builds</a></span></dt>
                    259: 
                    260:                     <dt><span class="sect2"><a href=
1.23    ! wiz       261:                     "#id2624905">5.3.7. Building a partial set of
1.1       grant     262:                     packages</a></span></dt>
1.13      hubertf   263: 
                    264:                     <dt><span class="sect2"><a href=
                    265:                     "#bulk-upload">5.3.8. Uploading results of a
                    266:                     bulk build</a></span></dt>
1.1       grant     267:                   </dl>
                    268:                 </dd>
                    269: 
1.23    ! wiz       270:                 <dt><span class="sect1"><a href="#id2625274">5.4.
1.1       grant     271:                 Creating a multiple CD-ROM packages
                    272:                 collection</a></span></dt>
                    273: 
                    274:                 <dd>
                    275:                   <dl>
                    276:                     <dt><span class="sect2"><a href=
1.23    ! wiz       277:                     "#id2625289">5.4.1. Example of
1.1       grant     278:                     cdpack</a></span></dt>
                    279:                   </dl>
                    280:                 </dd>
                    281:               </dl>
                    282:             </dd>
                    283: 
                    284:             <dt><span class="chapter"><a href="#faq">6. Frequently
                    285:             Asked Questions</a></span></dt>
                    286: 
                    287:             <dd>
                    288:               <dl>
1.23    ! wiz       289:                 <dt><span class="sect1"><a href="#id2625481">6.1.
1.18      xtraeme   290:                 Are there any mailing lists for pkg-related
1.1       grant     291:                 discussion?</a></span></dt>
                    292: 
1.23    ! wiz       293:                 <dt><span class="sect1"><a href="#id2625616">6.2.
1.1       grant     294:                 Where's the pkgviews documentation?</a></span></dt>
                    295: 
1.5       hubertf   296:                 <dt><span class="sect1"><a href=
                    297:                 "#faq-pkgtools">6.3. Utilities for package
                    298:                 management (pkgtools)</a></span></dt>
1.1       grant     299: 
1.23    ! wiz       300:                 <dt><span class="sect1"><a href="#id2625937">6.4.
1.1       grant     301:                 How to use pkgsrc as non-root</a></span></dt>
                    302: 
1.23    ! wiz       303:                 <dt><span class="sect1"><a href="#id2625948">6.5.
1.15      xtraeme   304:                 How to resume transfers when fetching
                    305:                 distfiles?</a></span></dt>
1.14      xtraeme   306: 
1.23    ! wiz       307:                 <dt><span class="sect1"><a href="#id2625991">6.6.
1.1       grant     308:                 How can I install/use XFree86 from
                    309:                 pkgsrc?</a></span></dt>
                    310: 
1.23    ! wiz       311:                 <dt><span class="sect1"><a href="#id2626019">6.7.
1.1       grant     312:                 How can I install/use X.org from
                    313:                 pkgsrc?</a></span></dt>
                    314: 
1.23    ! wiz       315:                 <dt><span class="sect1"><a href="#id2626046">6.8.
1.1       grant     316:                 How to fetch files from behind a
                    317:                 firewall</a></span></dt>
                    318: 
1.23    ! wiz       319:                 <dt><span class="sect1"><a href="#id2626060">6.9.
1.14      xtraeme   320:                 How do I tell <span><strong class="command">make
                    321:                 fetch</strong></span> to do passive
1.1       grant     322:                 FTP?</a></span></dt>
                    323: 
1.23    ! wiz       324:                 <dt><span class="sect1"><a href="#id2626112">6.10.
1.1       grant     325:                 How to fetch all distfiles at once</a></span></dt>
                    326: 
1.23    ! wiz       327:                 <dt><span class="sect1"><a href="#id2626251">6.11.
1.14      xtraeme   328:                 What does &#8220;<span class="quote">Don't know how
                    329:                 to make /usr/share/tmac/tmac.andoc</span>&#8221;
                    330:                 mean?</a></span></dt>
1.13      hubertf   331: 
1.23    ! wiz       332:                 <dt><span class="sect1"><a href="#id2626290">6.12.
1.14      xtraeme   333:                 What does &#8220;<span class="quote">Could not find
                    334:                 bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant     335: 
1.23    ! wiz       336:                 <dt><span class="sect1"><a href="#id2626347">6.13.
1.1       grant     337:                 Using 'sudo' with pkgsrc</a></span></dt>
                    338: 
1.14      xtraeme   339:                 <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant     340:                 Configuration files handling and
                    341:                 placement</a></span></dt>
                    342: 
                    343:                 <dt><span class="sect1"><a href=
1.14      xtraeme   344:                 "#audit-packages">6.15. Automated security
1.1       grant     345:                 checks</a></span></dt>
                    346:               </dl>
                    347:             </dd>
                    348:           </dl>
                    349:         </dd>
                    350: 
1.2       hubertf   351:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     352:         pkgsrc developer's guide</a></span></dt>
                    353: 
                    354:         <dd>
                    355:           <dl>
                    356:             <dt><span class="chapter"><a href="#components">7.
                    357:             Package components - files, directories and
                    358:             contents</a></span></dt>
                    359: 
                    360:             <dd>
                    361:               <dl>
                    362:                 <dt><span class="sect1"><a href=
1.14      xtraeme   363:                 "#components.Makefile">7.1. <code class=
                    364:                 "filename">Makefile</code></a></span></dt>
1.1       grant     365: 
                    366:                 <dt><span class="sect1"><a href=
1.14      xtraeme   367:                 "#components.distinfo">7.2. <code class=
                    368:                 "filename">distinfo</code></a></span></dt>
1.1       grant     369: 
                    370:                 <dt><span class="sect1"><a href=
                    371:                 "#components.patches">7.3.
                    372:                 patches/*</a></span></dt>
                    373: 
1.23    ! wiz       374:                 <dt><span class="sect1"><a href="#id2627420">7.4.
1.1       grant     375:                 Other mandatory files</a></span></dt>
                    376: 
                    377:                 <dt><span class="sect1"><a href=
                    378:                 "#components.optional">7.5. Optional
                    379:                 files</a></span></dt>
                    380: 
1.23    ! wiz       381:                 <dt><span class="sect1"><a href="#id2627614">7.6.
1.14      xtraeme   382:                 <code class="filename">work*</code></a></span></dt>
1.1       grant     383: 
1.23    ! wiz       384:                 <dt><span class="sect1"><a href="#id2627702">7.7.
1.14      xtraeme   385:                 <code class=
                    386:                 "filename">files/*</code></a></span></dt>
1.1       grant     387:               </dl>
                    388:             </dd>
                    389: 
                    390:             <dt><span class="chapter"><a href="#plist">8. PLIST
                    391:             issues</a></span></dt>
                    392: 
                    393:             <dd>
                    394:               <dl>
1.23    ! wiz       395:                 <dt><span class="sect1"><a href="#id2627825">8.1.
1.1       grant     396:                 RCS ID</a></span></dt>
                    397: 
1.23    ! wiz       398:                 <dt><span class="sect1"><a href="#id2627840">8.2.
1.14      xtraeme   399:                 Semi-automatic <code class="filename">PLIST</code>
                    400:                 generation</a></span></dt>
1.1       grant     401: 
                    402:                 <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme   403:                 Tweaking output of <span><strong class=
                    404:                 "command">make
                    405:                 print-PLIST</strong></span></a></span></dt>
1.1       grant     406: 
                    407:                 <dt><span class="sect1"><a href="#plist.misc">8.4.
                    408:                 Variable substitution in PLIST</a></span></dt>
                    409: 
1.23    ! wiz       410:                 <dt><span class="sect1"><a href="#id2628229">8.5.
1.1       grant     411:                 Manpage-compression</a></span></dt>
                    412: 
1.23    ! wiz       413:                 <dt><span class="sect1"><a href="#id2628270">8.6.
1.14      xtraeme   414:                 Changing PLIST source with <code class=
                    415:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     416: 
1.23    ! wiz       417:                 <dt><span class="sect1"><a href="#id2628288">8.7.
1.1       grant     418:                 Platform specific and differing
                    419:                 PLISTs</a></span></dt>
                    420: 
                    421:                 <dt><span class="sect1"><a href=
                    422:                 "#faq.common-dirs">8.8. Sharing directories between
                    423:                 packages</a></span></dt>
                    424:               </dl>
                    425:             </dd>
                    426: 
                    427:             <dt><span class="chapter"><a href="#buildlink">9.
                    428:             Buildlink methodology</a></span></dt>
                    429: 
                    430:             <dd>
                    431:               <dl>
1.23    ! wiz       432:                 <dt><span class="sect1"><a href="#id2628486">9.1.
1.1       grant     433:                 Converting packages to use
                    434:                 buildlink3</a></span></dt>
                    435: 
1.23    ! wiz       436:                 <dt><span class="sect1"><a href="#id2628872">9.2.
1.14      xtraeme   437:                 Writing <code class="filename">buildlink3.mk</code>
                    438:                 files</a></span></dt>
1.1       grant     439: 
                    440:                 <dd>
                    441:                   <dl>
                    442:                     <dt><span class="sect2"><a href=
1.23    ! wiz       443:                     "#id2628941">9.2.1. Anatomy of a buildlink3.mk
1.1       grant     444:                     file</a></span></dt>
                    445: 
                    446:                     <dt><span class="sect2"><a href=
1.23    ! wiz       447:                     "#id2629382">9.2.2. Updating <code class=
1.14      xtraeme   448:                     "varname">BUILDLINK_DEPENDS.<em class=
                    449:                     "replaceable"><code>pkg</code></em></code> in
                    450:                     <code class="filename">buildlink3.mk</code>
1.1       grant     451:                     files</a></span></dt>
                    452:                   </dl>
                    453:                 </dd>
                    454: 
1.23    ! wiz       455:                 <dt><span class="sect1"><a href="#id2629461">9.3.
1.14      xtraeme   456:                 Writing <code class="filename">builtin.mk</code>
                    457:                 files</a></span></dt>
1.1       grant     458: 
                    459:                 <dd>
                    460:                   <dl>
                    461:                     <dt><span class="sect2"><a href=
1.23    ! wiz       462:                     "#id2629542">9.3.1. Anatomy of a <code class=
1.14      xtraeme   463:                     "filename">builtin.mk</code>
1.1       grant     464:                     file</a></span></dt>
                    465: 
                    466:                     <dt><span class="sect2"><a href=
1.23    ! wiz       467:                     "#id2629837">9.3.2. Global preferences for
1.1       grant     468:                     native or pkgsrc software</a></span></dt>
                    469:                   </dl>
                    470:                 </dd>
                    471:               </dl>
                    472:             </dd>
                    473: 
                    474:             <dt><span class="chapter"><a href="#options">10.
                    475:             Options handling</a></span></dt>
                    476: 
                    477:             <dd>
                    478:               <dl>
1.23    ! wiz       479:                 <dt><span class="sect1"><a href="#id2629910">10.1.
1.1       grant     480:                 Global default options</a></span></dt>
                    481: 
1.23    ! wiz       482:                 <dt><span class="sect1"><a href="#id2629925">10.2.
1.14      xtraeme   483:                 Converting packages to use <code class=
                    484:                 "filename">bsd.options.mk</code></a></span></dt>
1.1       grant     485:               </dl>
                    486:             </dd>
                    487: 
                    488:             <dt><span class="chapter"><a href="#build">11. The
                    489:             build process</a></span></dt>
                    490: 
                    491:             <dd>
                    492:               <dl>
                    493:                 <dt><span class="sect1"><a href=
                    494:                 "#build.prefix">11.1. Program
                    495:                 location</a></span></dt>
                    496: 
1.23    ! wiz       497:                 <dt><span class="sect1"><a href="#id2630533">11.2.
1.1       grant     498:                 Main targets</a></span></dt>
                    499: 
                    500:                 <dt><span class="sect1"><a href=
                    501:                 "#build.helpful-targets">11.3. Other helpful
                    502:                 targets</a></span></dt>
                    503:               </dl>
                    504:             </dd>
                    505: 
                    506:             <dt><span class="chapter"><a href="#fixes">12. Notes on
                    507:             fixes for packages</a></span></dt>
                    508: 
                    509:             <dd>
                    510:               <dl>
1.23    ! wiz       511:                 <dt><span class="sect1"><a href="#id2632070">12.1.
1.1       grant     512:                 General operation</a></span></dt>
                    513: 
                    514:                 <dd>
                    515:                   <dl>
                    516:                     <dt><span class="sect2"><a href=
1.23    ! wiz       517:                     "#id2632073">12.1.1. How to pull in variables
1.1       grant     518:                     from /etc/mk.conf</a></span></dt>
                    519: 
                    520:                     <dt><span class="sect2"><a href=
1.23    ! wiz       521:                     "#id2632156">12.1.2. Restricted
1.1       grant     522:                     packages</a></span></dt>
                    523: 
                    524:                     <dt><span class="sect2"><a href=
                    525:                     "#dependencies">12.1.3. Handling
                    526:                     dependencies</a></span></dt>
                    527: 
                    528:                     <dt><span class="sect2"><a href=
1.23    ! wiz       529:                     "#id2632672">12.1.4. Handling conflicts with
1.1       grant     530:                     other packages</a></span></dt>
                    531: 
                    532:                     <dt><span class="sect2"><a href=
1.23    ! wiz       533:                     "#id2632790">12.1.5. Packages that cannot or
1.1       grant     534:                     should not be built</a></span></dt>
                    535: 
                    536:                     <dt><span class="sect2"><a href=
1.23    ! wiz       537:                     "#id2632816">12.1.6. Packages which should not
1.1       grant     538:                     be deleted, once installed</a></span></dt>
                    539: 
                    540:                     <dt><span class="sect2"><a href=
                    541:                     "#security-handling">12.1.7. Handling packages
                    542:                     with security problems</a></span></dt>
                    543: 
                    544:                     <dt><span class="sect2"><a href=
1.23    ! wiz       545:                     "#id2632907">12.1.8. How to handle compiler
1.1       grant     546:                     bugs</a></span></dt>
                    547: 
                    548:                     <dt><span class="sect2"><a href=
1.23    ! wiz       549:                     "#id2632930">12.1.9. How to handle incrementing
1.1       grant     550:                     versions when fixing an existing
                    551:                     package</a></span></dt>
                    552: 
                    553:                     <dt><span class="sect2"><a href=
1.23    ! wiz       554:                     "#id2632979">12.1.10. Portability of
1.1       grant     555:                     packages</a></span></dt>
                    556:                   </dl>
                    557:                 </dd>
                    558: 
1.23    ! wiz       559:                 <dt><span class="sect1"><a href="#id2633003">12.2.
1.1       grant     560:                 Possible downloading issues</a></span></dt>
                    561: 
                    562:                 <dd>
                    563:                   <dl>
                    564:                     <dt><span class="sect2"><a href=
1.23    ! wiz       565:                     "#id2633006">12.2.1. Packages whose distfiles
1.1       grant     566:                     aren't available for plain
                    567:                     downloading</a></span></dt>
                    568: 
                    569:                     <dt><span class="sect2"><a href=
1.23    ! wiz       570:                     "#id2633069">12.2.2. How to handle modified
1.1       grant     571:                     distfiles with the 'old' name</a></span></dt>
                    572:                   </dl>
                    573:                 </dd>
                    574: 
1.23    ! wiz       575:                 <dt><span class="sect1"><a href="#id2633081">12.3.
1.1       grant     576:                 Configuration gotchas</a></span></dt>
                    577: 
                    578:                 <dd>
                    579:                   <dl>
                    580:                     <dt><span class="sect2"><a href=
                    581:                     "#fixes.libtool">12.3.1. Shared libraries -
                    582:                     libtool</a></span></dt>
                    583: 
                    584:                     <dt><span class="sect2"><a href=
1.23    ! wiz       585:                     "#id2633438">12.3.2. Using libtool on GNU
1.1       grant     586:                     packages that already support
                    587:                     libtool</a></span></dt>
                    588: 
                    589:                     <dt><span class="sect2"><a href=
1.23    ! wiz       590:                     "#id2633588">12.3.3. GNU
1.1       grant     591:                     Autoconf/Automake</a></span></dt>
                    592:                   </dl>
                    593:                 </dd>
                    594: 
1.23    ! wiz       595:                 <dt><span class="sect1"><a href="#id2633701">12.4.
1.1       grant     596:                 Building considerations</a></span></dt>
                    597: 
                    598:                 <dd>
                    599:                   <dl>
                    600:                     <dt><span class="sect2"><a href=
1.23    ! wiz       601:                     "#id2633704">12.4.1. CPP
1.1       grant     602:                     defines</a></span></dt>
                    603:                   </dl>
                    604:                 </dd>
                    605: 
1.23    ! wiz       606:                 <dt><span class="sect1"><a href="#id2633802">12.5.
1.1       grant     607:                 Package specific actions</a></span></dt>
                    608: 
                    609:                 <dd>
                    610:                   <dl>
                    611:                     <dt><span class="sect2"><a href=
1.23    ! wiz       612:                     "#id2633805">12.5.1. Package configuration
1.1       grant     613:                     files</a></span></dt>
                    614: 
                    615:                     <dt><span class="sect2"><a href=
1.23    ! wiz       616:                     "#id2633908">12.5.2. User
1.2       hubertf   617:                     interaction</a></span></dt>
1.1       grant     618: 
                    619:                     <dt><span class="sect2"><a href=
1.23    ! wiz       620:                     "#id2633953">12.5.3. Handling
1.1       grant     621:                     licenses</a></span></dt>
                    622: 
                    623:                     <dt><span class="sect2"><a href=
1.23    ! wiz       624:                     "#id2634036">12.5.4. Creating an account from a
1.1       grant     625:                     package</a></span></dt>
                    626: 
                    627:                     <dt><span class="sect2"><a href=
1.23    ! wiz       628:                     "#id2634166">12.5.5. Installing score
1.1       grant     629:                     files</a></span></dt>
                    630: 
                    631:                     <dt><span class="sect2"><a href=
1.23    ! wiz       632:                     "#id2634210">12.5.6. Packages providing login
1.1       grant     633:                     shells</a></span></dt>
                    634: 
                    635:                     <dt><span class="sect2"><a href=
1.23    ! wiz       636:                     "#id2634267">12.5.7. Packages containing perl
1.1       grant     637:                     scripts</a></span></dt>
                    638: 
                    639:                     <dt><span class="sect2"><a href=
1.23    ! wiz       640:                     "#id2634422">12.5.8. Packages with hardcoded
1.1       grant     641:                     paths to other interpreters</a></span></dt>
                    642: 
                    643:                     <dt><span class="sect2"><a href=
1.23    ! wiz       644:                     "#id2634443">12.5.9. Packages installing perl
1.1       grant     645:                     modules</a></span></dt>
                    646: 
                    647:                     <dt><span class="sect2"><a href=
                    648:                     "#faq.info-files">12.5.10. Packages installing
                    649:                     info files</a></span></dt>
                    650: 
                    651:                     <dt><span class="sect2"><a href=
1.23    ! wiz       652:                     "#id2634663">12.5.11. Packages installing
1.1       grant     653:                     GConf2 data files</a></span></dt>
                    654: 
                    655:                     <dt><span class="sect2"><a href=
1.23    ! wiz       656:                     "#id2634763">12.5.12. Packages installing
1.1       grant     657:                     scrollkeeper data files</a></span></dt>
                    658: 
                    659:                     <dt><span class="sect2"><a href=
1.23    ! wiz       660:                     "#id2634814">12.5.13. Packages installing X11
1.1       grant     661:                     fonts</a></span></dt>
                    662: 
                    663:                     <dt><span class="sect2"><a href=
1.23    ! wiz       664:                     "#id2634861">12.5.14. Packages installing GTK2
1.1       grant     665:                     modules</a></span></dt>
                    666: 
                    667:                     <dt><span class="sect2"><a href=
1.23    ! wiz       668:                     "#id2634931">12.5.15. Packages installing SGML
1.1       grant     669:                     or XML data</a></span></dt>
                    670: 
                    671:                     <dt><span class="sect2"><a href=
1.23    ! wiz       672:                     "#id2635051">12.5.16. Packages installing
1.1       grant     673:                     extensions to the MIME database</a></span></dt>
                    674: 
                    675:                     <dt><span class="sect2"><a href=
1.23    ! wiz       676:                     "#id2635190">12.5.17. Packages using
1.1       grant     677:                     intltool</a></span></dt>
1.18      xtraeme   678: 
                    679:                     <dt><span class="sect2"><a href=
1.23    ! wiz       680:                     "#id2635204">12.5.18. Packages installing
1.18      xtraeme   681:                     startup scripts</a></span></dt>
1.1       grant     682:                   </dl>
                    683:                 </dd>
                    684: 
1.23    ! wiz       685:                 <dt><span class="sect1"><a href="#id2635225">12.6.
1.1       grant     686:                 Feedback to the author</a></span></dt>
                    687:               </dl>
                    688:             </dd>
                    689: 
                    690:             <dt><span class="chapter"><a href="#debug">13.
                    691:             Debugging</a></span></dt>
                    692: 
                    693:             <dt><span class="chapter"><a href="#submit">14.
                    694:             Submitting and Committing</a></span></dt>
                    695: 
                    696:             <dd>
                    697:               <dl>
1.23    ! wiz       698:                 <dt><span class="sect1"><a href="#id2635824">14.1.
1.1       grant     699:                 Submitting your packages</a></span></dt>
                    700: 
1.23    ! wiz       701:                 <dt><span class="sect1"><a href="#id2635875">14.2.
1.1       grant     702:                 Committing: Importing a package into
                    703:                 CVS</a></span></dt>
                    704: 
1.23    ! wiz       705:                 <dt><span class="sect1"><a href="#id2635938">14.3.
1.2       hubertf   706:                 Updating a package to a newer
                    707:                 version</a></span></dt>
1.1       grant     708: 
1.23    ! wiz       709:                 <dt><span class="sect1"><a href="#id2635957">14.4.
1.2       hubertf   710:                 Moving a package in pkgsrc</a></span></dt>
1.1       grant     711:               </dl>
                    712:             </dd>
                    713:           </dl>
                    714:         </dd>
                    715: 
                    716:         <dt><span class="appendix"><a href="#examples">A. A simple
                    717:         example package: bison</a></span></dt>
                    718: 
                    719:         <dd>
                    720:           <dl>
1.23    ! wiz       721:             <dt><span class="sect1"><a href="#id2636183">A.1.
1.1       grant     722:             files</a></span></dt>
                    723: 
                    724:             <dd>
                    725:               <dl>
1.23    ! wiz       726:                 <dt><span class="sect2"><a href="#id2636186">A.1.1.
1.1       grant     727:                 Makefile</a></span></dt>
                    728: 
1.23    ! wiz       729:                 <dt><span class="sect2"><a href="#id2636194">A.1.2.
1.1       grant     730:                 DESCR</a></span></dt>
                    731: 
1.23    ! wiz       732:                 <dt><span class="sect2"><a href="#id2636209">A.1.3.
1.1       grant     733:                 PLIST</a></span></dt>
                    734: 
1.23    ! wiz       735:                 <dt><span class="sect2"><a href="#id2636216">A.1.4.
1.14      xtraeme   736:                 Checking a package with <span><strong class=
                    737:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant     738:               </dl>
                    739:             </dd>
                    740: 
1.23    ! wiz       741:             <dt><span class="sect1"><a href="#id2636257">A.2. Steps
1.1       grant     742:             for building, installing, packaging</a></span></dt>
                    743:           </dl>
                    744:         </dd>
                    745: 
                    746:         <dt><span class="appendix"><a href="#logs">B. Build
                    747:         logs</a></span></dt>
                    748: 
                    749:         <dd>
                    750:           <dl>
                    751:             <dt><span class="sect1"><a href="#logs.building">B.1.
                    752:             Building figlet</a></span></dt>
                    753: 
                    754:             <dt><span class="sect1"><a href="#logs.package">B.2.
                    755:             Packaging figlet</a></span></dt>
                    756:           </dl>
                    757:         </dd>
                    758: 
                    759:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
                    760:         of the FTP server's package archive</a></span></dt>
1.2       hubertf   761: 
                    762:         <dt><span class="appendix"><a href="#editing">D. Editing
                    763:         guidelines for the pkgsrc guide</a></span></dt>
                    764: 
                    765:         <dd>
                    766:           <dl>
1.23    ! wiz       767:             <dt><span class="sect1"><a href="#id2637176">D.1.
1.2       hubertf   768:             Targets</a></span></dt>
                    769: 
1.23    ! wiz       770:             <dt><span class="sect1"><a href="#id2637378">D.2.
1.2       hubertf   771:             Procedure</a></span></dt>
                    772:           </dl>
                    773:         </dd>
1.1       grant     774:       </dl>
                    775:     </div>
                    776: 
                    777:     <div class="chapter" lang="en" xml:lang="en">
                    778:       <div class="titlepage">
                    779:         <div>
                    780:           <div>
                    781:             <h2 class="title"><a name="introduction" id=
                    782:             "introduction"></a>Chapter&nbsp;1.&nbsp;Introduction</h2>
                    783:           </div>
                    784:         </div>
                    785:       </div>
                    786: 
                    787:       <div class="toc">
                    788:         <p><b>Table of Contents</b></p>
                    789: 
                    790:         <dl>
1.23    ! wiz       791:           <dt><span class="sect1"><a href="#id2623536">1.1.
1.1       grant     792:           Introduction</a></span></dt>
                    793: 
                    794:           <dt><span class="sect1"><a href="#overview">1.2.
                    795:           Overview</a></span></dt>
                    796: 
                    797:           <dt><span class="sect1"><a href="#terminology">1.3.
                    798:           Terminology</a></span></dt>
                    799: 
                    800:           <dt><span class="sect1"><a href="#typography">1.4.
                    801:           Typography</a></span></dt>
                    802:         </dl>
                    803:       </div>
                    804: 
                    805:       <div class="sect1" lang="en" xml:lang="en">
                    806:         <div class="titlepage">
                    807:           <div>
                    808:             <div>
                    809:               <h2 class="title" style="clear: both"><a name=
1.23    ! wiz       810:               "id2623536" id=
        !           811:               "id2623536"></a>1.1.&nbsp;Introduction</h2>
1.1       grant     812:             </div>
                    813:           </div>
                    814:         </div>
                    815: 
                    816:         <p>There is a lot of software freely available for Unix
                    817:         based systems, which usually runs on NetBSD and other
                    818:         Unix-flavoured systems, too, sometimes with some
                    819:         modifications. The NetBSD Packages Collection (pkgsrc)
                    820:         incorporates any such changes necessary to make that
                    821:         software run, and makes the installation (and
                    822:         de-installation) of the software package easy by means of a
                    823:         single command.</p>
                    824: 
                    825:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme   826:         the <span><strong class="command">pkg_*</strong></span>
                    827:         tools so that installation and de-installation, printing of
                    828:         an inventory of all installed packages and retrieval of
                    829:         one-line comments or more verbose descriptions are all
                    830:         simple.</p>
1.1       grant     831: 
                    832:         <p>pkgsrc currently contains several thousand packages,
                    833:         including:</p>
                    834: 
                    835:         <div class="itemizedlist">
                    836:           <ul type="disc">
                    837:             <li>
                    838:               <p><a xmlns=
                    839:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    840:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.20      ben       841:               class="pkgname">www/apache</a> - The Apache web
                    842:               server</p>
1.1       grant     843:             </li>
                    844: 
                    845:             <li>
                    846:               <p><a xmlns=
                    847:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    848:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20      ben       849:               class="pkgname">www/mozilla</a> - The Mozilla web
                    850:               browser</p>
1.1       grant     851:             </li>
                    852: 
                    853:             <li>
                    854:               <p><a xmlns=
                    855:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    856:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.20      ben       857:               class="pkgname">meta-pkgs/gnome</a> - The GNOME
                    858:               Desktop Environment</p>
1.1       grant     859:             </li>
                    860: 
                    861:             <li>
                    862:               <p><a xmlns=
                    863:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    864:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.20      ben       865:               class="pkgname">meta-pkgs/kde3</a> - The K Desktop
                    866:               Environment</p>
1.1       grant     867:             </li>
                    868:           </ul>
                    869:         </div>
                    870: 
                    871:         <p>...just to name a few.</p>
                    872: 
                    873:         <p>pkgsrc has built-in support for handling varying
                    874:         dependencies, such as pthreads and X11, and extended
                    875:         features such as IPv6 support on a range of platforms.</p>
                    876: 
                    877:         <p>pkgsrc was derived from FreeBSD's ports system, and
                    878:         initially developed for NetBSD only. Since then, pkgsrc has
                    879:         grown a lot, and now supports the following platforms:</p>
                    880: 
                    881:         <div class="itemizedlist">
                    882:           <ul type="disc">
                    883:             <li>
                    884:               <p><a href="http://developer.apple.com/darwin/"
                    885:               target="_top">Darwin</a> (<a href=
                    886:               "http://www.apple.com/macosx/" target="_top">Mac OS
                    887:               X</a>)</p>
                    888:             </li>
                    889: 
                    890:             <li>
1.3       hubertf   891:               <p><a href="http://www.DragonFlyBSD.org/" target=
                    892:               "_top">DragonFlyBSD</a></p>
                    893:             </li>
                    894: 
                    895:             <li>
1.1       grant     896:               <p><a href="http://www.FreeBSD.org/" target=
                    897:               "_top">FreeBSD</a></p>
                    898:             </li>
                    899: 
                    900:             <li>
1.3       hubertf   901:               <p>Microsoft Windows, via <a href=
                    902:               "http://www.microsoft.com/windows/sfu/" target=
                    903:               "_top">Interix</a></p>
1.1       grant     904:             </li>
                    905: 
                    906:             <li>
                    907:               <p><a href="http://www.sgi.com/software/irix6.5/"
                    908:               target="_top">IRIX</a></p>
                    909:             </li>
                    910: 
                    911:             <li>
                    912:               <p><a href="http://www.linux.org/" target=
                    913:               "_top">Linux</a></p>
                    914:             </li>
                    915: 
                    916:             <li>
                    917:               <p><a href="http://www.NetBSD.org/" target=
                    918:               "_top">NetBSD</a> (of course)</p>
                    919:             </li>
                    920: 
                    921:             <li>
1.17      sketch    922:               <p><a href="http://h30097.www3.hp.com/" target=
                    923:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                    924:             </li>
                    925: 
                    926:             <li>
1.1       grant     927:               <p><a href="http://www.openbsd.org/" target=
                    928:               "_top">OpenBSD</a></p>
                    929:             </li>
                    930: 
                    931:             <li>
                    932:               <p><a href="http://www.sun.com/solaris/" target=
                    933:               "_top">Solaris</a></p>
                    934:             </li>
                    935:           </ul>
                    936:         </div>
                    937:       </div>
                    938: 
                    939:       <div class="sect1" lang="en" xml:lang="en">
                    940:         <div class="titlepage">
                    941:           <div>
                    942:             <div>
                    943:               <h2 class="title" style="clear: both"><a name=
                    944:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
                    945:             </div>
                    946:           </div>
                    947:         </div>
                    948: 
                    949:         <p>This document is divided into two parts. The first,
                    950:         <a href="#users-guide" title=
1.2       hubertf   951:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
                    952:         user's guide</a>, describes how one can use one of the
                    953:         packages in the Package Collection, either by installing a
                    954:         precompiled binary package, or by building one's own copy
                    955:         using the NetBSD package system. The second part, <a href=
1.1       grant     956:         "#developers-guide" title=
1.2       hubertf   957:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                    958:         pkgsrc developer's guide</a>, explains how to prepare a
                    959:         package so it can be easily built by other NetBSD users
                    960:         without knowing about the package's building details.</p>
1.1       grant     961: 
                    962:         <p>This document is available in various formats:</p>
                    963: 
                    964:         <div class="itemizedlist">
                    965:           <ul type="disc">
                    966:             <li>
                    967:               <p><a href="index.html" target="_top">HTML</a></p>
                    968:             </li>
                    969: 
                    970:             <li>
                    971:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                    972:             </li>
                    973: 
                    974:             <li>
                    975:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                    976:             </li>
                    977: 
                    978:             <li>
                    979:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                    980:             </li>
                    981:           </ul>
                    982:         </div>
                    983:       </div>
                    984: 
                    985:       <div class="sect1" lang="en" xml:lang="en">
                    986:         <div class="titlepage">
                    987:           <div>
                    988:             <div>
                    989:               <h2 class="title" style="clear: both"><a name=
                    990:               "terminology" id=
                    991:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                    992:             </div>
                    993:           </div>
                    994:         </div>
                    995: 
                    996:         <p>There has been a lot of talk about &#8220;<span class=
                    997:         "quote">ports</span>&#8221;, &#8220;<span class=
                    998:         "quote">packages</span>&#8221;, etc. so far. Here is a
                    999:         description of all the terminology used within this
                   1000:         document.</p>
                   1001: 
                   1002:         <div class="variablelist">
                   1003:           <dl>
                   1004:             <dt><span class="term">Package</span></dt>
                   1005: 
                   1006:             <dd>
                   1007:               <p>A set of files and building instructions that
                   1008:               describe what's necessary to build a certain piece of
                   1009:               software using pkgsrc. Packages are traditionally
1.14      xtraeme  1010:               stored under <code class=
                   1011:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1012:             </dd>
                   1013: 
                   1014:             <dt><span class="term">The NetBSD package
                   1015:             system</span></dt>
                   1016: 
                   1017:             <dd>
                   1018:               <p>This is the former name of &#8220;<span class=
                   1019:               "quote">pkgsrc</span>&#8221;. It is part of the
                   1020:               NetBSD operating system and can be bootstrap to run
                   1021:               on non-NetBSD operating systems as well. It handles
                   1022:               building (compiling), installing, and removing of
                   1023:               packages.</p>
                   1024:             </dd>
                   1025: 
                   1026:             <dt><span class="term">Distfile</span></dt>
                   1027: 
                   1028:             <dd>
                   1029:               <p>This term describes the file or files that are
                   1030:               provided by the author of the piece of software to
                   1031:               distribute his work. All the changes necessary to
                   1032:               build on NetBSD are reflected in the corresponding
                   1033:               package. Usually the distfile is in the form of a
                   1034:               compressed tar-archive, but other types are possible,
1.14      xtraeme  1035:               too. Distfiles are usually stored below <code class=
                   1036:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1037:             </dd>
                   1038: 
                   1039:             <dt><span class="term">Port</span></dt>
                   1040: 
                   1041:             <dd>
                   1042:               <p>This is the term used by FreeBSD and OpenBSD
                   1043:               people for what we call a package. In NetBSD
                   1044:               terminology, &#8220;<span class=
                   1045:               "quote">port</span>&#8221; refers to a different
                   1046:               architecture.</p>
                   1047:             </dd>
                   1048: 
                   1049:             <dt><span class="term">Precompiled/binary
                   1050:             package</span></dt>
                   1051: 
                   1052:             <dd>
                   1053:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1054:               distfile and stuffed together in a single
                   1055:               <code class="filename">.tgz</code> file so it can be
                   1056:               installed on machines of the same machine
                   1057:               architecture without the need to recompile. Packages
                   1058:               are usually generated in <code class=
                   1059:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1060:               an archive on <a href=
1.1       grant    1061:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1062:               "_top">ftp.NetBSD.org</a>.</p>
                   1063: 
                   1064:               <p>Sometimes, this is referred to by the term
                   1065:               &#8220;<span class="quote">package</span>&#8221; too,
                   1066:               especially in the context of precompiled
                   1067:               packages.</p>
                   1068:             </dd>
                   1069: 
                   1070:             <dt><span class="term">Program</span></dt>
                   1071: 
                   1072:             <dd>
                   1073:               <p>The piece of software to be installed which will
                   1074:               be constructed from all the files in the Distfile by
                   1075:               the actions defined in the corresponding package.</p>
                   1076:             </dd>
                   1077:           </dl>
                   1078:         </div>
                   1079:       </div>
                   1080: 
                   1081:       <div class="sect1" lang="en" xml:lang="en">
                   1082:         <div class="titlepage">
                   1083:           <div>
                   1084:             <div>
                   1085:               <h2 class="title" style="clear: both"><a name=
                   1086:               "typography" id=
                   1087:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1088:             </div>
                   1089:           </div>
                   1090:         </div>
                   1091: 
                   1092:         <p>When giving examples for commands, shell prompts are
                   1093:         used to show if the command should/can be issued as root,
                   1094:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1095:         privileges are sufficient. We use a <code class=
                   1096:         "prompt">#</code> for root's shell prompt, and a
                   1097:         <code class="prompt">$</code> for users' shell prompt,
                   1098:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1099:       </div>
                   1100:     </div>
                   1101: 
                   1102:     <div class="part" lang="en" xml:lang="en">
                   1103:       <div class="titlepage">
                   1104:         <div>
                   1105:           <div>
                   1106:             <h1 class="title"><a name="users-guide" id=
1.2       hubertf  1107:             "users-guide"></a>The pkgsrc user's guide</h1>
1.1       grant    1108:           </div>
                   1109:         </div>
                   1110:       </div>
                   1111: 
                   1112:       <div class="toc">
                   1113:         <p><b>Table of Contents</b></p>
                   1114: 
                   1115:         <dl>
                   1116:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1117:           get pkgsrc</a></span></dt>
                   1118: 
                   1119:           <dd>
                   1120:             <dl>
1.23    ! wiz      1121:               <dt><span class="sect1"><a href="#id2569303">2.1. As
1.1       grant    1122:               tar file</a></span></dt>
                   1123: 
1.23    ! wiz      1124:               <dt><span class="sect1"><a href="#id2569319">2.2. Via
1.1       grant    1125:               SUP</a></span></dt>
                   1126: 
1.23    ! wiz      1127:               <dt><span class="sect1"><a href="#id2569351">2.3. Via
1.1       grant    1128:               CVS</a></span></dt>
                   1129:             </dl>
                   1130:           </dd>
                   1131: 
                   1132:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1133:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1134: 
                   1135:           <dd>
                   1136:             <dl>
1.23    ! wiz      1137:               <dt><span class="sect1"><a href="#id2569529">3.1.
1.1       grant    1138:               Bootstrapping pkgsrc</a></span></dt>
                   1139: 
1.23    ! wiz      1140:               <dt><span class="sect1"><a href="#id2569710">3.2.
1.1       grant    1141:               Platform specific notes</a></span></dt>
                   1142: 
                   1143:               <dd>
                   1144:                 <dl>
                   1145:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1146:                   "#id2569717">3.2.1. Darwin (Mac OS
1.1       grant    1147:                   X)</a></span></dt>
                   1148: 
                   1149:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1150:                   "#id2569879">3.2.2. FreeBSD</a></span></dt>
1.22      tv       1151: 
                   1152:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1153:                   "#id2570459">3.2.3. Interix</a></span></dt>
1.1       grant    1154: 
                   1155:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1156:                   "#id2570693">3.2.4. IRIX</a></span></dt>
1.1       grant    1157: 
                   1158:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1159:                   "#id2570777">3.2.5. Linux</a></span></dt>
1.1       grant    1160: 
                   1161:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1162:                   "#id2570838">3.2.6. OpenBSD</a></span></dt>
1.1       grant    1163: 
                   1164:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1165:                   "#id2570950">3.2.7. Solaris</a></span></dt>
1.1       grant    1166:                 </dl>
                   1167:               </dd>
                   1168:             </dl>
                   1169:           </dd>
                   1170: 
                   1171:           <dt><span class="chapter"><a href="#using">4. Using
                   1172:           pkgsrc</a></span></dt>
                   1173: 
                   1174:           <dd>
                   1175:             <dl>
                   1176:               <dt><span class="sect1"><a href=
                   1177:               "#getting-started">4.1. Working with binary
                   1178:               packages</a></span></dt>
                   1179: 
                   1180:               <dd>
                   1181:                 <dl>
                   1182:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1183:                   "#id2571155">4.1.1. Where to get binary
1.1       grant    1184:                   packages</a></span></dt>
                   1185: 
                   1186:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1187:                   "#id2571264">4.1.2. How to use binary
1.1       grant    1188:                   packages</a></span></dt>
                   1189: 
                   1190:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1191:                   "#id2571371">4.1.3. A word of
1.1       grant    1192:                   warning</a></span></dt>
                   1193:                 </dl>
                   1194:               </dd>
                   1195: 
1.23    ! wiz      1196:               <dt><span class="sect1"><a href="#id2571383">4.2.
1.1       grant    1197:               Building packages from source</a></span></dt>
                   1198: 
                   1199:               <dd>
                   1200:                 <dl>
                   1201:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1202:                   "#id2571393">4.2.1. Requirements</a></span></dt>
1.1       grant    1203: 
                   1204:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1205:                   "#id2571822">4.2.2. Fetching
1.1       grant    1206:                   distfiles</a></span></dt>
                   1207: 
                   1208:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1209:                   "#id2571875">4.2.3. How to build and
1.1       grant    1210:                   install</a></span></dt>
                   1211: 
                   1212:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1213:                   "#id2623810">4.2.4. Selecting the
1.1       grant    1214:                   compiler</a></span></dt>
                   1215:                 </dl>
                   1216:               </dd>
                   1217:             </dl>
                   1218:           </dd>
                   1219: 
                   1220:           <dt><span class="chapter"><a href="#binary">5. Creating
                   1221:           binary packages</a></span></dt>
                   1222: 
                   1223:           <dd>
                   1224:             <dl>
1.23    ! wiz      1225:               <dt><span class="sect1"><a href="#id2623896">5.1.
1.1       grant    1226:               Building a single binary package</a></span></dt>
                   1227: 
1.23    ! wiz      1228:               <dt><span class="sect1"><a href="#id2623974">5.2.
1.1       grant    1229:               Settings for creation of binary
                   1230:               packages</a></span></dt>
                   1231: 
                   1232:               <dt><span class="sect1"><a href="#bulkbuild">5.3.
                   1233:               Doing a bulk build of all packages</a></span></dt>
                   1234: 
                   1235:               <dd>
                   1236:                 <dl>
                   1237:                   <dt><span class="sect2"><a href=
                   1238:                   "#binary.configuration">5.3.1.
                   1239:                   Configuration</a></span></dt>
                   1240: 
                   1241:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1242:                   "#id2624115">5.3.2. Other environmental
1.1       grant    1243:                   considerations</a></span></dt>
                   1244: 
                   1245:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1246:                   "#id2624155">5.3.3. Operation</a></span></dt>
1.1       grant    1247: 
                   1248:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1249:                   "#id2624225">5.3.4. What it does</a></span></dt>
1.1       grant    1250: 
                   1251:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1252:                   "#id2624281">5.3.5. Disk space
1.1       grant    1253:                   requirements</a></span></dt>
                   1254: 
                   1255:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1256:                   "#id2624308">5.3.6. Setting up a sandbox for
1.1       grant    1257:                   chroot'ed builds</a></span></dt>
                   1258: 
                   1259:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1260:                   "#id2624905">5.3.7. Building a partial set of
1.1       grant    1261:                   packages</a></span></dt>
1.13      hubertf  1262: 
                   1263:                   <dt><span class="sect2"><a href=
                   1264:                   "#bulk-upload">5.3.8. Uploading results of a bulk
                   1265:                   build</a></span></dt>
1.1       grant    1266:                 </dl>
                   1267:               </dd>
                   1268: 
1.23    ! wiz      1269:               <dt><span class="sect1"><a href="#id2625274">5.4.
1.1       grant    1270:               Creating a multiple CD-ROM packages
                   1271:               collection</a></span></dt>
                   1272: 
                   1273:               <dd>
                   1274:                 <dl>
                   1275:                   <dt><span class="sect2"><a href=
1.23    ! wiz      1276:                   "#id2625289">5.4.1. Example of
1.1       grant    1277:                   cdpack</a></span></dt>
                   1278:                 </dl>
                   1279:               </dd>
                   1280:             </dl>
                   1281:           </dd>
                   1282: 
                   1283:           <dt><span class="chapter"><a href="#faq">6. Frequently
                   1284:           Asked Questions</a></span></dt>
                   1285: 
                   1286:           <dd>
                   1287:             <dl>
1.23    ! wiz      1288:               <dt><span class="sect1"><a href="#id2625481">6.1. Are
1.18      xtraeme  1289:               there any mailing lists for pkg-related
1.1       grant    1290:               discussion?</a></span></dt>
                   1291: 
1.23    ! wiz      1292:               <dt><span class="sect1"><a href="#id2625616">6.2.
1.1       grant    1293:               Where's the pkgviews documentation?</a></span></dt>
                   1294: 
1.5       hubertf  1295:               <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    1296:               Utilities for package management
                   1297:               (pkgtools)</a></span></dt>
                   1298: 
1.23    ! wiz      1299:               <dt><span class="sect1"><a href="#id2625937">6.4. How
1.1       grant    1300:               to use pkgsrc as non-root</a></span></dt>
                   1301: 
1.23    ! wiz      1302:               <dt><span class="sect1"><a href="#id2625948">6.5. How
1.15      xtraeme  1303:               to resume transfers when fetching
                   1304:               distfiles?</a></span></dt>
1.14      xtraeme  1305: 
1.23    ! wiz      1306:               <dt><span class="sect1"><a href="#id2625991">6.6. How
1.1       grant    1307:               can I install/use XFree86 from
                   1308:               pkgsrc?</a></span></dt>
                   1309: 
1.23    ! wiz      1310:               <dt><span class="sect1"><a href="#id2626019">6.7. How
1.1       grant    1311:               can I install/use X.org from pkgsrc?</a></span></dt>
                   1312: 
1.23    ! wiz      1313:               <dt><span class="sect1"><a href="#id2626046">6.8. How
1.1       grant    1314:               to fetch files from behind a firewall</a></span></dt>
                   1315: 
1.23    ! wiz      1316:               <dt><span class="sect1"><a href="#id2626060">6.9. How
1.14      xtraeme  1317:               do I tell <span><strong class="command">make
                   1318:               fetch</strong></span> to do passive
1.1       grant    1319:               FTP?</a></span></dt>
                   1320: 
1.23    ! wiz      1321:               <dt><span class="sect1"><a href="#id2626112">6.10.
1.14      xtraeme  1322:               How to fetch all distfiles at once</a></span></dt>
1.1       grant    1323: 
1.23    ! wiz      1324:               <dt><span class="sect1"><a href="#id2626251">6.11.
1.14      xtraeme  1325:               What does &#8220;<span class="quote">Don't know how
                   1326:               to make /usr/share/tmac/tmac.andoc</span>&#8221;
                   1327:               mean?</a></span></dt>
1.13      hubertf  1328: 
1.23    ! wiz      1329:               <dt><span class="sect1"><a href="#id2626290">6.12.
1.14      xtraeme  1330:               What does &#8220;<span class="quote">Could not find
                   1331:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1332: 
1.23    ! wiz      1333:               <dt><span class="sect1"><a href="#id2626347">6.13.
1.1       grant    1334:               Using 'sudo' with pkgsrc</a></span></dt>
                   1335: 
1.14      xtraeme  1336:               <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    1337:               Configuration files handling and
                   1338:               placement</a></span></dt>
                   1339: 
                   1340:               <dt><span class="sect1"><a href=
1.14      xtraeme  1341:               "#audit-packages">6.15. Automated security
1.1       grant    1342:               checks</a></span></dt>
                   1343:             </dl>
                   1344:           </dd>
                   1345:         </dl>
                   1346:       </div>
                   1347: 
                   1348:       <div class="chapter" lang="en" xml:lang="en">
                   1349:         <div class="titlepage">
                   1350:           <div>
                   1351:             <div>
                   1352:               <h2 class="title"><a name="getting" id=
                   1353:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1354:               pkgsrc</h2>
                   1355:             </div>
                   1356:           </div>
                   1357:         </div>
                   1358: 
                   1359:         <div class="toc">
                   1360:           <p><b>Table of Contents</b></p>
                   1361: 
                   1362:           <dl>
1.23    ! wiz      1363:             <dt><span class="sect1"><a href="#id2569303">2.1. As
1.1       grant    1364:             tar file</a></span></dt>
                   1365: 
1.23    ! wiz      1366:             <dt><span class="sect1"><a href="#id2569319">2.2. Via
1.1       grant    1367:             SUP</a></span></dt>
                   1368: 
1.23    ! wiz      1369:             <dt><span class="sect1"><a href="#id2569351">2.3. Via
1.1       grant    1370:             CVS</a></span></dt>
                   1371:           </dl>
                   1372:         </div>
                   1373: 
                   1374:         <p>There are three ways to get pkgsrc. Either as a tar
                   1375:         file, via SUP, or via CVS. All three ways are described
                   1376:         here.</p>
                   1377: 
                   1378:         <div class="sect1" lang="en" xml:lang="en">
                   1379:           <div class="titlepage">
                   1380:             <div>
                   1381:               <div>
                   1382:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      1383:                 "id2569303" id="id2569303"></a>2.1.&nbsp;As tar
1.1       grant    1384:                 file</h2>
                   1385:               </div>
                   1386:             </div>
                   1387:           </div>
                   1388: 
                   1389:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1390:           file from <a href=
1.11      ben      1391:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20      ben      1392:           target="_top">ftp.NetBSD.org</a> and unpack it into
                   1393:           <code class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1394:         </div>
                   1395: 
                   1396:         <div class="sect1" lang="en" xml:lang="en">
                   1397:           <div class="titlepage">
                   1398:             <div>
                   1399:               <div>
                   1400:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      1401:                 "id2569319" id="id2569319"></a>2.2.&nbsp;Via
1.1       grant    1402:                 SUP</h2>
                   1403:               </div>
                   1404:             </div>
                   1405:           </div>
                   1406: 
                   1407:           <p>As an alternative to the tar file, you can get pkgsrc
                   1408:           via the Software Update Protocol, SUP. To do so, make
                   1409:           sure your supfile has a line</p>
                   1410:           <pre class="programlisting">
                   1411: release=pkgsrc
                   1412: </pre>
                   1413: 
1.14      xtraeme  1414:           <p>in it, see the examples in <code class=
                   1415:           "filename">/usr/share/examples/supfiles</code>, and that
                   1416:           the <code class="filename">/usr/pkgsrc</code> directory
                   1417:           exists. Then, simply run <span><strong class=
                   1418:           "command">sup -v <em class=
                   1419:           "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1420:         </div>
                   1421: 
                   1422:         <div class="sect1" lang="en" xml:lang="en">
                   1423:           <div class="titlepage">
                   1424:             <div>
                   1425:               <div>
                   1426:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      1427:                 "id2569351" id="id2569351"></a>2.3.&nbsp;Via
1.1       grant    1428:                 CVS</h2>
                   1429:               </div>
                   1430:             </div>
                   1431:           </div>
                   1432: 
                   1433:           <p>To get pkgsrc via CVS, make sure you have
                   1434:           &#8220;<span class="quote">cvs</span>&#8221; installed.
                   1435:           If not present on your system, it can be found as
                   1436:           precompiled binary on ftp.NetBSD.org. To do an initial
                   1437:           (full) checkout of pkgsrc, do the following steps:</p>
                   1438:           <pre class="screen">
1.14      xtraeme  1439: <code class="prompt">%</code> <strong class=
                   1440: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1441: <code class="prompt">%</code> <strong class=
                   1442: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1443: <code class="prompt">%</code> <strong class=
                   1444: "userinput"><code>cd /usr</code></strong>
                   1445: <code class="prompt">%</code> <strong class=
                   1446: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1447: </pre>
                   1448: 
                   1449:           <p>This will create the <code class=
                   1450:           "filename">pkgsrc</code> directory in your <code class=
                   1451:           "filename">/usr</code>, and all the package source will
                   1452:           be stored under <code class=
                   1453:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1454:           initial checkout, make sure you have <code class=
                   1455:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1456:           <pre class="screen">
1.14      xtraeme  1457: <code class="prompt">%</code> <strong class=
                   1458: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1459: <code class="prompt">%</code> <strong class=
                   1460: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1461: </pre>
                   1462: 
                   1463:           <p>Please also note that it is possible to have multiple
                   1464:           copies of the pkgsrc hierarchy in use at any one time -
                   1465:           all work is done relatively within the pkgsrc tree.</p>
                   1466:         </div>
                   1467:       </div>
                   1468: 
                   1469:       <div class="chapter" lang="en" xml:lang="en">
                   1470:         <div class="titlepage">
                   1471:           <div>
                   1472:             <div>
                   1473:               <h2 class="title"><a name="platforms" id=
                   1474:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1475:               systems other than NetBSD</h2>
                   1476:             </div>
                   1477:           </div>
                   1478:         </div>
                   1479: 
                   1480:         <div class="toc">
                   1481:           <p><b>Table of Contents</b></p>
                   1482: 
                   1483:           <dl>
1.23    ! wiz      1484:             <dt><span class="sect1"><a href="#id2569529">3.1.
1.1       grant    1485:             Bootstrapping pkgsrc</a></span></dt>
                   1486: 
1.23    ! wiz      1487:             <dt><span class="sect1"><a href="#id2569710">3.2.
1.1       grant    1488:             Platform specific notes</a></span></dt>
                   1489: 
                   1490:             <dd>
                   1491:               <dl>
1.23    ! wiz      1492:                 <dt><span class="sect2"><a href="#id2569717">3.2.1.
1.1       grant    1493:                 Darwin (Mac OS X)</a></span></dt>
                   1494: 
1.23    ! wiz      1495:                 <dt><span class="sect2"><a href="#id2569879">3.2.2.
1.1       grant    1496:                 FreeBSD</a></span></dt>
                   1497: 
1.23    ! wiz      1498:                 <dt><span class="sect2"><a href="#id2570459">3.2.3.
1.1       grant    1499:                 Interix</a></span></dt>
                   1500: 
1.23    ! wiz      1501:                 <dt><span class="sect2"><a href="#id2570693">3.2.4.
1.1       grant    1502:                 IRIX</a></span></dt>
                   1503: 
1.23    ! wiz      1504:                 <dt><span class="sect2"><a href="#id2570777">3.2.5.
1.22      tv       1505:                 Linux</a></span></dt>
                   1506: 
1.23    ! wiz      1507:                 <dt><span class="sect2"><a href="#id2570838">3.2.6.
1.1       grant    1508:                 OpenBSD</a></span></dt>
                   1509: 
1.23    ! wiz      1510:                 <dt><span class="sect2"><a href="#id2570950">3.2.7.
1.1       grant    1511:                 Solaris</a></span></dt>
                   1512:               </dl>
                   1513:             </dd>
                   1514:           </dl>
                   1515:         </div>
                   1516: 
                   1517:         <div class="sect1" lang="en" xml:lang="en">
                   1518:           <div class="titlepage">
                   1519:             <div>
                   1520:               <div>
                   1521:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      1522:                 "id2569529" id=
        !          1523:                 "id2569529"></a>3.1.&nbsp;Bootstrapping pkgsrc</h2>
1.1       grant    1524:               </div>
                   1525:             </div>
                   1526:           </div>
                   1527: 
                   1528:           <p>For Operating Systems other than NetBSD, we provide a
                   1529:           bootstrap kit to build the required tools to use pkgsrc
                   1530:           on your platform. Besides support for native NetBSD,
                   1531:           pkgsrc and the bootstrap kit have support for the
                   1532:           following operating systems:</p>
                   1533: 
                   1534:           <div class="itemizedlist">
                   1535:             <ul type="disc">
                   1536:               <li>
                   1537:                 <p>Darwin (Mac OS X)</p>
                   1538:               </li>
                   1539: 
                   1540:               <li>
1.16      grant    1541:                 <p>DragonFlyBSD</p>
                   1542:               </li>
                   1543: 
                   1544:               <li>
1.1       grant    1545:                 <p>FreeBSD</p>
                   1546:               </li>
                   1547: 
                   1548:               <li>
                   1549:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1550:               </li>
                   1551: 
                   1552:               <li>
                   1553:                 <p>IRIX</p>
                   1554:               </li>
                   1555: 
                   1556:               <li>
                   1557:                 <p>Linux</p>
                   1558:               </li>
                   1559: 
                   1560:               <li>
                   1561:                 <p>OpenBSD</p>
                   1562:               </li>
                   1563: 
                   1564:               <li>
                   1565:                 <p>Solaris</p>
                   1566:               </li>
1.16      grant    1567: 
                   1568:               <li>
                   1569:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1570:               </li>
1.1       grant    1571:             </ul>
                   1572:           </div>
                   1573: 
                   1574:           <p>Support for other platforms is under development.</p>
                   1575: 
                   1576:           <p>Installing the bootstrap kit should be as simple
                   1577:           as:</p>
                   1578:           <pre class="screen">
1.14      xtraeme  1579: <code class="prompt">#</code> <strong class=
                   1580: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1581: <code class="prompt">#</code> <strong class=
                   1582: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1583: <code class="prompt">#</code> <strong class=
                   1584: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1585: </pre>
                   1586: 
                   1587:           <p>See <a href="#getting" title=
                   1588:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter 2,
                   1589:           <i>Where to get pkgsrc</i></a> for other ways to get
1.14      xtraeme  1590:           pkgsrc before bootstrapping. The given
                   1591:           <span><strong class="command">bootstrap</strong></span>
                   1592:           command will use the defaults of <code class=
                   1593:           "filename">/usr/pkg</code> for the <span class=
                   1594:           "emphasis"><em>prefix</em></span> where programs will be
                   1595:           installed in, and <code class=
                   1596:           "filename">/var/db/pkg</code> for the package database
1.1       grant    1597:           directory where pkgsrc will do it's internal bookkeeping.
                   1598:           However, these can also be set using command-line
                   1599:           parameters.</p>
                   1600: 
                   1601:           <p>Binary packages for the pkgsrc tools and an initial
                   1602:           set of packages is available for supported platforms. An
                   1603:           up-to-date list of these can be found on <a href=
                   1604:           "http://www.pkgsrc.org/" target=
                   1605:           "_top">www.pkgsrc.org</a>.</p>
                   1606:         </div>
                   1607: 
                   1608:         <div class="sect1" lang="en" xml:lang="en">
                   1609:           <div class="titlepage">
                   1610:             <div>
                   1611:               <div>
                   1612:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      1613:                 "id2569710" id="id2569710"></a>3.2.&nbsp;Platform
1.1       grant    1614:                 specific notes</h2>
                   1615:               </div>
                   1616:             </div>
                   1617:           </div>
                   1618: 
                   1619:           <p>Here are some platform-specific notes you should be
                   1620:           aware of.</p>
                   1621: 
                   1622:           <div class="sect2" lang="en" xml:lang="en">
                   1623:             <div class="titlepage">
                   1624:               <div>
                   1625:                 <div>
1.23    ! wiz      1626:                   <h3 class="title"><a name="id2569717" id=
        !          1627:                   "id2569717"></a>3.2.1.&nbsp;Darwin (Mac OS
1.1       grant    1628:                   X)</h3>
                   1629:                 </div>
                   1630:               </div>
                   1631:             </div>
                   1632: 
                   1633:             <p>Darwin 5.x and 6.x are supported. There are two
                   1634:             methods of using pkgsrc on Mac OS X, by using a
                   1635:             <a href="#platform.osx-image" title=
                   1636:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1637:             <a href="#platform.osx-ufs" title=
                   1638:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1639:             partition</a>.</p>
                   1640: 
                   1641:             <p>Before you start, you will need to download and
                   1642:             install the Mac OS X Developer Tools from Apple's
                   1643:             Developer Connection. See <a href=
                   1644:             "http://developer.apple.com/macosx/" target=
                   1645:             "_top">http://developer.apple.com/macosx/</a> for
                   1646:             details. Also, make sure you install X11 for Mac OS X
                   1647:             and the X11 SDK from <a href=
                   1648:             "http://www.apple.com/macosx/x11/download/" target=
                   1649:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1650:             you intend to build packages that use the X11 Window
                   1651:             System.</p>
                   1652: 
                   1653:             <p>If you already have a UFS partition, or have a spare
                   1654:             partition that you can format as UFS, it is recommended
                   1655:             to use that instead of the disk image. It'll be
                   1656:             somewhat faster and will mount automatically at boot
                   1657:             time, where you must manually mount a disk image.</p>
                   1658: 
                   1659:             <div class="note" style=
                   1660:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1661:               <h3 class="title">Note</h3>
                   1662: 
                   1663:               <p>You cannot use a HFS+ file system for pkgsrc,
                   1664:               because pkgsrc currently requires the filesystem to
                   1665:               be case-sensitive, and HFS+ is not.</p>
                   1666:             </div>
                   1667: 
                   1668:             <div class="sect3" lang="en" xml:lang="en">
                   1669:               <div class="titlepage">
                   1670:                 <div>
                   1671:                   <div>
                   1672:                     <h4 class="title"><a name="platform.osx-image"
                   1673:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
                   1674:                     a disk image</h4>
                   1675:                   </div>
                   1676:                 </div>
                   1677:               </div>
                   1678: 
                   1679:               <p>Create the disk image:</p>
                   1680:               <pre class="screen">
1.14      xtraeme  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>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   1685: <code class="prompt">#</code> <strong class=
                   1686: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   1687: <code class="prompt">#</code> <strong class=
                   1688: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    1689: </pre>
                   1690: 
                   1691:               <p>That's it!</p>
                   1692:             </div>
                   1693: 
                   1694:             <div class="sect3" lang="en" xml:lang="en">
                   1695:               <div class="titlepage">
                   1696:                 <div>
                   1697:                   <div>
                   1698:                     <h4 class="title"><a name="platform.osx-ufs"
                   1699:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
                   1700:                     UFS partition</h4>
                   1701:                   </div>
                   1702:                 </div>
                   1703:               </div>
                   1704: 
1.14      xtraeme  1705:               <p>By default, <code class="filename">/usr</code>
                   1706:               will be on your root file system, normally HFS+. It
                   1707:               is possible to use the default <span class=
                   1708:               "emphasis"><em>prefix</em></span> of <code class=
                   1709:               "filename">/usr/pkg</code> by symlinking <code class=
                   1710:               "filename">/usr/pkg</code> to a directory on a UFS
                   1711:               file system. Obviously, another symlink is required
                   1712:               if you want to place the package database directory
                   1713:               outside the <span class=
                   1714:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    1715:               <pre class="screen">
1.14      xtraeme  1716: <code class="prompt">#</code> <strong class=
1.22      tv       1717: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1       grant    1718: </pre>
                   1719: 
                   1720:               <p>If you created your partitions at the time of
                   1721:               installing Mac OS X and formatted the target
                   1722:               partition as UFS, it should automatically mount on
1.14      xtraeme  1723:               <code class="filename">/Volumes/&lt;volume
                   1724:               name&gt;</code> when the machine boots. If you are
1.1       grant    1725:               (re)formatting a partition as UFS, you need to ensure
                   1726:               that the partition map correctly reflects
                   1727:               &#8220;<span class="quote">Apple_UFS</span>&#8221;
                   1728:               and not &#8220;<span class=
                   1729:               "quote">Apple_HFS</span>&#8221;.</p>
                   1730: 
                   1731:               <p>The problem is that none of the disk tools will
                   1732:               let you touch a disk that is booted from. You can
                   1733:               unmount the partition, but even if you newfs it, the
                   1734:               partition type will be incorrect and the automounter
                   1735:               won't mount it. It can be mounted manually, but it
                   1736:               won't appear in Finder.</p>
                   1737: 
                   1738:               <p>You'll need to boot off of the OS X Installation
                   1739:               (User) CD. When the Installation program starts, go
                   1740:               up to the menu and select Disk Utility. Now, you will
                   1741:               be able to select the partition you want to be UFS,
                   1742:               and Format it Apple UFS. Quit the Disk Utility, quit
                   1743:               the installer which will reboot your machine. The new
                   1744:               UFS file system will appear in Finder.</p>
                   1745: 
                   1746:               <p>Be aware that the permissions on the new file
                   1747:               system will be writable by root only.</p>
                   1748: 
                   1749:               <p>This note is as of 10.2 (Jaguar) and applies to
                   1750:               earlier versions. Hopefully Apple will fix Disk
                   1751:               Utility in 10.3 (Panther).</p>
                   1752:             </div>
                   1753:           </div>
                   1754: 
                   1755:           <div class="sect2" lang="en" xml:lang="en">
                   1756:             <div class="titlepage">
                   1757:               <div>
                   1758:                 <div>
1.23    ! wiz      1759:                   <h3 class="title"><a name="id2569879" id=
        !          1760:                   "id2569879"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    1761:                 </div>
                   1762:               </div>
                   1763:             </div>
                   1764: 
                   1765:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   1766:             supported, other versions may work.</p>
                   1767: 
                   1768:             <p>Care should be taken so that the tools that this kit
                   1769:             installs do not conflict with the FreeBSD userland
                   1770:             tools. There are several steps:</p>
                   1771: 
                   1772:             <div class="orderedlist">
                   1773:               <ol type="1">
                   1774:                 <li>
                   1775:                   <p>FreeBSD stores its ports pkg database in
1.14      xtraeme  1776:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    1777:                   therefore recommended that you choose a different
1.14      xtraeme  1778:                   location (e.g. <code class=
                   1779:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    1780:                   --pkgdbdir option to the bootstrap script.</p>
                   1781:                 </li>
                   1782: 
                   1783:                 <li>
                   1784:                   <p>If you do not intend to use the FreeBSD ports
                   1785:                   tools, it's probably a good idea to move them out
                   1786:                   of the way to avoid confusion, e.g.</p>
                   1787:                   <pre class="screen">
1.14      xtraeme  1788: <code class="prompt">#</code> <strong class=
                   1789: "userinput"><code>cd /usr/sbin</code></strong>
                   1790: <code class="prompt">#</code> <strong class=
                   1791: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   1792: <code class="prompt">#</code> <strong class=
                   1793: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   1794: <code class="prompt">#</code> <strong class=
                   1795: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   1796: <code class="prompt">#</code> <strong class=
                   1797: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    1798: </pre>
                   1799:                 </li>
                   1800: 
                   1801:                 <li>
1.14      xtraeme  1802:                   <p>An example <code class=
                   1803:                   "filename">/etc/mk.conf</code> file will be
                   1804:                   placed in <code class=
                   1805:                   "filename">/etc/mk.conf.example</code> file when
                   1806:                   you use the bootstrap script.</p>
1.1       grant    1807:                 </li>
                   1808:               </ol>
                   1809:             </div>
                   1810:           </div>
                   1811: 
                   1812:           <div class="sect2" lang="en" xml:lang="en">
                   1813:             <div class="titlepage">
                   1814:               <div>
                   1815:                 <div>
1.23    ! wiz      1816:                   <h3 class="title"><a name="id2570459" id=
        !          1817:                   "id2570459"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    1818:                 </div>
                   1819:               </div>
                   1820:             </div>
                   1821: 
                   1822:             <p>Interix is a POSIX compatible subsystem for the
                   1823:             Windows NT kernel, providing a Unix-like environment
                   1824:             with a tighter kernel integration than available with
                   1825:             Cygwin. It is part of the Windows Services for Unix
                   1826:             package, available for free for any licensed copy of
1.22      tv       1827:             Windows 2000, XP (not including XP Home), or 2003. SFU
                   1828:             can be downloaded from <a href=
                   1829:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    1830:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   1831: 
                   1832:             <p>Services for Unix 3.5, current as of this writing,
                   1833:             has been tested. 3.0 or 3.1 may work, but are not
                   1834:             officially supported. (The main difference in 3.0/3.1
                   1835:             is lack of pthreads.)</p>
                   1836: 
                   1837:             <div class="sect3" lang="en" xml:lang="en">
                   1838:               <div class="titlepage">
                   1839:                 <div>
                   1840:                   <div>
                   1841:                     <h4 class="title"><a name=
                   1842:                     "platform.interix-sfu-install" id=
                   1843:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  1844:                     installing Interix/SFU</h4>
1.1       grant    1845:                   </div>
                   1846:                 </div>
                   1847:               </div>
                   1848: 
                   1849:               <p>At an absolute minimum, the following packages
                   1850:               must be installed from the Windows Services for Unix
                   1851:               3.5 distribution in order to use pkgsrc:</p>
                   1852: 
                   1853:               <div class="itemizedlist">
                   1854:                 <ul type="disc">
                   1855:                   <li>
                   1856:                     <p>Utilities -&gt; Base Utilities</p>
                   1857:                   </li>
                   1858: 
                   1859:                   <li>
                   1860:                     <p>Interix GNU Components -&gt; (all)</p>
                   1861:                   </li>
                   1862: 
                   1863:                   <li>
                   1864:                     <p>Remote Connectivity</p>
                   1865:                   </li>
                   1866: 
                   1867:                   <li>
                   1868:                     <p>Interix SDK</p>
                   1869:                   </li>
                   1870:                 </ul>
                   1871:               </div>
                   1872: 
                   1873:               <p>When using pkgsrc on Interix, DO NOT install the
                   1874:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   1875:               without shared module support, installed to
                   1876:               /usr/local, and will only cause confusion. Instead,
                   1877:               install Perl 5.8 from pkgsrc (or from a binary
                   1878:               package).</p>
                   1879: 
                   1880:               <p>The Remote Connectivity subcomponent "Windows
                   1881:               Remote Shell Service" does not need to be installed,
                   1882:               but Remote Connectivity itself should be installed in
                   1883:               order to have a working inetd.</p>
                   1884: 
                   1885:               <p>Finally, during installation you may be asked
                   1886:               whether to enable setuid behavior for Interix
                   1887:               programs, and whether to make pathnames default to
                   1888:               case-sensitive. Setuid should be enabled, and
                   1889:               case-sensitivity MUST be enabled. (Without
                   1890:               case-sensitivity, a large number of packages
                   1891:               including perl will not build.)</p>
                   1892:             </div>
                   1893: 
                   1894:             <div class="sect3" lang="en" xml:lang="en">
                   1895:               <div class="titlepage">
                   1896:                 <div>
                   1897:                   <div>
                   1898:                     <h4 class="title"><a name=
                   1899:                     "platform.interix-sfu-postinstall" id=
                   1900:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   1901:                     to do if Interix/SFU is already installed</h4>
                   1902:                   </div>
                   1903:                 </div>
                   1904:               </div>
                   1905: 
                   1906:               <p>If SFU is already installed and you wish to alter
                   1907:               these settings to work with pkgsrc, note the
                   1908:               following things.</p>
                   1909: 
                   1910:               <div class="itemizedlist">
                   1911:                 <ul type="disc">
                   1912:                   <li>
                   1913:                     <p>To uninstall UNIX Perl, use Add/Remove
                   1914:                     Programs, select Microsoft Windows Services for
                   1915:                     UNIX, then click Change. In the installer,
                   1916:                     choose Add or Remove, then uncheck
                   1917:                     Utilities-&gt;UNIX Perl.</p>
                   1918:                   </li>
                   1919: 
                   1920:                   <li>
                   1921:                     <p>To enable case-sensitivity for the
                   1922:                     filesystem, run REGEDIT.EXE, and change the
                   1923:                     following registry key:</p>
                   1924: 
                   1925:                     <p>
                   1926:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   1927:                     Manager\kernel</p>
                   1928: 
                   1929:                     <p>Set the DWORD value "obcaseinsensitive" to
                   1930:                     0; then reboot.</p>
                   1931:                   </li>
                   1932: 
                   1933:                   <li>
                   1934:                     <p>To enable setuid binaries (optional), run
                   1935:                     REGEDIT.EXE, and change the following registry
                   1936:                     key:</p>
                   1937: 
                   1938:                     <p>
                   1939:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   1940:                     for UNIX</p>
                   1941: 
                   1942:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   1943:                     to 1; then reboot.</p>
                   1944:                   </li>
                   1945:                 </ul>
                   1946:               </div>
                   1947:             </div>
                   1948: 
                   1949:             <div class="sect3" lang="en" xml:lang="en">
                   1950:               <div class="titlepage">
                   1951:                 <div>
                   1952:                   <div>
                   1953:                     <h4 class="title"><a name=
                   1954:                     "platform.interix-notes" id=
                   1955:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   1956:                     notes for using pkgsrc</h4>
                   1957:                   </div>
                   1958:                 </div>
                   1959:               </div>
                   1960: 
                   1961:               <p>The package imanager (either the pkgsrc "su" user,
                   1962:               or the user running "pkg_add") must be a member of
                   1963:               the local Administrators group. Such a user must also
                   1964:               be used to run the bootstrap. This is slightly
                   1965:               relaxed from the normal pkgsrc requirement of
                   1966:               "root".</p>
                   1967: 
                   1968:               <p>The package manager should use a umask of 002.
                   1969:               "make install" will automatically complain if this is
                   1970:               not the case. This ensures that directories written
                   1971:               in /var/db/pkg are Administrators-group
                   1972:               writeable.</p>
                   1973: 
                   1974:               <p>The popular Interix binary packages from
                   1975:               http://www.interopsystems.com/ use an older version
                   1976:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   1977:               used in conjunction with pkgsrc. If you choose to use
                   1978:               them at the same time as the pkgsrc packages, ensure
                   1979:               that you use the proper pkg_* tools for each type of
                   1980:               binary package.</p>
1.22      tv       1981: 
                   1982:               <p>The TERM setting used for DOS-type console windows
                   1983:               (including those invoked by the csh and ksh startup
                   1984:               shortcuts) is "interix". Most systems don't have a
                   1985:               termcap/terminfo entry for it, but the following
                   1986:               .termcap entry provides adequate emulation in most
                   1987:               cases:</p>
                   1988:               <pre class="programlisting">
                   1989: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
                   1990: </pre>
1.1       grant    1991:             </div>
                   1992:           </div>
                   1993: 
                   1994:           <div class="sect2" lang="en" xml:lang="en">
                   1995:             <div class="titlepage">
                   1996:               <div>
                   1997:                 <div>
1.23    ! wiz      1998:                   <h3 class="title"><a name="id2570693" id=
        !          1999:                   "id2570693"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    2000:                 </div>
                   2001:               </div>
                   2002:             </div>
                   2003: 
                   2004:             <p>You will need a working C compiler, either gcc or
                   2005:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  2006:             the <code class="varname">CC</code> environment
                   2007:             variable according to your preference. If you do not
                   2008:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2009:             download a gcc tardist file from <a href=
                   2010:             "http://freeware.sgi.com/" target=
                   2011:             "_top">http://freeware.sgi.com/</a>.</p>
                   2012: 
                   2013:             <p>Please note that you will need IRIX 6.5.17 or
                   2014:             higher, as this is the earliest version of IRIX
                   2015:             providing support for if_indextoname(3),
                   2016:             if_nametoindex(3), etc.</p>
                   2017: 
                   2018:             <p>At this point in time, pkgsrc only supports one ABI.
                   2019:             That is, you can not switch between the old 32-bit ABI,
                   2020:             the new 32-bit ABI and the 64-bit ABI. If you start out
                   2021:             using "abi=n32", that's what all your packages will be
                   2022:             built with.</p>
                   2023: 
                   2024:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2025:             conflicting <code class="varname">CFLAGS</code> in your
                   2026:             environment or the <code class=
                   2027:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2028:             that you do not try to link n32 object files with lib64
1.14      xtraeme  2029:             or vice versa. Check your <code class=
                   2030:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2031: 
                   2032:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2033:             from a different host, please make sure to set
1.14      xtraeme  2034:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2035:             directory, as it appears that IRIX linker occasionally
                   2036:             runs into issues when trying to link over a network
                   2037:             mounted filesystem.</p>
                   2038: 
                   2039:             <p>The bootstrapping process should set all the right
                   2040:             options for programs such as imake(1), but you may want
                   2041:             to set some options depending on your local setup.
1.14      xtraeme  2042:             Please see <code class=
                   2043:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.1       grant    2044:             course, your compilers man pages for details.</p>
1.22      tv       2045: 
                   2046:             <p>If you are using SGI's MIPSPro compiler, please
                   2047:             set</p>
                   2048:             <pre class="programlisting">
                   2049: PKGSRC_COMPILER=mipspro
                   2050: </pre>
                   2051: 
                   2052:             <p>in <code class="filename">/etc/mk.conf</code>.
                   2053:             Otherwise, pkgsrc will assume you are using gcc and may
                   2054:             end up passing invalid flags to the compiler. Note that
                   2055:             bootstrap should create an appropriate <code class=
                   2056:             "filename">mk.conf.example</code> by default.</p>
                   2057: 
                   2058:             <p>If you have both the MIPSPro compiler chain
                   2059:             installed as well as gcc, but want to make sure that
                   2060:             MIPRPro is used, please set your <code class=
                   2061:             "varname">PATH</code> to <span class=
                   2062:             "emphasis"><em>not</em></span> include the location of
                   2063:             gcc (often <code class=
                   2064:             "filename">/usr/freeware/bin</code>), and (important)
                   2065:             pass the '--preserve-path' flag.</p>
1.1       grant    2066:           </div>
                   2067: 
                   2068:           <div class="sect2" lang="en" xml:lang="en">
                   2069:             <div class="titlepage">
                   2070:               <div>
                   2071:                 <div>
1.23    ! wiz      2072:                   <h3 class="title"><a name="id2570777" id=
        !          2073:                   "id2570777"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2074:                 </div>
                   2075:               </div>
                   2076:             </div>
                   2077: 
                   2078:             <p>Some versions of Linux (for example Debian
                   2079:             GNU/Linux) need either libtermcap or libcurses
                   2080:             (libncurses). Installing the distributions
                   2081:             libncurses-dev package (or equivalent) should fix the
                   2082:             problem.</p>
                   2083: 
                   2084:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2085:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2086:             8.0 and 8.1 on i386 have been tested.</p>
                   2087: 
                   2088:             <p>To bootstrap using icc, assuming the default icc
                   2089:             installation directory:</p>
                   2090:             <pre class="programlisting">
                   2091: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2092:                 ac_cv___attribute__=yes ./bootstrap
                   2093: </pre>
                   2094: 
                   2095:             <div class="note" style=
                   2096:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2097:               <h3 class="title">Note</h3>
                   2098: 
                   2099:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2100:               -static-libcxa.</p>
                   2101:             </div>
                   2102: 
                   2103:             <p>icc supports __attribute__, but the GNU configure
                   2104:             test uses a nested function, which icc does not
                   2105:             support. #undef'ing __attribute__ has the unfortunate
                   2106:             side-effect of breaking many of the Linux header files,
                   2107:             which cannot be compiled properly without
                   2108:             __attribute__. The test must be overridden so that
                   2109:             __attribute__ is assumed supported by the compiler.</p>
                   2110: 
                   2111:             <p>After bootstrapping, you should set <code class=
                   2112:             "varname">PKGSRC_COMPILER</code> in <code class=
                   2113:             "filename">/etc/mk.conf</code>:</p>
                   2114:             <pre class="programlisting">
                   2115: PKGSRC_COMPILER=icc
                   2116: </pre>
                   2117: 
                   2118:             <p>The default installation directory for icc is
                   2119:             <code class="filename">/opt/intel_cc_80</code>, which
                   2120:             is also the pkgsrc default. If you have installed it
                   2121:             into a different directory, set <code class=
                   2122:             "varname">ICCBASE</code> in <code class=
                   2123:             "filename">/etc/mk.conf</code>:</p>
                   2124:             <pre class="programlisting">
                   2125: ICCBASE=/opt/icc
                   2126: </pre>
                   2127: 
                   2128:             <p>pkgsrc uses the static linking method of the runtime
                   2129:             libraries provided by icc, so binaries can be run on
                   2130:             other systems which do not have the shared libraries
                   2131:             installed.</p>
                   2132: 
                   2133:             <p>Libtool, however, extracts a list of libraries from
                   2134:             the ld(1) command run when linking a C++ shared library
                   2135:             and records it, throwing away the -Bstatic and
                   2136:             -Bdynamic options interspersed between the libraries.
                   2137:             This means that libtool-linked C++ shared libraries
                   2138:             will have a runtime dependency on the icc libraries
                   2139:             until this is fixed in libtool.</p>
                   2140:           </div>
                   2141: 
                   2142:           <div class="sect2" lang="en" xml:lang="en">
                   2143:             <div class="titlepage">
                   2144:               <div>
                   2145:                 <div>
1.23    ! wiz      2146:                   <h3 class="title"><a name="id2570838" id=
        !          2147:                   "id2570838"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2148:                 </div>
                   2149:               </div>
                   2150:             </div>
                   2151: 
                   2152:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2153: 
                   2154:             <p>Care should be taken so that the tools that this kit
                   2155:             installs do not conflict with the OpenBSD userland
                   2156:             tools. There are several steps:</p>
                   2157: 
                   2158:             <div class="orderedlist">
                   2159:               <ol type="1">
                   2160:                 <li>
                   2161:                   <p>OpenBSD stores its ports pkg database in
1.14      xtraeme  2162:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    2163:                   therefore recommended that you choose a different
1.14      xtraeme  2164:                   location (e.g. <code class=
                   2165:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2166:                   --pkgdbdir option to the bootstrap script.</p>
                   2167:                 </li>
                   2168: 
                   2169:                 <li>
                   2170:                   <p>If you do not intend to use the OpenBSD ports
                   2171:                   tools, it's probably a good idea to move them out
                   2172:                   of the way to avoid confusion, e.g.</p>
                   2173:                   <pre class="screen">
1.14      xtraeme  2174: <code class="prompt">#</code> <strong class=
                   2175: "userinput"><code>cd /usr/sbin</code></strong>
                   2176: <code class="prompt">#</code> <strong class=
                   2177: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2178: <code class="prompt">#</code> <strong class=
                   2179: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2180: <code class="prompt">#</code> <strong class=
                   2181: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2182: <code class="prompt">#</code> <strong class=
                   2183: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2184: </pre>
                   2185:                 </li>
                   2186: 
                   2187:                 <li>
1.14      xtraeme  2188:                   <p>An example <code class=
                   2189:                   "filename">/etc/mk.conf</code> file will be
                   2190:                   placed in <code class=
                   2191:                   "filename">/etc/mk.conf.example</code> file when
                   2192:                   you use the bootstrap script. OpenBSD's make
                   2193:                   program uses <code class=
                   2194:                   "filename">/etc/mk.conf</code> as well. You can
1.1       grant    2195:                   work around this by enclosing all the pkgsrc
                   2196:                   specific parts of the file with:</p>
                   2197:                   <pre class="programlisting">
                   2198: .ifdef BSD_PKG_MK
1.11      ben      2199: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1       grant    2200: .else
                   2201: # OpenBSD stuff
                   2202: .endif
                   2203: </pre>
                   2204:                 </li>
                   2205:               </ol>
                   2206:             </div>
                   2207:           </div>
                   2208: 
                   2209:           <div class="sect2" lang="en" xml:lang="en">
                   2210:             <div class="titlepage">
                   2211:               <div>
                   2212:                 <div>
1.23    ! wiz      2213:                   <h3 class="title"><a name="id2570950" id=
        !          2214:                   "id2570950"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2215:                 </div>
                   2216:               </div>
                   2217:             </div>
                   2218: 
                   2219:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2220:             sparc. You will need a working C compiler. Both gcc
                   2221:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2222: 
                   2223:             <p>The following packages are required on Solaris 8 for
                   2224:             the bootstrap process and to build packages.</p>
                   2225: 
                   2226:             <div class="itemizedlist">
                   2227:               <ul type="disc">
                   2228:                 <li>
                   2229:                   <p>SUNWsprot</p>
                   2230:                 </li>
                   2231: 
                   2232:                 <li>
                   2233:                   <p>SUNWarc</p>
                   2234:                 </li>
                   2235: 
                   2236:                 <li>
                   2237:                   <p>SUNWbtool</p>
                   2238:                 </li>
                   2239: 
                   2240:                 <li>
                   2241:                   <p>SUNWtoo</p>
                   2242:                 </li>
                   2243: 
                   2244:                 <li>
                   2245:                   <p>SUNWlibm</p>
                   2246:                 </li>
                   2247:               </ul>
                   2248:             </div>
                   2249: 
                   2250:             <p>Please note the use of GNU binutils on Solaris is
                   2251:             <span class="emphasis"><em>not</em></span>
                   2252:             supported.</p>
                   2253: 
                   2254:             <div class="sect3" lang="en" xml:lang="en">
                   2255:               <div class="titlepage">
                   2256:                 <div>
                   2257:                   <div>
1.23    ! wiz      2258:                     <h4 class="title"><a name="id2570981" id=
        !          2259:                     "id2570981"></a>3.2.7.1.&nbsp;If you are using
1.1       grant    2260:                     gcc</h4>
                   2261:                   </div>
                   2262:                 </div>
                   2263:               </div>
                   2264: 
                   2265:               <p>It makes life much simpler if you only use the
                   2266:               same gcc consistently for building all packages.</p>
                   2267: 
                   2268:               <p>It is recommended that an external gcc be used
                   2269:               only for bootstrapping, then either build gcc from
                   2270:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2271:               href=
                   2272:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.20      ben      2273:               class="pkgname">lang/gcc</a> or install a binary gcc
                   2274:               package, then remove gcc used during
                   2275:               bootstrapping.</p>
1.1       grant    2276: 
                   2277:               <p>Binary packages of gcc can be found through
                   2278:               <a href=
                   2279:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2280:               target=
                   2281:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2282:             </div>
                   2283: 
                   2284:             <div class="sect3" lang="en" xml:lang="en">
                   2285:               <div class="titlepage">
                   2286:                 <div>
                   2287:                   <div>
1.23    ! wiz      2288:                     <h4 class="title"><a name="id2571070" id=
        !          2289:                     "id2571070"></a>3.2.7.2.&nbsp;If you are using
1.1       grant    2290:                     Sun WorkShop</h4>
                   2291:                   </div>
                   2292:                 </div>
                   2293:               </div>
                   2294: 
                   2295:               <p>You will need at least the following packages
                   2296:               installed (from WorkShop 5.0)</p>
                   2297: 
                   2298:               <div class="itemizedlist">
                   2299:                 <ul type="disc">
                   2300:                   <li>
                   2301:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2302:                   </li>
                   2303: 
                   2304:                   <li>
                   2305:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2306:                   </li>
                   2307: 
                   2308:                   <li>
                   2309:                     <p>SPROild - Sun WorkShop Incremental
                   2310:                     Linker</p>
                   2311:                   </li>
                   2312: 
                   2313:                   <li>
                   2314:                     <p>SPROlang - Sun WorkShop Compilers common
                   2315:                     components</p>
                   2316:                   </li>
                   2317:                 </ul>
                   2318:               </div>
                   2319: 
1.14      xtraeme  2320:               <p>You should set <code class="varname">CC</code>,
                   2321:               <code class="varname">CXX</code> and optionally,
                   2322:               <code class="varname">CPP</code> in <code class=
                   2323:               "filename">/etc/mk.conf</code>, eg.</p>
1.1       grant    2324:               <pre class="programlisting">
                   2325: CC=        cc
                   2326: CXX=    CC
                   2327: CPP=    /usr/ccs/lib/cpp
                   2328: </pre>
                   2329: 
                   2330:               <p>You may also want to build 64-bit binaries,
                   2331:               eg.</p>
                   2332:               <pre class="programlisting">
                   2333: CFLAGS= -xtarget=ultra -xarch=v9
                   2334: </pre>
                   2335: 
                   2336:               <p>Whichever compiler you use, please ensure the
                   2337:               compiler tools and your $prefix are in your
1.14      xtraeme  2338:               <code class="varname">PATH</code>. This includes
                   2339:               <code class="filename">/usr/ccs/{bin,lib}</code> and
                   2340:               eg. <code class=
                   2341:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2342:             </div>
                   2343:           </div>
                   2344:         </div>
                   2345:       </div>
                   2346: 
                   2347:       <div class="chapter" lang="en" xml:lang="en">
                   2348:         <div class="titlepage">
                   2349:           <div>
                   2350:             <div>
                   2351:               <h2 class="title"><a name="using" id=
                   2352:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2353:             </div>
                   2354:           </div>
                   2355:         </div>
                   2356: 
                   2357:         <div class="toc">
                   2358:           <p><b>Table of Contents</b></p>
                   2359: 
                   2360:           <dl>
                   2361:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2362:             Working with binary packages</a></span></dt>
                   2363: 
                   2364:             <dd>
                   2365:               <dl>
1.23    ! wiz      2366:                 <dt><span class="sect2"><a href="#id2571155">4.1.1.
1.1       grant    2367:                 Where to get binary packages</a></span></dt>
                   2368: 
1.23    ! wiz      2369:                 <dt><span class="sect2"><a href="#id2571264">4.1.2.
1.1       grant    2370:                 How to use binary packages</a></span></dt>
                   2371: 
1.23    ! wiz      2372:                 <dt><span class="sect2"><a href="#id2571371">4.1.3.
1.1       grant    2373:                 A word of warning</a></span></dt>
                   2374:               </dl>
                   2375:             </dd>
                   2376: 
1.23    ! wiz      2377:             <dt><span class="sect1"><a href="#id2571383">4.2.
1.1       grant    2378:             Building packages from source</a></span></dt>
                   2379: 
                   2380:             <dd>
                   2381:               <dl>
1.23    ! wiz      2382:                 <dt><span class="sect2"><a href="#id2571393">4.2.1.
1.1       grant    2383:                 Requirements</a></span></dt>
                   2384: 
1.23    ! wiz      2385:                 <dt><span class="sect2"><a href="#id2571822">4.2.2.
1.1       grant    2386:                 Fetching distfiles</a></span></dt>
                   2387: 
1.23    ! wiz      2388:                 <dt><span class="sect2"><a href="#id2571875">4.2.3.
1.1       grant    2389:                 How to build and install</a></span></dt>
                   2390: 
1.23    ! wiz      2391:                 <dt><span class="sect2"><a href="#id2623810">4.2.4.
1.1       grant    2392:                 Selecting the compiler</a></span></dt>
                   2393:               </dl>
                   2394:             </dd>
                   2395:           </dl>
                   2396:         </div>
                   2397: 
                   2398:         <div class="sect1" lang="en" xml:lang="en">
                   2399:           <div class="titlepage">
                   2400:             <div>
                   2401:               <div>
                   2402:                 <h2 class="title" style="clear: both"><a name=
                   2403:                 "getting-started" id=
                   2404:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2405:                 packages</h2>
                   2406:               </div>
                   2407:             </div>
                   2408:           </div>
                   2409: 
                   2410:           <p>This section describes how to find, retrieve and
                   2411:           install a precompiled binary package that someone else
                   2412:           already prepared for your type of machine.</p>
                   2413: 
                   2414:           <div class="sect2" lang="en" xml:lang="en">
                   2415:             <div class="titlepage">
                   2416:               <div>
                   2417:                 <div>
1.23    ! wiz      2418:                   <h3 class="title"><a name="id2571155" id=
        !          2419:                   "id2571155"></a>4.1.1.&nbsp;Where to get binary
1.1       grant    2420:                   packages</h3>
                   2421:                 </div>
                   2422:               </div>
                   2423:             </div>
                   2424: 
                   2425:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.14      xtraeme  2426:             and its mirrors in the directory <code class=
                   2427:             "filename">/pub/NetBSD/packages</code> for anonymous
                   2428:             FTP access. Please pick the right subdirectory there as
                   2429:             indicated by <span><strong class="command">uname
                   2430:             -p</strong></span>. In that directory, there is a
1.1       grant    2431:             subdirectory for each category plus a subdirectory
1.14      xtraeme  2432:             <code class="filename">All</code> which includes the
                   2433:             actual binaries in <code class="filename">.tgz</code>
                   2434:             files. The category subdirectories use symbolic links
                   2435:             to those files (this is the same directory layout as in
                   2436:             <code class=
                   2437:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2438: 
                   2439:             <p>This same directory layout applies for CDROM
                   2440:             distributions, only that the directory may be rooted
1.14      xtraeme  2441:             somewhere else, probably somewhere below <code class=
                   2442:             "filename">/cdrom</code>. Please consult your CDROMs
1.1       grant    2443:             documentation for the exact location.</p>
                   2444:           </div>
                   2445: 
                   2446:           <div class="sect2" lang="en" xml:lang="en">
                   2447:             <div class="titlepage">
                   2448:               <div>
                   2449:                 <div>
1.23    ! wiz      2450:                   <h3 class="title"><a name="id2571264" id=
        !          2451:                   "id2571264"></a>4.1.2.&nbsp;How to use binary
1.1       grant    2452:                   packages</h3>
                   2453:                 </div>
                   2454:               </div>
                   2455:             </div>
                   2456: 
                   2457:             <p>If you have the files on a CDROM or downloaded them
1.23    ! wiz      2458:             to your hard disk, you can install them with the
1.14      xtraeme  2459:             following command (be sure to<span><strong class=
                   2460:             "command">su</strong></span> to root first):</p>
1.1       grant    2461:             <pre class="screen">
1.14      xtraeme  2462: <code class="prompt">#</code> <strong class=
                   2463: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    2464: </pre>
                   2465: 
                   2466:             <p>If you have FTP access and you don't want to
                   2467:             download the packages via FTP prior to installation,
1.14      xtraeme  2468:             you can do this automatically by giving
                   2469:             <span><strong class="command">pkg_add</strong></span>
                   2470:             an FTP URL:</p>
1.1       grant    2471:             <pre class="screen">
1.14      xtraeme  2472: <code class="prompt">#</code> <strong class=
                   2473: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/&lt;OSvers&gt;/&lt;arch&gt;/All/package.tgz</code></strong>
1.1       grant    2474: </pre>
                   2475: 
                   2476:             <p>If there is any doubt, the uname utility can be used
                   2477:             to determine the &lt;OSvers&gt;, and &lt;arch&gt; by
1.14      xtraeme  2478:             running <span><strong class="command">uname
                   2479:             -rp</strong></span>.</p>
1.1       grant    2480: 
                   2481:             <p>Also note that any prerequisite packages needed to
                   2482:             run the package in question will be installed, too,
                   2483:             assuming they are present where you install from.</p>
                   2484: 
1.23    ! wiz      2485:             <p>To save some typing, you can set the <code class=
        !          2486:             "varname">PKG_PATH</code> environment variable to a
        !          2487:             semicolon separated list of paths (including remote
        !          2488:             URLs); trailing slashes are not allowed.</p>
        !          2489: 
        !          2490:             <p>Additionally to the <code class=
        !          2491:             "filename">All</code> directory there exists a
        !          2492:             <code class="filename">vulnerable</code> directory to
        !          2493:             which binary packages with known vulnerabilities are
        !          2494:             moved, since removing them could cause missing
        !          2495:             dependencies. To use these packages, add the
        !          2496:             <code class="filename">vulnerable</code> directory to
        !          2497:             your <code class="varname">PKG_PATH</code>. However,
        !          2498:             you should run <a xmlns=
        !          2499:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          2500:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
        !          2501:             class="pkgname">security/audit-packages</a> regularly,
        !          2502:             and especially after installing new packages, and
        !          2503:             verify that the vulnerabilities are acceptable for your
        !          2504:             configuration. An example <code class=
        !          2505:             "varname">PKG_PATH</code> would be: <code class=
        !          2506:             "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/&lt;OSvers&gt;/&lt;arch&gt;/All;ftp://ftp.NetBSD.org/pub/NetBSD/packages/&lt;OSvers&gt;/&lt;arch&gt;/vulnerable</code>
        !          2507:             Please note that semicolon (';') is a shell
        !          2508:             meta-character, so you'll probably have to quote
        !          2509:             it.</p>
        !          2510: 
1.1       grant    2511:             <p>After you've installed packages, be sure to have
1.14      xtraeme  2512:             <code class="filename">/usr/pkg/bin</code> in your
                   2513:             <code class="varname">PATH</code> so you can actually
                   2514:             start the just installed program.</p>
1.1       grant    2515:           </div>
                   2516: 
                   2517:           <div class="sect2" lang="en" xml:lang="en">
                   2518:             <div class="titlepage">
                   2519:               <div>
                   2520:                 <div>
1.23    ! wiz      2521:                   <h3 class="title"><a name="id2571371" id=
        !          2522:                   "id2571371"></a>4.1.3.&nbsp;A word of
1.1       grant    2523:                   warning</h3>
                   2524:                 </div>
                   2525:               </div>
                   2526:             </div>
                   2527: 
                   2528:             <p>Please pay very careful attention to the warnings
                   2529:             expressed in the <a href=
                   2530:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2531:             <span class="citerefentry"><span class=
                   2532:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2533:             page about the inherent dangers of installing binary
                   2534:             packages which you did not create yourself, and the
                   2535:             security holes that can be introduced onto your system
                   2536:             by indiscriminate adding of such files.</p>
                   2537:           </div>
                   2538:         </div>
                   2539: 
                   2540:         <div class="sect1" lang="en" xml:lang="en">
                   2541:           <div class="titlepage">
                   2542:             <div>
                   2543:               <div>
                   2544:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      2545:                 "id2571383" id="id2571383"></a>4.2.&nbsp;Building
1.1       grant    2546:                 packages from source</h2>
                   2547:               </div>
                   2548:             </div>
                   2549:           </div>
                   2550: 
                   2551:           <p>This assumes that the package is already in pkgsrc. If
                   2552:           it is not, see <a href="#developers-guide" title=
1.2       hubertf  2553:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
                   2554:           &#8220;The pkgsrc developer's guide&#8221;</a>.</p>
1.1       grant    2555: 
                   2556:           <div class="sect2" lang="en" xml:lang="en">
                   2557:             <div class="titlepage">
                   2558:               <div>
                   2559:                 <div>
1.23    ! wiz      2560:                   <h3 class="title"><a name="id2571393" id=
        !          2561:                   "id2571393"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2562:                 </div>
                   2563:               </div>
                   2564:             </div>
                   2565: 
                   2566:             <p>To build packages from source on a NetBSD system the
                   2567:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2568:             &#8220;<span class="quote">text</span>&#8221;
                   2569:             distribution sets must be installed. If you want to
                   2570:             build X11 related packages the &#8220;<span class=
                   2571:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2572:             "quote">xcomp</span>&#8221; distribution sets are
                   2573:             required, too.</p>
                   2574:           </div>
                   2575: 
                   2576:           <div class="sect2" lang="en" xml:lang="en">
                   2577:             <div class="titlepage">
                   2578:               <div>
                   2579:                 <div>
1.23    ! wiz      2580:                   <h3 class="title"><a name="id2571822" id=
        !          2581:                   "id2571822"></a>4.2.2.&nbsp;Fetching
1.1       grant    2582:                   distfiles</h3>
                   2583:                 </div>
                   2584:               </div>
                   2585:             </div>
                   2586: 
                   2587:             <p>The distfile (i.e. the unmodified source) must exist
                   2588:             on your system for the packages system to be able to
                   2589:             build it. If it does not exist, pkgsrc will use
                   2590:             <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   2591:             <span class="citerefentry"><span class=
                   2592:             "refentrytitle">ftp</span>(1)</span></a> to fetch it
                   2593:             automatically.</p>
                   2594: 
                   2595:             <p>You can overwrite some of the major distribution
                   2596:             sites to fit to sites that are close to your own. Have
1.14      xtraeme  2597:             a look at <code class=
                   2598:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
                   2599:             some examples - in particular, look for the
                   2600:             <code class="varname">MASTER_SORT</code>, <code class=
                   2601:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   2602:             "varname">INET_COUNTRY</code> definitions. This may
                   2603:             save some of your bandwidth and time.</p>
1.1       grant    2604: 
                   2605:             <p>You can change these settings either in your shell's
                   2606:             environment, or, if you want to keep the settings, by
1.14      xtraeme  2607:             editing the <code class="filename">/etc/mk.conf</code>
1.1       grant    2608:             file, and adding the definitions there.</p>
                   2609: 
                   2610:             <p>If you don't have a permanent Internet connection
                   2611:             and you want to know which files to download,
1.14      xtraeme  2612:             <span><strong class="command">make
                   2613:             fetch-list</strong></span> will tell you what you'll
                   2614:             need. Put these distfiles into <code class=
                   2615:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    2616:           </div>
                   2617: 
                   2618:           <div class="sect2" lang="en" xml:lang="en">
                   2619:             <div class="titlepage">
                   2620:               <div>
                   2621:                 <div>
1.23    ! wiz      2622:                   <h3 class="title"><a name="id2571875" id=
        !          2623:                   "id2571875"></a>4.2.3.&nbsp;How to build and
1.1       grant    2624:                   install</h3>
                   2625:                 </div>
                   2626:               </div>
                   2627:             </div>
                   2628: 
                   2629:             <p>Assuming that the distfile has been fetched (see
                   2630:             previous section), become root and change into the
1.14      xtraeme  2631:             relevant directory and running <span><strong class=
                   2632:             "command">make</strong></span>. For example, type</p>
1.1       grant    2633:             <pre class="screen">
1.14      xtraeme  2634: <code class="prompt">%</code> <strong class=
                   2635: "userinput"><code>cd misc/figlet</code></strong>
                   2636: <code class="prompt">%</code> <strong class=
                   2637: "userinput"><code>make</code></strong>
1.1       grant    2638: </pre>
                   2639: 
                   2640:             <p>at the shell prompt to build the various components
                   2641:             of the package, and</p>
                   2642:             <pre class="screen">
1.14      xtraeme  2643: <code class="prompt">#</code> <strong class=
                   2644: "userinput"><code>make install</code></strong>
1.1       grant    2645: </pre>
                   2646: 
                   2647:             <p>to install the various components into the correct
                   2648:             places on your system. Installing the package on your
                   2649:             system requires you to be root. However, pkgsrc has a
                   2650:             <span class="emphasis"><em>just-in-time-su</em></span>
                   2651:             feature, which allows you to only become root for the
                   2652:             actual installation step</p>
                   2653: 
                   2654:             <p>Taking the figlet utility as an example, we can
                   2655:             install it on our system by building as shown in
                   2656:             <a href="#logs" title=
                   2657:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
                   2658:             logs</i></a>.</p>
                   2659: 
                   2660:             <p>The program is installed under the default root of
1.14      xtraeme  2661:             the packages tree - <code class=
                   2662:             "filename">/usr/pkg</code>. Should this not conform to
                   2663:             your tastes, set the <code class=
                   2664:             "varname">LOCALBASE</code> variable in your
1.1       grant    2665:             environment, and it will use that value as the root of
1.14      xtraeme  2666:             your packages tree. So, to use <code class=
                   2667:             "filename">/usr/local</code>, set <code class=
                   2668:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    2669:             environment. Please note that you should use a
                   2670:             directory which is dedicated to packages and not shared
1.14      xtraeme  2671:             with other programs (ie, do not try and use
                   2672:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   2673:             should not try to add any of your own files or
                   2674:             directories (such as <code class=
                   2675:             "filename">src/</code>, <code class=
                   2676:             "filename">obj/</code>, or <code class=
                   2677:             "filename">pkgsrc/</code>) below the <code class=
                   2678:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    2679:             possible conflicts between programs and other files
                   2680:             installed by the package system and whatever else may
                   2681:             have been installed there.</p>
                   2682: 
1.14      xtraeme  2683:             <p>Some packages look in <code class=
                   2684:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    2685:             configuration options at build time. Have a look at
1.14      xtraeme  2686:             <code class=
                   2687:             "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
                   2688:             overview of what will be set there by default.
                   2689:             Environment variables such as <code class=
                   2690:             "varname">LOCALBASE</code> can be set in <code class=
                   2691:             "filename">/etc/mk.conf</code> to save having to
                   2692:             remember to set them each time you want to use
                   2693:             pkgsrc.</p>
1.1       grant    2694: 
                   2695:             <p>Occasionally, people want to &#8220;<span class=
                   2696:             "quote">look under the covers</span>&#8221; to see what
                   2697:             is going on when a package is building or being
                   2698:             installed. This may be for debugging purposes, or out
                   2699:             of simple curiosity. A number of utility values have
                   2700:             been added to help with this.</p>
                   2701: 
                   2702:             <div class="orderedlist">
                   2703:               <ol type="1">
                   2704:                 <li>
                   2705:                   <p>If you invoke the <a href=
                   2706:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2707:                   <span class="citerefentry"><span class=
                   2708:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  2709:                   with <code class=
                   2710:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   2711:                   amount of information will be displayed. For
                   2712:                   example,</p>
1.1       grant    2713:                   <pre class="screen">
1.14      xtraeme  2714: <strong class=
                   2715: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    2716: </pre>
                   2717: 
                   2718:                   <p>will show all the commands that are invoked,
                   2719:                   up to and including the &#8220;<span class=
                   2720:                   "quote">patch</span>&#8221; stage.</p>
                   2721:                 </li>
                   2722: 
                   2723:                 <li>
                   2724:                   <p>If you want to know the value of a certain
1.22      tv       2725:                   <a href=
                   2726:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2727:                   <span class="citerefentry"><span class=
                   2728:                   "refentrytitle">make</span>(1)</span></a>
                   2729:                   definition, then the <code class=
1.14      xtraeme  2730:                   "varname">VARNAME</code> definition should be
                   2731:                   used, in conjunction with the show-var target.
                   2732:                   e.g. to show the expansion of the <a href=
1.1       grant    2733:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2734:                   <span class="citerefentry"><span class=
                   2735:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  2736:                   variable <code class=
1.22      tv       2737:                   "varname">LOCALBASE</code>:</p>
1.1       grant    2738:                   <pre class="screen">
1.14      xtraeme  2739: <code class="prompt">%</code> <strong class=
                   2740: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    2741: /usr/pkg
1.14      xtraeme  2742: <code class="prompt">%</code>
1.1       grant    2743:           
                   2744: </pre>
                   2745:                 </li>
                   2746:               </ol>
                   2747:             </div>
                   2748: 
                   2749:             <p>If you want to install a binary package that you've
                   2750:             either created yourself (see next section), that you
                   2751:             put into pkgsrc/packages manually or that is located on
1.8       wiz      2752:             a remote FTP server, you can use the "bin-install"
1.1       grant    2753:             target. This target will install a binary package - if
                   2754:             available - via <a href=
                   2755:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2756:             <span class="citerefentry"><span class=
                   2757:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  2758:             <span><strong class="command">make
                   2759:             package</strong></span>. The list of remote FTP sites
                   2760:             searched is kept in the variable <code class=
                   2761:             "varname">BINPKG_SITES</code>, which defaults to
                   2762:             ftp.NetBSD.org. Any flags that should be added to
                   2763:             <a href=
1.1       grant    2764:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2765:             <span class="citerefentry"><span class=
                   2766:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  2767:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
                   2768:             See <code class=
                   2769:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   2770:             details.</p>
1.1       grant    2771: 
                   2772:             <p>A final word of warning: If you setup a system that
1.14      xtraeme  2773:             has a non-standard setting for <code class=
                   2774:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    2775:             any packages are installed, as you can not use several
                   2776:             directories for the same purpose. Doing so will result
                   2777:             in pkgsrc not being able to properly detect your
                   2778:             installed packages, and fail miserably. Note also that
                   2779:             precompiled binary packages are usually built with the
1.14      xtraeme  2780:             default <code class="varname">LOCALBASE</code> of
                   2781:             <code class="filename">/usr/pkg</code>, and that you
                   2782:             should <span class="emphasis"><em>not</em></span>
                   2783:             install any if you use a non-standard <code class=
                   2784:             "varname">LOCALBASE</code>.</p>
1.1       grant    2785:           </div>
                   2786: 
                   2787:           <div class="sect2" lang="en" xml:lang="en">
                   2788:             <div class="titlepage">
                   2789:               <div>
                   2790:                 <div>
1.23    ! wiz      2791:                   <h3 class="title"><a name="id2623810" id=
        !          2792:                   "id2623810"></a>4.2.4.&nbsp;Selecting the
1.1       grant    2793:                   compiler</h3>
                   2794:                 </div>
                   2795:               </div>
                   2796:             </div>
                   2797: 
                   2798:             <p>By default, pkgsrc will use GCC to build packages.
                   2799:             This may be overridden by setting the following
                   2800:             variables in /etc/mk.conf:</p>
                   2801: 
                   2802:             <div class="variablelist">
                   2803:               <dl>
1.14      xtraeme  2804:                 <dt><span class="term"><code class=
                   2805:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    2806: 
                   2807:                 <dd>
                   2808:                   <p>This is a list of values specifying the chain
                   2809:                   of compilers to invoke when building packages.
                   2810:                   Valid values are:</p>
                   2811: 
                   2812:                   <div class="itemizedlist">
                   2813:                     <ul type="disc">
                   2814:                       <li>
1.14      xtraeme  2815:                         <p><code class="varname">distcc</code>:
1.1       grant    2816:                         distributed C/C++ (chainable)</p>
                   2817:                       </li>
                   2818: 
                   2819:                       <li>
1.14      xtraeme  2820:                         <p><code class="varname">ccache</code>:
1.1       grant    2821:                         compiler cache (chainable)</p>
                   2822:                       </li>
                   2823: 
                   2824:                       <li>
1.14      xtraeme  2825:                         <p><code class="varname">gcc</code>: GNU
                   2826:                         C/C++ Compiler</p>
1.1       grant    2827:                       </li>
                   2828: 
                   2829:                       <li>
1.14      xtraeme  2830:                         <p><code class="varname">mipspro</code>:
1.1       grant    2831:                         Silicon Graphics, Inc. MIPSpro
                   2832:                         (n32/n64)</p>
                   2833:                       </li>
                   2834: 
                   2835:                       <li>
1.14      xtraeme  2836:                         <p><code class="varname">mipspro</code>:
1.1       grant    2837:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   2838:                       </li>
                   2839: 
                   2840:                       <li>
1.14      xtraeme  2841:                         <p><code class="varname">sunpro</code>:
1.1       grant    2842:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   2843:                         Studio</p>
                   2844:                       </li>
                   2845:                     </ul>
                   2846:                   </div>
                   2847: 
                   2848:                   <p>The default is &#8220;<span class=
1.14      xtraeme  2849:                   "quote"><code class=
                   2850:                   "varname">gcc</code></span>&#8221;. You can use
                   2851:                   <code class="varname">ccache</code> and/or
                   2852:                   <code class="varname">distcc</code> with an
                   2853:                   appropriate <code class=
                   2854:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   2855:                   &#8220;<span class="quote"><code class=
                   2856:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    2857:                   variable should always be terminated with a value
                   2858:                   for a real compiler.</p>
                   2859:                 </dd>
                   2860: 
1.14      xtraeme  2861:                 <dt><span class="term"><code class=
                   2862:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    2863: 
                   2864:                 <dd>
                   2865:                   <p>This specifies the minimum version of GCC to
                   2866:                   use when building packages. If the system GCC
                   2867:                   doesn't satisfy this requirement, then pkgsrc
                   2868:                   will build and install one of the GCC packages to
                   2869:                   use instead.</p>
                   2870:                 </dd>
                   2871:               </dl>
                   2872:             </div>
                   2873:           </div>
                   2874:         </div>
                   2875:       </div>
                   2876: 
                   2877:       <div class="chapter" lang="en" xml:lang="en">
                   2878:         <div class="titlepage">
                   2879:           <div>
                   2880:             <div>
                   2881:               <h2 class="title"><a name="binary" id=
                   2882:               "binary"></a>Chapter&nbsp;5.&nbsp;Creating binary
                   2883:               packages</h2>
                   2884:             </div>
                   2885:           </div>
                   2886:         </div>
                   2887: 
                   2888:         <div class="toc">
                   2889:           <p><b>Table of Contents</b></p>
                   2890: 
                   2891:           <dl>
1.23    ! wiz      2892:             <dt><span class="sect1"><a href="#id2623896">5.1.
1.1       grant    2893:             Building a single binary package</a></span></dt>
                   2894: 
1.23    ! wiz      2895:             <dt><span class="sect1"><a href="#id2623974">5.2.
1.1       grant    2896:             Settings for creation of binary
                   2897:             packages</a></span></dt>
                   2898: 
                   2899:             <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
                   2900:             a bulk build of all packages</a></span></dt>
                   2901: 
                   2902:             <dd>
                   2903:               <dl>
                   2904:                 <dt><span class="sect2"><a href=
                   2905:                 "#binary.configuration">5.3.1.
                   2906:                 Configuration</a></span></dt>
                   2907: 
1.23    ! wiz      2908:                 <dt><span class="sect2"><a href="#id2624115">5.3.2.
1.1       grant    2909:                 Other environmental considerations</a></span></dt>
                   2910: 
1.23    ! wiz      2911:                 <dt><span class="sect2"><a href="#id2624155">5.3.3.
1.1       grant    2912:                 Operation</a></span></dt>
                   2913: 
1.23    ! wiz      2914:                 <dt><span class="sect2"><a href="#id2624225">5.3.4.
1.1       grant    2915:                 What it does</a></span></dt>
                   2916: 
1.23    ! wiz      2917:                 <dt><span class="sect2"><a href="#id2624281">5.3.5.
1.1       grant    2918:                 Disk space requirements</a></span></dt>
                   2919: 
1.23    ! wiz      2920:                 <dt><span class="sect2"><a href="#id2624308">5.3.6.
1.1       grant    2921:                 Setting up a sandbox for chroot'ed
                   2922:                 builds</a></span></dt>
                   2923: 
1.23    ! wiz      2924:                 <dt><span class="sect2"><a href="#id2624905">5.3.7.
1.1       grant    2925:                 Building a partial set of packages</a></span></dt>
1.13      hubertf  2926: 
                   2927:                 <dt><span class="sect2"><a href=
                   2928:                 "#bulk-upload">5.3.8. Uploading results of a bulk
                   2929:                 build</a></span></dt>
1.1       grant    2930:               </dl>
                   2931:             </dd>
                   2932: 
1.23    ! wiz      2933:             <dt><span class="sect1"><a href="#id2625274">5.4.
1.1       grant    2934:             Creating a multiple CD-ROM packages
                   2935:             collection</a></span></dt>
                   2936: 
                   2937:             <dd>
                   2938:               <dl>
1.23    ! wiz      2939:                 <dt><span class="sect2"><a href="#id2625289">5.4.1.
1.1       grant    2940:                 Example of cdpack</a></span></dt>
                   2941:               </dl>
                   2942:             </dd>
                   2943:           </dl>
                   2944:         </div>
                   2945: 
                   2946:         <div class="sect1" lang="en" xml:lang="en">
                   2947:           <div class="titlepage">
                   2948:             <div>
                   2949:               <div>
                   2950:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      2951:                 "id2623896" id="id2623896"></a>5.1.&nbsp;Building a
1.1       grant    2952:                 single binary package</h2>
                   2953:               </div>
                   2954:             </div>
                   2955:           </div>
                   2956: 
                   2957:           <p>Once you have built and installed a package, you can
                   2958:           create a <span class="emphasis"><em>binary
                   2959:           package</em></span> which can be installed on another
                   2960:           system with <a href=
                   2961:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2962:           <span class="citerefentry"><span class=
                   2963:           "refentrytitle">pkg_add</span>(1)</span></a> This saves
                   2964:           having to build the same package on a group of hosts and
                   2965:           wasting CPU time. It also provides a simple means for
                   2966:           others to install your package, should you distribute
                   2967:           it.</p>
                   2968: 
                   2969:           <p>To create a binary package, change into the
1.14      xtraeme  2970:           appropriate directory in pkgsrc, and run
                   2971:           <span><strong class="command">make
                   2972:           package</strong></span>:</p>
1.1       grant    2973:           <pre class="screen">
1.14      xtraeme  2974: <code class="prompt">#</code> <strong class=
                   2975: "userinput"><code>cd misc/figlet</code></strong>
                   2976: <code class="prompt">#</code> <strong class=
                   2977: "userinput"><code>make package</code></strong>
1.1       grant    2978: </pre>
                   2979: 
                   2980:           <p>This will build and install your package (if not
                   2981:           already done), and then build a binary package from what
1.14      xtraeme  2982:           was installed. You can then use the <span><strong class=
                   2983:           "command">pkg_*</strong></span> tools to manipulate it.
                   2984:           Binary packages are created by default in <code class=
                   2985:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    2986:           gzipped tar file. See <a href="#logs.package" title=
                   2987:           "B.2.&nbsp;Packaging figlet">Section B.2,
                   2988:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   2989:           the above <a xmlns=
                   2990:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   2991:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.20      ben      2992:           class="pkgname">misc/figlet</a> example.</p>
1.1       grant    2993: 
                   2994:           <p>See <a href="#submit" title=
                   2995:           "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter
                   2996:           14, <i>Submitting and Committing</i></a> for information
                   2997:           on how to submit such a binary package.</p>
                   2998:         </div>
                   2999: 
                   3000:         <div class="sect1" lang="en" xml:lang="en">
                   3001:           <div class="titlepage">
                   3002:             <div>
                   3003:               <div>
                   3004:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      3005:                 "id2623974" id="id2623974"></a>5.2.&nbsp;Settings
1.1       grant    3006:                 for creation of binary packages</h2>
                   3007:               </div>
                   3008:             </div>
                   3009:           </div>
                   3010: 
                   3011:           <p>See <a href="#build.helpful-targets" title=
                   3012:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   3013:           &#8220;Other helpful targets&#8221;</a>.</p>
                   3014:         </div>
                   3015: 
                   3016:         <div class="sect1" lang="en" xml:lang="en">
                   3017:           <div class="titlepage">
                   3018:             <div>
                   3019:               <div>
                   3020:                 <h2 class="title" style="clear: both"><a name=
                   3021:                 "bulkbuild" id="bulkbuild"></a>5.3.&nbsp;Doing a
                   3022:                 bulk build of all packages</h2>
                   3023:               </div>
                   3024:             </div>
                   3025:           </div>
                   3026: 
                   3027:           <p>If you want to get a full set of precompiled binary
                   3028:           packages, this section describes how to get them. Beware
                   3029:           that the bulk build will remove all currently installed
1.23    ! wiz      3030:           packages from your system! Having an FTP server
        !          3031:           configured either on the machine doing the bulk builds or
        !          3032:           on a nearby NFS server can help to make the packages
        !          3033:           available to everyone. See <a href=
1.1       grant    3034:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   3035:           <span class="citerefentry"><span class=
                   3036:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   3037:           information. If you use a remote NFS server's storage, be
                   3038:           sure to not actually compile on NFS storage, as this
                   3039:           slows things down a lot.</p>
                   3040: 
                   3041:           <div class="sect2" lang="en" xml:lang="en">
                   3042:             <div class="titlepage">
                   3043:               <div>
                   3044:                 <div>
                   3045:                   <h3 class="title"><a name="binary.configuration"
                   3046:                   id=
                   3047:                   "binary.configuration"></a>5.3.1.&nbsp;Configuration</h3>
                   3048:                 </div>
                   3049:               </div>
                   3050:             </div>
                   3051: 
                   3052:             <div class="sect3" lang="en" xml:lang="en">
                   3053:               <div class="titlepage">
                   3054:                 <div>
                   3055:                   <div>
                   3056:                     <h4 class="title"><a name="binary.mk.conf" id=
                   3057:                     "binary.mk.conf"></a>5.3.1.1.&nbsp;/etc/mk.conf</h4>
                   3058:                   </div>
                   3059:                 </div>
                   3060:               </div>
                   3061: 
1.23    ! wiz      3062:               <p>You may want to set variables in <code class=
1.14      xtraeme  3063:               "filename">/etc/mk.conf</code>. Look at <code class=
                   3064:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    3065:               details of the default settings. You will want to
1.14      xtraeme  3066:               ensure that <code class=
                   3067:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   3068:               policy. As used in this example, <code class=
                   3069:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    3070:               "emphasis"><em>all</em></span> licenses.</p>
                   3071:               <pre class="programlisting">
                   3072: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   3073: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   3074: BSDSRCDIR=      /usr/src
                   3075: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   3076: OBJHOSTNAME?=   yes               # use work.`hostname`
                   3077: FAILOVER_FETCH= yes               # insist on the correct checksum
                   3078: PKG_DEVELOPER?= yes
                   3079: _ACCEPTABLE=    yes
                   3080: </pre>
                   3081:             </div>
                   3082: 
                   3083:             <div class="sect3" lang="en" xml:lang="en">
                   3084:               <div class="titlepage">
                   3085:                 <div>
                   3086:                   <div>
1.23    ! wiz      3087:                     <h4 class="title"><a name="id2624039" id=
        !          3088:                     "id2624039"></a>5.3.1.2.&nbsp;<code class=
1.14      xtraeme  3089:                     "filename">build.conf</code></h4>
1.1       grant    3090:                   </div>
                   3091:                 </div>
                   3092:               </div>
                   3093: 
1.14      xtraeme  3094:               <p>In <code class="filename">pkgsrc/mk/bulk</code>,
                   3095:               copy <code class="filename">build.conf-example</code>
                   3096:               to <code class="filename">build.conf</code> and edit
                   3097:               it, following the comments in that file. This is the
1.1       grant    3098:               config file that determines where log files are
                   3099:               generated after the build, where to mail the build
1.23    ! wiz      3100:               report to, where your pkgsrc tree is located and the
        !          3101:               user to which user to <a href=
1.1       grant    3102:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   3103:               <span class="citerefentry"><span class=
1.23    ! wiz      3104:               "refentrytitle">su</span>(8)</span></a> to do a
1.14      xtraeme  3105:               <span><strong class="command">cvs
                   3106:               update</strong></span>.</p>
1.1       grant    3107:             </div>
                   3108: 
                   3109:             <div class="sect3" lang="en" xml:lang="en">
                   3110:               <div class="titlepage">
                   3111:                 <div>
                   3112:                   <div>
1.23    ! wiz      3113:                     <h4 class="title"><a name="id2624075" id=
        !          3114:                     "id2624075"></a>5.3.1.3.&nbsp;<code class=
1.14      xtraeme  3115:                     "filename">pre-build.local</code></h4>
1.1       grant    3116:                   </div>
                   3117:                 </div>
                   3118:               </div>
                   3119: 
                   3120:               <p>It is possible to configure the bulk build to
                   3121:               perform certain site specific tasks at the end of the
1.14      xtraeme  3122:               pre-build stage. If the file <code class=
                   3123:               "filename">pre-build.local</code> exists in
1.23    ! wiz      3124:               <code class="filename">/usr/pkgsrc/mk/bulk</code>, it
1.14      xtraeme  3125:               will be executed (as a sh(1) script) at the end of
                   3126:               the usual pre-build stage. An example use of
                   3127:               <code class="filename">pre-build.local</code> is to
                   3128:               have the line:</p>
1.1       grant    3129:               <pre class="screen">
1.14      xtraeme  3130: <code class="prompt">#</code> <strong class=
                   3131: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23    ! wiz      3132:     &gt; pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1       grant    3133: </pre>
                   3134: 
                   3135:               <p>to prevent the system from trying to build a
                   3136:               particular package which requires nearly 3 GB of disk
                   3137:               space.</p>
                   3138:             </div>
                   3139:           </div>
                   3140: 
                   3141:           <div class="sect2" lang="en" xml:lang="en">
                   3142:             <div class="titlepage">
                   3143:               <div>
                   3144:                 <div>
1.23    ! wiz      3145:                   <h3 class="title"><a name="id2624115" id=
        !          3146:                   "id2624115"></a>5.3.2.&nbsp;Other environmental
1.1       grant    3147:                   considerations</h3>
                   3148:                 </div>
                   3149:               </div>
                   3150:             </div>
                   3151: 
1.14      xtraeme  3152:             <p>As <code class="filename">/usr/pkg</code> will be
1.1       grant    3153:             completely deleted at the start of bulk builds, make
                   3154:             sure your login shell is placed somewhere else. Either
1.14      xtraeme  3155:             drop it into <code class=
                   3156:             "filename">/usr/local/bin</code> (and adjust your login
                   3157:             shell in the passwd file), or (re-)install it via
                   3158:             <a href=
1.1       grant    3159:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3160:             <span class="citerefentry"><span class=
                   3161:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.14      xtraeme  3162:             <code class="filename">/etc/rc.local</code>, so you can
1.1       grant    3163:             login after a reboot (remember that your current
                   3164:             process won't die if the package is removed, you just
                   3165:             can't start any new instances of the shell any more).
                   3166:             Also, if you use NetBSD earlier than 1.5, or you still
                   3167:             want to use the pkgsrc version of ssh for some reason,
                   3168:             be sure to install ssh before starting it from
1.14      xtraeme  3169:             <code class="filename">rc.local</code>:</p>
1.1       grant    3170:             <pre class="programlisting">
                   3171: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   3172: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   3173:     /usr/pkg/etc/rc.d/sshd
                   3174: fi
                   3175: </pre>
                   3176: 
                   3177:             <p>Not doing so will result in you being not able to
                   3178:             log in via ssh after the bulk build is finished or if
                   3179:             the machine gets rebooted or crashes. You have been
                   3180:             warned! :)</p>
                   3181:           </div>
                   3182: 
                   3183:           <div class="sect2" lang="en" xml:lang="en">
                   3184:             <div class="titlepage">
                   3185:               <div>
                   3186:                 <div>
1.23    ! wiz      3187:                   <h3 class="title"><a name="id2624155" id=
        !          3188:                   "id2624155"></a>5.3.3.&nbsp;Operation</h3>
1.1       grant    3189:                 </div>
                   3190:               </div>
                   3191:             </div>
                   3192: 
                   3193:             <p>Make sure you don't need any of the packages still
                   3194:             installed.</p>
                   3195: 
                   3196:             <div class="warning" style=
                   3197:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3198:               <h3 class="title">Warning</h3>
                   3199: 
                   3200:               <p>During the bulk build, <span class=
                   3201:               "emphasis"><em>all packages will be
                   3202:               removed!</em></span></p>
                   3203:             </div>
                   3204: 
                   3205:             <p>Be sure to remove all other things that might
                   3206:             interfere with builds, like some libs installed in
1.14      xtraeme  3207:             <code class="filename">/usr/local</code>, etc. then
                   3208:             become root and type:</p>
1.1       grant    3209:             <pre class="screen">
1.14      xtraeme  3210: <code class="prompt">#</code> <strong class=
                   3211: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   3212: <code class="prompt">#</code> <strong class=
                   3213: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    3214: </pre>
                   3215: 
                   3216:             <p>If for some reason your last build didn't complete
                   3217:             (power failure, system panic, ...), you can continue it
                   3218:             by running:</p>
                   3219:             <pre class="screen">
1.14      xtraeme  3220: <code class="prompt">#</code> <strong class=
                   3221: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    3222: </pre>
                   3223: 
                   3224:             <p>At the end of the bulk build, you will get a summary
                   3225:             via mail, and find build logs in the directory
1.14      xtraeme  3226:             specified by <code class="varname">FTP</code> in the
                   3227:             <code class="filename">build.conf</code> file.</p>
1.1       grant    3228:           </div>
                   3229: 
                   3230:           <div class="sect2" lang="en" xml:lang="en">
                   3231:             <div class="titlepage">
                   3232:               <div>
                   3233:                 <div>
1.23    ! wiz      3234:                   <h3 class="title"><a name="id2624225" id=
        !          3235:                   "id2624225"></a>5.3.4.&nbsp;What it does</h3>
1.1       grant    3236:                 </div>
                   3237:               </div>
                   3238:             </div>
                   3239: 
                   3240:             <p>The bulk builds consist of three steps:</p>
                   3241: 
                   3242:             <div class="variablelist">
                   3243:               <dl>
                   3244:                 <dt><span class="term">1. pre-build</span></dt>
                   3245: 
                   3246:                 <dd>
                   3247:                   <p>The script updates your pkgsrc tree via
                   3248:                   (anon)cvs, then cleans out any broken distfiles,
                   3249:                   and removes all packages installed.</p>
                   3250:                 </dd>
                   3251: 
                   3252:                 <dt><span class="term">2. the bulk
                   3253:                 build</span></dt>
                   3254: 
                   3255:                 <dd>
                   3256:                   <p>This is basically &#8220;<span class=
                   3257:                   "quote">make bulk-package</span>&#8221; with an
                   3258:                   optimised order in which packages will be built.
                   3259:                   Packages that don't require other packages will
                   3260:                   be built first, and packages with many
                   3261:                   dependencies will be built later.</p>
                   3262:                 </dd>
                   3263: 
                   3264:                 <dt><span class="term">3. post-build</span></dt>
                   3265: 
                   3266:                 <dd>
                   3267:                   <p>Generates a report that's placed in the
1.14      xtraeme  3268:                   directory specified in the <code class=
                   3269:                   "filename">build.conf</code> file named
                   3270:                   <code class="filename">broken.html</code>, a
                   3271:                   short version of that report will also be mailed
                   3272:                   to the build's admin.</p>
1.1       grant    3273:                 </dd>
                   3274:               </dl>
                   3275:             </div>
                   3276: 
                   3277:             <p>During the build, a list of broken packages will be
1.14      xtraeme  3278:             compiled in <code class=
                   3279:             "filename">/usr/pkgsrc/.broken</code> (or <code class=
                   3280:             "filename">.../.broken.${MACHINE}</code> if
                   3281:             <code class="varname">OBJMACHINE</code> is set),
                   3282:             individual build logs of broken builds can be found in
                   3283:             the package's directory. These files are used by the
                   3284:             bulk-targets to mark broken builds to not waste time
                   3285:             trying to rebuild them, and they can be used to debug
                   3286:             these broken package builds later.</p>
1.1       grant    3287:           </div>
                   3288: 
                   3289:           <div class="sect2" lang="en" xml:lang="en">
                   3290:             <div class="titlepage">
                   3291:               <div>
                   3292:                 <div>
1.23    ! wiz      3293:                   <h3 class="title"><a name="id2624281" id=
        !          3294:                   "id2624281"></a>5.3.5.&nbsp;Disk space
1.1       grant    3295:                   requirements</h3>
                   3296:                 </div>
                   3297:               </div>
                   3298:             </div>
                   3299: 
                   3300:             <p>Currently, roughly the following requirements are
                   3301:             valid for NetBSD 2.0/i386:</p>
                   3302: 
                   3303:             <div class="itemizedlist">
                   3304:               <ul type="disc">
                   3305:                 <li>
                   3306:                   <p>10 GB - distfiles (NFS ok)</p>
                   3307:                 </li>
                   3308: 
                   3309:                 <li>
                   3310:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   3311:                 </li>
                   3312: 
                   3313:                 <li>
                   3314:                   <p>5 GB - temp space for compiling (local disk
                   3315:                   recommended)</p>
                   3316:                 </li>
                   3317:               </ul>
                   3318:             </div>
                   3319: 
                   3320:             <p>Note that all pkgs will be de-installed as soon as
                   3321:             they are turned into a binary package, and that sources
                   3322:             are removed, so there is no excessively huge demand to
                   3323:             disk space. Afterwards, if the package is needed again,
                   3324:             it will be installed via <a href=
                   3325:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3326:             <span class="citerefentry"><span class=
                   3327:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   3328:             building again, so there are no cycles wasted by
                   3329:             recompiling.</p>
                   3330:           </div>
                   3331: 
                   3332:           <div class="sect2" lang="en" xml:lang="en">
                   3333:             <div class="titlepage">
                   3334:               <div>
                   3335:                 <div>
1.23    ! wiz      3336:                   <h3 class="title"><a name="id2624308" id=
        !          3337:                   "id2624308"></a>5.3.6.&nbsp;Setting up a sandbox
1.1       grant    3338:                   for chroot'ed builds</h3>
                   3339:                 </div>
                   3340:               </div>
                   3341:             </div>
                   3342: 
1.12      agc      3343:             <p>If you don't want all the packages nuked from a
                   3344:             machine (rendering it useless for anything but pkg
1.23    ! wiz      3345:             compiling), there is the possibility of doing the
        !          3346:             package bulk build inside a chroot environment.</p>
1.12      agc      3347: 
                   3348:             <p>The first step is to set up a chroot sandbox, e.g.
1.14      xtraeme  3349:             <code class="filename">/usr/sandbox</code>. This can be
1.12      agc      3350:             done by using null mounts, or manually.</p>
                   3351: 
1.14      xtraeme  3352:             <p>There is a shell script called <code class=
                   3353:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   3354:             set up the sandbox environment using null mounts. It
                   3355:             will also create a script called <code class=
                   3356:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      3357:             environment, which will allow the null mounts to be
1.14      xtraeme  3358:             activated using the <span><strong class=
                   3359:             "command">sandbox mount</strong></span> command and
                   3360:             deactivated using the <span><strong class=
                   3361:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      3362: 
                   3363:             <p>To set up a sandbox environment by hand, after
                   3364:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  3365:             doing a <span><strong class="command">make distribution
                   3366:             DESTDIR=/usr/sandbox</strong></span> in <code class=
                   3367:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      3368:             items are present and properly configured:</p>
1.1       grant    3369: 
                   3370:             <div class="procedure">
                   3371:               <ol type="1">
                   3372:                 <li>
                   3373:                   <p>Kernel</p>
                   3374:                   <pre class="screen">
1.14      xtraeme  3375: <code class="prompt">#</code> <strong class=
                   3376: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    3377: </pre>
                   3378:                 </li>
                   3379: 
                   3380:                 <li>
1.14      xtraeme  3381:                   <p><code class="filename">/dev/*</code></p>
1.1       grant    3382:                   <pre class="screen">
1.14      xtraeme  3383: <code class="prompt">#</code> <strong class=
                   3384: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    3385: </pre>
                   3386:                 </li>
                   3387: 
                   3388:                 <li>
1.14      xtraeme  3389:                   <p><code class="filename">/etc/resolv.conf</code>
1.1       grant    3390:                   (for <a xmlns=
                   3391:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3392:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20      ben      3393:                   class="pkgname">security/smtpd</a> and mail):</p>
1.1       grant    3394:                   <pre class="screen">
1.14      xtraeme  3395: <code class="prompt">#</code> <strong class=
                   3396: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    3397: </pre>
                   3398:                 </li>
                   3399: 
                   3400:                 <li>
                   3401:                   <p>Working(!) mail config (hostname,
                   3402:                   sendmail.cf):</p>
                   3403:                   <pre class="screen">
1.14      xtraeme  3404: <code class="prompt">#</code> <strong class=
                   3405: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    3406: </pre>
                   3407:                 </li>
                   3408: 
                   3409:                 <li>
1.14      xtraeme  3410:                   <p><code class="filename">/etc/localtime</code>
                   3411:                   (for <a xmlns=
1.1       grant    3412:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3413:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20      ben      3414:                   class="pkgname">security/smtpd</a>):</p>
1.1       grant    3415:                   <pre class="screen">
1.14      xtraeme  3416: <code class="prompt">#</code> <strong class=
                   3417: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    3418: </pre>
                   3419:                 </li>
                   3420: 
                   3421:                 <li>
1.14      xtraeme  3422:                   <p><code class="filename">/usr/src</code> (system
1.1       grant    3423:                   sources, for <a xmlns=
                   3424:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3425:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.20      ben      3426:                   class="pkgname">sysutils/aperture</a>, <a xmlns=
                   3427:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3428:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
                   3429:                   class="pkgname">net/ppp-mppe</a>):</p>
1.1       grant    3430:                   <pre class="screen">
1.14      xtraeme  3431: <code class="prompt">#</code> <strong class=
                   3432: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   3433: <code class="prompt">#</code> <strong class=
1.23    ! wiz      3434: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    3435: </pre>
                   3436:                 </li>
                   3437: 
                   3438:                 <li>
1.14      xtraeme  3439:                   <p>Create <code class=
                   3440:                   "filename">/var/db/pkg</code> (not part of
                   3441:                   default install):</p>
1.1       grant    3442:                   <pre class="screen">
1.14      xtraeme  3443: <code class="prompt">#</code> <strong class=
                   3444: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    3445: </pre>
                   3446:                 </li>
                   3447: 
                   3448:                 <li>
1.14      xtraeme  3449:                   <p>Create <code class="filename">/usr/pkg</code>
                   3450:                   (not part of default install):</p>
1.1       grant    3451:                   <pre class="screen">
1.14      xtraeme  3452: <code class="prompt">#</code> <strong class=
                   3453: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    3454: </pre>
                   3455:                 </li>
                   3456: 
                   3457:                 <li>
1.14      xtraeme  3458:                   <p>Checkout pkgsrc via cvs into <code class=
                   3459:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    3460:                   <pre class="screen">
1.14      xtraeme  3461: <code class="prompt">#</code> <strong class=
                   3462: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   3463: <code class="prompt">#</code> <strong class=
                   3464: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    3465: </pre>
                   3466: 
                   3467:                   <p>Do not mount/link this to the copy of your
                   3468:                   pkgsrc tree you do development in, as this will
                   3469:                   likely cause problems!</p>
                   3470:                 </li>
                   3471: 
                   3472:                 <li>
1.14      xtraeme  3473:                   <p>Make <code class=
                   3474:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
                   3475:                   and <code class="filename">.../distfiles</code>
                   3476:                   point somewhere appropriate. NFS- and/or
                   3477:                   nullfs-mounts may come in handy!</p>
1.1       grant    3478:                 </li>
                   3479: 
                   3480:                 <li>
1.14      xtraeme  3481:                   <p>Edit <code class=
                   3482:                   "filename">/etc/mk.conf</code>, see <a href=
                   3483:                   "#binary.mk.conf" title=
1.1       grant    3484:                   "5.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;5.3.1.1,
                   3485:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   3486:                 </li>
                   3487: 
                   3488:                 <li>
1.14      xtraeme  3489:                   <p>Adjust <code class=
                   3490:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    3491:                   needs.</p>
                   3492:                 </li>
                   3493: 
                   3494:                 <li>
1.14      xtraeme  3495:                   <p>If you have set <code class=
                   3496:                   "varname">CVS_USER</code> in <code class=
                   3497:                   "filename">build.conf</code>, make sure that
                   3498:                   account exists and can do a <span><strong class=
                   3499:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    3500:                   properly!</p>
                   3501:                 </li>
                   3502:               </ol>
                   3503:             </div>
                   3504: 
                   3505:             <p>When the chroot sandbox is setup, you can start the
                   3506:             build with the following steps:</p>
                   3507:             <pre class="screen">
1.14      xtraeme  3508: <code class="prompt">#</code> <strong class=
                   3509: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   3510: <code class="prompt">#</code> <strong class=
                   3511: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    3512: </pre>
                   3513: 
                   3514:             <p>This will just jump inside the sandbox and start
                   3515:             building. At the end of the build, mail will be sent
                   3516:             with the results of the build. Created binary pkgs will
1.14      xtraeme  3517:             be in <code class=
                   3518:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    3519:             (wherever that points/mounts to/from).</p>
                   3520:           </div>
                   3521: 
                   3522:           <div class="sect2" lang="en" xml:lang="en">
                   3523:             <div class="titlepage">
                   3524:               <div>
                   3525:                 <div>
1.23    ! wiz      3526:                   <h3 class="title"><a name="id2624905" id=
        !          3527:                   "id2624905"></a>5.3.7.&nbsp;Building a partial
1.1       grant    3528:                   set of packages</h3>
                   3529:                 </div>
                   3530:               </div>
                   3531:             </div>
                   3532: 
                   3533:             <p>In addition to building a complete set of all
1.14      xtraeme  3534:             packages in pkgsrc, the <code class=
                   3535:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   3536:             used to build a subset of the packages contained in
                   3537:             pkgsrc. By setting defining <code class=
                   3538:             "varname">SPECIFIC_PKGS</code> in <code class=
                   3539:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    3540: 
                   3541:             <div class="itemizedlist">
                   3542:               <ul type="disc">
                   3543:                 <li>
                   3544:                   <p>SITE_SPECIFIC_PKGS</p>
                   3545:                 </li>
                   3546: 
                   3547:                 <li>
                   3548:                   <p>HOST_SPECIFIC_PKGS</p>
                   3549:                 </li>
                   3550: 
                   3551:                 <li>
                   3552:                   <p>GROUP_SPECIFIC_PKGS</p>
                   3553:                 </li>
                   3554: 
                   3555:                 <li>
                   3556:                   <p>USER_SPECIFIC_PKGS</p>
                   3557:                 </li>
                   3558:               </ul>
                   3559:             </div>
                   3560: 
                   3561:             <p>will define the set of packages which should be
                   3562:             built. The bulk build code will also include any
                   3563:             packages which are needed as dependencies for the
                   3564:             explicitly listed packages.</p>
                   3565: 
                   3566:             <p>One use of this is to do a bulk build with
1.14      xtraeme  3567:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    3568:             sandbox periodically to have a complete set of the
                   3569:             binary packages needed for your site available without
                   3570:             the overhead of building extra packages that are not
                   3571:             needed.</p>
                   3572:           </div>
1.13      hubertf  3573: 
                   3574:           <div class="sect2" lang="en" xml:lang="en">
                   3575:             <div class="titlepage">
                   3576:               <div>
                   3577:                 <div>
                   3578:                   <h3 class="title"><a name="bulk-upload" id=
                   3579:                   "bulk-upload"></a>5.3.8.&nbsp;Uploading results
                   3580:                   of a bulk build</h3>
                   3581:                 </div>
                   3582:               </div>
                   3583:             </div>
                   3584: 
                   3585:             <p>This section describes how pkgsrc developers can
                   3586:             upload binary pkgs built by bulk builds to
                   3587:             ftp.NetBSD.org.</p>
                   3588: 
1.17      sketch   3589:             <p>If you would like to automatically create checksum
                   3590:             files for the binary packages you intend to upload,
                   3591:             remember to set <code class="varname">MKSUMS=yes</code>
                   3592:             in your <code class=
                   3593:             "filename">mk/bulk/build.conf</code>.</p>
                   3594: 
                   3595:             <p>If you would like to PGP sign the checksum files
                   3596:             (highly recommended!), remember to set <code class=
                   3597:             "varname">SIGN_AS=username@NetBSD.org</code> in your
                   3598:             <code class="filename">mk/bulk/build.conf</code>. This
1.23    ! wiz      3599:             will prompt you for your GPG password to sign the files
1.17      sketch   3600:             before uploading everything.</p>
                   3601: 
                   3602:             <p>Then, make sure that you have <code class=
1.14      xtraeme  3603:             "varname">RSYNC_DST</code> set properly in your
                   3604:             <code class="filename">mk/bulk/build.conf</code> file,
                   3605:             i.e. adjust it to something like one of the
                   3606:             following:</p>
1.13      hubertf  3607:             <pre class="screen">
                   3608: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3609: </pre>
                   3610: 
1.23    ! wiz      3611:             <p>Please use appropviate values for "pkgsrc-200xQy",
1.13      hubertf  3612:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  3613:             ftp.NetBSD.org is different from <code class=
                   3614:             "varname">CVS_USER</code>, write your login directly
                   3615:             into the variable, e.g. my local account is "feyrer",
                   3616:             but for my login "hubertf", I use:</p>
1.13      hubertf  3617:             <pre class="screen">
                   3618: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3619: </pre>
                   3620: 
1.14      xtraeme  3621:             <p>A separate <code class="filename">upload</code>
1.13      hubertf  3622:             directory is used here to allow "closing" the directory
                   3623:             during upload. To do so, run the following command on
                   3624:             ftp.NetBSD.org next:</p>
                   3625:             <pre class="screen">
1.14      xtraeme  3626: nbftp% <strong class=
                   3627: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  3628: </pre>
                   3629: 
1.14      xtraeme  3630:             <p>Please note that <code class=
                   3631:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  3632:             appropriate for packages for the NetBSD operating
                   3633:             system. Binary packages for other operating systems
1.14      xtraeme  3634:             should go into <code class=
                   3635:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  3636: 
                   3637:             <p>Before uploading the binary pkgs, ssh authentication
1.23    ! wiz      3638:             needs to be set up. This example shows how to setup
1.13      hubertf  3639:             temporary keys for the root account <span class=
                   3640:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   3641:             that no keys should be present there usually):</p>
                   3642:             <pre class="screen">
1.14      xtraeme  3643: <code class="prompt">#</code> <strong class=
                   3644: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   3645: chroot-<code class="prompt">#</code> <strong class=
                   3646: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   3647: chroot-<code class="prompt">#</code> <strong class=
                   3648: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   3649: chroot-<code class="prompt">#</code> <strong class=
                   3650: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  3651: </pre>
                   3652: 
1.14      xtraeme  3653:             <p>Now take the output of <code class=
                   3654:             "filename">id-dsa.pub</code> and append it to your
                   3655:             <code class="filename">~/.ssh/authorized_keys</code>
1.17      sketch   3656:             file on ftp.NetBSD.org. You can remove the key after
1.14      xtraeme  3657:             the upload is done!</p>
1.13      hubertf  3658: 
                   3659:             <p>Next, test if your ssh connection really works:</p>
                   3660:             <pre class="screen">
1.14      xtraeme  3661: chroot-<code class="prompt">#</code> <strong class=
                   3662: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  3663: </pre>
                   3664: 
                   3665:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   3666: 
                   3667:             <p>Now after all this works, you can exit the sandbox
                   3668:             and start the upload:</p>
                   3669:             <pre class="screen">
1.14      xtraeme  3670: chroot-<code class="prompt">#</code> <strong class=
                   3671: "userinput"><code>exit</code></strong>        
                   3672: <code class="prompt">#</code> <strong class=
                   3673: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   3674: <code class="prompt">#</code> <strong class=
                   3675: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  3676: </pre>
                   3677: 
                   3678:             <p>The upload process may take quite some time. Use
                   3679:             "ls" or "du" on the FTP server to monitor progress of
                   3680:             the upload.</p>
                   3681: 
                   3682:             <p>After the upload has ended, first thing is to revoke
                   3683:             ssh access:</p>
                   3684:             <pre class="screen">
1.14      xtraeme  3685: nbftp% <strong class=
                   3686: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  3687: Gdd:x! 
                   3688: </pre>
                   3689: 
                   3690:             <p>Use whatever is needed to remove the key you've
                   3691:             entered before! Last, move the uploaded packages out of
1.14      xtraeme  3692:             the <code class="filename">upload</code> directory to
                   3693:             have them accessible to everyone:</p>
1.13      hubertf  3694:             <pre class="screen">
1.14      xtraeme  3695: nbftp% <strong class=
                   3696: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   3697: nbftp% <strong class=
                   3698: "userinput"><code>mv upload/* .</code></strong>
                   3699: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   3700: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  3701: </pre>
                   3702:           </div>
1.1       grant    3703:         </div>
                   3704: 
                   3705:         <div class="sect1" lang="en" xml:lang="en">
                   3706:           <div class="titlepage">
                   3707:             <div>
                   3708:               <div>
                   3709:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      3710:                 "id2625274" id="id2625274"></a>5.4.&nbsp;Creating a
1.1       grant    3711:                 multiple CD-ROM packages collection</h2>
                   3712:               </div>
                   3713:             </div>
                   3714:           </div>
                   3715: 
                   3716:           <p>After your pkgsrc bulk-build has completed, you may
                   3717:           wish to create a CD-ROM set of the resulting binary
                   3718:           packages to assist in installing packages on other
                   3719:           machines. The <a xmlns=
                   3720:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3721:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.20      ben      3722:           class="pkgname">pkgtools/cdpack</a> package provides a
                   3723:           simple tool for creating the ISO 9660 images.
                   3724:           <span><strong class="command">cdpack</strong></span>
                   3725:           arranges the packages on the CD-ROMs in a way that keeps
                   3726:           all the dependencies for given package on the same CD as
                   3727:           that package.</p>
1.1       grant    3728: 
                   3729:           <div class="sect2" lang="en" xml:lang="en">
                   3730:             <div class="titlepage">
                   3731:               <div>
                   3732:                 <div>
1.23    ! wiz      3733:                   <h3 class="title"><a name="id2625289" id=
        !          3734:                   "id2625289"></a>5.4.1.&nbsp;Example of
1.1       grant    3735:                   cdpack</h3>
                   3736:                 </div>
                   3737:               </div>
                   3738:             </div>
                   3739: 
                   3740:             <p>Complete documentation for cdpack is found in the
                   3741:             cdpack(1) manpage. The following short example assumes
1.14      xtraeme  3742:             that the binary packages are left in <code class=
                   3743:             "filename">/usr/pkgsrc/packages/All</code> and that
                   3744:             sufficient disk space exists in <code class=
                   3745:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    3746:             <pre class="screen">
1.14      xtraeme  3747: <code class="prompt">#</code> <strong class=
                   3748: "userinput"><code>mkdir /u2/images</code></strong>
                   3749: <code class="prompt">#</code> <strong class=
                   3750: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   3751: <code class="prompt">#</code> <strong class=
                   3752: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3753: </pre>
                   3754: 
                   3755:             <p>If you wish to include a common set of files
1.14      xtraeme  3756:             (<code class="filename">COPYRIGHT</code>, <code class=
                   3757:             "filename">README</code>, etc.) on each CD in the
1.1       grant    3758:             collection, then you need to create a directory which
                   3759:             contains these files. e.g.</p>
                   3760:             <pre class="screen">
1.14      xtraeme  3761: <code class="prompt">#</code> <strong class=
                   3762: "userinput"><code>mkdir /tmp/common</code></strong>
                   3763: <code class="prompt">#</code> <strong class=
                   3764: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   3765: <code class="prompt">#</code> <strong class=
                   3766: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   3767: <code class="prompt">#</code> <strong class=
                   3768: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   3769: <code class="prompt">#</code> <strong class=
                   3770: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   3771: <code class="prompt">#</code> <strong class=
                   3772: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   3773: <code class="prompt">#</code> <strong class=
                   3774: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    3775: </pre>
                   3776: 
                   3777:             <p>Now create the images:</p>
                   3778:             <pre class="screen">
1.14      xtraeme  3779: <code class="prompt">#</code> <strong class=
                   3780: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3781: </pre>
                   3782: 
1.14      xtraeme  3783:             <p>Each image will contain <code class=
                   3784:             "filename">README</code>, <code class=
                   3785:             "filename">COPYING</code>, and <code class=
                   3786:             "filename">bin/myscript</code> in their root
1.1       grant    3787:             directories.</p>
                   3788:           </div>
                   3789:         </div>
                   3790:       </div>
                   3791: 
                   3792:       <div class="chapter" lang="en" xml:lang="en">
                   3793:         <div class="titlepage">
                   3794:           <div>
                   3795:             <div>
                   3796:               <h2 class="title"><a name="faq" id=
                   3797:               "faq"></a>Chapter&nbsp;6.&nbsp;Frequently Asked
                   3798:               Questions</h2>
                   3799:             </div>
                   3800:           </div>
                   3801:         </div>
                   3802: 
                   3803:         <div class="toc">
                   3804:           <p><b>Table of Contents</b></p>
                   3805: 
                   3806:           <dl>
1.23    ! wiz      3807:             <dt><span class="sect1"><a href="#id2625481">6.1. Are
1.18      xtraeme  3808:             there any mailing lists for pkg-related
1.1       grant    3809:             discussion?</a></span></dt>
                   3810: 
1.23    ! wiz      3811:             <dt><span class="sect1"><a href="#id2625616">6.2.
1.1       grant    3812:             Where's the pkgviews documentation?</a></span></dt>
                   3813: 
1.5       hubertf  3814:             <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    3815:             Utilities for package management
                   3816:             (pkgtools)</a></span></dt>
                   3817: 
1.23    ! wiz      3818:             <dt><span class="sect1"><a href="#id2625937">6.4. How
1.1       grant    3819:             to use pkgsrc as non-root</a></span></dt>
                   3820: 
1.23    ! wiz      3821:             <dt><span class="sect1"><a href="#id2625948">6.5. How
1.15      xtraeme  3822:             to resume transfers when fetching
                   3823:             distfiles?</a></span></dt>
1.14      xtraeme  3824: 
1.23    ! wiz      3825:             <dt><span class="sect1"><a href="#id2625991">6.6. How
1.1       grant    3826:             can I install/use XFree86 from pkgsrc?</a></span></dt>
                   3827: 
1.23    ! wiz      3828:             <dt><span class="sect1"><a href="#id2626019">6.7. How
1.1       grant    3829:             can I install/use X.org from pkgsrc?</a></span></dt>
                   3830: 
1.23    ! wiz      3831:             <dt><span class="sect1"><a href="#id2626046">6.8. How
1.1       grant    3832:             to fetch files from behind a firewall</a></span></dt>
                   3833: 
1.23    ! wiz      3834:             <dt><span class="sect1"><a href="#id2626060">6.9. How
1.14      xtraeme  3835:             do I tell <span><strong class="command">make
                   3836:             fetch</strong></span> to do passive
                   3837:             FTP?</a></span></dt>
1.1       grant    3838: 
1.23    ! wiz      3839:             <dt><span class="sect1"><a href="#id2626112">6.10. How
1.1       grant    3840:             to fetch all distfiles at once</a></span></dt>
                   3841: 
1.23    ! wiz      3842:             <dt><span class="sect1"><a href="#id2626251">6.11. What
1.14      xtraeme  3843:             does &#8220;<span class="quote">Don't know how to make
                   3844:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    3845:             mean?</a></span></dt>
                   3846: 
1.23    ! wiz      3847:             <dt><span class="sect1"><a href="#id2626290">6.12. What
1.14      xtraeme  3848:             does &#8220;<span class="quote">Could not find
                   3849:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    3850: 
1.23    ! wiz      3851:             <dt><span class="sect1"><a href="#id2626347">6.13.
1.1       grant    3852:             Using 'sudo' with pkgsrc</a></span></dt>
                   3853: 
1.14      xtraeme  3854:             <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    3855:             Configuration files handling and
                   3856:             placement</a></span></dt>
                   3857: 
1.14      xtraeme  3858:             <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1       grant    3859:             Automated security checks</a></span></dt>
                   3860:           </dl>
                   3861:         </div>
                   3862: 
                   3863:         <p>This section contains hints, tips &amp; tricks on
                   3864:         special things in pkgsrc that we didn't find a better place
                   3865:         for in the previous chapters, and it contains items for
                   3866:         both pkgsrc users and developers.</p>
                   3867: 
                   3868:         <div class="sect1" lang="en" xml:lang="en">
                   3869:           <div class="titlepage">
                   3870:             <div>
                   3871:               <div>
                   3872:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      3873:                 "id2625481" id="id2625481"></a>6.1.&nbsp;Are there
1.18      xtraeme  3874:                 any mailing lists for pkg-related discussion?</h2>
1.1       grant    3875:               </div>
                   3876:             </div>
                   3877:           </div>
                   3878: 
1.18      xtraeme  3879:           <p>The following mailing lists may be of interest to
                   3880:           pkgsrc users:</p>
                   3881: 
                   3882:           <div class="itemizedlist">
                   3883:             <ul type="disc">
                   3884:               <li>
                   3885:                 <p><a href=
                   3886:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.20      ben      3887:                 target="_top">pkgsrc-bugs</a> -- a list where
                   3888:                 problem reports related to pkgsrc are sent and
                   3889:                 discussed</p>
1.18      xtraeme  3890:               </li>
                   3891: 
                   3892:               <li>
                   3893:                 <p><a href=
                   3894:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.20      ben      3895:                 target="_top">pkgsrc-bulk</a> -- a list where the
                   3896:                 results of pkgsrc bulk builds are sent and
                   3897:                 discussed</p>
1.18      xtraeme  3898:               </li>
                   3899: 
                   3900:               <li>
                   3901:                 <p><a href=
                   3902:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.20      ben      3903:                 target="_top">pkgsrc-changes</a> -- a list where
                   3904:                 all commit messages to pkgsrc are sent</p>
1.18      xtraeme  3905:               </li>
                   3906: 
                   3907:               <li>
                   3908:                 <p><a href=
                   3909:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.20      ben      3910:                 target="_top">tech-pkg</a> -- a general discussion
                   3911:                 list for all things related to pkgsrc</p>
1.18      xtraeme  3912:               </li>
                   3913:             </ul>
                   3914:           </div>
                   3915: 
                   3916:           <p>To subscribe, do:</p>
1.1       grant    3917:           <pre class="programlisting">
1.18      xtraeme  3918: <code class="prompt">%</code> echo subscribe <em class=
                   3919: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    3920: </pre>
                   3921: 
1.18      xtraeme  3922:           <p>Archives for all these mailing lists are available
                   3923:           from <a href="http://mail-index.NetBSD.org/" target=
                   3924:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    3925:         </div>
                   3926: 
                   3927:         <div class="sect1" lang="en" xml:lang="en">
                   3928:           <div class="titlepage">
                   3929:             <div>
                   3930:               <div>
                   3931:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      3932:                 "id2625616" id="id2625616"></a>6.2.&nbsp;Where's
1.1       grant    3933:                 the pkgviews documentation?</h2>
                   3934:               </div>
                   3935:             </div>
                   3936:           </div>
                   3937: 
                   3938:           <p>Pkgviews is tightly integrated with buildlink. You can
1.14      xtraeme  3939:           find a pkgviews User's guide in <code class=
                   3940:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    3941:         </div>
                   3942: 
                   3943:         <div class="sect1" lang="en" xml:lang="en">
                   3944:           <div class="titlepage">
                   3945:             <div>
                   3946:               <div>
                   3947:                 <h2 class="title" style="clear: both"><a name=
1.5       hubertf  3948:                 "faq-pkgtools" id=
                   3949:                 "faq-pkgtools"></a>6.3.&nbsp;Utilities for package
                   3950:                 management (pkgtools)</h2>
1.1       grant    3951:               </div>
                   3952:             </div>
                   3953:           </div>
                   3954: 
1.14      xtraeme  3955:           <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1       grant    3956:           directory pkgtools contains a number of useful utilities
                   3957:           for both users and developers of pkgsrc. This section
                   3958:           attempts only to make the reader aware of the utilities
                   3959:           and when they might be useful, and not to duplicate the
                   3960:           documentation that comes with each package.</p>
                   3961: 
                   3962:           <p>Utilities used by pkgsrc (automatically installed when
                   3963:           needed):</p>
                   3964: 
                   3965:           <div class="itemizedlist">
                   3966:             <ul type="disc">
                   3967:               <li>
                   3968:                 <p><a xmlns=
                   3969:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3970:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.20      ben      3971:                 class="pkgname">pkgtools/x11-links</a>: symlinks
                   3972:                 for use by buildlink</p>
1.1       grant    3973:               </li>
                   3974:             </ul>
                   3975:           </div>
                   3976: 
                   3977:           <p>OS tool augmentation (automatically installed when
                   3978:           needed):</p>
                   3979: 
                   3980:           <div class="itemizedlist">
                   3981:             <ul type="disc">
                   3982:               <li>
                   3983:                 <p><a xmlns=
                   3984:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3985:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20      ben      3986:                 class="pkgname">pkgtools/digest</a>: calculates
                   3987:                 SHA1 checksums (and other kinds)</p>
1.1       grant    3988:               </li>
                   3989: 
                   3990:               <li>
                   3991:                 <p><a xmlns=
                   3992:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3993:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.20      ben      3994:                 class="pkgname">pkgtools/libnbcompat</a>: compat
                   3995:                 library for pkg tools</p>
1.1       grant    3996:               </li>
                   3997: 
                   3998:               <li>
                   3999:                 <p><a xmlns=
                   4000:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4001:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.20      ben      4002:                 class="pkgname">pkgtools/mtree</a>: installed on
                   4003:                 non-BSD systems due to lack of native mtree</p>
1.1       grant    4004:               </li>
                   4005: 
                   4006:               <li>
                   4007:                 <p><a xmlns=
                   4008:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4009:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4010:                 class="pkgname">pkgtools/pkg_install</a>:
                   4011:                 up-to-date replacement for /usr/sbin/pkg_install,
                   4012:                 or for use on operating systems where pkg_install
                   4013:                 is not present</p>
1.1       grant    4014:               </li>
                   4015:             </ul>
                   4016:           </div>
                   4017: 
                   4018:           <p>Utilities used by pkgsrc (not automatically
                   4019:           installed):</p>
                   4020: 
                   4021:           <div class="itemizedlist">
                   4022:             <ul type="disc">
                   4023:               <li>
                   4024:                 <p><a xmlns=
                   4025:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4026:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.20      ben      4027:                 class="pkgname">pkgtools/pkg_tarup</a>: create a
                   4028:                 binary package from an already-installed package.
                   4029:                 used by 'make replace' to save the old package</p>
1.1       grant    4030:               </li>
                   4031: 
                   4032:               <li>
                   4033:                 <p><a xmlns=
                   4034:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  4035:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.20      ben      4036:                 class="pkgname">pkgtools/dfdisk</a>: adds extra
                   4037:                 functionality to pkgsrc, allowing it to fetch
                   4038:                 distfiles from multiple locations. It currently
                   4039:                 supports the following methods: multiple CD-ROMs
                   4040:                 and network FTP/HTTP connections.</p>
1.5       hubertf  4041:               </li>
                   4042: 
                   4043:               <li>
                   4044:                 <p><a xmlns=
                   4045:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    4046:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20      ben      4047:                 class="pkgname">pkgtools/xpkgwedge</a>: put X11
                   4048:                 packages someplace else (enabled by default)</p>
1.1       grant    4049:               </li>
1.5       hubertf  4050: 
                   4051:               <li>
                   4052:                 <p><a xmlns=
                   4053:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4054:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20      ben      4055:                 class="pkgname">devel/cpuflags</a>: will determine
                   4056:                 the best compiler flags to optimise code for your
                   4057:                 current CPU and compiler.</p>
1.5       hubertf  4058:               </li>
1.1       grant    4059:             </ul>
                   4060:           </div>
                   4061: 
                   4062:           <p>Utilities for keeping track of installed packages,
                   4063:           being up to date, etc:</p>
                   4064: 
                   4065:           <div class="itemizedlist">
                   4066:             <ul type="disc">
                   4067:               <li>
                   4068:                 <p><a xmlns=
                   4069:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4070:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.20      ben      4071:                 class="pkgname">pkgtools/pkg_chk</a>: installs
                   4072:                 pkg_chk, which reports on packages whose installed
                   4073:                 versions do not match the latest pkgsrc entries</p>
1.1       grant    4074:               </li>
                   4075: 
                   4076:               <li>
                   4077:                 <p><a xmlns=
                   4078:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4079:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.20      ben      4080:                 class="pkgname">pkgtools/pkgdep</a>: makes
                   4081:                 dependency graphs of packages, to aid in choosing a
                   4082:                 strategy for updating</p>
1.1       grant    4083:               </li>
                   4084: 
                   4085:               <li>
                   4086:                 <p><a xmlns=
                   4087:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4088:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.20      ben      4089:                 class="pkgname">pkgtools/pkgdepgraph</a>: make
                   4090:                 graph from above (uses graphviz)</p>
1.1       grant    4091:               </li>
                   4092: 
                   4093:               <li>
                   4094:                 <p><a xmlns=
                   4095:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4096:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      4097:                 class="pkgname">pkgtools/pkglint</a>: This provides
                   4098:                 two distinct abilities: check a pkgsrc entry for
                   4099:                 correctness (pkglint) check for and remove
                   4100:                 out-of-date distfiles and binary packages
                   4101:                 (lintpkgsrc)</p>
1.1       grant    4102:               </li>
                   4103: 
                   4104:               <li>
                   4105:                 <p><a xmlns=
                   4106:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4107:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.20      ben      4108:                 class="pkgname">pkgtools/pkgsurvey</a>: report what
                   4109:                 packages you have installed</p>
1.1       grant    4110:               </li>
                   4111:             </ul>
                   4112:           </div>
                   4113: 
                   4114:           <p>Utilities for people maintaining or creating
                   4115:           individual packages:</p>
                   4116: 
                   4117:           <div class="itemizedlist">
                   4118:             <ul type="disc">
                   4119:               <li>
                   4120:                 <p><a xmlns=
                   4121:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4122:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      4123:                 class="pkgname">pkgtools/pkgdiff</a>: automate
                   4124:                 making and maintaining patches for a package
                   4125:                 (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1       grant    4126:               </li>
                   4127: 
                   4128:               <li>
                   4129:                 <p><a xmlns=
                   4130:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4131:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20      ben      4132:                 class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
                   4133:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4134:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
                   4135:                 class="pkgname">pkgtools/url2pkg</a>: aids in
                   4136:                 converting to pkgsrc</p>
1.1       grant    4137:               </li>
                   4138: 
                   4139:               <li>
                   4140:                 <p><a xmlns=
                   4141:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4142:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.20      ben      4143:                 class="pkgname">pkgtools/gensolpkg</a>: convert
                   4144:                 pkgsrc to a Solaris package</p>
1.1       grant    4145:               </li>
                   4146:             </ul>
                   4147:           </div>
                   4148: 
                   4149:           <p>Utilities for people maintaining pkgsrc (or more
                   4150:           obscure pkg utilities)</p>
                   4151: 
                   4152:           <div class="itemizedlist">
                   4153:             <ul type="disc">
                   4154:               <li>
                   4155:                 <p><a xmlns=
                   4156:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4157:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.20      ben      4158:                 class="pkgname">pkgtools/pkgconflict</a>: find
                   4159:                 packages that conflict but aren't marked as
                   4160:                 such</p>
1.1       grant    4161:               </li>
                   4162: 
                   4163:               <li>
                   4164:                 <p><a xmlns=
                   4165:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4166:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.20      ben      4167:                 class="pkgname">pkgtools/pkg_comp</a>: build
                   4168:                 packages in a chrooted area</p>
1.1       grant    4169:               </li>
                   4170: 
                   4171:               <li>
                   4172:                 <p><a xmlns=
                   4173:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4174:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.20      ben      4175:                 class="pkgname">pkgtools/libkver</a>: spoof kernel
                   4176:                 version for chrooted cross builds</p>
1.1       grant    4177:               </li>
                   4178:             </ul>
                   4179:           </div>
                   4180:         </div>
                   4181: 
                   4182:         <div class="sect1" lang="en" xml:lang="en">
                   4183:           <div class="titlepage">
                   4184:             <div>
                   4185:               <div>
                   4186:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      4187:                 "id2625937" id="id2625937"></a>6.4.&nbsp;How to use
1.1       grant    4188:                 pkgsrc as non-root</h2>
                   4189:               </div>
                   4190:             </div>
                   4191:           </div>
                   4192: 
                   4193:           <p>If you want to use pkgsrc as non-root user, you can
                   4194:           set some variables to make pkgsrc work under these
                   4195:           conditions. Please see <a href=
                   4196:           "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.20      ben      4197:           target="_top">this message</a> for more details.</p>
1.14      xtraeme  4198:         </div>
                   4199: 
                   4200:         <div class="sect1" lang="en" xml:lang="en">
                   4201:           <div class="titlepage">
                   4202:             <div>
                   4203:               <div>
                   4204:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      4205:                 "id2625948" id="id2625948"></a>6.5.&nbsp;How to
1.15      xtraeme  4206:                 resume transfers when fetching distfiles?</h2>
1.14      xtraeme  4207:               </div>
                   4208:             </div>
                   4209:           </div>
                   4210: 
1.15      xtraeme  4211:           <p>By default resuming transfers in pkgsrc is disabled,
                   4212:           but you can enable this feature by adding the option
                   4213:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
                   4214:           into <code class="filename">/etc/mk.conf</code>. If,
                   4215:           during a fetch step, an incomplete distfile is found,
                   4216:           pkgsrc will try to resume it.</p>
                   4217: 
                   4218:           <p>You can also use a different program than the default
                   4219:           ftp(1) by changing the <code class=
                   4220:           "varname">FETCH_CMD</code> variable. Don't forget to set
                   4221:           <code class="varname">FETCH_RESUME_ARGS</code> and
                   4222:           <code class="varname">FETCH_OUTPUT_ARGS</code> if you are
                   4223:           not using default values.</p>
1.14      xtraeme  4224: 
                   4225:           <p>For example, if you want to use <code class=
                   4226:           "filename">wget</code> to resume downloads, you'll have
                   4227:           to use something like:</p>
                   4228:           <pre class="programlisting">
                   4229:         FETCH_CMD=wget
                   4230:         .if defined(FETCH_CMD) &amp;&amp; ${FETCH_CMD} == "wget"
                   4231:         FETCH_BEFORE_ARGS=--passive-ftp
                   4232:         FETCH_RESUME_ARGS=-c
                   4233:         FETCH_OUTPUT_ARGS=-O
                   4234:         .endif
                   4235:     
                   4236: </pre>
1.1       grant    4237:         </div>
                   4238: 
                   4239:         <div class="sect1" lang="en" xml:lang="en">
                   4240:           <div class="titlepage">
                   4241:             <div>
                   4242:               <div>
                   4243:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      4244:                 "id2625991" id="id2625991"></a>6.6.&nbsp;How can I
1.1       grant    4245:                 install/use XFree86 from pkgsrc?</h2>
                   4246:               </div>
                   4247:             </div>
                   4248:           </div>
                   4249: 
                   4250:           <p>If you want to use XFree86 from pkgsrc instead of your
1.14      xtraeme  4251:           system's own X11 (<code class=
                   4252:           "filename">/usr/X11R6</code>, <code class=
                   4253:           "filename">/usr/openwin</code>, ...), you will have to
                   4254:           add the following line into <code class=
1.15      xtraeme  4255:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4256:           <pre class="programlisting">
                   4257:       X11_TYPE=XFree86
                   4258:     
                   4259: </pre>
                   4260:         </div>
                   4261: 
                   4262:         <div class="sect1" lang="en" xml:lang="en">
                   4263:           <div class="titlepage">
                   4264:             <div>
                   4265:               <div>
                   4266:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      4267:                 "id2626019" id="id2626019"></a>6.7.&nbsp;How can I
1.1       grant    4268:                 install/use X.org from pkgsrc?</h2>
                   4269:               </div>
                   4270:             </div>
                   4271:           </div>
                   4272: 
                   4273:           <p>If you want to use X.org from pkgsrc instead of your
1.14      xtraeme  4274:           system's own X11 (<code class=
                   4275:           "filename">/usr/X11R6</code>, <code class=
                   4276:           "filename">/usr/openwin</code>, ...) you will have to add
                   4277:           the following line into <code class=
1.15      xtraeme  4278:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4279:           <pre class="programlisting">
                   4280:       X11_TYPE=xorg
                   4281:     
                   4282: </pre>
                   4283:         </div>
                   4284: 
                   4285:         <div class="sect1" lang="en" xml:lang="en">
                   4286:           <div class="titlepage">
                   4287:             <div>
                   4288:               <div>
                   4289:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      4290:                 "id2626046" id="id2626046"></a>6.8.&nbsp;How to
1.1       grant    4291:                 fetch files from behind a firewall</h2>
                   4292:               </div>
                   4293:             </div>
                   4294:           </div>
                   4295: 
                   4296:           <p>If you are sitting behind a firewall which does not
                   4297:           allow direct connections to Internet hosts (i.e.
                   4298:           non-NAT), you may specify the relevant proxy hosts. This
                   4299:           is done using an environment variable in the form of a
                   4300:           URL e.g. in Amdahl, the machine &#8220;<span class=
                   4301:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   4302:           firewalls, and it uses port 80 as the proxy port number.
                   4303:           So the proxy environment variables are:</p>
                   4304:           <pre class="programlisting">
                   4305:   ftp_proxy=ftp://orpheus.amdahl.com:80/
                   4306: http_proxy=http://orpheus.amdahl.com:80/
                   4307: </pre>
                   4308:         </div>
                   4309: 
                   4310:         <div class="sect1" lang="en" xml:lang="en">
                   4311:           <div class="titlepage">
                   4312:             <div>
                   4313:               <div>
                   4314:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      4315:                 "id2626060" id="id2626060"></a>6.9.&nbsp;How do I
1.14      xtraeme  4316:                 tell <span><strong class="command">make
                   4317:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    4318:               </div>
                   4319:             </div>
                   4320:           </div>
                   4321: 
                   4322:           <p>This depends on which utility is used to retrieve
1.14      xtraeme  4323:           distfiles. From <code class="filename">bsd.pkg.mk</code>,
                   4324:           <code class="varname">FETCH_CMD</code> is assigned the
                   4325:           first available command from the following list:</p>
1.1       grant    4326:           <pre class="programlisting">
                   4327: ${LOCALBASE}/bin/ftp
                   4328: /usr/bin/ftp
                   4329: </pre>
                   4330: 
                   4331:           <p>On a default NetBSD installation, this will be
1.14      xtraeme  4332:           <code class="filename">/usr/bin/ftp</code>, which
1.1       grant    4333:           automatically tries passive connections first, and falls
                   4334:           back to active connections if the server refuses to do
                   4335:           passive. For the other tools, add the following to your
1.14      xtraeme  4336:           <code class="filename">/etc/mk.conf</code> file:
                   4337:           <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    4338: 
1.14      xtraeme  4339:           <p>Having that option present will prevent <code class=
                   4340:           "filename">/usr/bin/ftp</code> from falling back to
                   4341:           active transfers.</p>
1.1       grant    4342:         </div>
                   4343: 
                   4344:         <div class="sect1" lang="en" xml:lang="en">
                   4345:           <div class="titlepage">
                   4346:             <div>
                   4347:               <div>
                   4348:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      4349:                 "id2626112" id="id2626112"></a>6.10.&nbsp;How to
1.1       grant    4350:                 fetch all distfiles at once</h2>
                   4351:               </div>
                   4352:             </div>
                   4353:           </div>
                   4354: 
                   4355:           <p>You would like to download all the distfiles in a
                   4356:           single batch from work or university, where you can't run
1.14      xtraeme  4357:           a <span><strong class="command">make
                   4358:           fetch</strong></span>. There is an archive of distfiles
                   4359:           on <a href=
1.1       grant    4360:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   4361:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   4362:           entire directory may not be appropriate.</p>
                   4363: 
1.14      xtraeme  4364:           <p>The answer here is to do a <span><strong class=
                   4365:           "command">make fetch-list</strong></span> in <code class=
                   4366:           "filename">/usr/pkgsrc</code> or one of it's
1.1       grant    4367:           subdirectories, carry the resulting list to your machine
1.23    ! wiz      4368:           at work/school and use it there. If you don't have a
1.1       grant    4369:           NetBSD-compatible ftp(1) (like lukemftp) at work, don't
1.14      xtraeme  4370:           forget to set <code class="varname">FETCH_CMD</code> to
1.1       grant    4371:           something that fetches a URL:</p>
                   4372: 
                   4373:           <p>At home:</p>
                   4374:           <pre class="screen">
1.14      xtraeme  4375: <code class="prompt">%</code> <strong class=
                   4376: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4377: <code class="prompt">%</code> <strong class=
                   4378: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   4379: <code class="prompt">%</code> <strong class=
                   4380: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    4381: </pre>
                   4382: 
                   4383:           <p>At work:</p>
                   4384:           <pre class="screen">
1.14      xtraeme  4385: <code class="prompt">%</code> <strong class=
                   4386: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    4387: </pre>
                   4388: 
1.14      xtraeme  4389:           <p>then tar up <code class=
                   4390:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    4391: 
                   4392:           <p>If you have a machine running NetBSD, and you want to
                   4393:           get <span class="emphasis"><em>all</em></span> distfiles
                   4394:           (even ones that aren't for your machine architecture),
                   4395:           you can do so by using the above-mentioned
1.14      xtraeme  4396:           <span><strong class="command">make
                   4397:           fetch-list</strong></span> approach, or fetch the
                   4398:           distfiles directly by running:</p>
1.1       grant    4399:           <pre class="screen">
1.14      xtraeme  4400: <code class="prompt">%</code> <strong class=
                   4401: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    4402: </pre>
                   4403: 
1.14      xtraeme  4404:           <p>If you even decide to ignore <code class=
                   4405:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   4406:           can get everything by running:</p>
1.1       grant    4407:           <pre class="screen">
1.14      xtraeme  4408: <code class="prompt">%</code> <strong class=
                   4409: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    4410: </pre>
                   4411:         </div>
                   4412: 
                   4413:         <div class="sect1" lang="en" xml:lang="en">
                   4414:           <div class="titlepage">
                   4415:             <div>
                   4416:               <div>
                   4417:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      4418:                 "id2626251" id="id2626251"></a>6.11.&nbsp;What does
1.1       grant    4419:                 &#8220;<span class="quote">Don't know how to make
                   4420:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   4421:               </div>
                   4422:             </div>
                   4423:           </div>
                   4424: 
                   4425:           <p>When compiling the <a xmlns=
                   4426:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4427:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4428:           class="pkgname">pkgtools/pkg_install</a> package, you get
                   4429:           the error from make that it doesn't know how to make
                   4430:           <code class="filename">/usr/share/tmac/tmac.andoc</code>?
                   4431:           This indicates that you don't have installed the
1.23    ! wiz      4432:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
        !          4433:           ...) from the NetBSD base distribution on your machine.
        !          4434:           It is recommended to do that to format manpages.</p>
1.1       grant    4435: 
                   4436:           <p>In the case of the <a xmlns=
                   4437:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4438:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4439:           class="pkgname">pkgtools/pkg_install</a> package, you can
                   4440:           get away with setting <code class=
                   4441:           "varname">NOMAN=YES</code> either in the environment or
                   4442:           in <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    4443:         </div>
                   4444: 
                   4445:         <div class="sect1" lang="en" xml:lang="en">
                   4446:           <div class="titlepage">
                   4447:             <div>
                   4448:               <div>
                   4449:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      4450:                 "id2626290" id="id2626290"></a>6.12.&nbsp;What does
1.1       grant    4451:                 &#8220;<span class="quote">Could not find
                   4452:                 bsd.own.mk</span>&#8221; mean?</h2>
                   4453:               </div>
                   4454:             </div>
                   4455:           </div>
                   4456: 
1.14      xtraeme  4457:           <p>You didn't install the compiler set, <code class=
                   4458:           "filename">comp.tgz</code>, when you installed your
                   4459:           NetBSD machine. Please get it and install it, by
                   4460:           extracting it in <code class="filename">/</code>:</p>
1.1       grant    4461:           <pre class="screen">
1.14      xtraeme  4462: <code class="prompt">#</code> <strong class=
                   4463: "userinput"><code>cd /</code></strong>
                   4464: <code class="prompt">#</code> <strong class=
                   4465: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    4466: </pre>
                   4467: 
1.14      xtraeme  4468:           <p><code class="filename">comp.tgz</code> is part of
                   4469:           every NetBSD release. Get the one that corresponds to
                   4470:           your release (determine via <span><strong class=
                   4471:           "command">uname -r</strong></span>).</p>
1.1       grant    4472:         </div>
                   4473: 
                   4474:         <div class="sect1" lang="en" xml:lang="en">
                   4475:           <div class="titlepage">
                   4476:             <div>
                   4477:               <div>
                   4478:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      4479:                 "id2626347" id="id2626347"></a>6.13.&nbsp;Using
1.1       grant    4480:                 'sudo' with pkgsrc</h2>
                   4481:               </div>
                   4482:             </div>
                   4483:           </div>
                   4484: 
                   4485:           <p>When installing packages as non-root user and using
                   4486:           the just-in-time su(1) feature of pkgsrc, it can become
                   4487:           annoying to type in the root password for each required
                   4488:           package installed. To avoid this, the sudo package can be
                   4489:           used, which does password caching over a limited time. To
                   4490:           use it, install sudo (either as binary package or from
                   4491:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   4492:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20      ben      4493:           class="pkgname">security/sudo</a>) and then put the
                   4494:           following into your <code class=
                   4495:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4496:           <pre class="programlisting">
1.23    ! wiz      4497:         .if exists(${LOCALBASE}/bin/sudo)
        !          4498:         SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
1.1       grant    4499:         .endif
                   4500:     
                   4501: </pre>
                   4502:         </div>
                   4503: 
                   4504:         <div class="sect1" lang="en" xml:lang="en">
                   4505:           <div class="titlepage">
                   4506:             <div>
                   4507:               <div>
                   4508:                 <h2 class="title" style="clear: both"><a name=
                   4509:                 "faq.conf" id=
1.14      xtraeme  4510:                 "faq.conf"></a>6.14.&nbsp;Configuration files
1.1       grant    4511:                 handling and placement</h2>
                   4512:               </div>
                   4513:             </div>
                   4514:           </div>
                   4515: 
1.14      xtraeme  4516:           <p>The global variable <code class=
                   4517:           "varname">PKG_SYSCONFBASE</code> (and some others) can be
                   4518:           set by the system administrator in <code class=
                   4519:           "filename">/etc/mk.conf</code> to define the place where
1.1       grant    4520:           configuration files get installed. Therefore, packages
                   4521:           must be adapted to support this feature. Keep in mind
                   4522:           that you should only install files that are strictly
                   4523:           necessary in the configuration directory, files that can
1.14      xtraeme  4524:           go to <code class="filename">$PREFIX/share</code> should
                   4525:           go there.</p>
1.1       grant    4526: 
                   4527:           <p>We will take a look at available variables first
1.14      xtraeme  4528:           (<code class="filename">bsd.pkg.mk</code> contains more
                   4529:           information). <code class="varname">PKG_SYSCONFDIR</code>
                   4530:           is where the configuration files for a package may be
                   4531:           found (that is, the full path, e.g. <code class=
                   4532:           "filename">/etc</code> or <code class=
                   4533:           "filename">/usr/pkg/etc</code>). This value may be
1.1       grant    4534:           customized in various ways:</p>
                   4535: 
                   4536:           <div class="orderedlist">
                   4537:             <ol type="1">
                   4538:               <li>
1.14      xtraeme  4539:                 <p><code class="varname">PKG_SYSCONFBASE</code> is
                   4540:                 the main config directory under which all package
1.1       grant    4541:                 configuration files are to be found. Users will
1.14      xtraeme  4542:                 typically want to set it to <code class=
                   4543:                 "filename">/etc</code>, or accept the default
                   4544:                 location of <code class=
                   4545:                 "filename">$PREFIX/etc</code>.</p>
1.1       grant    4546:               </li>
                   4547: 
                   4548:               <li>
1.14      xtraeme  4549:                 <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   4550:                 is the subdirectory of <code class=
                   4551:                 "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    4552:                 configuration files for a particular package may be
1.14      xtraeme  4553:                 found. Defaults to <code class=
                   4554:                 "varname">${SYSCONFBASE}</code>.</p>
1.1       grant    4555:               </li>
                   4556: 
                   4557:               <li>
1.14      xtraeme  4558:                 <p><code class="varname">PKG_SYSCONFVAR</code> is
                   4559:                 the special suffix used to distinguish any
                   4560:                 overriding values for a particular package (see
                   4561:                 next item). It defaults to <code class=
                   4562:                 "varname">${PKGBASE}</code>, but for a collection
                   4563:                 of related packages that should all have the same
                   4564:                 <code class="varname">PKG_SYSCONFDIR</code> value,
                   4565:                 it can be set in each of the package Makefiles to a
                   4566:                 common value.</p>
1.1       grant    4567:               </li>
                   4568: 
                   4569:               <li>
1.14      xtraeme  4570:                 <p><code class=
                   4571:                 "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   4572:                 overrides the value of <code class=
                   4573:                 "varname">${PKG_SYSCONFDIR}</code> for packages
                   4574:                 with the same value for <code class=
                   4575:                 "varname">PKG_SYSCONFVAR</code>.</p>
1.1       grant    4576: 
                   4577:                 <p>As an example, all the various KDE packages may
1.14      xtraeme  4578:                 want to set <code class=
                   4579:                 "varname">PKG_SYSCONFVAR</code> to
                   4580:                 &#8220;<span class="quote">kde</span>&#8221; so
                   4581:                 admins can set <code class=
                   4582:                 "varname">PKG_SYSCONFDIR.kde</code> in <code class=
                   4583:                 "filename">/etc/mk.conf</code> to define where to
1.1       grant    4584:                 install KDE config files.</p>
                   4585:               </li>
                   4586:             </ol>
                   4587:           </div>
                   4588: 
                   4589:           <p>Programs' configuration directory should be defined
                   4590:           during the configure stage. Packages that use GNU
                   4591:           autoconf can usually do this by using the
                   4592:           &#8220;<span class="quote">--sysconfdir</span>&#8221;
                   4593:           parameter, but this brings some problems as we will see
                   4594:           now. When you change this pathname in packages, you
                   4595:           should not allow them to install files in that directory
                   4596:           directly. Instead they need to install those files under
1.14      xtraeme  4597:           <code class="filename">share/examples/${PKGNAME}</code>
                   4598:           so <code class="filename">PLIST</code> can register
                   4599:           them.</p>
1.1       grant    4600: 
                   4601:           <p>Once you have the required configuration files in
1.14      xtraeme  4602:           place (under the <code class=
                   4603:           "filename">share/examples</code> directory) the variable
                   4604:           <code class="varname">CONF_FILES</code> should be set to
                   4605:           copy them into <code class=
                   4606:           "varname">PKG_SYSCONFDIR</code>. The contents of this
                   4607:           variable is formed by pairs of filenames; the first
1.1       grant    4608:           element of the pair specifies the file inside the
1.14      xtraeme  4609:           examples directory (registered by <code class=
                   4610:           "filename">PLIST</code>) and the second element specifies
1.1       grant    4611:           the target file. This is done this way to allow binary
                   4612:           packages to place files in the right directory using
1.14      xtraeme  4613:           <code class="filename">INSTALL</code>/<code class=
                   4614:           "filename">DEINSTALL</code> scripts which are created
                   4615:           automatically. The package <code class=
                   4616:           "filename">Makefile</code> must also set <code class=
                   4617:           "varname">USE_PKGINSTALL=YES</code> to use these
1.1       grant    4618:           automatically generated scripts. The automatic copying of
                   4619:           config files can be toggled by setting the environment
1.14      xtraeme  4620:           variable <code class="varname">PKG_CONFIG</code> prior to
1.1       grant    4621:           package installation.</p>
                   4622: 
                   4623:           <p>Here is an example, taken from mail/mutt/Makefile:</p>
                   4624:           <pre class="programlisting">
                   4625:   EGDIR=            ${PREFIX}/share/doc/mutt/samples
                   4626: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   4627: </pre>
                   4628: 
                   4629:           <p>As you can see, this package installs configuration
1.14      xtraeme  4630:           files inside <code class="varname">EGDIR</code>, which
                   4631:           are registered by <code class="filename">PLIST</code>.
                   4632:           After that, the variable <code class=
                   4633:           "varname">CONF_FILES</code> lists the installed file
                   4634:           first and then the target file. Users will also get an
                   4635:           automatic message when files are installed using this
                   4636:           method.</p>
1.1       grant    4637:         </div>
                   4638: 
                   4639:         <div class="sect1" lang="en" xml:lang="en">
                   4640:           <div class="titlepage">
                   4641:             <div>
                   4642:               <div>
                   4643:                 <h2 class="title" style="clear: both"><a name=
                   4644:                 "audit-packages" id=
1.14      xtraeme  4645:                 "audit-packages"></a>6.15.&nbsp;Automated security
1.1       grant    4646:                 checks</h2>
                   4647:               </div>
                   4648:             </div>
                   4649:           </div>
                   4650: 
                   4651:           <p>Please be aware that there can often be bugs in
                   4652:           third-party software, and some of these bugs can leave a
                   4653:           machine vulnerable to exploitation by attackers. In an
                   4654:           effort to lessen the exposure, the NetBSD packages team
                   4655:           maintains a database of known-exploits to packages which
                   4656:           have at one time been included in pkgsrc. The database
                   4657:           can be downloaded automatically, and a security audit of
                   4658:           all packages installed on a system can take place. To do
                   4659:           this, install the <a xmlns=
                   4660:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4661:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20      ben      4662:           class="pkgname">security/audit-packages</a> package. It
                   4663:           has two components:</p>
1.1       grant    4664: 
                   4665:           <div class="orderedlist">
                   4666:             <ol type="1">
                   4667:               <li>
                   4668:                 <p>&#8220;<span class=
                   4669:                 "quote">download-vulnerability-list</span>&#8221;,
                   4670:                 an easy way to download a list of the security
                   4671:                 vulnerabilities information. This list is kept up
                   4672:                 to date by the NetBSD security officer and the
                   4673:                 NetBSD packages team, and is distributed from the
                   4674:                 NetBSD ftp server:</p>
                   4675: 
                   4676:                 <p><a href=
                   4677:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      4678:                 target=
                   4679:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    4680:               </li>
                   4681: 
                   4682:               <li>
                   4683:                 <p>&#8220;<span class=
                   4684:                 "quote">audit-packages</span>&#8221;, an easy way
                   4685:                 to audit the current machine, checking each
                   4686:                 vulnerability which is known. If a vulnerable
                   4687:                 package is installed, it will be shown by output to
                   4688:                 stdout, including a description of the type of
                   4689:                 vulnerability, and a URL containing more
                   4690:                 information.</p>
                   4691:               </li>
                   4692:             </ol>
                   4693:           </div>
                   4694: 
1.23    ! wiz      4695:           <p>Use of the <a xmlns=
        !          4696:           "http://www.w3.org/TR/xhtml1/transitional" href=
        !          4697:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
        !          4698:           class="pkgname">security/audit-packages</a> package is
        !          4699:           strongly recommended! After &#8220;<span class=
        !          4700:           "quote">audit-packages</span>&#8221; is installed, please
        !          4701:           read the package's message, which you can get by running
        !          4702:           <strong class="userinput"><code>pkg_info -D
        !          4703:           audit-package</code></strong>.</p>
1.1       grant    4704:         </div>
                   4705:       </div>
                   4706:     </div>
                   4707: 
                   4708:     <div class="part" lang="en" xml:lang="en">
                   4709:       <div class="titlepage">
                   4710:         <div>
                   4711:           <div>
                   4712:             <h1 class="title"><a name="developers-guide" id=
1.2       hubertf  4713:             "developers-guide"></a>The pkgsrc developer's
                   4714:             guide</h1>
1.1       grant    4715:           </div>
                   4716:         </div>
                   4717:       </div>
                   4718: 
                   4719:       <div class="toc">
                   4720:         <p><b>Table of Contents</b></p>
                   4721: 
                   4722:         <dl>
                   4723:           <dt><span class="chapter"><a href="#components">7.
                   4724:           Package components - files, directories and
                   4725:           contents</a></span></dt>
                   4726: 
                   4727:           <dd>
                   4728:             <dl>
                   4729:               <dt><span class="sect1"><a href=
1.14      xtraeme  4730:               "#components.Makefile">7.1. <code class=
                   4731:               "filename">Makefile</code></a></span></dt>
1.1       grant    4732: 
                   4733:               <dt><span class="sect1"><a href=
1.14      xtraeme  4734:               "#components.distinfo">7.2. <code class=
                   4735:               "filename">distinfo</code></a></span></dt>
1.1       grant    4736: 
                   4737:               <dt><span class="sect1"><a href=
                   4738:               "#components.patches">7.3. patches/*</a></span></dt>
                   4739: 
1.23    ! wiz      4740:               <dt><span class="sect1"><a href="#id2627420">7.4.
1.1       grant    4741:               Other mandatory files</a></span></dt>
                   4742: 
                   4743:               <dt><span class="sect1"><a href=
                   4744:               "#components.optional">7.5. Optional
                   4745:               files</a></span></dt>
                   4746: 
1.23    ! wiz      4747:               <dt><span class="sect1"><a href="#id2627614">7.6.
1.14      xtraeme  4748:               <code class="filename">work*</code></a></span></dt>
1.1       grant    4749: 
1.23    ! wiz      4750:               <dt><span class="sect1"><a href="#id2627702">7.7.
1.14      xtraeme  4751:               <code class="filename">files/*</code></a></span></dt>
1.1       grant    4752:             </dl>
                   4753:           </dd>
                   4754: 
                   4755:           <dt><span class="chapter"><a href="#plist">8. PLIST
                   4756:           issues</a></span></dt>
                   4757: 
                   4758:           <dd>
                   4759:             <dl>
1.23    ! wiz      4760:               <dt><span class="sect1"><a href="#id2627825">8.1. RCS
1.1       grant    4761:               ID</a></span></dt>
                   4762: 
1.23    ! wiz      4763:               <dt><span class="sect1"><a href="#id2627840">8.2.
1.14      xtraeme  4764:               Semi-automatic <code class="filename">PLIST</code>
                   4765:               generation</a></span></dt>
1.1       grant    4766: 
                   4767:               <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme  4768:               Tweaking output of <span><strong class="command">make
                   4769:               print-PLIST</strong></span></a></span></dt>
1.1       grant    4770: 
                   4771:               <dt><span class="sect1"><a href="#plist.misc">8.4.
                   4772:               Variable substitution in PLIST</a></span></dt>
                   4773: 
1.23    ! wiz      4774:               <dt><span class="sect1"><a href="#id2628229">8.5.
1.1       grant    4775:               Manpage-compression</a></span></dt>
                   4776: 
1.23    ! wiz      4777:               <dt><span class="sect1"><a href="#id2628270">8.6.
1.14      xtraeme  4778:               Changing PLIST source with <code class=
                   4779:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    4780: 
1.23    ! wiz      4781:               <dt><span class="sect1"><a href="#id2628288">8.7.
1.1       grant    4782:               Platform specific and differing
                   4783:               PLISTs</a></span></dt>
                   4784: 
                   4785:               <dt><span class="sect1"><a href=
                   4786:               "#faq.common-dirs">8.8. Sharing directories between
                   4787:               packages</a></span></dt>
                   4788:             </dl>
                   4789:           </dd>
                   4790: 
                   4791:           <dt><span class="chapter"><a href="#buildlink">9.
                   4792:           Buildlink methodology</a></span></dt>
                   4793: 
                   4794:           <dd>
                   4795:             <dl>
1.23    ! wiz      4796:               <dt><span class="sect1"><a href="#id2628486">9.1.
1.1       grant    4797:               Converting packages to use buildlink3</a></span></dt>
                   4798: 
1.23    ! wiz      4799:               <dt><span class="sect1"><a href="#id2628872">9.2.
1.14      xtraeme  4800:               Writing <code class="filename">buildlink3.mk</code>
                   4801:               files</a></span></dt>
1.1       grant    4802: 
                   4803:               <dd>
                   4804:                 <dl>
                   4805:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4806:                   "#id2628941">9.2.1. Anatomy of a buildlink3.mk
1.1       grant    4807:                   file</a></span></dt>
                   4808: 
                   4809:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4810:                   "#id2629382">9.2.2. Updating <code class=
1.14      xtraeme  4811:                   "varname">BUILDLINK_DEPENDS.<em class=
                   4812:                   "replaceable"><code>pkg</code></em></code> in
                   4813:                   <code class="filename">buildlink3.mk</code>
1.1       grant    4814:                   files</a></span></dt>
                   4815:                 </dl>
                   4816:               </dd>
                   4817: 
1.23    ! wiz      4818:               <dt><span class="sect1"><a href="#id2629461">9.3.
1.14      xtraeme  4819:               Writing <code class="filename">builtin.mk</code>
                   4820:               files</a></span></dt>
1.1       grant    4821: 
                   4822:               <dd>
                   4823:                 <dl>
                   4824:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4825:                   "#id2629542">9.3.1. Anatomy of a <code class=
1.14      xtraeme  4826:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    4827: 
                   4828:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4829:                   "#id2629837">9.3.2. Global preferences for native
1.1       grant    4830:                   or pkgsrc software</a></span></dt>
                   4831:                 </dl>
                   4832:               </dd>
                   4833:             </dl>
                   4834:           </dd>
                   4835: 
                   4836:           <dt><span class="chapter"><a href="#options">10. Options
                   4837:           handling</a></span></dt>
                   4838: 
                   4839:           <dd>
                   4840:             <dl>
1.23    ! wiz      4841:               <dt><span class="sect1"><a href="#id2629910">10.1.
1.1       grant    4842:               Global default options</a></span></dt>
                   4843: 
1.23    ! wiz      4844:               <dt><span class="sect1"><a href="#id2629925">10.2.
1.14      xtraeme  4845:               Converting packages to use <code class=
                   4846:               "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    4847:             </dl>
                   4848:           </dd>
                   4849: 
                   4850:           <dt><span class="chapter"><a href="#build">11. The build
                   4851:           process</a></span></dt>
                   4852: 
                   4853:           <dd>
                   4854:             <dl>
                   4855:               <dt><span class="sect1"><a href="#build.prefix">11.1.
                   4856:               Program location</a></span></dt>
                   4857: 
1.23    ! wiz      4858:               <dt><span class="sect1"><a href="#id2630533">11.2.
1.1       grant    4859:               Main targets</a></span></dt>
                   4860: 
                   4861:               <dt><span class="sect1"><a href=
                   4862:               "#build.helpful-targets">11.3. Other helpful
                   4863:               targets</a></span></dt>
                   4864:             </dl>
                   4865:           </dd>
                   4866: 
                   4867:           <dt><span class="chapter"><a href="#fixes">12. Notes on
                   4868:           fixes for packages</a></span></dt>
                   4869: 
                   4870:           <dd>
                   4871:             <dl>
1.23    ! wiz      4872:               <dt><span class="sect1"><a href="#id2632070">12.1.
1.1       grant    4873:               General operation</a></span></dt>
                   4874: 
                   4875:               <dd>
                   4876:                 <dl>
                   4877:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4878:                   "#id2632073">12.1.1. How to pull in variables
1.1       grant    4879:                   from /etc/mk.conf</a></span></dt>
                   4880: 
                   4881:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4882:                   "#id2632156">12.1.2. Restricted
1.1       grant    4883:                   packages</a></span></dt>
                   4884: 
                   4885:                   <dt><span class="sect2"><a href=
                   4886:                   "#dependencies">12.1.3. Handling
                   4887:                   dependencies</a></span></dt>
                   4888: 
                   4889:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4890:                   "#id2632672">12.1.4. Handling conflicts with
1.1       grant    4891:                   other packages</a></span></dt>
                   4892: 
                   4893:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4894:                   "#id2632790">12.1.5. Packages that cannot or
1.1       grant    4895:                   should not be built</a></span></dt>
                   4896: 
                   4897:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4898:                   "#id2632816">12.1.6. Packages which should not be
1.1       grant    4899:                   deleted, once installed</a></span></dt>
                   4900: 
                   4901:                   <dt><span class="sect2"><a href=
                   4902:                   "#security-handling">12.1.7. Handling packages
                   4903:                   with security problems</a></span></dt>
                   4904: 
                   4905:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4906:                   "#id2632907">12.1.8. How to handle compiler
1.1       grant    4907:                   bugs</a></span></dt>
                   4908: 
                   4909:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4910:                   "#id2632930">12.1.9. How to handle incrementing
1.1       grant    4911:                   versions when fixing an existing
                   4912:                   package</a></span></dt>
                   4913: 
                   4914:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4915:                   "#id2632979">12.1.10. Portability of
1.1       grant    4916:                   packages</a></span></dt>
                   4917:                 </dl>
                   4918:               </dd>
                   4919: 
1.23    ! wiz      4920:               <dt><span class="sect1"><a href="#id2633003">12.2.
1.1       grant    4921:               Possible downloading issues</a></span></dt>
                   4922: 
                   4923:               <dd>
                   4924:                 <dl>
                   4925:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4926:                   "#id2633006">12.2.1. Packages whose distfiles
1.1       grant    4927:                   aren't available for plain
                   4928:                   downloading</a></span></dt>
                   4929: 
                   4930:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4931:                   "#id2633069">12.2.2. How to handle modified
1.1       grant    4932:                   distfiles with the 'old' name</a></span></dt>
                   4933:                 </dl>
                   4934:               </dd>
                   4935: 
1.23    ! wiz      4936:               <dt><span class="sect1"><a href="#id2633081">12.3.
1.1       grant    4937:               Configuration gotchas</a></span></dt>
                   4938: 
                   4939:               <dd>
                   4940:                 <dl>
                   4941:                   <dt><span class="sect2"><a href=
                   4942:                   "#fixes.libtool">12.3.1. Shared libraries -
                   4943:                   libtool</a></span></dt>
                   4944: 
                   4945:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4946:                   "#id2633438">12.3.2. Using libtool on GNU
1.1       grant    4947:                   packages that already support
                   4948:                   libtool</a></span></dt>
                   4949: 
                   4950:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4951:                   "#id2633588">12.3.3. GNU
1.1       grant    4952:                   Autoconf/Automake</a></span></dt>
                   4953:                 </dl>
                   4954:               </dd>
                   4955: 
1.23    ! wiz      4956:               <dt><span class="sect1"><a href="#id2633701">12.4.
1.1       grant    4957:               Building considerations</a></span></dt>
                   4958: 
                   4959:               <dd>
                   4960:                 <dl>
                   4961:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4962:                   "#id2633704">12.4.1. CPP defines</a></span></dt>
1.1       grant    4963:                 </dl>
                   4964:               </dd>
                   4965: 
1.23    ! wiz      4966:               <dt><span class="sect1"><a href="#id2633802">12.5.
1.1       grant    4967:               Package specific actions</a></span></dt>
                   4968: 
                   4969:               <dd>
                   4970:                 <dl>
                   4971:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4972:                   "#id2633805">12.5.1. Package configuration
1.1       grant    4973:                   files</a></span></dt>
                   4974: 
                   4975:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4976:                   "#id2633908">12.5.2. User
1.2       hubertf  4977:                   interaction</a></span></dt>
1.1       grant    4978: 
                   4979:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4980:                   "#id2633953">12.5.3. Handling
1.1       grant    4981:                   licenses</a></span></dt>
                   4982: 
                   4983:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4984:                   "#id2634036">12.5.4. Creating an account from a
1.1       grant    4985:                   package</a></span></dt>
                   4986: 
                   4987:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4988:                   "#id2634166">12.5.5. Installing score
1.1       grant    4989:                   files</a></span></dt>
                   4990: 
                   4991:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4992:                   "#id2634210">12.5.6. Packages providing login
1.1       grant    4993:                   shells</a></span></dt>
                   4994: 
                   4995:                   <dt><span class="sect2"><a href=
1.23    ! wiz      4996:                   "#id2634267">12.5.7. Packages containing perl
1.1       grant    4997:                   scripts</a></span></dt>
                   4998: 
                   4999:                   <dt><span class="sect2"><a href=
1.23    ! wiz      5000:                   "#id2634422">12.5.8. Packages with hardcoded
1.1       grant    5001:                   paths to other interpreters</a></span></dt>
                   5002: 
                   5003:                   <dt><span class="sect2"><a href=
1.23    ! wiz      5004:                   "#id2634443">12.5.9. Packages installing perl
1.1       grant    5005:                   modules</a></span></dt>
                   5006: 
                   5007:                   <dt><span class="sect2"><a href=
                   5008:                   "#faq.info-files">12.5.10. Packages installing
                   5009:                   info files</a></span></dt>
                   5010: 
                   5011:                   <dt><span class="sect2"><a href=
1.23    ! wiz      5012:                   "#id2634663">12.5.11. Packages installing GConf2
1.1       grant    5013:                   data files</a></span></dt>
                   5014: 
                   5015:                   <dt><span class="sect2"><a href=
1.23    ! wiz      5016:                   "#id2634763">12.5.12. Packages installing
1.1       grant    5017:                   scrollkeeper data files</a></span></dt>
                   5018: 
                   5019:                   <dt><span class="sect2"><a href=
1.23    ! wiz      5020:                   "#id2634814">12.5.13. Packages installing X11
1.1       grant    5021:                   fonts</a></span></dt>
                   5022: 
                   5023:                   <dt><span class="sect2"><a href=
1.23    ! wiz      5024:                   "#id2634861">12.5.14. Packages installing GTK2
1.1       grant    5025:                   modules</a></span></dt>
                   5026: 
                   5027:                   <dt><span class="sect2"><a href=
1.23    ! wiz      5028:                   "#id2634931">12.5.15. Packages installing SGML or
1.1       grant    5029:                   XML data</a></span></dt>
                   5030: 
                   5031:                   <dt><span class="sect2"><a href=
1.23    ! wiz      5032:                   "#id2635051">12.5.16. Packages installing
1.1       grant    5033:                   extensions to the MIME database</a></span></dt>
                   5034: 
                   5035:                   <dt><span class="sect2"><a href=
1.23    ! wiz      5036:                   "#id2635190">12.5.17. Packages using
1.1       grant    5037:                   intltool</a></span></dt>
1.18      xtraeme  5038: 
                   5039:                   <dt><span class="sect2"><a href=
1.23    ! wiz      5040:                   "#id2635204">12.5.18. Packages installing startup
1.18      xtraeme  5041:                   scripts</a></span></dt>
1.1       grant    5042:                 </dl>
                   5043:               </dd>
                   5044: 
1.23    ! wiz      5045:               <dt><span class="sect1"><a href="#id2635225">12.6.
1.1       grant    5046:               Feedback to the author</a></span></dt>
                   5047:             </dl>
                   5048:           </dd>
                   5049: 
                   5050:           <dt><span class="chapter"><a href="#debug">13.
                   5051:           Debugging</a></span></dt>
                   5052: 
                   5053:           <dt><span class="chapter"><a href="#submit">14.
                   5054:           Submitting and Committing</a></span></dt>
                   5055: 
                   5056:           <dd>
                   5057:             <dl>
1.23    ! wiz      5058:               <dt><span class="sect1"><a href="#id2635824">14.1.
1.1       grant    5059:               Submitting your packages</a></span></dt>
                   5060: 
1.23    ! wiz      5061:               <dt><span class="sect1"><a href="#id2635875">14.2.
1.1       grant    5062:               Committing: Importing a package into
                   5063:               CVS</a></span></dt>
                   5064: 
1.23    ! wiz      5065:               <dt><span class="sect1"><a href="#id2635938">14.3.
1.2       hubertf  5066:               Updating a package to a newer version</a></span></dt>
1.1       grant    5067: 
1.23    ! wiz      5068:               <dt><span class="sect1"><a href="#id2635957">14.4.
1.2       hubertf  5069:               Moving a package in pkgsrc</a></span></dt>
1.1       grant    5070:             </dl>
                   5071:           </dd>
                   5072:         </dl>
                   5073:       </div>
                   5074: 
                   5075:       <div class="chapter" lang="en" xml:lang="en">
                   5076:         <div class="titlepage">
                   5077:           <div>
                   5078:             <div>
                   5079:               <h2 class="title"><a name="components" id=
                   5080:               "components"></a>Chapter&nbsp;7.&nbsp;Package
                   5081:               components - files, directories and contents</h2>
                   5082:             </div>
                   5083:           </div>
                   5084:         </div>
                   5085: 
                   5086:         <div class="toc">
                   5087:           <p><b>Table of Contents</b></p>
                   5088: 
                   5089:           <dl>
                   5090:             <dt><span class="sect1"><a href=
1.14      xtraeme  5091:             "#components.Makefile">7.1. <code class=
                   5092:             "filename">Makefile</code></a></span></dt>
1.1       grant    5093: 
                   5094:             <dt><span class="sect1"><a href=
1.14      xtraeme  5095:             "#components.distinfo">7.2. <code class=
                   5096:             "filename">distinfo</code></a></span></dt>
1.1       grant    5097: 
                   5098:             <dt><span class="sect1"><a href=
                   5099:             "#components.patches">7.3. patches/*</a></span></dt>
                   5100: 
1.23    ! wiz      5101:             <dt><span class="sect1"><a href="#id2627420">7.4. Other
1.1       grant    5102:             mandatory files</a></span></dt>
                   5103: 
                   5104:             <dt><span class="sect1"><a href=
                   5105:             "#components.optional">7.5. Optional
                   5106:             files</a></span></dt>
                   5107: 
1.23    ! wiz      5108:             <dt><span class="sect1"><a href="#id2627614">7.6.
1.14      xtraeme  5109:             <code class="filename">work*</code></a></span></dt>
1.1       grant    5110: 
1.23    ! wiz      5111:             <dt><span class="sect1"><a href="#id2627702">7.7.
1.14      xtraeme  5112:             <code class="filename">files/*</code></a></span></dt>
1.1       grant    5113:           </dl>
                   5114:         </div>
                   5115: 
                   5116:         <p>Whenever you're preparing a package, there are a number
                   5117:         of files involved which are described in the following
                   5118:         sections.</p>
                   5119: 
                   5120:         <div class="sect1" lang="en" xml:lang="en">
                   5121:           <div class="titlepage">
                   5122:             <div>
                   5123:               <div>
                   5124:                 <h2 class="title" style="clear: both"><a name=
                   5125:                 "components.Makefile" id=
1.14      xtraeme  5126:                 "components.Makefile"></a>7.1.&nbsp;<code class=
                   5127:                 "filename">Makefile</code></h2>
1.1       grant    5128:               </div>
                   5129:             </div>
                   5130:           </div>
                   5131: 
                   5132:           <p>Building, installation and creation of a binary
1.14      xtraeme  5133:           package are all controlled by the package's <code class=
1.23    ! wiz      5134:           "filename">Makefile</code>. The <code class=
        !          5135:           "filename">Makefile</code> describes various things about
        !          5136:           a package, for example from where to get it, how to
        !          5137:           configure, build, and install it.</p>
        !          5138: 
        !          5139:           <p>A package <code class="filename">Makefile</code>
        !          5140:           contains several sections that describe the package.</p>
        !          5141: 
        !          5142:           <p>In the first section there are the following
        !          5143:           variables, which should appear exactly in the order given
        !          5144:           here.</p>
        !          5145: 
        !          5146:           <div class="itemizedlist">
        !          5147:             <ul type="disc">
        !          5148:               <li>
        !          5149:                 <p><code class="varname">DISTNAME</code> is the
        !          5150:                 basename of the distribution file to be downloaded
        !          5151:                 from the package's website.</p>
        !          5152:               </li>
        !          5153: 
        !          5154:               <li>
        !          5155:                 <p><code class="varname">PKGNAME</code> is the name
        !          5156:                 of the package, as used by pkgsrc. You only need to
        !          5157:                 provide it if it differs from DISTNAME. Usually it
        !          5158:                 is the directory name together with the version
        !          5159:                 number.</p>
        !          5160:               </li>
        !          5161: 
        !          5162:               <li>
        !          5163:                 <p><code class="varname">CATEGORIES</code> is a
        !          5164:                 list of categories which the package fits in. You
        !          5165:                 can choose any of the top-level directories of
        !          5166:                 pkgsrc for it.</p>
        !          5167:               </li>
        !          5168: 
        !          5169:               <li>
        !          5170:                 <p><code class="varname">MASTER_SITES</code> is a
        !          5171:                 list of URLs where the distribution files can be
        !          5172:                 downloaded. Each URL must end with a slash.</p>
        !          5173:               </li>
        !          5174:             </ul>
        !          5175:           </div>
        !          5176: 
        !          5177:           <p>The second section contains the following
        !          5178:           variables.</p>
        !          5179: 
        !          5180:           <div class="itemizedlist">
        !          5181:             <ul type="disc">
        !          5182:               <li>
        !          5183:                 <p><code class="varname">MAINTAINER</code> is the
        !          5184:                 mail address of the package's maintainer, which is
        !          5185:                 the person you can contact when the package does
        !          5186:                 not work.</p>
        !          5187:               </li>
        !          5188: 
        !          5189:               <li>
        !          5190:                 <p><code class="varname">HOMEPAGE</code> is a URL
        !          5191:                 where users can find more information about the
        !          5192:                 package.</p>
        !          5193:               </li>
1.1       grant    5194: 
1.23    ! wiz      5195:               <li>
        !          5196:                 <p><code class="varname">COMMENT</code> is a
        !          5197:                 one-line comment about the purpose of the
        !          5198:                 package.</p>
        !          5199:               </li>
        !          5200:             </ul>
        !          5201:           </div>
1.1       grant    5202: 
1.14      xtraeme  5203:           <p>The <code class="varname">MASTER_SITES</code> may be
                   5204:           set to one of the predefined sites:</p>
1.1       grant    5205:           <pre class="programlisting">
                   5206:         ${MASTER_SITE_APACHE}
                   5207:         ${MASTER_SITE_DEBIAN}
                   5208:         ${MASTER_SITE_GNOME}
                   5209:         ${MASTER_SITE_GNU}
                   5210:         ${MASTER_SITE_GNUSTEP}
1.9       dillo    5211:         ${MASTER_SITE_IFARCHIVE}
1.1       grant    5212:         ${MASTER_SITE_MOZILLA}
                   5213:         ${MASTER_SITE_PERL_CPAN}
                   5214:         ${MASTER_SITE_SOURCEFORGE}
                   5215:         ${MASTER_SITE_SUNSITE}
                   5216:         ${MASTER_SITE_R_CRAN}
                   5217:         ${MASTER_SITE_SUSE}
                   5218:         ${MASTER_SITE_TEX_CTAN}
                   5219:         ${MASTER_SITE_XCONTRIB}
                   5220:         ${MASTER_SITE_XEMACS} 
                   5221: </pre>
                   5222: 
                   5223:           <p>If one of these predefined sites is chosen, you may
                   5224:           require the ability to specify a subdirectory of that
                   5225:           site. Since these macros may expand to more than one
                   5226:           actual site, you <span class=
                   5227:           "emphasis"><em>must</em></span> use the following
                   5228:           construct to specify a subdirectory:</p>
                   5229:           <pre class="programlisting">
                   5230:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   5231:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   5232: </pre>
                   5233: 
                   5234:           <p>Note the trailing slash after the subdirectory
                   5235:           name.</p>
                   5236: 
                   5237:           <div class="note" style=
                   5238:           "margin-left: 0.5in; margin-right: 0.5in;">
                   5239:             <h3 class="title">Note</h3>
                   5240: 
1.14      xtraeme  5241:             <p><code class="varname">MASTER_SITE_SUBDIR</code> has
                   5242:             been deprecated and <span class="emphasis"><em>should
                   5243:             no longer be used</em></span>.</p>
1.1       grant    5244:           </div>
                   5245: 
1.14      xtraeme  5246:           <p>If the package has multiple <code class=
                   5247:           "varname">DISTFILES</code> or multiple <code class=
                   5248:           "varname">PATCHFILES</code> from different sites, set
                   5249:           <code class="varname">SITES_foo</code> to a list of URI's
1.1       grant    5250:           where file &#8220;<span class="quote">foo</span>&#8221;
                   5251:           may be found. &#8220;<span class=
                   5252:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   5253:           <pre class="programlisting">
                   5254: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   5255: DISTFILES+=     foo-file.tar.gz
                   5256: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   5257:         http://www.somewhereelse.com/mirror/somehow/
                   5258: </pre>
                   5259: 
1.14      xtraeme  5260:           <p>Note that the normal default setting of <code class=
                   5261:           "varname">DISTFILES</code> must be made explicit if you
1.1       grant    5262:           want to add to it (rather than replace it), as you
                   5263:           usually would.</p>
                   5264: 
                   5265:           <p>Currently the following values are available for
1.14      xtraeme  5266:           <code class="varname">CATEGORIES</code>. If more than one
                   5267:           is used, they need to be separated by spaces:</p>
1.1       grant    5268:           <pre class="programlisting">
                   5269: archivers     cross         geography     meta-pkgs     security
                   5270: audio         databases     graphics      misc          shells
                   5271: benchmarks    devel         ham           multimedia    sysutils
                   5272: biology       editors       inputmethod   net           textproc
                   5273: cad           emulators     lang          news          time
                   5274: chat          finance       mail          parallel      wm
                   5275: comms         fonts         math          pkgtools      www
                   5276: converters    games         mbone         print         x11
                   5277: </pre>
                   5278: 
                   5279:           <p>Please pay attention to the following gotchas:</p>
                   5280: 
                   5281:           <div class="itemizedlist">
                   5282:             <ul type="disc">
                   5283:               <li>
1.14      xtraeme  5284:                 <p>Add <code class="varname">MANCOMPRESSED</code>
                   5285:                 if manpages are installed in compressed form by the
                   5286:                 package; see comment in <code class=
                   5287:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    5288:               </li>
                   5289: 
                   5290:               <li>
1.14      xtraeme  5291:                 <p>Replace <code class="filename">/usr/local</code>
1.1       grant    5292:                 with &#8220;<span class=
                   5293:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   5294:                 patches, below).</p>
                   5295:               </li>
                   5296: 
                   5297:               <li>
                   5298:                 <p>If the package installs any info files, see
                   5299:                 <a href="#faq.info-files" title=
                   5300:                 "12.5.10.&nbsp;Packages installing info files">Section
                   5301:                 12.5.10, &#8220;Packages installing info
                   5302:                 files&#8221;</a>.</p>
                   5303:               </li>
                   5304: 
                   5305:               <li>
1.14      xtraeme  5306:                 <p>Set <code class="varname">MAINTAINER</code> to
                   5307:                 be yourself. If you really can't maintain the
                   5308:                 package for future updates, set it to <code class=
1.1       grant    5309:                 "email">&lt;<a href=
1.14      xtraeme  5310:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.1       grant    5311:               </li>
                   5312: 
                   5313:               <li>
                   5314:                 <p>If a home page for the software in question
1.14      xtraeme  5315:                 exists, add the variable <code class=
                   5316:                 "varname">HOMEPAGE</code> right after <code class=
                   5317:                 "varname">MAINTAINER</code>. The value of this
1.1       grant    5318:                 variable should be the URL for the home page.</p>
                   5319:               </li>
                   5320: 
                   5321:               <li>
1.14      xtraeme  5322:                 <p>Be sure to set the <code class=
                   5323:                 "varname">COMMENT</code> variable to a short
1.1       grant    5324:                 description of the package, not containing the
                   5325:                 pkg's name.</p>
                   5326:               </li>
                   5327:             </ul>
                   5328:           </div>
                   5329:         </div>
                   5330: 
                   5331:         <div class="sect1" lang="en" xml:lang="en">
                   5332:           <div class="titlepage">
                   5333:             <div>
                   5334:               <div>
                   5335:                 <h2 class="title" style="clear: both"><a name=
                   5336:                 "components.distinfo" id=
1.14      xtraeme  5337:                 "components.distinfo"></a>7.2.&nbsp;<code class=
                   5338:                 "filename">distinfo</code></h2>
1.1       grant    5339:               </div>
                   5340:             </div>
                   5341:           </div>
                   5342: 
                   5343:           <p>Most important, the mandatory message digest, or
                   5344:           checksum, of all the distfiles needed for the package to
                   5345:           compile, confirming they match the original file
                   5346:           distributed by the author. This ensures that the distfile
                   5347:           retrieved from the Internet has not been corrupted during
                   5348:           transfer or altered by a malign force to introduce a
1.14      xtraeme  5349:           security hole. It is generated using the
                   5350:           <span><strong class="command">make
                   5351:           makesum</strong></span> command. The digest algorithm
                   5352:           used was, at one stage, md5, but that was felt lacking
                   5353:           compared to sha1, and so sha1 is now the default
1.1       grant    5354:           algorithm. The distfile size is also generated and stored
                   5355:           in new distinfo files. The <a xmlns=
                   5356:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5357:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20      ben      5358:           class="pkgname">pkgtools/digest</a> utility calculates
                   5359:           all of the digests in the distinfo file, and it provides
                   5360:           various different algorithms. At the current time, the
                   5361:           algorithms provided are: <span class=
                   5362:           "emphasis"><em>md5</em></span>, <span class=
                   5363:           "emphasis"><em>rmd160</em></span>, <span class=
                   5364:           "emphasis"><em>sha1</em></span>, <span class=
                   5365:           "emphasis"><em>sha256</em></span>, <span class=
                   5366:           "emphasis"><em>sha384</em></span> and <span class=
                   5367:           "emphasis"><em>sha512</em></span>.</p>
1.1       grant    5368: 
                   5369:           <p>Some packages have different sets of distfiles on a
                   5370:           per architecture basis, for example <a xmlns=
                   5371:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5372:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20      ben      5373:           class="pkgname">www/navigator</a>). These are kept in the
                   5374:           same distinfo file and care should be taken when
                   5375:           upgrading such a package to ensure distfile information
                   5376:           is not lost.</p>
1.1       grant    5377: 
                   5378:           <p>The message digest/checksum for all the official
1.14      xtraeme  5379:           patches found in the <code class=
                   5380:           "filename">patches/</code> directory (see <a href=
                   5381:           "#components.patches" title=
1.1       grant    5382:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   5383:           &#8220;patches/*&#8221;</a>) for the package is also
1.14      xtraeme  5384:           stored in the <code class="filename">distinfo</code>
                   5385:           file. This is a message digest/checksum of all lines in
                   5386:           the patch file except the NetBSD RCS Id. This file is
                   5387:           generated by invoking <span><strong class="command">make
                   5388:           makepatchsum</strong></span> (or <span><strong class=
                   5389:           "command">make mps</strong></span> if you're in a
                   5390:           hurry).</p>
1.1       grant    5391:         </div>
                   5392: 
                   5393:         <div class="sect1" lang="en" xml:lang="en">
                   5394:           <div class="titlepage">
                   5395:             <div>
                   5396:               <div>
                   5397:                 <h2 class="title" style="clear: both"><a name=
                   5398:                 "components.patches" id=
                   5399:                 "components.patches"></a>7.3.&nbsp;patches/*</h2>
                   5400:               </div>
                   5401:             </div>
                   5402:           </div>
                   5403: 
                   5404:           <p>This directory contains files that are used by the
                   5405:           <a href=
                   5406:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   5407:           <span class="citerefentry"><span class=
                   5408:           "refentrytitle">patch</span>(1)</span></a> command to
                   5409:           modify the sources as distributed in the distribution
                   5410:           file into a form that will compile and run perfectly on
                   5411:           NetBSD. The files are applied successively in alphabetic
                   5412:           order (as returned by a shell &#8220;<span class=
                   5413:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.14      xtraeme  5414:           <code class="filename">patch-aa</code> is applied before
                   5415:           <code class="filename">patch-ab</code>, etc.</p>
1.1       grant    5416: 
1.14      xtraeme  5417:           <p>The <code class="filename">patch-*</code> files should
                   5418:           be in <span><strong class="command">diff
                   5419:           -bu</strong></span> format, and apply without a fuzz to
                   5420:           avoid problems. (To force patches to apply with fuzz you
                   5421:           can set <code class=
                   5422:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    5423:           not put changes for more than one file into a single
                   5424:           patch-file, as this will make future modifications more
                   5425:           difficult.</p>
                   5426: 
                   5427:           <p>Similar, a file should be patched at most once, not
                   5428:           several times by several different patches. If a file
                   5429:           needs several patches, they should be combined into one
                   5430:           file.</p>
                   5431: 
                   5432:           <p>One important thing to mention is to pay attention
                   5433:           that no RCS IDs get stored in the patch files, as these
                   5434:           will cause problems when later checked into the NetBSD
1.14      xtraeme  5435:           CVS tree. Use the <span><strong class=
                   5436:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    5437:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5438:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      5439:           class="pkgname">pkgtools/pkgdiff</a> package to avoid
                   5440:           these problems.</p>
1.1       grant    5441: 
                   5442:           <p>For even more automation, we recommend using
1.14      xtraeme  5443:           <span><strong class="command">mkpatches</strong></span>
                   5444:           from the same package to make a whole set of patches. You
                   5445:           just have to backup files before you edit them to
                   5446:           <code class="filename">filename.orig</code>, e.g. with
                   5447:           <span><strong class="command">cp -p filename
                   5448:           filename.orig</strong></span> or, easier, by using
                   5449:           <span><strong class="command">pkgvi</strong></span> again
                   5450:           from the same package. If you upgrade a package this way,
                   5451:           you can easily compare the new set of patches with the
                   5452:           previously existing one with <span><strong class=
                   5453:           "command">patchdiff</strong></span>.</p>
1.1       grant    5454: 
                   5455:           <p>When you have finished a package, remember to generate
                   5456:           the checksums for the patch files by using the
1.14      xtraeme  5457:           <span><strong class="command">make
                   5458:           makepatchsum</strong></span> command, see <a href=
                   5459:           "#components.distinfo" title=
1.5       hubertf  5460:           "7.2.&nbsp;distinfo">Section&nbsp;7.2,
1.14      xtraeme  5461:           &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    5462: 
                   5463:           <p>Patch files that are distributed by the author or
1.14      xtraeme  5464:           other maintainers can be listed in <code class=
                   5465:           "varname">$PATCHFILES</code>.</p>
1.1       grant    5466: 
                   5467:           <p>If it is desired to store any patches that should not
                   5468:           be committed into pkgsrc, they can be kept outside the
1.14      xtraeme  5469:           pkgsrc tree in the <code class=
                   5470:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    5471:           tree there is expected to have the same
                   5472:           &#8220;<span class="quote">category/package</span>&#8221;
                   5473:           structure as pkgsrc, and patches are expected to be
1.14      xtraeme  5474:           stored inside these dirs (also known as <code class=
                   5475:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
                   5476:           you want to keep a private patch for <code class=
                   5477:           "filename">pkgsrc/graphics/png</code>, keep it in
                   5478:           <code class=
                   5479:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   5480:           files in the named directory are expected to be patch
1.1       grant    5481:           files, and <span class="emphasis"><em>they are applied
                   5482:           after pkgsrc patches are applied</em></span>.</p>
                   5483:         </div>
                   5484: 
                   5485:         <div class="sect1" lang="en" xml:lang="en">
                   5486:           <div class="titlepage">
                   5487:             <div>
                   5488:               <div>
                   5489:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      5490:                 "id2627420" id="id2627420"></a>7.4.&nbsp;Other
1.1       grant    5491:                 mandatory files</h2>
                   5492:               </div>
                   5493:             </div>
                   5494:           </div>
                   5495: 
                   5496:           <div class="variablelist">
                   5497:             <dl>
1.14      xtraeme  5498:               <dt><span class="term"><code class=
                   5499:               "filename">DESCR</code></span></dt>
1.1       grant    5500: 
                   5501:               <dd>
                   5502:                 <p>A multi-line description of the piece of
                   5503:                 software. This should include any credits where
                   5504:                 they are due. Please bear in mind that others do
                   5505:                 not share your sense of humour (or spelling
                   5506:                 idiosyncrasies), and that others will read
                   5507:                 everything that you write here.</p>
                   5508:               </dd>
                   5509: 
1.14      xtraeme  5510:               <dt><span class="term"><code class=
                   5511:               "filename">PLIST</code></span></dt>
1.1       grant    5512: 
                   5513:               <dd>
                   5514:                 <p>This file governs the files that are installed
                   5515:                 on your system: all the binaries, manual pages,
                   5516:                 etc. There are other directives which may be
                   5517:                 entered in this file, to control the creation and
                   5518:                 deletion of directories, and the location of
                   5519:                 inserted files. See <a href="#plist" title=
                   5520:                 "Chapter&nbsp;8.&nbsp;PLIST issues">Chapter&nbsp;8,
                   5521:                 <i>PLIST issues</i></a> for more information.</p>
                   5522:               </dd>
                   5523:             </dl>
                   5524:           </div>
                   5525:         </div>
                   5526: 
                   5527:         <div class="sect1" lang="en" xml:lang="en">
                   5528:           <div class="titlepage">
                   5529:             <div>
                   5530:               <div>
                   5531:                 <h2 class="title" style="clear: both"><a name=
                   5532:                 "components.optional" id=
                   5533:                 "components.optional"></a>7.5.&nbsp;Optional
                   5534:                 files</h2>
                   5535:               </div>
                   5536:             </div>
                   5537:           </div>
                   5538: 
                   5539:           <div class="variablelist">
                   5540:             <dl>
1.14      xtraeme  5541:               <dt><span class="term"><code class=
                   5542:               "filename">INSTALL</code></span></dt>
1.1       grant    5543: 
                   5544:               <dd>
                   5545:                 <p>This shell script is invoked twice by <a href=
                   5546:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5547:                 <span class="citerefentry"><span class=
                   5548:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   5549:                 time after package extraction and before files are
                   5550:                 moved in place, the second time after the files to
                   5551:                 install are moved in place. This can be used to do
                   5552:                 any custom procedures not possible with @exec
1.14      xtraeme  5553:                 commands in <code class="filename">PLIST</code>.
                   5554:                 See <a href=
1.1       grant    5555:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5556:                 <span class="citerefentry"><span class=
                   5557:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   5558:                 <a href=
                   5559:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5560:                 <span class="citerefentry"><span class=
                   5561:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5562:                 more information.</p>
                   5563:               </dd>
                   5564: 
1.14      xtraeme  5565:               <dt><span class="term"><code class=
                   5566:               "filename">DEINSTALL</code></span></dt>
1.1       grant    5567: 
                   5568:               <dd>
                   5569:                 <p>This script is executed before and after any
                   5570:                 files are removed. It is this script's
                   5571:                 responsibility to clean up any additional messy
                   5572:                 details around the package's installation, since
                   5573:                 all pkg_delete knows is how to delete the files
                   5574:                 created in the original distribution. See <a href=
                   5575:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   5576:                 <span class="citerefentry"><span class=
                   5577:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   5578:                 <a href=
                   5579:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5580:                 <span class="citerefentry"><span class=
                   5581:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5582:                 more information.</p>
                   5583:               </dd>
                   5584: 
1.14      xtraeme  5585:               <dt><span class="term"><code class=
                   5586:               "filename">MESSAGE</code></span></dt>
1.1       grant    5587: 
                   5588:               <dd>
                   5589:                 <p>Display this file after installation of the
                   5590:                 package. Useful for things like legal notices on
                   5591:                 almost-free software and hints for updating config
                   5592:                 files after installing modules for apache, PHP etc.
                   5593:                 Please note that you can modify variables in it
1.14      xtraeme  5594:                 easily by using <code class=
                   5595:                 "varname">MESSAGE_SUBST</code> in the package's
                   5596:                 <code class="filename">Makefile</code>:</p>
1.1       grant    5597:                 <pre class="programlisting">
                   5598: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   5599: </pre>
                   5600: 
                   5601:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.14      xtraeme  5602:                 "quote">somevalue</span>&#8221; in <code class=
                   5603:                 "filename">MESSAGE</code>.</p>
1.1       grant    5604:               </dd>
                   5605:             </dl>
                   5606:           </div>
                   5607:         </div>
                   5608: 
                   5609:         <div class="sect1" lang="en" xml:lang="en">
                   5610:           <div class="titlepage">
                   5611:             <div>
                   5612:               <div>
                   5613:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      5614:                 "id2627614" id=
        !          5615:                 "id2627614"></a>7.6.&nbsp;<code class=
1.14      xtraeme  5616:                 "filename">work*</code></h2>
1.1       grant    5617:               </div>
                   5618:             </div>
                   5619:           </div>
                   5620: 
1.14      xtraeme  5621:           <p>When you type <span><strong class=
                   5622:           "command">make</strong></span> the distribution files are
                   5623:           unpacked into this directory. It can be removed by
                   5624:           running <span><strong class="command">make
                   5625:           clean</strong></span>. Besides the sources, this
                   5626:           directory is also used to keep various timestamp
1.1       grant    5627:           files.</p>
                   5628: 
                   5629:           <p>If a package doesn't create a subdirectory for itself
                   5630:           (like GNU software does, for instance), but extracts
                   5631:           itself in the current directory, you should set
1.14      xtraeme  5632:           <code class="varname">WRKSRC</code> accordingly, e.g.
1.1       grant    5633:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   5634:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.20      ben      5635:           class="pkgname">editors/sam</a> again, but the quick
                   5636:           answer is:</p>
1.1       grant    5637:           <pre class="programlisting">
                   5638: WRKSRC=                ${WRKDIR}
                   5639: </pre>
                   5640: 
1.14      xtraeme  5641:           <p>Please note that the old <code class=
                   5642:           "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1       grant    5643:           should not be used. Also, if your package doesn't create
1.14      xtraeme  5644:           a subdir with the name of <code class=
                   5645:           "varname">DISTNAME</code> but some different name, set
                   5646:           <code class="varname">WRKSRC</code> to point to the
                   5647:           proper name in <code class="filename">${WRKDIR}</code>.
                   5648:           See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5649:           href=
1.1       grant    5650:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.20      ben      5651:           class="pkgname">lang/tcl</a> and <a xmlns=
                   5652:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5653:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   5654:           class="pkgname">x11/tk</a> for examples, and here is
                   5655:           another one:</p>
1.1       grant    5656:           <pre class="programlisting">
                   5657: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   5658: </pre>
                   5659: 
                   5660:           <p>The name of the working directory created by pkgsrc is
1.14      xtraeme  5661:           <code class="filename">work</code> by default. If the
                   5662:           same pkgsrc tree should be used on several different
                   5663:           platforms, the variable <code class=
                   5664:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1       grant    5665:           attach the platform to the directory name, e.g.
1.14      xtraeme  5666:           <code class="filename">work.i386</code> or <code class=
                   5667:           "filename">work.sparc</code>.</p>
1.1       grant    5668:         </div>
                   5669: 
                   5670:         <div class="sect1" lang="en" xml:lang="en">
                   5671:           <div class="titlepage">
                   5672:             <div>
                   5673:               <div>
                   5674:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      5675:                 "id2627702" id=
        !          5676:                 "id2627702"></a>7.7.&nbsp;<code class=
1.14      xtraeme  5677:                 "filename">files/*</code></h2>
1.1       grant    5678:               </div>
                   5679:             </div>
                   5680:           </div>
                   5681: 
                   5682:           <p>If you have any files that you wish to be placed in
                   5683:           the package prior to configuration or building, you could
                   5684:           place these files here and use a &#8220;<span class=
                   5685:           "quote">${CP}</span>&#8221; command in the
                   5686:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   5687:           target to achieve this. Alternatively, you could simply
1.14      xtraeme  5688:           diff the file against <code class=
                   5689:           "filename">/dev/null</code> and use the patch mechanism
                   5690:           to manage the creation of this file.</p>
1.1       grant    5691:         </div>
                   5692:       </div>
                   5693: 
                   5694:       <div class="chapter" lang="en" xml:lang="en">
                   5695:         <div class="titlepage">
                   5696:           <div>
                   5697:             <div>
                   5698:               <h2 class="title"><a name="plist" id=
                   5699:               "plist"></a>Chapter&nbsp;8.&nbsp;PLIST issues</h2>
                   5700:             </div>
                   5701:           </div>
                   5702:         </div>
                   5703: 
                   5704:         <div class="toc">
                   5705:           <p><b>Table of Contents</b></p>
                   5706: 
                   5707:           <dl>
1.23    ! wiz      5708:             <dt><span class="sect1"><a href="#id2627825">8.1. RCS
1.1       grant    5709:             ID</a></span></dt>
                   5710: 
1.23    ! wiz      5711:             <dt><span class="sect1"><a href="#id2627840">8.2.
1.14      xtraeme  5712:             Semi-automatic <code class="filename">PLIST</code>
                   5713:             generation</a></span></dt>
1.1       grant    5714: 
                   5715:             <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme  5716:             Tweaking output of <span><strong class="command">make
                   5717:             print-PLIST</strong></span></a></span></dt>
1.1       grant    5718: 
                   5719:             <dt><span class="sect1"><a href="#plist.misc">8.4.
                   5720:             Variable substitution in PLIST</a></span></dt>
                   5721: 
1.23    ! wiz      5722:             <dt><span class="sect1"><a href="#id2628229">8.5.
1.1       grant    5723:             Manpage-compression</a></span></dt>
                   5724: 
1.23    ! wiz      5725:             <dt><span class="sect1"><a href="#id2628270">8.6.
1.14      xtraeme  5726:             Changing PLIST source with <code class=
                   5727:             "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5728: 
1.23    ! wiz      5729:             <dt><span class="sect1"><a href="#id2628288">8.7.
1.1       grant    5730:             Platform specific and differing PLISTs</a></span></dt>
                   5731: 
                   5732:             <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
                   5733:             Sharing directories between packages</a></span></dt>
                   5734:           </dl>
                   5735:         </div>
                   5736: 
1.14      xtraeme  5737:         <p>The <code class="filename">PLIST</code> file contains a
1.1       grant    5738:         package's &#8220;<span class="quote">packing
                   5739:         list</span>&#8221;, i.e. a list of files that belong to the
1.14      xtraeme  5740:         package (relative to the <code class=
                   5741:         "filename">${PREFIX}</code> directory it's been installed
                   5742:         in) plus some additional statements - see the <a href=
1.1       grant    5743:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5744:         <span class="citerefentry"><span class=
                   5745:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   5746:         a full list. This chapter addresses some issues that need
1.14      xtraeme  5747:         attention when dealing with the <code class=
                   5748:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    5749: 
                   5750:         <div class="sect1" lang="en" xml:lang="en">
                   5751:           <div class="titlepage">
                   5752:             <div>
                   5753:               <div>
                   5754:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      5755:                 "id2627825" id="id2627825"></a>8.1.&nbsp;RCS
1.1       grant    5756:                 ID</h2>
                   5757:               </div>
                   5758:             </div>
                   5759:           </div>
                   5760: 
                   5761:           <p>Be sure to add a RCS ID line as the first thing in any
1.14      xtraeme  5762:           <code class="filename">PLIST</code> file you write:</p>
1.1       grant    5763:           <pre class="programlisting">
1.17      sketch   5764: @comment $NetBSD$
1.1       grant    5765: </pre>
                   5766:         </div>
                   5767: 
                   5768:         <div class="sect1" lang="en" xml:lang="en">
                   5769:           <div class="titlepage">
                   5770:             <div>
                   5771:               <div>
                   5772:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      5773:                 "id2627840" id=
        !          5774:                 "id2627840"></a>8.2.&nbsp;Semi-automatic
1.14      xtraeme  5775:                 <code class="filename">PLIST</code> generation</h2>
1.1       grant    5776:               </div>
                   5777:             </div>
                   5778:           </div>
                   5779: 
1.14      xtraeme  5780:           <p>You can use the <span><strong class="command">make
                   5781:           print-PLIST</strong></span> command to output a PLIST
                   5782:           that matches any new files since the package was
                   5783:           extracted. See <a href="#build.helpful-targets" title=
1.1       grant    5784:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   5785:           &#8220;Other helpful targets&#8221;</a> for more
                   5786:           information on this target.</p>
                   5787:         </div>
                   5788: 
                   5789:         <div class="sect1" lang="en" xml:lang="en">
                   5790:           <div class="titlepage">
                   5791:             <div>
                   5792:               <div>
                   5793:                 <h2 class="title" style="clear: both"><a name=
                   5794:                 "print-PLIST" id=
                   5795:                 "print-PLIST"></a>8.3.&nbsp;Tweaking output of
1.14      xtraeme  5796:                 <span><strong class="command">make
                   5797:                 print-PLIST</strong></span></h2>
1.1       grant    5798:               </div>
                   5799:             </div>
                   5800:           </div>
                   5801: 
                   5802:           <p>If you have used any of the *-dirs packages, as
                   5803:           explained in <a href="#faq.common-dirs" title=
                   5804:           "8.8.&nbsp;Sharing directories between packages">Section&nbsp;8.8,
                   5805:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  5806:           you may have noticed that <span><strong class=
                   5807:           "command">make print-PLIST</strong></span> outputs a set
                   5808:           of <code class="varname">@comment</code>s instead of real
                   5809:           <code class="varname">@dirrm</code> lines. You can also
                   5810:           do this for specific directories and files, so that the
                   5811:           results of that command are very close to reality. This
                   5812:           helps <span class="emphasis"><em>a lot</em></span> during
                   5813:           the update of packages.</p>
                   5814: 
                   5815:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   5816:           variable takes a set of AWK patterns and actions that are
                   5817:           used to filter the output of print-PLIST. You can
                   5818:           <span class="emphasis"><em>append</em></span> any chunk
                   5819:           of AWK scripting you like to it, but be careful with
1.1       grant    5820:           quoting.</p>
                   5821: 
1.14      xtraeme  5822:           <p>For example, to get all files inside the <code class=
                   5823:           "filename">libdata/foo</code> directory removed from the
1.1       grant    5824:           resulting PLIST:</p>
                   5825:           <pre class="programlisting">
                   5826:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   5827:     
                   5828: </pre>
                   5829: 
1.14      xtraeme  5830:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    5831:           lines referring to a specific (shared) directory
1.14      xtraeme  5832:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    5833:           <pre class="programlisting">
                   5834:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   5835:     
                   5836: </pre>
                   5837:         </div>
                   5838: 
                   5839:         <div class="sect1" lang="en" xml:lang="en">
                   5840:           <div class="titlepage">
                   5841:             <div>
                   5842:               <div>
                   5843:                 <h2 class="title" style="clear: both"><a name=
                   5844:                 "plist.misc" id="plist.misc"></a>8.4.&nbsp;Variable
                   5845:                 substitution in PLIST</h2>
                   5846:               </div>
                   5847:             </div>
                   5848:           </div>
                   5849: 
                   5850:           <p>A number of variables are substituted automatically in
                   5851:           PLISTs when a package is installed on a system. This
                   5852:           includes the following variables:</p>
                   5853: 
                   5854:           <div class="variablelist">
                   5855:             <dl>
1.14      xtraeme  5856:               <dt><span class="term"><code class=
                   5857:               "varname">${MACHINE_ARCH}</code>, <code class=
                   5858:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    5859: 
                   5860:               <dd>
                   5861:                 <p>Some packages like emacs and perl embed
                   5862:                 information about which architecture they were
                   5863:                 built on into the pathnames where they install
                   5864:                 their file. To handle this case, PLIST will be
                   5865:                 preprocessed before actually used, and the symbol
1.14      xtraeme  5866:                 &#8220;<span class="quote"><code class=
                   5867:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   5868:                 be replaced by what <span><strong class=
                   5869:                 "command">uname -p</strong></span> gives. The same
                   5870:                 is done if the string <code class=
                   5871:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   5872:                 PLIST somewhere - use this on packages that have
                   5873:                 GNU autoconf created configure scripts.</p>
1.1       grant    5874: 
                   5875:                 <div class="note" style=
                   5876:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   5877:                   <h3 class="title">Legacy note</h3>
                   5878: 
                   5879:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  5880:                   "quote"><code class=
                   5881:                   "varname">$ARCH</code></span>&#8221; that was
                   5882:                   replaced by the output of <span><strong class=
                   5883:                   "command">uname -m</strong></span>, but that's no
1.1       grant    5884:                   longer supported and has been removed.</p>
                   5885:                 </div>
                   5886:               </dd>
                   5887: 
1.14      xtraeme  5888:               <dt><span class="term"><code class=
                   5889:               "varname">${OPSYS}</code>, <code class=
                   5890:               "varname">${LOWER_OPSYS}</code>, <code class=
                   5891:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    5892: 
                   5893:               <dd>
                   5894:                 <p>Some packages want to embed the OS name and
                   5895:                 version into some paths. To do this, use these
1.14      xtraeme  5896:                 variables in the <code class=
                   5897:                 "filename">PLIST</code>:</p>
1.1       grant    5898: 
                   5899:                 <div class="itemizedlist">
                   5900:                   <ul type="disc">
                   5901:                     <li>
1.14      xtraeme  5902:                       <p><code class="varname">${OPSYS}</code> -
                   5903:                       output of &#8220;<span class=
                   5904:                       "quote"><span><strong class="command">uname
                   5905:                       -s</strong></span></span>&#8221;</p>
1.1       grant    5906:                     </li>
                   5907: 
                   5908:                     <li>
1.14      xtraeme  5909:                       <p><code class=
                   5910:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   5911:                       common name (eg. &#8220;<span class=
                   5912:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    5913:                     </li>
                   5914: 
                   5915:                     <li>
1.14      xtraeme  5916:                       <p><code class="varname">${OS_VERSION}</code>
                   5917:                       - &#8220;<span class=
                   5918:                       "quote"><span><strong class="command">uname
                   5919:                       -r</strong></span></span>&#8221;</p>
1.1       grant    5920:                     </li>
                   5921:                   </ul>
                   5922:                 </div>
                   5923:               </dd>
                   5924: 
1.14      xtraeme  5925:               <dt><span class="term"><code class=
                   5926:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    5927: 
                   5928:               <dd>
                   5929:                 <p>Packages that install locale files should list
                   5930:                 them in the PLIST as &#8220;<span class=
                   5931:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   5932:                 instead of &#8220;<span class=
                   5933:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   5934:                 This properly handles the fact that different
                   5935:                 operating systems expect locale files to be either
1.14      xtraeme  5936:                 in <code class="filename">share</code> or
                   5937:                 <code class="filename">lib</code> by default.</p>
1.1       grant    5938:               </dd>
                   5939:             </dl>
                   5940:           </div>
                   5941: 
                   5942:           <p>For a complete list of values which are replaced by
1.14      xtraeme  5943:           default, please look in <code class=
                   5944:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    5945:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   5946: 
                   5947:           <p>If you want to change other variables not listed
                   5948:           above, you can add variables and their expansions to this
1.14      xtraeme  5949:           variable in the following way, similar to <code class=
                   5950:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    5951:           "#components.optional" title=
                   5952:           "7.5.&nbsp;Optional files">Section&nbsp;7.5,
                   5953:           &#8220;Optional files&#8221;</a>):</p>
                   5954:           <pre class="programlisting">
                   5955: PLIST_SUBST+=    SOMEVAR="somevalue"
                   5956: </pre>
                   5957: 
                   5958:           <p>This replaces all occurrences of &#8220;<span class=
                   5959:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   5960:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   5961:         </div>
                   5962: 
                   5963:         <div class="sect1" lang="en" xml:lang="en">
                   5964:           <div class="titlepage">
                   5965:             <div>
                   5966:               <div>
                   5967:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      5968:                 "id2628229" id=
        !          5969:                 "id2628229"></a>8.5.&nbsp;Manpage-compression</h2>
1.1       grant    5970:               </div>
                   5971:             </div>
                   5972:           </div>
                   5973: 
                   5974:           <p>Manpages should be installed in compressed form if
1.14      xtraeme  5975:           <code class="varname">MANZ</code> is set (in <code class=
                   5976:           "filename">bsd.own.mk</code>), and uncompressed
                   5977:           otherwise. To handle this in the <code class=
                   5978:           "filename">PLIST</code> file, the suffix
                   5979:           &#8220;<span class="quote">.gz</span>&#8221; is
                   5980:           appended/removed automatically for manpages according to
                   5981:           <code class="varname">MANZ</code> and <code class=
                   5982:           "varname">MANCOMPRESSED</code> being set or not, see
                   5983:           above for details. This modification of the <code class=
                   5984:           "filename">PLIST</code> file is done on a copy of it, not
                   5985:           <code class="filename">PLIST</code> itself.</p>
1.1       grant    5986:         </div>
                   5987: 
                   5988:         <div class="sect1" lang="en" xml:lang="en">
                   5989:           <div class="titlepage">
                   5990:             <div>
                   5991:               <div>
                   5992:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      5993:                 "id2628270" id="id2628270"></a>8.6.&nbsp;Changing
1.14      xtraeme  5994:                 PLIST source with <code class=
                   5995:                 "varname">PLIST_SRC</code></h2>
1.1       grant    5996:               </div>
                   5997:             </div>
                   5998:           </div>
                   5999: 
1.14      xtraeme  6000:           <p>To use one or more files as source for the
                   6001:           <code class="filename">PLIST</code> used in generating
                   6002:           the binary package, set the variable <code class=
                   6003:           "varname">PLIST_SRC</code> to the names of that file(s).
1.1       grant    6004:           The files are later concatenated using cat(1), and order
                   6005:           of things is important.</p>
                   6006:         </div>
                   6007: 
                   6008:         <div class="sect1" lang="en" xml:lang="en">
                   6009:           <div class="titlepage">
                   6010:             <div>
                   6011:               <div>
                   6012:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      6013:                 "id2628288" id="id2628288"></a>8.7.&nbsp;Platform
1.1       grant    6014:                 specific and differing PLISTs</h2>
                   6015:               </div>
                   6016:             </div>
                   6017:           </div>
                   6018: 
                   6019:           <p>Some packages decide to install a different set of
                   6020:           files based on the operating system being used. These
                   6021:           differences can be automatically handled by using the
                   6022:           following files:</p>
                   6023: 
                   6024:           <div class="itemizedlist">
                   6025:             <ul type="disc">
                   6026:               <li>
1.14      xtraeme  6027:                 <p><code class="filename">PLIST.common</code></p>
1.1       grant    6028:               </li>
                   6029: 
                   6030:               <li>
1.14      xtraeme  6031:                 <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1       grant    6032:               </li>
                   6033: 
                   6034:               <li>
1.14      xtraeme  6035:                 <p><code class=
1.21      ben      6036:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   6037:               </li>
                   6038: 
                   6039:               <li>
                   6040:                 <p><code class=
                   6041:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   6042:               </li>
                   6043: 
                   6044:               <li>
                   6045:                 <p><code class=
1.14      xtraeme  6046:                 "filename">PLIST.common_end</code></p>
1.1       grant    6047:               </li>
                   6048:             </ul>
                   6049:           </div>
                   6050:         </div>
                   6051: 
                   6052:         <div class="sect1" lang="en" xml:lang="en">
                   6053:           <div class="titlepage">
                   6054:             <div>
                   6055:               <div>
                   6056:                 <h2 class="title" style="clear: both"><a name=
                   6057:                 "faq.common-dirs" id=
                   6058:                 "faq.common-dirs"></a>8.8.&nbsp;Sharing directories
                   6059:                 between packages</h2>
                   6060:               </div>
                   6061:             </div>
                   6062:           </div>
                   6063: 
                   6064:           <p>A &#8220;<span class="quote">shared
                   6065:           directory</span>&#8221; is a directory where multiple
                   6066:           (and unrelated) packages install files. These directories
                   6067:           are problematic because you have to add special tricks in
                   6068:           the PLIST to conditionally remove them, or have some
                   6069:           centralized package handle them.</p>
                   6070: 
                   6071:           <p>Within pkgsrc, you'll find both approaches. If a
                   6072:           directory is shared by a few unrelated packages, it's
                   6073:           often not worth to add an extra package to remove it.
                   6074:           Therefore, one simply does:</p>
                   6075:           <pre class="programlisting">
                   6076:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   6077:     
                   6078: </pre>
                   6079: 
                   6080:           <p>in the PLISTs of all affected packages, instead of the
                   6081:           regular "@dirrm" line.</p>
                   6082: 
                   6083:           <p>However, if the directory is shared across many
                   6084:           packages, two different solutions are available:</p>
                   6085: 
                   6086:           <div class="orderedlist">
                   6087:             <ol type="1">
                   6088:               <li>
                   6089:                 <p>If the packages have a common dependency, the
                   6090:                 directory can be removed in that. For example, see
                   6091:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6092:                 href=
                   6093:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20      ben      6094:                 class="pkgname">textproc/scrollkeeper</a>, which
                   6095:                 removes the shared directory <code class=
                   6096:                 "filename">share/omf</code>.</p>
1.1       grant    6097:               </li>
                   6098: 
                   6099:               <li>
                   6100:                 <p>If the packages using the directory are not
                   6101:                 related at all (they have no common dependencies),
                   6102:                 a *-dirs package is used.</p>
                   6103:               </li>
                   6104:             </ol>
                   6105:           </div>
                   6106: 
                   6107:           <p>From now on, we'll discuss the second solution. To get
                   6108:           an idea of the *-dirs packages available, issue:</p>
                   6109:           <pre class="programlisting">
1.14      xtraeme  6110:       <code class="prompt">%</code> cd .../pkgsrc
                   6111:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    6112:     
                   6113: </pre>
                   6114: 
                   6115:           <p>Their use from other packages is very simple. The
1.14      xtraeme  6116:           <code class="varname">USE_DIRS</code> variable takes a
                   6117:           list of package names (without the &#8220;<span class=
1.1       grant    6118:           "quote">-dirs</span>&#8221; part) together with the
                   6119:           required version number (always pick the latest one when
                   6120:           writting new packages).</p>
                   6121: 
                   6122:           <p>For example, if a package installs files under
1.14      xtraeme  6123:           <code class="filename">share/applications</code>, it
                   6124:           should have the following line in it:</p>
1.1       grant    6125:           <pre class="programlisting">
                   6126:       USE_DIRS+= xdg-1.1
                   6127:     
                   6128: </pre>
                   6129: 
1.14      xtraeme  6130:           <p>After regenerating the PLIST using
                   6131:           <span><strong class="command">make
                   6132:           print-PLIST</strong></span>, you should get the right
                   6133:           (commented out) lines.</p>
1.1       grant    6134: 
1.14      xtraeme  6135:           <p>Note that, even if your package is using <code class=
                   6136:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    6137:           *-x11-dirs packages. Just specify the name without that
1.14      xtraeme  6138:           part and pkgsrc (in particular, <code class=
                   6139:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    6140:         </div>
                   6141:       </div>
                   6142: 
                   6143:       <div class="chapter" lang="en" xml:lang="en">
                   6144:         <div class="titlepage">
                   6145:           <div>
                   6146:             <div>
                   6147:               <h2 class="title"><a name="buildlink" id=
                   6148:               "buildlink"></a>Chapter&nbsp;9.&nbsp;Buildlink
                   6149:               methodology</h2>
                   6150:             </div>
                   6151:           </div>
                   6152:         </div>
                   6153: 
                   6154:         <div class="toc">
                   6155:           <p><b>Table of Contents</b></p>
                   6156: 
                   6157:           <dl>
1.23    ! wiz      6158:             <dt><span class="sect1"><a href="#id2628486">9.1.
1.1       grant    6159:             Converting packages to use buildlink3</a></span></dt>
                   6160: 
1.23    ! wiz      6161:             <dt><span class="sect1"><a href="#id2628872">9.2.
1.14      xtraeme  6162:             Writing <code class="filename">buildlink3.mk</code>
                   6163:             files</a></span></dt>
1.1       grant    6164: 
                   6165:             <dd>
                   6166:               <dl>
1.23    ! wiz      6167:                 <dt><span class="sect2"><a href="#id2628941">9.2.1.
1.1       grant    6168:                 Anatomy of a buildlink3.mk file</a></span></dt>
                   6169: 
1.23    ! wiz      6170:                 <dt><span class="sect2"><a href="#id2629382">9.2.2.
1.14      xtraeme  6171:                 Updating <code class=
                   6172:                 "varname">BUILDLINK_DEPENDS.<em class=
                   6173:                 "replaceable"><code>pkg</code></em></code> in
                   6174:                 <code class="filename">buildlink3.mk</code>
1.1       grant    6175:                 files</a></span></dt>
                   6176:               </dl>
                   6177:             </dd>
                   6178: 
1.23    ! wiz      6179:             <dt><span class="sect1"><a href="#id2629461">9.3.
1.14      xtraeme  6180:             Writing <code class="filename">builtin.mk</code>
                   6181:             files</a></span></dt>
1.1       grant    6182: 
                   6183:             <dd>
                   6184:               <dl>
1.23    ! wiz      6185:                 <dt><span class="sect2"><a href="#id2629542">9.3.1.
1.14      xtraeme  6186:                 Anatomy of a <code class=
                   6187:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    6188: 
1.23    ! wiz      6189:                 <dt><span class="sect2"><a href="#id2629837">9.3.2.
1.1       grant    6190:                 Global preferences for native or pkgsrc
                   6191:                 software</a></span></dt>
                   6192:               </dl>
                   6193:             </dd>
                   6194:           </dl>
                   6195:         </div>
                   6196: 
                   6197:         <p>Buildlink is a framework in pkgsrc that controls what
                   6198:         headers and libraries are seen by a package's configure and
                   6199:         build processes. This is implemented in a two step
                   6200:         process:</p>
                   6201: 
                   6202:         <div class="orderedlist">
                   6203:           <ol type="1">
                   6204:             <li>
                   6205:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  6206:               into <code class="varname">BUILDLINK_DIR</code>,
                   6207:               which by default is a subdirectory of <code class=
                   6208:               "varname">WRKDIR</code>.</p>
1.1       grant    6209:             </li>
                   6210: 
                   6211:             <li>
                   6212:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  6213:               the normal compiler tools that translate <code class=
                   6214:               "option">-I${LOCALBASE}/include</code> and
                   6215:               <code class="option">-L${LOCALBASE}/lib</code> into
                   6216:               references to <code class=
                   6217:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   6218:               also make native compiler on some operating systems
                   6219:               look like GCC, so that packages that expect GCC won't
                   6220:               require modifications to build with those native
                   6221:               compilers.</p>
1.1       grant    6222:             </li>
                   6223:           </ol>
                   6224:         </div>
                   6225: 
                   6226:         <p>This normalizes the environment in which a package is
                   6227:         built so that the package may be built consistently despite
                   6228:         what other software may be installed. Please note that the
1.14      xtraeme  6229:         normal system header and library paths, e.g. <code class=
                   6230:         "filename">/usr/include</code>, <code class=
                   6231:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    6232:         buildlink3 is designed to insulate the package build from
                   6233:         non-system-supplied software.</p>
                   6234: 
                   6235:         <div class="sect1" lang="en" xml:lang="en">
                   6236:           <div class="titlepage">
                   6237:             <div>
                   6238:               <div>
                   6239:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      6240:                 "id2628486" id="id2628486"></a>9.1.&nbsp;Converting
1.1       grant    6241:                 packages to use buildlink3</h2>
                   6242:               </div>
                   6243:             </div>
                   6244:           </div>
                   6245: 
                   6246:           <p>The process of converting packages to use the
                   6247:           buildlink3 framework (&#8220;<span class=
                   6248:           "quote">bl3ifying</span>&#8221;) is fairly
                   6249:           straightforward. The things to keep in mind are:</p>
                   6250: 
                   6251:           <div class="orderedlist">
                   6252:             <ol type="1">
                   6253:               <li>
                   6254:                 <p>Ensure that the build always calls the wrapper
                   6255:                 scripts instead of the actual toolchain. Some
                   6256:                 packages are tricky, and the only way to know for
1.14      xtraeme  6257:                 sure is the check <code class=
                   6258:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    6259:                 wrappers are being invoked.</p>
                   6260:               </li>
                   6261: 
                   6262:               <li>
1.14      xtraeme  6263:                 <p>Don't override <code class=
                   6264:                 "varname">PREFIX</code> from within the package
                   6265:                 Makefile, e.g. Java VMs, standalone shells, etc.,
                   6266:                 because the code to symlink files into <code class=
                   6267:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    6268:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  6269:                 <em class=
                   6270:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    6271:               </li>
                   6272: 
                   6273:               <li>
                   6274:                 <p>Remember that <span class=
1.14      xtraeme  6275:                 "emphasis"><em>only</em></span> the <code class=
                   6276:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    6277:                 in a package's Makefile are added as dependencies
                   6278:                 for that package.</p>
                   6279:               </li>
                   6280:             </ol>
                   6281:           </div>
                   6282: 
                   6283:           <p>If a dependency on a particular package is required
                   6284:           for its libraries and headers, then we replace:</p>
                   6285:           <pre class="programlisting">
                   6286: DEPENDS+=       foo&gt;=1.1.0:../../category/foo
                   6287: </pre>
                   6288: 
                   6289:           <p>with</p>
                   6290:           <pre class="programlisting">
                   6291: .include "../../category/foo/buildlink3.mk"
                   6292: </pre>
                   6293: 
1.14      xtraeme  6294:           <p>There are several <code class=
                   6295:           "filename">buildlink3.mk</code> files in <code class=
                   6296:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    6297:           issues:</p>
                   6298: 
                   6299:           <div class="itemizedlist">
                   6300:             <ul type="disc">
                   6301:               <li>
1.14      xtraeme  6302:                 <p><code class="filename">bdb.buildlink3.mk</code>
1.1       grant    6303:                 chooses either the native or a pkgsrc Berkeley DB
1.14      xtraeme  6304:                 implementation based on the values of <code class=
                   6305:                 "varname">BDB_ACCEPTED</code> and <code class=
                   6306:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    6307:               </li>
                   6308: 
                   6309:               <li>
1.14      xtraeme  6310:                 <p><code class=
                   6311:                 "filename">curses.buildlink3.mk</code> If the
                   6312:                 system comes with neither Curses nor NCurses, this
                   6313:                 will take care to install the <a xmlns=
                   6314:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    6315:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20      ben      6316:                 class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    6317:               </li>
                   6318: 
                   6319:               <li>
1.14      xtraeme  6320:                 <p><code class="filename">krb5.buildlink3.mk</code>
                   6321:                 uses the value of <code class=
                   6322:                 "varname">KRB5_ACCEPTED</code> to choose between
1.1       grant    6323:                 adding a dependency on Heimdal or MIT-krb5 for
                   6324:                 packages that require a Kerberos 5
                   6325:                 implementation.</p>
                   6326:               </li>
                   6327: 
                   6328:               <li>
1.14      xtraeme  6329:                 <p><code class=
                   6330:                 "filename">motif.buildlink3.mk</code> checks for a
                   6331:                 system-provided Motif installation or adds a
                   6332:                 dependency on <a xmlns=
1.1       grant    6333:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6334:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20      ben      6335:                 class="pkgname">x11/lesstif</a> or <a xmlns=
                   6336:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6337:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
                   6338:                 class="pkgname">x11/openmotif</a>;</p>
1.1       grant    6339:               </li>
                   6340: 
                   6341:               <li>
1.14      xtraeme  6342:                 <p><code class=
                   6343:                 "filename">ossaudio.buildlink3.mk</code> defines
                   6344:                 several variables that may be used by packages that
                   6345:                 use the Open Sound System (OSS) API;</p>
1.1       grant    6346:               </li>
                   6347: 
                   6348:               <li>
1.14      xtraeme  6349:                 <p><code class=
                   6350:                 "filename">pgsql.buildlink3.mk</code> will accept
                   6351:                 either Postgres 7.3 or 7.4, whichever is found
                   6352:                 installed. See the file for more information.</p>
1.1       grant    6353:               </li>
                   6354: 
                   6355:               <li>
1.14      xtraeme  6356:                 <p><code class=
                   6357:                 "filename">pthread.buildlink3.mk</code> uses the
                   6358:                 value of <code class="varname">PTHREAD_OPTS</code>
                   6359:                 and checks for native pthreads or adds a dependency
                   6360:                 on <a xmlns=
1.1       grant    6361:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6362:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20      ben      6363:                 class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    6364:               </li>
                   6365: 
                   6366:               <li>
1.14      xtraeme  6367:                 <p><code class="filename">xaw.buildlink3.mk</code>
                   6368:                 uses the value of <code class=
                   6369:                 "varname">XAW_TYPE</code> to choose a particular
                   6370:                 Athena widgets library.</p>
1.1       grant    6371:               </li>
                   6372:             </ul>
                   6373:           </div>
                   6374: 
1.14      xtraeme  6375:           <p>The comments in those <code class=
                   6376:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    6377:           complete description of how to use them properly.</p>
                   6378:         </div>
                   6379: 
                   6380:         <div class="sect1" lang="en" xml:lang="en">
                   6381:           <div class="titlepage">
                   6382:             <div>
                   6383:               <div>
                   6384:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      6385:                 "id2628872" id="id2628872"></a>9.2.&nbsp;Writing
1.14      xtraeme  6386:                 <code class="filename">buildlink3.mk</code>
                   6387:                 files</h2>
1.1       grant    6388:               </div>
                   6389:             </div>
                   6390:           </div>
                   6391: 
1.14      xtraeme  6392:           <p>A package's <code class=
                   6393:           "filename">buildlink3.mk</code> file is included by
                   6394:           Makefiles to indicate the need to compile and link
                   6395:           against header files and libraries provided by the
                   6396:           package. A <code class="filename">buildlink3.mk</code>
                   6397:           file should always provide enough information to add the
                   6398:           correct type of dependency relationship and include any
                   6399:           other <code class="filename">buildlink3.mk</code> files
                   6400:           that it needs to find headers and libraries that it needs
                   6401:           in turn.</p>
1.1       grant    6402: 
1.14      xtraeme  6403:           <p>To generate an initial <code class=
                   6404:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    6405:           Rene Hexel's <a xmlns=
                   6406:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6407:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20      ben      6408:           class="pkgname">pkgtools/createbuildlink</a> package is
                   6409:           highly recommended. For most packages, the following
                   6410:           command will generate a good starting point for
                   6411:           <code class="filename">buildlink3.mk</code> files:</p>
1.1       grant    6412:           <pre class="screen">
1.14      xtraeme  6413: <code class="prompt">%</code> <strong class=
                   6414: "userinput"><code>cd pkgsrc/<em class=
                   6415: "replaceable"><code>category</code></em>/<em class=
                   6416: "replaceable"><code>pkgdir</code></em>
                   6417: <code class=
                   6418: "prompt">%</code> createbuildlink -3 &gt;buildlink3.mk</code></strong>
1.1       grant    6419: </pre>
                   6420: 
                   6421:           <div class="sect2" lang="en" xml:lang="en">
                   6422:             <div class="titlepage">
                   6423:               <div>
                   6424:                 <div>
1.23    ! wiz      6425:                   <h3 class="title"><a name="id2628941" id=
        !          6426:                   "id2628941"></a>9.2.1. Anatomy of a buildlink3.mk
1.1       grant    6427:                   file</h3>
                   6428:                 </div>
                   6429:               </div>
                   6430:             </div>
                   6431: 
1.14      xtraeme  6432:             <p>The following real-life example <code class=
                   6433:             "filename">buildlink3.mk</code> is taken from
                   6434:             <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    6435:             <pre class="programlisting">
1.17      sketch   6436: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    6437: 
                   6438: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   6439: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   6440: 
                   6441: .if !empty(BUILDLINK_DEPTH:M+)
                   6442: BUILDLINK_DEPENDS+=     tiff
                   6443: .endif
                   6444: 
                   6445: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   6446: BUILDLINK_PACKAGES+=    tiff
                   6447: 
                   6448: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   6449: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   6450: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   6451: .endif  # TIFF_BUILDLINK3_MK
                   6452: 
                   6453: .include "../../devel/zlib/buildlink3.mk"
                   6454: .include "../../graphics/jpeg/buildlink3.mk"
                   6455: 
                   6456: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   6457: </pre>
                   6458: 
1.14      xtraeme  6459:             <p>The header and footer manipulate <code class=
                   6460:             "varname">BUILDLINK_DEPTH</code>, which is common
                   6461:             across all <code class="filename">buildlink3.mk</code>
                   6462:             files and is used to track at what depth we are
                   6463:             including <code class="filename">buildlink3.mk</code>
                   6464:             files.</p>
1.1       grant    6465: 
                   6466:             <p>The first section controls if the dependency on
1.14      xtraeme  6467:             <em class="replaceable"><code>pkg</code></em> is added.
                   6468:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    6469:             global list of packages for which dependencies are
                   6470:             added by buildlink3.</p>
                   6471: 
                   6472:             <p>The second section advises pkgsrc that the
1.14      xtraeme  6473:             <code class="filename">buildlink3.mk</code> file for
                   6474:             <em class="replaceable"><code>pkg</code></em> has been
                   6475:             included at some point. <code class=
                   6476:             "varname">BUILDLINK_PACKAGES</code> is the global list
                   6477:             of packages for which <code class=
                   6478:             "filename">buildlink3.mk</code> files have been
                   6479:             included. It must <span class=
                   6480:             "emphasis"><em>always</em></span> be appended to within
                   6481:             a <code class="filename">buildlink3.mk</code> file.</p>
1.1       grant    6482: 
                   6483:             <p>The third section is protected from multiple
1.14      xtraeme  6484:             inclusion and controls how the dependency on <em class=
                   6485:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    6486:             important variables are set in the section:</p>
                   6487: 
                   6488:             <div class="itemizedlist">
                   6489:               <ul type="disc">
                   6490:                 <li>
1.14      xtraeme  6491:                   <p><code class=
                   6492:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6493:                   "replaceable"><code>pkg</code></em></code> is the
                   6494:                   actual dependency recorded in the installed
                   6495:                   package; this should always be set using
                   6496:                   <span><strong class="command">+=</strong></span>
                   6497:                   to ensure that we're appending to any
                   6498:                   pre-existing list of values. This variable should
                   6499:                   be set to the first version of the package that
                   6500:                   had the last change in the major number of a
                   6501:                   shared library or that had a major API
                   6502:                   change.</p>
1.1       grant    6503:                 </li>
                   6504: 
                   6505:                 <li>
1.14      xtraeme  6506:                   <p><code class=
                   6507:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   6508:                   "replaceable"><code>pkg</code></em></code> is the
                   6509:                   location of the <em class=
                   6510:                   "replaceable"><code>pkg</code></em> pkgsrc
1.1       grant    6511:                   directory;</p>
                   6512:                 </li>
                   6513: 
                   6514:                 <li>
1.14      xtraeme  6515:                   <p><code class=
                   6516:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6517:                   "replaceable"><code>pkg</code></em></code> (not
                   6518:                   shown above) controls whether we use <code class=
                   6519:                   "varname">BUILD_DEPENDS</code> or <code class=
                   6520:                   "varname">DEPENDS</code> to add the dependency on
                   6521:                   <em class="replaceable"><code>pkg</code></em>.
                   6522:                   The build dependency is selected by setting
                   6523:                   <code class=
                   6524:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6525:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    6526:                   &#8220;<span class="quote">build</span>&#8221;.
                   6527:                   By default, the full dependency is used.</p>
                   6528:                 </li>
                   6529: 
                   6530:                 <li>
1.14      xtraeme  6531:                   <p><code class=
                   6532:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6533:                   "replaceable"><code>pkg</code></em></code> and
                   6534:                   <code class=
                   6535:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
                   6536:                   <code>pkg</code></em></code> (not shown above)
                   6537:                   are lists of subdirectories of <code class=
                   6538:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6539:                   "replaceable"><code>pkg</code></em>}</code> to
                   6540:                   add to the header and library search paths. These
1.1       grant    6541:                   default to &#8220;<span class=
                   6542:                   "quote">include</span>&#8221; and
                   6543:                   &#8220;<span class="quote">lib</span>&#8221;
                   6544:                   respectively.</p>
                   6545:                 </li>
                   6546: 
                   6547:                 <li>
1.14      xtraeme  6548:                   <p><code class=
                   6549:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   6550:                   "replaceable"><code>pkg</code></em></code> (not
                   6551:                   shown above) is the list of preprocessor flags to
                   6552:                   add to <code class="varname">CPPFLAGS</code>,
                   6553:                   which are passed on to the configure and build
                   6554:                   phases. The &#8220;<span class=
                   6555:                   "quote">-I</span>&#8221; option should be avoided
                   6556:                   and instead be handled using <code class=
                   6557:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6558:                   "replaceable"><code>pkg</code></em></code> as
                   6559:                   above.</p>
1.1       grant    6560:                 </li>
                   6561:               </ul>
                   6562:             </div>
                   6563: 
                   6564:             <p>The following variables are all optionally defined
                   6565:             within this second section (protected against multiple
                   6566:             inclusion) and control which package files are
1.14      xtraeme  6567:             symlinked into <code class=
                   6568:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    6569:             are transformed during the symlinking:</p>
                   6570: 
                   6571:             <div class="itemizedlist">
                   6572:               <ul type="disc">
                   6573:                 <li>
1.14      xtraeme  6574:                   <p><code class=
                   6575:                   "varname">BUILDLINK_FILES.<em class=
                   6576:                   "replaceable"><code>pkg</code></em></code> (not
                   6577:                   shown above) is a shell glob pattern relative to
                   6578:                   <code class=
                   6579:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6580:                   "replaceable"><code>pkg</code></em>}</code> to be
                   6581:                   symlinked into <code class=
                   6582:                   "filename">${BUILDLINK_DIR}</code>, e.g.
                   6583:                   <code class="filename">include/*.h</code>.</p>
1.1       grant    6584:                 </li>
                   6585: 
                   6586:                 <li>
1.14      xtraeme  6587:                   <p><code class=
                   6588:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   6589:                   "replaceable"><code>pkg</code></em></code> (not
                   6590:                   shown above) is a shell pipeline that outputs to
                   6591:                   stdout a list of files relative to <code class=
                   6592:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6593:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    6594:                   resulting files are to be symlinked into
1.14      xtraeme  6595:                   <code class="filename">${BUILDLINK_DIR}</code>.
                   6596:                   By default, this takes the <code class=
                   6597:                   "filename">+CONTENTS</code> of a <em class=
                   6598:                   "replaceable"><code>pkg</code></em> and filters
                   6599:                   it through <code class=
                   6600:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   6601:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    6602:                 </li>
                   6603: 
                   6604:                 <li>
1.14      xtraeme  6605:                   <p><code class=
                   6606:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6607:                   "replaceable"><code>pkg</code></em></code> (not
                   6608:                   shown above) is a filter command that filters
                   6609:                   <code class="filename">+CONTENTS</code> input
                   6610:                   into a list of files relative to <code class=
                   6611:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6612:                   "replaceable"><code>pkg</code></em>}</code> on
                   6613:                   stdout. By default for overwrite packages,
                   6614:                   <code class=
                   6615:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6616:                   "replaceable"><code>pkg</code></em></code>
                   6617:                   outputs the contents of the <code class=
                   6618:                   "filename">include</code> and <code class=
                   6619:                   "filename">lib</code> directories in the package
                   6620:                   <code class="filename">+CONTENTS</code>, and for
                   6621:                   pkgviews packages, it outputs any libtool
                   6622:                   archives in <code class="filename">lib</code>
1.1       grant    6623:                   directories.</p>
                   6624:                 </li>
                   6625: 
                   6626:                 <li>
1.14      xtraeme  6627:                   <p><code class=
                   6628:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   6629:                   "replaceable"><code>pkg</code></em></code> (not
                   6630:                   shown above) is a list of sed arguments used to
1.1       grant    6631:                   transform the name of the source filename into a
1.14      xtraeme  6632:                   destination filename, e.g. <span><strong class=
1.1       grant    6633:                   "command">-e
1.14      xtraeme  6634:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    6635:                 </li>
                   6636:               </ul>
                   6637:             </div>
                   6638: 
1.14      xtraeme  6639:             <p>The last section includes any <code class=
                   6640:             "filename">buildlink3.mk</code> needed for <em class=
                   6641:             "replaceable"><code>pkg</code></em>'s library
                   6642:             dependencies. Including these <code class=
                   6643:             "filename">buildlink3.mk</code> files means that the
                   6644:             headers and libraries for these dependencies are also
                   6645:             symlinked into <code class=
                   6646:             "filename">${BUILDLINK_DIR}</code> whenever the
                   6647:             <em class="replaceable"><code>pkg</code></em>
                   6648:             <code class="filename">buildlink3.mk</code> file is
                   6649:             included.</p>
1.1       grant    6650:           </div>
                   6651: 
                   6652:           <div class="sect2" lang="en" xml:lang="en">
                   6653:             <div class="titlepage">
                   6654:               <div>
                   6655:                 <div>
1.23    ! wiz      6656:                   <h3 class="title"><a name="id2629382" id=
        !          6657:                   "id2629382"></a>9.2.2. Updating <code class=
1.14      xtraeme  6658:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6659:                   "replaceable"><code>pkg</code></em></code> in
                   6660:                   <code class="filename">buildlink3.mk</code>
                   6661:                   files</h3>
1.1       grant    6662:                 </div>
                   6663:               </div>
                   6664:             </div>
                   6665: 
                   6666:             <p>There are two situations that require increasing the
1.14      xtraeme  6667:             dependency listed in <code class=
                   6668:             "varname">BUILDLINK_DEPENDS.<em class=
                   6669:             "replaceable"><code>pkg</code></em></code> after a
                   6670:             package update:</p>
1.1       grant    6671: 
                   6672:             <div class="orderedlist">
                   6673:               <ol type="1">
                   6674:                 <li>
                   6675:                   <p>if the sonames (major number of the library
                   6676:                   version) of any installed shared libraries
                   6677:                   change;</p>
                   6678:                 </li>
                   6679: 
                   6680:                 <li>
                   6681:                   <p>if the API or interface to the header files
                   6682:                   change.</p>
                   6683:                 </li>
                   6684:               </ol>
                   6685:             </div>
                   6686: 
1.14      xtraeme  6687:             <p>In these cases, <code class=
                   6688:             "varname">BUILDLINK_DEPENDS.<em class=
                   6689:             "replaceable"><code>pkg</code></em></code> should be
                   6690:             adjusted to require at least the new package version.
                   6691:             In some cases, the packages that depend on this new
                   6692:             version may need their <code class=
                   6693:             "varname">PKGREVISION</code>s increased and, if they
                   6694:             have <code class="filename">buildlink3.mk</code> files,
                   6695:             their <code class=
                   6696:             "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
                   6697:             pkg</code></em></code> adjusted, too. This is needed so
                   6698:             that binary packages made using it will require the
                   6699:             correct package dependency and not settle for an older
                   6700:             one which will not contain the necessary shared
                   6701:             libraries.</p>
1.1       grant    6702: 
                   6703:             <p>Please take careful consideration before adjusting
1.14      xtraeme  6704:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   6705:             "replaceable"><code>pkg</code></em></code> as we don't
                   6706:             want to cause unneeded package deletions and rebuilds.
                   6707:             In many cases, new versions of packages work just fine
                   6708:             with older dependencies. See <a href="#dependencies"
                   6709:             title="12.1.3.&nbsp;Handling dependencies">Section
                   6710:             12.1.3, &#8220;Handling dependencies&#8221;</a> and
                   6711:             <a href="#buildlink" title=
1.1       grant    6712:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter 9,
                   6713:             <i>Buildlink methodology</i></a> for more information
                   6714:             about dependencies on other packages, including the
1.14      xtraeme  6715:             <code class="varname">BUILDLINK_RECOMMENDED</code> and
                   6716:             <code class="varname">RECOMMENDED</code>
                   6717:             definitions.</p>
1.1       grant    6718:           </div>
                   6719:         </div>
                   6720: 
                   6721:         <div class="sect1" lang="en" xml:lang="en">
                   6722:           <div class="titlepage">
                   6723:             <div>
                   6724:               <div>
                   6725:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      6726:                 "id2629461" id="id2629461"></a>9.3.&nbsp;Writing
1.14      xtraeme  6727:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    6728:               </div>
                   6729:             </div>
                   6730:           </div>
                   6731: 
                   6732:           <p>Some packages in pkgsrc install headers and libraries
                   6733:           that coincide with headers and libraries present in the
1.14      xtraeme  6734:           base system. Aside from a <code class=
                   6735:           "filename">buildlink3.mk</code> file, these packages
                   6736:           should also include a <code class=
                   6737:           "filename">builtin.mk</code> file that includes the
                   6738:           necessary checks to decide whether using the built-in
                   6739:           software or the pkgsrc software is appropriate.</p>
1.1       grant    6740: 
                   6741:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  6742:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    6743: 
                   6744:           <div class="orderedlist">
                   6745:             <ol type="1">
                   6746:               <li>
1.14      xtraeme  6747:                 <p>It should set <code class=
                   6748:                 "varname">USE_BUILTIN.<em class=
                   6749:                 "replaceable"><code>pkg</code></em></code> to
                   6750:                 either &#8220;<span class="quote">yes</span>&#8221;
                   6751:                 or &#8220;<span class="quote">no</span>&#8221;
                   6752:                 after it is included.</p>
1.1       grant    6753:               </li>
                   6754: 
                   6755:               <li>
                   6756:                 <p>It should <span class=
                   6757:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  6758:                 <code class="varname">USE_BUILTIN.<em class=
                   6759:                 "replaceable"><code>pkg</code></em></code> which is
                   6760:                 already set before the <code class=
                   6761:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    6762:               </li>
                   6763: 
                   6764:               <li>
                   6765:                 <p>It should be written to allow multiple
                   6766:                 inclusion. This is <span class=
                   6767:                 "emphasis"><em>very</em></span> important and takes
1.14      xtraeme  6768:                 careful attention to <code class=
                   6769:                 "filename">Makefile</code> coding.</p>
1.1       grant    6770:               </li>
                   6771:             </ol>
                   6772:           </div>
                   6773: 
                   6774:           <div class="sect2" lang="en" xml:lang="en">
                   6775:             <div class="titlepage">
                   6776:               <div>
                   6777:                 <div>
1.23    ! wiz      6778:                   <h3 class="title"><a name="id2629542" id=
        !          6779:                   "id2629542"></a>9.3.1.&nbsp;Anatomy of a
1.14      xtraeme  6780:                   <code class="filename">builtin.mk</code>
                   6781:                   file</h3>
1.1       grant    6782:                 </div>
                   6783:               </div>
                   6784:             </div>
                   6785: 
                   6786:             <p>The following is the recommended template for
                   6787:             builtin.mk files:</p>
                   6788:             <pre class="programlisting">
                   6789: .if !defined(IS_BUILTIN.foo)
                   6790: #
                   6791: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   6792: # genuinely exists in the system or not.
                   6793: #
                   6794: IS_BUILTIN.foo?=        no
                   6795: 
                   6796: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   6797: # version can be determined.
                   6798: #
                   6799: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   6800: BUILTIN_PKG.foo?=       foo-1.0
                   6801: .  endif
                   6802: .endif  # IS_BUILTIN.foo
                   6803: 
                   6804: .if !defined(USE_BUILTIN.foo)
                   6805: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   6806: .  if defined(BUILTIN_PKG.foo)
                   6807: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   6808: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   6809: USE_BUILTIN.foo!=                                                       \
                   6810:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   6811:               ${ECHO} "yes";                                            \
                   6812:       else                                                              \
                   6813:               ${ECHO} "no";                                             \
                   6814:       fi
                   6815: .      endif
                   6816: .    endfor
                   6817: .  endif
                   6818: .endif  # USE_BUILTIN.foo
                   6819: 
                   6820: CHECK_BUILTIN.foo?=     no
                   6821: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   6822: #
                   6823: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   6824: # "yes" or "no".
                   6825: #
                   6826: .endif  # CHECK_BUILTIN.foo
                   6827:       
                   6828: </pre>
                   6829: 
1.14      xtraeme  6830:             <p>The first section sets <code class=
                   6831:             "varname">IS_BUILTIN.<em class=
                   6832:             "replaceable"><code>pkg</code></em></code> depending on
                   6833:             if <em class="replaceable"><code>pkg</code></em> really
                   6834:             exists in the base system. This should not be a base
                   6835:             system software with similar functionality to
                   6836:             <em class="replaceable"><code>pkg</code></em>; it
                   6837:             should only be &#8220;<span class=
                   6838:             "quote">yes</span>&#8221; if the actual package is
                   6839:             included as part of the base system. This variable is
                   6840:             only used internally within the <code class=
                   6841:             "filename">builtin.mk</code> file.</p>
                   6842: 
                   6843:             <p>The second section sets <code class=
                   6844:             "varname">BUILTIN_PKG.<em class=
                   6845:             "replaceable"><code>pkg</code></em></code> to the
                   6846:             version of <em class=
                   6847:             "replaceable"><code>pkg</code></em> in the base system
                   6848:             if it exists (if <code class=
                   6849:             "varname">IS_BUILTIN.<em class=
                   6850:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6851:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  6852:             variable is only used internally within the
                   6853:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    6854: 
1.14      xtraeme  6855:             <p>The third section sets <code class=
                   6856:             "varname">USE_BUILTIN.<em class=
                   6857:             "replaceable"><code>pkg</code></em></code> and is
                   6858:             <span class="emphasis"><em>required</em></span> in all
                   6859:             <code class="filename">builtin.mk</code> files. The
                   6860:             code in this section must make the determination
                   6861:             whether the built-in software is adequate to satisfy
                   6862:             the dependencies listed in <code class=
                   6863:             "varname">BUILDLINK_DEPENDS.<em class=
                   6864:             "replaceable"><code>pkg</code></em></code>. This is
                   6865:             typically done by comparing <code class=
                   6866:             "varname">BUILTIN_PKG.<em class=
                   6867:             "replaceable"><code>pkg</code></em></code> against each
                   6868:             of the dependencies in <code class=
                   6869:             "varname">BUILDLINK_DEPENDS.<em class=
                   6870:             "replaceable"><code>pkg</code></em></code>.
                   6871:             <code class="varname">USE_BUILTIN.<em class=
                   6872:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    6873:             "emphasis"><em>must</em></span> be set to the correct
1.14      xtraeme  6874:             value by the end of the <code class=
                   6875:             "filename">builtin.mk</code> file. Note that
                   6876:             <code class="varname">USE_BUILTIN.<em class=
                   6877:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    6878:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  6879:             <code class="varname">IS_BUILTIN.<em class=
                   6880:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6881:             &#8220;<span class="quote">no</span>&#8221; because we
                   6882:             may make the determination that the built-in version of
                   6883:             the software is similar enough to be used as a
                   6884:             replacement.</p>
                   6885: 
1.14      xtraeme  6886:             <p>The last section is guarded by <code class=
                   6887:             "varname">CHECK_BUILTIN.<em class=
                   6888:             "replaceable"><code>pkg</code></em></code>, and
                   6889:             includes code that uses the value of <code class=
                   6890:             "varname">USE_BUILTIN.<em class=
                   6891:             "replaceable"><code>pkg</code></em></code> set in the
                   6892:             previous section. This typically includes, e.g., adding
1.1       grant    6893:             additional dependency restrictions and listing
1.14      xtraeme  6894:             additional files to symlink into <code class=
                   6895:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   6896:             "varname">BUILDLINK_FILES.<em class=
                   6897:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    6898:           </div>
                   6899: 
                   6900:           <div class="sect2" lang="en" xml:lang="en">
                   6901:             <div class="titlepage">
                   6902:               <div>
                   6903:                 <div>
1.23    ! wiz      6904:                   <h3 class="title"><a name="id2629837" id=
        !          6905:                   "id2629837"></a>9.3.2.&nbsp;Global preferences
1.1       grant    6906:                   for native or pkgsrc software</h3>
                   6907:                 </div>
                   6908:               </div>
                   6909:             </div>
                   6910: 
                   6911:             <p>When building packages, it's possible to choose
                   6912:             whether to set a global preference for using either the
                   6913:             built-in (native) version or the pkgsrc version of
                   6914:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  6915:             setting <code class="varname">PREFER_PKGSRC</code> and
                   6916:             <code class="varname">PREFER_NATIVE</code>. These
                   6917:             variables take values of either &#8220;<span class=
1.1       grant    6918:             "quote">yes</span>&#8221;, &#8220;<span class=
                   6919:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  6920:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   6921:             to use the pkgsrc versions of software, while
                   6922:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   6923:             to use the built-in versions. Preferences are
                   6924:             determined by the most specific instance of the package
                   6925:             in either <code class="varname">PREFER_PKGSRC</code> or
                   6926:             <code class="varname">PREFER_NATIVE</code>. If a
                   6927:             package is specified in neither or in both variables,
                   6928:             then <code class="varname">PREFER_PKGSRC</code> has
                   6929:             precedence over <code class=
                   6930:             "varname">PREFER_NATIVE</code>. For example, to require
                   6931:             using pkgsrc versions of software for all but the most
                   6932:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    6933:             <pre class="programlisting">
                   6934:         PREFER_PKGSRC=  yes
                   6935:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   6936:       
                   6937: </pre>
                   6938: 
                   6939:             <p>A package <span class=
1.14      xtraeme  6940:             "emphasis"><em>must</em></span> have a <code class=
                   6941:             "filename">builtin.mk</code> file to be listed in
                   6942:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   6943:             it is simply ignored in that list.</p>
1.1       grant    6944:           </div>
                   6945:         </div>
                   6946:       </div>
                   6947: 
                   6948:       <div class="chapter" lang="en" xml:lang="en">
                   6949:         <div class="titlepage">
                   6950:           <div>
                   6951:             <div>
                   6952:               <h2 class="title"><a name="options" id=
                   6953:               "options"></a>Chapter&nbsp;10.&nbsp;Options
                   6954:               handling</h2>
                   6955:             </div>
                   6956:           </div>
                   6957:         </div>
                   6958: 
                   6959:         <div class="toc">
                   6960:           <p><b>Table of Contents</b></p>
                   6961: 
                   6962:           <dl>
1.23    ! wiz      6963:             <dt><span class="sect1"><a href="#id2629910">10.1.
1.1       grant    6964:             Global default options</a></span></dt>
                   6965: 
1.23    ! wiz      6966:             <dt><span class="sect1"><a href="#id2629925">10.2.
1.14      xtraeme  6967:             Converting packages to use <code class=
                   6968:             "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    6969:           </dl>
                   6970:         </div>
                   6971: 
                   6972:         <p>Many packages have the ability to be built to support
1.14      xtraeme  6973:         different sets of features. <code class=
                   6974:         "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1       grant    6975:         that provides generic handling of those options that
                   6976:         determine different ways in which the packages can be
                   6977:         built. It's possible for the user to specify exactly which
                   6978:         sets of options will be built into a package or to allow a
                   6979:         set of global default options apply.</p>
                   6980: 
                   6981:         <div class="sect1" lang="en" xml:lang="en">
                   6982:           <div class="titlepage">
                   6983:             <div>
                   6984:               <div>
                   6985:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      6986:                 "id2629910" id="id2629910"></a>10.1.&nbsp;Global
1.1       grant    6987:                 default options</h2>
                   6988:               </div>
                   6989:             </div>
                   6990:           </div>
                   6991: 
1.14      xtraeme  6992:           <p>Global default options are listed in <code class=
                   6993:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1       grant    6994:           the options that should be built into every package if
                   6995:           that option is supported. This variable should be set in
1.14      xtraeme  6996:           <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    6997:         </div>
                   6998: 
                   6999:         <div class="sect1" lang="en" xml:lang="en">
                   7000:           <div class="titlepage">
                   7001:             <div>
                   7002:               <div>
                   7003:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      7004:                 "id2629925" id=
        !          7005:                 "id2629925"></a>10.2.&nbsp;Converting packages to
1.14      xtraeme  7006:                 use <code class=
                   7007:                 "filename">bsd.options.mk</code></h2>
1.1       grant    7008:               </div>
                   7009:             </div>
                   7010:           </div>
                   7011: 
1.14      xtraeme  7012:           <p>The following example shows how <code class=
1.23    ! wiz      7013:           "filename">bsd.options.mk</code> should be used in a
1.14      xtraeme  7014:           package <code class="filename">Makefile</code>, or in a
                   7015:           file, e.g. <code class="filename">options.mk</code>, that
                   7016:           is included by the main package <code class=
                   7017:           "filename">Makefile</code>.</p>
1.1       grant    7018:           <pre class="programlisting">
                   7019: # Global and legacy options
                   7020: .if defined(WIBBLE_USE_OPENLDAP) &amp;&amp; !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
                   7021: PKG_DEFAULT_OPTIONS+=   ldap
                   7022: .endif
                   7023: .if defined(USE_SASL2) &amp;&amp; !empty(USE_SASL2:M[yY][eE][sS])
                   7024: PKG_DEFAULT_OPTIONS+=   sasl
                   7025: .endif
                   7026: 
                   7027: PKG_OPTIONS_VAR=        PKG_OPTIONS.wibble
                   7028: PKG_SUPPORTED_OPTIONS=  ldap sasl
                   7029: #
                   7030: # Default options for "wibble" package.
                   7031: #
                   7032: .if !defined(PKG_OPTIONS.wibble)
                   7033: PKG_DEFAULT_OPTIONS+=   sasl
                   7034: endif
                   7035: .include "../../mk/bsd.options.mk"
                   7036: 
                   7037: # Package-specific option-handling
                   7038: 
                   7039: ###
                   7040: ### LDAP support
                   7041: ###
                   7042: .if !empty(PKG_OPTIONS:Mldap)
                   7043: .  include "../../databases/openldap/buildlink3.mk"
                   7044: CONFIGURE_ARGS+=      --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   7045: .endif
                   7046: 
                   7047: ###
                   7048: ### SASL authentication
                   7049: ###
                   7050: .if !empty(PKG_OPTIONS:Msasl)
                   7051: .  include "../../security/cyrus-sasl2/buildlink3.mk"
                   7052: CONFIGURE_ARGS+=        --enable-sasl=${BUILDLINK_PREFIX.sasl}
                   7053: .endif
                   7054:       
                   7055: </pre>
                   7056: 
                   7057:           <p>The first section only exists if you are converting a
                   7058:           package that had its own ad-hoc options handling to use
1.14      xtraeme  7059:           <code class="filename">bsd.options.mk</code>. It converts
1.1       grant    7060:           global or legacy options variables into an equivalent
1.14      xtraeme  7061:           <code class="varname">PKG_OPTIONS.<em class=
                   7062:           "replaceable"><code>pkg</code></em></code> value. These
                   7063:           sections will be removed over time as the old options are
                   7064:           in turn deprecated and removed.</p>
1.1       grant    7065: 
                   7066:           <p>The second section contains the information about
                   7067:           which build options are supported by the package, and any
                   7068:           default options settings if needed.</p>
                   7069: 
                   7070:           <div class="orderedlist">
                   7071:             <ol type="1">
                   7072:               <li>
1.14      xtraeme  7073:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
                   7074:                 a list of the name of the <a href=
1.1       grant    7075:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7076:                 <span class="citerefentry"><span class=
                   7077:                 "refentrytitle">make</span>(1)</span></a> variables
                   7078:                 that contain the options the user wishes to select.
                   7079:                 The recommended value is &#8220;<span class=
1.14      xtraeme  7080:                 "quote">PKG_OPTIONS.<em class=
                   7081:                 "replaceable"><code>pkg</code></em></span>&#8221;
                   7082:                 but any package-specific value may be used. This
1.1       grant    7083:                 variable should be set in a package Makefile.</p>
                   7084:               </li>
                   7085: 
                   7086:               <li>
1.14      xtraeme  7087:                 <p><code class=
                   7088:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
                   7089:                 build options supported by the package. This
                   7090:                 variable should be set in a package Makefile.</p>
1.1       grant    7091:               </li>
                   7092: 
                   7093:               <li>
1.14      xtraeme  7094:                 <p><code class="varname">${PKG_OPTIONS_VAR}</code>
                   7095:                 (the variables named in <code class=
                   7096:                 "varname">PKG_OPTIONS_VAR</code>) are variables
                   7097:                 that list the selected build options and override
                   7098:                 any default options given in <code class=
                   7099:                 "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1       grant    7100:                 options begin with a &#8220;<span class=
                   7101:                 "quote">-</span>&#8221;, then that option is always
                   7102:                 removed from the selected build options, e.g.</p>
                   7103:                 <pre class="programlisting">
                   7104:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   7105:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   7106:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
                   7107:         # implies PKG_OPTIONS == "kerberos ldap"
                   7108:           
                   7109: </pre>
                   7110: 
                   7111:                 <p>or</p>
                   7112:                 <pre class="programlisting">
                   7113:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   7114:         WIBBLE_OPTIONS=         kerberos -ldap ldap
                   7115:         # implies PKG_OPTIONS == "kerberos"
                   7116:           
                   7117: </pre>
                   7118: 
1.14      xtraeme  7119:                 <p>This variable should be set in <code class=
                   7120:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    7121:               </li>
                   7122:             </ol>
                   7123:           </div>
                   7124: 
                   7125:           <p>After the inclusion of bsd.options.mk, the following
                   7126:           variables are set:</p>
                   7127: 
                   7128:           <div class="itemizedlist">
                   7129:             <ul type="disc">
                   7130:               <li>
1.14      xtraeme  7131:                 <p><code class="varname">PKG_OPTIONS</code>
                   7132:                 contains the list of the selected build options,
                   7133:                 properly filtered to remove unsupported and
                   7134:                 duplicate options.</p>
1.1       grant    7135:               </li>
                   7136:             </ul>
                   7137:           </div>
                   7138: 
                   7139:           <p>The remaining sections contain the logic that is
                   7140:           specific to each option. There should be a check for
1.14      xtraeme  7141:           every option listed in <code class=
                   7142:           "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
                   7143:           be clear documentation on what turning on the option will
                   7144:           do in the comments preceding each section. The correct
                   7145:           way to check for an option is to check whether it is
                   7146:           listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1       grant    7147:         </div>
                   7148:       </div>
                   7149: 
                   7150:       <div class="chapter" lang="en" xml:lang="en">
                   7151:         <div class="titlepage">
                   7152:           <div>
                   7153:             <div>
                   7154:               <h2 class="title"><a name="build" id=
                   7155:               "build"></a>Chapter&nbsp;11.&nbsp;The build
                   7156:               process</h2>
                   7157:             </div>
                   7158:           </div>
                   7159:         </div>
                   7160: 
                   7161:         <div class="toc">
                   7162:           <p><b>Table of Contents</b></p>
                   7163: 
                   7164:           <dl>
                   7165:             <dt><span class="sect1"><a href="#build.prefix">11.1.
                   7166:             Program location</a></span></dt>
                   7167: 
1.23    ! wiz      7168:             <dt><span class="sect1"><a href="#id2630533">11.2. Main
1.1       grant    7169:             targets</a></span></dt>
                   7170: 
                   7171:             <dt><span class="sect1"><a href=
                   7172:             "#build.helpful-targets">11.3. Other helpful
                   7173:             targets</a></span></dt>
                   7174:           </dl>
                   7175:         </div>
                   7176: 
                   7177:         <p>The basic steps for building a program are always the
                   7178:         same. First the program's source (<span class=
                   7179:         "emphasis"><em>distfile</em></span>) must be brought to the
                   7180:         local system and then extracted. After any patches to
                   7181:         compile properly on NetBSD are applied, the software can be
                   7182:         configured, then built (usually by compiling), and finally
                   7183:         the generated binaries, etc. can be put into place on the
                   7184:         system. These are exactly the steps performed by the NetBSD
                   7185:         package system, which is implemented as a series of targets
1.14      xtraeme  7186:         in a central Makefile, <code class=
                   7187:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    7188: 
                   7189:         <div class="sect1" lang="en" xml:lang="en">
                   7190:           <div class="titlepage">
                   7191:             <div>
                   7192:               <div>
                   7193:                 <h2 class="title" style="clear: both"><a name=
                   7194:                 "build.prefix" id=
                   7195:                 "build.prefix"></a>11.1.&nbsp;Program location</h2>
                   7196:               </div>
                   7197:             </div>
                   7198:           </div>
                   7199: 
                   7200:           <p>Before outlining the process performed by the NetBSD
                   7201:           package system in the next section, here's a brief
                   7202:           discussion on where programs are installed, and which
                   7203:           variables influence this.</p>
                   7204: 
1.14      xtraeme  7205:           <p>The automatic variable <code class=
                   7206:           "varname">PREFIX</code> indicates where all files of the
                   7207:           final program shall be installed. It is usually set to
                   7208:           <code class="varname">LOCALBASE</code> (<code class=
                   7209:           "filename">/usr/pkg</code>), or <code class=
                   7210:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    7211:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  7212:           The value of <code class="varname">PREFIX</code> needs to
                   7213:           be put into the various places in the program's source
                   7214:           where paths to these files are encoded. See <a href=
1.1       grant    7215:           "#components.patches" title=
                   7216:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   7217:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   7218:           title=
                   7219:           "12.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;12.3.1,
                   7220:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   7221:           details.</p>
                   7222: 
                   7223:           <p>When choosing which of these variables to use, follow
                   7224:           the following rules:</p>
                   7225: 
                   7226:           <div class="itemizedlist">
                   7227:             <ul type="disc">
                   7228:               <li>
1.14      xtraeme  7229:                 <p><code class="varname">PREFIX</code> always
                   7230:                 points to the location where the current pkg will
                   7231:                 be installed. When referring to a pkg's own
1.1       grant    7232:                 installation path, use &#8220;<span class=
                   7233:                 "quote">${PREFIX}</span>&#8221;.</p>
                   7234:               </li>
                   7235: 
                   7236:               <li>
1.14      xtraeme  7237:                 <p><code class="varname">LOCALBASE</code> is where
                   7238:                 all non-X11 pkgs are installed. If you need to
1.1       grant    7239:                 construct a -I or -L argument to the compiler to
                   7240:                 find includes and libraries installed by another
                   7241:                 non-X11 pkg, use &#8220;<span class=
                   7242:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   7243:               </li>
                   7244: 
                   7245:               <li>
1.14      xtraeme  7246:                 <p><code class="varname">X11BASE</code> is where
                   7247:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    7248:                 installed. When looking for <span class=
                   7249:                 "emphasis"><em>standard</em></span> X11 includes
                   7250:                 (not those installed by a pkg), use
                   7251:                 &#8220;<span class=
                   7252:                 "quote">${X11BASE}</span>&#8221;.</p>
                   7253:               </li>
                   7254: 
                   7255:               <li>
                   7256:                 <p>X11 based are special in that they may be
1.14      xtraeme  7257:                 installed in either <code class=
                   7258:                 "varname">X11BASE</code> or <code class=
                   7259:                 "varname">LOCALBASE</code>.</p>
1.1       grant    7260: 
                   7261:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  7262:                 <code class="varname">LOCALBASE</code> whenever
                   7263:                 possible. Note that you will need to set
                   7264:                 <code class="varname">USE_X11</code> in them to
                   7265:                 request the presence of X11 and to get the right
                   7266:                 compilation flags.</p>
1.1       grant    7267: 
                   7268:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  7269:                 be installed under <code class=
                   7270:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    7271:                 app-defaults files. These packages are special and
1.14      xtraeme  7272:                 they must be placed under <code class=
                   7273:                 "varname">X11BASE</code>. To accomplish this, set
                   7274:                 either <code class="varname">USE_X11BASE</code> or
                   7275:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    7276:                 package.</p>
                   7277: 
1.14      xtraeme  7278:                 <p>Some notes: <code class="varname">USE_X11</code>
                   7279:                 and <code class="varname">USE_X11BASE</code> are
                   7280:                 mutually exclusive. If you need to find includes or
                   7281:                 libraries installed by a pkg that has <code class=
                   7282:                 "varname">USE_IMAKE</code> or <code class=
                   7283:                 "varname">USE_X11BASE</code> in its pkg
                   7284:                 <code class="filename">Makefile</code>, you need to
                   7285:                 use <span class="emphasis"><em>both</em></span>
                   7286:                 <code class="filename">${X11BASE}</code> and
                   7287:                 <code class="filename">${LOCALBASE}</code>. To
                   7288:                 force installation of all X11 packages in
                   7289:                 <code class="varname">LOCALBASE</code>, the
                   7290:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7291:                 href=
1.1       grant    7292:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20      ben      7293:                 class="pkgname">pkgtools/xpkgwedge</a> is enabled
                   7294:                 by default.</p>
1.1       grant    7295:               </li>
                   7296: 
                   7297:               <li>
1.14      xtraeme  7298:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    7299:                 used to refer to the installed location of an X11
1.14      xtraeme  7300:                 package. <code class="varname">X11PREFIX</code>
                   7301:                 will be set to <code class="varname">X11BASE</code>
                   7302:                 if xpkgwedge is not installed, and to <code class=
                   7303:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    7304:                 installed.</p>
                   7305:               </li>
                   7306: 
                   7307:               <li>
                   7308:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  7309:                 have some packages installed in <code class=
                   7310:                 "varname">X11BASE</code> and some in <code class=
                   7311:                 "varname">LOCALBASE</code>. To determine the prefix
                   7312:                 of an installed package, the <code class=
                   7313:                 "varname">EVAL_PREFIX</code> definition can be
                   7314:                 used. It takes pairs in the format
                   7315:                 &#8220;<span class=
1.1       grant    7316:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.14      xtraeme  7317:                 the make(1) variable <code class=
                   7318:                 "varname">DIRNAME</code> will be set to the prefix
                   7319:                 of the installed package &lt;package&gt;, or
1.1       grant    7320:                 &#8220;<span class=
                   7321:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   7322:                 is not installed.</p>
                   7323: 
                   7324:                 <p>This is best illustrated by example.</p>
                   7325: 
1.14      xtraeme  7326:                 <p>The following lines are taken from <code class=
                   7327:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    7328:                 <pre class="programlisting">
1.14      xtraeme  7329: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    7330: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   7331:                         --with-gtk-prefix="${GTKDIR}"           \
                   7332:                         --enable-multibyte
                   7333: </pre>
                   7334: 
                   7335:                 <p>Specific defaults can be defined for the
1.14      xtraeme  7336:                 packages evaluated using <code class=
                   7337:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    7338:                 of the form:</p>
                   7339:                 <pre class="programlisting">
                   7340: GTKDIR_DEFAULT= ${LOCALBASE}
                   7341: </pre>
                   7342: 
1.14      xtraeme  7343:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    7344:                 corresponds to the first definition in the
1.14      xtraeme  7345:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    7346:               </li>
                   7347: 
                   7348:               <li>
1.14      xtraeme  7349:                 <p>Within <code class="filename">${PREFIX}</code>,
1.1       grant    7350:                 packages should install files according to hier(7),
                   7351:                 with the exception that manual pages go into
1.14      xtraeme  7352:                 <code class="filename">${PREFIX}/man</code>, not
                   7353:                 <code class=
                   7354:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    7355:               </li>
                   7356:             </ul>
                   7357:           </div>
                   7358:         </div>
                   7359: 
                   7360:         <div class="sect1" lang="en" xml:lang="en">
                   7361:           <div class="titlepage">
                   7362:             <div>
                   7363:               <div>
                   7364:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      7365:                 "id2630533" id="id2630533"></a>11.2.&nbsp;Main
1.1       grant    7366:                 targets</h2>
                   7367:               </div>
                   7368:             </div>
                   7369:           </div>
                   7370: 
                   7371:           <p>The main targets used during the build process defined
1.14      xtraeme  7372:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    7373: 
                   7374:           <div class="variablelist">
                   7375:             <dl>
                   7376:               <dt><span class="term">fetch</span></dt>
                   7377: 
                   7378:               <dd>
                   7379:                 <p>This will check if the file(s) given in the
1.14      xtraeme  7380:                 variables <code class="varname">DISTFILES</code>
                   7381:                 and <code class="varname">PATCHFILES</code> (as
                   7382:                 defined in the package's Makefile) are present on
                   7383:                 the local system in <code class=
                   7384:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   7385:                 are not present, an attempt will be made to fetch
                   7386:                 them using commands of the form:</p>
1.1       grant    7387:                 <pre class="programlisting">
                   7388: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   7389: </pre>
                   7390: 
                   7391:                 <p>where ${site} varies through several
1.14      xtraeme  7392:                 possibilities in turn: first, <code class=
                   7393:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   7394:                 then the sites specified in either <code class=
                   7395:                 "varname">SITES_file</code> if defined, else
                   7396:                 <code class="varname">MASTER_SITES</code> or
                   7397:                 <code class="varname">PATCH_SITES</code>, as
                   7398:                 applies, then finally the value of <code class=
                   7399:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   7400:                 all except the first can be optionally sorted by
                   7401:                 the user, via setting either <code class=
                   7402:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   7403:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    7404:               </dd>
                   7405: 
                   7406:               <dt><span class="term">checksum</span></dt>
                   7407: 
                   7408:               <dd>
                   7409:                 <p>After the distfile(s) are fetched, their
                   7410:                 checksum is generated and compared with the
                   7411:                 checksums stored in the distinfo file. If the
                   7412:                 checksums don't match, the build is aborted. This
                   7413:                 is to ensure the same distfile is used for
                   7414:                 building, and that the distfile wasn't changed,
                   7415:                 e.g. by some malign force, deliberately changed
                   7416:                 distfiles on the master distribution site or
                   7417:                 network lossage.</p>
                   7418:               </dd>
                   7419: 
                   7420:               <dt><span class="term">extract</span></dt>
                   7421: 
                   7422:               <dd>
                   7423:                 <p>When the distfiles are present on the local
                   7424:                 system, they need to be extracted, as they are
                   7425:                 usually in the form of some compressed archive
1.14      xtraeme  7426:                 format, most commonly <code class=
                   7427:                 "filename">.tar.gz</code>.</p>
1.1       grant    7428: 
                   7429:                 <p>If only some of the distfiles need to be
                   7430:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  7431:                 be put into <code class=
                   7432:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    7433: 
1.14      xtraeme  7434:                 <p>If the distfiles are not in <code class=
                   7435:                 "filename">.tar.gz</code> format, they can be
                   7436:                 extracted by setting either <code class=
                   7437:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   7438:                 "varname">EXTRACT_CMD</code>, <code class=
                   7439:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   7440:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   7441:                 the former case, pkgsrc knows how to extract a
                   7442:                 number of suffixes (<code class=
                   7443:                 "filename">.tar.gz</code>, <code class=
                   7444:                 "filename">.tgz</code>, <code class=
                   7445:                 "filename">.tar.gz2</code>, <code class=
                   7446:                 "filename">.tbz</code>, <code class=
                   7447:                 "filename">.tar.Z</code>, <code class=
                   7448:                 "filename">.tar</code>, <code class=
                   7449:                 "filename">.shar.gz</code>, <code class=
                   7450:                 "filename">.shar.bz2</code>, <code class=
                   7451:                 "filename">.shar.Z</code>, <code class=
                   7452:                 "filename">.shar</code>, <code class=
                   7453:                 "filename">.Z</code>, <code class=
                   7454:                 "filename">.bz2</code> and <code class=
                   7455:                 "filename">.gz</code>; see the definition of the
                   7456:                 various <code class="varname">DECOMPRESS_CMD</code>
                   7457:                 variables <code class="filename">bsd.pkg.mk</code>
                   7458:                 for a complete list). Here's an example on how to
                   7459:                 use the other variables for a program that comes
                   7460:                 with a compressed shell archive whose name ends in
                   7461:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    7462:                 <pre class="programlisting">
                   7463:      EXTRACT_SUFX=   .msg.gz
                   7464:      EXTRACT_CMD=            zcat
                   7465:      EXTRACT_BEFORE_ARGS=
                   7466:      EXTRACT_AFTER_ARGS=     |sh
                   7467: </pre>
                   7468:               </dd>
                   7469: 
                   7470:               <dt><span class="term">patch</span></dt>
                   7471: 
                   7472:               <dd>
                   7473:                 <p>After extraction, all the patches named by the
1.14      xtraeme  7474:                 <code class="varname">PATCHFILES</code>, those
                   7475:                 present in the patches subdirectory of the package
                   7476:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
                   7477:                 <code class=
                   7478:                 "filename">/usr/local/patches/graphics/png</code>)
                   7479:                 are applied. Patchfiles ending in <code class=
                   7480:                 "filename">.Z</code> or <code class=
                   7481:                 "filename">.gz</code> are uncompressed before they
                   7482:                 are applied, files ending in <code class=
                   7483:                 "filename">.orig</code> or <code class=
                   7484:                 "filename">.rej</code> are ignored. Any special
                   7485:                 options to patch(1) can be handed in <code class=
                   7486:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   7487:                 "#components.patches" title=
1.1       grant    7488:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   7489:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   7490: 
                   7491:                 <p>By default patch(1) is given special args to
                   7492:                 make it fail if the patches apply with some lines
                   7493:                 of fuzz. Please fix (regen) the patches so that
                   7494:                 they apply cleanly. The rationale behind this is
                   7495:                 that patches that don't apply cleanly may end up
                   7496:                 being applied in the wrong place, and cause severe
                   7497:                 harm there.</p>
                   7498:               </dd>
                   7499: 
                   7500:               <dt><span class="term">configure</span></dt>
                   7501: 
                   7502:               <dd>
                   7503:                 <p>Most pieces of software need information on the
                   7504:                 header files, system calls, and library routines
                   7505:                 which are available in NetBSD. This is the process
                   7506:                 known as configuration, and is usually automated.
                   7507:                 In most cases, a script is supplied with the
                   7508:                 source, and its invocation results in generation of
                   7509:                 header files, Makefiles, etc.</p>
                   7510: 
                   7511:                 <p>If the program's distfile contains its own
                   7512:                 configure script, this can be invoked by setting
1.14      xtraeme  7513:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    7514:                 configure script is a GNU autoconf script,
1.14      xtraeme  7515:                 <code class="varname">GNU_CONFIGURE</code> should
                   7516:                 be specified instead. In either case, any arguments
                   7517:                 to the configure script can be specified in the
                   7518:                 <code class="varname">CONFIGURE_ARGS</code>
                   7519:                 variable, and the configure script's name can be
                   7520:                 set in <code class=
                   7521:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   7522:                 from the default &#8220;<span class=
1.1       grant    7523:                 "quote">configure</span>&#8221;. Here's an example
                   7524:                 from the <a xmlns=
                   7525:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7526:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20      ben      7527:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    7528:                 <pre class="programlisting">
                   7529: HAS_CONFIGURE=          yes
                   7530: CONFIGURE_SCRIPT=       Configure
                   7531: CONFIGURE_ARGS+=        netbsd13
                   7532: </pre>
                   7533: 
                   7534:                 <p>If the program uses an Imakefile for
                   7535:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  7536:                 by setting <code class="varname">USE_IMAKE</code>
                   7537:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   7538:                 (If you only want the package installed in
                   7539:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   7540:                 not being run, set <code class=
                   7541:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    7542:               </dd>
                   7543: 
                   7544:               <dt><span class="term">build</span></dt>
                   7545: 
                   7546:               <dd>
                   7547:                 <p>Once configuration has taken place, the software
1.14      xtraeme  7548:                 will be built by invoking <code class=
                   7549:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   7550:                 "varname">$MAKEFILE</code> with <code class=
                   7551:                 "varname">$BUILD_TARGET</code> as the target to
                   7552:                 build. The default <code class=
                   7553:                 "varname">MAKE_PROGRAM</code> is
                   7554:                 &#8220;<span class="quote">gmake</span>&#8221; if
                   7555:                 <code class="varname">USE_GNU_TOOLS</code> contains
1.7       wiz      7556:                 &#8220;<span class="quote">make</span>&#8221;,
1.1       grant    7557:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  7558:                 otherwise. <code class="varname">MAKEFILE</code> is
                   7559:                 set to &#8220;<span class=
1.1       grant    7560:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  7561:                 <code class="varname">BUILD_TARGET</code> defaults
                   7562:                 to &#8220;<span class="quote">all</span>&#8221;.
                   7563:                 Any of these variables can be set in the package's
1.1       grant    7564:                 Makefile to change the default build process.</p>
                   7565:               </dd>
                   7566: 
                   7567:               <dt><span class="term">install</span></dt>
                   7568: 
                   7569:               <dd>
                   7570:                 <p>Once the build stage has completed, the final
                   7571:                 step is to install the software in public
                   7572:                 directories, so users can access the programs and
1.14      xtraeme  7573:                 files. As in the build-target, <code class=
                   7574:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   7575:                 <code class="varname">$MAKEFILE</code> here, but
                   7576:                 with the <code class=
                   7577:                 "varname">$INSTALL_TARGET</code> instead, the
                   7578:                 latter defaulting to &#8220;<span class=
                   7579:                 "quote">install</span>&#8221; (plus
                   7580:                 &#8220;<span class=
                   7581:                 "quote">install.man</span>&#8221;, if <code class=
                   7582:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    7583:               </dd>
                   7584:             </dl>
                   7585:           </div>
                   7586: 
                   7587:           <p>If no target is specified, the default is
                   7588:           &#8220;<span class="quote">build</span>&#8221;. If a
                   7589:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  7590:           e.g. <span><strong class="command">make
                   7591:           build</strong></span> will also perform the equivalent
                   7592:           of:</p>
1.1       grant    7593:           <pre class="programlisting">
                   7594: make fetch
                   7595: make checksum
                   7596: make extract
                   7597: make patch
                   7598: make configure
                   7599: make build
                   7600: </pre>
                   7601:         </div>
                   7602: 
                   7603:         <div class="sect1" lang="en" xml:lang="en">
                   7604:           <div class="titlepage">
                   7605:             <div>
                   7606:               <div>
                   7607:                 <h2 class="title" style="clear: both"><a name=
                   7608:                 "build.helpful-targets" id=
                   7609:                 "build.helpful-targets"></a>11.3.&nbsp;Other
                   7610:                 helpful targets</h2>
                   7611:               </div>
                   7612:             </div>
                   7613:           </div>
                   7614: 
                   7615:           <div class="variablelist">
                   7616:             <dl>
                   7617:               <dt><span class="term">pre/post-*</span></dt>
                   7618: 
                   7619:               <dd>
                   7620:                 <p>For any of the main targets described in the
                   7621:                 previous section, two auxiliary targets exist with
                   7622:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   7623:                 &#8220;<span class="quote">post-</span>&#8221; used
                   7624:                 as a prefix for the main target's name. These
                   7625:                 targets are invoked before and after the main
                   7626:                 target is called, allowing extra configuration or
                   7627:                 installation steps be performed from a package's
                   7628:                 Makefile, for example, which a program's configure
                   7629:                 script or install target omitted.</p>
                   7630:               </dd>
                   7631: 
                   7632:               <dt><span class="term">do-*</span></dt>
                   7633: 
                   7634:               <dd>
                   7635:                 <p>Should one of the main targets do the wrong
                   7636:                 thing, and should there be no variable to fix this,
                   7637:                 you can redefine it with the do-* target. (Note
                   7638:                 that redefining the target itself instead of the
                   7639:                 do-* target is a bad idea, as the pre-* and post-*
                   7640:                 targets won't be called anymore, etc.) You will not
                   7641:                 usually need to do this.</p>
                   7642:               </dd>
                   7643: 
                   7644:               <dt><span class="term">reinstall</span></dt>
                   7645: 
                   7646:               <dd>
1.14      xtraeme  7647:                 <p>If you did a <span><strong class="command">make
                   7648:                 install</strong></span> and you noticed some file
                   7649:                 was not installed properly, you can repeat the
1.1       grant    7650:                 installation with this target, which will ignore
                   7651:                 the &#8220;<span class="quote">already
                   7652:                 installed</span>&#8221; flag.</p>
                   7653:               </dd>
                   7654: 
                   7655:               <dt><span class="term">deinstall</span></dt>
                   7656: 
                   7657:               <dd>
                   7658:                 <p>This target does a pkg_delete(1) in the current
                   7659:                 directory, effectively de-installing the package.
                   7660:                 The following variables can be used to tune the
                   7661:                 behaviour:</p>
                   7662: 
                   7663:                 <div class="variablelist">
                   7664:                   <dl>
1.14      xtraeme  7665:                     <dt><span class="term"><code class=
                   7666:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    7667: 
                   7668:                     <dd>
                   7669:                       <p>Add a "-v" to the <a href=
                   7670:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7671:                       <span class="citerefentry"><span class=
                   7672:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7673:                       command.</p>
                   7674:                     </dd>
                   7675: 
1.14      xtraeme  7676:                     <dt><span class="term"><code class=
                   7677:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    7678: 
                   7679:                     <dd>
                   7680:                       <p>Remove all packages that require (depend
                   7681:                       on) the given package. This can be used to
                   7682:                       remove any packages that may have been pulled
                   7683:                       in by a given package, e.g. if
1.14      xtraeme  7684:                       <span><strong class="command">make deinstall
                   7685:                       DEINSTALLDEPENDS=1</strong></span> is done in
                   7686:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    7687:                       this is likely to remove whole KDE. Works by
                   7688:                       adding &#8220;<span class=
                   7689:                       "quote">-R</span>&#8221; to the <a href=
                   7690:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7691:                       <span class="citerefentry"><span class=
                   7692:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7693:                       command line.</p>
                   7694:                     </dd>
                   7695:                   </dl>
                   7696:                 </div>
                   7697:               </dd>
                   7698: 
                   7699:               <dt><span class="term">update</span></dt>
                   7700: 
                   7701:               <dd>
                   7702:                 <p>This target causes the current package to be
                   7703:                 updated to the latest version. The package and all
                   7704:                 depending packages first get de-installed, then
                   7705:                 current versions of the corresponding packages get
                   7706:                 compiled and installed. This is similar to manually
                   7707:                 noting which packages are currently installed, then
1.14      xtraeme  7708:                 performing a series of <span><strong class=
                   7709:                 "command">make deinstall</strong></span> and
                   7710:                 <span><strong class="command">make
                   7711:                 install</strong></span> (or whatever <code class=
                   7712:                 "varname">UPDATE_TARGET</code> is set to) for these
                   7713:                 packages.</p>
1.1       grant    7714: 
                   7715:                 <p>You can use the &#8220;<span class=
                   7716:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  7717:                 package updating in case a previous
                   7718:                 <span><strong class="command">make
                   7719:                 update</strong></span> was interrupted for some
                   7720:                 reason. However, in this case, make sure you don't
                   7721:                 call <span><strong class="command">make
                   7722:                 clean</strong></span> or otherwise remove the list
                   7723:                 of dependent packages in <code class=
                   7724:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    7725:                 ability to automatically update the current package
                   7726:                 along with the dependent packages you have
                   7727:                 installed.</p>
                   7728: 
1.14      xtraeme  7729:                 <p>Resuming an interrupted <span><strong class=
                   7730:                 "command">make update</strong></span> will only
                   7731:                 work as long as the package tree remains unchanged.
                   7732:                 If the source code for one of the packages to be
                   7733:                 updated has been changed, resuming
                   7734:                 <span><strong class="command">make
                   7735:                 update</strong></span> will most certainly
                   7736:                 fail!</p>
1.1       grant    7737: 
                   7738:                 <p>The following variables can be used either on
1.14      xtraeme  7739:                 the command line or in <code class=
                   7740:                 "filename">/etc/mk.conf</code> to alter the
                   7741:                 behaviour of <span><strong class="command">make
                   7742:                 update</strong></span>:</p>
1.1       grant    7743: 
                   7744:                 <div class="variablelist">
                   7745:                   <dl>
1.14      xtraeme  7746:                     <dt><span class="term"><code class=
                   7747:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    7748: 
                   7749:                     <dd>
                   7750:                       <p>Install target to recursively use for the
                   7751:                       updated package and the dependent packages.
1.14      xtraeme  7752:                       Defaults to <code class=
                   7753:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    7754:                       &#8220;<span class=
                   7755:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  7756:                       <span><strong class="command">make
                   7757:                       update</strong></span>. e.g.
                   7758:                       <span><strong class="command">make update
                   7759:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    7760:                     </dd>
                   7761: 
1.14      xtraeme  7762:                     <dt><span class="term"><code class=
                   7763:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    7764: 
                   7765:                     <dd>
                   7766:                       <p>Don't clean up after updating. Useful if
                   7767:                       you want to leave the work sources of the
                   7768:                       updated packages around for inspection or
                   7769:                       other purposes. Be sure you eventually clean
                   7770:                       up the source tree (see the
                   7771:                       &#8220;<span class=
                   7772:                       "quote">clean-update</span>&#8221; target
                   7773:                       below) or you may run into troubles with old
                   7774:                       source code still lying around on your next
1.14      xtraeme  7775:                       <span><strong class=
                   7776:                       "command">make</strong></span> or
                   7777:                       <span><strong class="command">make
                   7778:                       update</strong></span>.</p>
1.1       grant    7779:                     </dd>
                   7780: 
1.14      xtraeme  7781:                     <dt><span class="term"><code class=
                   7782:                     "varname">REINSTALL</code></span></dt>
1.1       grant    7783: 
                   7784:                     <dd>
                   7785:                       <p>Deinstall each package before installing
1.14      xtraeme  7786:                       (making <code class=
                   7787:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    7788:                       necessary if the &#8220;<span class=
                   7789:                       "quote">clean-update</span>&#8221; target
                   7790:                       (see below) was called after interrupting a
1.14      xtraeme  7791:                       running <span><strong class="command">make
                   7792:                       update</strong></span>.</p>
1.1       grant    7793:                     </dd>
                   7794: 
1.14      xtraeme  7795:                     <dt><span class="term"><code class=
                   7796:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    7797: 
                   7798:                     <dd>
                   7799:                       <p>Allows you to disable recursion and
                   7800:                       hardcode the target for packages. The default
                   7801:                       is &#8220;<span class=
                   7802:                       "quote">update</span>&#8221; for the update
                   7803:                       target, facilitating a recursive update of
1.14      xtraeme  7804:                       prerequisite packages. Only set <code class=
                   7805:                       "varname">DEPENDS_TARGET</code> if you want
                   7806:                       to disable recursive updates. Use
                   7807:                       <code class="varname">UPDATE_TARGET</code>
                   7808:                       instead to just set a specific target for
                   7809:                       each package to be installed during
                   7810:                       <span><strong class="command">make
                   7811:                       update</strong></span> (see above).</p>
1.1       grant    7812:                     </dd>
                   7813:                   </dl>
                   7814:                 </div>
                   7815:               </dd>
                   7816: 
                   7817:               <dt><span class="term">clean-update</span></dt>
                   7818: 
                   7819:               <dd>
                   7820:                 <p>Clean the source tree for all packages that
1.14      xtraeme  7821:                 would get updated if <span><strong class=
                   7822:                 "command">make update</strong></span> was called
                   7823:                 from the current directory. This target should not
                   7824:                 be used if the current package (or any of its
                   7825:                 depending packages) have already been de-installed
                   7826:                 (e.g., after calling <span><strong class=
                   7827:                 "command">make update</strong></span>) or you may
                   7828:                 lose some packages you intended to update. As a
                   7829:                 rule of thumb: only use this target <span class=
                   7830:                 "emphasis"><em>before</em></span> the first time
                   7831:                 you run <span><strong class="command">make
                   7832:                 update</strong></span> and only if you have a dirty
                   7833:                 package tree (e.g., if you used <code class=
                   7834:                 "varname">NOCLEAN</code>).</p>
1.1       grant    7835: 
                   7836:                 <p>If you unsure about whether your tree is clean
1.14      xtraeme  7837:                 you can either perform a <span><strong class=
                   7838:                 "command">make clean</strong></span> at the top of
                   7839:                 the tree, or use the following sequence of commands
1.1       grant    7840:                 from the directory of the package you want to
                   7841:                 update (<span class=
                   7842:                 "emphasis"><em>before</em></span> running
1.14      xtraeme  7843:                 <span><strong class="command">make
                   7844:                 update</strong></span> for the first time,
                   7845:                 otherwise you lose all the packages you wanted to
                   7846:                 update!):</p>
1.1       grant    7847:                 <pre class="screen">
1.14      xtraeme  7848: <code class="prompt">#</code> <strong class=
                   7849: "userinput"><code>make clean-update</code></strong>
                   7850: <code class="prompt">#</code> <strong class=
                   7851: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   7852: <code class="prompt">#</code> <strong class=
                   7853: "userinput"><code>make update</code></strong>
1.1       grant    7854: </pre>
                   7855: 
                   7856:                 <p>The following variables can be used either on
1.14      xtraeme  7857:                 the command line or in <code class=
                   7858:                 "filename">/etc/mk.conf</code> to alter the
                   7859:                 behaviour of <span><strong class="command">make
                   7860:                 clean-update</strong></span>:</p>
1.1       grant    7861: 
                   7862:                 <div class="variablelist">
                   7863:                   <dl>
1.14      xtraeme  7864:                     <dt><span class="term"><code class=
                   7865:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    7866: 
                   7867:                     <dd>
1.14      xtraeme  7868:                       <p>After <span><strong class="command">make
                   7869:                       clean</strong></span>, do not reconstruct the
                   7870:                       list of directories to update for this
                   7871:                       package. Only use this if
                   7872:                       <span><strong class="command">make
                   7873:                       update</strong></span> successfully installed
                   7874:                       all packages you wanted to update. Normally,
                   7875:                       this is done automatically on
                   7876:                       <span><strong class="command">make
                   7877:                       update</strong></span>, but may have been
                   7878:                       suppressed by the <code class=
                   7879:                       "varname">NOCLEAN</code> variable (see
1.1       grant    7880:                       above).</p>
                   7881:                     </dd>
                   7882:                   </dl>
                   7883:                 </div>
                   7884:               </dd>
                   7885: 
                   7886:               <dt><span class="term">info</span></dt>
                   7887: 
                   7888:               <dd>
                   7889:                 <p>This target invokes <a href=
                   7890:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   7891:                 <span class="citerefentry"><span class=
                   7892:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   7893:                 the current package. You can use this to check
                   7894:                 which version of a package is installed.</p>
                   7895:               </dd>
                   7896: 
                   7897:               <dt><span class="term">readme</span></dt>
                   7898: 
                   7899:               <dd>
1.14      xtraeme  7900:                 <p>This target generates a <code class=
                   7901:                 "filename">README.html</code> file, which can be
1.1       grant    7902:                 viewed using a browser such as <a xmlns=
                   7903:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7904:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20      ben      7905:                 class="pkgname">www/mozilla</a> or <a xmlns=
                   7906:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7907:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
                   7908:                 class="pkgname">www/links</a>. The generated files
                   7909:                 contain references to any packages which are in the
                   7910:                 <code class="varname">PACKAGES</code> directory on
                   7911:                 the local host. The generated files can be made to
                   7912:                 refer to URLs based on <code class=
                   7913:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   7914:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
                   7915:                 wanted to generate <code class=
                   7916:                 "filename">README.html</code> files which pointed
                   7917:                 to binary packages on the local machine, in the
                   7918:                 directory <code class=
                   7919:                 "filename">/usr/packages</code>, set <code class=
                   7920:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   7921:                 and <code class=
                   7922:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   7923:                 <code class="varname">${PACKAGES}</code> directory
                   7924:                 and its subdirectories will be searched for all the
                   7925:                 binary packages.</p>
1.1       grant    7926:               </dd>
                   7927: 
                   7928:               <dt><span class="term">readme-all</span></dt>
                   7929: 
                   7930:               <dd>
1.14      xtraeme  7931:                 <p>Use this target to create a file <code class=
                   7932:                 "filename">README-all.html</code> which contains a
1.1       grant    7933:                 list of all packages currently available in the
                   7934:                 NetBSD Packages Collection, together with the
                   7935:                 category they belong to and a short description.
1.14      xtraeme  7936:                 This file is compiled from the <code class=
                   7937:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    7938:                 sure to run this <span class=
1.14      xtraeme  7939:                 "emphasis"><em>after</em></span> a
                   7940:                 <span><strong class="command">make
                   7941:                 readme</strong></span>.</p>
1.1       grant    7942:               </dd>
                   7943: 
                   7944:               <dt><span class="term">cdrom-readme</span></dt>
                   7945: 
                   7946:               <dd>
                   7947:                 <p>This is very much the same as the
                   7948:                 &#8220;<span class="quote">readme</span>&#8221;
                   7949:                 target (see above), but is to be used when
                   7950:                 generating a pkgsrc tree to be written to a CD-ROM.
1.14      xtraeme  7951:                 This target also produces <code class=
                   7952:                 "filename">README.html</code> files, and can be
                   7953:                 made to refer to URLs based on <code class=
                   7954:                 "varname">CDROM_PKG_URL_HOST</code> and
                   7955:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    7956:               </dd>
                   7957: 
                   7958:               <dt><span class="term">show-distfiles</span></dt>
                   7959: 
                   7960:               <dd>
                   7961:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  7962:                 are needed to build the package. (<code class=
                   7963:                 "varname">DISTFILES</code> and <code class=
                   7964:                 "varname">PATCHFILES</code>, but not <code class=
                   7965:                 "filename">patches/*</code>)</p>
1.1       grant    7966:               </dd>
                   7967: 
                   7968:               <dt><span class="term">show-downlevel</span></dt>
                   7969: 
                   7970:               <dd>
                   7971:                 <p>This target shows nothing if the package is not
                   7972:                 installed. If a version of this package is
                   7973:                 installed, but is not the version provided in this
                   7974:                 version of pkgsrc, then a warning message is
                   7975:                 displayed. This target can be used to show which of
                   7976:                 your installed packages are downlevel, and so the
                   7977:                 old versions can be deleted, and the current ones
                   7978:                 added.</p>
                   7979:               </dd>
                   7980: 
                   7981:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   7982: 
                   7983:               <dd>
                   7984:                 <p>This target shows the directory in the pkgsrc
                   7985:                 hierarchy from which the package can be built and
                   7986:                 installed. This may not be the same directory as
                   7987:                 the one from which the package was installed. This
                   7988:                 target is intended to be used by people who may
                   7989:                 wish to upgrade many packages on a single host, and
                   7990:                 can be invoked from the top-level pkgsrc Makefile
                   7991:                 by using the &#8220;<span class=
                   7992:                 "quote">show-host-specific-pkgs</span>&#8221;
                   7993:                 target.</p>
                   7994:               </dd>
                   7995: 
                   7996:               <dt><span class=
                   7997:               "term">show-installed-depends</span></dt>
                   7998: 
                   7999:               <dd>
                   8000:                 <p>This target shows which installed packages match
1.14      xtraeme  8001:                 the current package's <code class=
                   8002:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    8003:                 dependencies are causing build problems.</p>
                   8004:               </dd>
                   8005: 
                   8006:               <dt><span class="term">check-shlibs</span></dt>
                   8007: 
                   8008:               <dd>
                   8009:                 <p>After a package is installed, check all its
                   8010:                 binaries and (on ELF platforms) shared libraries to
                   8011:                 see if they find the shared libs they need. Run by
1.14      xtraeme  8012:                 default if <code class=
                   8013:                 "varname">PKG_DEVELOPER</code> is set in
                   8014:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    8015:               </dd>
                   8016: 
                   8017:               <dt><span class="term">print-PLIST</span></dt>
                   8018: 
                   8019:               <dd>
                   8020:                 <p>After a &#8220;<span class="quote">make
                   8021:                 install</span>&#8221; from a new or upgraded pkg,
                   8022:                 this prints out an attempt to generate a new
1.14      xtraeme  8023:                 <code class="filename">PLIST</code> from a
                   8024:                 <span><strong class="command">find -newer
                   8025:                 work/.extract_done</strong></span>. An attempt is
                   8026:                 made to care for shared libs etc., but it is
1.1       grant    8027:                 <span class="emphasis"><em>strongly</em></span>
                   8028:                 recommended to review the result before putting it
1.14      xtraeme  8029:                 into <code class="filename">PLIST</code>. On
                   8030:                 upgrades, it's useful to diff the output of this
                   8031:                 command against an already existing <code class=
                   8032:                 "filename">PLIST</code> file.</p>
1.1       grant    8033: 
                   8034:                 <p>If the package installs files via tar(1) or
                   8035:                 other methods that don't update file access times,
                   8036:                 be sure to add these files manually to your
1.14      xtraeme  8037:                 <code class="filename">PLIST</code>, as the
1.1       grant    8038:                 &#8220;<span class="quote">find
                   8039:                 -newer</span>&#8221; command used by this target
                   8040:                 won't catch them!</p>
                   8041: 
                   8042:                 <p>See <a href="#print-PLIST" title=
                   8043:                 "8.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;8.3,
1.14      xtraeme  8044:                 &#8220;Tweaking output of <span><strong class=
                   8045:                 "command">make
                   8046:                 print-PLIST</strong></span>&#8221;</a> for more
                   8047:                 information on this target.</p>
1.1       grant    8048:               </dd>
                   8049: 
                   8050:               <dt><span class="term">bulk-package</span></dt>
                   8051: 
                   8052:               <dd>
                   8053:                 <p>Used to do bulk builds. If an appropriate binary
                   8054:                 package already exists, no action is taken. If not,
                   8055:                 this target will compile, install and package it
1.14      xtraeme  8056:                 (and it's depends, if <code class=
                   8057:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    8058:                 <a href="#binary.configuration" title=
                   8059:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   8060:                 &#8220;Configuration&#8221;</a>. After creating the
                   8061:                 binary package, the sources, the just-installed
                   8062:                 package and it's required packages are removed,
                   8063:                 preserving free disk space.</p>
                   8064: 
                   8065:                 <p><span class="emphasis"><em>Beware that this
                   8066:                 target may deinstall all packages installed on a
                   8067:                 system!</em></span></p>
                   8068:               </dd>
                   8069: 
                   8070:               <dt><span class="term">bulk-install</span></dt>
                   8071: 
                   8072:               <dd>
                   8073:                 <p>Used during bulk-installs to install required
                   8074:                 packages. If an upto-date binary package is
                   8075:                 available, it will be installed via <a href=
                   8076:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   8077:                 <span class="citerefentry"><span class=
                   8078:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  8079:                 not, <span><strong class="command">make
                   8080:                 bulk-package</strong></span> will be executed, but
                   8081:                 the installed binary not be removed.</p>
1.1       grant    8082: 
                   8083:                 <p>A binary package is considered
                   8084:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   8085:                 to be installed via <a href=
                   8086:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   8087:                 <span class="citerefentry"><span class=
                   8088:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   8089:                 if:</p>
                   8090: 
                   8091:                 <div class="itemizedlist">
                   8092:                   <ul type="disc">
                   8093:                     <li>
1.14      xtraeme  8094:                       <p>None of the package's files (<code class=
                   8095:                       "filename">Makefile</code>, ...) were
                   8096:                       modified since it was built.</p>
1.1       grant    8097:                     </li>
                   8098: 
                   8099:                     <li>
                   8100:                       <p>None of the package's required (binary)
                   8101:                       packages were modified since it was
                   8102:                       built.</p>
                   8103:                     </li>
                   8104:                   </ul>
                   8105:                 </div>
                   8106: 
                   8107:                 <p><span class="emphasis"><em>Beware that this
                   8108:                 target may deinstall all packages installed on a
                   8109:                 system!</em></span></p>
                   8110:               </dd>
                   8111:             </dl>
                   8112:           </div>
                   8113:         </div>
                   8114:       </div>
                   8115: 
                   8116:       <div class="chapter" lang="en" xml:lang="en">
                   8117:         <div class="titlepage">
                   8118:           <div>
                   8119:             <div>
                   8120:               <h2 class="title"><a name="fixes" id=
                   8121:               "fixes"></a>Chapter&nbsp;12.&nbsp;Notes on fixes for
                   8122:               packages</h2>
                   8123:             </div>
                   8124:           </div>
                   8125:         </div>
                   8126: 
                   8127:         <div class="toc">
                   8128:           <p><b>Table of Contents</b></p>
                   8129: 
                   8130:           <dl>
1.23    ! wiz      8131:             <dt><span class="sect1"><a href="#id2632070">12.1.
1.1       grant    8132:             General operation</a></span></dt>
                   8133: 
                   8134:             <dd>
                   8135:               <dl>
                   8136:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8137:                 "#id2632073">12.1.1. How to pull in variables from
1.1       grant    8138:                 /etc/mk.conf</a></span></dt>
                   8139: 
                   8140:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8141:                 "#id2632156">12.1.2. Restricted
1.1       grant    8142:                 packages</a></span></dt>
                   8143: 
                   8144:                 <dt><span class="sect2"><a href=
                   8145:                 "#dependencies">12.1.3. Handling
                   8146:                 dependencies</a></span></dt>
                   8147: 
                   8148:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8149:                 "#id2632672">12.1.4. Handling conflicts with other
1.1       grant    8150:                 packages</a></span></dt>
                   8151: 
                   8152:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8153:                 "#id2632790">12.1.5. Packages that cannot or should
1.1       grant    8154:                 not be built</a></span></dt>
                   8155: 
                   8156:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8157:                 "#id2632816">12.1.6. Packages which should not be
1.1       grant    8158:                 deleted, once installed</a></span></dt>
                   8159: 
                   8160:                 <dt><span class="sect2"><a href=
                   8161:                 "#security-handling">12.1.7. Handling packages with
                   8162:                 security problems</a></span></dt>
                   8163: 
                   8164:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8165:                 "#id2632907">12.1.8. How to handle compiler
1.1       grant    8166:                 bugs</a></span></dt>
                   8167: 
                   8168:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8169:                 "#id2632930">12.1.9. How to handle incrementing
1.1       grant    8170:                 versions when fixing an existing
                   8171:                 package</a></span></dt>
                   8172: 
                   8173:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8174:                 "#id2632979">12.1.10. Portability of
1.1       grant    8175:                 packages</a></span></dt>
                   8176:               </dl>
                   8177:             </dd>
                   8178: 
1.23    ! wiz      8179:             <dt><span class="sect1"><a href="#id2633003">12.2.
1.1       grant    8180:             Possible downloading issues</a></span></dt>
                   8181: 
                   8182:             <dd>
                   8183:               <dl>
                   8184:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8185:                 "#id2633006">12.2.1. Packages whose distfiles
1.1       grant    8186:                 aren't available for plain
                   8187:                 downloading</a></span></dt>
                   8188: 
                   8189:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8190:                 "#id2633069">12.2.2. How to handle modified
1.1       grant    8191:                 distfiles with the 'old' name</a></span></dt>
                   8192:               </dl>
                   8193:             </dd>
                   8194: 
1.23    ! wiz      8195:             <dt><span class="sect1"><a href="#id2633081">12.3.
1.1       grant    8196:             Configuration gotchas</a></span></dt>
                   8197: 
                   8198:             <dd>
                   8199:               <dl>
                   8200:                 <dt><span class="sect2"><a href=
                   8201:                 "#fixes.libtool">12.3.1. Shared libraries -
                   8202:                 libtool</a></span></dt>
                   8203: 
                   8204:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8205:                 "#id2633438">12.3.2. Using libtool on GNU packages
1.1       grant    8206:                 that already support libtool</a></span></dt>
                   8207: 
                   8208:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8209:                 "#id2633588">12.3.3. GNU
1.1       grant    8210:                 Autoconf/Automake</a></span></dt>
                   8211:               </dl>
                   8212:             </dd>
                   8213: 
1.23    ! wiz      8214:             <dt><span class="sect1"><a href="#id2633701">12.4.
1.1       grant    8215:             Building considerations</a></span></dt>
                   8216: 
                   8217:             <dd>
                   8218:               <dl>
                   8219:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8220:                 "#id2633704">12.4.1. CPP defines</a></span></dt>
1.1       grant    8221:               </dl>
                   8222:             </dd>
                   8223: 
1.23    ! wiz      8224:             <dt><span class="sect1"><a href="#id2633802">12.5.
1.1       grant    8225:             Package specific actions</a></span></dt>
                   8226: 
                   8227:             <dd>
                   8228:               <dl>
                   8229:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8230:                 "#id2633805">12.5.1. Package configuration
1.1       grant    8231:                 files</a></span></dt>
                   8232: 
                   8233:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8234:                 "#id2633908">12.5.2. User
1.2       hubertf  8235:                 interaction</a></span></dt>
1.1       grant    8236: 
                   8237:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8238:                 "#id2633953">12.5.3. Handling
1.1       grant    8239:                 licenses</a></span></dt>
                   8240: 
                   8241:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8242:                 "#id2634036">12.5.4. Creating an account from a
1.1       grant    8243:                 package</a></span></dt>
                   8244: 
                   8245:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8246:                 "#id2634166">12.5.5. Installing score
1.1       grant    8247:                 files</a></span></dt>
                   8248: 
                   8249:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8250:                 "#id2634210">12.5.6. Packages providing login
1.1       grant    8251:                 shells</a></span></dt>
                   8252: 
                   8253:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8254:                 "#id2634267">12.5.7. Packages containing perl
1.1       grant    8255:                 scripts</a></span></dt>
                   8256: 
                   8257:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8258:                 "#id2634422">12.5.8. Packages with hardcoded paths
1.1       grant    8259:                 to other interpreters</a></span></dt>
                   8260: 
                   8261:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8262:                 "#id2634443">12.5.9. Packages installing perl
1.1       grant    8263:                 modules</a></span></dt>
                   8264: 
                   8265:                 <dt><span class="sect2"><a href=
                   8266:                 "#faq.info-files">12.5.10. Packages installing info
                   8267:                 files</a></span></dt>
                   8268: 
                   8269:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8270:                 "#id2634663">12.5.11. Packages installing GConf2
1.1       grant    8271:                 data files</a></span></dt>
                   8272: 
                   8273:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8274:                 "#id2634763">12.5.12. Packages installing
1.1       grant    8275:                 scrollkeeper data files</a></span></dt>
                   8276: 
                   8277:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8278:                 "#id2634814">12.5.13. Packages installing X11
1.1       grant    8279:                 fonts</a></span></dt>
                   8280: 
                   8281:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8282:                 "#id2634861">12.5.14. Packages installing GTK2
1.1       grant    8283:                 modules</a></span></dt>
                   8284: 
                   8285:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8286:                 "#id2634931">12.5.15. Packages installing SGML or
1.1       grant    8287:                 XML data</a></span></dt>
                   8288: 
                   8289:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8290:                 "#id2635051">12.5.16. Packages installing
1.1       grant    8291:                 extensions to the MIME database</a></span></dt>
                   8292: 
                   8293:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8294:                 "#id2635190">12.5.17. Packages using
1.1       grant    8295:                 intltool</a></span></dt>
1.18      xtraeme  8296: 
                   8297:                 <dt><span class="sect2"><a href=
1.23    ! wiz      8298:                 "#id2635204">12.5.18. Packages installing startup
1.18      xtraeme  8299:                 scripts</a></span></dt>
1.1       grant    8300:               </dl>
                   8301:             </dd>
                   8302: 
1.23    ! wiz      8303:             <dt><span class="sect1"><a href="#id2635225">12.6.
1.1       grant    8304:             Feedback to the author</a></span></dt>
                   8305:           </dl>
                   8306:         </div>
                   8307: 
                   8308:         <div class="sect1" lang="en" xml:lang="en">
                   8309:           <div class="titlepage">
                   8310:             <div>
                   8311:               <div>
                   8312:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      8313:                 "id2632070" id="id2632070"></a>12.1.&nbsp;General
1.1       grant    8314:                 operation</h2>
                   8315:               </div>
                   8316:             </div>
                   8317:           </div>
                   8318: 
                   8319:           <div class="sect2" lang="en" xml:lang="en">
                   8320:             <div class="titlepage">
                   8321:               <div>
                   8322:                 <div>
1.23    ! wiz      8323:                   <h3 class="title"><a name="id2632073" id=
        !          8324:                   "id2632073"></a>12.1.1.&nbsp;How to pull in
1.1       grant    8325:                   variables from /etc/mk.conf</h3>
                   8326:                 </div>
                   8327:               </div>
                   8328:             </div>
                   8329: 
                   8330:             <p>The problem with package-defined variables that can
1.14      xtraeme  8331:             be overridden via <code class="varname">MAKECONF</code>
                   8332:             or <code class="filename">/etc/mk.conf</code> is that
                   8333:             <a href=
1.1       grant    8334:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8335:             <span class="citerefentry"><span class=
                   8336:             "refentrytitle">make</span>(1)</span></a> expands a
                   8337:             variable as it is used, but evaluates preprocessor like
                   8338:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  8339:             So, to use any variable (which may be set in
                   8340:             <code class="filename">/etc/mk.conf</code>) in one of
                   8341:             the .if* statements, the file <code class=
                   8342:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    8343:             that .if* statement.</p>
                   8344: 
                   8345:             <p>Rather than have a number of ad-hoc ways of
1.14      xtraeme  8346:             including <code class="filename">/etc/mk.conf</code>,
                   8347:             should it exist, or <code class=
                   8348:             "varname">MAKECONF</code>, should it exist, include the
                   8349:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
                   8350:             file in the package Makefile before any
                   8351:             preprocessor-like .if, .ifdef, or .ifndef
                   8352:             statements:</p>
1.1       grant    8353:             <pre class="programlisting">
                   8354: .include "../../mk/bsd.prefs.mk"
                   8355:     
                   8356:     .if defined(USE_MENUS)
                   8357:       ...
                   8358:     .endif
                   8359: </pre>
                   8360: 
1.14      xtraeme  8361:             <p>If you wish to set the <code class=
                   8362:             "varname">CFLAGS</code> variable in <code class=
                   8363:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    8364:             use:</p>
                   8365:             <pre class="programlisting">
                   8366: CFLAGS+=  -your -flags
                   8367: </pre>
                   8368: 
1.14      xtraeme  8369:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   8370:             without the &#8220;<span class="quote">+</span>&#8221;)
                   8371:             may lead to problems with packages that need to add
                   8372:             their own flags. Also, you may want to take a look at
                   8373:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    8374:             href=
                   8375:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20      ben      8376:             class="pkgname">devel/cpuflags</a> package if you're
                   8377:             interested in optimization for the current CPU.</p>
1.1       grant    8378:           </div>
                   8379: 
                   8380:           <div class="sect2" lang="en" xml:lang="en">
                   8381:             <div class="titlepage">
                   8382:               <div>
                   8383:                 <div>
1.23    ! wiz      8384:                   <h3 class="title"><a name="id2632156" id=
        !          8385:                   "id2632156"></a>12.1.2.&nbsp;Restricted
1.1       grant    8386:                   packages</h3>
                   8387:                 </div>
                   8388:               </div>
                   8389:             </div>
                   8390: 
                   8391:             <p>Some licenses restrict how software may be
                   8392:             re-distributed. In order to satisfy these restrictions,
                   8393:             the package system defines five make variables that can
                   8394:             be set to note these restrictions:</p>
                   8395: 
                   8396:             <div class="itemizedlist">
                   8397:               <ul type="disc">
                   8398:                 <li>
1.14      xtraeme  8399:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    8400: 
                   8401:                   <p>This variable should be set whenever a
                   8402:                   restriction exists (regardless of its kind). Set
                   8403:                   this variable to a string containing the reason
                   8404:                   for the restriction.</p>
                   8405:                 </li>
                   8406: 
                   8407:                 <li>
1.14      xtraeme  8408:                   <p><code class=
                   8409:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    8410: 
                   8411:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  8412:                   variable to <code class=
                   8413:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8414:                   package may not be included on a CD-ROM.</p>
                   8415:                 </li>
                   8416: 
                   8417:                 <li>
1.14      xtraeme  8418:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    8419: 
                   8420:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  8421:                   Set this variable to <code class=
                   8422:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8423:                   package may not not be made available on the
                   8424:                   Internet.</p>
                   8425:                 </li>
                   8426: 
                   8427:                 <li>
1.14      xtraeme  8428:                   <p><code class=
                   8429:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    8430: 
                   8431:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  8432:                   this variable to <code class=
                   8433:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8434:                   of the source code or other distfile(s) is not
                   8435:                   allowed on CD-ROMs.</p>
                   8436:                 </li>
                   8437: 
                   8438:                 <li>
1.14      xtraeme  8439:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    8440: 
                   8441:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  8442:                   variable to <code class=
                   8443:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8444:                   of the source code or other distfile(s) via the
                   8445:                   Internet is not allowed.</p>
                   8446:                 </li>
                   8447:               </ul>
                   8448:             </div>
                   8449: 
1.14      xtraeme  8450:             <p>Please note that the use of <code class=
                   8451:             "varname">NO_PACKAGE</code>, <code class=
                   8452:             "varname">IGNORE</code>, <code class=
                   8453:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    8454:             variables to denote restrictions is deprecated, because
                   8455:             they unconditionally prevent users from generating
                   8456:             binary packages!</p>
                   8457:           </div>
                   8458: 
                   8459:           <div class="sect2" lang="en" xml:lang="en">
                   8460:             <div class="titlepage">
                   8461:               <div>
                   8462:                 <div>
                   8463:                   <h3 class="title"><a name="dependencies" id=
                   8464:                   "dependencies"></a>12.1.3.&nbsp;Handling
                   8465:                   dependencies</h3>
                   8466:                 </div>
                   8467:               </div>
                   8468:             </div>
                   8469: 
                   8470:             <p>Your package may depend on some other package being
                   8471:             present - and there are various ways of expressing this
1.14      xtraeme  8472:             dependency. pkgsrc supports the <code class=
                   8473:             "varname">BUILD_DEPENDS</code> and <code class=
                   8474:             "varname">DEPENDS</code> definitions, as well as
                   8475:             dependencies via <code class=
                   8476:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    8477:             way to handle dependencies, and which uses the
                   8478:             variables named above. See <a href="#buildlink" title=
                   8479:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8480:             <i>Buildlink methodology</i></a> for more
                   8481:             information.</p>
                   8482: 
                   8483:             <p>The basic difference between the two variables is as
1.14      xtraeme  8484:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    8485:             definition registers that pre-requisite in the binary
                   8486:             package so it will be pulled in when the binary package
1.14      xtraeme  8487:             is later installed, whilst the <code class=
                   8488:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    8489:             marking a dependency that is only needed for building
                   8490:             the package.</p>
                   8491: 
                   8492:             <p>This means that if you only need a package present
                   8493:             whilst you are building, it should be noted as a
1.14      xtraeme  8494:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    8495: 
1.14      xtraeme  8496:             <p>The format for a <code class=
                   8497:             "varname">BUILD_DEPENDS</code> and a <code class=
                   8498:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    8499:             <pre class="programlisting">
                   8500: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   8501: </pre>
                   8502: 
                   8503:             <p>Please note that the &#8220;<span class=
                   8504:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  8505:             any of the wildcard version numbers recognized by
1.1       grant    8506:             <a href=
                   8507:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   8508:             <span class="citerefentry"><span class=
                   8509:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   8510: 
                   8511:             <div class="orderedlist">
                   8512:               <ol type="1">
                   8513:                 <li>
                   8514:                   <p>If your package needs another package's
                   8515:                   binaries or libraries to build or run, and if
1.14      xtraeme  8516:                   that package has a <code class=
                   8517:                   "filename">buildlink3.mk</code> file available,
                   8518:                   use it:</p>
1.1       grant    8519:                   <pre class="programlisting">
                   8520:     .include "../../graphics/jpeg/buildlink3.mk"
                   8521:     
                   8522: </pre>
                   8523:                 </li>
                   8524: 
                   8525:                 <li>
                   8526:                   <p>If your package needs to use another package
1.14      xtraeme  8527:                   to build itself and there is no <code class=
                   8528:                   "filename">buildlink3.mk</code> file available,
                   8529:                   use the <code class=
                   8530:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    8531:                   <pre class="programlisting">
                   8532: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   8533: </pre>
                   8534:                 </li>
                   8535: 
                   8536:                 <li>
                   8537:                   <p>If your package needs a library with which to
1.14      xtraeme  8538:                   link and again there is no <code class=
                   8539:                   "filename">buildlink3.mk</code> file available,
                   8540:                   this is specified using the <code class=
                   8541:                   "varname">DEPENDS</code> definition. An example
                   8542:                   of this is the <a xmlns=
1.1       grant    8543:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8544:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      8545:                   class="pkgname">print/lyx</a> package, which uses
                   8546:                   the xpm library, version 3.4j to build:</p>
1.1       grant    8547:                   <pre class="programlisting">
                   8548: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   8549: </pre>
                   8550: 
                   8551:                   <p>You can also use wildcards in package
                   8552:                   dependences:</p>
                   8553:                   <pre class="programlisting">
                   8554: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   8555: </pre>
                   8556: 
                   8557:                   <p>Note that such wildcard dependencies are
                   8558:                   retained when creating binary packages. The
                   8559:                   dependency is checked when installing the binary
                   8560:                   package and any package which matches the pattern
                   8561:                   will be used. Wildcard dependencies should be
                   8562:                   used with care.</p>
                   8563: 
                   8564:                   <p>The &#8220;<span class=
                   8565:                   "quote">-[0-9]*</span>&#8221; should be used
                   8566:                   instead of &#8220;<span class=
                   8567:                   "quote">-*</span>&#8221; to avoid potentially
                   8568:                   ambiguous matches such as &#8220;<span class=
                   8569:                   "quote">tk-postgresql</span>&#8221; matching a
                   8570:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  8571:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    8572: 
                   8573:                   <p>Wildcards can also be used to specify that a
                   8574:                   package will only build against a certain minimum
                   8575:                   version of a pre-requisite:</p>
                   8576:                   <pre class="programlisting">
                   8577: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   8578: </pre>
                   8579: 
                   8580:                   <p>This means that the package will build against
                   8581:                   version 3.5.4 of the tiff library or newer. Such
                   8582:                   a dependency may be warranted if, for example,
                   8583:                   the API of the library has changed with version
                   8584:                   3.5.4 and a package would not compile against an
                   8585:                   earlier version of tiff.</p>
                   8586: 
                   8587:                   <p>Please note that such dependencies should only
                   8588:                   be updated if a package requires a newer
                   8589:                   pre-requisite, but not to denote recommendations
                   8590:                   such as security updates or ABI changes that do
                   8591:                   not prevent a package from building correctly.
                   8592:                   Such recommendations can be expressed using
1.14      xtraeme  8593:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    8594:                   <pre class="programlisting">
                   8595: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   8596: </pre>
                   8597: 
1.14      xtraeme  8598:                   <p>In addition to the above <code class=
                   8599:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    8600:                   while a package will build against
                   8601:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  8602:                   recommended. <code class=
                   8603:                   "varname">RECOMMENDED</code> entries will be
                   8604:                   turned into dependencies unless explicitly
                   8605:                   ignored (in which case a warning will be
                   8606:                   printed). Packages that are built with
1.1       grant    8607:                   recommendations ignored may not be uploaded to
                   8608:                   ftp.NetBSD.org by developers and should not be
                   8609:                   used across different systems that may have
                   8610:                   different versions of binary packages
                   8611:                   installed.</p>
                   8612: 
                   8613:                   <p>For security fixes, please update the package
                   8614:                   vulnerabilities file as well as setting
1.14      xtraeme  8615:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    8616:                   <a href="#security-handling" title=
                   8617:                   "12.1.7.&nbsp;Handling packages with security problems">
                   8618:                   Section 12.1.7, &#8220;Handling packages with
                   8619:                   security problems&#8221;</a> for more
                   8620:                   information.</p>
                   8621:                 </li>
                   8622: 
                   8623:                 <li>
                   8624:                   <p>If your package needs some executable to be
1.17      sketch   8625:                   able to run correctly and if there's no
1.14      xtraeme  8626:                   <code class="filename">buildlink3.mk</code> file,
                   8627:                   this is specified using the <code class=
                   8628:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    8629:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8630:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      8631:                   class="pkgname">print/lyx</a> package needs to be
                   8632:                   able to execute the latex binary from the teTeX
                   8633:                   package when it runs, and that is specified:</p>
1.1       grant    8634:                   <pre class="programlisting">
                   8635: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   8636: </pre>
                   8637: 
                   8638:                   <p>The comment about wildcard dependencies from
                   8639:                   previous paragraph applies here, too.</p>
                   8640:                 </li>
                   8641:               </ol>
                   8642:             </div>
                   8643: 
                   8644:             <p>If your package needs files from another package to
                   8645:             build, see the first part of the &#8220;<span class=
                   8646:             "quote">do-configure</span>&#8221; target <a xmlns=
                   8647:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8648:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20      ben      8649:             class="pkgname">print/ghostscript5</a> package (it
                   8650:             relies on the jpeg sources being present in source form
                   8651:             during the build):</p>
1.1       grant    8652:             <pre class="programlisting">
                   8653: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   8654:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   8655:     fi
                   8656: </pre>
                   8657: 
                   8658:             <p>If you build any other packages that way, please
                   8659:             make sure the working files are deleted too when this
                   8660:             package's working files are cleaned up. The easiest way
                   8661:             to do so is by adding a pre-clean target:</p>
                   8662:             <pre class="programlisting">
                   8663: pre-clean:
                   8664:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   8665: </pre>
                   8666: 
1.14      xtraeme  8667:             <p>Please also note the <code class=
                   8668:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   8669:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   8670:             which are provided as convenience definitions. The
                   8671:             former works out whether msgfmt(1) is part of the base
                   8672:             system, and, if it isn't, installs the <a xmlns=
1.1       grant    8673:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8674:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20      ben      8675:             class="pkgname">devel/gettext</a> package. The latter
                   8676:             adds a build dependency on either an installed version
                   8677:             of an older gettext package, or if it isn't, installs
                   8678:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8679:             href=
                   8680:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
                   8681:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    8682:           </div>
                   8683: 
                   8684:           <div class="sect2" lang="en" xml:lang="en">
                   8685:             <div class="titlepage">
                   8686:               <div>
                   8687:                 <div>
1.23    ! wiz      8688:                   <h3 class="title"><a name="id2632672" id=
        !          8689:                   "id2632672"></a>12.1.4.&nbsp;Handling conflicts
1.1       grant    8690:                   with other packages</h3>
                   8691:                 </div>
                   8692:               </div>
                   8693:             </div>
                   8694: 
                   8695:             <p>Your package may conflict with other packages a user
                   8696:             might already have installed on his system, e.g. if
                   8697:             your package installs the same set of files like
                   8698:             another package in our pkgsrc tree.</p>
                   8699: 
1.14      xtraeme  8700:             <p>In this case you can set <code class=
                   8701:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    8702:             packages (including version string) your package
                   8703:             conflicts with.</p>
                   8704: 
                   8705:             <p>For example <a xmlns=
                   8706:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8707:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20      ben      8708:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
                   8709:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8710:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
                   8711:             class="pkgname">x11/Xaw-Xpm</a> install provide the
                   8712:             same shared library, thus you set in <code class=
                   8713:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    8714:             <pre class="programlisting">
                   8715: CONFLICTS=      Xaw-Xpm-[0-9]*
                   8716: </pre>
                   8717: 
1.14      xtraeme  8718:             <p>and in <code class=
                   8719:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    8720:             <pre class="programlisting">
                   8721: CONFLICTS=      Xaw3d-[0-9]*
                   8722: </pre>
                   8723: 
                   8724:             <p>Packages will automatically conflict with other
                   8725:             packages with the name prefix and a different version
                   8726:             string. &#8220;<span class=
                   8727:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   8728:             conflict with the older version &#8220;<span class=
                   8729:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   8730:           </div>
                   8731: 
                   8732:           <div class="sect2" lang="en" xml:lang="en">
                   8733:             <div class="titlepage">
                   8734:               <div>
                   8735:                 <div>
1.23    ! wiz      8736:                   <h3 class="title"><a name="id2632790" id=
        !          8737:                   "id2632790"></a>12.1.5.&nbsp;Packages that cannot
1.1       grant    8738:                   or should not be built</h3>
                   8739:                 </div>
                   8740:               </div>
                   8741:             </div>
                   8742: 
                   8743:             <p>There are several reasons why a package might be
                   8744:             instructed to not build under certain circumstances. If
                   8745:             the package builds and runs on most platforms, the
1.14      xtraeme  8746:             exceptions should be noted with <code class=
                   8747:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   8748:             builds and runs on a small handful of platforms, set
                   8749:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
                   8750:             If the package should be skipped (for example, because
                   8751:             it provides functionality already provided by the
                   8752:             system), set <code class=
                   8753:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   8754:             message. If the package should fail because some
                   8755:             preconditions are not met, set <code class=
                   8756:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    8757:             message.</p>
                   8758: 
1.14      xtraeme  8759:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    8760:             because it didn't provide enough information to
                   8761:             determine whether the build should fail.</p>
                   8762:           </div>
                   8763: 
                   8764:           <div class="sect2" lang="en" xml:lang="en">
                   8765:             <div class="titlepage">
                   8766:               <div>
                   8767:                 <div>
1.23    ! wiz      8768:                   <h3 class="title"><a name="id2632816" id=
        !          8769:                   "id2632816"></a>12.1.6.&nbsp;Packages which
1.1       grant    8770:                   should not be deleted, once installed</h3>
                   8771:                 </div>
                   8772:               </div>
                   8773:             </div>
                   8774: 
                   8775:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  8776:             has been installed, the <code class=
                   8777:             "varname">PKG_PRESERVE</code> definition should be set
                   8778:             in the package Makefile. This will be carried into any
1.1       grant    8779:             binary package that is made from this pkgsrc entry. A
                   8780:             &#8220;<span class="quote">preserved</span>&#8221;
                   8781:             package will not be deleted using <a href=
                   8782:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8783:             <span class="citerefentry"><span class=
                   8784:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   8785:             the &#8220;<span class="quote">-f</span>&#8221; option
                   8786:             is used.</p>
                   8787:           </div>
                   8788: 
                   8789:           <div class="sect2" lang="en" xml:lang="en">
                   8790:             <div class="titlepage">
                   8791:               <div>
                   8792:                 <div>
                   8793:                   <h3 class="title"><a name="security-handling" id=
                   8794:                   "security-handling"></a>12.1.7.&nbsp;Handling
                   8795:                   packages with security problems</h3>
                   8796:                 </div>
                   8797:               </div>
                   8798:             </div>
                   8799: 
                   8800:             <p>When a vulnerability is found, this should be noted
1.14      xtraeme  8801:             in <code class=
                   8802:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    8803:             and after the commit of that file, it should be copied
1.14      xtraeme  8804:             to both <code class=
                   8805:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
                   8806:             and <code class=
                   8807:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
                   8808:             on ftp.NetBSD.org using <code class=
                   8809:             "filename">localsrc/security/advisories/Makefile</code>.
                   8810:             In addition, if a <code class=
                   8811:             "filename">buildlink3.mk</code> file exists for an
                   8812:             affected package, bumping <code class=
                   8813:             "varname">PKGREVISION</code> and creating a
                   8814:             corresponding <code class=
                   8815:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   8816:             "replaceable"><code>pkg</code></em></code> entry should
                   8817:             be considered. See <a href="#buildlink" title=
1.1       grant    8818:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8819:             <i>Buildlink methodology</i></a> for more information
1.14      xtraeme  8820:             about writing <code class=
                   8821:             "filename">buildlink3.mk</code> files and <code class=
                   8822:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    8823: 
                   8824:             <p>Also, if the fix should be applied to the stable
                   8825:             pkgsrc branch, be sure to submit a pullup request!</p>
                   8826:           </div>
                   8827: 
                   8828:           <div class="sect2" lang="en" xml:lang="en">
                   8829:             <div class="titlepage">
                   8830:               <div>
                   8831:                 <div>
1.23    ! wiz      8832:                   <h3 class="title"><a name="id2632907" id=
        !          8833:                   "id2632907"></a>12.1.8.&nbsp;How to handle
1.1       grant    8834:                   compiler bugs</h3>
                   8835:                 </div>
                   8836:               </div>
                   8837:             </div>
                   8838: 
                   8839:             <p>Some source files trigger bugs in the compiler,
                   8840:             based on combinations of compiler version and
                   8841:             architecture and almost always relation to optimisation
                   8842:             being enabled. Common symptoms are gcc internal errors
                   8843:             or never finishing compiling a file.</p>
                   8844: 
                   8845:             <p>Typically a workaround involves testing the
1.14      xtraeme  8846:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    8847:             version, disabling optimisation for that
1.14      xtraeme  8848:             file/<code class="varname">MACHINE_ARCH</code>/compiler
                   8849:             combination, and documenting it in <code class=
                   8850:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    8851:             number of examples!</p>
                   8852:           </div>
                   8853: 
                   8854:           <div class="sect2" lang="en" xml:lang="en">
                   8855:             <div class="titlepage">
                   8856:               <div>
                   8857:                 <div>
1.23    ! wiz      8858:                   <h3 class="title"><a name="id2632930" id=
        !          8859:                   "id2632930"></a>12.1.9.&nbsp;How to handle
1.1       grant    8860:                   incrementing versions when fixing an existing
                   8861:                   package</h3>
                   8862:                 </div>
                   8863:               </div>
                   8864:             </div>
                   8865: 
                   8866:             <p>When making fixes to an existing package it can be
1.14      xtraeme  8867:             useful to change the version number in <code class=
                   8868:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    8869:             future versions by the original author, a
                   8870:             &#8220;<span class="quote">nb1</span>&#8221;,
                   8871:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   8872:             suffix can be used on package versions by setting
1.14      xtraeme  8873:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   8874:             The &#8220;<span class="quote">nb</span>&#8221; is
                   8875:             treated like a &#8220;<span class=
                   8876:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    8877:             <pre class="programlisting">
                   8878:   DISTNAME= foo-17.42
                   8879:     PKGREVISION=  9
                   8880: </pre>
                   8881: 
1.14      xtraeme  8882:             <p>will result in a <code class=
                   8883:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    8884:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   8885: 
                   8886:             <p>When a new release of the package is released, the
1.14      xtraeme  8887:             <code class="varname">PKGREVISION</code> should be
                   8888:             removed. e.g. on a new minor release of the above
                   8889:             package, things should be like:</p>
1.1       grant    8890:             <pre class="programlisting">
                   8891: DISTNAME=   foo-17.43
                   8892: </pre>
                   8893:           </div>
                   8894: 
                   8895:           <div class="sect2" lang="en" xml:lang="en">
                   8896:             <div class="titlepage">
                   8897:               <div>
                   8898:                 <div>
1.23    ! wiz      8899:                   <h3 class="title"><a name="id2632979" id=
        !          8900:                   "id2632979"></a>12.1.10.&nbsp;Portability of
1.1       grant    8901:                   packages</h3>
                   8902:                 </div>
                   8903:               </div>
                   8904:             </div>
                   8905: 
                   8906:             <p>One appealing feature of pkgsrc is that it runs on
                   8907:             many different platforms. As a result, it is important
                   8908:             to ensure, where possible, that packages in pkgsrc are
                   8909:             portable. There are some particular details you should
                   8910:             pay attention to while working on pkgsrc.</p>
                   8911: 
                   8912:             <div class="sect3" lang="en" xml:lang="en">
                   8913:               <div class="titlepage">
                   8914:                 <div>
                   8915:                   <div>
1.23    ! wiz      8916:                     <h4 class="title"><a name="id2632984" id=
        !          8917:                     "id2632984"></a>12.1.10.1.&nbsp;${INSTALL},
1.1       grant    8918:                     ${INSTALL_DATA_DIR}, ...</h4>
                   8919:                   </div>
                   8920:                 </div>
                   8921:               </div>
                   8922: 
1.14      xtraeme  8923:               <p>The BSD-compatible <span><strong class=
                   8924:               "command">install</strong></span> supplied with some
1.1       grant    8925:               operating systems will not perform more than one
                   8926:               operation at a time. As such, you should call
                   8927:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   8928:               etc. like this:</p>
                   8929:               <pre class="programlisting">
                   8930: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   8931: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   8932: </pre>
                   8933:             </div>
                   8934:           </div>
                   8935:         </div>
                   8936: 
                   8937:         <div class="sect1" lang="en" xml:lang="en">
                   8938:           <div class="titlepage">
                   8939:             <div>
                   8940:               <div>
                   8941:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      8942:                 "id2633003" id="id2633003"></a>12.2.&nbsp;Possible
1.1       grant    8943:                 downloading issues</h2>
                   8944:               </div>
                   8945:             </div>
                   8946:           </div>
                   8947: 
                   8948:           <div class="sect2" lang="en" xml:lang="en">
                   8949:             <div class="titlepage">
                   8950:               <div>
                   8951:                 <div>
1.23    ! wiz      8952:                   <h3 class="title"><a name="id2633006" id=
        !          8953:                   "id2633006"></a>12.2.1.&nbsp;Packages whose
1.1       grant    8954:                   distfiles aren't available for plain
                   8955:                   downloading</h3>
                   8956:                 </div>
                   8957:               </div>
                   8958:             </div>
                   8959: 
                   8960:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  8961:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   8962:             and a <span><strong class="command">make
                   8963:             fetch</strong></span> will call <code class=
                   8964:             "filename">files/getsite.sh</code> with the name of
                   8965:             each file to download as an argument, expecting it to
                   8966:             output the URL of the directory from which to download
                   8967:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8968:             href=
1.1       grant    8969:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20      ben      8970:             class="pkgname">graphics/ns-cult3d</a> is an example of
                   8971:             this usage.</p>
1.1       grant    8972: 
                   8973:             <p>If the download can't be automated, because the user
                   8974:             must submit personal information to apply for a
                   8975:             password, or must pay for the source, or whatever, you
1.14      xtraeme  8976:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   8977:             a macro which displays a message explaining the
                   8978:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   8979:             must be executable shell commands, not just a message.
                   8980:             (Generally, it executes <code class=
                   8981:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    8982:             following packages use this: <a xmlns=
                   8983:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8984:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20      ben      8985:             class="pkgname">audio/realplayer</a>, <a xmlns=
                   8986:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8987:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
                   8988:             class="pkgname">cad/simian</a>, <a xmlns=
                   8989:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8990:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
                   8991:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
                   8992:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8993:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
                   8994:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
                   8995:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8996:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
                   8997:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
                   8998:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8999:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
                   9000:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
                   9001:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9002:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
                   9003:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
                   9004:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9005:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
                   9006:             class="pkgname">www/openacs</a>. Try to be consistent
                   9007:             with them.</p>
1.1       grant    9008:           </div>
                   9009: 
                   9010:           <div class="sect2" lang="en" xml:lang="en">
                   9011:             <div class="titlepage">
                   9012:               <div>
                   9013:                 <div>
1.23    ! wiz      9014:                   <h3 class="title"><a name="id2633069" id=
        !          9015:                   "id2633069"></a>12.2.2.&nbsp;How to handle
1.1       grant    9016:                   modified distfiles with the 'old' name</h3>
                   9017:                 </div>
                   9018:               </div>
                   9019:             </div>
                   9020: 
                   9021:             <p>Sometimes authors of a software package make some
                   9022:             modifications after the software was released, and they
                   9023:             put up a new distfile without changing the package's
                   9024:             version number. If a package is already in pkgsrc at
                   9025:             that time, the md5 checksum will no longer match. The
                   9026:             correct way to work around this is to update the
                   9027:             package's md5 checksum to match the package on the
                   9028:             master site (beware, any mirrors may not be up to date
                   9029:             yet!), and to remove the old distfile from
1.14      xtraeme  9030:             ftp.NetBSD.org's <code class=
                   9031:             "filename">/pub/NetBSD/packages/distfiles</code>
1.1       grant    9032:             directory. Furthermore, a mail to the package's author
                   9033:             seems appropriate making sure the distfile was really
                   9034:             updated on purpose, and that no trojan horse or so
                   9035:             crept in.</p>
                   9036:           </div>
                   9037:         </div>
                   9038: 
                   9039:         <div class="sect1" lang="en" xml:lang="en">
                   9040:           <div class="titlepage">
                   9041:             <div>
                   9042:               <div>
                   9043:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      9044:                 "id2633081" id=
        !          9045:                 "id2633081"></a>12.3.&nbsp;Configuration
1.1       grant    9046:                 gotchas</h2>
                   9047:               </div>
                   9048:             </div>
                   9049:           </div>
                   9050: 
                   9051:           <div class="sect2" lang="en" xml:lang="en">
                   9052:             <div class="titlepage">
                   9053:               <div>
                   9054:                 <div>
                   9055:                   <h3 class="title"><a name="fixes.libtool" id=
                   9056:                   "fixes.libtool"></a>12.3.1.&nbsp;Shared libraries
                   9057:                   - libtool</h3>
                   9058:                 </div>
                   9059:               </div>
                   9060:             </div>
                   9061: 
                   9062:             <p>pkgsrc supports many different machines, with
                   9063:             different object formats like a.out and ELF, and
                   9064:             varying abilities to do shared library and dynamic
                   9065:             loading at all. To accompany this, varying commands and
                   9066:             options have to be passed to the compiler, linker, etc.
                   9067:             to get the Right Thing, which can be pretty annoying
                   9068:             especially if you don't have all the machines at your
                   9069:             hand to test things. The <a xmlns=
                   9070:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9071:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20      ben      9072:             class="pkgname">devel/libtool</a> pkg can help here, as
                   9073:             it just &#8220;<span class="quote">knows</span>&#8221;
                   9074:             how to build both static and dynamic libraries from a
                   9075:             set of source files, thus being platform
                   9076:             independent.</p>
1.1       grant    9077: 
                   9078:             <p>Here's how to use libtool in a pkg in seven simple
                   9079:             steps:</p>
                   9080: 
                   9081:             <div class="orderedlist">
                   9082:               <ol type="1">
                   9083:                 <li>
1.14      xtraeme  9084:                   <p>Add <code class=
                   9085:                   "varname">USE_LIBTOOL=yes</code> to the package
                   9086:                   Makefile.</p>
1.1       grant    9087:                 </li>
                   9088: 
                   9089:                 <li>
                   9090:                   <p>For library objects, use &#8220;<span class=
                   9091:                   "quote">${LIBTOOL} --mode=compile
                   9092:                   ${CC}</span>&#8221; in place of
                   9093:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   9094:                   You could even add it to the definition of
1.14      xtraeme  9095:                   <code class="varname">CC</code>, if only
                   9096:                   libraries are being built in a given Makefile.
                   9097:                   This one command will build both PIC and non-PIC
                   9098:                   library objects, so you need not have separate
                   9099:                   shared and non-shared library rules.</p>
1.1       grant    9100:                 </li>
                   9101: 
                   9102:                 <li>
                   9103:                   <p>For the linking of the library, remove any
                   9104:                   &#8220;<span class="quote">ar</span>&#8221;,
                   9105:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   9106:                   and &#8220;<span class="quote">ld
                   9107:                   -Bshareable</span>&#8221; commands, and instead
                   9108:                   use:</p>
                   9109:                   <pre class="programlisting">
                   9110: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   9111: </pre>
                   9112: 
                   9113:                   <p>Note that the library is changed to have a
1.14      xtraeme  9114:                   <code class="filename">.la</code> extension, and
                   9115:                   the objects are changed to have a <code class=
                   9116:                   "filename">.lo</code> extension. Change
                   9117:                   <code class="varname">OBJS</code> as necessary.
                   9118:                   This automatically creates all of the
                   9119:                   <code class="filename">.a</code>, <code class=
                   9120:                   "filename">.so.major.minor</code>, and ELF
                   9121:                   symlinks (if necessary) in the build directory.
                   9122:                   Be sure to include &#8220;<span class=
1.1       grant    9123:                   "quote">-version-info</span>&#8221;, especially
                   9124:                   when major and minor are zero, as libtool will
                   9125:                   otherwise strip off the shared library
                   9126:                   version.</p>
                   9127: 
                   9128:                   <p>From the libtool manual:</p>
                   9129:                   <pre class="programlisting">
                   9130:      So, libtool library versions are described by three integers:
                   9131: 
                   9132: CURRENT
                   9133:        The most recent interface number that this library implements.
                   9134: 
                   9135: REVISION
                   9136:        The implementation number of the CURRENT interface.
                   9137: 
                   9138: AGE
                   9139:        The difference between the newest and oldest interfaces that this
                   9140:        library implements.  In other words, the library implements all the
                   9141:        interface numbers in the range from number `CURRENT - AGE' to
                   9142:        `CURRENT'.
                   9143:        
                   9144:      If two libraries have identical CURRENT and AGE numbers, then the
                   9145: dynamic linker chooses the library with the greater REVISION number. 
                   9146: </pre>
                   9147: 
                   9148:                   <p>The &#8220;<span class=
                   9149:                   "quote">-release</span>&#8221; option will
                   9150:                   produce different results for a.out and ELF
                   9151:                   (excluding symlinks) in only one case. An ELF
                   9152:                   library of the form &#8220;<span class=
                   9153:                   "quote">libfoo-release.so.<span class=
                   9154:                   "emphasis"><em>x</em></span>.<span class=
                   9155:                   "emphasis"><em>y</em></span></span>&#8221; will
                   9156:                   have a symlink of &#8220;<span class=
                   9157:                   "quote">libfoo.so.<span class=
                   9158:                   "emphasis"><em>x</em></span>.<span class=
                   9159:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   9160:                   a.out platform. This is handled
                   9161:                   automatically.</p>
                   9162: 
                   9163:                   <p>The &#8220;<span class="quote">-rpath
                   9164:                   argument</span>&#8221; is the install directory
                   9165:                   of the library being built.</p>
                   9166: 
1.14      xtraeme  9167:                   <p>In the <code class="filename">PLIST</code>,
1.19      hubertf  9168:                   include only the <code class=
                   9169:                   "filename">.la</code> file, the other files will
                   9170:                   be added automatically.</p>
1.1       grant    9171:                 </li>
                   9172: 
                   9173:                 <li>
1.14      xtraeme  9174:                   <p>When linking shared object (<code class=
                   9175:                   "filename">.so</code>) files, i.e. files that are
1.1       grant    9176:                   loaded via dlopen(3), NOT shared libraries, use
                   9177:                   &#8220;<span class="quote">-module
                   9178:                   -avoid-version</span>&#8221; to prevent them
                   9179:                   getting version tacked on.</p>
                   9180: 
1.14      xtraeme  9181:                   <p>The <code class="filename">PLIST</code> file
                   9182:                   gets the <code class="filename">foo.so</code>
                   9183:                   entry.</p>
1.1       grant    9184:                 </li>
                   9185: 
                   9186:                 <li>
                   9187:                   <p>When linking programs that depend on these
                   9188:                   libraries <span class=
                   9189:                   "emphasis"><em>before</em></span> they are
                   9190:                   installed, preface the <a href=
                   9191:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   9192:                   <span class="citerefentry"><span class=
                   9193:                   "refentrytitle">cc</span>(1)</span></a> or
                   9194:                   <a href=
                   9195:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   9196:                   <span class="citerefentry"><span class=
                   9197:                   "refentrytitle">ld</span>(1)</span></a> line with
                   9198:                   &#8220;<span class="quote">${LIBTOOL}
                   9199:                   --mode=link</span>&#8221;, and it will find the
                   9200:                   correct libraries (static or shared), but please
                   9201:                   be aware that libtool will not allow you to
                   9202:                   specify a relative path in -L (such as
                   9203:                   &#8220;<span class=
                   9204:                   "quote">-L../somelib</span>&#8221;), because it
                   9205:                   expects you to change that argument to be the
1.14      xtraeme  9206:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    9207:                   <pre class="programlisting">
                   9208: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   9209: </pre>
                   9210: 
                   9211:                   <p>should be changed to:</p>
                   9212:                   <pre class="programlisting">
1.14      xtraeme  9213: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   9214: "replaceable"><code>someprog</code></em> <em class=
                   9215: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    9216: </pre>
                   9217: 
                   9218:                   <p>and it will do the right thing with the
                   9219:                   libraries.</p>
                   9220:                 </li>
                   9221: 
                   9222:                 <li>
                   9223:                   <p>When installing libraries, preface the
                   9224:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   9225:                   <span class="citerefentry"><span class=
                   9226:                   "refentrytitle">install</span>(1)</span></a> or
                   9227:                   <a href=
                   9228:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   9229:                   <span class="citerefentry"><span class=
                   9230:                   "refentrytitle">cp</span>(1)</span></a> command
                   9231:                   with &#8220;<span class="quote">${LIBTOOL}
                   9232:                   --mode=install</span>&#8221;, and change the
1.14      xtraeme  9233:                   library name to <code class=
                   9234:                   "filename">.la</code>. e.g.</p>
1.1       grant    9235:                   <pre class="programlisting">
                   9236: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   9237: </pre>
                   9238: 
1.14      xtraeme  9239:                   <p>This will install the static <code class=
                   9240:                   "filename">.a</code>, shared library, any needed
1.1       grant    9241:                   symlinks, and run <a href=
                   9242:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   9243:                   <span class="citerefentry"><span class=
                   9244:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   9245:                 </li>
                   9246: 
                   9247:                 <li>
1.14      xtraeme  9248:                   <p>In your <code class="filename">PLIST</code>,
1.23    ! wiz      9249:                   include only the <code class=
        !          9250:                   "filename">.la</code> file (this is a change from
        !          9251:                   previous behaviour).</p>
1.1       grant    9252:                 </li>
                   9253:               </ol>
                   9254:             </div>
                   9255:           </div>
                   9256: 
                   9257:           <div class="sect2" lang="en" xml:lang="en">
                   9258:             <div class="titlepage">
                   9259:               <div>
                   9260:                 <div>
1.23    ! wiz      9261:                   <h3 class="title"><a name="id2633438" id=
        !          9262:                   "id2633438"></a>12.3.2.&nbsp;Using libtool on GNU
1.1       grant    9263:                   packages that already support libtool</h3>
                   9264:                 </div>
                   9265:               </div>
                   9266:             </div>
                   9267: 
1.14      xtraeme  9268:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   9269:             the package Makefile. This will override the package's
                   9270:             own libtool in most cases. For older libtool using
1.1       grant    9271:             packages, libtool is made by ltconfig script during the
                   9272:             do-configure step; you can check the libtool script
1.14      xtraeme  9273:             location by doing <span><strong class="command">make
                   9274:             configure; find work*/ -name
                   9275:             libtool</strong></span>.</p>
                   9276: 
                   9277:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   9278:             specifies which libtool scripts, relative to
                   9279:             <code class="varname">WRKSRC</code>, to override. By
                   9280:             default, it is set to &#8220;<span class=
                   9281:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   9282:             this does not match the location of the package's
                   9283:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  9284: 
1.14      xtraeme  9285:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    9286:             static libraries built and installed, then use
1.14      xtraeme  9287:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    9288:             instead.</p>
                   9289: 
                   9290:             <p>If your package makes use of the platform
                   9291:             independent library for loading dynamic shared objects,
                   9292:             that comes with libtool (libltdl), you should include
1.22      tv       9293:             devel/libltdl/buildlink3.mk.</p>
1.1       grant    9294: 
                   9295:             <p>Some packages use libtool incorrectly so that the
                   9296:             package may not work or build in some circumstances.
                   9297:             Some of the more common errors are:</p>
                   9298: 
                   9299:             <div class="itemizedlist">
                   9300:               <ul type="disc">
                   9301:                 <li>
                   9302:                   <p>The inclusion of a shared object (-module) as
                   9303:                   a dependent library in an executable or library.
                   9304:                   This in itself isn't a problem if one of two
                   9305:                   things has been done:</p>
                   9306: 
                   9307:                   <div class="orderedlist">
                   9308:                     <ol type="1">
                   9309:                       <li>
                   9310:                         <p>The shared object is named correctly,
1.14      xtraeme  9311:                         i.e. <code class=
                   9312:                         "filename">libfoo.la</code>, not
                   9313:                         <code class="filename">foo.la</code></p>
1.1       grant    9314:                       </li>
                   9315: 
                   9316:                       <li>
                   9317:                         <p>The -dlopen option is used when linking
                   9318:                         an executable.</p>
                   9319:                       </li>
                   9320:                     </ol>
                   9321:                   </div>
                   9322:                 </li>
                   9323: 
                   9324:                 <li>
                   9325:                   <p>The use of libltdl without the correct calls
                   9326:                   to initialisation routines. The function
                   9327:                   lt_dlinit() should be called and the macro
1.14      xtraeme  9328:                   <code class=
                   9329:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    9330:                   included in executables.</p>
                   9331:                 </li>
                   9332:               </ul>
                   9333:             </div>
                   9334:           </div>
                   9335: 
                   9336:           <div class="sect2" lang="en" xml:lang="en">
                   9337:             <div class="titlepage">
                   9338:               <div>
                   9339:                 <div>
1.23    ! wiz      9340:                   <h3 class="title"><a name="id2633588" id=
        !          9341:                   "id2633588"></a>12.3.3.&nbsp;GNU
1.1       grant    9342:                   Autoconf/Automake</h3>
                   9343:                 </div>
                   9344:               </div>
                   9345:             </div>
                   9346: 
                   9347:             <p>If a package needs GNU autoconf or automake to be
                   9348:             executed to regenerate the configure script and
                   9349:             Makefile.in makefile templates, then they should be
                   9350:             executed in a pre-configure target. Two Makefile
1.14      xtraeme  9351:             fragments are provided in <code class=
                   9352:             "filename">pkgsrc/mk/autoconf.mk</code> and
                   9353:             <code class="filename">pkgsrc/mk/automake.mk</code> to
                   9354:             help dealing with these tools. See comments in these
                   9355:             files for details.</p>
1.1       grant    9356: 
                   9357:             <p>For packages that need only autoconf:</p>
                   9358:             <pre class="programlisting">
                   9359: AUTOCONF_REQD=    2.50    # if default version is not good enough
                   9360: ...
                   9361: 
                   9362: pre-configure:
                   9363:           cd ${WRKSRC}; ${AUTOCONF}
                   9364: 
                   9365: ...
                   9366: .include "../../mk/autoconf.mk"
                   9367: </pre>
                   9368: 
                   9369:             <p>and for packages that need automake and
                   9370:             autoconf:</p>
                   9371:             <pre class="programlisting">
                   9372: AUTOMAKE_REQD=  1.7.1   # if default version is not good enough
                   9373: ...
                   9374: 
                   9375: pre-configure:
                   9376:           cd ${WRKSRC};                                           \
                   9377:           ${ACLOCAL};                                             \
                   9378:           ${AUTOHEADER};                                          \
                   9379:           ${AUTOMAKE} -a --foreign -i;                            \
                   9380:           ${AUTOCONF}
                   9381: 
                   9382: ...
                   9383: .include "../mk/automake.mk"
                   9384: </pre>
                   9385: 
                   9386:             <p>Packages which use GNU Automake will almost
                   9387:             certainly require GNU Make, but that's automatically
1.14      xtraeme  9388:             provided for you in <code class=
                   9389:             "filename">mk/automake.mk</code>.</p>
1.1       grant    9390: 
                   9391:             <p>There are times when the configure process makes
                   9392:             additional changes to the generated files, which then
                   9393:             causes the build process to try to re-execute the
                   9394:             automake sequence. This is prevented by touching
                   9395:             various files in the configure stage. If this causes
1.14      xtraeme  9396:             problems with your package you can set <code class=
                   9397:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    9398:             Makefile.</p>
                   9399:           </div>
                   9400:         </div>
                   9401: 
                   9402:         <div class="sect1" lang="en" xml:lang="en">
                   9403:           <div class="titlepage">
                   9404:             <div>
                   9405:               <div>
                   9406:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      9407:                 "id2633701" id="id2633701"></a>12.4.&nbsp;Building
1.1       grant    9408:                 considerations</h2>
                   9409:               </div>
                   9410:             </div>
                   9411:           </div>
                   9412: 
                   9413:           <div class="sect2" lang="en" xml:lang="en">
                   9414:             <div class="titlepage">
                   9415:               <div>
                   9416:                 <div>
1.23    ! wiz      9417:                   <h3 class="title"><a name="id2633704" id=
        !          9418:                   "id2633704"></a>12.4.1.&nbsp;CPP defines</h3>
1.1       grant    9419:                 </div>
                   9420:               </div>
                   9421:             </div>
                   9422: 
                   9423:             <p>To port an application to NetBSD, it's usually
                   9424:             necessary for the compiler to be able to judge the
                   9425:             system on which it's compiling, and we use definitions
                   9426:             so that the C pre-processor can do this.</p>
                   9427: 
                   9428:             <p>To test whether you are working on a 4.4 BSD-derived
                   9429:             system, you should use the BSD definition, which is
1.14      xtraeme  9430:             defined in <code class=
                   9431:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    9432:             systems.</p>
                   9433:             <pre class="programlisting">
                   9434: #include &lt;sys/param.h&gt;
                   9435: </pre>
                   9436: 
                   9437:             <p>and then you can surround the BSD-specific parts of
                   9438:             your package's C/C++ code using this conditional:</p>
                   9439:             <pre class="programlisting">
                   9440: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   9441:     ...
                   9442: #endif
                   9443: </pre>
                   9444: 
                   9445:             <p>Please use the &#8220;<span class=
                   9446:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   9447:             it should only apply to features of NetBSD that are not
                   9448:             present in other 4.4-lite derived BSDs.</p>
                   9449:           </div>
                   9450:         </div>
                   9451: 
                   9452:         <div class="sect1" lang="en" xml:lang="en">
                   9453:           <div class="titlepage">
                   9454:             <div>
                   9455:               <div>
                   9456:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      9457:                 "id2633802" id="id2633802"></a>12.5.&nbsp;Package
1.1       grant    9458:                 specific actions</h2>
                   9459:               </div>
                   9460:             </div>
                   9461:           </div>
                   9462: 
                   9463:           <div class="sect2" lang="en" xml:lang="en">
                   9464:             <div class="titlepage">
                   9465:               <div>
                   9466:                 <div>
1.23    ! wiz      9467:                   <h3 class="title"><a name="id2633805" id=
        !          9468:                   "id2633805"></a>12.5.1.&nbsp;Package
1.1       grant    9469:                   configuration files</h3>
                   9470:                 </div>
                   9471:               </div>
                   9472:             </div>
                   9473: 
                   9474:             <p>Packages should be taught to look for their
1.14      xtraeme  9475:             configuration files in <code class=
                   9476:             "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1       grant    9477:             through to the configure and build processes.
1.14      xtraeme  9478:             <code class="varname">PKG_SYSCONFDIR</code> may be
1.1       grant    9479:             customized in various ways by setting other make
                   9480:             variables:</p>
                   9481: 
                   9482:             <div class="itemizedlist">
                   9483:               <ul type="disc">
                   9484:                 <li>
1.14      xtraeme  9485:                   <p><code class="varname">PKG_SYSCONFBASE</code>
                   9486:                   is the main config directory under which all
                   9487:                   package configuration files are to be found. This
                   9488:                   defaults to <code class=
                   9489:                   "filename">${PREFIX}/etc</code>, but may be
                   9490:                   overridden in <code class=
                   9491:                   "filename">/etc/mk.conf</code>.</p>
1.1       grant    9492:                 </li>
                   9493: 
                   9494:                 <li>
1.14      xtraeme  9495:                   <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   9496:                   is the subdirectory of <code class=
                   9497:                   "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    9498:                   configuration files for a particular package may
                   9499:                   be found, e.g. the Apache configuration files may
1.14      xtraeme  9500:                   all be found under the <code class=
                   9501:                   "filename">httpd/</code> subdirectory of
                   9502:                   <code class="varname">${PKG_SYSCONFBASE}</code>.
                   9503:                   This should be set in the package Makefile.</p>
1.1       grant    9504:                 </li>
                   9505: 
                   9506:                 <li>
1.14      xtraeme  9507:                   <p>By default, <code class=
                   9508:                   "varname">PKG_SYSCONFDIR</code> is set to
                   9509:                   <code class=
                   9510:                   "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
                   9511:                   but this may be overridden by setting
                   9512:                   <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9513:                   for a particular package, where <code class=
                   9514:                   "varname">PKG_SYSCONFVAR</code> defaults to
                   9515:                   <code class="varname">${PKGBASE}</code>. This is
                   9516:                   not meant to be set by a package Makefile, but is
1.1       grant    9517:                   reserved for users who wish to override the
1.14      xtraeme  9518:                   <code class="varname">PKG_SYSCONFDIR</code>
                   9519:                   setting for a particular package with a special
1.1       grant    9520:                   location.</p>
                   9521:                 </li>
                   9522:               </ul>
                   9523:             </div>
                   9524: 
                   9525:             <p>The only variables that users should customize are
1.14      xtraeme  9526:             <code class="varname">PKG_SYSCONFBASE</code> and
                   9527:             <code class=
                   9528:             "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
                   9529:             Users will typically want to set <code class=
                   9530:             "varname">PKG_SYSCONFBASE</code> to <code class=
                   9531:             "filename">/etc</code>, or to accept the default
                   9532:             location of <code class=
                   9533:             "filename">${PREFIX}/etc</code>.</p>
1.1       grant    9534:           </div>
                   9535: 
                   9536:           <div class="sect2" lang="en" xml:lang="en">
                   9537:             <div class="titlepage">
                   9538:               <div>
                   9539:                 <div>
1.23    ! wiz      9540:                   <h3 class="title"><a name="id2633908" id=
        !          9541:                   "id2633908"></a>12.5.2.&nbsp;User
1.2       hubertf  9542:                   interaction</h3>
1.1       grant    9543:                 </div>
                   9544:               </div>
                   9545:             </div>
                   9546: 
                   9547:             <p>Occasionally, packages require interaction from the
                   9548:             user, and this can be in a number of ways:</p>
                   9549: 
                   9550:             <div class="itemizedlist">
                   9551:               <ul type="disc">
                   9552:                 <li>
                   9553:                   <p>help in fetching the distfiles</p>
                   9554:                 </li>
                   9555: 
                   9556:                 <li>
                   9557:                   <p>help to configure the package before it is
                   9558:                   built</p>
                   9559:                 </li>
                   9560: 
                   9561:                 <li>
                   9562:                   <p>help during the build process</p>
                   9563:                 </li>
                   9564: 
                   9565:                 <li>
                   9566:                   <p>help during the installation of a package</p>
                   9567:                 </li>
                   9568:               </ul>
                   9569:             </div>
                   9570: 
1.14      xtraeme  9571:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    9572:             definition is provided to notify the pkgsrc mechanism
                   9573:             of an interactive stage which will be needed, and this
1.14      xtraeme  9574:             should be set in the package's <code class=
                   9575:             "filename">Makefile</code>. e.g.</p>
1.1       grant    9576:             <pre class="programlisting">
                   9577: INTERACTIVE_STAGE= build
                   9578: </pre>
                   9579: 
                   9580:             <p>Multiple interactive stages can be specified:</p>
                   9581:             <pre class="programlisting">
                   9582: INTERACTIVE_STAGE= configure install
                   9583: </pre>
                   9584:           </div>
                   9585: 
                   9586:           <div class="sect2" lang="en" xml:lang="en">
                   9587:             <div class="titlepage">
                   9588:               <div>
                   9589:                 <div>
1.23    ! wiz      9590:                   <h3 class="title"><a name="id2633953" id=
        !          9591:                   "id2633953"></a>12.5.3.&nbsp;Handling
1.1       grant    9592:                   licenses</h3>
                   9593:                 </div>
                   9594:               </div>
                   9595:             </div>
                   9596: 
                   9597:             <p>A package may underly a license which the user has
                   9598:             or has not agreed to accept. Usually, packages that
                   9599:             underly well-known Open Source licenses (e.g. the GNU
                   9600:             Public License, GPL) won't have any special license
                   9601:             tags added in pkgsrc which require special action by
                   9602:             the user of such packages, but there are quite a number
                   9603:             of other licenses out there that pkgsrc users may not
                   9604:             be able to follow, for whatever reasons. For these
                   9605:             cases, pkgsrc contains a mechanism to note that a
                   9606:             package underlies a certain license, and the user has
                   9607:             to accept the license before the package can be
                   9608:             installed.</p>
                   9609: 
                   9610:             <p>Placing a certain package under a certain license
1.14      xtraeme  9611:             works by setting the <code class=
                   9612:             "varname">LICENSE</code> variable to a string
                   9613:             identifying the license, e.g. in <a xmlns=
                   9614:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9615:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20      ben      9616:             class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    9617:             <pre class="programlisting">
                   9618: LICENSE=        graphviz-license
                   9619: </pre>
                   9620: 
                   9621:             <p>When trying to build, the user will get a notice
                   9622:             that the package underlies a license which he hasn't
                   9623:             accepted (yet):</p>
                   9624:             <pre class="programlisting">
1.14      xtraeme  9625: <code class="prompt">%</code> <strong class=
                   9626: "userinput"><code>make</code></strong>
1.1       grant    9627: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   9628: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   9629: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   9630: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   9631: *** Error code 1
                   9632: </pre>
                   9633: 
1.14      xtraeme  9634:             <p>The license can be viewed with <span><strong class=
                   9635:             "command">make show-license</strong></span>, and if it
                   9636:             is considered appropriate, the line printed above can
                   9637:             be added to <code class="filename">/etc/mk.conf</code>
                   9638:             to indicate acceptance of the particular license:</p>
1.1       grant    9639:             <pre class="programlisting">
                   9640: ACCEPTABLE_LICENSES+=graphviz-license
                   9641: </pre>
                   9642: 
                   9643:             <p>When adding a package with a new license, the
1.14      xtraeme  9644:             license text should be added to <code class=
                   9645:             "filename">pkgsrc/licenses</code> for displaying. A
                   9646:             list of known licenses can be seen in this directory as
                   9647:             well as by looking at the list of (commented out)
                   9648:             <code class="varname">ACCEPTABLE_LICENSES</code>
                   9649:             variable settings in <code class=
                   9650:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    9651: 
1.17      sketch   9652:             <p>If there is a <span class=
1.1       grant    9653:             "emphasis"><em>really</em></span> pressing need to
                   9654:             accept all licenses at once, like when trying to
                   9655:             download or mirror all distfiles or doing a bulk build
                   9656:             to test if all packages in pkgsrc build, this can be
1.14      xtraeme  9657:             done by setting <code class=
                   9658:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    9659:           </div>
                   9660: 
                   9661:           <div class="sect2" lang="en" xml:lang="en">
                   9662:             <div class="titlepage">
                   9663:               <div>
                   9664:                 <div>
1.23    ! wiz      9665:                   <h3 class="title"><a name="id2634036" id=
        !          9666:                   "id2634036"></a>12.5.4.&nbsp;Creating an account
1.1       grant    9667:                   from a package</h3>
                   9668:                 </div>
                   9669:               </div>
                   9670:             </div>
                   9671: 
                   9672:             <p>There are two make variables used to control the
                   9673:             creation of package-specific groups and users at
1.14      xtraeme  9674:             pre-install time. The first is <code class=
                   9675:             "varname">PKG_GROUPS</code>, which is a list of
1.1       grant    9676:             group[:groupid] elements, where the groupid is
1.14      xtraeme  9677:             optional. The second is <code class=
                   9678:             "varname">PKG_USERS</code>, which is a list of elements
1.1       grant    9679:             of the form:</p>
                   9680:             <pre class="programlisting">
                   9681: user:group[:[userid][:[description][:[home][:shell]]]]
                   9682: </pre>
                   9683: 
                   9684:             <p>where only the user and group are required, the rest
                   9685:             being optional. A simple example is:</p>
                   9686:             <pre class="programlisting">
                   9687:   PKG_GROUPS=       foogroup
                   9688:     PKG_USERS=    foouser:foogroup
                   9689: </pre>
                   9690: 
                   9691:             <p>A more complex example is that creates two groups
                   9692:             and two users is:</p>
                   9693:             <pre class="programlisting">
                   9694:   PKG_GROUPS=       group1 group2:1005
                   9695:     PKG_USERS=    first:group1::First\\ User                      \
                   9696:                   second:group2::Second\\ User:/home/second:${SH}
                   9697: </pre>
                   9698: 
                   9699:             <p>By default, a new user will have home directory
1.14      xtraeme  9700:             <code class="filename">/nonexistent</code>, and login
                   9701:             shell <code class="filename">/sbin/nologin</code>
                   9702:             unless they are specified as part of the user
                   9703:             element.</p>
1.1       grant    9704: 
1.14      xtraeme  9705:             <p>The package <code class="filename">Makefile</code>
                   9706:             must also set <code class=
                   9707:             "varname">USE_PKGINSTALL=YES</code>. This will cause
                   9708:             the users and groups to be created at pre-install time,
                   9709:             and the admin will be prompted to remove them at
                   9710:             post-deinstall time. Automatic creation of the users
                   9711:             and groups can be toggled on and off by setting the
                   9712:             <code class="varname">PKG_CREATE_USERGROUP</code>
                   9713:             variable prior to package installation.</p>
1.1       grant    9714:           </div>
                   9715: 
                   9716:           <div class="sect2" lang="en" xml:lang="en">
                   9717:             <div class="titlepage">
                   9718:               <div>
                   9719:                 <div>
1.23    ! wiz      9720:                   <h3 class="title"><a name="id2634166" id=
        !          9721:                   "id2634166"></a>12.5.5.&nbsp;Installing score
1.1       grant    9722:                   files</h3>
                   9723:                 </div>
                   9724:               </div>
                   9725:             </div>
                   9726: 
                   9727:             <p>Certain packages, most of them in the games
                   9728:             category, install a score file that allows all users on
                   9729:             the system to record their highscores. In order for
                   9730:             this to work, the binaries need to be installed setgid
                   9731:             and the score files owned by the appropriate group
                   9732:             and/or owner (traditionally the "games" user/group).
                   9733:             The following variables, documented in more detail in
1.14      xtraeme  9734:             <code class="filename">mk/defaults/mk.conf</code>,
                   9735:             control this behaviour: <code class=
                   9736:             "varname">SETGIDGAME</code>, <code class=
                   9737:             "varname">GAMEDATAMODE</code>, <code class=
                   9738:             "varname">GAMEGRP</code>, <code class=
                   9739:             "varname">GAMEMODE</code>, <code class=
                   9740:             "varname">GAMEOWN</code>.</p>
1.1       grant    9741: 
                   9742:             <p>Note that per default, setgid installation of games
1.14      xtraeme  9743:             is disabled; setting <code class=
                   9744:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    9745:             variables accordingly.</p>
                   9746: 
                   9747:             <p>A package should therefor never hard code file
1.14      xtraeme  9748:             ownership or access permissions but rely on
                   9749:             <code class="varname">INSTALL_GAME</code> and
                   9750:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   9751:             these correctly.</p>
1.1       grant    9752:           </div>
                   9753: 
                   9754:           <div class="sect2" lang="en" xml:lang="en">
                   9755:             <div class="titlepage">
                   9756:               <div>
                   9757:                 <div>
1.23    ! wiz      9758:                   <h3 class="title"><a name="id2634210" id=
        !          9759:                   "id2634210"></a>12.5.6.&nbsp;Packages providing
1.1       grant    9760:                   login shells</h3>
                   9761:                 </div>
                   9762:               </div>
                   9763:             </div>
                   9764: 
                   9765:             <p>If the purpose of the package is to provide a login
1.14      xtraeme  9766:             shell, the variable <code class=
                   9767:             "varname">PKG_SHELL</code> should contain the full
                   9768:             pathname of the shell executable installed by this
                   9769:             package. The package <code class=
                   9770:             "filename">Makefile</code> must also set <code class=
                   9771:             "varname">USE_PKGINSTALL=YES</code> to use the
                   9772:             automatically generated <code class=
                   9773:             "filename">INSTALL</code>/<code class=
                   9774:             "filename">DEINSTALL</code> scripts.</p>
1.1       grant    9775: 
                   9776:             <p>An example taken from shells/zsh:</p>
                   9777:             <pre class="programlisting">
                   9778:   USE_PKGINSTALL=   YES
                   9779:     PKG_SHELL=    ${PREFIX}/bin/zsh
                   9780: </pre>
                   9781: 
1.14      xtraeme  9782:             <p>The shell is registered into <code class=
                   9783:             "filename">/etc/shells</code> file automatically in the
                   9784:             post-install target by the generated <code class=
                   9785:             "filename">INSTALL</code> script and removed in the
                   9786:             deinstall target by the <code class=
                   9787:             "filename">DEINSTALL</code> script.</p>
1.1       grant    9788:           </div>
                   9789: 
                   9790:           <div class="sect2" lang="en" xml:lang="en">
                   9791:             <div class="titlepage">
                   9792:               <div>
                   9793:                 <div>
1.23    ! wiz      9794:                   <h3 class="title"><a name="id2634267" id=
        !          9795:                   "id2634267"></a>12.5.7.&nbsp;Packages containing
1.1       grant    9796:                   perl scripts</h3>
                   9797:                 </div>
                   9798:               </div>
                   9799:             </div>
                   9800: 
                   9801:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  9802:             set <code class="varname">REPLACE_PERL</code> to ensure
                   9803:             that the proper interpreter path is set. <code class=
                   9804:             "varname">REPLACE_PERL</code> should contain a list of
                   9805:             scripts, relative to <code class=
                   9806:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    9807:           </div>
                   9808: 
                   9809:           <div class="sect2" lang="en" xml:lang="en">
                   9810:             <div class="titlepage">
                   9811:               <div>
                   9812:                 <div>
1.23    ! wiz      9813:                   <h3 class="title"><a name="id2634422" id=
        !          9814:                   "id2634422"></a>12.5.8.&nbsp;Packages with
1.1       grant    9815:                   hardcoded paths to other interpreters</h3>
                   9816:                 </div>
                   9817:               </div>
                   9818:             </div>
                   9819: 
                   9820:             <p>Your package may also contain scripts with hardcoded
                   9821:             paths to other interpreters besides (or as well as)
                   9822:             perl. To correct the full pathname to the script
                   9823:             interpreter, you need to set the following definitions
1.14      xtraeme  9824:             in your <code class="filename">Makefile</code> (we
                   9825:             shall use <span><strong class=
                   9826:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    9827:             <pre class="programlisting">
                   9828:   REPLACE_INTERPRETER+=     tcl
                   9829:     _REPLACE.tcl.old=     .*/bin/tclsh
                   9830:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   9831:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   9832:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   9833: </pre>
                   9834:           </div>
                   9835: 
                   9836:           <div class="sect2" lang="en" xml:lang="en">
                   9837:             <div class="titlepage">
                   9838:               <div>
                   9839:                 <div>
1.23    ! wiz      9840:                   <h3 class="title"><a name="id2634443" id=
        !          9841:                   "id2634443"></a>12.5.9.&nbsp;Packages installing
1.1       grant    9842:                   perl modules</h3>
                   9843:                 </div>
                   9844:               </div>
                   9845:             </div>
                   9846: 
                   9847:             <p>Makefiles of packages providing perl5 modules should
1.14      xtraeme  9848:             include the Makefile fragment <code class=
                   9849:             "filename">../../lang/perl5/module.mk</code>. It
                   9850:             provides a <span><strong class=
                   9851:             "command">do-configure</strong></span> target for the
                   9852:             standard perl configuration for such modules as well as
                   9853:             various hooks to tune this configuration. See comments
                   9854:             in this file for details.</p>
1.1       grant    9855: 
                   9856:             <p>Perl5 modules will install into different places
                   9857:             depending on the version of perl used during the build
                   9858:             process. To address this, pkgsrc will append lines to
1.14      xtraeme  9859:             the <code class="filename">PLIST</code> corresponding
                   9860:             to the files listed in the installed <code class=
                   9861:             "filename">.packlist</code> file generated by most
                   9862:             perl5 modules. This is invoked by defining <code class=
                   9863:             "varname">PERL5_PACKLIST</code> to a space-separated
                   9864:             list of paths to packlist files, e.g.:</p>
1.1       grant    9865:             <pre class="programlisting">
                   9866: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   9867: </pre>
                   9868: 
1.14      xtraeme  9869:             <p>The variables <code class=
                   9870:             "varname">PERL5_SITELIB</code>, <code class=
                   9871:             "varname">PERL5_SITEARCH</code>, and <code class=
                   9872:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    9873:             locations in which perl5 modules may be installed, and
                   9874:             may be used by perl5 packages that don't have a
                   9875:             packlist. These three variables are also substituted
1.14      xtraeme  9876:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    9877:           </div>
                   9878: 
                   9879:           <div class="sect2" lang="en" xml:lang="en">
                   9880:             <div class="titlepage">
                   9881:               <div>
                   9882:                 <div>
                   9883:                   <h3 class="title"><a name="faq.info-files" id=
                   9884:                   "faq.info-files"></a>12.5.10.&nbsp;Packages
                   9885:                   installing info files</h3>
                   9886:                 </div>
                   9887:               </div>
                   9888:             </div>
                   9889: 
                   9890:             <p>Some packages install info files or use the
                   9891:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   9892:             &#8220;<span class="quote">install-info</span>&#8221;
                   9893:             commands. Each of the info files:</p>
                   9894: 
                   9895:             <div class="itemizedlist">
                   9896:               <ul type="disc">
                   9897:                 <li>
                   9898:                   <p>is considered to be installed in the directory
1.14      xtraeme  9899:                   <code class=
                   9900:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    9901:                 </li>
                   9902: 
                   9903:                 <li>
                   9904:                   <p>is registered in the Info directory file
1.14      xtraeme  9905:                   <code class=
                   9906:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    9907:                 </li>
                   9908: 
                   9909:                 <li>
                   9910:                   <p>and must be listed as a filename in the
1.14      xtraeme  9911:                   <code class="varname">INFO_FILES</code> variable
                   9912:                   in the package Makefile.</p>
1.1       grant    9913:                 </li>
                   9914:               </ul>
                   9915:             </div>
                   9916: 
1.14      xtraeme  9917:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    9918:             &#8220;<span class="quote">info</span>&#8221; and can
1.14      xtraeme  9919:             be overridden in the package Makefile. <code class=
                   9920:             "filename">INSTALL</code> and <code class=
                   9921:             "filename">DEINSTALL</code> scripts will be generated
                   9922:             to handle registration of the info files in the Info
1.1       grant    9923:             directory file. The &#8220;<span class=
                   9924:             "quote">install-info</span>&#8221; command used for the
                   9925:             info files registration is either provided by the
                   9926:             system, or by a special purpose package automatically
                   9927:             added as dependency if needed.</p>
                   9928: 
                   9929:             <p>A package which needs the &#8220;<span class=
                   9930:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  9931:             must define the variable <code class=
                   9932:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    9933:             minimum version of the &#8220;<span class=
                   9934:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  9935:             should be noted with the <code class=
                   9936:             "varname">TEXINFO_REQD</code> variable in the package
                   9937:             <code class="filename">Makefile</code>. By default, a
1.1       grant    9938:             minimum version of 3.12 is required. If the system does
1.14      xtraeme  9939:             not provide a <span><strong class=
                   9940:             "command">makeinfo</strong></span> command or if it
                   9941:             does not match the required minimum, a build dependency
                   9942:             on the <a xmlns=
                   9943:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9944:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20      ben      9945:             class="pkgname">devel/gtexinfo</a> package will be
                   9946:             added automatically.</p>
1.1       grant    9947: 
                   9948:             <p>The build and installation process of the software
                   9949:             provided by the package should not use the
1.14      xtraeme  9950:             <span><strong class=
                   9951:             "command">install-info</strong></span> command as the
                   9952:             registration of info files is the task of the package
                   9953:             <code class="filename">INSTALL</code> script, and it
                   9954:             must use the appropriate <span><strong class=
                   9955:             "command">makeinfo</strong></span> command.</p>
1.1       grant    9956: 
                   9957:             <p>To achieve this goal the pkgsrc infrastructure
1.14      xtraeme  9958:             creates overriding scripts for the <span><strong class=
                   9959:             "command">install-info</strong></span> and
                   9960:             <span><strong class="command">makeinfo</strong></span>
                   9961:             commands in a directory listed early in <code class=
                   9962:             "varname">PATH</code>.</p>
1.1       grant    9963: 
1.14      xtraeme  9964:             <p>The script overriding <span><strong class=
                   9965:             "command">install-info</strong></span> has no effect
                   9966:             except the logging of a message. The script overriding
                   9967:             <span><strong class="command">makeinfo</strong></span>
                   9968:             logs a message and according to the value of
                   9969:             <code class="varname">USE_MAKEINFO</code> and
                   9970:             <code class="varname">TEXINFO_REQD</code> either run
                   9971:             the appropriate <span><strong class=
                   9972:             "command">makeinfo</strong></span> command or exit on
                   9973:             error.</p>
1.1       grant    9974:           </div>
                   9975: 
                   9976:           <div class="sect2" lang="en" xml:lang="en">
                   9977:             <div class="titlepage">
                   9978:               <div>
                   9979:                 <div>
1.23    ! wiz      9980:                   <h3 class="title"><a name="id2634663" id=
        !          9981:                   "id2634663"></a>12.5.11.&nbsp;Packages installing
1.1       grant    9982:                   GConf2 data files</h3>
                   9983:                 </div>
                   9984:               </div>
                   9985:             </div>
                   9986: 
1.14      xtraeme  9987:             <p>If a package installs <code class=
                   9988:             "filename">.schemas</code> or <code class=
                   9989:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    9990:             need to take some extra steps to make sure they get
                   9991:             registered in the database:</p>
                   9992: 
                   9993:             <div class="orderedlist">
                   9994:               <ol type="1">
                   9995:                 <li>
1.14      xtraeme  9996:                   <p>Include <code class=
                   9997:                   "filename">../../devel/GConf2/schemas.mk</code>
                   9998:                   instead of its <code class=
                   9999:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    10000:                   care of rebuilding the GConf2 database at
                   10001:                   installation and deinstallation time, and tells
                   10002:                   the package where to install GConf2 data files
                   10003:                   using some standard configure arguments. It also
                   10004:                   disallows any access to the database directly
                   10005:                   from the package.</p>
                   10006:                 </li>
                   10007: 
                   10008:                 <li>
                   10009:                   <p>Ensure that the package installs its
1.14      xtraeme  10010:                   <code class="filename">.schemas</code> files
                   10011:                   under <code class=
                   10012:                   "filename">${PREFIX}/share/gconf/schemas</code>.
                   10013:                   If they get installed under <code class=
                   10014:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    10015:                   manually patch the package.</p>
                   10016:                 </li>
                   10017: 
                   10018:                 <li>
                   10019:                   <p>Check the PLIST and remove any entries under
                   10020:                   the etc/gconf directory, as they will be handled
                   10021:                   automatically. See <a href="#faq.conf" title=
1.14      xtraeme  10022:                   "6.14.&nbsp;Configuration files handling and placement">
                   10023:                   Section&nbsp;6.14, &#8220;Configuration files
1.1       grant    10024:                   handling and placement&#8221;</a> for more
                   10025:                   information.</p>
                   10026:                 </li>
                   10027: 
                   10028:                 <li>
1.14      xtraeme  10029:                   <p>Define the <code class=
                   10030:                   "varname">GCONF2_SCHEMAS</code> variable in your
                   10031:                   <code class="filename">Makefile</code> with a
                   10032:                   list of all <code class=
                   10033:                   "filename">.schemas</code> files installed by the
                   10034:                   package, if any. Names must not contain any
                   10035:                   directories in them.</p>
1.1       grant    10036:                 </li>
                   10037: 
                   10038:                 <li>
1.14      xtraeme  10039:                   <p>Define the <code class=
                   10040:                   "varname">GCONF2_ENTRIES</code> variable in your
                   10041:                   <code class="filename">Makefile</code> with a
                   10042:                   list of all <code class=
                   10043:                   "filename">.entries</code> files installed by the
                   10044:                   package, if any. Names must not contain any
                   10045:                   directories in them.</p>
1.1       grant    10046:                 </li>
                   10047:               </ol>
                   10048:             </div>
                   10049:           </div>
                   10050: 
                   10051:           <div class="sect2" lang="en" xml:lang="en">
                   10052:             <div class="titlepage">
                   10053:               <div>
                   10054:                 <div>
1.23    ! wiz      10055:                   <h3 class="title"><a name="id2634763" id=
        !          10056:                   "id2634763"></a>12.5.12.&nbsp;Packages installing
1.1       grant    10057:                   scrollkeeper data files</h3>
                   10058:                 </div>
                   10059:               </div>
                   10060:             </div>
                   10061: 
1.14      xtraeme  10062:             <p>If a package installs <code class=
                   10063:             "filename">.omf</code> files, used by scrollkeeper, you
                   10064:             need to take some extra steps to make sure they get
                   10065:             registered in the database:</p>
1.1       grant    10066: 
                   10067:             <div class="orderedlist">
                   10068:               <ol type="1">
                   10069:                 <li>
1.14      xtraeme  10070:                   <p>Include <code class=
                   10071:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
                   10072:                   instead of its <code class=
                   10073:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    10074:                   care of rebuilding the scrollkeeper database at
                   10075:                   installation and deinstallation time, and
                   10076:                   disallows any access to it directly from the
                   10077:                   package.</p>
                   10078:                 </li>
                   10079: 
                   10080:                 <li>
                   10081:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10082:                   the <code class=
                   10083:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    10084:                   as they will be handled automatically.</p>
                   10085:                 </li>
                   10086: 
                   10087:                 <li>
1.14      xtraeme  10088:                   <p>Remove the <code class=
                   10089:                   "filename">share/omf</code> directory from the
                   10090:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    10091:                 </li>
                   10092:               </ol>
                   10093:             </div>
                   10094:           </div>
                   10095: 
                   10096:           <div class="sect2" lang="en" xml:lang="en">
                   10097:             <div class="titlepage">
                   10098:               <div>
                   10099:                 <div>
1.23    ! wiz      10100:                   <h3 class="title"><a name="id2634814" id=
        !          10101:                   "id2634814"></a>12.5.13.&nbsp;Packages installing
1.1       grant    10102:                   X11 fonts</h3>
                   10103:                 </div>
                   10104:               </div>
                   10105:             </div>
                   10106: 
                   10107:             <p>If a package installs font files, you will need to
                   10108:             rebuild the fonts database in the directory where they
                   10109:             get installed at installation and deinstallation time.
1.14      xtraeme  10110:             This can be automatically done by using <code class=
                   10111:             "filename">mk/fonts.mk</code>, which you need to
                   10112:             include in your <code class=
                   10113:             "filename">Makefile</code>.</p>
1.1       grant    10114: 
                   10115:             <p>When the file is included, you can list the
1.14      xtraeme  10116:             directories where fonts are installed in the
                   10117:             <code class="varname">FONTS_<em class=
                   10118:             "replaceable"><code>type</code></em>_DIRS</code>
                   10119:             variables, where <em class=
                   10120:             "replaceable"><code>type</code></em> can be one of
                   10121:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    10122:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   10123:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.14      xtraeme  10124:             sure that the database file <code class=
                   10125:             "filename">fonts.dir</code> is not listed in the
1.1       grant    10126:             PLIST.</p>
                   10127: 
                   10128:             <p>Note that you should not create new directories for
                   10129:             fonts; instead use the standard ones to avoid that the
                   10130:             user needs to manually configure his X server to find
                   10131:             them.</p>
                   10132:           </div>
                   10133: 
                   10134:           <div class="sect2" lang="en" xml:lang="en">
                   10135:             <div class="titlepage">
                   10136:               <div>
                   10137:                 <div>
1.23    ! wiz      10138:                   <h3 class="title"><a name="id2634861" id=
        !          10139:                   "id2634861"></a>12.5.14.&nbsp;Packages installing
1.1       grant    10140:                   GTK2 modules</h3>
                   10141:                 </div>
                   10142:               </div>
                   10143:             </div>
                   10144: 
                   10145:             <p>If a package installs gtk2 immodules or loaders, you
                   10146:             need to take some extra steps to get them registered in
                   10147:             the GTK2 database properly:</p>
                   10148: 
                   10149:             <div class="orderedlist">
                   10150:               <ol type="1">
                   10151:                 <li>
1.14      xtraeme  10152:                   <p>Include <code class=
                   10153:                   "filename">../../x11/gtk2/modules.mk</code>
                   10154:                   instead of its <code class=
                   10155:                   "filename">buildlink3.mk</code> file. This takes
                   10156:                   care of rebuilding the database at installation
                   10157:                   and deinstallation time.</p>
1.1       grant    10158:                 </li>
                   10159: 
                   10160:                 <li>
1.14      xtraeme  10161:                   <p>Set <code class=
                   10162:                   "varname">GTK2_IMMODULES=YES</code> if your
                   10163:                   package installs GTK2 immodules.</p>
1.1       grant    10164:                 </li>
                   10165: 
                   10166:                 <li>
1.14      xtraeme  10167:                   <p>Set <code class=
                   10168:                   "varname">GTK2_LOADERS=YES</code> if your package
                   10169:                   installs GTK2 loaders.</p>
1.1       grant    10170:                 </li>
                   10171: 
                   10172:                 <li>
                   10173:                   <p>Patch the package to not touch any of the gtk2
                   10174:                   databases directly. These are:</p>
                   10175: 
                   10176:                   <div class="itemizedlist">
                   10177:                     <ul type="disc">
                   10178:                       <li>
1.14      xtraeme  10179:                         <p><code class=
                   10180:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    10181:                       </li>
                   10182: 
                   10183:                       <li>
1.14      xtraeme  10184:                         <p><code class=
                   10185:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    10186:                       </li>
                   10187:                     </ul>
                   10188:                   </div>
                   10189:                 </li>
                   10190: 
                   10191:                 <li>
                   10192:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10193:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    10194:                   directory, as they will be handled
                   10195:                   automatically.</p>
                   10196:                 </li>
                   10197:               </ol>
                   10198:             </div>
                   10199:           </div>
                   10200: 
                   10201:           <div class="sect2" lang="en" xml:lang="en">
                   10202:             <div class="titlepage">
                   10203:               <div>
                   10204:                 <div>
1.23    ! wiz      10205:                   <h3 class="title"><a name="id2634931" id=
        !          10206:                   "id2634931"></a>12.5.15.&nbsp;Packages installing
1.1       grant    10207:                   SGML or XML data</h3>
                   10208:                 </div>
                   10209:               </div>
                   10210:             </div>
                   10211: 
                   10212:             <p>If a package installs SGML or XML data files that
                   10213:             need to be registered in system-wide catalogs (like
                   10214:             DTDs, sub-catalogs, etc.), you need to take some extra
                   10215:             steps:</p>
                   10216: 
                   10217:             <div class="orderedlist">
                   10218:               <ol type="1">
                   10219:                 <li>
1.14      xtraeme  10220:                   <p>Include <code class=
                   10221:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
                   10222:                   in your <code class="filename">Makefile</code>,
                   10223:                   which takes care of registering those files in
1.1       grant    10224:                   system-wide catalogs at installation and
                   10225:                   deinstallation time.</p>
                   10226:                 </li>
                   10227: 
                   10228:                 <li>
1.14      xtraeme  10229:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   10230:                   to the full path of any SGML catalogs installed
                   10231:                   by the package.</p>
1.1       grant    10232:                 </li>
                   10233: 
                   10234:                 <li>
1.14      xtraeme  10235:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   10236:                   to the full path of any XML catalogs installed by
1.1       grant    10237:                   the package.</p>
                   10238:                 </li>
                   10239: 
                   10240:                 <li>
1.14      xtraeme  10241:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   10242:                   to individual entries to be added to the SGML
1.1       grant    10243:                   catalog. These come in groups of three strings;
                   10244:                   see xmlcatmgr(1) for more information
                   10245:                   (specifically, arguments recognized by the 'add'
                   10246:                   action). Note that you will normally not use this
                   10247:                   variable.</p>
                   10248:                 </li>
                   10249: 
                   10250:                 <li>
1.14      xtraeme  10251:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   10252:                   to individual entries to be added to the XML
1.1       grant    10253:                   catalog. These come in groups of three strings;
                   10254:                   see xmlcatmgr(1) for more information
                   10255:                   (specifically, arguments recognized by the 'add'
                   10256:                   action). Note that you will normally not use this
                   10257:                   variable.</p>
                   10258:                 </li>
                   10259:               </ol>
                   10260:             </div>
                   10261:           </div>
                   10262: 
                   10263:           <div class="sect2" lang="en" xml:lang="en">
                   10264:             <div class="titlepage">
                   10265:               <div>
                   10266:                 <div>
1.23    ! wiz      10267:                   <h3 class="title"><a name="id2635051" id=
        !          10268:                   "id2635051"></a>12.5.16.&nbsp;Packages installing
1.1       grant    10269:                   extensions to the MIME database</h3>
                   10270:                 </div>
                   10271:               </div>
                   10272:             </div>
                   10273: 
                   10274:             <p>If a package provides extensions to the MIME
1.14      xtraeme  10275:             database by installing <code class=
                   10276:             "filename">.xml</code> files inside <code class=
                   10277:             "filename">${PREFIX}/share/mime/packages</code>, you
                   10278:             need to take some extra steps to ensure that the
                   10279:             database is kept consistent with respect to these new
                   10280:             files:</p>
1.1       grant    10281: 
                   10282:             <div class="orderedlist">
                   10283:               <ol type="1">
                   10284:                 <li>
1.14      xtraeme  10285:                   <p>Include <code class=
                   10286:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
                   10287:                   (avoid using the <code class=
                   10288:                   "filename">buildlink3.mk</code> file from this
                   10289:                   same directory, which is reserved for inclusion
                   10290:                   from other <code class=
                   10291:                   "filename">buildlink3.mk</code> files). It takes
                   10292:                   care of rebuilding the MIME database at
                   10293:                   installation and deinstallation time, and
                   10294:                   disallows any access to it directly from the
1.1       grant    10295:                   package.</p>
                   10296:                 </li>
                   10297: 
                   10298:                 <li>
                   10299:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10300:                   the <code class="filename">share/mime</code>
1.1       grant    10301:                   directory, <span class=
                   10302:                   "emphasis"><em>except</em></span> for files saved
1.14      xtraeme  10303:                   under <code class=
                   10304:                   "filename">share/mime/packages</code>. The former
1.1       grant    10305:                   are handled automatically by the
                   10306:                   update-mime-database program, but the later are
                   10307:                   package-dependent and must be removed by the
                   10308:                   package that installed them in the first
                   10309:                   place.</p>
                   10310:                 </li>
                   10311: 
                   10312:                 <li>
1.14      xtraeme  10313:                   <p>Remove any <code class=
                   10314:                   "filename">share/mime/*</code> directories from
                   10315:                   the PLIST. They will be handled by the
1.1       grant    10316:                   shared-mime-info package.</p>
                   10317:                 </li>
                   10318:               </ol>
                   10319:             </div>
                   10320:           </div>
                   10321: 
                   10322:           <div class="sect2" lang="en" xml:lang="en">
                   10323:             <div class="titlepage">
                   10324:               <div>
                   10325:                 <div>
1.23    ! wiz      10326:                   <h3 class="title"><a name="id2635190" id=
        !          10327:                   "id2635190"></a>12.5.17.&nbsp;Packages using
1.1       grant    10328:                   intltool</h3>
                   10329:                 </div>
                   10330:               </div>
                   10331:             </div>
                   10332: 
                   10333:             <p>If a package uses intltool during its build, include
1.14      xtraeme  10334:             the <code class=
                   10335:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    10336:             file, which forces it to use the intltool package
                   10337:             provided by pkgsrc, instead of the one bundled with the
                   10338:             distribution file.</p>
                   10339: 
                   10340:             <p>This tracks intltool's build-time dependencies and
                   10341:             uses the latest available version; this way, the
                   10342:             package benefits of any bug fixes that may have
                   10343:             appeared since it was released.</p>
                   10344:           </div>
1.18      xtraeme  10345: 
                   10346:           <div class="sect2" lang="en" xml:lang="en">
                   10347:             <div class="titlepage">
                   10348:               <div>
                   10349:                 <div>
1.23    ! wiz      10350:                   <h3 class="title"><a name="id2635204" id=
        !          10351:                   "id2635204"></a>12.5.18.&nbsp;Packages installing
1.18      xtraeme  10352:                   startup scripts</h3>
                   10353:                 </div>
                   10354:               </div>
                   10355:             </div>
                   10356: 
                   10357:             <p>If a package contains a rc.d script, it won't be
                   10358:             copied into the startup directory by default, but you
                   10359:             can enable it, by adding the option <code class=
                   10360:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
                   10361:             "filename">/etc/mk.conf</code>. This option will copy
                   10362:             the scripts into <code class=
                   10363:             "filename">/etc/rc.d</code> when a package is
                   10364:             installed, and it will automatically remove the scripts
                   10365:             when the package is deinstalled.</p>
                   10366:           </div>
1.1       grant    10367:         </div>
                   10368: 
                   10369:         <div class="sect1" lang="en" xml:lang="en">
                   10370:           <div class="titlepage">
                   10371:             <div>
                   10372:               <div>
                   10373:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      10374:                 "id2635225" id="id2635225"></a>12.6.&nbsp;Feedback
1.1       grant    10375:                 to the author</h2>
                   10376:               </div>
                   10377:             </div>
                   10378:           </div>
                   10379: 
                   10380:           <p>If you have found any bugs in the package you make
                   10381:           available, if you had to do special steps to make it run
                   10382:           under NetBSD or if you enhanced the software in various
                   10383:           other ways, be sure to report these changes back to the
                   10384:           original author of the program! With that kind of
                   10385:           support, the next release of the program can incorporate
                   10386:           these fixes, and people not using the NetBSD packages
                   10387:           system can win from your efforts.</p>
                   10388: 
                   10389:           <p>Support the idea of free software!</p>
                   10390:         </div>
                   10391:       </div>
                   10392: 
                   10393:       <div class="chapter" lang="en" xml:lang="en">
                   10394:         <div class="titlepage">
                   10395:           <div>
                   10396:             <div>
                   10397:               <h2 class="title"><a name="debug" id=
                   10398:               "debug"></a>Chapter&nbsp;13.&nbsp;Debugging</h2>
                   10399:             </div>
                   10400:           </div>
                   10401:         </div>
                   10402: 
                   10403:         <p>To check out all the gotchas when building a package,
                   10404:         here are the steps that I do in order to get a package
                   10405:         working. Please note this is basically the same as what was
                   10406:         explained in the previous sections, only with some
                   10407:         debugging aids.</p>
                   10408: 
                   10409:         <div class="itemizedlist">
                   10410:           <ul type="disc">
                   10411:             <li>
1.14      xtraeme  10412:               <p>Be sure to set <code class=
                   10413:               "varname">PKG_DEVELOPER=1</code> in <code class=
                   10414:               "filename">/etc/mk.conf</code></p>
1.1       grant    10415:             </li>
                   10416: 
                   10417:             <li>
                   10418:               <p>Install <a xmlns=
                   10419:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10420:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20      ben      10421:               class="pkgname">pkgtools/url2pkg</a>, create a
                   10422:               directory for a new package, change into it, then run
                   10423:               <span><strong class=
                   10424:               "command">url2pkg</strong></span>:</p>
1.1       grant    10425:               <pre class="screen">
1.14      xtraeme  10426: <code class="prompt">%</code> <strong class=
                   10427: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   10428: "replaceable"><code>category</code></em>/<em class=
                   10429: "replaceable"><code>examplepkg</code></em></code></strong>
                   10430: <code class="prompt">%</code> <strong class=
                   10431: "userinput"><code>cd /usr/pkgsrc/<em class=
                   10432: "replaceable"><code>category</code></em>/<em class=
                   10433: "replaceable"><code>examplepkg</code></em></code></strong>
                   10434: <code class="prompt">%</code> <strong class=
                   10435: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    10436: </pre>
                   10437:             </li>
                   10438: 
                   10439:             <li>
1.14      xtraeme  10440:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    10441:               requested.</p>
                   10442:             </li>
                   10443: 
                   10444:             <li>
1.14      xtraeme  10445:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    10446:               file</p>
                   10447:             </li>
                   10448: 
                   10449:             <li>
1.14      xtraeme  10450:               <p>Run <span><strong class="command">make
                   10451:               configure</strong></span></p>
1.1       grant    10452:             </li>
                   10453: 
                   10454:             <li>
                   10455:               <p>Add any dependencies glimpsed from documentation
1.14      xtraeme  10456:               and the configure step to the package's <code class=
                   10457:               "filename">Makefile</code>.</p>
1.1       grant    10458:             </li>
                   10459: 
                   10460:             <li>
                   10461:               <p>Make the package compile, doing multiple rounds
                   10462:               of</p>
                   10463:               <pre class="screen">
1.14      xtraeme  10464: <code class="prompt">%</code> <strong class=
                   10465: "userinput"><code>make</code></strong>
                   10466: <code class="prompt">%</code> <strong class=
                   10467: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   10468: <code class="prompt">%</code> <strong class=
                   10469: "userinput"><code>mkpatches</code></strong>
                   10470: <code class="prompt">%</code> <strong class=
                   10471: "userinput"><code>patchdiff</code></strong>
                   10472: <code class="prompt">%</code> <strong class=
                   10473: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   10474: <code class="prompt">%</code> <strong class=
                   10475: "userinput"><code>make mps</code></strong>
                   10476: <code class="prompt">%</code> <strong class=
                   10477: "userinput"><code>make clean</code></strong>
1.1       grant    10478: </pre>
                   10479: 
                   10480:               <p>Doing as non-root user will ensure that no files
                   10481:               are modified that shouldn't be, especially during the
1.14      xtraeme  10482:               build phase. <span><strong class=
                   10483:               "command">mkpatches</strong></span>,
                   10484:               <span><strong class=
                   10485:               "command">patchdiff</strong></span> and
                   10486:               <span><strong class="command">pkgvi</strong></span>
                   10487:               are from the <a xmlns=
1.1       grant    10488:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10489:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      10490:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    10491:             </li>
                   10492: 
                   10493:             <li>
1.14      xtraeme  10494:               <p>Look at the <code class=
                   10495:               "filename">Makefile</code>, fix if necessary; see
                   10496:               <a href="#components.Makefile" title=
                   10497:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
                   10498:               &#8220;<code class=
                   10499:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    10500:             </li>
                   10501: 
                   10502:             <li>
1.14      xtraeme  10503:               <p>Generate a <code class=
                   10504:               "filename">PLIST</code>:</p>
1.1       grant    10505:               <pre class="screen">
1.14      xtraeme  10506: <code class="prompt">#</code> <strong class=
                   10507: "userinput"><code>make install</code></strong>
                   10508: <code class="prompt">#</code> <strong class=
                   10509: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   10510: <code class="prompt">#</code> <strong class=
                   10511: "userinput"><code>make deinstall</code></strong>
                   10512: <code class="prompt">#</code> <strong class=
                   10513: "userinput"><code>make install</code></strong>
                   10514: <code class="prompt">#</code> <strong class=
                   10515: "userinput"><code>make deinstall</code></strong>
1.1       grant    10516: </pre>
                   10517: 
1.14      xtraeme  10518:               <p>You usually need to be <code class=
                   10519:               "username">root</code> to do this. Look if there are
1.1       grant    10520:               any files left:</p>
                   10521:               <pre class="screen">
1.14      xtraeme  10522: <code class="prompt">#</code> <strong class=
                   10523: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10524: </pre>
                   10525: 
                   10526:               <p>If this reveals any files that are missing in
1.14      xtraeme  10527:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    10528:             </li>
                   10529: 
                   10530:             <li>
1.14      xtraeme  10531:               <p>Now that the <code class="filename">PLIST</code>
                   10532:               is OK, install the package again and make a binary
1.1       grant    10533:               package:</p>
                   10534:               <pre class="screen">
1.14      xtraeme  10535: <code class="prompt">#</code> <strong class=
                   10536: "userinput"><code>make reinstall</code></strong>
                   10537: <code class="prompt">#</code> <strong class=
                   10538: "userinput"><code>make package</code></strong>
1.1       grant    10539: </pre>
                   10540:             </li>
                   10541: 
                   10542:             <li>
                   10543:               <p>Delete the installed package:</p>
                   10544:               <pre class="screen">
1.14      xtraeme  10545: <code class="prompt">#</code> <strong class=
                   10546: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    10547: </pre>
                   10548:             </li>
                   10549: 
                   10550:             <li>
1.14      xtraeme  10551:               <p>Repeat the above <span><strong class=
                   10552:               "command">make print-PLIST</strong></span> command,
                   10553:               which shouldn't find anything now:</p>
1.1       grant    10554:               <pre class="screen">
1.14      xtraeme  10555: <code class="prompt">#</code> <strong class=
                   10556: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10557: </pre>
                   10558:             </li>
                   10559: 
                   10560:             <li>
                   10561:               <p>Reinstall the binary package:</p>
                   10562:               <pre class="screen">
1.14      xtraeme  10563: <code class="prompt">#</code> <strong class=
                   10564: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    10565: </pre>
                   10566:             </li>
                   10567: 
                   10568:             <li>
                   10569:               <p>Play with it. Make sure everything works.</p>
                   10570:             </li>
                   10571: 
                   10572:             <li>
1.14      xtraeme  10573:               <p>Run <span><strong class=
                   10574:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    10575:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10576:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      10577:               class="pkgname">pkgtools/pkglint</a>, and fix the
                   10578:               problems it reports:</p>
1.1       grant    10579:               <pre class="screen">
1.14      xtraeme  10580: <code class="prompt">#</code> <strong class=
                   10581: "userinput"><code>pkglint</code></strong>
1.1       grant    10582: </pre>
                   10583:             </li>
                   10584: 
                   10585:             <li>
                   10586:               <p>Submit (or commit, if you have cvs access); see
                   10587:               <a href="#submit" title=
                   10588:               "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter&nbsp;14,
                   10589:               <i>Submitting and Committing</i></a>.</p>
                   10590:             </li>
                   10591:           </ul>
                   10592:         </div>
                   10593:       </div>
                   10594: 
                   10595:       <div class="chapter" lang="en" xml:lang="en">
                   10596:         <div class="titlepage">
                   10597:           <div>
                   10598:             <div>
                   10599:               <h2 class="title"><a name="submit" id=
                   10600:               "submit"></a>Chapter&nbsp;14.&nbsp;Submitting and
                   10601:               Committing</h2>
                   10602:             </div>
                   10603:           </div>
                   10604:         </div>
                   10605: 
                   10606:         <div class="toc">
                   10607:           <p><b>Table of Contents</b></p>
                   10608: 
                   10609:           <dl>
1.23    ! wiz      10610:             <dt><span class="sect1"><a href="#id2635824">14.1.
1.1       grant    10611:             Submitting your packages</a></span></dt>
                   10612: 
1.23    ! wiz      10613:             <dt><span class="sect1"><a href="#id2635875">14.2.
1.1       grant    10614:             Committing: Importing a package into
                   10615:             CVS</a></span></dt>
                   10616: 
1.23    ! wiz      10617:             <dt><span class="sect1"><a href="#id2635938">14.3.
1.2       hubertf  10618:             Updating a package to a newer version</a></span></dt>
1.1       grant    10619: 
1.23    ! wiz      10620:             <dt><span class="sect1"><a href="#id2635957">14.4.
1.2       hubertf  10621:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    10622:           </dl>
                   10623:         </div>
                   10624: 
                   10625:         <div class="sect1" lang="en" xml:lang="en">
                   10626:           <div class="titlepage">
                   10627:             <div>
                   10628:               <div>
                   10629:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      10630:                 "id2635824" id=
        !          10631:                 "id2635824"></a>14.1.&nbsp;Submitting your
1.1       grant    10632:                 packages</h2>
                   10633:               </div>
                   10634:             </div>
                   10635:           </div>
                   10636: 
                   10637:           <p>You have to separate between binary and
                   10638:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   10639:           packages here:</p>
                   10640: 
                   10641:           <div class="itemizedlist">
                   10642:             <ul type="disc">
                   10643:               <li>
                   10644:                 <p>precompiled binary packages</p>
                   10645: 
                   10646:                 <p>Our policy is that we accept binaries only from
                   10647:                 pkgsrc developers to guarantee that the packages
                   10648:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  10649:                 annoy anyone but rather to protect our users!
1.1       grant    10650:                 You're still free to put up your home-made binary
1.13      hubertf  10651:                 packages and tell the world where to get them.
                   10652:                 NetBSD developers doing bulk builds and wanting to
                   10653:                 upload them please see <a href="#bulk-upload"
                   10654:                 title="5.3.8.&nbsp;Uploading results of a bulk build">
                   10655:                 Section&nbsp;5.3.8, &#8220;Uploading results of a
                   10656:                 bulk build&#8221;</a>.</p>
1.1       grant    10657:               </li>
                   10658: 
                   10659:               <li>
                   10660:                 <p>packages</p>
                   10661: 
                   10662:                 <p>First, check that your package is complete,
                   10663:                 compiles and runs well; see <a href="#debug" title=
                   10664:                 "Chapter&nbsp;13.&nbsp;Debugging">Chapter&nbsp;13,
                   10665:                 <i>Debugging</i></a> and the rest of this document.
                   10666:                 Next, generate an uuencoded gzipped tar(1) archive,
                   10667:                 preferably with all files in a single directory.
1.14      xtraeme  10668:                 Finally, <span><strong class=
                   10669:                 "command">send-pr</strong></span> with category
1.1       grant    10670:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   10671:                 synopsis which includes the package name and
                   10672:                 version number, a short description of your package
                   10673:                 (contents of the COMMENT variable or DESCR file are
                   10674:                 OK) and attach the archive to your PR.</p>
                   10675: 
                   10676:                 <p>If you want to submit several packages, please
                   10677:                 send a separate PR for each one, it's easier for us
                   10678:                 to track things that way.</p>
                   10679: 
                   10680:                 <p>Alternatively, you can also import new packages
                   10681:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   10682:                 work-in-progress</span>&#8221;); see the homepage
                   10683:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   10684:                 target=
                   10685:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   10686:                 details.</p>
                   10687:               </li>
                   10688:             </ul>
                   10689:           </div>
                   10690:         </div>
                   10691: 
                   10692:         <div class="sect1" lang="en" xml:lang="en">
                   10693:           <div class="titlepage">
                   10694:             <div>
                   10695:               <div>
                   10696:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      10697:                 "id2635875" id=
        !          10698:                 "id2635875"></a>14.2.&nbsp;Committing: Importing a
1.1       grant    10699:                 package into CVS</h2>
                   10700:               </div>
                   10701:             </div>
                   10702:           </div>
                   10703: 
                   10704:           <p>This section is only of interest for pkgsrc developers
                   10705:           with write access to the pkgsrc repository. Please
                   10706:           remember that cvs imports files relative to the current
                   10707:           working directory, and that the pathname that you give
1.14      xtraeme  10708:           the <span><strong class="command">cvs
                   10709:           import</strong></span> command is so that it knows where
                   10710:           to place the files in the repository. Newly created
                   10711:           packages should be imported with a vendor tag of
                   10712:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   10713:           release tag of &#8220;<span class=
                   10714:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    10715:           <pre class="programlisting">
                   10716:   % cd .../pkgsrc/category/pkgname
                   10717:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   10718: </pre>
                   10719: 
                   10720:           <p>Remember to move the directory from which you imported
                   10721:           out of the way, or cvs will complain the next time you
                   10722:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   10723:           source tree. Also don't forget to add the new package to
1.14      xtraeme  10724:           the category's <code class=
                   10725:           "filename">Makefile</code>.</p>
1.1       grant    10726: 
                   10727:           <p>The commit message of the initial import should
1.14      xtraeme  10728:           include part of the <code class="filename">DESCR</code>
                   10729:           file, so people reading the mailing lists know what the
                   10730:           package is/does.</p>
1.1       grant    10731: 
                   10732:           <p>Please note all package updates/additions in
1.14      xtraeme  10733:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
                   10734:           very important to keep this file up to date and
                   10735:           conforming to the existing format, because it will be
                   10736:           used by scripts to automatically update pages on <a href=
1.1       grant    10737:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   10738:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   10739:           file and remove the entry for the package you updated, in
                   10740:           case it was mentioned there.</p>
                   10741: 
                   10742:           <p>For new packages, &#8220;<span class="quote">cvs
                   10743:           import</span>&#8221; is preferred to &#8220;<span class=
                   10744:           "quote">cvs add</span>&#8221; because the former gets
                   10745:           everything with a single command, and provides a
                   10746:           consistent tag.</p>
                   10747:         </div>
                   10748: 
                   10749:         <div class="sect1" lang="en" xml:lang="en">
                   10750:           <div class="titlepage">
                   10751:             <div>
                   10752:               <div>
                   10753:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      10754:                 "id2635938" id="id2635938"></a>14.3.&nbsp;Updating
1.2       hubertf  10755:                 a package to a newer version</h2>
1.1       grant    10756:               </div>
                   10757:             </div>
                   10758:           </div>
                   10759: 
                   10760:           <p>Please always put a concise, appropriate and relevant
                   10761:           summary of the changes between old and new versions into
                   10762:           the commit log when updating a package. There are various
                   10763:           reasons for this:</p>
                   10764: 
                   10765:           <div class="itemizedlist">
                   10766:             <ul type="disc">
                   10767:               <li>
                   10768:                 <p>A URL is volatile, and can change over time. It
                   10769:                 may go away completely or its information may be
                   10770:                 overwritten by newer information.</p>
                   10771:               </li>
                   10772: 
                   10773:               <li>
                   10774:                 <p>Having the change information between old and
                   10775:                 new versions in our CVS repository is very useful
                   10776:                 for people who use either cvs or anoncvs.</p>
                   10777:               </li>
                   10778: 
                   10779:               <li>
                   10780:                 <p>Having the change information between old and
                   10781:                 new versions in our CVS repository is very useful
                   10782:                 for people who read the pkgsrc-changes mailing
                   10783:                 list, so that they can make tactical decisions
                   10784:                 about when to upgrade the package.</p>
                   10785:               </li>
                   10786:             </ul>
                   10787:           </div>
                   10788: 
1.18      xtraeme  10789:           <p>Please also recognize that, just because a new version
1.1       grant    10790:           of a package has been released, it should not
                   10791:           automatically be upgraded in the CVS repository. We
                   10792:           prefer to be conservative in the packages that are
                   10793:           included in pkgsrc - development or beta packages are not
                   10794:           really the best thing for most places in which pkgsrc is
                   10795:           used. Please use your judgement about what should go into
                   10796:           pkgsrc, and bear in mind that stability is to be
                   10797:           preferred above new and possibly untested features.</p>
                   10798:         </div>
                   10799: 
                   10800:         <div class="sect1" lang="en" xml:lang="en">
                   10801:           <div class="titlepage">
                   10802:             <div>
                   10803:               <div>
                   10804:                 <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      10805:                 "id2635957" id="id2635957"></a>14.4.&nbsp;Moving a
1.2       hubertf  10806:                 package in pkgsrc</h2>
1.1       grant    10807:               </div>
                   10808:             </div>
                   10809:           </div>
                   10810: 
                   10811:           <div class="orderedlist">
                   10812:             <ol type="1">
                   10813:               <li>
                   10814:                 <p>Make a copy of the directory somewhere else.</p>
                   10815:               </li>
                   10816: 
                   10817:               <li>
                   10818:                 <p>Remove all CVS dirs.</p>
                   10819: 
                   10820:                 <p>Alternatively to the first two steps you can
                   10821:                 also do:</p>
                   10822:                 <pre class="screen">
1.14      xtraeme  10823: <code class="prompt">%</code> <strong class=
                   10824: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    10825: </pre>
                   10826: 
                   10827:                 <p>and use that for further work.</p>
                   10828:               </li>
                   10829: 
                   10830:               <li>
1.14      xtraeme  10831:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   10832:                 any <code class="varname">DEPENDS</code> paths that
                   10833:                 just did &#8220;<span class=
1.1       grant    10834:                 "quote">../package</span>&#8221; instead of
                   10835:                 &#8220;<span class=
                   10836:                 "quote">../../category/package</span>&#8221;.</p>
                   10837:               </li>
                   10838: 
                   10839:               <li>
1.14      xtraeme  10840:                 <p><span><strong class="command">cvs
                   10841:                 import</strong></span> the modified package in the
                   10842:                 new place.</p>
1.1       grant    10843:               </li>
                   10844: 
                   10845:               <li>
                   10846:                 <p>Check if any package depends on it:</p>
                   10847:                 <pre class="screen">
1.14      xtraeme  10848: <code class="prompt">%</code> <strong class=
                   10849: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   10850: <code class="prompt">%</code> <strong class=
                   10851: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    10852: </pre>
                   10853:               </li>
                   10854: 
                   10855:               <li>
                   10856:                 <p>Fix paths in packages from step 5 to point to
                   10857:                 new location.</p>
                   10858:               </li>
                   10859: 
                   10860:               <li>
1.14      xtraeme  10861:                 <p><span><strong class="command">cvs rm
                   10862:                 (-f)</strong></span> the package at the old
                   10863:                 location.</p>
1.1       grant    10864:               </li>
                   10865: 
                   10866:               <li>
1.14      xtraeme  10867:                 <p>Remove from <code class=
                   10868:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    10869:               </li>
                   10870: 
                   10871:               <li>
1.14      xtraeme  10872:                 <p>Add to <code class=
                   10873:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    10874:               </li>
                   10875: 
                   10876:               <li>
                   10877:                 <p>Commit the changed and removed files:</p>
                   10878:                 <pre class="screen">
1.14      xtraeme  10879: <code class="prompt">%</code> <strong class=
                   10880: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    10881: </pre>
                   10882: 
                   10883:                 <p>(and any packages from step 5, of course).</p>
                   10884:               </li>
                   10885:             </ol>
                   10886:           </div>
                   10887:         </div>
                   10888:       </div>
                   10889:     </div>
                   10890: 
                   10891:     <div class="appendix" lang="en" xml:lang="en">
                   10892:       <div class="titlepage">
                   10893:         <div>
                   10894:           <div>
                   10895:             <h2 class="title"><a name="examples" id=
                   10896:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   10897:             package: bison</h2>
                   10898:           </div>
                   10899:         </div>
                   10900:       </div>
                   10901: 
                   10902:       <div class="toc">
                   10903:         <p><b>Table of Contents</b></p>
                   10904: 
                   10905:         <dl>
1.23    ! wiz      10906:           <dt><span class="sect1"><a href="#id2636183">A.1.
1.1       grant    10907:           files</a></span></dt>
                   10908: 
                   10909:           <dd>
                   10910:             <dl>
1.23    ! wiz      10911:               <dt><span class="sect2"><a href="#id2636186">A.1.1.
1.1       grant    10912:               Makefile</a></span></dt>
                   10913: 
1.23    ! wiz      10914:               <dt><span class="sect2"><a href="#id2636194">A.1.2.
1.1       grant    10915:               DESCR</a></span></dt>
                   10916: 
1.23    ! wiz      10917:               <dt><span class="sect2"><a href="#id2636209">A.1.3.
1.1       grant    10918:               PLIST</a></span></dt>
                   10919: 
1.23    ! wiz      10920:               <dt><span class="sect2"><a href="#id2636216">A.1.4.
1.14      xtraeme  10921:               Checking a package with <span><strong class=
                   10922:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    10923:             </dl>
                   10924:           </dd>
                   10925: 
1.23    ! wiz      10926:           <dt><span class="sect1"><a href="#id2636257">A.2. Steps
1.1       grant    10927:           for building, installing, packaging</a></span></dt>
                   10928:         </dl>
                   10929:       </div>
                   10930: 
                   10931:       <p>We checked to find a piece of software that wasn't in the
                   10932:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  10933:       would want to have <span><strong class=
                   10934:       "command">bison</strong></span> when Berkeley
                   10935:       <span><strong class="command">yacc</strong></span> is already
                   10936:       present in the tree is beyond us, but it's useful for the
                   10937:       purposes of this exercise.</p>
1.1       grant    10938: 
                   10939:       <div class="sect1" lang="en" xml:lang="en">
                   10940:         <div class="titlepage">
                   10941:           <div>
                   10942:             <div>
                   10943:               <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      10944:               "id2636183" id="id2636183"></a>A.1.&nbsp;files</h2>
1.1       grant    10945:             </div>
                   10946:           </div>
                   10947:         </div>
                   10948: 
                   10949:         <div class="sect2" lang="en" xml:lang="en">
                   10950:           <div class="titlepage">
                   10951:             <div>
                   10952:               <div>
1.23    ! wiz      10953:                 <h3 class="title"><a name="id2636186" id=
        !          10954:                 "id2636186"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    10955:               </div>
                   10956:             </div>
                   10957:           </div>
                   10958:           <pre class="programlisting">
1.17      sketch   10959: # $NetBSD$
1.1       grant    10960: #
                   10961: 
                   10962: DISTNAME=       bison-1.25
                   10963: CATEGORIES=     devel
                   10964: MASTER_SITES=   ${MASTER_SITE_GNU}
                   10965: 
                   10966: MAINTAINER=     thorpej@NetBSD.org
                   10967: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   10968: COMMENT=        GNU yacc clone
                   10969: 
                   10970: GNU_CONFIGURE=  yes
                   10971: INFO_FILES=     bison.info
                   10972: 
                   10973: .include "../../mk/bsd.pkg.mk"
                   10974: </pre>
                   10975:         </div>
                   10976: 
                   10977:         <div class="sect2" lang="en" xml:lang="en">
                   10978:           <div class="titlepage">
                   10979:             <div>
                   10980:               <div>
1.23    ! wiz      10981:                 <h3 class="title"><a name="id2636194" id=
        !          10982:                 "id2636194"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    10983:               </div>
                   10984:             </div>
                   10985:           </div>
                   10986:           <pre class="programlisting">
                   10987: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   10988: improvements.  Why you would want this when Berkeley <a href=
                   10989: "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
                   10990: of the NetBSD source tree is beyond me.
                   10991: </pre>
                   10992:         </div>
                   10993: 
                   10994:         <div class="sect2" lang="en" xml:lang="en">
                   10995:           <div class="titlepage">
                   10996:             <div>
                   10997:               <div>
1.23    ! wiz      10998:                 <h3 class="title"><a name="id2636209" id=
        !          10999:                 "id2636209"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    11000:               </div>
                   11001:             </div>
                   11002:           </div>
                   11003:           <pre class="programlisting">
1.17      sketch   11004: @comment $NetBSD$
1.1       grant    11005: bin/bison
                   11006: man/man1/bison.1.gz
                   11007: share/bison.simple
                   11008: share/bison.hairy
                   11009: </pre>
                   11010:         </div>
                   11011: 
                   11012:         <div class="sect2" lang="en" xml:lang="en">
                   11013:           <div class="titlepage">
                   11014:             <div>
                   11015:               <div>
1.23    ! wiz      11016:                 <h3 class="title"><a name="id2636216" id=
        !          11017:                 "id2636216"></a>A.1.4.&nbsp;Checking a package with
1.14      xtraeme  11018:                 <span><strong class=
                   11019:                 "command">pkglint</strong></span></h3>
1.1       grant    11020:               </div>
                   11021:             </div>
                   11022:           </div>
                   11023: 
                   11024:           <p>The NetBSD package system comes with <a xmlns=
                   11025:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   11026:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      11027:           class="pkgname">pkgtools/pkglint</a> which helps to check
                   11028:           the contents of these files. After installation it is
                   11029:           quite easy to use, just change to the directory of the
                   11030:           package you wish to examine and execute
                   11031:           <span><strong class=
                   11032:           "command">pkglint</strong></span>:</p>
1.1       grant    11033:           <pre class="screen">
1.14      xtraeme  11034: <code class="prompt">$</code> <strong class=
                   11035: "userinput"><code>pkglint</code></strong>
1.1       grant    11036: OK: checking ./DESCR.
                   11037: OK: checking Makefile.
                   11038: OK: checking distinfo.
                   11039: OK: checking patches/patch-aa.
                   11040: looks fine.
                   11041: </pre>
                   11042: 
                   11043:           <p>Depending on the supplied command line arguments (see
                   11044:           pkglint(1)) more verbose checks will be performed. Use
1.14      xtraeme  11045:           e.g. <span><strong class="command">pkglint
                   11046:           -v</strong></span> for a very verbose check.</p>
1.1       grant    11047:         </div>
                   11048:       </div>
                   11049: 
                   11050:       <div class="sect1" lang="en" xml:lang="en">
                   11051:         <div class="titlepage">
                   11052:           <div>
                   11053:             <div>
                   11054:               <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      11055:               "id2636257" id="id2636257"></a>A.2.&nbsp;Steps for
1.1       grant    11056:               building, installing, packaging</h2>
                   11057:             </div>
                   11058:           </div>
                   11059:         </div>
                   11060: 
                   11061:         <p>Create the directory where the package lives, plus any
                   11062:         auxiliary directories:</p>
                   11063:         <pre class="screen">
1.14      xtraeme  11064: <code class="prompt">#</code> <strong class=
                   11065: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   11066: <code class="prompt">#</code> <strong class=
                   11067: "userinput"><code>mkdir bison</code></strong>
                   11068: <code class="prompt">#</code> <strong class=
                   11069: "userinput"><code>cd bison</code></strong>
                   11070: <code class="prompt">#</code> <strong class=
                   11071: "userinput"><code>mkdir patches</code></strong>
1.1       grant    11072: </pre>
                   11073: 
1.14      xtraeme  11074:         <p>Create <code class="filename">Makefile</code>,
                   11075:         <code class="filename">DESCR</code> and <code class=
                   11076:         "filename">PLIST</code> (see <a href="#components" title=
1.1       grant    11077:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   11078:         Chapter 7, <i>Package components - files, directories and
                   11079:         contents</i></a>) then continue with fetching the
                   11080:         distfile:</p>
                   11081:         <pre class="screen">
1.14      xtraeme  11082: <code class="prompt">#</code> <strong class=
                   11083: "userinput"><code>make fetch</code></strong>
1.1       grant    11084: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   11085: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   11086: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11087: ftp: Error retrieving file: 500 Internal error
                   11088: 
                   11089: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   11090: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11091: ftp: Error retrieving file: 500 Internal error
                   11092: 
                   11093: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   11094: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11095: Successfully retrieved file.
                   11096: </pre>
                   11097: 
1.14      xtraeme  11098:         <p>Generate the checksum of the distfile into <code class=
                   11099:         "filename">distinfo</code>:</p>
1.1       grant    11100:         <pre class="screen">
1.14      xtraeme  11101: <code class="prompt">#</code> <strong class=
                   11102: "userinput"><code>make makesum</code></strong>
1.1       grant    11103: </pre>
                   11104: 
                   11105:         <p>Now compile:</p>
                   11106:         <pre class="screen">
1.14      xtraeme  11107: <code class="prompt">#</code> <strong class=
                   11108: "userinput"><code>make</code></strong>
1.1       grant    11109: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11110: ===&gt;  Extracting for bison-1.25
                   11111: ===&gt;  Patching for bison-1.25
                   11112: ===&gt;   Ignoring empty patch directory
                   11113: ===&gt;  Configuring for bison-1.25
                   11114: creating cache ./config.cache
                   11115: checking for gcc... cc
                   11116: checking whether we are using GNU C... yes
                   11117: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   11118: checking how to run the C preprocessor... cc -E
                   11119: checking for minix/config.h... no
                   11120: checking for POSIXized ISC... no
                   11121: checking whether cross-compiling... no
                   11122: checking for ANSI C header files... yes
                   11123: checking for string.h... yes
                   11124: checking for stdlib.h... yes
                   11125: checking for memory.h... yes
                   11126: checking for working const... yes
                   11127: checking for working alloca.h... no
                   11128: checking for alloca... yes
                   11129: checking for strerror... yes
                   11130: updating cache ./config.cache
                   11131: creating ./config.status
                   11132: creating Makefile
                   11133: ===&gt;  Building for bison-1.25
                   11134: 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
                   11135: 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
                   11136: 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
                   11137: 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
                   11138: 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
                   11139: 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 
                   11140: 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
                   11141: 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
                   11142: 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
                   11143: 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
                   11144: 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
                   11145: 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
                   11146: 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
                   11147: 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
                   11148: 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
                   11149: 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
                   11150: 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
                   11151: 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
                   11152: 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
                   11153: 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
                   11154: 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
                   11155: 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
                   11156: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   11157: rm -f bison.s1
                   11158: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   11159: </pre>
                   11160: 
                   11161:         <p>Everything seems OK, so install the files:</p>
                   11162:         <pre class="screen">
1.14      xtraeme  11163: <code class="prompt">#</code> <strong class=
                   11164: "userinput"><code>make install</code></strong>
1.1       grant    11165: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11166: ===&gt;  Installing for bison-1.25
                   11167: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   11168: rm -f /usr/pkg/bin/bison
                   11169: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   11170: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   11171: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   11172: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   11173: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   11174: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   11175: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   11176: ===&gt;  Registering installation for bison-1.25
                   11177: </pre>
                   11178: 
                   11179:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  11180:         remove it with <span><strong class="command">pkg_delete
                   11181:         bison</strong></span>. Should you decide that you want a
                   11182:         binary package, do this now:</p>
1.1       grant    11183:         <pre class="screen">
1.14      xtraeme  11184: <code class="prompt">#</code> <strong class=
                   11185: "userinput"><code>make package</code></strong>
1.1       grant    11186: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11187: ===&gt;  Building package for bison-1.25
                   11188: Creating package bison-1.25.tgz
                   11189: Registering depends:.
                   11190: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   11191: </pre>
                   11192: 
                   11193:         <p>Now that you don't need the source and object files any
                   11194:         more, clean up:</p>
                   11195:         <pre class="screen">
1.14      xtraeme  11196: <code class="prompt">#</code> <strong class=
                   11197: "userinput"><code>make clean</code></strong>
1.1       grant    11198: ===&gt;  Cleaning for bison-1.25
                   11199: </pre>
                   11200:       </div>
                   11201:     </div>
                   11202: 
                   11203:     <div class="appendix" lang="en" xml:lang="en">
                   11204:       <div class="titlepage">
                   11205:         <div>
                   11206:           <div>
                   11207:             <h2 class="title"><a name="logs" id=
                   11208:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   11209:           </div>
                   11210:         </div>
                   11211:       </div>
                   11212: 
                   11213:       <div class="toc">
                   11214:         <p><b>Table of Contents</b></p>
                   11215: 
                   11216:         <dl>
                   11217:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   11218:           Building figlet</a></span></dt>
                   11219: 
                   11220:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   11221:           Packaging figlet</a></span></dt>
                   11222:         </dl>
                   11223:       </div>
                   11224: 
                   11225:       <div class="sect1" lang="en" xml:lang="en">
                   11226:         <div class="titlepage">
                   11227:           <div>
                   11228:             <div>
                   11229:               <h2 class="title" style="clear: both"><a name=
                   11230:               "logs.building" id=
                   11231:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   11232:             </div>
                   11233:           </div>
                   11234:         </div>
                   11235:         <pre class="screen">
1.14      xtraeme  11236: <code class="prompt">#</code> <strong class=
                   11237: "userinput"><code>make</code></strong>
1.1       grant    11238: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11239: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   11240: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   11241: =&gt; [172219 bytes]
                   11242: Connected to ftp.plig.net.
                   11243: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   11244: 331 Guest login ok, send your complete e-mail address as password.
                   11245: 230-You are user #5 of 500 simultaneous users allowed.
                   11246: 230-
                   11247: 230-  ___ _             _ _                   
                   11248: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   11249: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   11250: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   11251: 230-         |_|   |_|     |___|         |___|
                   11252: 230-
                   11253: 230-** Welcome to ftp.plig.org **
                   11254: 230-
                   11255: 230-Please note that all transfers from this FTP site are logged. If you
                   11256: 230-do not like this, please disconnect now.
                   11257: 230-
                   11258: 230-This arhive is available via
                   11259: 230-
                   11260: 230-HTTP:  http://ftp.plig.org/
                   11261: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   11262: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   11263: 230-
                   11264: 230-Please email comments, bug reports and requests for packages to be
                   11265: 230-mirrored to ftp-admin@plig.org.   
                   11266: 230-
                   11267: 230-
                   11268: 230 Logged in anonymously.
                   11269: Remote system type is UNIX.
                   11270: Using binary mode to transfer files.
                   11271: 200 Type okay.
                   11272: 250 "/pub" is new cwd.
                   11273: 250-"/pub/figlet" is new cwd.
                   11274: 250-
                   11275: 250-Welcome to the figlet archive at ftp.figlet.org
                   11276: 250-    
                   11277: 250-    ftp://ftp.figlet.org/pub/figlet/
                   11278: 250-
                   11279: 250-The official FIGlet web page is:
                   11280: 250-    http://www.figlet.org/
                   11281: 250-
                   11282: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   11283: 250-contribute a font or something else, you can email us.
                   11284: 250 
                   11285: 250 "/pub/figlet/program" is new cwd.
                   11286: 250 "/pub/figlet/program/unix" is new cwd.
                   11287: local: figlet221.tar.gz remote: figlet221.tar.gz
                   11288: 502 Unimplemented command.
                   11289: 227 Entering Passive Mode (195,40,6,41,246,104)
                   11290: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   11291: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   11292: 226 Transfer completed.
                   11293: 172219 bytes received in 00:02 (75.99 KB/s)
                   11294: 221 Goodbye.
                   11295: =&gt; Checksum OK for figlet221.tar.gz.
                   11296: ===&gt; Extracting for figlet-2.2.1nb2
                   11297: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   11298: ===&gt; Patching for figlet-2.2.1nb2
                   11299: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   11300: ===&gt; Overriding tools for figlet-2.2.1nb2
                   11301: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   11302: ===&gt; Configuring for figlet-2.2.1nb2
                   11303: ===&gt; Building for figlet-2.2.1nb2
                   11304: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   11305: chmod a+x figlet
                   11306: gcc -O2 -o chkfont chkfont.c
                   11307: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  11308: <code class="prompt">#</code>
                   11309: <code class="prompt">#</code> <strong class=
                   11310: "userinput"><code>make install</code></strong>
1.1       grant    11311: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11312: ===&gt; Installing for figlet-2.2.1nb2
                   11313: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   11314: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   11315: mkdir -p /usr/pkg/share/figlet
                   11316: cp figlet /usr/pkg/bin
                   11317: cp chkfont /usr/pkg/bin
                   11318: chmod 555 figlist showfigfonts
                   11319: cp figlist /usr/pkg/bin
                   11320: cp showfigfonts /usr/pkg/bin
                   11321: cp fonts/*.flf /usr/pkg/share/figlet
                   11322: cp fonts/*.flc /usr/pkg/share/figlet
                   11323: cp figlet.6 /usr/pkg/man/man6
                   11324: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  11325: <code class="prompt">#</code>
1.1       grant    11326: </pre>
                   11327:       </div>
                   11328: 
                   11329:       <div class="sect1" lang="en" xml:lang="en">
                   11330:         <div class="titlepage">
                   11331:           <div>
                   11332:             <div>
                   11333:               <h2 class="title" style="clear: both"><a name=
                   11334:               "logs.package" id=
                   11335:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   11336:             </div>
                   11337:           </div>
                   11338:         </div>
                   11339:         <pre class="screen">
1.14      xtraeme  11340: <code class="prompt">#</code> <strong class=
                   11341: "userinput"><code>make package</code></strong>
1.1       grant    11342: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11343: ===&gt; Packaging figlet-2.2.1nb2
                   11344: ===&gt; Building binary package for figlet-2.2.1nb2
                   11345: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   11346: Using SrcDir value of /usr/pkg
                   11347: Registering depends:.  
1.14      xtraeme  11348: <code class="prompt">#</code>
1.1       grant    11349: </pre>
                   11350:       </div>
                   11351:     </div>
                   11352: 
                   11353:     <div class="appendix" lang="en" xml:lang="en">
                   11354:       <div class="titlepage">
                   11355:         <div>
                   11356:           <div>
                   11357:             <h2 class="title"><a name="ftp-layout" id=
                   11358:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   11359:             FTP server's package archive</h2>
                   11360:           </div>
                   11361:         </div>
                   11362:       </div>
                   11363: 
                   11364:       <p>Layout for precompiled binary packages on
                   11365:       ftp.NetBSD.org:</p>
                   11366:       <pre class="programlisting">
                   11367: /pub/NetBSD/packages/
                   11368:                 distfiles/
                   11369: 
                   11370:                 # Unpacked pkgsrc trees
                   11371:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   11372:                 pkgsrc-2003Q4 -&gt; N/A
                   11373:                 pkgsrc-2004Q1/pkgsrc
                   11374: 
                   11375:                 # pkgsrc archives
                   11376:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   11377:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   11378:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   11379: 
                   11380:                 # Per pkgsrc-release/OS-release/arch package archives
                   11381:                 pkgsrc-2003Q4/
                   11382:                         NetBSD-1.6.2/
                   11383:                                 i386/
                   11384:                                         All/
                   11385:                                         archivers/
                   11386:                                                 foo -&gt; ../All/foo
                   11387:                                         ...
                   11388:                 pkgsrc-2004Q1/
                   11389:                         NetBSD-1.6.2/
                   11390:                                 i386/
                   11391:                                         All/
                   11392:                                         ...
                   11393:                         NetBSD-2.0/
                   11394:                                 i386/
                   11395:                                         All/
                   11396:                                         ...
                   11397:                         SunOS-5.9/
                   11398:                                 sparc/
                   11399:                                         All/
                   11400:                                         ...
                   11401:                                 x86/
                   11402:                                         All/
                   11403:                                         ...
                   11404: 
                   11405:                 # Per os-release package archive convenience links
                   11406:                 NetBSD-1.6.2 -&gt; 1.6.2
                   11407:                 1.6.2/
                   11408:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   11409:                         m68k/
                   11410:                                 All/
                   11411:                                 archivers/
                   11412:                                         foo -&gt; ../All/foo
                   11413:                                 ...
                   11414:                         amiga -&gt; m68k
                   11415:                         atari -&gt; m68k
                   11416:                         ...
                   11417: 
                   11418:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   11419:                 NetBSD-2.0/
                   11420:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   11421:                 SunOS-5.9/
                   11422:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   11423:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   11424:                         
                   11425: </pre>
                   11426: 
                   11427:       <p>To create:</p>
                   11428: 
                   11429:       <div class="orderedlist">
                   11430:         <ol type="1">
                   11431:           <li>
                   11432:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   11433:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   11434:             5.3, &#8220;Doing a bulk build of all
                   11435:             packages&#8221;</a></p>
                   11436:           </li>
                   11437: 
                   11438:           <li>
                   11439:             <p>Upload /usr/pkgsrc/packages to</p>
                   11440:             <pre class="programlisting">
                   11441:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  11442:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    11443:         `uname -s`-`uname -r`/                  # OS &amp; version
                   11444:         `uname -p`                              # architecture
                   11445:        
                   11446: </pre>
                   11447:           </li>
                   11448: 
                   11449:           <li>
1.14      xtraeme  11450:             <p>If necessary, create a symlink <span><strong class=
                   11451:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   11452:             (amiga -&gt; m68k, ...)</p>
1.1       grant    11453:           </li>
                   11454:         </ol>
                   11455:       </div>
                   11456:     </div>
1.2       hubertf  11457: 
                   11458:     <div class="appendix" lang="en" xml:lang="en">
                   11459:       <div class="titlepage">
                   11460:         <div>
                   11461:           <div>
                   11462:             <h2 class="title"><a name="editing" id=
                   11463:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   11464:             for the pkgsrc guide</h2>
                   11465:           </div>
                   11466:         </div>
                   11467:       </div>
                   11468: 
                   11469:       <div class="toc">
                   11470:         <p><b>Table of Contents</b></p>
                   11471: 
                   11472:         <dl>
1.23    ! wiz      11473:           <dt><span class="sect1"><a href="#id2637176">D.1.
1.2       hubertf  11474:           Targets</a></span></dt>
                   11475: 
1.23    ! wiz      11476:           <dt><span class="sect1"><a href="#id2637378">D.2.
1.2       hubertf  11477:           Procedure</a></span></dt>
                   11478:         </dl>
                   11479:       </div>
                   11480: 
                   11481:       <p>This section contains information on editing the pkgsrc
                   11482:       guide itself.</p>
                   11483: 
                   11484:       <div class="sect1" lang="en" xml:lang="en">
                   11485:         <div class="titlepage">
                   11486:           <div>
                   11487:             <div>
                   11488:               <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      11489:               "id2637176" id="id2637176"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  11490:             </div>
                   11491:           </div>
                   11492:         </div>
                   11493: 
1.14      xtraeme  11494:         <p>The pkgsrc guide's source code is stored in <code class=
                   11495:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  11496:         are created from it:</p>
                   11497: 
                   11498:         <div class="itemizedlist">
                   11499:           <ul type="disc">
                   11500:             <li>
1.14      xtraeme  11501:               <p><code class=
1.23    ! wiz      11502:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  11503:             </li>
                   11504: 
                   11505:             <li>
1.14      xtraeme  11506:               <p><code class=
                   11507:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  11508:             </li>
                   11509: 
                   11510:             <li>
1.14      xtraeme  11511:               <p><code class=
                   11512:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  11513:               the documentation on the NetBSD website will be built
                   11514:               from pkgsrc and kept up to date on the web server
                   11515:               itself. This means you <span class=
                   11516:               "emphasis"><em>must</em></span> make sure that your
                   11517:               changes haven't broken the build!</p>
                   11518:             </li>
1.6       hubertf  11519: 
                   11520:             <li>
1.14      xtraeme  11521:               <p><code class=
                   11522:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  11523:               PDF version of the pkgsrc guide.</p>
                   11524:             </li>
                   11525: 
                   11526:             <li>
1.14      xtraeme  11527:               <p><code class=
                   11528:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  11529:               PostScript version of the pkgsrc guide.</p>
                   11530:             </li>
1.2       hubertf  11531:           </ul>
                   11532:         </div>
                   11533:       </div>
                   11534: 
                   11535:       <div class="sect1" lang="en" xml:lang="en">
                   11536:         <div class="titlepage">
                   11537:           <div>
                   11538:             <div>
                   11539:               <h2 class="title" style="clear: both"><a name=
1.23    ! wiz      11540:               "id2637378" id=
        !          11541:               "id2637378"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  11542:             </div>
                   11543:           </div>
                   11544:         </div>
                   11545: 
                   11546:         <p>The procedure to edit the pkgsrc guide is:</p>
                   11547: 
                   11548:         <div class="itemizedlist">
                   11549:           <ul type="disc">
                   11550:             <li>
1.6       hubertf  11551:               <p>Make sure you have the packages needed to
                   11552:               re-generate the pkgsrc guide (and other XML-based
                   11553:               NetBSD documentation) installed. These are
1.11      ben      11554:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  11555:               for creating the ASCII- and HTML-version, and
                   11556:               &#8220;<span class=
1.11      ben      11557:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  11558:               PostScript- and PDF version. You will need both
                   11559:               packages installed, to make sure documentation is
                   11560:               consistent across all formats. The packages can be
1.14      xtraeme  11561:               found in <code class=
                   11562:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
                   11563:               <code class=
                   11564:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  11565:             </li>
                   11566: 
                   11567:             <li>
1.14      xtraeme  11568:               <p>Edit the XML file(s) in <code class=
                   11569:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  11570:             </li>
                   11571: 
                   11572:             <li>
1.14      xtraeme  11573:               <p>Run <span><strong class="command">make extract
                   11574:               &amp;&amp; make do-lint</strong></span> in
                   11575:               <code class="filename">pkgsrc/doc/guide</code> to
                   11576:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  11577:             </li>
                   11578: 
                   11579:             <li>
1.14      xtraeme  11580:               <p>Run <span><strong class=
                   11581:               "command">make</strong></span> in <code class=
                   11582:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   11583:               and ASCII version.</p>
1.2       hubertf  11584:             </li>
                   11585: 
                   11586:             <li>
1.14      xtraeme  11587:               <p>If all is well, run <span><strong class=
                   11588:               "command">make install-doc</strong></span> to put the
                   11589:               generated files into <code class=
                   11590:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  11591:             </li>
                   11592: 
                   11593:             <li>
1.14      xtraeme  11594:               <p><span><strong class="command">cvs commit
                   11595:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  11596:             </li>
                   11597: 
                   11598:             <li>
1.14      xtraeme  11599:               <p><span><strong class="command">cvs commit -m
                   11600:               re-generate
                   11601:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  11602:             </li>
1.4       hubertf  11603: 
                   11604:             <li>
                   11605:               <p>Until the webserver on www.NetBSD.org is really
                   11606:               updated automatically to pick up changes to the
1.14      xtraeme  11607:               pkgsrc guide automatically, also run
1.18      xtraeme  11608:               <span><strong class="command">make install-htdocs
1.14      xtraeme  11609:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   11610:               similar, adjust <code class=
                   11611:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  11612:             </li>
                   11613: 
                   11614:             <li>
1.14      xtraeme  11615:               <p><span><strong class="command">cvs commit
                   11616:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  11617:             </li>
1.2       hubertf  11618:           </ul>
                   11619:         </div>
                   11620:       </div>
                   11621:     </div>
1.1       grant    11622:   </div>
                   11623: </body>
                   11624: </html>

CVSweb <webmaster@jp.NetBSD.org>