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

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.24    ! wiz        22:           <h1 class="title"><a name="id2510574" id=
        !            23:           "id2510574"></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.24    ! wiz        96:             <dt><span class="sect1"><a href="#id2623537">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.24    ! wiz       120:                 <dt><span class="sect1"><a href="#id2569236">2.1.
1.1       grant     121:                 As tar file</a></span></dt>
                    122: 
1.24    ! wiz       123:                 <dt><span class="sect1"><a href="#id2569252">2.2.
1.1       grant     124:                 Via SUP</a></span></dt>
                    125: 
1.24    ! wiz       126:                 <dt><span class="sect1"><a href="#id2569420">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.24    ! wiz       136:                 <dt><span class="sect1"><a href="#id2569530">3.1.
1.1       grant     137:                 Bootstrapping pkgsrc</a></span></dt>
                    138: 
1.24    ! wiz       139:                 <dt><span class="sect1"><a href="#id2569712">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.24    ! wiz       145:                     "#id2569718">3.2.1. Darwin (Mac OS
1.1       grant     146:                     X)</a></span></dt>
                    147: 
                    148:                     <dt><span class="sect2"><a href=
1.24    ! wiz       149:                     "#id2569880">3.2.2. FreeBSD</a></span></dt>
1.1       grant     150: 
                    151:                     <dt><span class="sect2"><a href=
1.24    ! wiz       152:                     "#id2570324">3.2.3. Interix</a></span></dt>
1.1       grant     153: 
                    154:                     <dt><span class="sect2"><a href=
1.24    ! wiz       155:                     "#id2570557">3.2.4. IRIX</a></span></dt>
1.1       grant     156: 
                    157:                     <dt><span class="sect2"><a href=
1.24    ! wiz       158:                     "#id2570654">3.2.5. Linux</a></span></dt>
1.1       grant     159: 
                    160:                     <dt><span class="sect2"><a href=
1.24    ! wiz       161:                     "#id2570723">3.2.6. OpenBSD</a></span></dt>
1.22      tv        162: 
                    163:                     <dt><span class="sect2"><a href=
1.24    ! wiz       164:                     "#id2570835">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.24    ! wiz       182:                     "#id2571040">4.1.1. Where to get binary
1.1       grant     183:                     packages</a></span></dt>
                    184: 
                    185:                     <dt><span class="sect2"><a href=
1.24    ! wiz       186:                     "#id2571080">4.1.2. How to use binary
1.1       grant     187:                     packages</a></span></dt>
                    188: 
                    189:                     <dt><span class="sect2"><a href=
1.24    ! wiz       190:                     "#id2571256">4.1.3. A word of
1.1       grant     191:                     warning</a></span></dt>
                    192:                   </dl>
                    193:                 </dd>
                    194: 
1.24    ! wiz       195:                 <dt><span class="sect1"><a href="#id2571336">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.24    ! wiz       201:                     "#id2571346">4.2.1.
1.1       grant     202:                     Requirements</a></span></dt>
                    203: 
                    204:                     <dt><span class="sect2"><a href=
1.24    ! wiz       205:                     "#id2571366">4.2.2. Fetching
1.1       grant     206:                     distfiles</a></span></dt>
                    207: 
                    208:                     <dt><span class="sect2"><a href=
1.24    ! wiz       209:                     "#id2571418">4.2.3. How to build and
1.1       grant     210:                     install</a></span></dt>
                    211: 
                    212:                     <dt><span class="sect2"><a href=
1.24    ! wiz       213:                     "#id2623831">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.24    ! wiz       225:                 <dt><span class="sect1"><a href="#id2623917">5.1.
1.1       grant     226:                 Building a single binary package</a></span></dt>
                    227: 
1.24    ! wiz       228:                 <dt><span class="sect1"><a href="#id2623995">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.24    ! wiz       242:                     "#id2624142">5.3.2. Other environmental
1.1       grant     243:                     considerations</a></span></dt>
                    244: 
                    245:                     <dt><span class="sect2"><a href=
1.24    ! wiz       246:                     "#id2624183">5.3.3. Operation</a></span></dt>
1.1       grant     247: 
                    248:                     <dt><span class="sect2"><a href=
1.24    ! wiz       249:                     "#id2624252">5.3.4. What it
1.1       grant     250:                     does</a></span></dt>
                    251: 
                    252:                     <dt><span class="sect2"><a href=
1.24    ! wiz       253:                     "#id2624309">5.3.5. Disk space
1.1       grant     254:                     requirements</a></span></dt>
                    255: 
                    256:                     <dt><span class="sect2"><a href=
1.24    ! wiz       257:                     "#id2624336">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.24    ! wiz       261:                     "#id2624865">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.24    ! wiz       270:                 <dt><span class="sect1"><a href="#id2625321">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.24    ! wiz       277:                     "#id2625336">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.24    ! wiz       289:                 <dt><span class="sect1"><a href="#id2625528">6.1.
1.18      xtraeme   290:                 Are there any mailing lists for pkg-related
1.1       grant     291:                 discussion?</a></span></dt>
                    292: 
1.24    ! wiz       293:                 <dt><span class="sect1"><a href="#id2625662">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.24    ! wiz       300:                 <dt><span class="sect1"><a href="#id2625984">6.4.
1.1       grant     301:                 How to use pkgsrc as non-root</a></span></dt>
                    302: 
1.24    ! wiz       303:                 <dt><span class="sect1"><a href="#id2625995">6.5.
1.15      xtraeme   304:                 How to resume transfers when fetching
                    305:                 distfiles?</a></span></dt>
1.14      xtraeme   306: 
1.24    ! wiz       307:                 <dt><span class="sect1"><a href="#id2626045">6.6.
1.1       grant     308:                 How can I install/use XFree86 from
                    309:                 pkgsrc?</a></span></dt>
                    310: 
1.24    ! wiz       311:                 <dt><span class="sect1"><a href="#id2626073">6.7.
1.1       grant     312:                 How can I install/use X.org from
                    313:                 pkgsrc?</a></span></dt>
                    314: 
1.24    ! wiz       315:                 <dt><span class="sect1"><a href="#id2626101">6.8.
1.1       grant     316:                 How to fetch files from behind a
                    317:                 firewall</a></span></dt>
                    318: 
1.24    ! wiz       319:                 <dt><span class="sect1"><a href="#id2626115">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.24    ! wiz       324:                 <dt><span class="sect1"><a href="#id2626166">6.10.
1.1       grant     325:                 How to fetch all distfiles at once</a></span></dt>
                    326: 
1.24    ! wiz       327:                 <dt><span class="sect1"><a href="#id2626313">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.24    ! wiz       332:                 <dt><span class="sect1"><a href="#id2626352">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.24    ! wiz       336:                 <dt><span class="sect1"><a href="#id2626409">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.24    ! wiz       374:                 <dt><span class="sect1"><a href="#id2627489">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.24    ! wiz       384:                 <dt><span class="sect1"><a href="#id2627770">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.24    ! wiz       395:                 <dt><span class="sect1"><a href="#id2627961">8.1.
1.1       grant     396:                 RCS ID</a></span></dt>
                    397: 
1.24    ! wiz       398:                 <dt><span class="sect1"><a href="#id2627976">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.24    ! wiz       410:                 <dt><span class="sect1"><a href="#id2628297">8.5.
1.1       grant     411:                 Manpage-compression</a></span></dt>
                    412: 
1.24    ! wiz       413:                 <dt><span class="sect1"><a href="#id2628339">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.24    ! wiz       417:                 <dt><span class="sect1"><a href="#id2628363">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.24    ! wiz       432:                 <dt><span class="sect1"><a href="#id2628562">9.1.
1.1       grant     433:                 Converting packages to use
                    434:                 buildlink3</a></span></dt>
                    435: 
1.24    ! wiz       436:                 <dt><span class="sect1"><a href="#id2628948">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.24    ! wiz       443:                     "#id2629017">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.24    ! wiz       447:                     "#id2629458">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.24    ! wiz       455:                 <dt><span class="sect1"><a href="#id2629537">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.24    ! wiz       462:                     "#id2629618">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.24    ! wiz       467:                     "#id2629913">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.24    ! wiz       479:                 <dt><span class="sect1"><a href="#id2629986">10.1.
1.1       grant     480:                 Global default options</a></span></dt>
                    481: 
1.24    ! wiz       482:                 <dt><span class="sect1"><a href="#id2630001">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.24    ! wiz       497:                 <dt><span class="sect1"><a href="#id2630624">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.24    ! wiz       511:                 <dt><span class="sect1"><a href="#id2632120">12.1.
1.1       grant     512:                 General operation</a></span></dt>
                    513: 
                    514:                 <dd>
                    515:                   <dl>
                    516:                     <dt><span class="sect2"><a href=
1.24    ! wiz       517:                     "#id2632123">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.24    ! wiz       521:                     "#id2632275">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.24    ! wiz       529:                     "#id2632728">12.1.4. Handling conflicts with
1.1       grant     530:                     other packages</a></span></dt>
                    531: 
                    532:                     <dt><span class="sect2"><a href=
1.24    ! wiz       533:                     "#id2632846">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.24    ! wiz       537:                     "#id2632872">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.24    ! wiz       545:                     "#id2632964">12.1.8. How to handle compiler
1.1       grant     546:                     bugs</a></span></dt>
                    547: 
                    548:                     <dt><span class="sect2"><a href=
1.24    ! wiz       549:                     "#id2633054">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.24    ! wiz       554:                     "#id2633104">12.1.10. Portability of
1.1       grant     555:                     packages</a></span></dt>
                    556:                   </dl>
                    557:                 </dd>
                    558: 
1.24    ! wiz       559:                 <dt><span class="sect1"><a href="#id2633128">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.24    ! wiz       565:                     "#id2633131">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.24    ! wiz       570:                     "#id2633194">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.24    ! wiz       575:                 <dt><span class="sect1"><a href="#id2633206">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.24    ! wiz       585:                     "#id2633640">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.24    ! wiz       590:                     "#id2633721">12.3.3. GNU
1.1       grant     591:                     Autoconf/Automake</a></span></dt>
                    592:                   </dl>
                    593:                 </dd>
                    594: 
1.24    ! wiz       595:                 <dt><span class="sect1"><a href="#id2633834">12.4.
1.1       grant     596:                 Building considerations</a></span></dt>
                    597: 
                    598:                 <dd>
                    599:                   <dl>
                    600:                     <dt><span class="sect2"><a href=
1.24    ! wiz       601:                     "#id2633837">12.4.1. CPP
1.1       grant     602:                     defines</a></span></dt>
                    603:                   </dl>
                    604:                 </dd>
                    605: 
1.24    ! wiz       606:                 <dt><span class="sect1"><a href="#id2633867">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.24    ! wiz       612:                     "#id2633870">12.5.1. Package configuration
1.1       grant     613:                     files</a></span></dt>
                    614: 
                    615:                     <dt><span class="sect2"><a href=
1.24    ! wiz       616:                     "#id2633973">12.5.2. User
1.2       hubertf   617:                     interaction</a></span></dt>
1.1       grant     618: 
                    619:                     <dt><span class="sect2"><a href=
1.24    ! wiz       620:                     "#id2634018">12.5.3. Handling
1.1       grant     621:                     licenses</a></span></dt>
                    622: 
                    623:                     <dt><span class="sect2"><a href=
1.24    ! wiz       624:                     "#id2634169">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.24    ! wiz       628:                     "#id2634231">12.5.5. Installing score
1.1       grant     629:                     files</a></span></dt>
                    630: 
                    631:                     <dt><span class="sect2"><a href=
1.24    ! wiz       632:                     "#id2634411">12.5.6. Packages providing login
1.1       grant     633:                     shells</a></span></dt>
                    634: 
                    635:                     <dt><span class="sect2"><a href=
1.24    ! wiz       636:                     "#id2634469">12.5.7. Packages containing perl
1.1       grant     637:                     scripts</a></span></dt>
                    638: 
                    639:                     <dt><span class="sect2"><a href=
1.24    ! wiz       640:                     "#id2634555">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.24    ! wiz       644:                     "#id2634577">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.24    ! wiz       652:                     "#id2634865">12.5.11. Packages installing
1.1       grant     653:                     GConf2 data files</a></span></dt>
                    654: 
                    655:                     <dt><span class="sect2"><a href=
1.24    ! wiz       656:                     "#id2634965">12.5.12. Packages installing
1.1       grant     657:                     scrollkeeper data files</a></span></dt>
                    658: 
                    659:                     <dt><span class="sect2"><a href=
1.24    ! wiz       660:                     "#id2635016">12.5.13. Packages installing X11
1.1       grant     661:                     fonts</a></span></dt>
                    662: 
                    663:                     <dt><span class="sect2"><a href=
1.24    ! wiz       664:                     "#id2635063">12.5.14. Packages installing GTK2
1.1       grant     665:                     modules</a></span></dt>
                    666: 
                    667:                     <dt><span class="sect2"><a href=
1.24    ! wiz       668:                     "#id2635201">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.24    ! wiz       672:                     "#id2635253">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.24    ! wiz       676:                     "#id2635323">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.24    ! wiz       680:                     "#id2635337">12.5.18. Packages installing
1.18      xtraeme   681:                     startup scripts</a></span></dt>
1.1       grant     682:                   </dl>
                    683:                 </dd>
                    684: 
1.24    ! wiz       685:                 <dt><span class="sect1"><a href="#id2635358">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.24    ! wiz       698:                 <dt><span class="sect1"><a href="#id2635957">14.1.
1.1       grant     699:                 Submitting your packages</a></span></dt>
                    700: 
1.24    ! wiz       701:                 <dt><span class="sect1"><a href="#id2636014">14.2.
1.1       grant     702:                 Committing: Importing a package into
                    703:                 CVS</a></span></dt>
                    704: 
1.24    ! wiz       705:                 <dt><span class="sect1"><a href="#id2636077">14.3.
1.2       hubertf   706:                 Updating a package to a newer
                    707:                 version</a></span></dt>
1.1       grant     708: 
1.24    ! wiz       709:                 <dt><span class="sect1"><a href="#id2636097">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.24    ! wiz       721:             <dt><span class="sect1"><a href="#id2636323">A.1.
1.1       grant     722:             files</a></span></dt>
                    723: 
                    724:             <dd>
                    725:               <dl>
1.24    ! wiz       726:                 <dt><span class="sect2"><a href="#id2636326">A.1.1.
1.1       grant     727:                 Makefile</a></span></dt>
                    728: 
1.24    ! wiz       729:                 <dt><span class="sect2"><a href="#id2636333">A.1.2.
1.1       grant     730:                 DESCR</a></span></dt>
                    731: 
1.24    ! wiz       732:                 <dt><span class="sect2"><a href="#id2636348">A.1.3.
1.1       grant     733:                 PLIST</a></span></dt>
                    734: 
1.24    ! wiz       735:                 <dt><span class="sect2"><a href="#id2636356">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.24    ! wiz       741:             <dt><span class="sect1"><a href="#id2636465">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.24    ! wiz       767:             <dt><span class="sect1"><a href="#id2637111">D.1.
1.2       hubertf   768:             Targets</a></span></dt>
                    769: 
1.24    ! wiz       770:             <dt><span class="sect1"><a href="#id2637517">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.24    ! wiz       791:           <dt><span class="sect1"><a href="#id2623537">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.24    ! wiz       810:               "id2623537" id=
        !           811:               "id2623537"></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.24    ! wiz      1121:               <dt><span class="sect1"><a href="#id2569236">2.1. As
1.1       grant    1122:               tar file</a></span></dt>
                   1123: 
1.24    ! wiz      1124:               <dt><span class="sect1"><a href="#id2569252">2.2. Via
1.1       grant    1125:               SUP</a></span></dt>
                   1126: 
1.24    ! wiz      1127:               <dt><span class="sect1"><a href="#id2569420">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.24    ! wiz      1137:               <dt><span class="sect1"><a href="#id2569530">3.1.
1.1       grant    1138:               Bootstrapping pkgsrc</a></span></dt>
                   1139: 
1.24    ! wiz      1140:               <dt><span class="sect1"><a href="#id2569712">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.24    ! wiz      1146:                   "#id2569718">3.2.1. Darwin (Mac OS
1.1       grant    1147:                   X)</a></span></dt>
                   1148: 
                   1149:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1150:                   "#id2569880">3.2.2. FreeBSD</a></span></dt>
1.22      tv       1151: 
                   1152:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1153:                   "#id2570324">3.2.3. Interix</a></span></dt>
1.1       grant    1154: 
                   1155:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1156:                   "#id2570557">3.2.4. IRIX</a></span></dt>
1.1       grant    1157: 
                   1158:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1159:                   "#id2570654">3.2.5. Linux</a></span></dt>
1.1       grant    1160: 
                   1161:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1162:                   "#id2570723">3.2.6. OpenBSD</a></span></dt>
1.1       grant    1163: 
                   1164:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1165:                   "#id2570835">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.24    ! wiz      1183:                   "#id2571040">4.1.1. Where to get binary
1.1       grant    1184:                   packages</a></span></dt>
                   1185: 
                   1186:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1187:                   "#id2571080">4.1.2. How to use binary
1.1       grant    1188:                   packages</a></span></dt>
                   1189: 
                   1190:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1191:                   "#id2571256">4.1.3. A word of
1.1       grant    1192:                   warning</a></span></dt>
                   1193:                 </dl>
                   1194:               </dd>
                   1195: 
1.24    ! wiz      1196:               <dt><span class="sect1"><a href="#id2571336">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.24    ! wiz      1202:                   "#id2571346">4.2.1. Requirements</a></span></dt>
1.1       grant    1203: 
                   1204:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1205:                   "#id2571366">4.2.2. Fetching
1.1       grant    1206:                   distfiles</a></span></dt>
                   1207: 
                   1208:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1209:                   "#id2571418">4.2.3. How to build and
1.1       grant    1210:                   install</a></span></dt>
                   1211: 
                   1212:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1213:                   "#id2623831">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.24    ! wiz      1225:               <dt><span class="sect1"><a href="#id2623917">5.1.
1.1       grant    1226:               Building a single binary package</a></span></dt>
                   1227: 
1.24    ! wiz      1228:               <dt><span class="sect1"><a href="#id2623995">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.24    ! wiz      1242:                   "#id2624142">5.3.2. Other environmental
1.1       grant    1243:                   considerations</a></span></dt>
                   1244: 
                   1245:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1246:                   "#id2624183">5.3.3. Operation</a></span></dt>
1.1       grant    1247: 
                   1248:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1249:                   "#id2624252">5.3.4. What it does</a></span></dt>
1.1       grant    1250: 
                   1251:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1252:                   "#id2624309">5.3.5. Disk space
1.1       grant    1253:                   requirements</a></span></dt>
                   1254: 
                   1255:                   <dt><span class="sect2"><a href=
1.24    ! wiz      1256:                   "#id2624336">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.24    ! wiz      1260:                   "#id2624865">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.24    ! wiz      1269:               <dt><span class="sect1"><a href="#id2625321">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.24    ! wiz      1276:                   "#id2625336">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.24    ! wiz      1288:               <dt><span class="sect1"><a href="#id2625528">6.1. Are
1.18      xtraeme  1289:               there any mailing lists for pkg-related
1.1       grant    1290:               discussion?</a></span></dt>
                   1291: 
1.24    ! wiz      1292:               <dt><span class="sect1"><a href="#id2625662">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.24    ! wiz      1299:               <dt><span class="sect1"><a href="#id2625984">6.4. How
1.1       grant    1300:               to use pkgsrc as non-root</a></span></dt>
                   1301: 
1.24    ! wiz      1302:               <dt><span class="sect1"><a href="#id2625995">6.5. How
1.15      xtraeme  1303:               to resume transfers when fetching
                   1304:               distfiles?</a></span></dt>
1.14      xtraeme  1305: 
1.24    ! wiz      1306:               <dt><span class="sect1"><a href="#id2626045">6.6. How
1.1       grant    1307:               can I install/use XFree86 from
                   1308:               pkgsrc?</a></span></dt>
                   1309: 
1.24    ! wiz      1310:               <dt><span class="sect1"><a href="#id2626073">6.7. How
1.1       grant    1311:               can I install/use X.org from pkgsrc?</a></span></dt>
                   1312: 
1.24    ! wiz      1313:               <dt><span class="sect1"><a href="#id2626101">6.8. How
1.1       grant    1314:               to fetch files from behind a firewall</a></span></dt>
                   1315: 
1.24    ! wiz      1316:               <dt><span class="sect1"><a href="#id2626115">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.24    ! wiz      1321:               <dt><span class="sect1"><a href="#id2626166">6.10.
1.14      xtraeme  1322:               How to fetch all distfiles at once</a></span></dt>
1.1       grant    1323: 
1.24    ! wiz      1324:               <dt><span class="sect1"><a href="#id2626313">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.24    ! wiz      1329:               <dt><span class="sect1"><a href="#id2626352">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.24    ! wiz      1333:               <dt><span class="sect1"><a href="#id2626409">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.24    ! wiz      1363:             <dt><span class="sect1"><a href="#id2569236">2.1. As
1.1       grant    1364:             tar file</a></span></dt>
                   1365: 
1.24    ! wiz      1366:             <dt><span class="sect1"><a href="#id2569252">2.2. Via
1.1       grant    1367:             SUP</a></span></dt>
                   1368: 
1.24    ! wiz      1369:             <dt><span class="sect1"><a href="#id2569420">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.24    ! wiz      1383:                 "id2569236" id="id2569236"></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.24    ! wiz      1401:                 "id2569252" id="id2569252"></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.24    ! wiz      1427:                 "id2569420" id="id2569420"></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.24    ! wiz      1484:             <dt><span class="sect1"><a href="#id2569530">3.1.
1.1       grant    1485:             Bootstrapping pkgsrc</a></span></dt>
                   1486: 
1.24    ! wiz      1487:             <dt><span class="sect1"><a href="#id2569712">3.2.
1.1       grant    1488:             Platform specific notes</a></span></dt>
                   1489: 
                   1490:             <dd>
                   1491:               <dl>
1.24    ! wiz      1492:                 <dt><span class="sect2"><a href="#id2569718">3.2.1.
1.1       grant    1493:                 Darwin (Mac OS X)</a></span></dt>
                   1494: 
1.24    ! wiz      1495:                 <dt><span class="sect2"><a href="#id2569880">3.2.2.
1.1       grant    1496:                 FreeBSD</a></span></dt>
                   1497: 
1.24    ! wiz      1498:                 <dt><span class="sect2"><a href="#id2570324">3.2.3.
1.1       grant    1499:                 Interix</a></span></dt>
                   1500: 
1.24    ! wiz      1501:                 <dt><span class="sect2"><a href="#id2570557">3.2.4.
1.1       grant    1502:                 IRIX</a></span></dt>
                   1503: 
1.24    ! wiz      1504:                 <dt><span class="sect2"><a href="#id2570654">3.2.5.
1.22      tv       1505:                 Linux</a></span></dt>
                   1506: 
1.24    ! wiz      1507:                 <dt><span class="sect2"><a href="#id2570723">3.2.6.
1.1       grant    1508:                 OpenBSD</a></span></dt>
                   1509: 
1.24    ! wiz      1510:                 <dt><span class="sect2"><a href="#id2570835">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.24    ! wiz      1522:                 "id2569530" id=
        !          1523:                 "id2569530"></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.24    ! wiz      1613:                 "id2569712" id="id2569712"></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.24    ! wiz      1626:                   <h3 class="title"><a name="id2569718" id=
        !          1627:                   "id2569718"></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.24    ! wiz      1759:                   <h3 class="title"><a name="id2569880" id=
        !          1760:                   "id2569880"></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.24    ! wiz      1816:                   <h3 class="title"><a name="id2570324" id=
        !          1817:                   "id2570324"></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.24    ! wiz      1998:                   <h3 class="title"><a name="id2570557" id=
        !          1999:                   "id2570557"></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
1.24    ! wiz      2015:             providing support for <a href=
        !          2016:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
        !          2017:             <span class="citerefentry"><span class=
        !          2018:             "refentrytitle">if_indextoname</span>(3)</span></a>,
        !          2019:             <a href=
        !          2020:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
        !          2021:             <span class="citerefentry"><span class=
        !          2022:             "refentrytitle">if_nametoindex</span>(3)</span></a>,
        !          2023:             etc.</p>
1.1       grant    2024: 
                   2025:             <p>At this point in time, pkgsrc only supports one ABI.
                   2026:             That is, you can not switch between the old 32-bit ABI,
                   2027:             the new 32-bit ABI and the 64-bit ABI. If you start out
                   2028:             using "abi=n32", that's what all your packages will be
                   2029:             built with.</p>
                   2030: 
                   2031:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2032:             conflicting <code class="varname">CFLAGS</code> in your
                   2033:             environment or the <code class=
                   2034:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2035:             that you do not try to link n32 object files with lib64
1.14      xtraeme  2036:             or vice versa. Check your <code class=
                   2037:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2038: 
                   2039:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2040:             from a different host, please make sure to set
1.14      xtraeme  2041:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2042:             directory, as it appears that IRIX linker occasionally
                   2043:             runs into issues when trying to link over a network
                   2044:             mounted filesystem.</p>
                   2045: 
                   2046:             <p>The bootstrapping process should set all the right
                   2047:             options for programs such as imake(1), but you may want
                   2048:             to set some options depending on your local setup.
1.14      xtraeme  2049:             Please see <code class=
                   2050:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.1       grant    2051:             course, your compilers man pages for details.</p>
1.22      tv       2052: 
                   2053:             <p>If you are using SGI's MIPSPro compiler, please
                   2054:             set</p>
                   2055:             <pre class="programlisting">
                   2056: PKGSRC_COMPILER=mipspro
                   2057: </pre>
                   2058: 
                   2059:             <p>in <code class="filename">/etc/mk.conf</code>.
                   2060:             Otherwise, pkgsrc will assume you are using gcc and may
                   2061:             end up passing invalid flags to the compiler. Note that
                   2062:             bootstrap should create an appropriate <code class=
                   2063:             "filename">mk.conf.example</code> by default.</p>
                   2064: 
                   2065:             <p>If you have both the MIPSPro compiler chain
                   2066:             installed as well as gcc, but want to make sure that
                   2067:             MIPRPro is used, please set your <code class=
                   2068:             "varname">PATH</code> to <span class=
                   2069:             "emphasis"><em>not</em></span> include the location of
                   2070:             gcc (often <code class=
                   2071:             "filename">/usr/freeware/bin</code>), and (important)
                   2072:             pass the '--preserve-path' flag.</p>
1.1       grant    2073:           </div>
                   2074: 
                   2075:           <div class="sect2" lang="en" xml:lang="en">
                   2076:             <div class="titlepage">
                   2077:               <div>
                   2078:                 <div>
1.24    ! wiz      2079:                   <h3 class="title"><a name="id2570654" id=
        !          2080:                   "id2570654"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2081:                 </div>
                   2082:               </div>
                   2083:             </div>
                   2084: 
                   2085:             <p>Some versions of Linux (for example Debian
                   2086:             GNU/Linux) need either libtermcap or libcurses
                   2087:             (libncurses). Installing the distributions
                   2088:             libncurses-dev package (or equivalent) should fix the
                   2089:             problem.</p>
                   2090: 
                   2091:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2092:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2093:             8.0 and 8.1 on i386 have been tested.</p>
                   2094: 
                   2095:             <p>To bootstrap using icc, assuming the default icc
                   2096:             installation directory:</p>
                   2097:             <pre class="programlisting">
                   2098: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2099:                 ac_cv___attribute__=yes ./bootstrap
                   2100: </pre>
                   2101: 
                   2102:             <div class="note" style=
                   2103:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2104:               <h3 class="title">Note</h3>
                   2105: 
                   2106:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2107:               -static-libcxa.</p>
                   2108:             </div>
                   2109: 
                   2110:             <p>icc supports __attribute__, but the GNU configure
                   2111:             test uses a nested function, which icc does not
                   2112:             support. #undef'ing __attribute__ has the unfortunate
                   2113:             side-effect of breaking many of the Linux header files,
                   2114:             which cannot be compiled properly without
                   2115:             __attribute__. The test must be overridden so that
                   2116:             __attribute__ is assumed supported by the compiler.</p>
                   2117: 
                   2118:             <p>After bootstrapping, you should set <code class=
                   2119:             "varname">PKGSRC_COMPILER</code> in <code class=
                   2120:             "filename">/etc/mk.conf</code>:</p>
                   2121:             <pre class="programlisting">
                   2122: PKGSRC_COMPILER=icc
                   2123: </pre>
                   2124: 
                   2125:             <p>The default installation directory for icc is
                   2126:             <code class="filename">/opt/intel_cc_80</code>, which
                   2127:             is also the pkgsrc default. If you have installed it
                   2128:             into a different directory, set <code class=
                   2129:             "varname">ICCBASE</code> in <code class=
                   2130:             "filename">/etc/mk.conf</code>:</p>
                   2131:             <pre class="programlisting">
                   2132: ICCBASE=/opt/icc
                   2133: </pre>
                   2134: 
                   2135:             <p>pkgsrc uses the static linking method of the runtime
                   2136:             libraries provided by icc, so binaries can be run on
                   2137:             other systems which do not have the shared libraries
                   2138:             installed.</p>
                   2139: 
                   2140:             <p>Libtool, however, extracts a list of libraries from
1.24    ! wiz      2141:             the <a href=
        !          2142:             "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
        !          2143:             <span class="citerefentry"><span class=
        !          2144:             "refentrytitle">ld</span>(1)</span></a> command run
        !          2145:             when linking a C++ shared library and records it,
        !          2146:             throwing away the -Bstatic and -Bdynamic options
        !          2147:             interspersed between the libraries. This means that
        !          2148:             libtool-linked C++ shared libraries will have a runtime
        !          2149:             dependency on the icc libraries until this is fixed in
        !          2150:             libtool.</p>
1.22      tv       2151:           </div>
                   2152: 
                   2153:           <div class="sect2" lang="en" xml:lang="en">
                   2154:             <div class="titlepage">
                   2155:               <div>
                   2156:                 <div>
1.24    ! wiz      2157:                   <h3 class="title"><a name="id2570723" id=
        !          2158:                   "id2570723"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2159:                 </div>
                   2160:               </div>
                   2161:             </div>
                   2162: 
                   2163:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2164: 
                   2165:             <p>Care should be taken so that the tools that this kit
                   2166:             installs do not conflict with the OpenBSD userland
                   2167:             tools. There are several steps:</p>
                   2168: 
                   2169:             <div class="orderedlist">
                   2170:               <ol type="1">
                   2171:                 <li>
                   2172:                   <p>OpenBSD stores its ports pkg database in
1.14      xtraeme  2173:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    2174:                   therefore recommended that you choose a different
1.14      xtraeme  2175:                   location (e.g. <code class=
                   2176:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2177:                   --pkgdbdir option to the bootstrap script.</p>
                   2178:                 </li>
                   2179: 
                   2180:                 <li>
                   2181:                   <p>If you do not intend to use the OpenBSD ports
                   2182:                   tools, it's probably a good idea to move them out
                   2183:                   of the way to avoid confusion, e.g.</p>
                   2184:                   <pre class="screen">
1.14      xtraeme  2185: <code class="prompt">#</code> <strong class=
                   2186: "userinput"><code>cd /usr/sbin</code></strong>
                   2187: <code class="prompt">#</code> <strong class=
                   2188: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2189: <code class="prompt">#</code> <strong class=
                   2190: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2191: <code class="prompt">#</code> <strong class=
                   2192: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2193: <code class="prompt">#</code> <strong class=
                   2194: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2195: </pre>
                   2196:                 </li>
                   2197: 
                   2198:                 <li>
1.14      xtraeme  2199:                   <p>An example <code class=
                   2200:                   "filename">/etc/mk.conf</code> file will be
                   2201:                   placed in <code class=
                   2202:                   "filename">/etc/mk.conf.example</code> file when
                   2203:                   you use the bootstrap script. OpenBSD's make
                   2204:                   program uses <code class=
                   2205:                   "filename">/etc/mk.conf</code> as well. You can
1.1       grant    2206:                   work around this by enclosing all the pkgsrc
                   2207:                   specific parts of the file with:</p>
                   2208:                   <pre class="programlisting">
                   2209: .ifdef BSD_PKG_MK
1.11      ben      2210: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1       grant    2211: .else
                   2212: # OpenBSD stuff
                   2213: .endif
                   2214: </pre>
                   2215:                 </li>
                   2216:               </ol>
                   2217:             </div>
                   2218:           </div>
                   2219: 
                   2220:           <div class="sect2" lang="en" xml:lang="en">
                   2221:             <div class="titlepage">
                   2222:               <div>
                   2223:                 <div>
1.24    ! wiz      2224:                   <h3 class="title"><a name="id2570835" id=
        !          2225:                   "id2570835"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2226:                 </div>
                   2227:               </div>
                   2228:             </div>
                   2229: 
                   2230:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2231:             sparc. You will need a working C compiler. Both gcc
                   2232:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2233: 
                   2234:             <p>The following packages are required on Solaris 8 for
                   2235:             the bootstrap process and to build packages.</p>
                   2236: 
                   2237:             <div class="itemizedlist">
                   2238:               <ul type="disc">
                   2239:                 <li>
                   2240:                   <p>SUNWsprot</p>
                   2241:                 </li>
                   2242: 
                   2243:                 <li>
                   2244:                   <p>SUNWarc</p>
                   2245:                 </li>
                   2246: 
                   2247:                 <li>
                   2248:                   <p>SUNWbtool</p>
                   2249:                 </li>
                   2250: 
                   2251:                 <li>
                   2252:                   <p>SUNWtoo</p>
                   2253:                 </li>
                   2254: 
                   2255:                 <li>
                   2256:                   <p>SUNWlibm</p>
                   2257:                 </li>
                   2258:               </ul>
                   2259:             </div>
                   2260: 
                   2261:             <p>Please note the use of GNU binutils on Solaris is
                   2262:             <span class="emphasis"><em>not</em></span>
                   2263:             supported.</p>
                   2264: 
                   2265:             <div class="sect3" lang="en" xml:lang="en">
                   2266:               <div class="titlepage">
                   2267:                 <div>
                   2268:                   <div>
1.24    ! wiz      2269:                     <h4 class="title"><a name="id2570934" id=
        !          2270:                     "id2570934"></a>3.2.7.1.&nbsp;If you are using
1.1       grant    2271:                     gcc</h4>
                   2272:                   </div>
                   2273:                 </div>
                   2274:               </div>
                   2275: 
                   2276:               <p>It makes life much simpler if you only use the
                   2277:               same gcc consistently for building all packages.</p>
                   2278: 
                   2279:               <p>It is recommended that an external gcc be used
                   2280:               only for bootstrapping, then either build gcc from
                   2281:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2282:               href=
                   2283:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.20      ben      2284:               class="pkgname">lang/gcc</a> or install a binary gcc
                   2285:               package, then remove gcc used during
                   2286:               bootstrapping.</p>
1.1       grant    2287: 
                   2288:               <p>Binary packages of gcc can be found through
                   2289:               <a href=
                   2290:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2291:               target=
                   2292:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2293:             </div>
                   2294: 
                   2295:             <div class="sect3" lang="en" xml:lang="en">
                   2296:               <div class="titlepage">
                   2297:                 <div>
                   2298:                   <div>
1.24    ! wiz      2299:                     <h4 class="title"><a name="id2570955" id=
        !          2300:                     "id2570955"></a>3.2.7.2.&nbsp;If you are using
1.1       grant    2301:                     Sun WorkShop</h4>
                   2302:                   </div>
                   2303:                 </div>
                   2304:               </div>
                   2305: 
                   2306:               <p>You will need at least the following packages
                   2307:               installed (from WorkShop 5.0)</p>
                   2308: 
                   2309:               <div class="itemizedlist">
                   2310:                 <ul type="disc">
                   2311:                   <li>
                   2312:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2313:                   </li>
                   2314: 
                   2315:                   <li>
                   2316:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2317:                   </li>
                   2318: 
                   2319:                   <li>
                   2320:                     <p>SPROild - Sun WorkShop Incremental
                   2321:                     Linker</p>
                   2322:                   </li>
                   2323: 
                   2324:                   <li>
                   2325:                     <p>SPROlang - Sun WorkShop Compilers common
                   2326:                     components</p>
                   2327:                   </li>
                   2328:                 </ul>
                   2329:               </div>
                   2330: 
1.14      xtraeme  2331:               <p>You should set <code class="varname">CC</code>,
                   2332:               <code class="varname">CXX</code> and optionally,
                   2333:               <code class="varname">CPP</code> in <code class=
                   2334:               "filename">/etc/mk.conf</code>, eg.</p>
1.1       grant    2335:               <pre class="programlisting">
                   2336: CC=        cc
                   2337: CXX=    CC
                   2338: CPP=    /usr/ccs/lib/cpp
                   2339: </pre>
                   2340: 
                   2341:               <p>You may also want to build 64-bit binaries,
                   2342:               eg.</p>
                   2343:               <pre class="programlisting">
                   2344: CFLAGS= -xtarget=ultra -xarch=v9
                   2345: </pre>
                   2346: 
                   2347:               <p>Whichever compiler you use, please ensure the
                   2348:               compiler tools and your $prefix are in your
1.14      xtraeme  2349:               <code class="varname">PATH</code>. This includes
                   2350:               <code class="filename">/usr/ccs/{bin,lib}</code> and
                   2351:               eg. <code class=
                   2352:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2353:             </div>
                   2354:           </div>
                   2355:         </div>
                   2356:       </div>
                   2357: 
                   2358:       <div class="chapter" lang="en" xml:lang="en">
                   2359:         <div class="titlepage">
                   2360:           <div>
                   2361:             <div>
                   2362:               <h2 class="title"><a name="using" id=
                   2363:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2364:             </div>
                   2365:           </div>
                   2366:         </div>
                   2367: 
                   2368:         <div class="toc">
                   2369:           <p><b>Table of Contents</b></p>
                   2370: 
                   2371:           <dl>
                   2372:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2373:             Working with binary packages</a></span></dt>
                   2374: 
                   2375:             <dd>
                   2376:               <dl>
1.24    ! wiz      2377:                 <dt><span class="sect2"><a href="#id2571040">4.1.1.
1.1       grant    2378:                 Where to get binary packages</a></span></dt>
                   2379: 
1.24    ! wiz      2380:                 <dt><span class="sect2"><a href="#id2571080">4.1.2.
1.1       grant    2381:                 How to use binary packages</a></span></dt>
                   2382: 
1.24    ! wiz      2383:                 <dt><span class="sect2"><a href="#id2571256">4.1.3.
1.1       grant    2384:                 A word of warning</a></span></dt>
                   2385:               </dl>
                   2386:             </dd>
                   2387: 
1.24    ! wiz      2388:             <dt><span class="sect1"><a href="#id2571336">4.2.
1.1       grant    2389:             Building packages from source</a></span></dt>
                   2390: 
                   2391:             <dd>
                   2392:               <dl>
1.24    ! wiz      2393:                 <dt><span class="sect2"><a href="#id2571346">4.2.1.
1.1       grant    2394:                 Requirements</a></span></dt>
                   2395: 
1.24    ! wiz      2396:                 <dt><span class="sect2"><a href="#id2571366">4.2.2.
1.1       grant    2397:                 Fetching distfiles</a></span></dt>
                   2398: 
1.24    ! wiz      2399:                 <dt><span class="sect2"><a href="#id2571418">4.2.3.
1.1       grant    2400:                 How to build and install</a></span></dt>
                   2401: 
1.24    ! wiz      2402:                 <dt><span class="sect2"><a href="#id2623831">4.2.4.
1.1       grant    2403:                 Selecting the compiler</a></span></dt>
                   2404:               </dl>
                   2405:             </dd>
                   2406:           </dl>
                   2407:         </div>
                   2408: 
                   2409:         <div class="sect1" lang="en" xml:lang="en">
                   2410:           <div class="titlepage">
                   2411:             <div>
                   2412:               <div>
                   2413:                 <h2 class="title" style="clear: both"><a name=
                   2414:                 "getting-started" id=
                   2415:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2416:                 packages</h2>
                   2417:               </div>
                   2418:             </div>
                   2419:           </div>
                   2420: 
                   2421:           <p>This section describes how to find, retrieve and
                   2422:           install a precompiled binary package that someone else
                   2423:           already prepared for your type of machine.</p>
                   2424: 
                   2425:           <div class="sect2" lang="en" xml:lang="en">
                   2426:             <div class="titlepage">
                   2427:               <div>
                   2428:                 <div>
1.24    ! wiz      2429:                   <h3 class="title"><a name="id2571040" id=
        !          2430:                   "id2571040"></a>4.1.1.&nbsp;Where to get binary
1.1       grant    2431:                   packages</h3>
                   2432:                 </div>
                   2433:               </div>
                   2434:             </div>
                   2435: 
                   2436:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.14      xtraeme  2437:             and its mirrors in the directory <code class=
                   2438:             "filename">/pub/NetBSD/packages</code> for anonymous
                   2439:             FTP access. Please pick the right subdirectory there as
                   2440:             indicated by <span><strong class="command">uname
                   2441:             -p</strong></span>. In that directory, there is a
1.1       grant    2442:             subdirectory for each category plus a subdirectory
1.14      xtraeme  2443:             <code class="filename">All</code> which includes the
                   2444:             actual binaries in <code class="filename">.tgz</code>
                   2445:             files. The category subdirectories use symbolic links
                   2446:             to those files (this is the same directory layout as in
                   2447:             <code class=
                   2448:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2449: 
                   2450:             <p>This same directory layout applies for CDROM
                   2451:             distributions, only that the directory may be rooted
1.14      xtraeme  2452:             somewhere else, probably somewhere below <code class=
                   2453:             "filename">/cdrom</code>. Please consult your CDROMs
1.1       grant    2454:             documentation for the exact location.</p>
                   2455:           </div>
                   2456: 
                   2457:           <div class="sect2" lang="en" xml:lang="en">
                   2458:             <div class="titlepage">
                   2459:               <div>
                   2460:                 <div>
1.24    ! wiz      2461:                   <h3 class="title"><a name="id2571080" id=
        !          2462:                   "id2571080"></a>4.1.2.&nbsp;How to use binary
1.1       grant    2463:                   packages</h3>
                   2464:                 </div>
                   2465:               </div>
                   2466:             </div>
                   2467: 
                   2468:             <p>If you have the files on a CDROM or downloaded them
1.23      wiz      2469:             to your hard disk, you can install them with the
1.14      xtraeme  2470:             following command (be sure to<span><strong class=
                   2471:             "command">su</strong></span> to root first):</p>
1.1       grant    2472:             <pre class="screen">
1.14      xtraeme  2473: <code class="prompt">#</code> <strong class=
                   2474: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    2475: </pre>
                   2476: 
                   2477:             <p>If you have FTP access and you don't want to
                   2478:             download the packages via FTP prior to installation,
1.14      xtraeme  2479:             you can do this automatically by giving
                   2480:             <span><strong class="command">pkg_add</strong></span>
                   2481:             an FTP URL:</p>
1.1       grant    2482:             <pre class="screen">
1.14      xtraeme  2483: <code class="prompt">#</code> <strong class=
                   2484: "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    2485: </pre>
                   2486: 
                   2487:             <p>If there is any doubt, the uname utility can be used
                   2488:             to determine the &lt;OSvers&gt;, and &lt;arch&gt; by
1.14      xtraeme  2489:             running <span><strong class="command">uname
                   2490:             -rp</strong></span>.</p>
1.1       grant    2491: 
                   2492:             <p>Also note that any prerequisite packages needed to
                   2493:             run the package in question will be installed, too,
                   2494:             assuming they are present where you install from.</p>
                   2495: 
1.23      wiz      2496:             <p>To save some typing, you can set the <code class=
                   2497:             "varname">PKG_PATH</code> environment variable to a
                   2498:             semicolon separated list of paths (including remote
                   2499:             URLs); trailing slashes are not allowed.</p>
                   2500: 
                   2501:             <p>Additionally to the <code class=
                   2502:             "filename">All</code> directory there exists a
                   2503:             <code class="filename">vulnerable</code> directory to
                   2504:             which binary packages with known vulnerabilities are
                   2505:             moved, since removing them could cause missing
                   2506:             dependencies. To use these packages, add the
                   2507:             <code class="filename">vulnerable</code> directory to
                   2508:             your <code class="varname">PKG_PATH</code>. However,
                   2509:             you should run <a xmlns=
                   2510:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   2511:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   2512:             class="pkgname">security/audit-packages</a> regularly,
                   2513:             and especially after installing new packages, and
                   2514:             verify that the vulnerabilities are acceptable for your
                   2515:             configuration. An example <code class=
                   2516:             "varname">PKG_PATH</code> would be: <code class=
                   2517:             "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>
                   2518:             Please note that semicolon (';') is a shell
                   2519:             meta-character, so you'll probably have to quote
                   2520:             it.</p>
                   2521: 
1.1       grant    2522:             <p>After you've installed packages, be sure to have
1.14      xtraeme  2523:             <code class="filename">/usr/pkg/bin</code> in your
                   2524:             <code class="varname">PATH</code> so you can actually
                   2525:             start the just installed program.</p>
1.1       grant    2526:           </div>
                   2527: 
                   2528:           <div class="sect2" lang="en" xml:lang="en">
                   2529:             <div class="titlepage">
                   2530:               <div>
                   2531:                 <div>
1.24    ! wiz      2532:                   <h3 class="title"><a name="id2571256" id=
        !          2533:                   "id2571256"></a>4.1.3.&nbsp;A word of
1.1       grant    2534:                   warning</h3>
                   2535:                 </div>
                   2536:               </div>
                   2537:             </div>
                   2538: 
                   2539:             <p>Please pay very careful attention to the warnings
                   2540:             expressed in the <a href=
                   2541:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2542:             <span class="citerefentry"><span class=
                   2543:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2544:             page about the inherent dangers of installing binary
                   2545:             packages which you did not create yourself, and the
                   2546:             security holes that can be introduced onto your system
                   2547:             by indiscriminate adding of such files.</p>
                   2548:           </div>
                   2549:         </div>
                   2550: 
                   2551:         <div class="sect1" lang="en" xml:lang="en">
                   2552:           <div class="titlepage">
                   2553:             <div>
                   2554:               <div>
                   2555:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      2556:                 "id2571336" id="id2571336"></a>4.2.&nbsp;Building
1.1       grant    2557:                 packages from source</h2>
                   2558:               </div>
                   2559:             </div>
                   2560:           </div>
                   2561: 
                   2562:           <p>This assumes that the package is already in pkgsrc. If
                   2563:           it is not, see <a href="#developers-guide" title=
1.2       hubertf  2564:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
                   2565:           &#8220;The pkgsrc developer's guide&#8221;</a>.</p>
1.1       grant    2566: 
                   2567:           <div class="sect2" lang="en" xml:lang="en">
                   2568:             <div class="titlepage">
                   2569:               <div>
                   2570:                 <div>
1.24    ! wiz      2571:                   <h3 class="title"><a name="id2571346" id=
        !          2572:                   "id2571346"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2573:                 </div>
                   2574:               </div>
                   2575:             </div>
                   2576: 
                   2577:             <p>To build packages from source on a NetBSD system the
                   2578:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2579:             &#8220;<span class="quote">text</span>&#8221;
                   2580:             distribution sets must be installed. If you want to
                   2581:             build X11 related packages the &#8220;<span class=
                   2582:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2583:             "quote">xcomp</span>&#8221; distribution sets are
                   2584:             required, too.</p>
                   2585:           </div>
                   2586: 
                   2587:           <div class="sect2" lang="en" xml:lang="en">
                   2588:             <div class="titlepage">
                   2589:               <div>
                   2590:                 <div>
1.24    ! wiz      2591:                   <h3 class="title"><a name="id2571366" id=
        !          2592:                   "id2571366"></a>4.2.2.&nbsp;Fetching
1.1       grant    2593:                   distfiles</h3>
                   2594:                 </div>
                   2595:               </div>
                   2596:             </div>
                   2597: 
                   2598:             <p>The distfile (i.e. the unmodified source) must exist
                   2599:             on your system for the packages system to be able to
                   2600:             build it. If it does not exist, pkgsrc will use
                   2601:             <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   2602:             <span class="citerefentry"><span class=
                   2603:             "refentrytitle">ftp</span>(1)</span></a> to fetch it
                   2604:             automatically.</p>
                   2605: 
                   2606:             <p>You can overwrite some of the major distribution
                   2607:             sites to fit to sites that are close to your own. Have
1.14      xtraeme  2608:             a look at <code class=
                   2609:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
                   2610:             some examples - in particular, look for the
                   2611:             <code class="varname">MASTER_SORT</code>, <code class=
                   2612:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   2613:             "varname">INET_COUNTRY</code> definitions. This may
                   2614:             save some of your bandwidth and time.</p>
1.1       grant    2615: 
                   2616:             <p>You can change these settings either in your shell's
                   2617:             environment, or, if you want to keep the settings, by
1.14      xtraeme  2618:             editing the <code class="filename">/etc/mk.conf</code>
1.1       grant    2619:             file, and adding the definitions there.</p>
                   2620: 
                   2621:             <p>If you don't have a permanent Internet connection
                   2622:             and you want to know which files to download,
1.14      xtraeme  2623:             <span><strong class="command">make
                   2624:             fetch-list</strong></span> will tell you what you'll
                   2625:             need. Put these distfiles into <code class=
                   2626:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    2627:           </div>
                   2628: 
                   2629:           <div class="sect2" lang="en" xml:lang="en">
                   2630:             <div class="titlepage">
                   2631:               <div>
                   2632:                 <div>
1.24    ! wiz      2633:                   <h3 class="title"><a name="id2571418" id=
        !          2634:                   "id2571418"></a>4.2.3.&nbsp;How to build and
1.1       grant    2635:                   install</h3>
                   2636:                 </div>
                   2637:               </div>
                   2638:             </div>
                   2639: 
                   2640:             <p>Assuming that the distfile has been fetched (see
                   2641:             previous section), become root and change into the
1.14      xtraeme  2642:             relevant directory and running <span><strong class=
                   2643:             "command">make</strong></span>. For example, type</p>
1.1       grant    2644:             <pre class="screen">
1.14      xtraeme  2645: <code class="prompt">%</code> <strong class=
                   2646: "userinput"><code>cd misc/figlet</code></strong>
                   2647: <code class="prompt">%</code> <strong class=
                   2648: "userinput"><code>make</code></strong>
1.1       grant    2649: </pre>
                   2650: 
                   2651:             <p>at the shell prompt to build the various components
                   2652:             of the package, and</p>
                   2653:             <pre class="screen">
1.14      xtraeme  2654: <code class="prompt">#</code> <strong class=
                   2655: "userinput"><code>make install</code></strong>
1.1       grant    2656: </pre>
                   2657: 
                   2658:             <p>to install the various components into the correct
                   2659:             places on your system. Installing the package on your
                   2660:             system requires you to be root. However, pkgsrc has a
                   2661:             <span class="emphasis"><em>just-in-time-su</em></span>
                   2662:             feature, which allows you to only become root for the
                   2663:             actual installation step</p>
                   2664: 
                   2665:             <p>Taking the figlet utility as an example, we can
                   2666:             install it on our system by building as shown in
                   2667:             <a href="#logs" title=
                   2668:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
                   2669:             logs</i></a>.</p>
                   2670: 
                   2671:             <p>The program is installed under the default root of
1.14      xtraeme  2672:             the packages tree - <code class=
                   2673:             "filename">/usr/pkg</code>. Should this not conform to
                   2674:             your tastes, set the <code class=
                   2675:             "varname">LOCALBASE</code> variable in your
1.1       grant    2676:             environment, and it will use that value as the root of
1.14      xtraeme  2677:             your packages tree. So, to use <code class=
                   2678:             "filename">/usr/local</code>, set <code class=
                   2679:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    2680:             environment. Please note that you should use a
                   2681:             directory which is dedicated to packages and not shared
1.14      xtraeme  2682:             with other programs (ie, do not try and use
                   2683:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   2684:             should not try to add any of your own files or
                   2685:             directories (such as <code class=
                   2686:             "filename">src/</code>, <code class=
                   2687:             "filename">obj/</code>, or <code class=
                   2688:             "filename">pkgsrc/</code>) below the <code class=
                   2689:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    2690:             possible conflicts between programs and other files
                   2691:             installed by the package system and whatever else may
                   2692:             have been installed there.</p>
                   2693: 
1.14      xtraeme  2694:             <p>Some packages look in <code class=
                   2695:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    2696:             configuration options at build time. Have a look at
1.14      xtraeme  2697:             <code class=
                   2698:             "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
                   2699:             overview of what will be set there by default.
                   2700:             Environment variables such as <code class=
                   2701:             "varname">LOCALBASE</code> can be set in <code class=
                   2702:             "filename">/etc/mk.conf</code> to save having to
                   2703:             remember to set them each time you want to use
                   2704:             pkgsrc.</p>
1.1       grant    2705: 
                   2706:             <p>Occasionally, people want to &#8220;<span class=
                   2707:             "quote">look under the covers</span>&#8221; to see what
                   2708:             is going on when a package is building or being
                   2709:             installed. This may be for debugging purposes, or out
                   2710:             of simple curiosity. A number of utility values have
                   2711:             been added to help with this.</p>
                   2712: 
                   2713:             <div class="orderedlist">
                   2714:               <ol type="1">
                   2715:                 <li>
                   2716:                   <p>If you invoke the <a href=
                   2717:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2718:                   <span class="citerefentry"><span class=
                   2719:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  2720:                   with <code class=
                   2721:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   2722:                   amount of information will be displayed. For
                   2723:                   example,</p>
1.1       grant    2724:                   <pre class="screen">
1.14      xtraeme  2725: <strong class=
                   2726: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    2727: </pre>
                   2728: 
                   2729:                   <p>will show all the commands that are invoked,
                   2730:                   up to and including the &#8220;<span class=
                   2731:                   "quote">patch</span>&#8221; stage.</p>
                   2732:                 </li>
                   2733: 
                   2734:                 <li>
                   2735:                   <p>If you want to know the value of a certain
1.22      tv       2736:                   <a href=
                   2737:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2738:                   <span class="citerefentry"><span class=
                   2739:                   "refentrytitle">make</span>(1)</span></a>
                   2740:                   definition, then the <code class=
1.14      xtraeme  2741:                   "varname">VARNAME</code> definition should be
                   2742:                   used, in conjunction with the show-var target.
                   2743:                   e.g. to show the expansion of the <a href=
1.1       grant    2744:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2745:                   <span class="citerefentry"><span class=
                   2746:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  2747:                   variable <code class=
1.22      tv       2748:                   "varname">LOCALBASE</code>:</p>
1.1       grant    2749:                   <pre class="screen">
1.14      xtraeme  2750: <code class="prompt">%</code> <strong class=
                   2751: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    2752: /usr/pkg
1.14      xtraeme  2753: <code class="prompt">%</code>
1.1       grant    2754:           
                   2755: </pre>
                   2756:                 </li>
                   2757:               </ol>
                   2758:             </div>
                   2759: 
                   2760:             <p>If you want to install a binary package that you've
                   2761:             either created yourself (see next section), that you
                   2762:             put into pkgsrc/packages manually or that is located on
1.8       wiz      2763:             a remote FTP server, you can use the "bin-install"
1.1       grant    2764:             target. This target will install a binary package - if
                   2765:             available - via <a href=
                   2766:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2767:             <span class="citerefentry"><span class=
                   2768:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  2769:             <span><strong class="command">make
                   2770:             package</strong></span>. The list of remote FTP sites
                   2771:             searched is kept in the variable <code class=
                   2772:             "varname">BINPKG_SITES</code>, which defaults to
                   2773:             ftp.NetBSD.org. Any flags that should be added to
                   2774:             <a href=
1.1       grant    2775:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2776:             <span class="citerefentry"><span class=
                   2777:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  2778:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
                   2779:             See <code class=
                   2780:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   2781:             details.</p>
1.1       grant    2782: 
                   2783:             <p>A final word of warning: If you setup a system that
1.14      xtraeme  2784:             has a non-standard setting for <code class=
                   2785:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    2786:             any packages are installed, as you can not use several
                   2787:             directories for the same purpose. Doing so will result
                   2788:             in pkgsrc not being able to properly detect your
                   2789:             installed packages, and fail miserably. Note also that
                   2790:             precompiled binary packages are usually built with the
1.14      xtraeme  2791:             default <code class="varname">LOCALBASE</code> of
                   2792:             <code class="filename">/usr/pkg</code>, and that you
                   2793:             should <span class="emphasis"><em>not</em></span>
                   2794:             install any if you use a non-standard <code class=
                   2795:             "varname">LOCALBASE</code>.</p>
1.1       grant    2796:           </div>
                   2797: 
                   2798:           <div class="sect2" lang="en" xml:lang="en">
                   2799:             <div class="titlepage">
                   2800:               <div>
                   2801:                 <div>
1.24    ! wiz      2802:                   <h3 class="title"><a name="id2623831" id=
        !          2803:                   "id2623831"></a>4.2.4.&nbsp;Selecting the
1.1       grant    2804:                   compiler</h3>
                   2805:                 </div>
                   2806:               </div>
                   2807:             </div>
                   2808: 
                   2809:             <p>By default, pkgsrc will use GCC to build packages.
                   2810:             This may be overridden by setting the following
                   2811:             variables in /etc/mk.conf:</p>
                   2812: 
                   2813:             <div class="variablelist">
                   2814:               <dl>
1.14      xtraeme  2815:                 <dt><span class="term"><code class=
                   2816:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    2817: 
                   2818:                 <dd>
                   2819:                   <p>This is a list of values specifying the chain
                   2820:                   of compilers to invoke when building packages.
                   2821:                   Valid values are:</p>
                   2822: 
                   2823:                   <div class="itemizedlist">
                   2824:                     <ul type="disc">
                   2825:                       <li>
1.14      xtraeme  2826:                         <p><code class="varname">distcc</code>:
1.1       grant    2827:                         distributed C/C++ (chainable)</p>
                   2828:                       </li>
                   2829: 
                   2830:                       <li>
1.14      xtraeme  2831:                         <p><code class="varname">ccache</code>:
1.1       grant    2832:                         compiler cache (chainable)</p>
                   2833:                       </li>
                   2834: 
                   2835:                       <li>
1.14      xtraeme  2836:                         <p><code class="varname">gcc</code>: GNU
                   2837:                         C/C++ Compiler</p>
1.1       grant    2838:                       </li>
                   2839: 
                   2840:                       <li>
1.14      xtraeme  2841:                         <p><code class="varname">mipspro</code>:
1.1       grant    2842:                         Silicon Graphics, Inc. MIPSpro
                   2843:                         (n32/n64)</p>
                   2844:                       </li>
                   2845: 
                   2846:                       <li>
1.14      xtraeme  2847:                         <p><code class="varname">mipspro</code>:
1.1       grant    2848:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   2849:                       </li>
                   2850: 
                   2851:                       <li>
1.14      xtraeme  2852:                         <p><code class="varname">sunpro</code>:
1.1       grant    2853:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   2854:                         Studio</p>
                   2855:                       </li>
                   2856:                     </ul>
                   2857:                   </div>
                   2858: 
                   2859:                   <p>The default is &#8220;<span class=
1.14      xtraeme  2860:                   "quote"><code class=
                   2861:                   "varname">gcc</code></span>&#8221;. You can use
                   2862:                   <code class="varname">ccache</code> and/or
                   2863:                   <code class="varname">distcc</code> with an
                   2864:                   appropriate <code class=
                   2865:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   2866:                   &#8220;<span class="quote"><code class=
                   2867:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    2868:                   variable should always be terminated with a value
                   2869:                   for a real compiler.</p>
                   2870:                 </dd>
                   2871: 
1.14      xtraeme  2872:                 <dt><span class="term"><code class=
                   2873:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    2874: 
                   2875:                 <dd>
                   2876:                   <p>This specifies the minimum version of GCC to
                   2877:                   use when building packages. If the system GCC
                   2878:                   doesn't satisfy this requirement, then pkgsrc
                   2879:                   will build and install one of the GCC packages to
                   2880:                   use instead.</p>
                   2881:                 </dd>
                   2882:               </dl>
                   2883:             </div>
                   2884:           </div>
                   2885:         </div>
                   2886:       </div>
                   2887: 
                   2888:       <div class="chapter" lang="en" xml:lang="en">
                   2889:         <div class="titlepage">
                   2890:           <div>
                   2891:             <div>
                   2892:               <h2 class="title"><a name="binary" id=
                   2893:               "binary"></a>Chapter&nbsp;5.&nbsp;Creating binary
                   2894:               packages</h2>
                   2895:             </div>
                   2896:           </div>
                   2897:         </div>
                   2898: 
                   2899:         <div class="toc">
                   2900:           <p><b>Table of Contents</b></p>
                   2901: 
                   2902:           <dl>
1.24    ! wiz      2903:             <dt><span class="sect1"><a href="#id2623917">5.1.
1.1       grant    2904:             Building a single binary package</a></span></dt>
                   2905: 
1.24    ! wiz      2906:             <dt><span class="sect1"><a href="#id2623995">5.2.
1.1       grant    2907:             Settings for creation of binary
                   2908:             packages</a></span></dt>
                   2909: 
                   2910:             <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
                   2911:             a bulk build of all packages</a></span></dt>
                   2912: 
                   2913:             <dd>
                   2914:               <dl>
                   2915:                 <dt><span class="sect2"><a href=
                   2916:                 "#binary.configuration">5.3.1.
                   2917:                 Configuration</a></span></dt>
                   2918: 
1.24    ! wiz      2919:                 <dt><span class="sect2"><a href="#id2624142">5.3.2.
1.1       grant    2920:                 Other environmental considerations</a></span></dt>
                   2921: 
1.24    ! wiz      2922:                 <dt><span class="sect2"><a href="#id2624183">5.3.3.
1.1       grant    2923:                 Operation</a></span></dt>
                   2924: 
1.24    ! wiz      2925:                 <dt><span class="sect2"><a href="#id2624252">5.3.4.
1.1       grant    2926:                 What it does</a></span></dt>
                   2927: 
1.24    ! wiz      2928:                 <dt><span class="sect2"><a href="#id2624309">5.3.5.
1.1       grant    2929:                 Disk space requirements</a></span></dt>
                   2930: 
1.24    ! wiz      2931:                 <dt><span class="sect2"><a href="#id2624336">5.3.6.
1.1       grant    2932:                 Setting up a sandbox for chroot'ed
                   2933:                 builds</a></span></dt>
                   2934: 
1.24    ! wiz      2935:                 <dt><span class="sect2"><a href="#id2624865">5.3.7.
1.1       grant    2936:                 Building a partial set of packages</a></span></dt>
1.13      hubertf  2937: 
                   2938:                 <dt><span class="sect2"><a href=
                   2939:                 "#bulk-upload">5.3.8. Uploading results of a bulk
                   2940:                 build</a></span></dt>
1.1       grant    2941:               </dl>
                   2942:             </dd>
                   2943: 
1.24    ! wiz      2944:             <dt><span class="sect1"><a href="#id2625321">5.4.
1.1       grant    2945:             Creating a multiple CD-ROM packages
                   2946:             collection</a></span></dt>
                   2947: 
                   2948:             <dd>
                   2949:               <dl>
1.24    ! wiz      2950:                 <dt><span class="sect2"><a href="#id2625336">5.4.1.
1.1       grant    2951:                 Example of cdpack</a></span></dt>
                   2952:               </dl>
                   2953:             </dd>
                   2954:           </dl>
                   2955:         </div>
                   2956: 
                   2957:         <div class="sect1" lang="en" xml:lang="en">
                   2958:           <div class="titlepage">
                   2959:             <div>
                   2960:               <div>
                   2961:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      2962:                 "id2623917" id="id2623917"></a>5.1.&nbsp;Building a
1.1       grant    2963:                 single binary package</h2>
                   2964:               </div>
                   2965:             </div>
                   2966:           </div>
                   2967: 
                   2968:           <p>Once you have built and installed a package, you can
                   2969:           create a <span class="emphasis"><em>binary
                   2970:           package</em></span> which can be installed on another
                   2971:           system with <a href=
                   2972:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2973:           <span class="citerefentry"><span class=
                   2974:           "refentrytitle">pkg_add</span>(1)</span></a> This saves
                   2975:           having to build the same package on a group of hosts and
                   2976:           wasting CPU time. It also provides a simple means for
                   2977:           others to install your package, should you distribute
                   2978:           it.</p>
                   2979: 
                   2980:           <p>To create a binary package, change into the
1.14      xtraeme  2981:           appropriate directory in pkgsrc, and run
                   2982:           <span><strong class="command">make
                   2983:           package</strong></span>:</p>
1.1       grant    2984:           <pre class="screen">
1.14      xtraeme  2985: <code class="prompt">#</code> <strong class=
                   2986: "userinput"><code>cd misc/figlet</code></strong>
                   2987: <code class="prompt">#</code> <strong class=
                   2988: "userinput"><code>make package</code></strong>
1.1       grant    2989: </pre>
                   2990: 
                   2991:           <p>This will build and install your package (if not
                   2992:           already done), and then build a binary package from what
1.14      xtraeme  2993:           was installed. You can then use the <span><strong class=
                   2994:           "command">pkg_*</strong></span> tools to manipulate it.
                   2995:           Binary packages are created by default in <code class=
                   2996:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    2997:           gzipped tar file. See <a href="#logs.package" title=
                   2998:           "B.2.&nbsp;Packaging figlet">Section B.2,
                   2999:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   3000:           the above <a xmlns=
                   3001:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3002:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.20      ben      3003:           class="pkgname">misc/figlet</a> example.</p>
1.1       grant    3004: 
                   3005:           <p>See <a href="#submit" title=
                   3006:           "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter
                   3007:           14, <i>Submitting and Committing</i></a> for information
                   3008:           on how to submit such a binary package.</p>
                   3009:         </div>
                   3010: 
                   3011:         <div class="sect1" lang="en" xml:lang="en">
                   3012:           <div class="titlepage">
                   3013:             <div>
                   3014:               <div>
                   3015:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      3016:                 "id2623995" id="id2623995"></a>5.2.&nbsp;Settings
1.1       grant    3017:                 for creation of binary packages</h2>
                   3018:               </div>
                   3019:             </div>
                   3020:           </div>
                   3021: 
                   3022:           <p>See <a href="#build.helpful-targets" title=
                   3023:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   3024:           &#8220;Other helpful targets&#8221;</a>.</p>
                   3025:         </div>
                   3026: 
                   3027:         <div class="sect1" lang="en" xml:lang="en">
                   3028:           <div class="titlepage">
                   3029:             <div>
                   3030:               <div>
                   3031:                 <h2 class="title" style="clear: both"><a name=
                   3032:                 "bulkbuild" id="bulkbuild"></a>5.3.&nbsp;Doing a
                   3033:                 bulk build of all packages</h2>
                   3034:               </div>
                   3035:             </div>
                   3036:           </div>
                   3037: 
                   3038:           <p>If you want to get a full set of precompiled binary
                   3039:           packages, this section describes how to get them. Beware
                   3040:           that the bulk build will remove all currently installed
1.23      wiz      3041:           packages from your system! Having an FTP server
                   3042:           configured either on the machine doing the bulk builds or
                   3043:           on a nearby NFS server can help to make the packages
                   3044:           available to everyone. See <a href=
1.1       grant    3045:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   3046:           <span class="citerefentry"><span class=
                   3047:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   3048:           information. If you use a remote NFS server's storage, be
                   3049:           sure to not actually compile on NFS storage, as this
                   3050:           slows things down a lot.</p>
                   3051: 
                   3052:           <div class="sect2" lang="en" xml:lang="en">
                   3053:             <div class="titlepage">
                   3054:               <div>
                   3055:                 <div>
                   3056:                   <h3 class="title"><a name="binary.configuration"
                   3057:                   id=
                   3058:                   "binary.configuration"></a>5.3.1.&nbsp;Configuration</h3>
                   3059:                 </div>
                   3060:               </div>
                   3061:             </div>
                   3062: 
                   3063:             <div class="sect3" lang="en" xml:lang="en">
                   3064:               <div class="titlepage">
                   3065:                 <div>
                   3066:                   <div>
                   3067:                     <h4 class="title"><a name="binary.mk.conf" id=
                   3068:                     "binary.mk.conf"></a>5.3.1.1.&nbsp;/etc/mk.conf</h4>
                   3069:                   </div>
                   3070:                 </div>
                   3071:               </div>
                   3072: 
1.23      wiz      3073:               <p>You may want to set variables in <code class=
1.14      xtraeme  3074:               "filename">/etc/mk.conf</code>. Look at <code class=
                   3075:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    3076:               details of the default settings. You will want to
1.14      xtraeme  3077:               ensure that <code class=
                   3078:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   3079:               policy. As used in this example, <code class=
                   3080:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    3081:               "emphasis"><em>all</em></span> licenses.</p>
                   3082:               <pre class="programlisting">
                   3083: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   3084: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   3085: BSDSRCDIR=      /usr/src
                   3086: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   3087: OBJHOSTNAME?=   yes               # use work.`hostname`
                   3088: FAILOVER_FETCH= yes               # insist on the correct checksum
                   3089: PKG_DEVELOPER?= yes
                   3090: _ACCEPTABLE=    yes
                   3091: </pre>
                   3092:             </div>
                   3093: 
                   3094:             <div class="sect3" lang="en" xml:lang="en">
                   3095:               <div class="titlepage">
                   3096:                 <div>
                   3097:                   <div>
1.24    ! wiz      3098:                     <h4 class="title"><a name="id2624060" id=
        !          3099:                     "id2624060"></a>5.3.1.2.&nbsp;<code class=
1.14      xtraeme  3100:                     "filename">build.conf</code></h4>
1.1       grant    3101:                   </div>
                   3102:                 </div>
                   3103:               </div>
                   3104: 
1.14      xtraeme  3105:               <p>In <code class="filename">pkgsrc/mk/bulk</code>,
                   3106:               copy <code class="filename">build.conf-example</code>
                   3107:               to <code class="filename">build.conf</code> and edit
                   3108:               it, following the comments in that file. This is the
1.1       grant    3109:               config file that determines where log files are
                   3110:               generated after the build, where to mail the build
1.23      wiz      3111:               report to, where your pkgsrc tree is located and the
                   3112:               user to which user to <a href=
1.1       grant    3113:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   3114:               <span class="citerefentry"><span class=
1.23      wiz      3115:               "refentrytitle">su</span>(8)</span></a> to do a
1.14      xtraeme  3116:               <span><strong class="command">cvs
                   3117:               update</strong></span>.</p>
1.1       grant    3118:             </div>
                   3119: 
                   3120:             <div class="sect3" lang="en" xml:lang="en">
                   3121:               <div class="titlepage">
                   3122:                 <div>
                   3123:                   <div>
1.24    ! wiz      3124:                     <h4 class="title"><a name="id2624097" id=
        !          3125:                     "id2624097"></a>5.3.1.3.&nbsp;<code class=
1.14      xtraeme  3126:                     "filename">pre-build.local</code></h4>
1.1       grant    3127:                   </div>
                   3128:                 </div>
                   3129:               </div>
                   3130: 
                   3131:               <p>It is possible to configure the bulk build to
                   3132:               perform certain site specific tasks at the end of the
1.14      xtraeme  3133:               pre-build stage. If the file <code class=
                   3134:               "filename">pre-build.local</code> exists in
1.23      wiz      3135:               <code class="filename">/usr/pkgsrc/mk/bulk</code>, it
1.24    ! wiz      3136:               will be executed (as a <a href=
        !          3137:               "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
        !          3138:               <span class="citerefentry"><span class=
        !          3139:               "refentrytitle">sh</span>(1)</span></a> script) at
        !          3140:               the end of the usual pre-build stage. An example use
        !          3141:               of <code class="filename">pre-build.local</code> is
        !          3142:               to have the line:</p>
1.1       grant    3143:               <pre class="screen">
1.14      xtraeme  3144: <code class="prompt">#</code> <strong class=
                   3145: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23      wiz      3146:     &gt; pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1       grant    3147: </pre>
                   3148: 
                   3149:               <p>to prevent the system from trying to build a
                   3150:               particular package which requires nearly 3 GB of disk
                   3151:               space.</p>
                   3152:             </div>
                   3153:           </div>
                   3154: 
                   3155:           <div class="sect2" lang="en" xml:lang="en">
                   3156:             <div class="titlepage">
                   3157:               <div>
                   3158:                 <div>
1.24    ! wiz      3159:                   <h3 class="title"><a name="id2624142" id=
        !          3160:                   "id2624142"></a>5.3.2.&nbsp;Other environmental
1.1       grant    3161:                   considerations</h3>
                   3162:                 </div>
                   3163:               </div>
                   3164:             </div>
                   3165: 
1.14      xtraeme  3166:             <p>As <code class="filename">/usr/pkg</code> will be
1.1       grant    3167:             completely deleted at the start of bulk builds, make
                   3168:             sure your login shell is placed somewhere else. Either
1.14      xtraeme  3169:             drop it into <code class=
                   3170:             "filename">/usr/local/bin</code> (and adjust your login
                   3171:             shell in the passwd file), or (re-)install it via
                   3172:             <a href=
1.1       grant    3173:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3174:             <span class="citerefentry"><span class=
                   3175:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.14      xtraeme  3176:             <code class="filename">/etc/rc.local</code>, so you can
1.1       grant    3177:             login after a reboot (remember that your current
                   3178:             process won't die if the package is removed, you just
                   3179:             can't start any new instances of the shell any more).
                   3180:             Also, if you use NetBSD earlier than 1.5, or you still
                   3181:             want to use the pkgsrc version of ssh for some reason,
                   3182:             be sure to install ssh before starting it from
1.14      xtraeme  3183:             <code class="filename">rc.local</code>:</p>
1.1       grant    3184:             <pre class="programlisting">
                   3185: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   3186: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   3187:     /usr/pkg/etc/rc.d/sshd
                   3188: fi
                   3189: </pre>
                   3190: 
                   3191:             <p>Not doing so will result in you being not able to
                   3192:             log in via ssh after the bulk build is finished or if
                   3193:             the machine gets rebooted or crashes. You have been
                   3194:             warned! :)</p>
                   3195:           </div>
                   3196: 
                   3197:           <div class="sect2" lang="en" xml:lang="en">
                   3198:             <div class="titlepage">
                   3199:               <div>
                   3200:                 <div>
1.24    ! wiz      3201:                   <h3 class="title"><a name="id2624183" id=
        !          3202:                   "id2624183"></a>5.3.3.&nbsp;Operation</h3>
1.1       grant    3203:                 </div>
                   3204:               </div>
                   3205:             </div>
                   3206: 
                   3207:             <p>Make sure you don't need any of the packages still
                   3208:             installed.</p>
                   3209: 
                   3210:             <div class="warning" style=
                   3211:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3212:               <h3 class="title">Warning</h3>
                   3213: 
                   3214:               <p>During the bulk build, <span class=
                   3215:               "emphasis"><em>all packages will be
                   3216:               removed!</em></span></p>
                   3217:             </div>
                   3218: 
                   3219:             <p>Be sure to remove all other things that might
                   3220:             interfere with builds, like some libs installed in
1.14      xtraeme  3221:             <code class="filename">/usr/local</code>, etc. then
                   3222:             become root and type:</p>
1.1       grant    3223:             <pre class="screen">
1.14      xtraeme  3224: <code class="prompt">#</code> <strong class=
                   3225: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   3226: <code class="prompt">#</code> <strong class=
                   3227: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    3228: </pre>
                   3229: 
                   3230:             <p>If for some reason your last build didn't complete
                   3231:             (power failure, system panic, ...), you can continue it
                   3232:             by running:</p>
                   3233:             <pre class="screen">
1.14      xtraeme  3234: <code class="prompt">#</code> <strong class=
                   3235: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    3236: </pre>
                   3237: 
                   3238:             <p>At the end of the bulk build, you will get a summary
                   3239:             via mail, and find build logs in the directory
1.14      xtraeme  3240:             specified by <code class="varname">FTP</code> in the
                   3241:             <code class="filename">build.conf</code> file.</p>
1.1       grant    3242:           </div>
                   3243: 
                   3244:           <div class="sect2" lang="en" xml:lang="en">
                   3245:             <div class="titlepage">
                   3246:               <div>
                   3247:                 <div>
1.24    ! wiz      3248:                   <h3 class="title"><a name="id2624252" id=
        !          3249:                   "id2624252"></a>5.3.4.&nbsp;What it does</h3>
1.1       grant    3250:                 </div>
                   3251:               </div>
                   3252:             </div>
                   3253: 
                   3254:             <p>The bulk builds consist of three steps:</p>
                   3255: 
                   3256:             <div class="variablelist">
                   3257:               <dl>
                   3258:                 <dt><span class="term">1. pre-build</span></dt>
                   3259: 
                   3260:                 <dd>
                   3261:                   <p>The script updates your pkgsrc tree via
                   3262:                   (anon)cvs, then cleans out any broken distfiles,
                   3263:                   and removes all packages installed.</p>
                   3264:                 </dd>
                   3265: 
                   3266:                 <dt><span class="term">2. the bulk
                   3267:                 build</span></dt>
                   3268: 
                   3269:                 <dd>
                   3270:                   <p>This is basically &#8220;<span class=
                   3271:                   "quote">make bulk-package</span>&#8221; with an
                   3272:                   optimised order in which packages will be built.
                   3273:                   Packages that don't require other packages will
                   3274:                   be built first, and packages with many
                   3275:                   dependencies will be built later.</p>
                   3276:                 </dd>
                   3277: 
                   3278:                 <dt><span class="term">3. post-build</span></dt>
                   3279: 
                   3280:                 <dd>
                   3281:                   <p>Generates a report that's placed in the
1.14      xtraeme  3282:                   directory specified in the <code class=
                   3283:                   "filename">build.conf</code> file named
                   3284:                   <code class="filename">broken.html</code>, a
                   3285:                   short version of that report will also be mailed
                   3286:                   to the build's admin.</p>
1.1       grant    3287:                 </dd>
                   3288:               </dl>
                   3289:             </div>
                   3290: 
                   3291:             <p>During the build, a list of broken packages will be
1.14      xtraeme  3292:             compiled in <code class=
                   3293:             "filename">/usr/pkgsrc/.broken</code> (or <code class=
                   3294:             "filename">.../.broken.${MACHINE}</code> if
                   3295:             <code class="varname">OBJMACHINE</code> is set),
                   3296:             individual build logs of broken builds can be found in
                   3297:             the package's directory. These files are used by the
                   3298:             bulk-targets to mark broken builds to not waste time
                   3299:             trying to rebuild them, and they can be used to debug
                   3300:             these broken package builds later.</p>
1.1       grant    3301:           </div>
                   3302: 
                   3303:           <div class="sect2" lang="en" xml:lang="en">
                   3304:             <div class="titlepage">
                   3305:               <div>
                   3306:                 <div>
1.24    ! wiz      3307:                   <h3 class="title"><a name="id2624309" id=
        !          3308:                   "id2624309"></a>5.3.5.&nbsp;Disk space
1.1       grant    3309:                   requirements</h3>
                   3310:                 </div>
                   3311:               </div>
                   3312:             </div>
                   3313: 
                   3314:             <p>Currently, roughly the following requirements are
                   3315:             valid for NetBSD 2.0/i386:</p>
                   3316: 
                   3317:             <div class="itemizedlist">
                   3318:               <ul type="disc">
                   3319:                 <li>
                   3320:                   <p>10 GB - distfiles (NFS ok)</p>
                   3321:                 </li>
                   3322: 
                   3323:                 <li>
                   3324:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   3325:                 </li>
                   3326: 
                   3327:                 <li>
                   3328:                   <p>5 GB - temp space for compiling (local disk
                   3329:                   recommended)</p>
                   3330:                 </li>
                   3331:               </ul>
                   3332:             </div>
                   3333: 
                   3334:             <p>Note that all pkgs will be de-installed as soon as
                   3335:             they are turned into a binary package, and that sources
                   3336:             are removed, so there is no excessively huge demand to
                   3337:             disk space. Afterwards, if the package is needed again,
                   3338:             it will be installed via <a href=
                   3339:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3340:             <span class="citerefentry"><span class=
                   3341:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   3342:             building again, so there are no cycles wasted by
                   3343:             recompiling.</p>
                   3344:           </div>
                   3345: 
                   3346:           <div class="sect2" lang="en" xml:lang="en">
                   3347:             <div class="titlepage">
                   3348:               <div>
                   3349:                 <div>
1.24    ! wiz      3350:                   <h3 class="title"><a name="id2624336" id=
        !          3351:                   "id2624336"></a>5.3.6.&nbsp;Setting up a sandbox
1.1       grant    3352:                   for chroot'ed builds</h3>
                   3353:                 </div>
                   3354:               </div>
                   3355:             </div>
                   3356: 
1.12      agc      3357:             <p>If you don't want all the packages nuked from a
                   3358:             machine (rendering it useless for anything but pkg
1.23      wiz      3359:             compiling), there is the possibility of doing the
                   3360:             package bulk build inside a chroot environment.</p>
1.12      agc      3361: 
                   3362:             <p>The first step is to set up a chroot sandbox, e.g.
1.14      xtraeme  3363:             <code class="filename">/usr/sandbox</code>. This can be
1.12      agc      3364:             done by using null mounts, or manually.</p>
                   3365: 
1.14      xtraeme  3366:             <p>There is a shell script called <code class=
                   3367:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   3368:             set up the sandbox environment using null mounts. It
                   3369:             will also create a script called <code class=
                   3370:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      3371:             environment, which will allow the null mounts to be
1.14      xtraeme  3372:             activated using the <span><strong class=
                   3373:             "command">sandbox mount</strong></span> command and
                   3374:             deactivated using the <span><strong class=
                   3375:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      3376: 
                   3377:             <p>To set up a sandbox environment by hand, after
                   3378:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  3379:             doing a <span><strong class="command">make distribution
                   3380:             DESTDIR=/usr/sandbox</strong></span> in <code class=
                   3381:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      3382:             items are present and properly configured:</p>
1.1       grant    3383: 
                   3384:             <div class="procedure">
                   3385:               <ol type="1">
                   3386:                 <li>
                   3387:                   <p>Kernel</p>
                   3388:                   <pre class="screen">
1.14      xtraeme  3389: <code class="prompt">#</code> <strong class=
                   3390: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    3391: </pre>
                   3392:                 </li>
                   3393: 
                   3394:                 <li>
1.14      xtraeme  3395:                   <p><code class="filename">/dev/*</code></p>
1.1       grant    3396:                   <pre class="screen">
1.14      xtraeme  3397: <code class="prompt">#</code> <strong class=
                   3398: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    3399: </pre>
                   3400:                 </li>
                   3401: 
                   3402:                 <li>
1.14      xtraeme  3403:                   <p><code class="filename">/etc/resolv.conf</code>
1.1       grant    3404:                   (for <a xmlns=
                   3405:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3406:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20      ben      3407:                   class="pkgname">security/smtpd</a> and mail):</p>
1.1       grant    3408:                   <pre class="screen">
1.14      xtraeme  3409: <code class="prompt">#</code> <strong class=
                   3410: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    3411: </pre>
                   3412:                 </li>
                   3413: 
                   3414:                 <li>
                   3415:                   <p>Working(!) mail config (hostname,
                   3416:                   sendmail.cf):</p>
                   3417:                   <pre class="screen">
1.14      xtraeme  3418: <code class="prompt">#</code> <strong class=
                   3419: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    3420: </pre>
                   3421:                 </li>
                   3422: 
                   3423:                 <li>
1.14      xtraeme  3424:                   <p><code class="filename">/etc/localtime</code>
                   3425:                   (for <a xmlns=
1.1       grant    3426:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3427:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20      ben      3428:                   class="pkgname">security/smtpd</a>):</p>
1.1       grant    3429:                   <pre class="screen">
1.14      xtraeme  3430: <code class="prompt">#</code> <strong class=
                   3431: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    3432: </pre>
                   3433:                 </li>
                   3434: 
                   3435:                 <li>
1.14      xtraeme  3436:                   <p><code class="filename">/usr/src</code> (system
1.1       grant    3437:                   sources, for <a xmlns=
                   3438:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3439:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.20      ben      3440:                   class="pkgname">sysutils/aperture</a>, <a xmlns=
                   3441:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3442:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
                   3443:                   class="pkgname">net/ppp-mppe</a>):</p>
1.1       grant    3444:                   <pre class="screen">
1.14      xtraeme  3445: <code class="prompt">#</code> <strong class=
                   3446: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   3447: <code class="prompt">#</code> <strong class=
1.23      wiz      3448: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    3449: </pre>
                   3450:                 </li>
                   3451: 
                   3452:                 <li>
1.14      xtraeme  3453:                   <p>Create <code class=
                   3454:                   "filename">/var/db/pkg</code> (not part of
                   3455:                   default install):</p>
1.1       grant    3456:                   <pre class="screen">
1.14      xtraeme  3457: <code class="prompt">#</code> <strong class=
                   3458: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    3459: </pre>
                   3460:                 </li>
                   3461: 
                   3462:                 <li>
1.14      xtraeme  3463:                   <p>Create <code class="filename">/usr/pkg</code>
                   3464:                   (not part of default install):</p>
1.1       grant    3465:                   <pre class="screen">
1.14      xtraeme  3466: <code class="prompt">#</code> <strong class=
                   3467: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    3468: </pre>
                   3469:                 </li>
                   3470: 
                   3471:                 <li>
1.14      xtraeme  3472:                   <p>Checkout pkgsrc via cvs into <code class=
                   3473:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    3474:                   <pre class="screen">
1.14      xtraeme  3475: <code class="prompt">#</code> <strong class=
                   3476: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   3477: <code class="prompt">#</code> <strong class=
                   3478: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    3479: </pre>
                   3480: 
                   3481:                   <p>Do not mount/link this to the copy of your
                   3482:                   pkgsrc tree you do development in, as this will
                   3483:                   likely cause problems!</p>
                   3484:                 </li>
                   3485: 
                   3486:                 <li>
1.14      xtraeme  3487:                   <p>Make <code class=
                   3488:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
                   3489:                   and <code class="filename">.../distfiles</code>
                   3490:                   point somewhere appropriate. NFS- and/or
                   3491:                   nullfs-mounts may come in handy!</p>
1.1       grant    3492:                 </li>
                   3493: 
                   3494:                 <li>
1.14      xtraeme  3495:                   <p>Edit <code class=
                   3496:                   "filename">/etc/mk.conf</code>, see <a href=
                   3497:                   "#binary.mk.conf" title=
1.1       grant    3498:                   "5.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;5.3.1.1,
                   3499:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   3500:                 </li>
                   3501: 
                   3502:                 <li>
1.14      xtraeme  3503:                   <p>Adjust <code class=
                   3504:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    3505:                   needs.</p>
                   3506:                 </li>
                   3507: 
                   3508:                 <li>
1.14      xtraeme  3509:                   <p>If you have set <code class=
                   3510:                   "varname">CVS_USER</code> in <code class=
                   3511:                   "filename">build.conf</code>, make sure that
                   3512:                   account exists and can do a <span><strong class=
                   3513:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    3514:                   properly!</p>
                   3515:                 </li>
                   3516:               </ol>
                   3517:             </div>
                   3518: 
                   3519:             <p>When the chroot sandbox is setup, you can start the
                   3520:             build with the following steps:</p>
                   3521:             <pre class="screen">
1.14      xtraeme  3522: <code class="prompt">#</code> <strong class=
                   3523: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   3524: <code class="prompt">#</code> <strong class=
                   3525: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    3526: </pre>
                   3527: 
                   3528:             <p>This will just jump inside the sandbox and start
                   3529:             building. At the end of the build, mail will be sent
                   3530:             with the results of the build. Created binary pkgs will
1.14      xtraeme  3531:             be in <code class=
                   3532:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    3533:             (wherever that points/mounts to/from).</p>
                   3534:           </div>
                   3535: 
                   3536:           <div class="sect2" lang="en" xml:lang="en">
                   3537:             <div class="titlepage">
                   3538:               <div>
                   3539:                 <div>
1.24    ! wiz      3540:                   <h3 class="title"><a name="id2624865" id=
        !          3541:                   "id2624865"></a>5.3.7.&nbsp;Building a partial
1.1       grant    3542:                   set of packages</h3>
                   3543:                 </div>
                   3544:               </div>
                   3545:             </div>
                   3546: 
                   3547:             <p>In addition to building a complete set of all
1.14      xtraeme  3548:             packages in pkgsrc, the <code class=
                   3549:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   3550:             used to build a subset of the packages contained in
                   3551:             pkgsrc. By setting defining <code class=
                   3552:             "varname">SPECIFIC_PKGS</code> in <code class=
                   3553:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    3554: 
                   3555:             <div class="itemizedlist">
                   3556:               <ul type="disc">
                   3557:                 <li>
                   3558:                   <p>SITE_SPECIFIC_PKGS</p>
                   3559:                 </li>
                   3560: 
                   3561:                 <li>
                   3562:                   <p>HOST_SPECIFIC_PKGS</p>
                   3563:                 </li>
                   3564: 
                   3565:                 <li>
                   3566:                   <p>GROUP_SPECIFIC_PKGS</p>
                   3567:                 </li>
                   3568: 
                   3569:                 <li>
                   3570:                   <p>USER_SPECIFIC_PKGS</p>
                   3571:                 </li>
                   3572:               </ul>
                   3573:             </div>
                   3574: 
                   3575:             <p>will define the set of packages which should be
                   3576:             built. The bulk build code will also include any
                   3577:             packages which are needed as dependencies for the
                   3578:             explicitly listed packages.</p>
                   3579: 
                   3580:             <p>One use of this is to do a bulk build with
1.14      xtraeme  3581:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    3582:             sandbox periodically to have a complete set of the
                   3583:             binary packages needed for your site available without
                   3584:             the overhead of building extra packages that are not
                   3585:             needed.</p>
                   3586:           </div>
1.13      hubertf  3587: 
                   3588:           <div class="sect2" lang="en" xml:lang="en">
                   3589:             <div class="titlepage">
                   3590:               <div>
                   3591:                 <div>
                   3592:                   <h3 class="title"><a name="bulk-upload" id=
                   3593:                   "bulk-upload"></a>5.3.8.&nbsp;Uploading results
                   3594:                   of a bulk build</h3>
                   3595:                 </div>
                   3596:               </div>
                   3597:             </div>
                   3598: 
                   3599:             <p>This section describes how pkgsrc developers can
                   3600:             upload binary pkgs built by bulk builds to
                   3601:             ftp.NetBSD.org.</p>
                   3602: 
1.17      sketch   3603:             <p>If you would like to automatically create checksum
                   3604:             files for the binary packages you intend to upload,
                   3605:             remember to set <code class="varname">MKSUMS=yes</code>
                   3606:             in your <code class=
                   3607:             "filename">mk/bulk/build.conf</code>.</p>
                   3608: 
                   3609:             <p>If you would like to PGP sign the checksum files
                   3610:             (highly recommended!), remember to set <code class=
                   3611:             "varname">SIGN_AS=username@NetBSD.org</code> in your
                   3612:             <code class="filename">mk/bulk/build.conf</code>. This
1.23      wiz      3613:             will prompt you for your GPG password to sign the files
1.17      sketch   3614:             before uploading everything.</p>
                   3615: 
                   3616:             <p>Then, make sure that you have <code class=
1.14      xtraeme  3617:             "varname">RSYNC_DST</code> set properly in your
                   3618:             <code class="filename">mk/bulk/build.conf</code> file,
                   3619:             i.e. adjust it to something like one of the
                   3620:             following:</p>
1.13      hubertf  3621:             <pre class="screen">
                   3622: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3623: </pre>
                   3624: 
1.23      wiz      3625:             <p>Please use appropviate values for "pkgsrc-200xQy",
1.13      hubertf  3626:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  3627:             ftp.NetBSD.org is different from <code class=
                   3628:             "varname">CVS_USER</code>, write your login directly
                   3629:             into the variable, e.g. my local account is "feyrer",
                   3630:             but for my login "hubertf", I use:</p>
1.13      hubertf  3631:             <pre class="screen">
                   3632: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3633: </pre>
                   3634: 
1.14      xtraeme  3635:             <p>A separate <code class="filename">upload</code>
1.13      hubertf  3636:             directory is used here to allow "closing" the directory
                   3637:             during upload. To do so, run the following command on
                   3638:             ftp.NetBSD.org next:</p>
                   3639:             <pre class="screen">
1.14      xtraeme  3640: nbftp% <strong class=
                   3641: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  3642: </pre>
                   3643: 
1.14      xtraeme  3644:             <p>Please note that <code class=
                   3645:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  3646:             appropriate for packages for the NetBSD operating
                   3647:             system. Binary packages for other operating systems
1.14      xtraeme  3648:             should go into <code class=
                   3649:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  3650: 
                   3651:             <p>Before uploading the binary pkgs, ssh authentication
1.23      wiz      3652:             needs to be set up. This example shows how to setup
1.13      hubertf  3653:             temporary keys for the root account <span class=
                   3654:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   3655:             that no keys should be present there usually):</p>
                   3656:             <pre class="screen">
1.14      xtraeme  3657: <code class="prompt">#</code> <strong class=
                   3658: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   3659: chroot-<code class="prompt">#</code> <strong class=
                   3660: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   3661: chroot-<code class="prompt">#</code> <strong class=
                   3662: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   3663: chroot-<code class="prompt">#</code> <strong class=
                   3664: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  3665: </pre>
                   3666: 
1.14      xtraeme  3667:             <p>Now take the output of <code class=
                   3668:             "filename">id-dsa.pub</code> and append it to your
                   3669:             <code class="filename">~/.ssh/authorized_keys</code>
1.17      sketch   3670:             file on ftp.NetBSD.org. You can remove the key after
1.14      xtraeme  3671:             the upload is done!</p>
1.13      hubertf  3672: 
                   3673:             <p>Next, test if your ssh connection really works:</p>
                   3674:             <pre class="screen">
1.14      xtraeme  3675: chroot-<code class="prompt">#</code> <strong class=
                   3676: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  3677: </pre>
                   3678: 
                   3679:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   3680: 
                   3681:             <p>Now after all this works, you can exit the sandbox
                   3682:             and start the upload:</p>
                   3683:             <pre class="screen">
1.14      xtraeme  3684: chroot-<code class="prompt">#</code> <strong class=
                   3685: "userinput"><code>exit</code></strong>        
                   3686: <code class="prompt">#</code> <strong class=
                   3687: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   3688: <code class="prompt">#</code> <strong class=
                   3689: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  3690: </pre>
                   3691: 
                   3692:             <p>The upload process may take quite some time. Use
1.24    ! wiz      3693:             <a href=
        !          3694:             "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
        !          3695:             <span class="citerefentry"><span class=
        !          3696:             "refentrytitle">ls</span>(1)</span></a> or <a href=
        !          3697:             "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
        !          3698:             <span class="citerefentry"><span class=
        !          3699:             "refentrytitle">du</span>(1)</span></a> on the FTP
        !          3700:             server to monitor progress of the upload. The upload
        !          3701:             script will take care of not uploading restricted
        !          3702:             packages and putting vulnerable packages into the
        !          3703:             <code class="filename">vulnerable</code>
        !          3704:             subdirectory.</p>
1.13      hubertf  3705: 
                   3706:             <p>After the upload has ended, first thing is to revoke
                   3707:             ssh access:</p>
                   3708:             <pre class="screen">
1.14      xtraeme  3709: nbftp% <strong class=
                   3710: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  3711: Gdd:x! 
                   3712: </pre>
                   3713: 
                   3714:             <p>Use whatever is needed to remove the key you've
                   3715:             entered before! Last, move the uploaded packages out of
1.14      xtraeme  3716:             the <code class="filename">upload</code> directory to
                   3717:             have them accessible to everyone:</p>
1.13      hubertf  3718:             <pre class="screen">
1.14      xtraeme  3719: nbftp% <strong class=
                   3720: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   3721: nbftp% <strong class=
                   3722: "userinput"><code>mv upload/* .</code></strong>
                   3723: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   3724: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  3725: </pre>
                   3726:           </div>
1.1       grant    3727:         </div>
                   3728: 
                   3729:         <div class="sect1" lang="en" xml:lang="en">
                   3730:           <div class="titlepage">
                   3731:             <div>
                   3732:               <div>
                   3733:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      3734:                 "id2625321" id="id2625321"></a>5.4.&nbsp;Creating a
1.1       grant    3735:                 multiple CD-ROM packages collection</h2>
                   3736:               </div>
                   3737:             </div>
                   3738:           </div>
                   3739: 
                   3740:           <p>After your pkgsrc bulk-build has completed, you may
                   3741:           wish to create a CD-ROM set of the resulting binary
                   3742:           packages to assist in installing packages on other
                   3743:           machines. The <a xmlns=
                   3744:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3745:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.20      ben      3746:           class="pkgname">pkgtools/cdpack</a> package provides a
                   3747:           simple tool for creating the ISO 9660 images.
                   3748:           <span><strong class="command">cdpack</strong></span>
                   3749:           arranges the packages on the CD-ROMs in a way that keeps
                   3750:           all the dependencies for given package on the same CD as
                   3751:           that package.</p>
1.1       grant    3752: 
                   3753:           <div class="sect2" lang="en" xml:lang="en">
                   3754:             <div class="titlepage">
                   3755:               <div>
                   3756:                 <div>
1.24    ! wiz      3757:                   <h3 class="title"><a name="id2625336" id=
        !          3758:                   "id2625336"></a>5.4.1.&nbsp;Example of
1.1       grant    3759:                   cdpack</h3>
                   3760:                 </div>
                   3761:               </div>
                   3762:             </div>
                   3763: 
                   3764:             <p>Complete documentation for cdpack is found in the
                   3765:             cdpack(1) manpage. The following short example assumes
1.14      xtraeme  3766:             that the binary packages are left in <code class=
                   3767:             "filename">/usr/pkgsrc/packages/All</code> and that
                   3768:             sufficient disk space exists in <code class=
                   3769:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    3770:             <pre class="screen">
1.14      xtraeme  3771: <code class="prompt">#</code> <strong class=
                   3772: "userinput"><code>mkdir /u2/images</code></strong>
                   3773: <code class="prompt">#</code> <strong class=
                   3774: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   3775: <code class="prompt">#</code> <strong class=
                   3776: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3777: </pre>
                   3778: 
                   3779:             <p>If you wish to include a common set of files
1.14      xtraeme  3780:             (<code class="filename">COPYRIGHT</code>, <code class=
                   3781:             "filename">README</code>, etc.) on each CD in the
1.1       grant    3782:             collection, then you need to create a directory which
                   3783:             contains these files. e.g.</p>
                   3784:             <pre class="screen">
1.14      xtraeme  3785: <code class="prompt">#</code> <strong class=
                   3786: "userinput"><code>mkdir /tmp/common</code></strong>
                   3787: <code class="prompt">#</code> <strong class=
                   3788: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   3789: <code class="prompt">#</code> <strong class=
                   3790: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   3791: <code class="prompt">#</code> <strong class=
                   3792: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   3793: <code class="prompt">#</code> <strong class=
                   3794: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   3795: <code class="prompt">#</code> <strong class=
                   3796: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   3797: <code class="prompt">#</code> <strong class=
                   3798: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    3799: </pre>
                   3800: 
                   3801:             <p>Now create the images:</p>
                   3802:             <pre class="screen">
1.14      xtraeme  3803: <code class="prompt">#</code> <strong class=
                   3804: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3805: </pre>
                   3806: 
1.14      xtraeme  3807:             <p>Each image will contain <code class=
                   3808:             "filename">README</code>, <code class=
                   3809:             "filename">COPYING</code>, and <code class=
                   3810:             "filename">bin/myscript</code> in their root
1.1       grant    3811:             directories.</p>
                   3812:           </div>
                   3813:         </div>
                   3814:       </div>
                   3815: 
                   3816:       <div class="chapter" lang="en" xml:lang="en">
                   3817:         <div class="titlepage">
                   3818:           <div>
                   3819:             <div>
                   3820:               <h2 class="title"><a name="faq" id=
                   3821:               "faq"></a>Chapter&nbsp;6.&nbsp;Frequently Asked
                   3822:               Questions</h2>
                   3823:             </div>
                   3824:           </div>
                   3825:         </div>
                   3826: 
                   3827:         <div class="toc">
                   3828:           <p><b>Table of Contents</b></p>
                   3829: 
                   3830:           <dl>
1.24    ! wiz      3831:             <dt><span class="sect1"><a href="#id2625528">6.1. Are
1.18      xtraeme  3832:             there any mailing lists for pkg-related
1.1       grant    3833:             discussion?</a></span></dt>
                   3834: 
1.24    ! wiz      3835:             <dt><span class="sect1"><a href="#id2625662">6.2.
1.1       grant    3836:             Where's the pkgviews documentation?</a></span></dt>
                   3837: 
1.5       hubertf  3838:             <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    3839:             Utilities for package management
                   3840:             (pkgtools)</a></span></dt>
                   3841: 
1.24    ! wiz      3842:             <dt><span class="sect1"><a href="#id2625984">6.4. How
1.1       grant    3843:             to use pkgsrc as non-root</a></span></dt>
                   3844: 
1.24    ! wiz      3845:             <dt><span class="sect1"><a href="#id2625995">6.5. How
1.15      xtraeme  3846:             to resume transfers when fetching
                   3847:             distfiles?</a></span></dt>
1.14      xtraeme  3848: 
1.24    ! wiz      3849:             <dt><span class="sect1"><a href="#id2626045">6.6. How
1.1       grant    3850:             can I install/use XFree86 from pkgsrc?</a></span></dt>
                   3851: 
1.24    ! wiz      3852:             <dt><span class="sect1"><a href="#id2626073">6.7. How
1.1       grant    3853:             can I install/use X.org from pkgsrc?</a></span></dt>
                   3854: 
1.24    ! wiz      3855:             <dt><span class="sect1"><a href="#id2626101">6.8. How
1.1       grant    3856:             to fetch files from behind a firewall</a></span></dt>
                   3857: 
1.24    ! wiz      3858:             <dt><span class="sect1"><a href="#id2626115">6.9. How
1.14      xtraeme  3859:             do I tell <span><strong class="command">make
                   3860:             fetch</strong></span> to do passive
                   3861:             FTP?</a></span></dt>
1.1       grant    3862: 
1.24    ! wiz      3863:             <dt><span class="sect1"><a href="#id2626166">6.10. How
1.1       grant    3864:             to fetch all distfiles at once</a></span></dt>
                   3865: 
1.24    ! wiz      3866:             <dt><span class="sect1"><a href="#id2626313">6.11. What
1.14      xtraeme  3867:             does &#8220;<span class="quote">Don't know how to make
                   3868:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    3869:             mean?</a></span></dt>
                   3870: 
1.24    ! wiz      3871:             <dt><span class="sect1"><a href="#id2626352">6.12. What
1.14      xtraeme  3872:             does &#8220;<span class="quote">Could not find
                   3873:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    3874: 
1.24    ! wiz      3875:             <dt><span class="sect1"><a href="#id2626409">6.13.
1.1       grant    3876:             Using 'sudo' with pkgsrc</a></span></dt>
                   3877: 
1.14      xtraeme  3878:             <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    3879:             Configuration files handling and
                   3880:             placement</a></span></dt>
                   3881: 
1.14      xtraeme  3882:             <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1       grant    3883:             Automated security checks</a></span></dt>
                   3884:           </dl>
                   3885:         </div>
                   3886: 
                   3887:         <p>This section contains hints, tips &amp; tricks on
                   3888:         special things in pkgsrc that we didn't find a better place
                   3889:         for in the previous chapters, and it contains items for
                   3890:         both pkgsrc users and developers.</p>
                   3891: 
                   3892:         <div class="sect1" lang="en" xml:lang="en">
                   3893:           <div class="titlepage">
                   3894:             <div>
                   3895:               <div>
                   3896:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      3897:                 "id2625528" id="id2625528"></a>6.1.&nbsp;Are there
1.18      xtraeme  3898:                 any mailing lists for pkg-related discussion?</h2>
1.1       grant    3899:               </div>
                   3900:             </div>
                   3901:           </div>
                   3902: 
1.18      xtraeme  3903:           <p>The following mailing lists may be of interest to
                   3904:           pkgsrc users:</p>
                   3905: 
                   3906:           <div class="itemizedlist">
                   3907:             <ul type="disc">
                   3908:               <li>
                   3909:                 <p><a href=
                   3910:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.20      ben      3911:                 target="_top">pkgsrc-bugs</a> -- a list where
                   3912:                 problem reports related to pkgsrc are sent and
                   3913:                 discussed</p>
1.18      xtraeme  3914:               </li>
                   3915: 
                   3916:               <li>
                   3917:                 <p><a href=
                   3918:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.20      ben      3919:                 target="_top">pkgsrc-bulk</a> -- a list where the
                   3920:                 results of pkgsrc bulk builds are sent and
                   3921:                 discussed</p>
1.18      xtraeme  3922:               </li>
                   3923: 
                   3924:               <li>
                   3925:                 <p><a href=
                   3926:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.20      ben      3927:                 target="_top">pkgsrc-changes</a> -- a list where
                   3928:                 all commit messages to pkgsrc are sent</p>
1.18      xtraeme  3929:               </li>
                   3930: 
                   3931:               <li>
                   3932:                 <p><a href=
                   3933:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.20      ben      3934:                 target="_top">tech-pkg</a> -- a general discussion
                   3935:                 list for all things related to pkgsrc</p>
1.18      xtraeme  3936:               </li>
                   3937:             </ul>
                   3938:           </div>
                   3939: 
                   3940:           <p>To subscribe, do:</p>
1.1       grant    3941:           <pre class="programlisting">
1.18      xtraeme  3942: <code class="prompt">%</code> echo subscribe <em class=
                   3943: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    3944: </pre>
                   3945: 
1.18      xtraeme  3946:           <p>Archives for all these mailing lists are available
                   3947:           from <a href="http://mail-index.NetBSD.org/" target=
                   3948:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    3949:         </div>
                   3950: 
                   3951:         <div class="sect1" lang="en" xml:lang="en">
                   3952:           <div class="titlepage">
                   3953:             <div>
                   3954:               <div>
                   3955:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      3956:                 "id2625662" id="id2625662"></a>6.2.&nbsp;Where's
1.1       grant    3957:                 the pkgviews documentation?</h2>
                   3958:               </div>
                   3959:             </div>
                   3960:           </div>
                   3961: 
                   3962:           <p>Pkgviews is tightly integrated with buildlink. You can
1.14      xtraeme  3963:           find a pkgviews User's guide in <code class=
                   3964:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    3965:         </div>
                   3966: 
                   3967:         <div class="sect1" lang="en" xml:lang="en">
                   3968:           <div class="titlepage">
                   3969:             <div>
                   3970:               <div>
                   3971:                 <h2 class="title" style="clear: both"><a name=
1.5       hubertf  3972:                 "faq-pkgtools" id=
                   3973:                 "faq-pkgtools"></a>6.3.&nbsp;Utilities for package
                   3974:                 management (pkgtools)</h2>
1.1       grant    3975:               </div>
                   3976:             </div>
                   3977:           </div>
                   3978: 
1.14      xtraeme  3979:           <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1       grant    3980:           directory pkgtools contains a number of useful utilities
                   3981:           for both users and developers of pkgsrc. This section
                   3982:           attempts only to make the reader aware of the utilities
                   3983:           and when they might be useful, and not to duplicate the
                   3984:           documentation that comes with each package.</p>
                   3985: 
                   3986:           <p>Utilities used by pkgsrc (automatically installed when
                   3987:           needed):</p>
                   3988: 
                   3989:           <div class="itemizedlist">
                   3990:             <ul type="disc">
                   3991:               <li>
                   3992:                 <p><a xmlns=
                   3993:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3994:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.20      ben      3995:                 class="pkgname">pkgtools/x11-links</a>: symlinks
                   3996:                 for use by buildlink</p>
1.1       grant    3997:               </li>
                   3998:             </ul>
                   3999:           </div>
                   4000: 
                   4001:           <p>OS tool augmentation (automatically installed when
                   4002:           needed):</p>
                   4003: 
                   4004:           <div class="itemizedlist">
                   4005:             <ul type="disc">
                   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/digest/README.html"
1.20      ben      4010:                 class="pkgname">pkgtools/digest</a>: calculates
                   4011:                 SHA1 checksums (and other kinds)</p>
1.1       grant    4012:               </li>
                   4013: 
                   4014:               <li>
                   4015:                 <p><a xmlns=
                   4016:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4017:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.20      ben      4018:                 class="pkgname">pkgtools/libnbcompat</a>: compat
                   4019:                 library for pkg tools</p>
1.1       grant    4020:               </li>
                   4021: 
                   4022:               <li>
                   4023:                 <p><a xmlns=
                   4024:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4025:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.20      ben      4026:                 class="pkgname">pkgtools/mtree</a>: installed on
                   4027:                 non-BSD systems due to lack of native mtree</p>
1.1       grant    4028:               </li>
                   4029: 
                   4030:               <li>
                   4031:                 <p><a xmlns=
                   4032:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4033:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4034:                 class="pkgname">pkgtools/pkg_install</a>:
                   4035:                 up-to-date replacement for /usr/sbin/pkg_install,
                   4036:                 or for use on operating systems where pkg_install
                   4037:                 is not present</p>
1.1       grant    4038:               </li>
                   4039:             </ul>
                   4040:           </div>
                   4041: 
                   4042:           <p>Utilities used by pkgsrc (not automatically
                   4043:           installed):</p>
                   4044: 
                   4045:           <div class="itemizedlist">
                   4046:             <ul type="disc">
                   4047:               <li>
                   4048:                 <p><a xmlns=
                   4049:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4050:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.20      ben      4051:                 class="pkgname">pkgtools/pkg_tarup</a>: create a
                   4052:                 binary package from an already-installed package.
                   4053:                 used by 'make replace' to save the old package</p>
1.1       grant    4054:               </li>
                   4055: 
                   4056:               <li>
                   4057:                 <p><a xmlns=
                   4058:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  4059:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.20      ben      4060:                 class="pkgname">pkgtools/dfdisk</a>: adds extra
                   4061:                 functionality to pkgsrc, allowing it to fetch
                   4062:                 distfiles from multiple locations. It currently
                   4063:                 supports the following methods: multiple CD-ROMs
                   4064:                 and network FTP/HTTP connections.</p>
1.5       hubertf  4065:               </li>
                   4066: 
                   4067:               <li>
                   4068:                 <p><a xmlns=
                   4069:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    4070:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20      ben      4071:                 class="pkgname">pkgtools/xpkgwedge</a>: put X11
                   4072:                 packages someplace else (enabled by default)</p>
1.1       grant    4073:               </li>
1.5       hubertf  4074: 
                   4075:               <li>
                   4076:                 <p><a xmlns=
                   4077:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4078:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20      ben      4079:                 class="pkgname">devel/cpuflags</a>: will determine
                   4080:                 the best compiler flags to optimise code for your
                   4081:                 current CPU and compiler.</p>
1.5       hubertf  4082:               </li>
1.1       grant    4083:             </ul>
                   4084:           </div>
                   4085: 
                   4086:           <p>Utilities for keeping track of installed packages,
                   4087:           being up to date, etc:</p>
                   4088: 
                   4089:           <div class="itemizedlist">
                   4090:             <ul type="disc">
                   4091:               <li>
                   4092:                 <p><a xmlns=
                   4093:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4094:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.20      ben      4095:                 class="pkgname">pkgtools/pkg_chk</a>: installs
                   4096:                 pkg_chk, which reports on packages whose installed
                   4097:                 versions do not match the latest pkgsrc entries</p>
1.1       grant    4098:               </li>
                   4099: 
                   4100:               <li>
                   4101:                 <p><a xmlns=
                   4102:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4103:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.20      ben      4104:                 class="pkgname">pkgtools/pkgdep</a>: makes
                   4105:                 dependency graphs of packages, to aid in choosing a
                   4106:                 strategy for updating</p>
1.1       grant    4107:               </li>
                   4108: 
                   4109:               <li>
                   4110:                 <p><a xmlns=
                   4111:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4112:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.20      ben      4113:                 class="pkgname">pkgtools/pkgdepgraph</a>: make
                   4114:                 graph from above (uses graphviz)</p>
1.1       grant    4115:               </li>
                   4116: 
                   4117:               <li>
                   4118:                 <p><a xmlns=
                   4119:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4120:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      4121:                 class="pkgname">pkgtools/pkglint</a>: This provides
                   4122:                 two distinct abilities: check a pkgsrc entry for
                   4123:                 correctness (pkglint) check for and remove
                   4124:                 out-of-date distfiles and binary packages
                   4125:                 (lintpkgsrc)</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/pkgsurvey/README.html"
1.20      ben      4132:                 class="pkgname">pkgtools/pkgsurvey</a>: report what
                   4133:                 packages you have installed</p>
1.1       grant    4134:               </li>
                   4135:             </ul>
                   4136:           </div>
                   4137: 
                   4138:           <p>Utilities for people maintaining or creating
                   4139:           individual packages:</p>
                   4140: 
                   4141:           <div class="itemizedlist">
                   4142:             <ul type="disc">
                   4143:               <li>
                   4144:                 <p><a xmlns=
                   4145:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4146:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      4147:                 class="pkgname">pkgtools/pkgdiff</a>: automate
                   4148:                 making and maintaining patches for a package
                   4149:                 (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1       grant    4150:               </li>
                   4151: 
                   4152:               <li>
                   4153:                 <p><a xmlns=
                   4154:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4155:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20      ben      4156:                 class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
                   4157:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4158:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
                   4159:                 class="pkgname">pkgtools/url2pkg</a>: aids in
                   4160:                 converting to pkgsrc</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/gensolpkg/README.html"
1.20      ben      4167:                 class="pkgname">pkgtools/gensolpkg</a>: convert
                   4168:                 pkgsrc to a Solaris package</p>
1.1       grant    4169:               </li>
                   4170:             </ul>
                   4171:           </div>
                   4172: 
                   4173:           <p>Utilities for people maintaining pkgsrc (or more
                   4174:           obscure pkg utilities)</p>
                   4175: 
                   4176:           <div class="itemizedlist">
                   4177:             <ul type="disc">
                   4178:               <li>
                   4179:                 <p><a xmlns=
                   4180:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4181:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.20      ben      4182:                 class="pkgname">pkgtools/pkgconflict</a>: find
                   4183:                 packages that conflict but aren't marked as
                   4184:                 such</p>
1.1       grant    4185:               </li>
                   4186: 
                   4187:               <li>
                   4188:                 <p><a xmlns=
                   4189:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4190:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.20      ben      4191:                 class="pkgname">pkgtools/pkg_comp</a>: build
                   4192:                 packages in a chrooted area</p>
1.1       grant    4193:               </li>
                   4194: 
                   4195:               <li>
                   4196:                 <p><a xmlns=
                   4197:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4198:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.20      ben      4199:                 class="pkgname">pkgtools/libkver</a>: spoof kernel
                   4200:                 version for chrooted cross builds</p>
1.1       grant    4201:               </li>
                   4202:             </ul>
                   4203:           </div>
                   4204:         </div>
                   4205: 
                   4206:         <div class="sect1" lang="en" xml:lang="en">
                   4207:           <div class="titlepage">
                   4208:             <div>
                   4209:               <div>
                   4210:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      4211:                 "id2625984" id="id2625984"></a>6.4.&nbsp;How to use
1.1       grant    4212:                 pkgsrc as non-root</h2>
                   4213:               </div>
                   4214:             </div>
                   4215:           </div>
                   4216: 
                   4217:           <p>If you want to use pkgsrc as non-root user, you can
                   4218:           set some variables to make pkgsrc work under these
                   4219:           conditions. Please see <a href=
                   4220:           "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.20      ben      4221:           target="_top">this message</a> for more details.</p>
1.14      xtraeme  4222:         </div>
                   4223: 
                   4224:         <div class="sect1" lang="en" xml:lang="en">
                   4225:           <div class="titlepage">
                   4226:             <div>
                   4227:               <div>
                   4228:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      4229:                 "id2625995" id="id2625995"></a>6.5.&nbsp;How to
1.15      xtraeme  4230:                 resume transfers when fetching distfiles?</h2>
1.14      xtraeme  4231:               </div>
                   4232:             </div>
                   4233:           </div>
                   4234: 
1.15      xtraeme  4235:           <p>By default resuming transfers in pkgsrc is disabled,
                   4236:           but you can enable this feature by adding the option
                   4237:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
                   4238:           into <code class="filename">/etc/mk.conf</code>. If,
                   4239:           during a fetch step, an incomplete distfile is found,
                   4240:           pkgsrc will try to resume it.</p>
                   4241: 
                   4242:           <p>You can also use a different program than the default
1.24    ! wiz      4243:           <a href=
        !          4244:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
        !          4245:           <span class="citerefentry"><span class=
        !          4246:           "refentrytitle">ftp</span>(1)</span></a> by changing the
        !          4247:           <code class="varname">FETCH_CMD</code> variable. Don't
        !          4248:           forget to set <code class=
        !          4249:           "varname">FETCH_RESUME_ARGS</code> and <code class=
        !          4250:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
        !          4251:           default values.</p>
1.14      xtraeme  4252: 
                   4253:           <p>For example, if you want to use <code class=
                   4254:           "filename">wget</code> to resume downloads, you'll have
                   4255:           to use something like:</p>
                   4256:           <pre class="programlisting">
                   4257:         FETCH_CMD=wget
                   4258:         .if defined(FETCH_CMD) &amp;&amp; ${FETCH_CMD} == "wget"
                   4259:         FETCH_BEFORE_ARGS=--passive-ftp
                   4260:         FETCH_RESUME_ARGS=-c
                   4261:         FETCH_OUTPUT_ARGS=-O
                   4262:         .endif
                   4263:     
                   4264: </pre>
1.1       grant    4265:         </div>
                   4266: 
                   4267:         <div class="sect1" lang="en" xml:lang="en">
                   4268:           <div class="titlepage">
                   4269:             <div>
                   4270:               <div>
                   4271:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      4272:                 "id2626045" id="id2626045"></a>6.6.&nbsp;How can I
1.1       grant    4273:                 install/use XFree86 from pkgsrc?</h2>
                   4274:               </div>
                   4275:             </div>
                   4276:           </div>
                   4277: 
                   4278:           <p>If you want to use XFree86 from pkgsrc instead of your
1.14      xtraeme  4279:           system's own X11 (<code class=
                   4280:           "filename">/usr/X11R6</code>, <code class=
                   4281:           "filename">/usr/openwin</code>, ...), you will have to
                   4282:           add the following line into <code class=
1.15      xtraeme  4283:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4284:           <pre class="programlisting">
                   4285:       X11_TYPE=XFree86
                   4286:     
                   4287: </pre>
                   4288:         </div>
                   4289: 
                   4290:         <div class="sect1" lang="en" xml:lang="en">
                   4291:           <div class="titlepage">
                   4292:             <div>
                   4293:               <div>
                   4294:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      4295:                 "id2626073" id="id2626073"></a>6.7.&nbsp;How can I
1.1       grant    4296:                 install/use X.org from pkgsrc?</h2>
                   4297:               </div>
                   4298:             </div>
                   4299:           </div>
                   4300: 
                   4301:           <p>If you want to use X.org from pkgsrc instead of your
1.14      xtraeme  4302:           system's own X11 (<code class=
                   4303:           "filename">/usr/X11R6</code>, <code class=
                   4304:           "filename">/usr/openwin</code>, ...) you will have to add
                   4305:           the following line into <code class=
1.15      xtraeme  4306:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4307:           <pre class="programlisting">
                   4308:       X11_TYPE=xorg
                   4309:     
                   4310: </pre>
                   4311:         </div>
                   4312: 
                   4313:         <div class="sect1" lang="en" xml:lang="en">
                   4314:           <div class="titlepage">
                   4315:             <div>
                   4316:               <div>
                   4317:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      4318:                 "id2626101" id="id2626101"></a>6.8.&nbsp;How to
1.1       grant    4319:                 fetch files from behind a firewall</h2>
                   4320:               </div>
                   4321:             </div>
                   4322:           </div>
                   4323: 
                   4324:           <p>If you are sitting behind a firewall which does not
                   4325:           allow direct connections to Internet hosts (i.e.
                   4326:           non-NAT), you may specify the relevant proxy hosts. This
                   4327:           is done using an environment variable in the form of a
                   4328:           URL e.g. in Amdahl, the machine &#8220;<span class=
                   4329:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   4330:           firewalls, and it uses port 80 as the proxy port number.
                   4331:           So the proxy environment variables are:</p>
                   4332:           <pre class="programlisting">
                   4333:   ftp_proxy=ftp://orpheus.amdahl.com:80/
                   4334: http_proxy=http://orpheus.amdahl.com:80/
                   4335: </pre>
                   4336:         </div>
                   4337: 
                   4338:         <div class="sect1" lang="en" xml:lang="en">
                   4339:           <div class="titlepage">
                   4340:             <div>
                   4341:               <div>
                   4342:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      4343:                 "id2626115" id="id2626115"></a>6.9.&nbsp;How do I
1.14      xtraeme  4344:                 tell <span><strong class="command">make
                   4345:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    4346:               </div>
                   4347:             </div>
                   4348:           </div>
                   4349: 
                   4350:           <p>This depends on which utility is used to retrieve
1.14      xtraeme  4351:           distfiles. From <code class="filename">bsd.pkg.mk</code>,
                   4352:           <code class="varname">FETCH_CMD</code> is assigned the
                   4353:           first available command from the following list:</p>
1.1       grant    4354:           <pre class="programlisting">
                   4355: ${LOCALBASE}/bin/ftp
                   4356: /usr/bin/ftp
                   4357: </pre>
                   4358: 
                   4359:           <p>On a default NetBSD installation, this will be
1.14      xtraeme  4360:           <code class="filename">/usr/bin/ftp</code>, which
1.1       grant    4361:           automatically tries passive connections first, and falls
                   4362:           back to active connections if the server refuses to do
                   4363:           passive. For the other tools, add the following to your
1.14      xtraeme  4364:           <code class="filename">/etc/mk.conf</code> file:
                   4365:           <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    4366: 
1.14      xtraeme  4367:           <p>Having that option present will prevent <code class=
                   4368:           "filename">/usr/bin/ftp</code> from falling back to
                   4369:           active transfers.</p>
1.1       grant    4370:         </div>
                   4371: 
                   4372:         <div class="sect1" lang="en" xml:lang="en">
                   4373:           <div class="titlepage">
                   4374:             <div>
                   4375:               <div>
                   4376:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      4377:                 "id2626166" id="id2626166"></a>6.10.&nbsp;How to
1.1       grant    4378:                 fetch all distfiles at once</h2>
                   4379:               </div>
                   4380:             </div>
                   4381:           </div>
                   4382: 
                   4383:           <p>You would like to download all the distfiles in a
                   4384:           single batch from work or university, where you can't run
1.14      xtraeme  4385:           a <span><strong class="command">make
                   4386:           fetch</strong></span>. There is an archive of distfiles
                   4387:           on <a href=
1.1       grant    4388:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   4389:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   4390:           entire directory may not be appropriate.</p>
                   4391: 
1.14      xtraeme  4392:           <p>The answer here is to do a <span><strong class=
                   4393:           "command">make fetch-list</strong></span> in <code class=
                   4394:           "filename">/usr/pkgsrc</code> or one of it's
1.1       grant    4395:           subdirectories, carry the resulting list to your machine
1.23      wiz      4396:           at work/school and use it there. If you don't have a
1.24    ! wiz      4397:           NetBSD-compatible <a href=
        !          4398:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
        !          4399:           <span class="citerefentry"><span class=
        !          4400:           "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
        !          4401:           at work, don't forget to set <code class=
        !          4402:           "varname">FETCH_CMD</code> to something that fetches a
        !          4403:           URL:</p>
1.1       grant    4404: 
                   4405:           <p>At home:</p>
                   4406:           <pre class="screen">
1.14      xtraeme  4407: <code class="prompt">%</code> <strong class=
                   4408: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4409: <code class="prompt">%</code> <strong class=
                   4410: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   4411: <code class="prompt">%</code> <strong class=
                   4412: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    4413: </pre>
                   4414: 
                   4415:           <p>At work:</p>
                   4416:           <pre class="screen">
1.14      xtraeme  4417: <code class="prompt">%</code> <strong class=
                   4418: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    4419: </pre>
                   4420: 
1.14      xtraeme  4421:           <p>then tar up <code class=
                   4422:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    4423: 
                   4424:           <p>If you have a machine running NetBSD, and you want to
                   4425:           get <span class="emphasis"><em>all</em></span> distfiles
                   4426:           (even ones that aren't for your machine architecture),
                   4427:           you can do so by using the above-mentioned
1.14      xtraeme  4428:           <span><strong class="command">make
                   4429:           fetch-list</strong></span> approach, or fetch the
                   4430:           distfiles directly by running:</p>
1.1       grant    4431:           <pre class="screen">
1.14      xtraeme  4432: <code class="prompt">%</code> <strong class=
                   4433: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    4434: </pre>
                   4435: 
1.14      xtraeme  4436:           <p>If you even decide to ignore <code class=
                   4437:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   4438:           can get everything by running:</p>
1.1       grant    4439:           <pre class="screen">
1.14      xtraeme  4440: <code class="prompt">%</code> <strong class=
                   4441: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    4442: </pre>
                   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.24    ! wiz      4450:                 "id2626313" id="id2626313"></a>6.11.&nbsp;What does
1.1       grant    4451:                 &#8220;<span class="quote">Don't know how to make
                   4452:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   4453:               </div>
                   4454:             </div>
                   4455:           </div>
                   4456: 
                   4457:           <p>When compiling the <a xmlns=
                   4458:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4459:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4460:           class="pkgname">pkgtools/pkg_install</a> package, you get
                   4461:           the error from make that it doesn't know how to make
                   4462:           <code class="filename">/usr/share/tmac/tmac.andoc</code>?
                   4463:           This indicates that you don't have installed the
1.23      wiz      4464:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
                   4465:           ...) from the NetBSD base distribution on your machine.
                   4466:           It is recommended to do that to format manpages.</p>
1.1       grant    4467: 
                   4468:           <p>In the case of the <a xmlns=
                   4469:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4470:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4471:           class="pkgname">pkgtools/pkg_install</a> package, you can
                   4472:           get away with setting <code class=
                   4473:           "varname">NOMAN=YES</code> either in the environment or
                   4474:           in <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    4475:         </div>
                   4476: 
                   4477:         <div class="sect1" lang="en" xml:lang="en">
                   4478:           <div class="titlepage">
                   4479:             <div>
                   4480:               <div>
                   4481:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      4482:                 "id2626352" id="id2626352"></a>6.12.&nbsp;What does
1.1       grant    4483:                 &#8220;<span class="quote">Could not find
                   4484:                 bsd.own.mk</span>&#8221; mean?</h2>
                   4485:               </div>
                   4486:             </div>
                   4487:           </div>
                   4488: 
1.14      xtraeme  4489:           <p>You didn't install the compiler set, <code class=
                   4490:           "filename">comp.tgz</code>, when you installed your
                   4491:           NetBSD machine. Please get it and install it, by
                   4492:           extracting it in <code class="filename">/</code>:</p>
1.1       grant    4493:           <pre class="screen">
1.14      xtraeme  4494: <code class="prompt">#</code> <strong class=
                   4495: "userinput"><code>cd /</code></strong>
                   4496: <code class="prompt">#</code> <strong class=
                   4497: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    4498: </pre>
                   4499: 
1.14      xtraeme  4500:           <p><code class="filename">comp.tgz</code> is part of
                   4501:           every NetBSD release. Get the one that corresponds to
                   4502:           your release (determine via <span><strong class=
                   4503:           "command">uname -r</strong></span>).</p>
1.1       grant    4504:         </div>
                   4505: 
                   4506:         <div class="sect1" lang="en" xml:lang="en">
                   4507:           <div class="titlepage">
                   4508:             <div>
                   4509:               <div>
                   4510:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      4511:                 "id2626409" id="id2626409"></a>6.13.&nbsp;Using
1.1       grant    4512:                 'sudo' with pkgsrc</h2>
                   4513:               </div>
                   4514:             </div>
                   4515:           </div>
                   4516: 
                   4517:           <p>When installing packages as non-root user and using
1.24    ! wiz      4518:           the just-in-time <a href=
        !          4519:           "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
        !          4520:           <span class="citerefentry"><span class=
        !          4521:           "refentrytitle">su</span>(1)</span></a> feature of
        !          4522:           pkgsrc, it can become annoying to type in the root
        !          4523:           password for each required package installed. To avoid
        !          4524:           this, the sudo package can be used, which does password
        !          4525:           caching over a limited time. To use it, install sudo
        !          4526:           (either as binary package or from <a xmlns=
        !          4527:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    4528:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20      ben      4529:           class="pkgname">security/sudo</a>) and then put the
                   4530:           following into your <code class=
                   4531:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4532:           <pre class="programlisting">
1.23      wiz      4533:         .if exists(${LOCALBASE}/bin/sudo)
                   4534:         SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
1.1       grant    4535:         .endif
                   4536:     
                   4537: </pre>
                   4538:         </div>
                   4539: 
                   4540:         <div class="sect1" lang="en" xml:lang="en">
                   4541:           <div class="titlepage">
                   4542:             <div>
                   4543:               <div>
                   4544:                 <h2 class="title" style="clear: both"><a name=
                   4545:                 "faq.conf" id=
1.14      xtraeme  4546:                 "faq.conf"></a>6.14.&nbsp;Configuration files
1.1       grant    4547:                 handling and placement</h2>
                   4548:               </div>
                   4549:             </div>
                   4550:           </div>
                   4551: 
1.14      xtraeme  4552:           <p>The global variable <code class=
                   4553:           "varname">PKG_SYSCONFBASE</code> (and some others) can be
                   4554:           set by the system administrator in <code class=
                   4555:           "filename">/etc/mk.conf</code> to define the place where
1.1       grant    4556:           configuration files get installed. Therefore, packages
                   4557:           must be adapted to support this feature. Keep in mind
                   4558:           that you should only install files that are strictly
                   4559:           necessary in the configuration directory, files that can
1.14      xtraeme  4560:           go to <code class="filename">$PREFIX/share</code> should
                   4561:           go there.</p>
1.1       grant    4562: 
                   4563:           <p>We will take a look at available variables first
1.14      xtraeme  4564:           (<code class="filename">bsd.pkg.mk</code> contains more
                   4565:           information). <code class="varname">PKG_SYSCONFDIR</code>
                   4566:           is where the configuration files for a package may be
                   4567:           found (that is, the full path, e.g. <code class=
                   4568:           "filename">/etc</code> or <code class=
                   4569:           "filename">/usr/pkg/etc</code>). This value may be
1.1       grant    4570:           customized in various ways:</p>
                   4571: 
                   4572:           <div class="orderedlist">
                   4573:             <ol type="1">
                   4574:               <li>
1.14      xtraeme  4575:                 <p><code class="varname">PKG_SYSCONFBASE</code> is
                   4576:                 the main config directory under which all package
1.1       grant    4577:                 configuration files are to be found. Users will
1.14      xtraeme  4578:                 typically want to set it to <code class=
                   4579:                 "filename">/etc</code>, or accept the default
                   4580:                 location of <code class=
                   4581:                 "filename">$PREFIX/etc</code>.</p>
1.1       grant    4582:               </li>
                   4583: 
                   4584:               <li>
1.14      xtraeme  4585:                 <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   4586:                 is the subdirectory of <code class=
                   4587:                 "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    4588:                 configuration files for a particular package may be
1.14      xtraeme  4589:                 found. Defaults to <code class=
                   4590:                 "varname">${SYSCONFBASE}</code>.</p>
1.1       grant    4591:               </li>
                   4592: 
                   4593:               <li>
1.14      xtraeme  4594:                 <p><code class="varname">PKG_SYSCONFVAR</code> is
                   4595:                 the special suffix used to distinguish any
                   4596:                 overriding values for a particular package (see
                   4597:                 next item). It defaults to <code class=
                   4598:                 "varname">${PKGBASE}</code>, but for a collection
                   4599:                 of related packages that should all have the same
                   4600:                 <code class="varname">PKG_SYSCONFDIR</code> value,
                   4601:                 it can be set in each of the package Makefiles to a
                   4602:                 common value.</p>
1.1       grant    4603:               </li>
                   4604: 
                   4605:               <li>
1.14      xtraeme  4606:                 <p><code class=
                   4607:                 "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   4608:                 overrides the value of <code class=
                   4609:                 "varname">${PKG_SYSCONFDIR}</code> for packages
                   4610:                 with the same value for <code class=
                   4611:                 "varname">PKG_SYSCONFVAR</code>.</p>
1.1       grant    4612: 
                   4613:                 <p>As an example, all the various KDE packages may
1.14      xtraeme  4614:                 want to set <code class=
                   4615:                 "varname">PKG_SYSCONFVAR</code> to
                   4616:                 &#8220;<span class="quote">kde</span>&#8221; so
                   4617:                 admins can set <code class=
                   4618:                 "varname">PKG_SYSCONFDIR.kde</code> in <code class=
                   4619:                 "filename">/etc/mk.conf</code> to define where to
1.1       grant    4620:                 install KDE config files.</p>
                   4621:               </li>
                   4622:             </ol>
                   4623:           </div>
                   4624: 
                   4625:           <p>Programs' configuration directory should be defined
                   4626:           during the configure stage. Packages that use GNU
                   4627:           autoconf can usually do this by using the
                   4628:           &#8220;<span class="quote">--sysconfdir</span>&#8221;
                   4629:           parameter, but this brings some problems as we will see
                   4630:           now. When you change this pathname in packages, you
                   4631:           should not allow them to install files in that directory
                   4632:           directly. Instead they need to install those files under
1.14      xtraeme  4633:           <code class="filename">share/examples/${PKGNAME}</code>
                   4634:           so <code class="filename">PLIST</code> can register
                   4635:           them.</p>
1.1       grant    4636: 
                   4637:           <p>Once you have the required configuration files in
1.14      xtraeme  4638:           place (under the <code class=
                   4639:           "filename">share/examples</code> directory) the variable
                   4640:           <code class="varname">CONF_FILES</code> should be set to
                   4641:           copy them into <code class=
                   4642:           "varname">PKG_SYSCONFDIR</code>. The contents of this
                   4643:           variable is formed by pairs of filenames; the first
1.1       grant    4644:           element of the pair specifies the file inside the
1.14      xtraeme  4645:           examples directory (registered by <code class=
                   4646:           "filename">PLIST</code>) and the second element specifies
1.1       grant    4647:           the target file. This is done this way to allow binary
                   4648:           packages to place files in the right directory using
1.14      xtraeme  4649:           <code class="filename">INSTALL</code>/<code class=
                   4650:           "filename">DEINSTALL</code> scripts which are created
                   4651:           automatically. The package <code class=
                   4652:           "filename">Makefile</code> must also set <code class=
                   4653:           "varname">USE_PKGINSTALL=YES</code> to use these
1.1       grant    4654:           automatically generated scripts. The automatic copying of
                   4655:           config files can be toggled by setting the environment
1.14      xtraeme  4656:           variable <code class="varname">PKG_CONFIG</code> prior to
1.1       grant    4657:           package installation.</p>
                   4658: 
                   4659:           <p>Here is an example, taken from mail/mutt/Makefile:</p>
                   4660:           <pre class="programlisting">
                   4661:   EGDIR=            ${PREFIX}/share/doc/mutt/samples
                   4662: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   4663: </pre>
                   4664: 
                   4665:           <p>As you can see, this package installs configuration
1.14      xtraeme  4666:           files inside <code class="varname">EGDIR</code>, which
                   4667:           are registered by <code class="filename">PLIST</code>.
                   4668:           After that, the variable <code class=
                   4669:           "varname">CONF_FILES</code> lists the installed file
                   4670:           first and then the target file. Users will also get an
                   4671:           automatic message when files are installed using this
                   4672:           method.</p>
1.1       grant    4673:         </div>
                   4674: 
                   4675:         <div class="sect1" lang="en" xml:lang="en">
                   4676:           <div class="titlepage">
                   4677:             <div>
                   4678:               <div>
                   4679:                 <h2 class="title" style="clear: both"><a name=
                   4680:                 "audit-packages" id=
1.14      xtraeme  4681:                 "audit-packages"></a>6.15.&nbsp;Automated security
1.1       grant    4682:                 checks</h2>
                   4683:               </div>
                   4684:             </div>
                   4685:           </div>
                   4686: 
                   4687:           <p>Please be aware that there can often be bugs in
                   4688:           third-party software, and some of these bugs can leave a
                   4689:           machine vulnerable to exploitation by attackers. In an
                   4690:           effort to lessen the exposure, the NetBSD packages team
                   4691:           maintains a database of known-exploits to packages which
                   4692:           have at one time been included in pkgsrc. The database
                   4693:           can be downloaded automatically, and a security audit of
                   4694:           all packages installed on a system can take place. To do
                   4695:           this, install 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"
1.20      ben      4698:           class="pkgname">security/audit-packages</a> package. It
                   4699:           has two components:</p>
1.1       grant    4700: 
                   4701:           <div class="orderedlist">
                   4702:             <ol type="1">
                   4703:               <li>
                   4704:                 <p>&#8220;<span class=
                   4705:                 "quote">download-vulnerability-list</span>&#8221;,
                   4706:                 an easy way to download a list of the security
                   4707:                 vulnerabilities information. This list is kept up
                   4708:                 to date by the NetBSD security officer and the
                   4709:                 NetBSD packages team, and is distributed from the
                   4710:                 NetBSD ftp server:</p>
                   4711: 
                   4712:                 <p><a href=
                   4713:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      4714:                 target=
                   4715:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    4716:               </li>
                   4717: 
                   4718:               <li>
                   4719:                 <p>&#8220;<span class=
                   4720:                 "quote">audit-packages</span>&#8221;, an easy way
                   4721:                 to audit the current machine, checking each
                   4722:                 vulnerability which is known. If a vulnerable
                   4723:                 package is installed, it will be shown by output to
                   4724:                 stdout, including a description of the type of
                   4725:                 vulnerability, and a URL containing more
                   4726:                 information.</p>
                   4727:               </li>
                   4728:             </ol>
                   4729:           </div>
                   4730: 
1.23      wiz      4731:           <p>Use of the <a xmlns=
                   4732:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4733:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   4734:           class="pkgname">security/audit-packages</a> package is
                   4735:           strongly recommended! After &#8220;<span class=
                   4736:           "quote">audit-packages</span>&#8221; is installed, please
                   4737:           read the package's message, which you can get by running
                   4738:           <strong class="userinput"><code>pkg_info -D
                   4739:           audit-package</code></strong>.</p>
1.1       grant    4740:         </div>
                   4741:       </div>
                   4742:     </div>
                   4743: 
                   4744:     <div class="part" lang="en" xml:lang="en">
                   4745:       <div class="titlepage">
                   4746:         <div>
                   4747:           <div>
                   4748:             <h1 class="title"><a name="developers-guide" id=
1.2       hubertf  4749:             "developers-guide"></a>The pkgsrc developer's
                   4750:             guide</h1>
1.1       grant    4751:           </div>
                   4752:         </div>
                   4753:       </div>
                   4754: 
                   4755:       <div class="toc">
                   4756:         <p><b>Table of Contents</b></p>
                   4757: 
                   4758:         <dl>
                   4759:           <dt><span class="chapter"><a href="#components">7.
                   4760:           Package components - files, directories and
                   4761:           contents</a></span></dt>
                   4762: 
                   4763:           <dd>
                   4764:             <dl>
                   4765:               <dt><span class="sect1"><a href=
1.14      xtraeme  4766:               "#components.Makefile">7.1. <code class=
                   4767:               "filename">Makefile</code></a></span></dt>
1.1       grant    4768: 
                   4769:               <dt><span class="sect1"><a href=
1.14      xtraeme  4770:               "#components.distinfo">7.2. <code class=
                   4771:               "filename">distinfo</code></a></span></dt>
1.1       grant    4772: 
                   4773:               <dt><span class="sect1"><a href=
                   4774:               "#components.patches">7.3. patches/*</a></span></dt>
                   4775: 
1.24    ! wiz      4776:               <dt><span class="sect1"><a href="#id2627489">7.4.
1.1       grant    4777:               Other mandatory files</a></span></dt>
                   4778: 
                   4779:               <dt><span class="sect1"><a href=
                   4780:               "#components.optional">7.5. Optional
                   4781:               files</a></span></dt>
                   4782: 
1.23      wiz      4783:               <dt><span class="sect1"><a href="#id2627614">7.6.
1.14      xtraeme  4784:               <code class="filename">work*</code></a></span></dt>
1.1       grant    4785: 
1.24    ! wiz      4786:               <dt><span class="sect1"><a href="#id2627770">7.7.
1.14      xtraeme  4787:               <code class="filename">files/*</code></a></span></dt>
1.1       grant    4788:             </dl>
                   4789:           </dd>
                   4790: 
                   4791:           <dt><span class="chapter"><a href="#plist">8. PLIST
                   4792:           issues</a></span></dt>
                   4793: 
                   4794:           <dd>
                   4795:             <dl>
1.24    ! wiz      4796:               <dt><span class="sect1"><a href="#id2627961">8.1. RCS
1.1       grant    4797:               ID</a></span></dt>
                   4798: 
1.24    ! wiz      4799:               <dt><span class="sect1"><a href="#id2627976">8.2.
1.14      xtraeme  4800:               Semi-automatic <code class="filename">PLIST</code>
                   4801:               generation</a></span></dt>
1.1       grant    4802: 
                   4803:               <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme  4804:               Tweaking output of <span><strong class="command">make
                   4805:               print-PLIST</strong></span></a></span></dt>
1.1       grant    4806: 
                   4807:               <dt><span class="sect1"><a href="#plist.misc">8.4.
                   4808:               Variable substitution in PLIST</a></span></dt>
                   4809: 
1.24    ! wiz      4810:               <dt><span class="sect1"><a href="#id2628297">8.5.
1.1       grant    4811:               Manpage-compression</a></span></dt>
                   4812: 
1.24    ! wiz      4813:               <dt><span class="sect1"><a href="#id2628339">8.6.
1.14      xtraeme  4814:               Changing PLIST source with <code class=
                   4815:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    4816: 
1.24    ! wiz      4817:               <dt><span class="sect1"><a href="#id2628363">8.7.
1.1       grant    4818:               Platform specific and differing
                   4819:               PLISTs</a></span></dt>
                   4820: 
                   4821:               <dt><span class="sect1"><a href=
                   4822:               "#faq.common-dirs">8.8. Sharing directories between
                   4823:               packages</a></span></dt>
                   4824:             </dl>
                   4825:           </dd>
                   4826: 
                   4827:           <dt><span class="chapter"><a href="#buildlink">9.
                   4828:           Buildlink methodology</a></span></dt>
                   4829: 
                   4830:           <dd>
                   4831:             <dl>
1.24    ! wiz      4832:               <dt><span class="sect1"><a href="#id2628562">9.1.
1.1       grant    4833:               Converting packages to use buildlink3</a></span></dt>
                   4834: 
1.24    ! wiz      4835:               <dt><span class="sect1"><a href="#id2628948">9.2.
1.14      xtraeme  4836:               Writing <code class="filename">buildlink3.mk</code>
                   4837:               files</a></span></dt>
1.1       grant    4838: 
                   4839:               <dd>
                   4840:                 <dl>
                   4841:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4842:                   "#id2629017">9.2.1. Anatomy of a buildlink3.mk
1.1       grant    4843:                   file</a></span></dt>
                   4844: 
                   4845:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4846:                   "#id2629458">9.2.2. Updating <code class=
1.14      xtraeme  4847:                   "varname">BUILDLINK_DEPENDS.<em class=
                   4848:                   "replaceable"><code>pkg</code></em></code> in
                   4849:                   <code class="filename">buildlink3.mk</code>
1.1       grant    4850:                   files</a></span></dt>
                   4851:                 </dl>
                   4852:               </dd>
                   4853: 
1.24    ! wiz      4854:               <dt><span class="sect1"><a href="#id2629537">9.3.
1.14      xtraeme  4855:               Writing <code class="filename">builtin.mk</code>
                   4856:               files</a></span></dt>
1.1       grant    4857: 
                   4858:               <dd>
                   4859:                 <dl>
                   4860:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4861:                   "#id2629618">9.3.1. Anatomy of a <code class=
1.14      xtraeme  4862:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    4863: 
                   4864:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4865:                   "#id2629913">9.3.2. Global preferences for native
1.1       grant    4866:                   or pkgsrc software</a></span></dt>
                   4867:                 </dl>
                   4868:               </dd>
                   4869:             </dl>
                   4870:           </dd>
                   4871: 
                   4872:           <dt><span class="chapter"><a href="#options">10. Options
                   4873:           handling</a></span></dt>
                   4874: 
                   4875:           <dd>
                   4876:             <dl>
1.24    ! wiz      4877:               <dt><span class="sect1"><a href="#id2629986">10.1.
1.1       grant    4878:               Global default options</a></span></dt>
                   4879: 
1.24    ! wiz      4880:               <dt><span class="sect1"><a href="#id2630001">10.2.
1.14      xtraeme  4881:               Converting packages to use <code class=
                   4882:               "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    4883:             </dl>
                   4884:           </dd>
                   4885: 
                   4886:           <dt><span class="chapter"><a href="#build">11. The build
                   4887:           process</a></span></dt>
                   4888: 
                   4889:           <dd>
                   4890:             <dl>
                   4891:               <dt><span class="sect1"><a href="#build.prefix">11.1.
                   4892:               Program location</a></span></dt>
                   4893: 
1.24    ! wiz      4894:               <dt><span class="sect1"><a href="#id2630624">11.2.
1.1       grant    4895:               Main targets</a></span></dt>
                   4896: 
                   4897:               <dt><span class="sect1"><a href=
                   4898:               "#build.helpful-targets">11.3. Other helpful
                   4899:               targets</a></span></dt>
                   4900:             </dl>
                   4901:           </dd>
                   4902: 
                   4903:           <dt><span class="chapter"><a href="#fixes">12. Notes on
                   4904:           fixes for packages</a></span></dt>
                   4905: 
                   4906:           <dd>
                   4907:             <dl>
1.24    ! wiz      4908:               <dt><span class="sect1"><a href="#id2632120">12.1.
1.1       grant    4909:               General operation</a></span></dt>
                   4910: 
                   4911:               <dd>
                   4912:                 <dl>
                   4913:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4914:                   "#id2632123">12.1.1. How to pull in variables
1.1       grant    4915:                   from /etc/mk.conf</a></span></dt>
                   4916: 
                   4917:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4918:                   "#id2632275">12.1.2. Restricted
1.1       grant    4919:                   packages</a></span></dt>
                   4920: 
                   4921:                   <dt><span class="sect2"><a href=
                   4922:                   "#dependencies">12.1.3. Handling
                   4923:                   dependencies</a></span></dt>
                   4924: 
                   4925:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4926:                   "#id2632728">12.1.4. Handling conflicts with
1.1       grant    4927:                   other packages</a></span></dt>
                   4928: 
                   4929:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4930:                   "#id2632846">12.1.5. Packages that cannot or
1.1       grant    4931:                   should not be built</a></span></dt>
                   4932: 
                   4933:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4934:                   "#id2632872">12.1.6. Packages which should not be
1.1       grant    4935:                   deleted, once installed</a></span></dt>
                   4936: 
                   4937:                   <dt><span class="sect2"><a href=
                   4938:                   "#security-handling">12.1.7. Handling packages
                   4939:                   with security problems</a></span></dt>
                   4940: 
                   4941:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4942:                   "#id2632964">12.1.8. How to handle compiler
1.1       grant    4943:                   bugs</a></span></dt>
                   4944: 
                   4945:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4946:                   "#id2633054">12.1.9. How to handle incrementing
1.1       grant    4947:                   versions when fixing an existing
                   4948:                   package</a></span></dt>
                   4949: 
                   4950:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4951:                   "#id2633104">12.1.10. Portability of
1.1       grant    4952:                   packages</a></span></dt>
                   4953:                 </dl>
                   4954:               </dd>
                   4955: 
1.24    ! wiz      4956:               <dt><span class="sect1"><a href="#id2633128">12.2.
1.1       grant    4957:               Possible downloading issues</a></span></dt>
                   4958: 
                   4959:               <dd>
                   4960:                 <dl>
                   4961:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4962:                   "#id2633131">12.2.1. Packages whose distfiles
1.1       grant    4963:                   aren't available for plain
                   4964:                   downloading</a></span></dt>
                   4965: 
                   4966:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4967:                   "#id2633194">12.2.2. How to handle modified
1.1       grant    4968:                   distfiles with the 'old' name</a></span></dt>
                   4969:                 </dl>
                   4970:               </dd>
                   4971: 
1.24    ! wiz      4972:               <dt><span class="sect1"><a href="#id2633206">12.3.
1.1       grant    4973:               Configuration gotchas</a></span></dt>
                   4974: 
                   4975:               <dd>
                   4976:                 <dl>
                   4977:                   <dt><span class="sect2"><a href=
                   4978:                   "#fixes.libtool">12.3.1. Shared libraries -
                   4979:                   libtool</a></span></dt>
                   4980: 
                   4981:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4982:                   "#id2633640">12.3.2. Using libtool on GNU
1.1       grant    4983:                   packages that already support
                   4984:                   libtool</a></span></dt>
                   4985: 
                   4986:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4987:                   "#id2633721">12.3.3. GNU
1.1       grant    4988:                   Autoconf/Automake</a></span></dt>
                   4989:                 </dl>
                   4990:               </dd>
                   4991: 
1.24    ! wiz      4992:               <dt><span class="sect1"><a href="#id2633834">12.4.
1.1       grant    4993:               Building considerations</a></span></dt>
                   4994: 
                   4995:               <dd>
                   4996:                 <dl>
                   4997:                   <dt><span class="sect2"><a href=
1.24    ! wiz      4998:                   "#id2633837">12.4.1. CPP defines</a></span></dt>
1.1       grant    4999:                 </dl>
                   5000:               </dd>
                   5001: 
1.24    ! wiz      5002:               <dt><span class="sect1"><a href="#id2633867">12.5.
1.1       grant    5003:               Package specific actions</a></span></dt>
                   5004: 
                   5005:               <dd>
                   5006:                 <dl>
                   5007:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5008:                   "#id2633870">12.5.1. Package configuration
1.1       grant    5009:                   files</a></span></dt>
                   5010: 
                   5011:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5012:                   "#id2633973">12.5.2. User
1.2       hubertf  5013:                   interaction</a></span></dt>
1.1       grant    5014: 
                   5015:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5016:                   "#id2634018">12.5.3. Handling
1.1       grant    5017:                   licenses</a></span></dt>
                   5018: 
                   5019:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5020:                   "#id2634169">12.5.4. Creating an account from a
1.1       grant    5021:                   package</a></span></dt>
                   5022: 
                   5023:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5024:                   "#id2634231">12.5.5. Installing score
1.1       grant    5025:                   files</a></span></dt>
                   5026: 
                   5027:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5028:                   "#id2634411">12.5.6. Packages providing login
1.1       grant    5029:                   shells</a></span></dt>
                   5030: 
                   5031:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5032:                   "#id2634469">12.5.7. Packages containing perl
1.1       grant    5033:                   scripts</a></span></dt>
                   5034: 
                   5035:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5036:                   "#id2634555">12.5.8. Packages with hardcoded
1.1       grant    5037:                   paths to other interpreters</a></span></dt>
                   5038: 
                   5039:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5040:                   "#id2634577">12.5.9. Packages installing perl
1.1       grant    5041:                   modules</a></span></dt>
                   5042: 
                   5043:                   <dt><span class="sect2"><a href=
                   5044:                   "#faq.info-files">12.5.10. Packages installing
                   5045:                   info files</a></span></dt>
                   5046: 
                   5047:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5048:                   "#id2634865">12.5.11. Packages installing GConf2
1.1       grant    5049:                   data files</a></span></dt>
                   5050: 
                   5051:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5052:                   "#id2634965">12.5.12. Packages installing
1.1       grant    5053:                   scrollkeeper data files</a></span></dt>
                   5054: 
                   5055:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5056:                   "#id2635016">12.5.13. Packages installing X11
1.1       grant    5057:                   fonts</a></span></dt>
                   5058: 
                   5059:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5060:                   "#id2635063">12.5.14. Packages installing GTK2
1.1       grant    5061:                   modules</a></span></dt>
                   5062: 
                   5063:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5064:                   "#id2635201">12.5.15. Packages installing SGML or
1.1       grant    5065:                   XML data</a></span></dt>
                   5066: 
                   5067:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5068:                   "#id2635253">12.5.16. Packages installing
1.1       grant    5069:                   extensions to the MIME database</a></span></dt>
                   5070: 
                   5071:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5072:                   "#id2635323">12.5.17. Packages using
1.1       grant    5073:                   intltool</a></span></dt>
1.18      xtraeme  5074: 
                   5075:                   <dt><span class="sect2"><a href=
1.24    ! wiz      5076:                   "#id2635337">12.5.18. Packages installing startup
1.18      xtraeme  5077:                   scripts</a></span></dt>
1.1       grant    5078:                 </dl>
                   5079:               </dd>
                   5080: 
1.24    ! wiz      5081:               <dt><span class="sect1"><a href="#id2635358">12.6.
1.1       grant    5082:               Feedback to the author</a></span></dt>
                   5083:             </dl>
                   5084:           </dd>
                   5085: 
                   5086:           <dt><span class="chapter"><a href="#debug">13.
                   5087:           Debugging</a></span></dt>
                   5088: 
                   5089:           <dt><span class="chapter"><a href="#submit">14.
                   5090:           Submitting and Committing</a></span></dt>
                   5091: 
                   5092:           <dd>
                   5093:             <dl>
1.24    ! wiz      5094:               <dt><span class="sect1"><a href="#id2635957">14.1.
1.1       grant    5095:               Submitting your packages</a></span></dt>
                   5096: 
1.24    ! wiz      5097:               <dt><span class="sect1"><a href="#id2636014">14.2.
1.1       grant    5098:               Committing: Importing a package into
                   5099:               CVS</a></span></dt>
                   5100: 
1.24    ! wiz      5101:               <dt><span class="sect1"><a href="#id2636077">14.3.
1.2       hubertf  5102:               Updating a package to a newer version</a></span></dt>
1.1       grant    5103: 
1.24    ! wiz      5104:               <dt><span class="sect1"><a href="#id2636097">14.4.
1.2       hubertf  5105:               Moving a package in pkgsrc</a></span></dt>
1.1       grant    5106:             </dl>
                   5107:           </dd>
                   5108:         </dl>
                   5109:       </div>
                   5110: 
                   5111:       <div class="chapter" lang="en" xml:lang="en">
                   5112:         <div class="titlepage">
                   5113:           <div>
                   5114:             <div>
                   5115:               <h2 class="title"><a name="components" id=
                   5116:               "components"></a>Chapter&nbsp;7.&nbsp;Package
                   5117:               components - files, directories and contents</h2>
                   5118:             </div>
                   5119:           </div>
                   5120:         </div>
                   5121: 
                   5122:         <div class="toc">
                   5123:           <p><b>Table of Contents</b></p>
                   5124: 
                   5125:           <dl>
                   5126:             <dt><span class="sect1"><a href=
1.14      xtraeme  5127:             "#components.Makefile">7.1. <code class=
                   5128:             "filename">Makefile</code></a></span></dt>
1.1       grant    5129: 
                   5130:             <dt><span class="sect1"><a href=
1.14      xtraeme  5131:             "#components.distinfo">7.2. <code class=
                   5132:             "filename">distinfo</code></a></span></dt>
1.1       grant    5133: 
                   5134:             <dt><span class="sect1"><a href=
                   5135:             "#components.patches">7.3. patches/*</a></span></dt>
                   5136: 
1.24    ! wiz      5137:             <dt><span class="sect1"><a href="#id2627489">7.4. Other
1.1       grant    5138:             mandatory files</a></span></dt>
                   5139: 
                   5140:             <dt><span class="sect1"><a href=
                   5141:             "#components.optional">7.5. Optional
                   5142:             files</a></span></dt>
                   5143: 
1.23      wiz      5144:             <dt><span class="sect1"><a href="#id2627614">7.6.
1.14      xtraeme  5145:             <code class="filename">work*</code></a></span></dt>
1.1       grant    5146: 
1.24    ! wiz      5147:             <dt><span class="sect1"><a href="#id2627770">7.7.
1.14      xtraeme  5148:             <code class="filename">files/*</code></a></span></dt>
1.1       grant    5149:           </dl>
                   5150:         </div>
                   5151: 
                   5152:         <p>Whenever you're preparing a package, there are a number
                   5153:         of files involved which are described in the following
                   5154:         sections.</p>
                   5155: 
                   5156:         <div class="sect1" lang="en" xml:lang="en">
                   5157:           <div class="titlepage">
                   5158:             <div>
                   5159:               <div>
                   5160:                 <h2 class="title" style="clear: both"><a name=
                   5161:                 "components.Makefile" id=
1.14      xtraeme  5162:                 "components.Makefile"></a>7.1.&nbsp;<code class=
                   5163:                 "filename">Makefile</code></h2>
1.1       grant    5164:               </div>
                   5165:             </div>
                   5166:           </div>
                   5167: 
                   5168:           <p>Building, installation and creation of a binary
1.14      xtraeme  5169:           package are all controlled by the package's <code class=
1.23      wiz      5170:           "filename">Makefile</code>. The <code class=
                   5171:           "filename">Makefile</code> describes various things about
                   5172:           a package, for example from where to get it, how to
                   5173:           configure, build, and install it.</p>
                   5174: 
                   5175:           <p>A package <code class="filename">Makefile</code>
                   5176:           contains several sections that describe the package.</p>
                   5177: 
                   5178:           <p>In the first section there are the following
                   5179:           variables, which should appear exactly in the order given
                   5180:           here.</p>
                   5181: 
                   5182:           <div class="itemizedlist">
                   5183:             <ul type="disc">
                   5184:               <li>
                   5185:                 <p><code class="varname">DISTNAME</code> is the
                   5186:                 basename of the distribution file to be downloaded
                   5187:                 from the package's website.</p>
                   5188:               </li>
                   5189: 
                   5190:               <li>
                   5191:                 <p><code class="varname">PKGNAME</code> is the name
                   5192:                 of the package, as used by pkgsrc. You only need to
                   5193:                 provide it if it differs from DISTNAME. Usually it
                   5194:                 is the directory name together with the version
                   5195:                 number.</p>
                   5196:               </li>
                   5197: 
                   5198:               <li>
                   5199:                 <p><code class="varname">CATEGORIES</code> is a
                   5200:                 list of categories which the package fits in. You
                   5201:                 can choose any of the top-level directories of
                   5202:                 pkgsrc for it.</p>
                   5203:               </li>
                   5204: 
                   5205:               <li>
                   5206:                 <p><code class="varname">MASTER_SITES</code> is a
                   5207:                 list of URLs where the distribution files can be
                   5208:                 downloaded. Each URL must end with a slash.</p>
                   5209:               </li>
                   5210:             </ul>
                   5211:           </div>
                   5212: 
                   5213:           <p>The second section contains the following
                   5214:           variables.</p>
                   5215: 
                   5216:           <div class="itemizedlist">
                   5217:             <ul type="disc">
                   5218:               <li>
                   5219:                 <p><code class="varname">MAINTAINER</code> is the
                   5220:                 mail address of the package's maintainer, which is
                   5221:                 the person you can contact when the package does
                   5222:                 not work.</p>
                   5223:               </li>
                   5224: 
                   5225:               <li>
                   5226:                 <p><code class="varname">HOMEPAGE</code> is a URL
                   5227:                 where users can find more information about the
                   5228:                 package.</p>
                   5229:               </li>
1.1       grant    5230: 
1.23      wiz      5231:               <li>
                   5232:                 <p><code class="varname">COMMENT</code> is a
                   5233:                 one-line comment about the purpose of the
                   5234:                 package.</p>
                   5235:               </li>
                   5236:             </ul>
                   5237:           </div>
1.1       grant    5238: 
1.14      xtraeme  5239:           <p>The <code class="varname">MASTER_SITES</code> may be
                   5240:           set to one of the predefined sites:</p>
1.1       grant    5241:           <pre class="programlisting">
                   5242:         ${MASTER_SITE_APACHE}
                   5243:         ${MASTER_SITE_DEBIAN}
                   5244:         ${MASTER_SITE_GNOME}
                   5245:         ${MASTER_SITE_GNU}
                   5246:         ${MASTER_SITE_GNUSTEP}
1.9       dillo    5247:         ${MASTER_SITE_IFARCHIVE}
1.1       grant    5248:         ${MASTER_SITE_MOZILLA}
                   5249:         ${MASTER_SITE_PERL_CPAN}
                   5250:         ${MASTER_SITE_SOURCEFORGE}
                   5251:         ${MASTER_SITE_SUNSITE}
                   5252:         ${MASTER_SITE_R_CRAN}
                   5253:         ${MASTER_SITE_SUSE}
                   5254:         ${MASTER_SITE_TEX_CTAN}
                   5255:         ${MASTER_SITE_XCONTRIB}
                   5256:         ${MASTER_SITE_XEMACS} 
                   5257: </pre>
                   5258: 
                   5259:           <p>If one of these predefined sites is chosen, you may
                   5260:           require the ability to specify a subdirectory of that
                   5261:           site. Since these macros may expand to more than one
                   5262:           actual site, you <span class=
                   5263:           "emphasis"><em>must</em></span> use the following
                   5264:           construct to specify a subdirectory:</p>
                   5265:           <pre class="programlisting">
                   5266:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   5267:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   5268: </pre>
                   5269: 
                   5270:           <p>Note the trailing slash after the subdirectory
                   5271:           name.</p>
                   5272: 
                   5273:           <div class="note" style=
                   5274:           "margin-left: 0.5in; margin-right: 0.5in;">
                   5275:             <h3 class="title">Note</h3>
                   5276: 
1.14      xtraeme  5277:             <p><code class="varname">MASTER_SITE_SUBDIR</code> has
                   5278:             been deprecated and <span class="emphasis"><em>should
                   5279:             no longer be used</em></span>.</p>
1.1       grant    5280:           </div>
                   5281: 
1.14      xtraeme  5282:           <p>If the package has multiple <code class=
                   5283:           "varname">DISTFILES</code> or multiple <code class=
                   5284:           "varname">PATCHFILES</code> from different sites, set
                   5285:           <code class="varname">SITES_foo</code> to a list of URI's
1.1       grant    5286:           where file &#8220;<span class="quote">foo</span>&#8221;
                   5287:           may be found. &#8220;<span class=
                   5288:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   5289:           <pre class="programlisting">
                   5290: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   5291: DISTFILES+=     foo-file.tar.gz
                   5292: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   5293:         http://www.somewhereelse.com/mirror/somehow/
                   5294: </pre>
                   5295: 
1.14      xtraeme  5296:           <p>Note that the normal default setting of <code class=
                   5297:           "varname">DISTFILES</code> must be made explicit if you
1.1       grant    5298:           want to add to it (rather than replace it), as you
                   5299:           usually would.</p>
                   5300: 
                   5301:           <p>Currently the following values are available for
1.14      xtraeme  5302:           <code class="varname">CATEGORIES</code>. If more than one
                   5303:           is used, they need to be separated by spaces:</p>
1.1       grant    5304:           <pre class="programlisting">
                   5305: archivers     cross         geography     meta-pkgs     security
                   5306: audio         databases     graphics      misc          shells
                   5307: benchmarks    devel         ham           multimedia    sysutils
                   5308: biology       editors       inputmethod   net           textproc
                   5309: cad           emulators     lang          news          time
                   5310: chat          finance       mail          parallel      wm
                   5311: comms         fonts         math          pkgtools      www
                   5312: converters    games         mbone         print         x11
                   5313: </pre>
                   5314: 
                   5315:           <p>Please pay attention to the following gotchas:</p>
                   5316: 
                   5317:           <div class="itemizedlist">
                   5318:             <ul type="disc">
                   5319:               <li>
1.14      xtraeme  5320:                 <p>Add <code class="varname">MANCOMPRESSED</code>
                   5321:                 if manpages are installed in compressed form by the
                   5322:                 package; see comment in <code class=
                   5323:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    5324:               </li>
                   5325: 
                   5326:               <li>
1.14      xtraeme  5327:                 <p>Replace <code class="filename">/usr/local</code>
1.1       grant    5328:                 with &#8220;<span class=
                   5329:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   5330:                 patches, below).</p>
                   5331:               </li>
                   5332: 
                   5333:               <li>
                   5334:                 <p>If the package installs any info files, see
                   5335:                 <a href="#faq.info-files" title=
                   5336:                 "12.5.10.&nbsp;Packages installing info files">Section
                   5337:                 12.5.10, &#8220;Packages installing info
                   5338:                 files&#8221;</a>.</p>
                   5339:               </li>
                   5340: 
                   5341:               <li>
1.14      xtraeme  5342:                 <p>Set <code class="varname">MAINTAINER</code> to
                   5343:                 be yourself. If you really can't maintain the
                   5344:                 package for future updates, set it to <code class=
1.1       grant    5345:                 "email">&lt;<a href=
1.14      xtraeme  5346:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.1       grant    5347:               </li>
                   5348: 
                   5349:               <li>
                   5350:                 <p>If a home page for the software in question
1.14      xtraeme  5351:                 exists, add the variable <code class=
                   5352:                 "varname">HOMEPAGE</code> right after <code class=
                   5353:                 "varname">MAINTAINER</code>. The value of this
1.1       grant    5354:                 variable should be the URL for the home page.</p>
                   5355:               </li>
                   5356: 
                   5357:               <li>
1.14      xtraeme  5358:                 <p>Be sure to set the <code class=
                   5359:                 "varname">COMMENT</code> variable to a short
1.1       grant    5360:                 description of the package, not containing the
                   5361:                 pkg's name.</p>
                   5362:               </li>
                   5363:             </ul>
                   5364:           </div>
                   5365:         </div>
                   5366: 
                   5367:         <div class="sect1" lang="en" xml:lang="en">
                   5368:           <div class="titlepage">
                   5369:             <div>
                   5370:               <div>
                   5371:                 <h2 class="title" style="clear: both"><a name=
                   5372:                 "components.distinfo" id=
1.14      xtraeme  5373:                 "components.distinfo"></a>7.2.&nbsp;<code class=
                   5374:                 "filename">distinfo</code></h2>
1.1       grant    5375:               </div>
                   5376:             </div>
                   5377:           </div>
                   5378: 
                   5379:           <p>Most important, the mandatory message digest, or
                   5380:           checksum, of all the distfiles needed for the package to
                   5381:           compile, confirming they match the original file
                   5382:           distributed by the author. This ensures that the distfile
                   5383:           retrieved from the Internet has not been corrupted during
                   5384:           transfer or altered by a malign force to introduce a
1.14      xtraeme  5385:           security hole. It is generated using the
                   5386:           <span><strong class="command">make
                   5387:           makesum</strong></span> command. The digest algorithm
                   5388:           used was, at one stage, md5, but that was felt lacking
                   5389:           compared to sha1, and so sha1 is now the default
1.1       grant    5390:           algorithm. The distfile size is also generated and stored
                   5391:           in new distinfo files. The <a xmlns=
                   5392:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5393:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20      ben      5394:           class="pkgname">pkgtools/digest</a> utility calculates
                   5395:           all of the digests in the distinfo file, and it provides
                   5396:           various different algorithms. At the current time, the
                   5397:           algorithms provided are: <span class=
                   5398:           "emphasis"><em>md5</em></span>, <span class=
                   5399:           "emphasis"><em>rmd160</em></span>, <span class=
                   5400:           "emphasis"><em>sha1</em></span>, <span class=
                   5401:           "emphasis"><em>sha256</em></span>, <span class=
                   5402:           "emphasis"><em>sha384</em></span> and <span class=
                   5403:           "emphasis"><em>sha512</em></span>.</p>
1.1       grant    5404: 
                   5405:           <p>Some packages have different sets of distfiles on a
                   5406:           per architecture basis, for example <a xmlns=
                   5407:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5408:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20      ben      5409:           class="pkgname">www/navigator</a>). These are kept in the
                   5410:           same distinfo file and care should be taken when
                   5411:           upgrading such a package to ensure distfile information
                   5412:           is not lost.</p>
1.1       grant    5413: 
                   5414:           <p>The message digest/checksum for all the official
1.14      xtraeme  5415:           patches found in the <code class=
                   5416:           "filename">patches/</code> directory (see <a href=
                   5417:           "#components.patches" title=
1.1       grant    5418:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   5419:           &#8220;patches/*&#8221;</a>) for the package is also
1.14      xtraeme  5420:           stored in the <code class="filename">distinfo</code>
                   5421:           file. This is a message digest/checksum of all lines in
                   5422:           the patch file except the NetBSD RCS Id. This file is
                   5423:           generated by invoking <span><strong class="command">make
                   5424:           makepatchsum</strong></span> (or <span><strong class=
                   5425:           "command">make mps</strong></span> if you're in a
                   5426:           hurry).</p>
1.1       grant    5427:         </div>
                   5428: 
                   5429:         <div class="sect1" lang="en" xml:lang="en">
                   5430:           <div class="titlepage">
                   5431:             <div>
                   5432:               <div>
                   5433:                 <h2 class="title" style="clear: both"><a name=
                   5434:                 "components.patches" id=
                   5435:                 "components.patches"></a>7.3.&nbsp;patches/*</h2>
                   5436:               </div>
                   5437:             </div>
                   5438:           </div>
                   5439: 
                   5440:           <p>This directory contains files that are used by the
                   5441:           <a href=
                   5442:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   5443:           <span class="citerefentry"><span class=
                   5444:           "refentrytitle">patch</span>(1)</span></a> command to
                   5445:           modify the sources as distributed in the distribution
                   5446:           file into a form that will compile and run perfectly on
                   5447:           NetBSD. The files are applied successively in alphabetic
                   5448:           order (as returned by a shell &#8220;<span class=
                   5449:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.14      xtraeme  5450:           <code class="filename">patch-aa</code> is applied before
                   5451:           <code class="filename">patch-ab</code>, etc.</p>
1.1       grant    5452: 
1.14      xtraeme  5453:           <p>The <code class="filename">patch-*</code> files should
                   5454:           be in <span><strong class="command">diff
                   5455:           -bu</strong></span> format, and apply without a fuzz to
                   5456:           avoid problems. (To force patches to apply with fuzz you
                   5457:           can set <code class=
                   5458:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    5459:           not put changes for more than one file into a single
                   5460:           patch-file, as this will make future modifications more
                   5461:           difficult.</p>
                   5462: 
                   5463:           <p>Similar, a file should be patched at most once, not
                   5464:           several times by several different patches. If a file
                   5465:           needs several patches, they should be combined into one
                   5466:           file.</p>
                   5467: 
                   5468:           <p>One important thing to mention is to pay attention
                   5469:           that no RCS IDs get stored in the patch files, as these
                   5470:           will cause problems when later checked into the NetBSD
1.14      xtraeme  5471:           CVS tree. Use the <span><strong class=
                   5472:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    5473:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5474:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      5475:           class="pkgname">pkgtools/pkgdiff</a> package to avoid
                   5476:           these problems.</p>
1.1       grant    5477: 
                   5478:           <p>For even more automation, we recommend using
1.14      xtraeme  5479:           <span><strong class="command">mkpatches</strong></span>
                   5480:           from the same package to make a whole set of patches. You
                   5481:           just have to backup files before you edit them to
                   5482:           <code class="filename">filename.orig</code>, e.g. with
                   5483:           <span><strong class="command">cp -p filename
                   5484:           filename.orig</strong></span> or, easier, by using
                   5485:           <span><strong class="command">pkgvi</strong></span> again
                   5486:           from the same package. If you upgrade a package this way,
                   5487:           you can easily compare the new set of patches with the
                   5488:           previously existing one with <span><strong class=
                   5489:           "command">patchdiff</strong></span>.</p>
1.1       grant    5490: 
                   5491:           <p>When you have finished a package, remember to generate
                   5492:           the checksums for the patch files by using the
1.14      xtraeme  5493:           <span><strong class="command">make
                   5494:           makepatchsum</strong></span> command, see <a href=
                   5495:           "#components.distinfo" title=
1.5       hubertf  5496:           "7.2.&nbsp;distinfo">Section&nbsp;7.2,
1.14      xtraeme  5497:           &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    5498: 
                   5499:           <p>Patch files that are distributed by the author or
1.14      xtraeme  5500:           other maintainers can be listed in <code class=
                   5501:           "varname">$PATCHFILES</code>.</p>
1.1       grant    5502: 
                   5503:           <p>If it is desired to store any patches that should not
                   5504:           be committed into pkgsrc, they can be kept outside the
1.14      xtraeme  5505:           pkgsrc tree in the <code class=
                   5506:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    5507:           tree there is expected to have the same
                   5508:           &#8220;<span class="quote">category/package</span>&#8221;
                   5509:           structure as pkgsrc, and patches are expected to be
1.14      xtraeme  5510:           stored inside these dirs (also known as <code class=
                   5511:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
                   5512:           you want to keep a private patch for <code class=
                   5513:           "filename">pkgsrc/graphics/png</code>, keep it in
                   5514:           <code class=
                   5515:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   5516:           files in the named directory are expected to be patch
1.1       grant    5517:           files, and <span class="emphasis"><em>they are applied
                   5518:           after pkgsrc patches are applied</em></span>.</p>
                   5519:         </div>
                   5520: 
                   5521:         <div class="sect1" lang="en" xml:lang="en">
                   5522:           <div class="titlepage">
                   5523:             <div>
                   5524:               <div>
                   5525:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      5526:                 "id2627489" id="id2627489"></a>7.4.&nbsp;Other
1.1       grant    5527:                 mandatory files</h2>
                   5528:               </div>
                   5529:             </div>
                   5530:           </div>
                   5531: 
                   5532:           <div class="variablelist">
                   5533:             <dl>
1.14      xtraeme  5534:               <dt><span class="term"><code class=
                   5535:               "filename">DESCR</code></span></dt>
1.1       grant    5536: 
                   5537:               <dd>
                   5538:                 <p>A multi-line description of the piece of
                   5539:                 software. This should include any credits where
                   5540:                 they are due. Please bear in mind that others do
                   5541:                 not share your sense of humour (or spelling
                   5542:                 idiosyncrasies), and that others will read
                   5543:                 everything that you write here.</p>
                   5544:               </dd>
                   5545: 
1.14      xtraeme  5546:               <dt><span class="term"><code class=
                   5547:               "filename">PLIST</code></span></dt>
1.1       grant    5548: 
                   5549:               <dd>
                   5550:                 <p>This file governs the files that are installed
                   5551:                 on your system: all the binaries, manual pages,
                   5552:                 etc. There are other directives which may be
                   5553:                 entered in this file, to control the creation and
                   5554:                 deletion of directories, and the location of
                   5555:                 inserted files. See <a href="#plist" title=
                   5556:                 "Chapter&nbsp;8.&nbsp;PLIST issues">Chapter&nbsp;8,
                   5557:                 <i>PLIST issues</i></a> for more information.</p>
                   5558:               </dd>
                   5559:             </dl>
                   5560:           </div>
                   5561:         </div>
                   5562: 
                   5563:         <div class="sect1" lang="en" xml:lang="en">
                   5564:           <div class="titlepage">
                   5565:             <div>
                   5566:               <div>
                   5567:                 <h2 class="title" style="clear: both"><a name=
                   5568:                 "components.optional" id=
                   5569:                 "components.optional"></a>7.5.&nbsp;Optional
                   5570:                 files</h2>
                   5571:               </div>
                   5572:             </div>
                   5573:           </div>
                   5574: 
                   5575:           <div class="variablelist">
                   5576:             <dl>
1.14      xtraeme  5577:               <dt><span class="term"><code class=
                   5578:               "filename">INSTALL</code></span></dt>
1.1       grant    5579: 
                   5580:               <dd>
                   5581:                 <p>This shell script is invoked twice by <a href=
                   5582:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5583:                 <span class="citerefentry"><span class=
                   5584:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   5585:                 time after package extraction and before files are
                   5586:                 moved in place, the second time after the files to
                   5587:                 install are moved in place. This can be used to do
                   5588:                 any custom procedures not possible with @exec
1.14      xtraeme  5589:                 commands in <code class="filename">PLIST</code>.
                   5590:                 See <a href=
1.1       grant    5591:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5592:                 <span class="citerefentry"><span class=
                   5593:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   5594:                 <a href=
                   5595:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5596:                 <span class="citerefentry"><span class=
                   5597:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5598:                 more information.</p>
                   5599:               </dd>
                   5600: 
1.14      xtraeme  5601:               <dt><span class="term"><code class=
                   5602:               "filename">DEINSTALL</code></span></dt>
1.1       grant    5603: 
                   5604:               <dd>
                   5605:                 <p>This script is executed before and after any
                   5606:                 files are removed. It is this script's
                   5607:                 responsibility to clean up any additional messy
                   5608:                 details around the package's installation, since
                   5609:                 all pkg_delete knows is how to delete the files
                   5610:                 created in the original distribution. See <a href=
                   5611:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   5612:                 <span class="citerefentry"><span class=
                   5613:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   5614:                 <a href=
                   5615:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5616:                 <span class="citerefentry"><span class=
                   5617:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5618:                 more information.</p>
                   5619:               </dd>
                   5620: 
1.14      xtraeme  5621:               <dt><span class="term"><code class=
                   5622:               "filename">MESSAGE</code></span></dt>
1.1       grant    5623: 
                   5624:               <dd>
                   5625:                 <p>Display this file after installation of the
                   5626:                 package. Useful for things like legal notices on
                   5627:                 almost-free software and hints for updating config
                   5628:                 files after installing modules for apache, PHP etc.
                   5629:                 Please note that you can modify variables in it
1.14      xtraeme  5630:                 easily by using <code class=
                   5631:                 "varname">MESSAGE_SUBST</code> in the package's
                   5632:                 <code class="filename">Makefile</code>:</p>
1.1       grant    5633:                 <pre class="programlisting">
                   5634: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   5635: </pre>
                   5636: 
                   5637:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.14      xtraeme  5638:                 "quote">somevalue</span>&#8221; in <code class=
                   5639:                 "filename">MESSAGE</code>.</p>
1.1       grant    5640:               </dd>
                   5641:             </dl>
                   5642:           </div>
                   5643:         </div>
                   5644: 
                   5645:         <div class="sect1" lang="en" xml:lang="en">
                   5646:           <div class="titlepage">
                   5647:             <div>
                   5648:               <div>
                   5649:                 <h2 class="title" style="clear: both"><a name=
1.23      wiz      5650:                 "id2627614" id=
                   5651:                 "id2627614"></a>7.6.&nbsp;<code class=
1.14      xtraeme  5652:                 "filename">work*</code></h2>
1.1       grant    5653:               </div>
                   5654:             </div>
                   5655:           </div>
                   5656: 
1.14      xtraeme  5657:           <p>When you type <span><strong class=
                   5658:           "command">make</strong></span> the distribution files are
                   5659:           unpacked into this directory. It can be removed by
                   5660:           running <span><strong class="command">make
                   5661:           clean</strong></span>. Besides the sources, this
                   5662:           directory is also used to keep various timestamp
1.1       grant    5663:           files.</p>
                   5664: 
                   5665:           <p>If a package doesn't create a subdirectory for itself
                   5666:           (like GNU software does, for instance), but extracts
                   5667:           itself in the current directory, you should set
1.14      xtraeme  5668:           <code class="varname">WRKSRC</code> accordingly, e.g.
1.1       grant    5669:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   5670:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.20      ben      5671:           class="pkgname">editors/sam</a> again, but the quick
                   5672:           answer is:</p>
1.1       grant    5673:           <pre class="programlisting">
                   5674: WRKSRC=                ${WRKDIR}
                   5675: </pre>
                   5676: 
1.14      xtraeme  5677:           <p>Please note that the old <code class=
                   5678:           "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1       grant    5679:           should not be used. Also, if your package doesn't create
1.14      xtraeme  5680:           a subdir with the name of <code class=
                   5681:           "varname">DISTNAME</code> but some different name, set
                   5682:           <code class="varname">WRKSRC</code> to point to the
                   5683:           proper name in <code class="filename">${WRKDIR}</code>.
                   5684:           See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5685:           href=
1.1       grant    5686:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.20      ben      5687:           class="pkgname">lang/tcl</a> and <a xmlns=
                   5688:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5689:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   5690:           class="pkgname">x11/tk</a> for examples, and here is
                   5691:           another one:</p>
1.1       grant    5692:           <pre class="programlisting">
                   5693: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   5694: </pre>
                   5695: 
                   5696:           <p>The name of the working directory created by pkgsrc is
1.14      xtraeme  5697:           <code class="filename">work</code> by default. If the
                   5698:           same pkgsrc tree should be used on several different
                   5699:           platforms, the variable <code class=
                   5700:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1       grant    5701:           attach the platform to the directory name, e.g.
1.14      xtraeme  5702:           <code class="filename">work.i386</code> or <code class=
                   5703:           "filename">work.sparc</code>.</p>
1.1       grant    5704:         </div>
                   5705: 
                   5706:         <div class="sect1" lang="en" xml:lang="en">
                   5707:           <div class="titlepage">
                   5708:             <div>
                   5709:               <div>
                   5710:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      5711:                 "id2627770" id=
        !          5712:                 "id2627770"></a>7.7.&nbsp;<code class=
1.14      xtraeme  5713:                 "filename">files/*</code></h2>
1.1       grant    5714:               </div>
                   5715:             </div>
                   5716:           </div>
                   5717: 
                   5718:           <p>If you have any files that you wish to be placed in
                   5719:           the package prior to configuration or building, you could
                   5720:           place these files here and use a &#8220;<span class=
                   5721:           "quote">${CP}</span>&#8221; command in the
                   5722:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   5723:           target to achieve this. Alternatively, you could simply
1.14      xtraeme  5724:           diff the file against <code class=
                   5725:           "filename">/dev/null</code> and use the patch mechanism
                   5726:           to manage the creation of this file.</p>
1.1       grant    5727:         </div>
                   5728:       </div>
                   5729: 
                   5730:       <div class="chapter" lang="en" xml:lang="en">
                   5731:         <div class="titlepage">
                   5732:           <div>
                   5733:             <div>
                   5734:               <h2 class="title"><a name="plist" id=
                   5735:               "plist"></a>Chapter&nbsp;8.&nbsp;PLIST issues</h2>
                   5736:             </div>
                   5737:           </div>
                   5738:         </div>
                   5739: 
                   5740:         <div class="toc">
                   5741:           <p><b>Table of Contents</b></p>
                   5742: 
                   5743:           <dl>
1.24    ! wiz      5744:             <dt><span class="sect1"><a href="#id2627961">8.1. RCS
1.1       grant    5745:             ID</a></span></dt>
                   5746: 
1.24    ! wiz      5747:             <dt><span class="sect1"><a href="#id2627976">8.2.
1.14      xtraeme  5748:             Semi-automatic <code class="filename">PLIST</code>
                   5749:             generation</a></span></dt>
1.1       grant    5750: 
                   5751:             <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme  5752:             Tweaking output of <span><strong class="command">make
                   5753:             print-PLIST</strong></span></a></span></dt>
1.1       grant    5754: 
                   5755:             <dt><span class="sect1"><a href="#plist.misc">8.4.
                   5756:             Variable substitution in PLIST</a></span></dt>
                   5757: 
1.24    ! wiz      5758:             <dt><span class="sect1"><a href="#id2628297">8.5.
1.1       grant    5759:             Manpage-compression</a></span></dt>
                   5760: 
1.24    ! wiz      5761:             <dt><span class="sect1"><a href="#id2628339">8.6.
1.14      xtraeme  5762:             Changing PLIST source with <code class=
                   5763:             "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5764: 
1.24    ! wiz      5765:             <dt><span class="sect1"><a href="#id2628363">8.7.
1.1       grant    5766:             Platform specific and differing PLISTs</a></span></dt>
                   5767: 
                   5768:             <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
                   5769:             Sharing directories between packages</a></span></dt>
                   5770:           </dl>
                   5771:         </div>
                   5772: 
1.14      xtraeme  5773:         <p>The <code class="filename">PLIST</code> file contains a
1.1       grant    5774:         package's &#8220;<span class="quote">packing
                   5775:         list</span>&#8221;, i.e. a list of files that belong to the
1.14      xtraeme  5776:         package (relative to the <code class=
                   5777:         "filename">${PREFIX}</code> directory it's been installed
                   5778:         in) plus some additional statements - see the <a href=
1.1       grant    5779:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5780:         <span class="citerefentry"><span class=
                   5781:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   5782:         a full list. This chapter addresses some issues that need
1.14      xtraeme  5783:         attention when dealing with the <code class=
                   5784:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    5785: 
                   5786:         <div class="sect1" lang="en" xml:lang="en">
                   5787:           <div class="titlepage">
                   5788:             <div>
                   5789:               <div>
                   5790:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      5791:                 "id2627961" id="id2627961"></a>8.1.&nbsp;RCS
1.1       grant    5792:                 ID</h2>
                   5793:               </div>
                   5794:             </div>
                   5795:           </div>
                   5796: 
                   5797:           <p>Be sure to add a RCS ID line as the first thing in any
1.14      xtraeme  5798:           <code class="filename">PLIST</code> file you write:</p>
1.1       grant    5799:           <pre class="programlisting">
1.17      sketch   5800: @comment $NetBSD$
1.1       grant    5801: </pre>
                   5802:         </div>
                   5803: 
                   5804:         <div class="sect1" lang="en" xml:lang="en">
                   5805:           <div class="titlepage">
                   5806:             <div>
                   5807:               <div>
                   5808:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      5809:                 "id2627976" id=
        !          5810:                 "id2627976"></a>8.2.&nbsp;Semi-automatic
1.14      xtraeme  5811:                 <code class="filename">PLIST</code> generation</h2>
1.1       grant    5812:               </div>
                   5813:             </div>
                   5814:           </div>
                   5815: 
1.14      xtraeme  5816:           <p>You can use the <span><strong class="command">make
                   5817:           print-PLIST</strong></span> command to output a PLIST
                   5818:           that matches any new files since the package was
                   5819:           extracted. See <a href="#build.helpful-targets" title=
1.1       grant    5820:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   5821:           &#8220;Other helpful targets&#8221;</a> for more
                   5822:           information on this target.</p>
                   5823:         </div>
                   5824: 
                   5825:         <div class="sect1" lang="en" xml:lang="en">
                   5826:           <div class="titlepage">
                   5827:             <div>
                   5828:               <div>
                   5829:                 <h2 class="title" style="clear: both"><a name=
                   5830:                 "print-PLIST" id=
                   5831:                 "print-PLIST"></a>8.3.&nbsp;Tweaking output of
1.14      xtraeme  5832:                 <span><strong class="command">make
                   5833:                 print-PLIST</strong></span></h2>
1.1       grant    5834:               </div>
                   5835:             </div>
                   5836:           </div>
                   5837: 
                   5838:           <p>If you have used any of the *-dirs packages, as
                   5839:           explained in <a href="#faq.common-dirs" title=
                   5840:           "8.8.&nbsp;Sharing directories between packages">Section&nbsp;8.8,
                   5841:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  5842:           you may have noticed that <span><strong class=
                   5843:           "command">make print-PLIST</strong></span> outputs a set
                   5844:           of <code class="varname">@comment</code>s instead of real
                   5845:           <code class="varname">@dirrm</code> lines. You can also
                   5846:           do this for specific directories and files, so that the
                   5847:           results of that command are very close to reality. This
                   5848:           helps <span class="emphasis"><em>a lot</em></span> during
                   5849:           the update of packages.</p>
                   5850: 
                   5851:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   5852:           variable takes a set of AWK patterns and actions that are
                   5853:           used to filter the output of print-PLIST. You can
                   5854:           <span class="emphasis"><em>append</em></span> any chunk
                   5855:           of AWK scripting you like to it, but be careful with
1.1       grant    5856:           quoting.</p>
                   5857: 
1.14      xtraeme  5858:           <p>For example, to get all files inside the <code class=
                   5859:           "filename">libdata/foo</code> directory removed from the
1.1       grant    5860:           resulting PLIST:</p>
                   5861:           <pre class="programlisting">
                   5862:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   5863:     
                   5864: </pre>
                   5865: 
1.14      xtraeme  5866:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    5867:           lines referring to a specific (shared) directory
1.14      xtraeme  5868:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    5869:           <pre class="programlisting">
                   5870:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   5871:     
                   5872: </pre>
                   5873:         </div>
                   5874: 
                   5875:         <div class="sect1" lang="en" xml:lang="en">
                   5876:           <div class="titlepage">
                   5877:             <div>
                   5878:               <div>
                   5879:                 <h2 class="title" style="clear: both"><a name=
                   5880:                 "plist.misc" id="plist.misc"></a>8.4.&nbsp;Variable
                   5881:                 substitution in PLIST</h2>
                   5882:               </div>
                   5883:             </div>
                   5884:           </div>
                   5885: 
                   5886:           <p>A number of variables are substituted automatically in
                   5887:           PLISTs when a package is installed on a system. This
                   5888:           includes the following variables:</p>
                   5889: 
                   5890:           <div class="variablelist">
                   5891:             <dl>
1.14      xtraeme  5892:               <dt><span class="term"><code class=
                   5893:               "varname">${MACHINE_ARCH}</code>, <code class=
                   5894:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    5895: 
                   5896:               <dd>
                   5897:                 <p>Some packages like emacs and perl embed
                   5898:                 information about which architecture they were
                   5899:                 built on into the pathnames where they install
                   5900:                 their file. To handle this case, PLIST will be
                   5901:                 preprocessed before actually used, and the symbol
1.14      xtraeme  5902:                 &#8220;<span class="quote"><code class=
                   5903:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   5904:                 be replaced by what <span><strong class=
                   5905:                 "command">uname -p</strong></span> gives. The same
                   5906:                 is done if the string <code class=
                   5907:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   5908:                 PLIST somewhere - use this on packages that have
                   5909:                 GNU autoconf created configure scripts.</p>
1.1       grant    5910: 
                   5911:                 <div class="note" style=
                   5912:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   5913:                   <h3 class="title">Legacy note</h3>
                   5914: 
                   5915:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  5916:                   "quote"><code class=
                   5917:                   "varname">$ARCH</code></span>&#8221; that was
                   5918:                   replaced by the output of <span><strong class=
                   5919:                   "command">uname -m</strong></span>, but that's no
1.1       grant    5920:                   longer supported and has been removed.</p>
                   5921:                 </div>
                   5922:               </dd>
                   5923: 
1.14      xtraeme  5924:               <dt><span class="term"><code class=
                   5925:               "varname">${OPSYS}</code>, <code class=
                   5926:               "varname">${LOWER_OPSYS}</code>, <code class=
                   5927:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    5928: 
                   5929:               <dd>
                   5930:                 <p>Some packages want to embed the OS name and
                   5931:                 version into some paths. To do this, use these
1.14      xtraeme  5932:                 variables in the <code class=
                   5933:                 "filename">PLIST</code>:</p>
1.1       grant    5934: 
                   5935:                 <div class="itemizedlist">
                   5936:                   <ul type="disc">
                   5937:                     <li>
1.14      xtraeme  5938:                       <p><code class="varname">${OPSYS}</code> -
                   5939:                       output of &#8220;<span class=
                   5940:                       "quote"><span><strong class="command">uname
                   5941:                       -s</strong></span></span>&#8221;</p>
1.1       grant    5942:                     </li>
                   5943: 
                   5944:                     <li>
1.14      xtraeme  5945:                       <p><code class=
                   5946:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   5947:                       common name (eg. &#8220;<span class=
                   5948:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    5949:                     </li>
                   5950: 
                   5951:                     <li>
1.14      xtraeme  5952:                       <p><code class="varname">${OS_VERSION}</code>
                   5953:                       - &#8220;<span class=
                   5954:                       "quote"><span><strong class="command">uname
                   5955:                       -r</strong></span></span>&#8221;</p>
1.1       grant    5956:                     </li>
                   5957:                   </ul>
                   5958:                 </div>
                   5959:               </dd>
                   5960: 
1.14      xtraeme  5961:               <dt><span class="term"><code class=
                   5962:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    5963: 
                   5964:               <dd>
                   5965:                 <p>Packages that install locale files should list
                   5966:                 them in the PLIST as &#8220;<span class=
                   5967:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   5968:                 instead of &#8220;<span class=
                   5969:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   5970:                 This properly handles the fact that different
                   5971:                 operating systems expect locale files to be either
1.14      xtraeme  5972:                 in <code class="filename">share</code> or
                   5973:                 <code class="filename">lib</code> by default.</p>
1.1       grant    5974:               </dd>
                   5975:             </dl>
                   5976:           </div>
                   5977: 
                   5978:           <p>For a complete list of values which are replaced by
1.14      xtraeme  5979:           default, please look in <code class=
                   5980:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    5981:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   5982: 
                   5983:           <p>If you want to change other variables not listed
                   5984:           above, you can add variables and their expansions to this
1.14      xtraeme  5985:           variable in the following way, similar to <code class=
                   5986:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    5987:           "#components.optional" title=
                   5988:           "7.5.&nbsp;Optional files">Section&nbsp;7.5,
                   5989:           &#8220;Optional files&#8221;</a>):</p>
                   5990:           <pre class="programlisting">
                   5991: PLIST_SUBST+=    SOMEVAR="somevalue"
                   5992: </pre>
                   5993: 
                   5994:           <p>This replaces all occurrences of &#8220;<span class=
                   5995:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   5996:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   5997:         </div>
                   5998: 
                   5999:         <div class="sect1" lang="en" xml:lang="en">
                   6000:           <div class="titlepage">
                   6001:             <div>
                   6002:               <div>
                   6003:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      6004:                 "id2628297" id=
        !          6005:                 "id2628297"></a>8.5.&nbsp;Manpage-compression</h2>
1.1       grant    6006:               </div>
                   6007:             </div>
                   6008:           </div>
                   6009: 
                   6010:           <p>Manpages should be installed in compressed form if
1.14      xtraeme  6011:           <code class="varname">MANZ</code> is set (in <code class=
                   6012:           "filename">bsd.own.mk</code>), and uncompressed
                   6013:           otherwise. To handle this in the <code class=
                   6014:           "filename">PLIST</code> file, the suffix
                   6015:           &#8220;<span class="quote">.gz</span>&#8221; is
                   6016:           appended/removed automatically for manpages according to
                   6017:           <code class="varname">MANZ</code> and <code class=
                   6018:           "varname">MANCOMPRESSED</code> being set or not, see
                   6019:           above for details. This modification of the <code class=
                   6020:           "filename">PLIST</code> file is done on a copy of it, not
                   6021:           <code class="filename">PLIST</code> itself.</p>
1.1       grant    6022:         </div>
                   6023: 
                   6024:         <div class="sect1" lang="en" xml:lang="en">
                   6025:           <div class="titlepage">
                   6026:             <div>
                   6027:               <div>
                   6028:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      6029:                 "id2628339" id="id2628339"></a>8.6.&nbsp;Changing
1.14      xtraeme  6030:                 PLIST source with <code class=
                   6031:                 "varname">PLIST_SRC</code></h2>
1.1       grant    6032:               </div>
                   6033:             </div>
                   6034:           </div>
                   6035: 
1.14      xtraeme  6036:           <p>To use one or more files as source for the
                   6037:           <code class="filename">PLIST</code> used in generating
                   6038:           the binary package, set the variable <code class=
                   6039:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24    ! wiz      6040:           The files are later concatenated using <a href=
        !          6041:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
        !          6042:           <span class="citerefentry"><span class=
        !          6043:           "refentrytitle">cat</span>(1)</span></a>, and order of
        !          6044:           things is important.</p>
1.1       grant    6045:         </div>
                   6046: 
                   6047:         <div class="sect1" lang="en" xml:lang="en">
                   6048:           <div class="titlepage">
                   6049:             <div>
                   6050:               <div>
                   6051:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      6052:                 "id2628363" id="id2628363"></a>8.7.&nbsp;Platform
1.1       grant    6053:                 specific and differing PLISTs</h2>
                   6054:               </div>
                   6055:             </div>
                   6056:           </div>
                   6057: 
                   6058:           <p>Some packages decide to install a different set of
                   6059:           files based on the operating system being used. These
                   6060:           differences can be automatically handled by using the
                   6061:           following files:</p>
                   6062: 
                   6063:           <div class="itemizedlist">
                   6064:             <ul type="disc">
                   6065:               <li>
1.14      xtraeme  6066:                 <p><code class="filename">PLIST.common</code></p>
1.1       grant    6067:               </li>
                   6068: 
                   6069:               <li>
1.14      xtraeme  6070:                 <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1       grant    6071:               </li>
                   6072: 
                   6073:               <li>
1.14      xtraeme  6074:                 <p><code class=
1.21      ben      6075:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   6076:               </li>
                   6077: 
                   6078:               <li>
                   6079:                 <p><code class=
                   6080:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   6081:               </li>
                   6082: 
                   6083:               <li>
                   6084:                 <p><code class=
1.14      xtraeme  6085:                 "filename">PLIST.common_end</code></p>
1.1       grant    6086:               </li>
                   6087:             </ul>
                   6088:           </div>
                   6089:         </div>
                   6090: 
                   6091:         <div class="sect1" lang="en" xml:lang="en">
                   6092:           <div class="titlepage">
                   6093:             <div>
                   6094:               <div>
                   6095:                 <h2 class="title" style="clear: both"><a name=
                   6096:                 "faq.common-dirs" id=
                   6097:                 "faq.common-dirs"></a>8.8.&nbsp;Sharing directories
                   6098:                 between packages</h2>
                   6099:               </div>
                   6100:             </div>
                   6101:           </div>
                   6102: 
                   6103:           <p>A &#8220;<span class="quote">shared
                   6104:           directory</span>&#8221; is a directory where multiple
                   6105:           (and unrelated) packages install files. These directories
                   6106:           are problematic because you have to add special tricks in
                   6107:           the PLIST to conditionally remove them, or have some
                   6108:           centralized package handle them.</p>
                   6109: 
                   6110:           <p>Within pkgsrc, you'll find both approaches. If a
                   6111:           directory is shared by a few unrelated packages, it's
                   6112:           often not worth to add an extra package to remove it.
                   6113:           Therefore, one simply does:</p>
                   6114:           <pre class="programlisting">
                   6115:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   6116:     
                   6117: </pre>
                   6118: 
                   6119:           <p>in the PLISTs of all affected packages, instead of the
                   6120:           regular "@dirrm" line.</p>
                   6121: 
                   6122:           <p>However, if the directory is shared across many
                   6123:           packages, two different solutions are available:</p>
                   6124: 
                   6125:           <div class="orderedlist">
                   6126:             <ol type="1">
                   6127:               <li>
                   6128:                 <p>If the packages have a common dependency, the
                   6129:                 directory can be removed in that. For example, see
                   6130:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6131:                 href=
                   6132:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20      ben      6133:                 class="pkgname">textproc/scrollkeeper</a>, which
                   6134:                 removes the shared directory <code class=
                   6135:                 "filename">share/omf</code>.</p>
1.1       grant    6136:               </li>
                   6137: 
                   6138:               <li>
                   6139:                 <p>If the packages using the directory are not
                   6140:                 related at all (they have no common dependencies),
                   6141:                 a *-dirs package is used.</p>
                   6142:               </li>
                   6143:             </ol>
                   6144:           </div>
                   6145: 
                   6146:           <p>From now on, we'll discuss the second solution. To get
                   6147:           an idea of the *-dirs packages available, issue:</p>
                   6148:           <pre class="programlisting">
1.14      xtraeme  6149:       <code class="prompt">%</code> cd .../pkgsrc
                   6150:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    6151:     
                   6152: </pre>
                   6153: 
                   6154:           <p>Their use from other packages is very simple. The
1.14      xtraeme  6155:           <code class="varname">USE_DIRS</code> variable takes a
                   6156:           list of package names (without the &#8220;<span class=
1.1       grant    6157:           "quote">-dirs</span>&#8221; part) together with the
                   6158:           required version number (always pick the latest one when
                   6159:           writting new packages).</p>
                   6160: 
                   6161:           <p>For example, if a package installs files under
1.14      xtraeme  6162:           <code class="filename">share/applications</code>, it
                   6163:           should have the following line in it:</p>
1.1       grant    6164:           <pre class="programlisting">
                   6165:       USE_DIRS+= xdg-1.1
                   6166:     
                   6167: </pre>
                   6168: 
1.14      xtraeme  6169:           <p>After regenerating the PLIST using
                   6170:           <span><strong class="command">make
                   6171:           print-PLIST</strong></span>, you should get the right
                   6172:           (commented out) lines.</p>
1.1       grant    6173: 
1.14      xtraeme  6174:           <p>Note that, even if your package is using <code class=
                   6175:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    6176:           *-x11-dirs packages. Just specify the name without that
1.14      xtraeme  6177:           part and pkgsrc (in particular, <code class=
                   6178:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    6179:         </div>
                   6180:       </div>
                   6181: 
                   6182:       <div class="chapter" lang="en" xml:lang="en">
                   6183:         <div class="titlepage">
                   6184:           <div>
                   6185:             <div>
                   6186:               <h2 class="title"><a name="buildlink" id=
                   6187:               "buildlink"></a>Chapter&nbsp;9.&nbsp;Buildlink
                   6188:               methodology</h2>
                   6189:             </div>
                   6190:           </div>
                   6191:         </div>
                   6192: 
                   6193:         <div class="toc">
                   6194:           <p><b>Table of Contents</b></p>
                   6195: 
                   6196:           <dl>
1.24    ! wiz      6197:             <dt><span class="sect1"><a href="#id2628562">9.1.
1.1       grant    6198:             Converting packages to use buildlink3</a></span></dt>
                   6199: 
1.24    ! wiz      6200:             <dt><span class="sect1"><a href="#id2628948">9.2.
1.14      xtraeme  6201:             Writing <code class="filename">buildlink3.mk</code>
                   6202:             files</a></span></dt>
1.1       grant    6203: 
                   6204:             <dd>
                   6205:               <dl>
1.24    ! wiz      6206:                 <dt><span class="sect2"><a href="#id2629017">9.2.1.
1.1       grant    6207:                 Anatomy of a buildlink3.mk file</a></span></dt>
                   6208: 
1.24    ! wiz      6209:                 <dt><span class="sect2"><a href="#id2629458">9.2.2.
1.14      xtraeme  6210:                 Updating <code class=
                   6211:                 "varname">BUILDLINK_DEPENDS.<em class=
                   6212:                 "replaceable"><code>pkg</code></em></code> in
                   6213:                 <code class="filename">buildlink3.mk</code>
1.1       grant    6214:                 files</a></span></dt>
                   6215:               </dl>
                   6216:             </dd>
                   6217: 
1.24    ! wiz      6218:             <dt><span class="sect1"><a href="#id2629537">9.3.
1.14      xtraeme  6219:             Writing <code class="filename">builtin.mk</code>
                   6220:             files</a></span></dt>
1.1       grant    6221: 
                   6222:             <dd>
                   6223:               <dl>
1.24    ! wiz      6224:                 <dt><span class="sect2"><a href="#id2629618">9.3.1.
1.14      xtraeme  6225:                 Anatomy of a <code class=
                   6226:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    6227: 
1.24    ! wiz      6228:                 <dt><span class="sect2"><a href="#id2629913">9.3.2.
1.1       grant    6229:                 Global preferences for native or pkgsrc
                   6230:                 software</a></span></dt>
                   6231:               </dl>
                   6232:             </dd>
                   6233:           </dl>
                   6234:         </div>
                   6235: 
                   6236:         <p>Buildlink is a framework in pkgsrc that controls what
                   6237:         headers and libraries are seen by a package's configure and
                   6238:         build processes. This is implemented in a two step
                   6239:         process:</p>
                   6240: 
                   6241:         <div class="orderedlist">
                   6242:           <ol type="1">
                   6243:             <li>
                   6244:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  6245:               into <code class="varname">BUILDLINK_DIR</code>,
                   6246:               which by default is a subdirectory of <code class=
                   6247:               "varname">WRKDIR</code>.</p>
1.1       grant    6248:             </li>
                   6249: 
                   6250:             <li>
                   6251:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  6252:               the normal compiler tools that translate <code class=
                   6253:               "option">-I${LOCALBASE}/include</code> and
                   6254:               <code class="option">-L${LOCALBASE}/lib</code> into
                   6255:               references to <code class=
                   6256:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   6257:               also make native compiler on some operating systems
                   6258:               look like GCC, so that packages that expect GCC won't
                   6259:               require modifications to build with those native
                   6260:               compilers.</p>
1.1       grant    6261:             </li>
                   6262:           </ol>
                   6263:         </div>
                   6264: 
                   6265:         <p>This normalizes the environment in which a package is
                   6266:         built so that the package may be built consistently despite
                   6267:         what other software may be installed. Please note that the
1.14      xtraeme  6268:         normal system header and library paths, e.g. <code class=
                   6269:         "filename">/usr/include</code>, <code class=
                   6270:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    6271:         buildlink3 is designed to insulate the package build from
                   6272:         non-system-supplied software.</p>
                   6273: 
                   6274:         <div class="sect1" lang="en" xml:lang="en">
                   6275:           <div class="titlepage">
                   6276:             <div>
                   6277:               <div>
                   6278:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      6279:                 "id2628562" id="id2628562"></a>9.1.&nbsp;Converting
1.1       grant    6280:                 packages to use buildlink3</h2>
                   6281:               </div>
                   6282:             </div>
                   6283:           </div>
                   6284: 
                   6285:           <p>The process of converting packages to use the
                   6286:           buildlink3 framework (&#8220;<span class=
                   6287:           "quote">bl3ifying</span>&#8221;) is fairly
                   6288:           straightforward. The things to keep in mind are:</p>
                   6289: 
                   6290:           <div class="orderedlist">
                   6291:             <ol type="1">
                   6292:               <li>
                   6293:                 <p>Ensure that the build always calls the wrapper
                   6294:                 scripts instead of the actual toolchain. Some
                   6295:                 packages are tricky, and the only way to know for
1.14      xtraeme  6296:                 sure is the check <code class=
                   6297:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    6298:                 wrappers are being invoked.</p>
                   6299:               </li>
                   6300: 
                   6301:               <li>
1.14      xtraeme  6302:                 <p>Don't override <code class=
                   6303:                 "varname">PREFIX</code> from within the package
                   6304:                 Makefile, e.g. Java VMs, standalone shells, etc.,
                   6305:                 because the code to symlink files into <code class=
                   6306:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    6307:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  6308:                 <em class=
                   6309:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    6310:               </li>
                   6311: 
                   6312:               <li>
                   6313:                 <p>Remember that <span class=
1.14      xtraeme  6314:                 "emphasis"><em>only</em></span> the <code class=
                   6315:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    6316:                 in a package's Makefile are added as dependencies
                   6317:                 for that package.</p>
                   6318:               </li>
                   6319:             </ol>
                   6320:           </div>
                   6321: 
                   6322:           <p>If a dependency on a particular package is required
                   6323:           for its libraries and headers, then we replace:</p>
                   6324:           <pre class="programlisting">
                   6325: DEPENDS+=       foo&gt;=1.1.0:../../category/foo
                   6326: </pre>
                   6327: 
                   6328:           <p>with</p>
                   6329:           <pre class="programlisting">
                   6330: .include "../../category/foo/buildlink3.mk"
                   6331: </pre>
                   6332: 
1.14      xtraeme  6333:           <p>There are several <code class=
                   6334:           "filename">buildlink3.mk</code> files in <code class=
                   6335:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    6336:           issues:</p>
                   6337: 
                   6338:           <div class="itemizedlist">
                   6339:             <ul type="disc">
                   6340:               <li>
1.14      xtraeme  6341:                 <p><code class="filename">bdb.buildlink3.mk</code>
1.1       grant    6342:                 chooses either the native or a pkgsrc Berkeley DB
1.14      xtraeme  6343:                 implementation based on the values of <code class=
                   6344:                 "varname">BDB_ACCEPTED</code> and <code class=
                   6345:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    6346:               </li>
                   6347: 
                   6348:               <li>
1.14      xtraeme  6349:                 <p><code class=
                   6350:                 "filename">curses.buildlink3.mk</code> If the
                   6351:                 system comes with neither Curses nor NCurses, this
                   6352:                 will take care to install the <a xmlns=
                   6353:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    6354:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20      ben      6355:                 class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    6356:               </li>
                   6357: 
                   6358:               <li>
1.14      xtraeme  6359:                 <p><code class="filename">krb5.buildlink3.mk</code>
                   6360:                 uses the value of <code class=
                   6361:                 "varname">KRB5_ACCEPTED</code> to choose between
1.1       grant    6362:                 adding a dependency on Heimdal or MIT-krb5 for
                   6363:                 packages that require a Kerberos 5
                   6364:                 implementation.</p>
                   6365:               </li>
                   6366: 
                   6367:               <li>
1.14      xtraeme  6368:                 <p><code class=
                   6369:                 "filename">motif.buildlink3.mk</code> checks for a
                   6370:                 system-provided Motif installation or adds a
                   6371:                 dependency on <a xmlns=
1.1       grant    6372:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6373:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20      ben      6374:                 class="pkgname">x11/lesstif</a> or <a xmlns=
                   6375:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6376:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
                   6377:                 class="pkgname">x11/openmotif</a>;</p>
1.1       grant    6378:               </li>
                   6379: 
                   6380:               <li>
1.14      xtraeme  6381:                 <p><code class=
                   6382:                 "filename">ossaudio.buildlink3.mk</code> defines
                   6383:                 several variables that may be used by packages that
                   6384:                 use the Open Sound System (OSS) API;</p>
1.1       grant    6385:               </li>
                   6386: 
                   6387:               <li>
1.14      xtraeme  6388:                 <p><code class=
                   6389:                 "filename">pgsql.buildlink3.mk</code> will accept
                   6390:                 either Postgres 7.3 or 7.4, whichever is found
                   6391:                 installed. See the file for more information.</p>
1.1       grant    6392:               </li>
                   6393: 
                   6394:               <li>
1.14      xtraeme  6395:                 <p><code class=
                   6396:                 "filename">pthread.buildlink3.mk</code> uses the
                   6397:                 value of <code class="varname">PTHREAD_OPTS</code>
                   6398:                 and checks for native pthreads or adds a dependency
                   6399:                 on <a xmlns=
1.1       grant    6400:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6401:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20      ben      6402:                 class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    6403:               </li>
                   6404: 
                   6405:               <li>
1.14      xtraeme  6406:                 <p><code class="filename">xaw.buildlink3.mk</code>
                   6407:                 uses the value of <code class=
                   6408:                 "varname">XAW_TYPE</code> to choose a particular
                   6409:                 Athena widgets library.</p>
1.1       grant    6410:               </li>
                   6411:             </ul>
                   6412:           </div>
                   6413: 
1.14      xtraeme  6414:           <p>The comments in those <code class=
                   6415:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    6416:           complete description of how to use them properly.</p>
                   6417:         </div>
                   6418: 
                   6419:         <div class="sect1" lang="en" xml:lang="en">
                   6420:           <div class="titlepage">
                   6421:             <div>
                   6422:               <div>
                   6423:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      6424:                 "id2628948" id="id2628948"></a>9.2.&nbsp;Writing
1.14      xtraeme  6425:                 <code class="filename">buildlink3.mk</code>
                   6426:                 files</h2>
1.1       grant    6427:               </div>
                   6428:             </div>
                   6429:           </div>
                   6430: 
1.14      xtraeme  6431:           <p>A package's <code class=
                   6432:           "filename">buildlink3.mk</code> file is included by
                   6433:           Makefiles to indicate the need to compile and link
                   6434:           against header files and libraries provided by the
                   6435:           package. A <code class="filename">buildlink3.mk</code>
                   6436:           file should always provide enough information to add the
                   6437:           correct type of dependency relationship and include any
                   6438:           other <code class="filename">buildlink3.mk</code> files
                   6439:           that it needs to find headers and libraries that it needs
                   6440:           in turn.</p>
1.1       grant    6441: 
1.14      xtraeme  6442:           <p>To generate an initial <code class=
                   6443:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    6444:           Rene Hexel's <a xmlns=
                   6445:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6446:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20      ben      6447:           class="pkgname">pkgtools/createbuildlink</a> package is
                   6448:           highly recommended. For most packages, the following
                   6449:           command will generate a good starting point for
                   6450:           <code class="filename">buildlink3.mk</code> files:</p>
1.1       grant    6451:           <pre class="screen">
1.14      xtraeme  6452: <code class="prompt">%</code> <strong class=
                   6453: "userinput"><code>cd pkgsrc/<em class=
                   6454: "replaceable"><code>category</code></em>/<em class=
                   6455: "replaceable"><code>pkgdir</code></em>
                   6456: <code class=
                   6457: "prompt">%</code> createbuildlink -3 &gt;buildlink3.mk</code></strong>
1.1       grant    6458: </pre>
                   6459: 
                   6460:           <div class="sect2" lang="en" xml:lang="en">
                   6461:             <div class="titlepage">
                   6462:               <div>
                   6463:                 <div>
1.24    ! wiz      6464:                   <h3 class="title"><a name="id2629017" id=
        !          6465:                   "id2629017"></a>9.2.1. Anatomy of a buildlink3.mk
1.1       grant    6466:                   file</h3>
                   6467:                 </div>
                   6468:               </div>
                   6469:             </div>
                   6470: 
1.14      xtraeme  6471:             <p>The following real-life example <code class=
                   6472:             "filename">buildlink3.mk</code> is taken from
                   6473:             <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    6474:             <pre class="programlisting">
1.17      sketch   6475: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    6476: 
                   6477: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   6478: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   6479: 
                   6480: .if !empty(BUILDLINK_DEPTH:M+)
                   6481: BUILDLINK_DEPENDS+=     tiff
                   6482: .endif
                   6483: 
                   6484: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   6485: BUILDLINK_PACKAGES+=    tiff
                   6486: 
                   6487: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   6488: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   6489: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   6490: .endif  # TIFF_BUILDLINK3_MK
                   6491: 
                   6492: .include "../../devel/zlib/buildlink3.mk"
                   6493: .include "../../graphics/jpeg/buildlink3.mk"
                   6494: 
                   6495: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   6496: </pre>
                   6497: 
1.14      xtraeme  6498:             <p>The header and footer manipulate <code class=
                   6499:             "varname">BUILDLINK_DEPTH</code>, which is common
                   6500:             across all <code class="filename">buildlink3.mk</code>
                   6501:             files and is used to track at what depth we are
                   6502:             including <code class="filename">buildlink3.mk</code>
                   6503:             files.</p>
1.1       grant    6504: 
                   6505:             <p>The first section controls if the dependency on
1.14      xtraeme  6506:             <em class="replaceable"><code>pkg</code></em> is added.
                   6507:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    6508:             global list of packages for which dependencies are
                   6509:             added by buildlink3.</p>
                   6510: 
                   6511:             <p>The second section advises pkgsrc that the
1.14      xtraeme  6512:             <code class="filename">buildlink3.mk</code> file for
                   6513:             <em class="replaceable"><code>pkg</code></em> has been
                   6514:             included at some point. <code class=
                   6515:             "varname">BUILDLINK_PACKAGES</code> is the global list
                   6516:             of packages for which <code class=
                   6517:             "filename">buildlink3.mk</code> files have been
                   6518:             included. It must <span class=
                   6519:             "emphasis"><em>always</em></span> be appended to within
                   6520:             a <code class="filename">buildlink3.mk</code> file.</p>
1.1       grant    6521: 
                   6522:             <p>The third section is protected from multiple
1.14      xtraeme  6523:             inclusion and controls how the dependency on <em class=
                   6524:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    6525:             important variables are set in the section:</p>
                   6526: 
                   6527:             <div class="itemizedlist">
                   6528:               <ul type="disc">
                   6529:                 <li>
1.14      xtraeme  6530:                   <p><code class=
                   6531:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6532:                   "replaceable"><code>pkg</code></em></code> is the
                   6533:                   actual dependency recorded in the installed
                   6534:                   package; this should always be set using
                   6535:                   <span><strong class="command">+=</strong></span>
                   6536:                   to ensure that we're appending to any
                   6537:                   pre-existing list of values. This variable should
                   6538:                   be set to the first version of the package that
                   6539:                   had the last change in the major number of a
                   6540:                   shared library or that had a major API
                   6541:                   change.</p>
1.1       grant    6542:                 </li>
                   6543: 
                   6544:                 <li>
1.14      xtraeme  6545:                   <p><code class=
                   6546:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   6547:                   "replaceable"><code>pkg</code></em></code> is the
                   6548:                   location of the <em class=
                   6549:                   "replaceable"><code>pkg</code></em> pkgsrc
1.1       grant    6550:                   directory;</p>
                   6551:                 </li>
                   6552: 
                   6553:                 <li>
1.14      xtraeme  6554:                   <p><code class=
                   6555:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6556:                   "replaceable"><code>pkg</code></em></code> (not
                   6557:                   shown above) controls whether we use <code class=
                   6558:                   "varname">BUILD_DEPENDS</code> or <code class=
                   6559:                   "varname">DEPENDS</code> to add the dependency on
                   6560:                   <em class="replaceable"><code>pkg</code></em>.
                   6561:                   The build dependency is selected by setting
                   6562:                   <code class=
                   6563:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6564:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    6565:                   &#8220;<span class="quote">build</span>&#8221;.
                   6566:                   By default, the full dependency is used.</p>
                   6567:                 </li>
                   6568: 
                   6569:                 <li>
1.14      xtraeme  6570:                   <p><code class=
                   6571:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6572:                   "replaceable"><code>pkg</code></em></code> and
                   6573:                   <code class=
                   6574:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
                   6575:                   <code>pkg</code></em></code> (not shown above)
                   6576:                   are lists of subdirectories of <code class=
                   6577:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6578:                   "replaceable"><code>pkg</code></em>}</code> to
                   6579:                   add to the header and library search paths. These
1.1       grant    6580:                   default to &#8220;<span class=
                   6581:                   "quote">include</span>&#8221; and
                   6582:                   &#8220;<span class="quote">lib</span>&#8221;
                   6583:                   respectively.</p>
                   6584:                 </li>
                   6585: 
                   6586:                 <li>
1.14      xtraeme  6587:                   <p><code class=
                   6588:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   6589:                   "replaceable"><code>pkg</code></em></code> (not
                   6590:                   shown above) is the list of preprocessor flags to
                   6591:                   add to <code class="varname">CPPFLAGS</code>,
                   6592:                   which are passed on to the configure and build
                   6593:                   phases. The &#8220;<span class=
                   6594:                   "quote">-I</span>&#8221; option should be avoided
                   6595:                   and instead be handled using <code class=
                   6596:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6597:                   "replaceable"><code>pkg</code></em></code> as
                   6598:                   above.</p>
1.1       grant    6599:                 </li>
                   6600:               </ul>
                   6601:             </div>
                   6602: 
                   6603:             <p>The following variables are all optionally defined
                   6604:             within this second section (protected against multiple
                   6605:             inclusion) and control which package files are
1.14      xtraeme  6606:             symlinked into <code class=
                   6607:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    6608:             are transformed during the symlinking:</p>
                   6609: 
                   6610:             <div class="itemizedlist">
                   6611:               <ul type="disc">
                   6612:                 <li>
1.14      xtraeme  6613:                   <p><code class=
                   6614:                   "varname">BUILDLINK_FILES.<em class=
                   6615:                   "replaceable"><code>pkg</code></em></code> (not
                   6616:                   shown above) is a shell glob pattern relative to
                   6617:                   <code class=
                   6618:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6619:                   "replaceable"><code>pkg</code></em>}</code> to be
                   6620:                   symlinked into <code class=
                   6621:                   "filename">${BUILDLINK_DIR}</code>, e.g.
                   6622:                   <code class="filename">include/*.h</code>.</p>
1.1       grant    6623:                 </li>
                   6624: 
                   6625:                 <li>
1.14      xtraeme  6626:                   <p><code class=
                   6627:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   6628:                   "replaceable"><code>pkg</code></em></code> (not
                   6629:                   shown above) is a shell pipeline that outputs to
                   6630:                   stdout a list of files relative to <code class=
                   6631:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6632:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    6633:                   resulting files are to be symlinked into
1.14      xtraeme  6634:                   <code class="filename">${BUILDLINK_DIR}</code>.
                   6635:                   By default, this takes the <code class=
                   6636:                   "filename">+CONTENTS</code> of a <em class=
                   6637:                   "replaceable"><code>pkg</code></em> and filters
                   6638:                   it through <code class=
                   6639:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   6640:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    6641:                 </li>
                   6642: 
                   6643:                 <li>
1.14      xtraeme  6644:                   <p><code class=
                   6645:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6646:                   "replaceable"><code>pkg</code></em></code> (not
                   6647:                   shown above) is a filter command that filters
                   6648:                   <code class="filename">+CONTENTS</code> input
                   6649:                   into a list of files relative to <code class=
                   6650:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6651:                   "replaceable"><code>pkg</code></em>}</code> on
                   6652:                   stdout. By default for overwrite packages,
                   6653:                   <code class=
                   6654:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6655:                   "replaceable"><code>pkg</code></em></code>
                   6656:                   outputs the contents of the <code class=
                   6657:                   "filename">include</code> and <code class=
                   6658:                   "filename">lib</code> directories in the package
                   6659:                   <code class="filename">+CONTENTS</code>, and for
                   6660:                   pkgviews packages, it outputs any libtool
                   6661:                   archives in <code class="filename">lib</code>
1.1       grant    6662:                   directories.</p>
                   6663:                 </li>
                   6664: 
                   6665:                 <li>
1.14      xtraeme  6666:                   <p><code class=
                   6667:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   6668:                   "replaceable"><code>pkg</code></em></code> (not
                   6669:                   shown above) is a list of sed arguments used to
1.1       grant    6670:                   transform the name of the source filename into a
1.14      xtraeme  6671:                   destination filename, e.g. <span><strong class=
1.1       grant    6672:                   "command">-e
1.14      xtraeme  6673:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    6674:                 </li>
                   6675:               </ul>
                   6676:             </div>
                   6677: 
1.14      xtraeme  6678:             <p>The last section includes any <code class=
                   6679:             "filename">buildlink3.mk</code> needed for <em class=
                   6680:             "replaceable"><code>pkg</code></em>'s library
                   6681:             dependencies. Including these <code class=
                   6682:             "filename">buildlink3.mk</code> files means that the
                   6683:             headers and libraries for these dependencies are also
                   6684:             symlinked into <code class=
                   6685:             "filename">${BUILDLINK_DIR}</code> whenever the
                   6686:             <em class="replaceable"><code>pkg</code></em>
                   6687:             <code class="filename">buildlink3.mk</code> file is
                   6688:             included.</p>
1.1       grant    6689:           </div>
                   6690: 
                   6691:           <div class="sect2" lang="en" xml:lang="en">
                   6692:             <div class="titlepage">
                   6693:               <div>
                   6694:                 <div>
1.24    ! wiz      6695:                   <h3 class="title"><a name="id2629458" id=
        !          6696:                   "id2629458"></a>9.2.2. Updating <code class=
1.14      xtraeme  6697:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6698:                   "replaceable"><code>pkg</code></em></code> in
                   6699:                   <code class="filename">buildlink3.mk</code>
                   6700:                   files</h3>
1.1       grant    6701:                 </div>
                   6702:               </div>
                   6703:             </div>
                   6704: 
                   6705:             <p>There are two situations that require increasing the
1.14      xtraeme  6706:             dependency listed in <code class=
                   6707:             "varname">BUILDLINK_DEPENDS.<em class=
                   6708:             "replaceable"><code>pkg</code></em></code> after a
                   6709:             package update:</p>
1.1       grant    6710: 
                   6711:             <div class="orderedlist">
                   6712:               <ol type="1">
                   6713:                 <li>
                   6714:                   <p>if the sonames (major number of the library
                   6715:                   version) of any installed shared libraries
                   6716:                   change;</p>
                   6717:                 </li>
                   6718: 
                   6719:                 <li>
                   6720:                   <p>if the API or interface to the header files
                   6721:                   change.</p>
                   6722:                 </li>
                   6723:               </ol>
                   6724:             </div>
                   6725: 
1.14      xtraeme  6726:             <p>In these cases, <code class=
                   6727:             "varname">BUILDLINK_DEPENDS.<em class=
                   6728:             "replaceable"><code>pkg</code></em></code> should be
                   6729:             adjusted to require at least the new package version.
                   6730:             In some cases, the packages that depend on this new
                   6731:             version may need their <code class=
                   6732:             "varname">PKGREVISION</code>s increased and, if they
                   6733:             have <code class="filename">buildlink3.mk</code> files,
                   6734:             their <code class=
                   6735:             "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
                   6736:             pkg</code></em></code> adjusted, too. This is needed so
                   6737:             that binary packages made using it will require the
                   6738:             correct package dependency and not settle for an older
                   6739:             one which will not contain the necessary shared
                   6740:             libraries.</p>
1.1       grant    6741: 
                   6742:             <p>Please take careful consideration before adjusting
1.14      xtraeme  6743:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   6744:             "replaceable"><code>pkg</code></em></code> as we don't
                   6745:             want to cause unneeded package deletions and rebuilds.
                   6746:             In many cases, new versions of packages work just fine
                   6747:             with older dependencies. See <a href="#dependencies"
                   6748:             title="12.1.3.&nbsp;Handling dependencies">Section
                   6749:             12.1.3, &#8220;Handling dependencies&#8221;</a> and
                   6750:             <a href="#buildlink" title=
1.1       grant    6751:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter 9,
                   6752:             <i>Buildlink methodology</i></a> for more information
                   6753:             about dependencies on other packages, including the
1.14      xtraeme  6754:             <code class="varname">BUILDLINK_RECOMMENDED</code> and
                   6755:             <code class="varname">RECOMMENDED</code>
                   6756:             definitions.</p>
1.1       grant    6757:           </div>
                   6758:         </div>
                   6759: 
                   6760:         <div class="sect1" lang="en" xml:lang="en">
                   6761:           <div class="titlepage">
                   6762:             <div>
                   6763:               <div>
                   6764:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      6765:                 "id2629537" id="id2629537"></a>9.3.&nbsp;Writing
1.14      xtraeme  6766:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    6767:               </div>
                   6768:             </div>
                   6769:           </div>
                   6770: 
                   6771:           <p>Some packages in pkgsrc install headers and libraries
                   6772:           that coincide with headers and libraries present in the
1.14      xtraeme  6773:           base system. Aside from a <code class=
                   6774:           "filename">buildlink3.mk</code> file, these packages
                   6775:           should also include a <code class=
                   6776:           "filename">builtin.mk</code> file that includes the
                   6777:           necessary checks to decide whether using the built-in
                   6778:           software or the pkgsrc software is appropriate.</p>
1.1       grant    6779: 
                   6780:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  6781:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    6782: 
                   6783:           <div class="orderedlist">
                   6784:             <ol type="1">
                   6785:               <li>
1.14      xtraeme  6786:                 <p>It should set <code class=
                   6787:                 "varname">USE_BUILTIN.<em class=
                   6788:                 "replaceable"><code>pkg</code></em></code> to
                   6789:                 either &#8220;<span class="quote">yes</span>&#8221;
                   6790:                 or &#8220;<span class="quote">no</span>&#8221;
                   6791:                 after it is included.</p>
1.1       grant    6792:               </li>
                   6793: 
                   6794:               <li>
                   6795:                 <p>It should <span class=
                   6796:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  6797:                 <code class="varname">USE_BUILTIN.<em class=
                   6798:                 "replaceable"><code>pkg</code></em></code> which is
                   6799:                 already set before the <code class=
                   6800:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    6801:               </li>
                   6802: 
                   6803:               <li>
                   6804:                 <p>It should be written to allow multiple
                   6805:                 inclusion. This is <span class=
                   6806:                 "emphasis"><em>very</em></span> important and takes
1.14      xtraeme  6807:                 careful attention to <code class=
                   6808:                 "filename">Makefile</code> coding.</p>
1.1       grant    6809:               </li>
                   6810:             </ol>
                   6811:           </div>
                   6812: 
                   6813:           <div class="sect2" lang="en" xml:lang="en">
                   6814:             <div class="titlepage">
                   6815:               <div>
                   6816:                 <div>
1.24    ! wiz      6817:                   <h3 class="title"><a name="id2629618" id=
        !          6818:                   "id2629618"></a>9.3.1.&nbsp;Anatomy of a
1.14      xtraeme  6819:                   <code class="filename">builtin.mk</code>
                   6820:                   file</h3>
1.1       grant    6821:                 </div>
                   6822:               </div>
                   6823:             </div>
                   6824: 
                   6825:             <p>The following is the recommended template for
                   6826:             builtin.mk files:</p>
                   6827:             <pre class="programlisting">
                   6828: .if !defined(IS_BUILTIN.foo)
                   6829: #
                   6830: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   6831: # genuinely exists in the system or not.
                   6832: #
                   6833: IS_BUILTIN.foo?=        no
                   6834: 
                   6835: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   6836: # version can be determined.
                   6837: #
                   6838: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   6839: BUILTIN_PKG.foo?=       foo-1.0
                   6840: .  endif
                   6841: .endif  # IS_BUILTIN.foo
                   6842: 
                   6843: .if !defined(USE_BUILTIN.foo)
                   6844: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   6845: .  if defined(BUILTIN_PKG.foo)
                   6846: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   6847: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   6848: USE_BUILTIN.foo!=                                                       \
                   6849:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   6850:               ${ECHO} "yes";                                            \
                   6851:       else                                                              \
                   6852:               ${ECHO} "no";                                             \
                   6853:       fi
                   6854: .      endif
                   6855: .    endfor
                   6856: .  endif
                   6857: .endif  # USE_BUILTIN.foo
                   6858: 
                   6859: CHECK_BUILTIN.foo?=     no
                   6860: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   6861: #
                   6862: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   6863: # "yes" or "no".
                   6864: #
                   6865: .endif  # CHECK_BUILTIN.foo
                   6866:       
                   6867: </pre>
                   6868: 
1.14      xtraeme  6869:             <p>The first section sets <code class=
                   6870:             "varname">IS_BUILTIN.<em class=
                   6871:             "replaceable"><code>pkg</code></em></code> depending on
                   6872:             if <em class="replaceable"><code>pkg</code></em> really
                   6873:             exists in the base system. This should not be a base
                   6874:             system software with similar functionality to
                   6875:             <em class="replaceable"><code>pkg</code></em>; it
                   6876:             should only be &#8220;<span class=
                   6877:             "quote">yes</span>&#8221; if the actual package is
                   6878:             included as part of the base system. This variable is
                   6879:             only used internally within the <code class=
                   6880:             "filename">builtin.mk</code> file.</p>
                   6881: 
                   6882:             <p>The second section sets <code class=
                   6883:             "varname">BUILTIN_PKG.<em class=
                   6884:             "replaceable"><code>pkg</code></em></code> to the
                   6885:             version of <em class=
                   6886:             "replaceable"><code>pkg</code></em> in the base system
                   6887:             if it exists (if <code class=
                   6888:             "varname">IS_BUILTIN.<em class=
                   6889:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6890:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  6891:             variable is only used internally within the
                   6892:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    6893: 
1.14      xtraeme  6894:             <p>The third section sets <code class=
                   6895:             "varname">USE_BUILTIN.<em class=
                   6896:             "replaceable"><code>pkg</code></em></code> and is
                   6897:             <span class="emphasis"><em>required</em></span> in all
                   6898:             <code class="filename">builtin.mk</code> files. The
                   6899:             code in this section must make the determination
                   6900:             whether the built-in software is adequate to satisfy
                   6901:             the dependencies listed in <code class=
                   6902:             "varname">BUILDLINK_DEPENDS.<em class=
                   6903:             "replaceable"><code>pkg</code></em></code>. This is
                   6904:             typically done by comparing <code class=
                   6905:             "varname">BUILTIN_PKG.<em class=
                   6906:             "replaceable"><code>pkg</code></em></code> against each
                   6907:             of the dependencies in <code class=
                   6908:             "varname">BUILDLINK_DEPENDS.<em class=
                   6909:             "replaceable"><code>pkg</code></em></code>.
                   6910:             <code class="varname">USE_BUILTIN.<em class=
                   6911:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    6912:             "emphasis"><em>must</em></span> be set to the correct
1.14      xtraeme  6913:             value by the end of the <code class=
                   6914:             "filename">builtin.mk</code> file. Note that
                   6915:             <code class="varname">USE_BUILTIN.<em class=
                   6916:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    6917:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  6918:             <code class="varname">IS_BUILTIN.<em class=
                   6919:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6920:             &#8220;<span class="quote">no</span>&#8221; because we
                   6921:             may make the determination that the built-in version of
                   6922:             the software is similar enough to be used as a
                   6923:             replacement.</p>
                   6924: 
1.14      xtraeme  6925:             <p>The last section is guarded by <code class=
                   6926:             "varname">CHECK_BUILTIN.<em class=
                   6927:             "replaceable"><code>pkg</code></em></code>, and
                   6928:             includes code that uses the value of <code class=
                   6929:             "varname">USE_BUILTIN.<em class=
                   6930:             "replaceable"><code>pkg</code></em></code> set in the
                   6931:             previous section. This typically includes, e.g., adding
1.1       grant    6932:             additional dependency restrictions and listing
1.14      xtraeme  6933:             additional files to symlink into <code class=
                   6934:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   6935:             "varname">BUILDLINK_FILES.<em class=
                   6936:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    6937:           </div>
                   6938: 
                   6939:           <div class="sect2" lang="en" xml:lang="en">
                   6940:             <div class="titlepage">
                   6941:               <div>
                   6942:                 <div>
1.24    ! wiz      6943:                   <h3 class="title"><a name="id2629913" id=
        !          6944:                   "id2629913"></a>9.3.2.&nbsp;Global preferences
1.1       grant    6945:                   for native or pkgsrc software</h3>
                   6946:                 </div>
                   6947:               </div>
                   6948:             </div>
                   6949: 
                   6950:             <p>When building packages, it's possible to choose
                   6951:             whether to set a global preference for using either the
                   6952:             built-in (native) version or the pkgsrc version of
                   6953:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  6954:             setting <code class="varname">PREFER_PKGSRC</code> and
                   6955:             <code class="varname">PREFER_NATIVE</code>. These
                   6956:             variables take values of either &#8220;<span class=
1.1       grant    6957:             "quote">yes</span>&#8221;, &#8220;<span class=
                   6958:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  6959:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   6960:             to use the pkgsrc versions of software, while
                   6961:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   6962:             to use the built-in versions. Preferences are
                   6963:             determined by the most specific instance of the package
                   6964:             in either <code class="varname">PREFER_PKGSRC</code> or
                   6965:             <code class="varname">PREFER_NATIVE</code>. If a
                   6966:             package is specified in neither or in both variables,
                   6967:             then <code class="varname">PREFER_PKGSRC</code> has
                   6968:             precedence over <code class=
                   6969:             "varname">PREFER_NATIVE</code>. For example, to require
                   6970:             using pkgsrc versions of software for all but the most
                   6971:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    6972:             <pre class="programlisting">
                   6973:         PREFER_PKGSRC=  yes
                   6974:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   6975:       
                   6976: </pre>
                   6977: 
                   6978:             <p>A package <span class=
1.14      xtraeme  6979:             "emphasis"><em>must</em></span> have a <code class=
                   6980:             "filename">builtin.mk</code> file to be listed in
                   6981:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   6982:             it is simply ignored in that list.</p>
1.1       grant    6983:           </div>
                   6984:         </div>
                   6985:       </div>
                   6986: 
                   6987:       <div class="chapter" lang="en" xml:lang="en">
                   6988:         <div class="titlepage">
                   6989:           <div>
                   6990:             <div>
                   6991:               <h2 class="title"><a name="options" id=
                   6992:               "options"></a>Chapter&nbsp;10.&nbsp;Options
                   6993:               handling</h2>
                   6994:             </div>
                   6995:           </div>
                   6996:         </div>
                   6997: 
                   6998:         <div class="toc">
                   6999:           <p><b>Table of Contents</b></p>
                   7000: 
                   7001:           <dl>
1.24    ! wiz      7002:             <dt><span class="sect1"><a href="#id2629986">10.1.
1.1       grant    7003:             Global default options</a></span></dt>
                   7004: 
1.24    ! wiz      7005:             <dt><span class="sect1"><a href="#id2630001">10.2.
1.14      xtraeme  7006:             Converting packages to use <code class=
                   7007:             "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    7008:           </dl>
                   7009:         </div>
                   7010: 
                   7011:         <p>Many packages have the ability to be built to support
1.14      xtraeme  7012:         different sets of features. <code class=
                   7013:         "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1       grant    7014:         that provides generic handling of those options that
                   7015:         determine different ways in which the packages can be
                   7016:         built. It's possible for the user to specify exactly which
                   7017:         sets of options will be built into a package or to allow a
                   7018:         set of global default options apply.</p>
                   7019: 
                   7020:         <div class="sect1" lang="en" xml:lang="en">
                   7021:           <div class="titlepage">
                   7022:             <div>
                   7023:               <div>
                   7024:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      7025:                 "id2629986" id="id2629986"></a>10.1.&nbsp;Global
1.1       grant    7026:                 default options</h2>
                   7027:               </div>
                   7028:             </div>
                   7029:           </div>
                   7030: 
1.14      xtraeme  7031:           <p>Global default options are listed in <code class=
                   7032:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1       grant    7033:           the options that should be built into every package if
                   7034:           that option is supported. This variable should be set in
1.14      xtraeme  7035:           <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    7036:         </div>
                   7037: 
                   7038:         <div class="sect1" lang="en" xml:lang="en">
                   7039:           <div class="titlepage">
                   7040:             <div>
                   7041:               <div>
                   7042:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      7043:                 "id2630001" id=
        !          7044:                 "id2630001"></a>10.2.&nbsp;Converting packages to
1.14      xtraeme  7045:                 use <code class=
                   7046:                 "filename">bsd.options.mk</code></h2>
1.1       grant    7047:               </div>
                   7048:             </div>
                   7049:           </div>
                   7050: 
1.14      xtraeme  7051:           <p>The following example shows how <code class=
1.23      wiz      7052:           "filename">bsd.options.mk</code> should be used in a
1.14      xtraeme  7053:           package <code class="filename">Makefile</code>, or in a
                   7054:           file, e.g. <code class="filename">options.mk</code>, that
                   7055:           is included by the main package <code class=
                   7056:           "filename">Makefile</code>.</p>
1.1       grant    7057:           <pre class="programlisting">
                   7058: # Global and legacy options
                   7059: .if defined(WIBBLE_USE_OPENLDAP) &amp;&amp; !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
                   7060: PKG_DEFAULT_OPTIONS+=   ldap
                   7061: .endif
                   7062: .if defined(USE_SASL2) &amp;&amp; !empty(USE_SASL2:M[yY][eE][sS])
                   7063: PKG_DEFAULT_OPTIONS+=   sasl
                   7064: .endif
                   7065: 
                   7066: PKG_OPTIONS_VAR=        PKG_OPTIONS.wibble
                   7067: PKG_SUPPORTED_OPTIONS=  ldap sasl
                   7068: #
                   7069: # Default options for "wibble" package.
                   7070: #
                   7071: .if !defined(PKG_OPTIONS.wibble)
                   7072: PKG_DEFAULT_OPTIONS+=   sasl
                   7073: endif
                   7074: .include "../../mk/bsd.options.mk"
                   7075: 
                   7076: # Package-specific option-handling
                   7077: 
                   7078: ###
                   7079: ### LDAP support
                   7080: ###
                   7081: .if !empty(PKG_OPTIONS:Mldap)
                   7082: .  include "../../databases/openldap/buildlink3.mk"
                   7083: CONFIGURE_ARGS+=      --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   7084: .endif
                   7085: 
                   7086: ###
                   7087: ### SASL authentication
                   7088: ###
                   7089: .if !empty(PKG_OPTIONS:Msasl)
                   7090: .  include "../../security/cyrus-sasl2/buildlink3.mk"
                   7091: CONFIGURE_ARGS+=        --enable-sasl=${BUILDLINK_PREFIX.sasl}
                   7092: .endif
                   7093:       
                   7094: </pre>
                   7095: 
                   7096:           <p>The first section only exists if you are converting a
                   7097:           package that had its own ad-hoc options handling to use
1.14      xtraeme  7098:           <code class="filename">bsd.options.mk</code>. It converts
1.1       grant    7099:           global or legacy options variables into an equivalent
1.14      xtraeme  7100:           <code class="varname">PKG_OPTIONS.<em class=
                   7101:           "replaceable"><code>pkg</code></em></code> value. These
                   7102:           sections will be removed over time as the old options are
                   7103:           in turn deprecated and removed.</p>
1.1       grant    7104: 
                   7105:           <p>The second section contains the information about
                   7106:           which build options are supported by the package, and any
                   7107:           default options settings if needed.</p>
                   7108: 
                   7109:           <div class="orderedlist">
                   7110:             <ol type="1">
                   7111:               <li>
1.14      xtraeme  7112:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
                   7113:                 a list of the name of the <a href=
1.1       grant    7114:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7115:                 <span class="citerefentry"><span class=
                   7116:                 "refentrytitle">make</span>(1)</span></a> variables
                   7117:                 that contain the options the user wishes to select.
                   7118:                 The recommended value is &#8220;<span class=
1.14      xtraeme  7119:                 "quote">PKG_OPTIONS.<em class=
                   7120:                 "replaceable"><code>pkg</code></em></span>&#8221;
                   7121:                 but any package-specific value may be used. This
1.1       grant    7122:                 variable should be set in a package Makefile.</p>
                   7123:               </li>
                   7124: 
                   7125:               <li>
1.14      xtraeme  7126:                 <p><code class=
                   7127:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
                   7128:                 build options supported by the package. This
                   7129:                 variable should be set in a package Makefile.</p>
1.1       grant    7130:               </li>
                   7131: 
                   7132:               <li>
1.14      xtraeme  7133:                 <p><code class="varname">${PKG_OPTIONS_VAR}</code>
                   7134:                 (the variables named in <code class=
                   7135:                 "varname">PKG_OPTIONS_VAR</code>) are variables
                   7136:                 that list the selected build options and override
                   7137:                 any default options given in <code class=
                   7138:                 "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1       grant    7139:                 options begin with a &#8220;<span class=
                   7140:                 "quote">-</span>&#8221;, then that option is always
                   7141:                 removed from the selected build options, e.g.</p>
                   7142:                 <pre class="programlisting">
                   7143:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   7144:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   7145:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
                   7146:         # implies PKG_OPTIONS == "kerberos ldap"
                   7147:           
                   7148: </pre>
                   7149: 
                   7150:                 <p>or</p>
                   7151:                 <pre class="programlisting">
                   7152:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   7153:         WIBBLE_OPTIONS=         kerberos -ldap ldap
                   7154:         # implies PKG_OPTIONS == "kerberos"
                   7155:           
                   7156: </pre>
                   7157: 
1.14      xtraeme  7158:                 <p>This variable should be set in <code class=
                   7159:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    7160:               </li>
                   7161:             </ol>
                   7162:           </div>
                   7163: 
                   7164:           <p>After the inclusion of bsd.options.mk, the following
                   7165:           variables are set:</p>
                   7166: 
                   7167:           <div class="itemizedlist">
                   7168:             <ul type="disc">
                   7169:               <li>
1.14      xtraeme  7170:                 <p><code class="varname">PKG_OPTIONS</code>
                   7171:                 contains the list of the selected build options,
                   7172:                 properly filtered to remove unsupported and
                   7173:                 duplicate options.</p>
1.1       grant    7174:               </li>
                   7175:             </ul>
                   7176:           </div>
                   7177: 
                   7178:           <p>The remaining sections contain the logic that is
                   7179:           specific to each option. There should be a check for
1.14      xtraeme  7180:           every option listed in <code class=
                   7181:           "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
                   7182:           be clear documentation on what turning on the option will
                   7183:           do in the comments preceding each section. The correct
                   7184:           way to check for an option is to check whether it is
                   7185:           listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1       grant    7186:         </div>
                   7187:       </div>
                   7188: 
                   7189:       <div class="chapter" lang="en" xml:lang="en">
                   7190:         <div class="titlepage">
                   7191:           <div>
                   7192:             <div>
                   7193:               <h2 class="title"><a name="build" id=
                   7194:               "build"></a>Chapter&nbsp;11.&nbsp;The build
                   7195:               process</h2>
                   7196:             </div>
                   7197:           </div>
                   7198:         </div>
                   7199: 
                   7200:         <div class="toc">
                   7201:           <p><b>Table of Contents</b></p>
                   7202: 
                   7203:           <dl>
                   7204:             <dt><span class="sect1"><a href="#build.prefix">11.1.
                   7205:             Program location</a></span></dt>
                   7206: 
1.24    ! wiz      7207:             <dt><span class="sect1"><a href="#id2630624">11.2. Main
1.1       grant    7208:             targets</a></span></dt>
                   7209: 
                   7210:             <dt><span class="sect1"><a href=
                   7211:             "#build.helpful-targets">11.3. Other helpful
                   7212:             targets</a></span></dt>
                   7213:           </dl>
                   7214:         </div>
                   7215: 
                   7216:         <p>The basic steps for building a program are always the
                   7217:         same. First the program's source (<span class=
                   7218:         "emphasis"><em>distfile</em></span>) must be brought to the
                   7219:         local system and then extracted. After any patches to
                   7220:         compile properly on NetBSD are applied, the software can be
                   7221:         configured, then built (usually by compiling), and finally
                   7222:         the generated binaries, etc. can be put into place on the
                   7223:         system. These are exactly the steps performed by the NetBSD
                   7224:         package system, which is implemented as a series of targets
1.14      xtraeme  7225:         in a central Makefile, <code class=
                   7226:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    7227: 
                   7228:         <div class="sect1" lang="en" xml:lang="en">
                   7229:           <div class="titlepage">
                   7230:             <div>
                   7231:               <div>
                   7232:                 <h2 class="title" style="clear: both"><a name=
                   7233:                 "build.prefix" id=
                   7234:                 "build.prefix"></a>11.1.&nbsp;Program location</h2>
                   7235:               </div>
                   7236:             </div>
                   7237:           </div>
                   7238: 
                   7239:           <p>Before outlining the process performed by the NetBSD
                   7240:           package system in the next section, here's a brief
                   7241:           discussion on where programs are installed, and which
                   7242:           variables influence this.</p>
                   7243: 
1.14      xtraeme  7244:           <p>The automatic variable <code class=
                   7245:           "varname">PREFIX</code> indicates where all files of the
                   7246:           final program shall be installed. It is usually set to
                   7247:           <code class="varname">LOCALBASE</code> (<code class=
                   7248:           "filename">/usr/pkg</code>), or <code class=
                   7249:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    7250:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  7251:           The value of <code class="varname">PREFIX</code> needs to
                   7252:           be put into the various places in the program's source
                   7253:           where paths to these files are encoded. See <a href=
1.1       grant    7254:           "#components.patches" title=
                   7255:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   7256:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   7257:           title=
                   7258:           "12.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;12.3.1,
                   7259:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   7260:           details.</p>
                   7261: 
                   7262:           <p>When choosing which of these variables to use, follow
                   7263:           the following rules:</p>
                   7264: 
                   7265:           <div class="itemizedlist">
                   7266:             <ul type="disc">
                   7267:               <li>
1.14      xtraeme  7268:                 <p><code class="varname">PREFIX</code> always
                   7269:                 points to the location where the current pkg will
                   7270:                 be installed. When referring to a pkg's own
1.1       grant    7271:                 installation path, use &#8220;<span class=
                   7272:                 "quote">${PREFIX}</span>&#8221;.</p>
                   7273:               </li>
                   7274: 
                   7275:               <li>
1.14      xtraeme  7276:                 <p><code class="varname">LOCALBASE</code> is where
                   7277:                 all non-X11 pkgs are installed. If you need to
1.1       grant    7278:                 construct a -I or -L argument to the compiler to
                   7279:                 find includes and libraries installed by another
                   7280:                 non-X11 pkg, use &#8220;<span class=
                   7281:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   7282:               </li>
                   7283: 
                   7284:               <li>
1.14      xtraeme  7285:                 <p><code class="varname">X11BASE</code> is where
                   7286:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    7287:                 installed. When looking for <span class=
                   7288:                 "emphasis"><em>standard</em></span> X11 includes
                   7289:                 (not those installed by a pkg), use
                   7290:                 &#8220;<span class=
                   7291:                 "quote">${X11BASE}</span>&#8221;.</p>
                   7292:               </li>
                   7293: 
                   7294:               <li>
                   7295:                 <p>X11 based are special in that they may be
1.14      xtraeme  7296:                 installed in either <code class=
                   7297:                 "varname">X11BASE</code> or <code class=
                   7298:                 "varname">LOCALBASE</code>.</p>
1.1       grant    7299: 
                   7300:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  7301:                 <code class="varname">LOCALBASE</code> whenever
                   7302:                 possible. Note that you will need to set
                   7303:                 <code class="varname">USE_X11</code> in them to
                   7304:                 request the presence of X11 and to get the right
                   7305:                 compilation flags.</p>
1.1       grant    7306: 
                   7307:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  7308:                 be installed under <code class=
                   7309:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    7310:                 app-defaults files. These packages are special and
1.14      xtraeme  7311:                 they must be placed under <code class=
                   7312:                 "varname">X11BASE</code>. To accomplish this, set
                   7313:                 either <code class="varname">USE_X11BASE</code> or
                   7314:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    7315:                 package.</p>
                   7316: 
1.14      xtraeme  7317:                 <p>Some notes: <code class="varname">USE_X11</code>
                   7318:                 and <code class="varname">USE_X11BASE</code> are
                   7319:                 mutually exclusive. If you need to find includes or
                   7320:                 libraries installed by a pkg that has <code class=
                   7321:                 "varname">USE_IMAKE</code> or <code class=
                   7322:                 "varname">USE_X11BASE</code> in its pkg
                   7323:                 <code class="filename">Makefile</code>, you need to
                   7324:                 use <span class="emphasis"><em>both</em></span>
                   7325:                 <code class="filename">${X11BASE}</code> and
                   7326:                 <code class="filename">${LOCALBASE}</code>. To
                   7327:                 force installation of all X11 packages in
                   7328:                 <code class="varname">LOCALBASE</code>, the
                   7329:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7330:                 href=
1.1       grant    7331:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20      ben      7332:                 class="pkgname">pkgtools/xpkgwedge</a> is enabled
                   7333:                 by default.</p>
1.1       grant    7334:               </li>
                   7335: 
                   7336:               <li>
1.14      xtraeme  7337:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    7338:                 used to refer to the installed location of an X11
1.14      xtraeme  7339:                 package. <code class="varname">X11PREFIX</code>
                   7340:                 will be set to <code class="varname">X11BASE</code>
                   7341:                 if xpkgwedge is not installed, and to <code class=
                   7342:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    7343:                 installed.</p>
                   7344:               </li>
                   7345: 
                   7346:               <li>
                   7347:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  7348:                 have some packages installed in <code class=
                   7349:                 "varname">X11BASE</code> and some in <code class=
                   7350:                 "varname">LOCALBASE</code>. To determine the prefix
                   7351:                 of an installed package, the <code class=
                   7352:                 "varname">EVAL_PREFIX</code> definition can be
                   7353:                 used. It takes pairs in the format
                   7354:                 &#8220;<span class=
1.1       grant    7355:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24    ! wiz      7356:                 the <a href=
        !          7357:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
        !          7358:                 <span class="citerefentry"><span class=
        !          7359:                 "refentrytitle">make</span>(1)</span></a> variable
        !          7360:                 <code class="varname">DIRNAME</code> will be set to
        !          7361:                 the prefix of the installed package
        !          7362:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    7363:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   7364:                 is not installed.</p>
                   7365: 
                   7366:                 <p>This is best illustrated by example.</p>
                   7367: 
1.14      xtraeme  7368:                 <p>The following lines are taken from <code class=
                   7369:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    7370:                 <pre class="programlisting">
1.14      xtraeme  7371: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    7372: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   7373:                         --with-gtk-prefix="${GTKDIR}"           \
                   7374:                         --enable-multibyte
                   7375: </pre>
                   7376: 
                   7377:                 <p>Specific defaults can be defined for the
1.14      xtraeme  7378:                 packages evaluated using <code class=
                   7379:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    7380:                 of the form:</p>
                   7381:                 <pre class="programlisting">
                   7382: GTKDIR_DEFAULT= ${LOCALBASE}
                   7383: </pre>
                   7384: 
1.14      xtraeme  7385:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    7386:                 corresponds to the first definition in the
1.14      xtraeme  7387:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    7388:               </li>
                   7389: 
                   7390:               <li>
1.14      xtraeme  7391:                 <p>Within <code class="filename">${PREFIX}</code>,
1.24    ! wiz      7392:                 packages should install files according to <a href=
        !          7393:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
        !          7394:                 <span class="citerefentry"><span class=
        !          7395:                 "refentrytitle">hier</span>(7)</span></a>, with the
        !          7396:                 exception that manual pages go into <code class=
        !          7397:                 "filename">${PREFIX}/man</code>, not <code class=
1.14      xtraeme  7398:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    7399:               </li>
                   7400:             </ul>
                   7401:           </div>
                   7402:         </div>
                   7403: 
                   7404:         <div class="sect1" lang="en" xml:lang="en">
                   7405:           <div class="titlepage">
                   7406:             <div>
                   7407:               <div>
                   7408:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      7409:                 "id2630624" id="id2630624"></a>11.2.&nbsp;Main
1.1       grant    7410:                 targets</h2>
                   7411:               </div>
                   7412:             </div>
                   7413:           </div>
                   7414: 
                   7415:           <p>The main targets used during the build process defined
1.14      xtraeme  7416:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    7417: 
                   7418:           <div class="variablelist">
                   7419:             <dl>
                   7420:               <dt><span class="term">fetch</span></dt>
                   7421: 
                   7422:               <dd>
                   7423:                 <p>This will check if the file(s) given in the
1.14      xtraeme  7424:                 variables <code class="varname">DISTFILES</code>
                   7425:                 and <code class="varname">PATCHFILES</code> (as
                   7426:                 defined in the package's Makefile) are present on
                   7427:                 the local system in <code class=
                   7428:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   7429:                 are not present, an attempt will be made to fetch
                   7430:                 them using commands of the form:</p>
1.1       grant    7431:                 <pre class="programlisting">
                   7432: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   7433: </pre>
                   7434: 
                   7435:                 <p>where ${site} varies through several
1.14      xtraeme  7436:                 possibilities in turn: first, <code class=
                   7437:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   7438:                 then the sites specified in either <code class=
                   7439:                 "varname">SITES_file</code> if defined, else
                   7440:                 <code class="varname">MASTER_SITES</code> or
                   7441:                 <code class="varname">PATCH_SITES</code>, as
                   7442:                 applies, then finally the value of <code class=
                   7443:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   7444:                 all except the first can be optionally sorted by
                   7445:                 the user, via setting either <code class=
                   7446:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   7447:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    7448:               </dd>
                   7449: 
                   7450:               <dt><span class="term">checksum</span></dt>
                   7451: 
                   7452:               <dd>
                   7453:                 <p>After the distfile(s) are fetched, their
                   7454:                 checksum is generated and compared with the
                   7455:                 checksums stored in the distinfo file. If the
                   7456:                 checksums don't match, the build is aborted. This
                   7457:                 is to ensure the same distfile is used for
                   7458:                 building, and that the distfile wasn't changed,
                   7459:                 e.g. by some malign force, deliberately changed
                   7460:                 distfiles on the master distribution site or
                   7461:                 network lossage.</p>
                   7462:               </dd>
                   7463: 
                   7464:               <dt><span class="term">extract</span></dt>
                   7465: 
                   7466:               <dd>
                   7467:                 <p>When the distfiles are present on the local
                   7468:                 system, they need to be extracted, as they are
                   7469:                 usually in the form of some compressed archive
1.14      xtraeme  7470:                 format, most commonly <code class=
                   7471:                 "filename">.tar.gz</code>.</p>
1.1       grant    7472: 
                   7473:                 <p>If only some of the distfiles need to be
                   7474:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  7475:                 be put into <code class=
                   7476:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    7477: 
1.14      xtraeme  7478:                 <p>If the distfiles are not in <code class=
                   7479:                 "filename">.tar.gz</code> format, they can be
                   7480:                 extracted by setting either <code class=
                   7481:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   7482:                 "varname">EXTRACT_CMD</code>, <code class=
                   7483:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   7484:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   7485:                 the former case, pkgsrc knows how to extract a
                   7486:                 number of suffixes (<code class=
                   7487:                 "filename">.tar.gz</code>, <code class=
                   7488:                 "filename">.tgz</code>, <code class=
                   7489:                 "filename">.tar.gz2</code>, <code class=
                   7490:                 "filename">.tbz</code>, <code class=
                   7491:                 "filename">.tar.Z</code>, <code class=
                   7492:                 "filename">.tar</code>, <code class=
                   7493:                 "filename">.shar.gz</code>, <code class=
                   7494:                 "filename">.shar.bz2</code>, <code class=
                   7495:                 "filename">.shar.Z</code>, <code class=
                   7496:                 "filename">.shar</code>, <code class=
                   7497:                 "filename">.Z</code>, <code class=
                   7498:                 "filename">.bz2</code> and <code class=
                   7499:                 "filename">.gz</code>; see the definition of the
                   7500:                 various <code class="varname">DECOMPRESS_CMD</code>
                   7501:                 variables <code class="filename">bsd.pkg.mk</code>
                   7502:                 for a complete list). Here's an example on how to
                   7503:                 use the other variables for a program that comes
                   7504:                 with a compressed shell archive whose name ends in
                   7505:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    7506:                 <pre class="programlisting">
                   7507:      EXTRACT_SUFX=   .msg.gz
                   7508:      EXTRACT_CMD=            zcat
                   7509:      EXTRACT_BEFORE_ARGS=
                   7510:      EXTRACT_AFTER_ARGS=     |sh
                   7511: </pre>
                   7512:               </dd>
                   7513: 
                   7514:               <dt><span class="term">patch</span></dt>
                   7515: 
                   7516:               <dd>
                   7517:                 <p>After extraction, all the patches named by the
1.14      xtraeme  7518:                 <code class="varname">PATCHFILES</code>, those
                   7519:                 present in the patches subdirectory of the package
                   7520:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
                   7521:                 <code class=
                   7522:                 "filename">/usr/local/patches/graphics/png</code>)
                   7523:                 are applied. Patchfiles ending in <code class=
                   7524:                 "filename">.Z</code> or <code class=
                   7525:                 "filename">.gz</code> are uncompressed before they
                   7526:                 are applied, files ending in <code class=
                   7527:                 "filename">.orig</code> or <code class=
                   7528:                 "filename">.rej</code> are ignored. Any special
1.24    ! wiz      7529:                 options to <a href=
        !          7530:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
        !          7531:                 <span class="citerefentry"><span class=
        !          7532:                 "refentrytitle">patch</span>(1)</span></a> can be
        !          7533:                 handed in <code class=
1.14      xtraeme  7534:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   7535:                 "#components.patches" title=
1.1       grant    7536:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   7537:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   7538: 
1.24    ! wiz      7539:                 <p>By default <a href=
        !          7540:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
        !          7541:                 <span class="citerefentry"><span class=
        !          7542:                 "refentrytitle">patch</span>(1)</span></a> is given
        !          7543:                 special args to make it fail if the patches apply
        !          7544:                 with some lines of fuzz. Please fix (regen) the
        !          7545:                 patches so that they apply cleanly. The rationale
        !          7546:                 behind this is that patches that don't apply
        !          7547:                 cleanly may end up being applied in the wrong
        !          7548:                 place, and cause severe harm there.</p>
1.1       grant    7549:               </dd>
                   7550: 
                   7551:               <dt><span class="term">configure</span></dt>
                   7552: 
                   7553:               <dd>
                   7554:                 <p>Most pieces of software need information on the
                   7555:                 header files, system calls, and library routines
                   7556:                 which are available in NetBSD. This is the process
                   7557:                 known as configuration, and is usually automated.
                   7558:                 In most cases, a script is supplied with the
                   7559:                 source, and its invocation results in generation of
                   7560:                 header files, Makefiles, etc.</p>
                   7561: 
                   7562:                 <p>If the program's distfile contains its own
                   7563:                 configure script, this can be invoked by setting
1.14      xtraeme  7564:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    7565:                 configure script is a GNU autoconf script,
1.14      xtraeme  7566:                 <code class="varname">GNU_CONFIGURE</code> should
                   7567:                 be specified instead. In either case, any arguments
                   7568:                 to the configure script can be specified in the
                   7569:                 <code class="varname">CONFIGURE_ARGS</code>
                   7570:                 variable, and the configure script's name can be
                   7571:                 set in <code class=
                   7572:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   7573:                 from the default &#8220;<span class=
1.1       grant    7574:                 "quote">configure</span>&#8221;. Here's an example
                   7575:                 from the <a xmlns=
                   7576:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7577:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20      ben      7578:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    7579:                 <pre class="programlisting">
                   7580: HAS_CONFIGURE=          yes
                   7581: CONFIGURE_SCRIPT=       Configure
                   7582: CONFIGURE_ARGS+=        netbsd13
                   7583: </pre>
                   7584: 
                   7585:                 <p>If the program uses an Imakefile for
                   7586:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  7587:                 by setting <code class="varname">USE_IMAKE</code>
                   7588:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   7589:                 (If you only want the package installed in
                   7590:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   7591:                 not being run, set <code class=
                   7592:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    7593:               </dd>
                   7594: 
                   7595:               <dt><span class="term">build</span></dt>
                   7596: 
                   7597:               <dd>
                   7598:                 <p>Once configuration has taken place, the software
1.14      xtraeme  7599:                 will be built by invoking <code class=
                   7600:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   7601:                 "varname">$MAKEFILE</code> with <code class=
                   7602:                 "varname">$BUILD_TARGET</code> as the target to
                   7603:                 build. The default <code class=
                   7604:                 "varname">MAKE_PROGRAM</code> is
                   7605:                 &#8220;<span class="quote">gmake</span>&#8221; if
                   7606:                 <code class="varname">USE_GNU_TOOLS</code> contains
1.7       wiz      7607:                 &#8220;<span class="quote">make</span>&#8221;,
1.1       grant    7608:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  7609:                 otherwise. <code class="varname">MAKEFILE</code> is
                   7610:                 set to &#8220;<span class=
1.1       grant    7611:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  7612:                 <code class="varname">BUILD_TARGET</code> defaults
                   7613:                 to &#8220;<span class="quote">all</span>&#8221;.
                   7614:                 Any of these variables can be set in the package's
1.1       grant    7615:                 Makefile to change the default build process.</p>
                   7616:               </dd>
                   7617: 
                   7618:               <dt><span class="term">install</span></dt>
                   7619: 
                   7620:               <dd>
                   7621:                 <p>Once the build stage has completed, the final
                   7622:                 step is to install the software in public
                   7623:                 directories, so users can access the programs and
1.14      xtraeme  7624:                 files. As in the build-target, <code class=
                   7625:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   7626:                 <code class="varname">$MAKEFILE</code> here, but
                   7627:                 with the <code class=
                   7628:                 "varname">$INSTALL_TARGET</code> instead, the
                   7629:                 latter defaulting to &#8220;<span class=
                   7630:                 "quote">install</span>&#8221; (plus
                   7631:                 &#8220;<span class=
                   7632:                 "quote">install.man</span>&#8221;, if <code class=
                   7633:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    7634:               </dd>
                   7635:             </dl>
                   7636:           </div>
                   7637: 
                   7638:           <p>If no target is specified, the default is
                   7639:           &#8220;<span class="quote">build</span>&#8221;. If a
                   7640:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  7641:           e.g. <span><strong class="command">make
                   7642:           build</strong></span> will also perform the equivalent
                   7643:           of:</p>
1.1       grant    7644:           <pre class="programlisting">
                   7645: make fetch
                   7646: make checksum
                   7647: make extract
                   7648: make patch
                   7649: make configure
                   7650: make build
                   7651: </pre>
                   7652:         </div>
                   7653: 
                   7654:         <div class="sect1" lang="en" xml:lang="en">
                   7655:           <div class="titlepage">
                   7656:             <div>
                   7657:               <div>
                   7658:                 <h2 class="title" style="clear: both"><a name=
                   7659:                 "build.helpful-targets" id=
                   7660:                 "build.helpful-targets"></a>11.3.&nbsp;Other
                   7661:                 helpful targets</h2>
                   7662:               </div>
                   7663:             </div>
                   7664:           </div>
                   7665: 
                   7666:           <div class="variablelist">
                   7667:             <dl>
                   7668:               <dt><span class="term">pre/post-*</span></dt>
                   7669: 
                   7670:               <dd>
                   7671:                 <p>For any of the main targets described in the
                   7672:                 previous section, two auxiliary targets exist with
                   7673:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   7674:                 &#8220;<span class="quote">post-</span>&#8221; used
                   7675:                 as a prefix for the main target's name. These
                   7676:                 targets are invoked before and after the main
                   7677:                 target is called, allowing extra configuration or
                   7678:                 installation steps be performed from a package's
                   7679:                 Makefile, for example, which a program's configure
                   7680:                 script or install target omitted.</p>
                   7681:               </dd>
                   7682: 
                   7683:               <dt><span class="term">do-*</span></dt>
                   7684: 
                   7685:               <dd>
                   7686:                 <p>Should one of the main targets do the wrong
                   7687:                 thing, and should there be no variable to fix this,
                   7688:                 you can redefine it with the do-* target. (Note
                   7689:                 that redefining the target itself instead of the
                   7690:                 do-* target is a bad idea, as the pre-* and post-*
                   7691:                 targets won't be called anymore, etc.) You will not
                   7692:                 usually need to do this.</p>
                   7693:               </dd>
                   7694: 
                   7695:               <dt><span class="term">reinstall</span></dt>
                   7696: 
                   7697:               <dd>
1.14      xtraeme  7698:                 <p>If you did a <span><strong class="command">make
                   7699:                 install</strong></span> and you noticed some file
                   7700:                 was not installed properly, you can repeat the
1.1       grant    7701:                 installation with this target, which will ignore
                   7702:                 the &#8220;<span class="quote">already
                   7703:                 installed</span>&#8221; flag.</p>
                   7704:               </dd>
                   7705: 
                   7706:               <dt><span class="term">deinstall</span></dt>
                   7707: 
                   7708:               <dd>
1.24    ! wiz      7709:                 <p>This target does a <a href=
        !          7710:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
        !          7711:                 <span class="citerefentry"><span class=
        !          7712:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
        !          7713:                 the current directory, effectively de-installing
        !          7714:                 the package. The following variables can be used to
        !          7715:                 tune the behaviour:</p>
1.1       grant    7716: 
                   7717:                 <div class="variablelist">
                   7718:                   <dl>
1.14      xtraeme  7719:                     <dt><span class="term"><code class=
                   7720:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    7721: 
                   7722:                     <dd>
                   7723:                       <p>Add a "-v" to the <a href=
                   7724:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7725:                       <span class="citerefentry"><span class=
                   7726:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7727:                       command.</p>
                   7728:                     </dd>
                   7729: 
1.14      xtraeme  7730:                     <dt><span class="term"><code class=
                   7731:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    7732: 
                   7733:                     <dd>
                   7734:                       <p>Remove all packages that require (depend
                   7735:                       on) the given package. This can be used to
                   7736:                       remove any packages that may have been pulled
                   7737:                       in by a given package, e.g. if
1.14      xtraeme  7738:                       <span><strong class="command">make deinstall
                   7739:                       DEINSTALLDEPENDS=1</strong></span> is done in
                   7740:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    7741:                       this is likely to remove whole KDE. Works by
                   7742:                       adding &#8220;<span class=
                   7743:                       "quote">-R</span>&#8221; to the <a href=
                   7744:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7745:                       <span class="citerefentry"><span class=
                   7746:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7747:                       command line.</p>
                   7748:                     </dd>
                   7749:                   </dl>
                   7750:                 </div>
                   7751:               </dd>
                   7752: 
                   7753:               <dt><span class="term">update</span></dt>
                   7754: 
                   7755:               <dd>
                   7756:                 <p>This target causes the current package to be
                   7757:                 updated to the latest version. The package and all
                   7758:                 depending packages first get de-installed, then
                   7759:                 current versions of the corresponding packages get
                   7760:                 compiled and installed. This is similar to manually
                   7761:                 noting which packages are currently installed, then
1.14      xtraeme  7762:                 performing a series of <span><strong class=
                   7763:                 "command">make deinstall</strong></span> and
                   7764:                 <span><strong class="command">make
                   7765:                 install</strong></span> (or whatever <code class=
                   7766:                 "varname">UPDATE_TARGET</code> is set to) for these
                   7767:                 packages.</p>
1.1       grant    7768: 
                   7769:                 <p>You can use the &#8220;<span class=
                   7770:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  7771:                 package updating in case a previous
                   7772:                 <span><strong class="command">make
                   7773:                 update</strong></span> was interrupted for some
                   7774:                 reason. However, in this case, make sure you don't
                   7775:                 call <span><strong class="command">make
                   7776:                 clean</strong></span> or otherwise remove the list
                   7777:                 of dependent packages in <code class=
                   7778:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    7779:                 ability to automatically update the current package
                   7780:                 along with the dependent packages you have
                   7781:                 installed.</p>
                   7782: 
1.14      xtraeme  7783:                 <p>Resuming an interrupted <span><strong class=
                   7784:                 "command">make update</strong></span> will only
                   7785:                 work as long as the package tree remains unchanged.
                   7786:                 If the source code for one of the packages to be
                   7787:                 updated has been changed, resuming
                   7788:                 <span><strong class="command">make
                   7789:                 update</strong></span> will most certainly
                   7790:                 fail!</p>
1.1       grant    7791: 
                   7792:                 <p>The following variables can be used either on
1.14      xtraeme  7793:                 the command line or in <code class=
                   7794:                 "filename">/etc/mk.conf</code> to alter the
                   7795:                 behaviour of <span><strong class="command">make
                   7796:                 update</strong></span>:</p>
1.1       grant    7797: 
                   7798:                 <div class="variablelist">
                   7799:                   <dl>
1.14      xtraeme  7800:                     <dt><span class="term"><code class=
                   7801:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    7802: 
                   7803:                     <dd>
                   7804:                       <p>Install target to recursively use for the
                   7805:                       updated package and the dependent packages.
1.14      xtraeme  7806:                       Defaults to <code class=
                   7807:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    7808:                       &#8220;<span class=
                   7809:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  7810:                       <span><strong class="command">make
                   7811:                       update</strong></span>. e.g.
                   7812:                       <span><strong class="command">make update
                   7813:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    7814:                     </dd>
                   7815: 
1.14      xtraeme  7816:                     <dt><span class="term"><code class=
                   7817:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    7818: 
                   7819:                     <dd>
                   7820:                       <p>Don't clean up after updating. Useful if
                   7821:                       you want to leave the work sources of the
                   7822:                       updated packages around for inspection or
                   7823:                       other purposes. Be sure you eventually clean
                   7824:                       up the source tree (see the
                   7825:                       &#8220;<span class=
                   7826:                       "quote">clean-update</span>&#8221; target
                   7827:                       below) or you may run into troubles with old
                   7828:                       source code still lying around on your next
1.14      xtraeme  7829:                       <span><strong class=
                   7830:                       "command">make</strong></span> or
                   7831:                       <span><strong class="command">make
                   7832:                       update</strong></span>.</p>
1.1       grant    7833:                     </dd>
                   7834: 
1.14      xtraeme  7835:                     <dt><span class="term"><code class=
                   7836:                     "varname">REINSTALL</code></span></dt>
1.1       grant    7837: 
                   7838:                     <dd>
                   7839:                       <p>Deinstall each package before installing
1.14      xtraeme  7840:                       (making <code class=
                   7841:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    7842:                       necessary if the &#8220;<span class=
                   7843:                       "quote">clean-update</span>&#8221; target
                   7844:                       (see below) was called after interrupting a
1.14      xtraeme  7845:                       running <span><strong class="command">make
                   7846:                       update</strong></span>.</p>
1.1       grant    7847:                     </dd>
                   7848: 
1.14      xtraeme  7849:                     <dt><span class="term"><code class=
                   7850:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    7851: 
                   7852:                     <dd>
                   7853:                       <p>Allows you to disable recursion and
                   7854:                       hardcode the target for packages. The default
                   7855:                       is &#8220;<span class=
                   7856:                       "quote">update</span>&#8221; for the update
                   7857:                       target, facilitating a recursive update of
1.14      xtraeme  7858:                       prerequisite packages. Only set <code class=
                   7859:                       "varname">DEPENDS_TARGET</code> if you want
                   7860:                       to disable recursive updates. Use
                   7861:                       <code class="varname">UPDATE_TARGET</code>
                   7862:                       instead to just set a specific target for
                   7863:                       each package to be installed during
                   7864:                       <span><strong class="command">make
                   7865:                       update</strong></span> (see above).</p>
1.1       grant    7866:                     </dd>
                   7867:                   </dl>
                   7868:                 </div>
                   7869:               </dd>
                   7870: 
                   7871:               <dt><span class="term">clean-update</span></dt>
                   7872: 
                   7873:               <dd>
                   7874:                 <p>Clean the source tree for all packages that
1.14      xtraeme  7875:                 would get updated if <span><strong class=
                   7876:                 "command">make update</strong></span> was called
                   7877:                 from the current directory. This target should not
                   7878:                 be used if the current package (or any of its
                   7879:                 depending packages) have already been de-installed
                   7880:                 (e.g., after calling <span><strong class=
                   7881:                 "command">make update</strong></span>) or you may
                   7882:                 lose some packages you intended to update. As a
                   7883:                 rule of thumb: only use this target <span class=
                   7884:                 "emphasis"><em>before</em></span> the first time
                   7885:                 you run <span><strong class="command">make
                   7886:                 update</strong></span> and only if you have a dirty
                   7887:                 package tree (e.g., if you used <code class=
                   7888:                 "varname">NOCLEAN</code>).</p>
1.1       grant    7889: 
                   7890:                 <p>If you unsure about whether your tree is clean
1.14      xtraeme  7891:                 you can either perform a <span><strong class=
                   7892:                 "command">make clean</strong></span> at the top of
                   7893:                 the tree, or use the following sequence of commands
1.1       grant    7894:                 from the directory of the package you want to
                   7895:                 update (<span class=
                   7896:                 "emphasis"><em>before</em></span> running
1.14      xtraeme  7897:                 <span><strong class="command">make
                   7898:                 update</strong></span> for the first time,
                   7899:                 otherwise you lose all the packages you wanted to
                   7900:                 update!):</p>
1.1       grant    7901:                 <pre class="screen">
1.14      xtraeme  7902: <code class="prompt">#</code> <strong class=
                   7903: "userinput"><code>make clean-update</code></strong>
                   7904: <code class="prompt">#</code> <strong class=
                   7905: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   7906: <code class="prompt">#</code> <strong class=
                   7907: "userinput"><code>make update</code></strong>
1.1       grant    7908: </pre>
                   7909: 
                   7910:                 <p>The following variables can be used either on
1.14      xtraeme  7911:                 the command line or in <code class=
                   7912:                 "filename">/etc/mk.conf</code> to alter the
                   7913:                 behaviour of <span><strong class="command">make
                   7914:                 clean-update</strong></span>:</p>
1.1       grant    7915: 
                   7916:                 <div class="variablelist">
                   7917:                   <dl>
1.14      xtraeme  7918:                     <dt><span class="term"><code class=
                   7919:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    7920: 
                   7921:                     <dd>
1.14      xtraeme  7922:                       <p>After <span><strong class="command">make
                   7923:                       clean</strong></span>, do not reconstruct the
                   7924:                       list of directories to update for this
                   7925:                       package. Only use this if
                   7926:                       <span><strong class="command">make
                   7927:                       update</strong></span> successfully installed
                   7928:                       all packages you wanted to update. Normally,
                   7929:                       this is done automatically on
                   7930:                       <span><strong class="command">make
                   7931:                       update</strong></span>, but may have been
                   7932:                       suppressed by the <code class=
                   7933:                       "varname">NOCLEAN</code> variable (see
1.1       grant    7934:                       above).</p>
                   7935:                     </dd>
                   7936:                   </dl>
                   7937:                 </div>
                   7938:               </dd>
                   7939: 
                   7940:               <dt><span class="term">info</span></dt>
                   7941: 
                   7942:               <dd>
                   7943:                 <p>This target invokes <a href=
                   7944:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   7945:                 <span class="citerefentry"><span class=
                   7946:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   7947:                 the current package. You can use this to check
                   7948:                 which version of a package is installed.</p>
                   7949:               </dd>
                   7950: 
                   7951:               <dt><span class="term">readme</span></dt>
                   7952: 
                   7953:               <dd>
1.14      xtraeme  7954:                 <p>This target generates a <code class=
                   7955:                 "filename">README.html</code> file, which can be
1.1       grant    7956:                 viewed using a browser such as <a xmlns=
                   7957:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7958:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20      ben      7959:                 class="pkgname">www/mozilla</a> or <a xmlns=
                   7960:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7961:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
                   7962:                 class="pkgname">www/links</a>. The generated files
                   7963:                 contain references to any packages which are in the
                   7964:                 <code class="varname">PACKAGES</code> directory on
                   7965:                 the local host. The generated files can be made to
                   7966:                 refer to URLs based on <code class=
                   7967:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   7968:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
                   7969:                 wanted to generate <code class=
                   7970:                 "filename">README.html</code> files which pointed
                   7971:                 to binary packages on the local machine, in the
                   7972:                 directory <code class=
                   7973:                 "filename">/usr/packages</code>, set <code class=
                   7974:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   7975:                 and <code class=
                   7976:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   7977:                 <code class="varname">${PACKAGES}</code> directory
                   7978:                 and its subdirectories will be searched for all the
                   7979:                 binary packages.</p>
1.1       grant    7980:               </dd>
                   7981: 
                   7982:               <dt><span class="term">readme-all</span></dt>
                   7983: 
                   7984:               <dd>
1.14      xtraeme  7985:                 <p>Use this target to create a file <code class=
                   7986:                 "filename">README-all.html</code> which contains a
1.1       grant    7987:                 list of all packages currently available in the
                   7988:                 NetBSD Packages Collection, together with the
                   7989:                 category they belong to and a short description.
1.14      xtraeme  7990:                 This file is compiled from the <code class=
                   7991:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    7992:                 sure to run this <span class=
1.14      xtraeme  7993:                 "emphasis"><em>after</em></span> a
                   7994:                 <span><strong class="command">make
                   7995:                 readme</strong></span>.</p>
1.1       grant    7996:               </dd>
                   7997: 
                   7998:               <dt><span class="term">cdrom-readme</span></dt>
                   7999: 
                   8000:               <dd>
                   8001:                 <p>This is very much the same as the
                   8002:                 &#8220;<span class="quote">readme</span>&#8221;
                   8003:                 target (see above), but is to be used when
                   8004:                 generating a pkgsrc tree to be written to a CD-ROM.
1.14      xtraeme  8005:                 This target also produces <code class=
                   8006:                 "filename">README.html</code> files, and can be
                   8007:                 made to refer to URLs based on <code class=
                   8008:                 "varname">CDROM_PKG_URL_HOST</code> and
                   8009:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    8010:               </dd>
                   8011: 
                   8012:               <dt><span class="term">show-distfiles</span></dt>
                   8013: 
                   8014:               <dd>
                   8015:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  8016:                 are needed to build the package. (<code class=
                   8017:                 "varname">DISTFILES</code> and <code class=
                   8018:                 "varname">PATCHFILES</code>, but not <code class=
                   8019:                 "filename">patches/*</code>)</p>
1.1       grant    8020:               </dd>
                   8021: 
                   8022:               <dt><span class="term">show-downlevel</span></dt>
                   8023: 
                   8024:               <dd>
                   8025:                 <p>This target shows nothing if the package is not
                   8026:                 installed. If a version of this package is
                   8027:                 installed, but is not the version provided in this
                   8028:                 version of pkgsrc, then a warning message is
                   8029:                 displayed. This target can be used to show which of
                   8030:                 your installed packages are downlevel, and so the
                   8031:                 old versions can be deleted, and the current ones
                   8032:                 added.</p>
                   8033:               </dd>
                   8034: 
                   8035:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   8036: 
                   8037:               <dd>
                   8038:                 <p>This target shows the directory in the pkgsrc
                   8039:                 hierarchy from which the package can be built and
                   8040:                 installed. This may not be the same directory as
                   8041:                 the one from which the package was installed. This
                   8042:                 target is intended to be used by people who may
                   8043:                 wish to upgrade many packages on a single host, and
                   8044:                 can be invoked from the top-level pkgsrc Makefile
                   8045:                 by using the &#8220;<span class=
                   8046:                 "quote">show-host-specific-pkgs</span>&#8221;
                   8047:                 target.</p>
                   8048:               </dd>
                   8049: 
                   8050:               <dt><span class=
                   8051:               "term">show-installed-depends</span></dt>
                   8052: 
                   8053:               <dd>
                   8054:                 <p>This target shows which installed packages match
1.14      xtraeme  8055:                 the current package's <code class=
                   8056:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    8057:                 dependencies are causing build problems.</p>
                   8058:               </dd>
                   8059: 
                   8060:               <dt><span class="term">check-shlibs</span></dt>
                   8061: 
                   8062:               <dd>
                   8063:                 <p>After a package is installed, check all its
                   8064:                 binaries and (on ELF platforms) shared libraries to
                   8065:                 see if they find the shared libs they need. Run by
1.14      xtraeme  8066:                 default if <code class=
                   8067:                 "varname">PKG_DEVELOPER</code> is set in
                   8068:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    8069:               </dd>
                   8070: 
                   8071:               <dt><span class="term">print-PLIST</span></dt>
                   8072: 
                   8073:               <dd>
                   8074:                 <p>After a &#8220;<span class="quote">make
                   8075:                 install</span>&#8221; from a new or upgraded pkg,
                   8076:                 this prints out an attempt to generate a new
1.14      xtraeme  8077:                 <code class="filename">PLIST</code> from a
                   8078:                 <span><strong class="command">find -newer
                   8079:                 work/.extract_done</strong></span>. An attempt is
                   8080:                 made to care for shared libs etc., but it is
1.1       grant    8081:                 <span class="emphasis"><em>strongly</em></span>
                   8082:                 recommended to review the result before putting it
1.14      xtraeme  8083:                 into <code class="filename">PLIST</code>. On
                   8084:                 upgrades, it's useful to diff the output of this
                   8085:                 command against an already existing <code class=
                   8086:                 "filename">PLIST</code> file.</p>
1.1       grant    8087: 
1.24    ! wiz      8088:                 <p>If the package installs files via <a href=
        !          8089:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
        !          8090:                 <span class="citerefentry"><span class=
        !          8091:                 "refentrytitle">tar</span>(1)</span></a> or other
        !          8092:                 methods that don't update file access times, be
        !          8093:                 sure to add these files manually to your
1.14      xtraeme  8094:                 <code class="filename">PLIST</code>, as the
1.1       grant    8095:                 &#8220;<span class="quote">find
                   8096:                 -newer</span>&#8221; command used by this target
                   8097:                 won't catch them!</p>
                   8098: 
                   8099:                 <p>See <a href="#print-PLIST" title=
                   8100:                 "8.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;8.3,
1.14      xtraeme  8101:                 &#8220;Tweaking output of <span><strong class=
                   8102:                 "command">make
                   8103:                 print-PLIST</strong></span>&#8221;</a> for more
                   8104:                 information on this target.</p>
1.1       grant    8105:               </dd>
                   8106: 
                   8107:               <dt><span class="term">bulk-package</span></dt>
                   8108: 
                   8109:               <dd>
                   8110:                 <p>Used to do bulk builds. If an appropriate binary
                   8111:                 package already exists, no action is taken. If not,
                   8112:                 this target will compile, install and package it
1.14      xtraeme  8113:                 (and it's depends, if <code class=
                   8114:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    8115:                 <a href="#binary.configuration" title=
                   8116:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   8117:                 &#8220;Configuration&#8221;</a>. After creating the
                   8118:                 binary package, the sources, the just-installed
                   8119:                 package and it's required packages are removed,
                   8120:                 preserving free disk space.</p>
                   8121: 
                   8122:                 <p><span class="emphasis"><em>Beware that this
                   8123:                 target may deinstall all packages installed on a
                   8124:                 system!</em></span></p>
                   8125:               </dd>
                   8126: 
                   8127:               <dt><span class="term">bulk-install</span></dt>
                   8128: 
                   8129:               <dd>
                   8130:                 <p>Used during bulk-installs to install required
                   8131:                 packages. If an upto-date binary package is
                   8132:                 available, it will be installed via <a href=
                   8133:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   8134:                 <span class="citerefentry"><span class=
                   8135:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  8136:                 not, <span><strong class="command">make
                   8137:                 bulk-package</strong></span> will be executed, but
                   8138:                 the installed binary not be removed.</p>
1.1       grant    8139: 
                   8140:                 <p>A binary package is considered
                   8141:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   8142:                 to be installed via <a href=
                   8143:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   8144:                 <span class="citerefentry"><span class=
                   8145:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   8146:                 if:</p>
                   8147: 
                   8148:                 <div class="itemizedlist">
                   8149:                   <ul type="disc">
                   8150:                     <li>
1.14      xtraeme  8151:                       <p>None of the package's files (<code class=
                   8152:                       "filename">Makefile</code>, ...) were
                   8153:                       modified since it was built.</p>
1.1       grant    8154:                     </li>
                   8155: 
                   8156:                     <li>
                   8157:                       <p>None of the package's required (binary)
                   8158:                       packages were modified since it was
                   8159:                       built.</p>
                   8160:                     </li>
                   8161:                   </ul>
                   8162:                 </div>
                   8163: 
                   8164:                 <p><span class="emphasis"><em>Beware that this
                   8165:                 target may deinstall all packages installed on a
                   8166:                 system!</em></span></p>
                   8167:               </dd>
                   8168:             </dl>
                   8169:           </div>
                   8170:         </div>
                   8171:       </div>
                   8172: 
                   8173:       <div class="chapter" lang="en" xml:lang="en">
                   8174:         <div class="titlepage">
                   8175:           <div>
                   8176:             <div>
                   8177:               <h2 class="title"><a name="fixes" id=
                   8178:               "fixes"></a>Chapter&nbsp;12.&nbsp;Notes on fixes for
                   8179:               packages</h2>
                   8180:             </div>
                   8181:           </div>
                   8182:         </div>
                   8183: 
                   8184:         <div class="toc">
                   8185:           <p><b>Table of Contents</b></p>
                   8186: 
                   8187:           <dl>
1.24    ! wiz      8188:             <dt><span class="sect1"><a href="#id2632120">12.1.
1.1       grant    8189:             General operation</a></span></dt>
                   8190: 
                   8191:             <dd>
                   8192:               <dl>
                   8193:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8194:                 "#id2632123">12.1.1. How to pull in variables from
1.1       grant    8195:                 /etc/mk.conf</a></span></dt>
                   8196: 
                   8197:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8198:                 "#id2632275">12.1.2. Restricted
1.1       grant    8199:                 packages</a></span></dt>
                   8200: 
                   8201:                 <dt><span class="sect2"><a href=
                   8202:                 "#dependencies">12.1.3. Handling
                   8203:                 dependencies</a></span></dt>
                   8204: 
                   8205:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8206:                 "#id2632728">12.1.4. Handling conflicts with other
1.1       grant    8207:                 packages</a></span></dt>
                   8208: 
                   8209:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8210:                 "#id2632846">12.1.5. Packages that cannot or should
1.1       grant    8211:                 not be built</a></span></dt>
                   8212: 
                   8213:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8214:                 "#id2632872">12.1.6. Packages which should not be
1.1       grant    8215:                 deleted, once installed</a></span></dt>
                   8216: 
                   8217:                 <dt><span class="sect2"><a href=
                   8218:                 "#security-handling">12.1.7. Handling packages with
                   8219:                 security problems</a></span></dt>
                   8220: 
                   8221:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8222:                 "#id2632964">12.1.8. How to handle compiler
1.1       grant    8223:                 bugs</a></span></dt>
                   8224: 
                   8225:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8226:                 "#id2633054">12.1.9. How to handle incrementing
1.1       grant    8227:                 versions when fixing an existing
                   8228:                 package</a></span></dt>
                   8229: 
                   8230:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8231:                 "#id2633104">12.1.10. Portability of
1.1       grant    8232:                 packages</a></span></dt>
                   8233:               </dl>
                   8234:             </dd>
                   8235: 
1.24    ! wiz      8236:             <dt><span class="sect1"><a href="#id2633128">12.2.
1.1       grant    8237:             Possible downloading issues</a></span></dt>
                   8238: 
                   8239:             <dd>
                   8240:               <dl>
                   8241:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8242:                 "#id2633131">12.2.1. Packages whose distfiles
1.1       grant    8243:                 aren't available for plain
                   8244:                 downloading</a></span></dt>
                   8245: 
                   8246:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8247:                 "#id2633194">12.2.2. How to handle modified
1.1       grant    8248:                 distfiles with the 'old' name</a></span></dt>
                   8249:               </dl>
                   8250:             </dd>
                   8251: 
1.24    ! wiz      8252:             <dt><span class="sect1"><a href="#id2633206">12.3.
1.1       grant    8253:             Configuration gotchas</a></span></dt>
                   8254: 
                   8255:             <dd>
                   8256:               <dl>
                   8257:                 <dt><span class="sect2"><a href=
                   8258:                 "#fixes.libtool">12.3.1. Shared libraries -
                   8259:                 libtool</a></span></dt>
                   8260: 
                   8261:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8262:                 "#id2633640">12.3.2. Using libtool on GNU packages
1.1       grant    8263:                 that already support libtool</a></span></dt>
                   8264: 
                   8265:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8266:                 "#id2633721">12.3.3. GNU
1.1       grant    8267:                 Autoconf/Automake</a></span></dt>
                   8268:               </dl>
                   8269:             </dd>
                   8270: 
1.24    ! wiz      8271:             <dt><span class="sect1"><a href="#id2633834">12.4.
1.1       grant    8272:             Building considerations</a></span></dt>
                   8273: 
                   8274:             <dd>
                   8275:               <dl>
                   8276:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8277:                 "#id2633837">12.4.1. CPP defines</a></span></dt>
1.1       grant    8278:               </dl>
                   8279:             </dd>
                   8280: 
1.24    ! wiz      8281:             <dt><span class="sect1"><a href="#id2633867">12.5.
1.1       grant    8282:             Package specific actions</a></span></dt>
                   8283: 
                   8284:             <dd>
                   8285:               <dl>
                   8286:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8287:                 "#id2633870">12.5.1. Package configuration
1.1       grant    8288:                 files</a></span></dt>
                   8289: 
                   8290:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8291:                 "#id2633973">12.5.2. User
1.2       hubertf  8292:                 interaction</a></span></dt>
1.1       grant    8293: 
                   8294:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8295:                 "#id2634018">12.5.3. Handling
1.1       grant    8296:                 licenses</a></span></dt>
                   8297: 
                   8298:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8299:                 "#id2634169">12.5.4. Creating an account from a
1.1       grant    8300:                 package</a></span></dt>
                   8301: 
                   8302:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8303:                 "#id2634231">12.5.5. Installing score
1.1       grant    8304:                 files</a></span></dt>
                   8305: 
                   8306:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8307:                 "#id2634411">12.5.6. Packages providing login
1.1       grant    8308:                 shells</a></span></dt>
                   8309: 
                   8310:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8311:                 "#id2634469">12.5.7. Packages containing perl
1.1       grant    8312:                 scripts</a></span></dt>
                   8313: 
                   8314:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8315:                 "#id2634555">12.5.8. Packages with hardcoded paths
1.1       grant    8316:                 to other interpreters</a></span></dt>
                   8317: 
                   8318:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8319:                 "#id2634577">12.5.9. Packages installing perl
1.1       grant    8320:                 modules</a></span></dt>
                   8321: 
                   8322:                 <dt><span class="sect2"><a href=
                   8323:                 "#faq.info-files">12.5.10. Packages installing info
                   8324:                 files</a></span></dt>
                   8325: 
                   8326:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8327:                 "#id2634865">12.5.11. Packages installing GConf2
1.1       grant    8328:                 data files</a></span></dt>
                   8329: 
                   8330:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8331:                 "#id2634965">12.5.12. Packages installing
1.1       grant    8332:                 scrollkeeper data files</a></span></dt>
                   8333: 
                   8334:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8335:                 "#id2635016">12.5.13. Packages installing X11
1.1       grant    8336:                 fonts</a></span></dt>
                   8337: 
                   8338:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8339:                 "#id2635063">12.5.14. Packages installing GTK2
1.1       grant    8340:                 modules</a></span></dt>
                   8341: 
                   8342:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8343:                 "#id2635201">12.5.15. Packages installing SGML or
1.1       grant    8344:                 XML data</a></span></dt>
                   8345: 
                   8346:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8347:                 "#id2635253">12.5.16. Packages installing
1.1       grant    8348:                 extensions to the MIME database</a></span></dt>
                   8349: 
                   8350:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8351:                 "#id2635323">12.5.17. Packages using
1.1       grant    8352:                 intltool</a></span></dt>
1.18      xtraeme  8353: 
                   8354:                 <dt><span class="sect2"><a href=
1.24    ! wiz      8355:                 "#id2635337">12.5.18. Packages installing startup
1.18      xtraeme  8356:                 scripts</a></span></dt>
1.1       grant    8357:               </dl>
                   8358:             </dd>
                   8359: 
1.24    ! wiz      8360:             <dt><span class="sect1"><a href="#id2635358">12.6.
1.1       grant    8361:             Feedback to the author</a></span></dt>
                   8362:           </dl>
                   8363:         </div>
                   8364: 
                   8365:         <div class="sect1" lang="en" xml:lang="en">
                   8366:           <div class="titlepage">
                   8367:             <div>
                   8368:               <div>
                   8369:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      8370:                 "id2632120" id="id2632120"></a>12.1.&nbsp;General
1.1       grant    8371:                 operation</h2>
                   8372:               </div>
                   8373:             </div>
                   8374:           </div>
                   8375: 
                   8376:           <div class="sect2" lang="en" xml:lang="en">
                   8377:             <div class="titlepage">
                   8378:               <div>
                   8379:                 <div>
1.24    ! wiz      8380:                   <h3 class="title"><a name="id2632123" id=
        !          8381:                   "id2632123"></a>12.1.1.&nbsp;How to pull in
1.1       grant    8382:                   variables from /etc/mk.conf</h3>
                   8383:                 </div>
                   8384:               </div>
                   8385:             </div>
                   8386: 
                   8387:             <p>The problem with package-defined variables that can
1.14      xtraeme  8388:             be overridden via <code class="varname">MAKECONF</code>
                   8389:             or <code class="filename">/etc/mk.conf</code> is that
                   8390:             <a href=
1.1       grant    8391:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8392:             <span class="citerefentry"><span class=
                   8393:             "refentrytitle">make</span>(1)</span></a> expands a
                   8394:             variable as it is used, but evaluates preprocessor like
                   8395:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  8396:             So, to use any variable (which may be set in
                   8397:             <code class="filename">/etc/mk.conf</code>) in one of
                   8398:             the .if* statements, the file <code class=
                   8399:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    8400:             that .if* statement.</p>
                   8401: 
                   8402:             <p>Rather than have a number of ad-hoc ways of
1.14      xtraeme  8403:             including <code class="filename">/etc/mk.conf</code>,
                   8404:             should it exist, or <code class=
                   8405:             "varname">MAKECONF</code>, should it exist, include the
                   8406:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
                   8407:             file in the package Makefile before any
                   8408:             preprocessor-like .if, .ifdef, or .ifndef
                   8409:             statements:</p>
1.1       grant    8410:             <pre class="programlisting">
                   8411: .include "../../mk/bsd.prefs.mk"
                   8412:     
                   8413:     .if defined(USE_MENUS)
                   8414:       ...
                   8415:     .endif
                   8416: </pre>
                   8417: 
1.14      xtraeme  8418:             <p>If you wish to set the <code class=
                   8419:             "varname">CFLAGS</code> variable in <code class=
                   8420:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    8421:             use:</p>
                   8422:             <pre class="programlisting">
                   8423: CFLAGS+=  -your -flags
                   8424: </pre>
                   8425: 
1.14      xtraeme  8426:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   8427:             without the &#8220;<span class="quote">+</span>&#8221;)
                   8428:             may lead to problems with packages that need to add
                   8429:             their own flags. Also, you may want to take a look at
                   8430:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    8431:             href=
                   8432:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20      ben      8433:             class="pkgname">devel/cpuflags</a> package if you're
                   8434:             interested in optimization for the current CPU.</p>
1.1       grant    8435:           </div>
                   8436: 
                   8437:           <div class="sect2" lang="en" xml:lang="en">
                   8438:             <div class="titlepage">
                   8439:               <div>
                   8440:                 <div>
1.24    ! wiz      8441:                   <h3 class="title"><a name="id2632275" id=
        !          8442:                   "id2632275"></a>12.1.2.&nbsp;Restricted
1.1       grant    8443:                   packages</h3>
                   8444:                 </div>
                   8445:               </div>
                   8446:             </div>
                   8447: 
                   8448:             <p>Some licenses restrict how software may be
                   8449:             re-distributed. In order to satisfy these restrictions,
                   8450:             the package system defines five make variables that can
                   8451:             be set to note these restrictions:</p>
                   8452: 
                   8453:             <div class="itemizedlist">
                   8454:               <ul type="disc">
                   8455:                 <li>
1.14      xtraeme  8456:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    8457: 
                   8458:                   <p>This variable should be set whenever a
                   8459:                   restriction exists (regardless of its kind). Set
                   8460:                   this variable to a string containing the reason
                   8461:                   for the restriction.</p>
                   8462:                 </li>
                   8463: 
                   8464:                 <li>
1.14      xtraeme  8465:                   <p><code class=
                   8466:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    8467: 
                   8468:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  8469:                   variable to <code class=
                   8470:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8471:                   package may not be included on a CD-ROM.</p>
                   8472:                 </li>
                   8473: 
                   8474:                 <li>
1.14      xtraeme  8475:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    8476: 
                   8477:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  8478:                   Set this variable to <code class=
                   8479:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8480:                   package may not not be made available on the
                   8481:                   Internet.</p>
                   8482:                 </li>
                   8483: 
                   8484:                 <li>
1.14      xtraeme  8485:                   <p><code class=
                   8486:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    8487: 
                   8488:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  8489:                   this variable to <code class=
                   8490:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8491:                   of the source code or other distfile(s) is not
                   8492:                   allowed on CD-ROMs.</p>
                   8493:                 </li>
                   8494: 
                   8495:                 <li>
1.14      xtraeme  8496:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    8497: 
                   8498:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  8499:                   variable to <code class=
                   8500:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8501:                   of the source code or other distfile(s) via the
                   8502:                   Internet is not allowed.</p>
                   8503:                 </li>
                   8504:               </ul>
                   8505:             </div>
                   8506: 
1.14      xtraeme  8507:             <p>Please note that the use of <code class=
                   8508:             "varname">NO_PACKAGE</code>, <code class=
                   8509:             "varname">IGNORE</code>, <code class=
                   8510:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    8511:             variables to denote restrictions is deprecated, because
                   8512:             they unconditionally prevent users from generating
                   8513:             binary packages!</p>
                   8514:           </div>
                   8515: 
                   8516:           <div class="sect2" lang="en" xml:lang="en">
                   8517:             <div class="titlepage">
                   8518:               <div>
                   8519:                 <div>
                   8520:                   <h3 class="title"><a name="dependencies" id=
                   8521:                   "dependencies"></a>12.1.3.&nbsp;Handling
                   8522:                   dependencies</h3>
                   8523:                 </div>
                   8524:               </div>
                   8525:             </div>
                   8526: 
                   8527:             <p>Your package may depend on some other package being
                   8528:             present - and there are various ways of expressing this
1.14      xtraeme  8529:             dependency. pkgsrc supports the <code class=
                   8530:             "varname">BUILD_DEPENDS</code> and <code class=
                   8531:             "varname">DEPENDS</code> definitions, as well as
                   8532:             dependencies via <code class=
                   8533:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    8534:             way to handle dependencies, and which uses the
                   8535:             variables named above. See <a href="#buildlink" title=
                   8536:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8537:             <i>Buildlink methodology</i></a> for more
                   8538:             information.</p>
                   8539: 
                   8540:             <p>The basic difference between the two variables is as
1.14      xtraeme  8541:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    8542:             definition registers that pre-requisite in the binary
                   8543:             package so it will be pulled in when the binary package
1.14      xtraeme  8544:             is later installed, whilst the <code class=
                   8545:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    8546:             marking a dependency that is only needed for building
                   8547:             the package.</p>
                   8548: 
                   8549:             <p>This means that if you only need a package present
                   8550:             whilst you are building, it should be noted as a
1.14      xtraeme  8551:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    8552: 
1.14      xtraeme  8553:             <p>The format for a <code class=
                   8554:             "varname">BUILD_DEPENDS</code> and a <code class=
                   8555:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    8556:             <pre class="programlisting">
                   8557: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   8558: </pre>
                   8559: 
                   8560:             <p>Please note that the &#8220;<span class=
                   8561:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  8562:             any of the wildcard version numbers recognized by
1.1       grant    8563:             <a href=
                   8564:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   8565:             <span class="citerefentry"><span class=
                   8566:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   8567: 
                   8568:             <div class="orderedlist">
                   8569:               <ol type="1">
                   8570:                 <li>
                   8571:                   <p>If your package needs another package's
                   8572:                   binaries or libraries to build or run, and if
1.14      xtraeme  8573:                   that package has a <code class=
                   8574:                   "filename">buildlink3.mk</code> file available,
                   8575:                   use it:</p>
1.1       grant    8576:                   <pre class="programlisting">
                   8577:     .include "../../graphics/jpeg/buildlink3.mk"
                   8578:     
                   8579: </pre>
                   8580:                 </li>
                   8581: 
                   8582:                 <li>
                   8583:                   <p>If your package needs to use another package
1.14      xtraeme  8584:                   to build itself and there is no <code class=
                   8585:                   "filename">buildlink3.mk</code> file available,
                   8586:                   use the <code class=
                   8587:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    8588:                   <pre class="programlisting">
                   8589: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   8590: </pre>
                   8591:                 </li>
                   8592: 
                   8593:                 <li>
                   8594:                   <p>If your package needs a library with which to
1.14      xtraeme  8595:                   link and again there is no <code class=
                   8596:                   "filename">buildlink3.mk</code> file available,
                   8597:                   this is specified using the <code class=
                   8598:                   "varname">DEPENDS</code> definition. An example
                   8599:                   of this is the <a xmlns=
1.1       grant    8600:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8601:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      8602:                   class="pkgname">print/lyx</a> package, which uses
                   8603:                   the xpm library, version 3.4j to build:</p>
1.1       grant    8604:                   <pre class="programlisting">
                   8605: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   8606: </pre>
                   8607: 
                   8608:                   <p>You can also use wildcards in package
                   8609:                   dependences:</p>
                   8610:                   <pre class="programlisting">
                   8611: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   8612: </pre>
                   8613: 
                   8614:                   <p>Note that such wildcard dependencies are
                   8615:                   retained when creating binary packages. The
                   8616:                   dependency is checked when installing the binary
                   8617:                   package and any package which matches the pattern
                   8618:                   will be used. Wildcard dependencies should be
                   8619:                   used with care.</p>
                   8620: 
                   8621:                   <p>The &#8220;<span class=
                   8622:                   "quote">-[0-9]*</span>&#8221; should be used
                   8623:                   instead of &#8220;<span class=
                   8624:                   "quote">-*</span>&#8221; to avoid potentially
                   8625:                   ambiguous matches such as &#8220;<span class=
                   8626:                   "quote">tk-postgresql</span>&#8221; matching a
                   8627:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  8628:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    8629: 
                   8630:                   <p>Wildcards can also be used to specify that a
                   8631:                   package will only build against a certain minimum
                   8632:                   version of a pre-requisite:</p>
                   8633:                   <pre class="programlisting">
                   8634: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   8635: </pre>
                   8636: 
                   8637:                   <p>This means that the package will build against
                   8638:                   version 3.5.4 of the tiff library or newer. Such
                   8639:                   a dependency may be warranted if, for example,
                   8640:                   the API of the library has changed with version
                   8641:                   3.5.4 and a package would not compile against an
                   8642:                   earlier version of tiff.</p>
                   8643: 
                   8644:                   <p>Please note that such dependencies should only
                   8645:                   be updated if a package requires a newer
                   8646:                   pre-requisite, but not to denote recommendations
                   8647:                   such as security updates or ABI changes that do
                   8648:                   not prevent a package from building correctly.
                   8649:                   Such recommendations can be expressed using
1.14      xtraeme  8650:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    8651:                   <pre class="programlisting">
                   8652: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   8653: </pre>
                   8654: 
1.14      xtraeme  8655:                   <p>In addition to the above <code class=
                   8656:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    8657:                   while a package will build against
                   8658:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  8659:                   recommended. <code class=
                   8660:                   "varname">RECOMMENDED</code> entries will be
                   8661:                   turned into dependencies unless explicitly
                   8662:                   ignored (in which case a warning will be
                   8663:                   printed). Packages that are built with
1.1       grant    8664:                   recommendations ignored may not be uploaded to
                   8665:                   ftp.NetBSD.org by developers and should not be
                   8666:                   used across different systems that may have
                   8667:                   different versions of binary packages
                   8668:                   installed.</p>
                   8669: 
                   8670:                   <p>For security fixes, please update the package
                   8671:                   vulnerabilities file as well as setting
1.14      xtraeme  8672:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    8673:                   <a href="#security-handling" title=
                   8674:                   "12.1.7.&nbsp;Handling packages with security problems">
                   8675:                   Section 12.1.7, &#8220;Handling packages with
                   8676:                   security problems&#8221;</a> for more
                   8677:                   information.</p>
                   8678:                 </li>
                   8679: 
                   8680:                 <li>
                   8681:                   <p>If your package needs some executable to be
1.17      sketch   8682:                   able to run correctly and if there's no
1.14      xtraeme  8683:                   <code class="filename">buildlink3.mk</code> file,
                   8684:                   this is specified using the <code class=
                   8685:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    8686:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8687:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      8688:                   class="pkgname">print/lyx</a> package needs to be
                   8689:                   able to execute the latex binary from the teTeX
                   8690:                   package when it runs, and that is specified:</p>
1.1       grant    8691:                   <pre class="programlisting">
                   8692: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   8693: </pre>
                   8694: 
                   8695:                   <p>The comment about wildcard dependencies from
                   8696:                   previous paragraph applies here, too.</p>
                   8697:                 </li>
                   8698:               </ol>
                   8699:             </div>
                   8700: 
                   8701:             <p>If your package needs files from another package to
                   8702:             build, see the first part of the &#8220;<span class=
                   8703:             "quote">do-configure</span>&#8221; target <a xmlns=
                   8704:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8705:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20      ben      8706:             class="pkgname">print/ghostscript5</a> package (it
                   8707:             relies on the jpeg sources being present in source form
                   8708:             during the build):</p>
1.1       grant    8709:             <pre class="programlisting">
                   8710: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   8711:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   8712:     fi
                   8713: </pre>
                   8714: 
                   8715:             <p>If you build any other packages that way, please
                   8716:             make sure the working files are deleted too when this
                   8717:             package's working files are cleaned up. The easiest way
                   8718:             to do so is by adding a pre-clean target:</p>
                   8719:             <pre class="programlisting">
                   8720: pre-clean:
                   8721:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   8722: </pre>
                   8723: 
1.14      xtraeme  8724:             <p>Please also note the <code class=
                   8725:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   8726:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   8727:             which are provided as convenience definitions. The
1.24    ! wiz      8728:             former works out whether <a href=
        !          8729:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
        !          8730:             <span class="citerefentry"><span class=
        !          8731:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
        !          8732:             the base system, and, if it isn't, installs the
        !          8733:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          8734:             href=
1.1       grant    8735:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20      ben      8736:             class="pkgname">devel/gettext</a> package. The latter
                   8737:             adds a build dependency on either an installed version
                   8738:             of an older gettext package, or if it isn't, installs
                   8739:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8740:             href=
                   8741:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
                   8742:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    8743:           </div>
                   8744: 
                   8745:           <div class="sect2" lang="en" xml:lang="en">
                   8746:             <div class="titlepage">
                   8747:               <div>
                   8748:                 <div>
1.24    ! wiz      8749:                   <h3 class="title"><a name="id2632728" id=
        !          8750:                   "id2632728"></a>12.1.4.&nbsp;Handling conflicts
1.1       grant    8751:                   with other packages</h3>
                   8752:                 </div>
                   8753:               </div>
                   8754:             </div>
                   8755: 
                   8756:             <p>Your package may conflict with other packages a user
                   8757:             might already have installed on his system, e.g. if
                   8758:             your package installs the same set of files like
                   8759:             another package in our pkgsrc tree.</p>
                   8760: 
1.14      xtraeme  8761:             <p>In this case you can set <code class=
                   8762:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    8763:             packages (including version string) your package
                   8764:             conflicts with.</p>
                   8765: 
                   8766:             <p>For example <a xmlns=
                   8767:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8768:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20      ben      8769:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
                   8770:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8771:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
                   8772:             class="pkgname">x11/Xaw-Xpm</a> install provide the
                   8773:             same shared library, thus you set in <code class=
                   8774:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    8775:             <pre class="programlisting">
                   8776: CONFLICTS=      Xaw-Xpm-[0-9]*
                   8777: </pre>
                   8778: 
1.14      xtraeme  8779:             <p>and in <code class=
                   8780:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    8781:             <pre class="programlisting">
                   8782: CONFLICTS=      Xaw3d-[0-9]*
                   8783: </pre>
                   8784: 
                   8785:             <p>Packages will automatically conflict with other
                   8786:             packages with the name prefix and a different version
                   8787:             string. &#8220;<span class=
                   8788:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   8789:             conflict with the older version &#8220;<span class=
                   8790:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   8791:           </div>
                   8792: 
                   8793:           <div class="sect2" lang="en" xml:lang="en">
                   8794:             <div class="titlepage">
                   8795:               <div>
                   8796:                 <div>
1.24    ! wiz      8797:                   <h3 class="title"><a name="id2632846" id=
        !          8798:                   "id2632846"></a>12.1.5.&nbsp;Packages that cannot
1.1       grant    8799:                   or should not be built</h3>
                   8800:                 </div>
                   8801:               </div>
                   8802:             </div>
                   8803: 
                   8804:             <p>There are several reasons why a package might be
                   8805:             instructed to not build under certain circumstances. If
                   8806:             the package builds and runs on most platforms, the
1.14      xtraeme  8807:             exceptions should be noted with <code class=
                   8808:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   8809:             builds and runs on a small handful of platforms, set
                   8810:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
                   8811:             If the package should be skipped (for example, because
                   8812:             it provides functionality already provided by the
                   8813:             system), set <code class=
                   8814:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   8815:             message. If the package should fail because some
                   8816:             preconditions are not met, set <code class=
                   8817:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    8818:             message.</p>
                   8819: 
1.14      xtraeme  8820:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    8821:             because it didn't provide enough information to
                   8822:             determine whether the build should fail.</p>
                   8823:           </div>
                   8824: 
                   8825:           <div class="sect2" lang="en" xml:lang="en">
                   8826:             <div class="titlepage">
                   8827:               <div>
                   8828:                 <div>
1.24    ! wiz      8829:                   <h3 class="title"><a name="id2632872" id=
        !          8830:                   "id2632872"></a>12.1.6.&nbsp;Packages which
1.1       grant    8831:                   should not be deleted, once installed</h3>
                   8832:                 </div>
                   8833:               </div>
                   8834:             </div>
                   8835: 
                   8836:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  8837:             has been installed, the <code class=
                   8838:             "varname">PKG_PRESERVE</code> definition should be set
                   8839:             in the package Makefile. This will be carried into any
1.1       grant    8840:             binary package that is made from this pkgsrc entry. A
                   8841:             &#8220;<span class="quote">preserved</span>&#8221;
                   8842:             package will not be deleted using <a href=
                   8843:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8844:             <span class="citerefentry"><span class=
                   8845:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   8846:             the &#8220;<span class="quote">-f</span>&#8221; option
                   8847:             is used.</p>
                   8848:           </div>
                   8849: 
                   8850:           <div class="sect2" lang="en" xml:lang="en">
                   8851:             <div class="titlepage">
                   8852:               <div>
                   8853:                 <div>
                   8854:                   <h3 class="title"><a name="security-handling" id=
                   8855:                   "security-handling"></a>12.1.7.&nbsp;Handling
                   8856:                   packages with security problems</h3>
                   8857:                 </div>
                   8858:               </div>
                   8859:             </div>
                   8860: 
                   8861:             <p>When a vulnerability is found, this should be noted
1.14      xtraeme  8862:             in <code class=
                   8863:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    8864:             and after the commit of that file, it should be copied
1.14      xtraeme  8865:             to both <code class=
                   8866:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
                   8867:             and <code class=
                   8868:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
                   8869:             on ftp.NetBSD.org using <code class=
                   8870:             "filename">localsrc/security/advisories/Makefile</code>.
                   8871:             In addition, if a <code class=
                   8872:             "filename">buildlink3.mk</code> file exists for an
                   8873:             affected package, bumping <code class=
                   8874:             "varname">PKGREVISION</code> and creating a
                   8875:             corresponding <code class=
                   8876:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   8877:             "replaceable"><code>pkg</code></em></code> entry should
                   8878:             be considered. See <a href="#buildlink" title=
1.1       grant    8879:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8880:             <i>Buildlink methodology</i></a> for more information
1.14      xtraeme  8881:             about writing <code class=
                   8882:             "filename">buildlink3.mk</code> files and <code class=
                   8883:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    8884: 
                   8885:             <p>Also, if the fix should be applied to the stable
                   8886:             pkgsrc branch, be sure to submit a pullup request!</p>
                   8887:           </div>
                   8888: 
                   8889:           <div class="sect2" lang="en" xml:lang="en">
                   8890:             <div class="titlepage">
                   8891:               <div>
                   8892:                 <div>
1.24    ! wiz      8893:                   <h3 class="title"><a name="id2632964" id=
        !          8894:                   "id2632964"></a>12.1.8.&nbsp;How to handle
1.1       grant    8895:                   compiler bugs</h3>
                   8896:                 </div>
                   8897:               </div>
                   8898:             </div>
                   8899: 
                   8900:             <p>Some source files trigger bugs in the compiler,
                   8901:             based on combinations of compiler version and
                   8902:             architecture and almost always relation to optimisation
                   8903:             being enabled. Common symptoms are gcc internal errors
                   8904:             or never finishing compiling a file.</p>
                   8905: 
                   8906:             <p>Typically a workaround involves testing the
1.14      xtraeme  8907:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    8908:             version, disabling optimisation for that
1.14      xtraeme  8909:             file/<code class="varname">MACHINE_ARCH</code>/compiler
                   8910:             combination, and documenting it in <code class=
                   8911:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    8912:             number of examples!</p>
                   8913:           </div>
                   8914: 
                   8915:           <div class="sect2" lang="en" xml:lang="en">
                   8916:             <div class="titlepage">
                   8917:               <div>
                   8918:                 <div>
1.24    ! wiz      8919:                   <h3 class="title"><a name="id2633054" id=
        !          8920:                   "id2633054"></a>12.1.9.&nbsp;How to handle
1.1       grant    8921:                   incrementing versions when fixing an existing
                   8922:                   package</h3>
                   8923:                 </div>
                   8924:               </div>
                   8925:             </div>
                   8926: 
                   8927:             <p>When making fixes to an existing package it can be
1.14      xtraeme  8928:             useful to change the version number in <code class=
                   8929:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    8930:             future versions by the original author, a
                   8931:             &#8220;<span class="quote">nb1</span>&#8221;,
                   8932:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   8933:             suffix can be used on package versions by setting
1.14      xtraeme  8934:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   8935:             The &#8220;<span class="quote">nb</span>&#8221; is
                   8936:             treated like a &#8220;<span class=
                   8937:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    8938:             <pre class="programlisting">
                   8939:   DISTNAME= foo-17.42
                   8940:     PKGREVISION=  9
                   8941: </pre>
                   8942: 
1.14      xtraeme  8943:             <p>will result in a <code class=
                   8944:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    8945:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   8946: 
                   8947:             <p>When a new release of the package is released, the
1.14      xtraeme  8948:             <code class="varname">PKGREVISION</code> should be
                   8949:             removed. e.g. on a new minor release of the above
                   8950:             package, things should be like:</p>
1.1       grant    8951:             <pre class="programlisting">
                   8952: DISTNAME=   foo-17.43
                   8953: </pre>
                   8954:           </div>
                   8955: 
                   8956:           <div class="sect2" lang="en" xml:lang="en">
                   8957:             <div class="titlepage">
                   8958:               <div>
                   8959:                 <div>
1.24    ! wiz      8960:                   <h3 class="title"><a name="id2633104" id=
        !          8961:                   "id2633104"></a>12.1.10.&nbsp;Portability of
1.1       grant    8962:                   packages</h3>
                   8963:                 </div>
                   8964:               </div>
                   8965:             </div>
                   8966: 
                   8967:             <p>One appealing feature of pkgsrc is that it runs on
                   8968:             many different platforms. As a result, it is important
                   8969:             to ensure, where possible, that packages in pkgsrc are
                   8970:             portable. There are some particular details you should
                   8971:             pay attention to while working on pkgsrc.</p>
                   8972: 
                   8973:             <div class="sect3" lang="en" xml:lang="en">
                   8974:               <div class="titlepage">
                   8975:                 <div>
                   8976:                   <div>
1.24    ! wiz      8977:                     <h4 class="title"><a name="id2633109" id=
        !          8978:                     "id2633109"></a>12.1.10.1.&nbsp;${INSTALL},
1.1       grant    8979:                     ${INSTALL_DATA_DIR}, ...</h4>
                   8980:                   </div>
                   8981:                 </div>
                   8982:               </div>
                   8983: 
1.14      xtraeme  8984:               <p>The BSD-compatible <span><strong class=
                   8985:               "command">install</strong></span> supplied with some
1.1       grant    8986:               operating systems will not perform more than one
                   8987:               operation at a time. As such, you should call
                   8988:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   8989:               etc. like this:</p>
                   8990:               <pre class="programlisting">
                   8991: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   8992: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   8993: </pre>
                   8994:             </div>
                   8995:           </div>
                   8996:         </div>
                   8997: 
                   8998:         <div class="sect1" lang="en" xml:lang="en">
                   8999:           <div class="titlepage">
                   9000:             <div>
                   9001:               <div>
                   9002:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      9003:                 "id2633128" id="id2633128"></a>12.2.&nbsp;Possible
1.1       grant    9004:                 downloading issues</h2>
                   9005:               </div>
                   9006:             </div>
                   9007:           </div>
                   9008: 
                   9009:           <div class="sect2" lang="en" xml:lang="en">
                   9010:             <div class="titlepage">
                   9011:               <div>
                   9012:                 <div>
1.24    ! wiz      9013:                   <h3 class="title"><a name="id2633131" id=
        !          9014:                   "id2633131"></a>12.2.1.&nbsp;Packages whose
1.1       grant    9015:                   distfiles aren't available for plain
                   9016:                   downloading</h3>
                   9017:                 </div>
                   9018:               </div>
                   9019:             </div>
                   9020: 
                   9021:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  9022:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   9023:             and a <span><strong class="command">make
                   9024:             fetch</strong></span> will call <code class=
                   9025:             "filename">files/getsite.sh</code> with the name of
                   9026:             each file to download as an argument, expecting it to
                   9027:             output the URL of the directory from which to download
                   9028:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9029:             href=
1.1       grant    9030:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20      ben      9031:             class="pkgname">graphics/ns-cult3d</a> is an example of
                   9032:             this usage.</p>
1.1       grant    9033: 
                   9034:             <p>If the download can't be automated, because the user
                   9035:             must submit personal information to apply for a
                   9036:             password, or must pay for the source, or whatever, you
1.14      xtraeme  9037:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   9038:             a macro which displays a message explaining the
                   9039:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   9040:             must be executable shell commands, not just a message.
                   9041:             (Generally, it executes <code class=
                   9042:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    9043:             following packages use this: <a xmlns=
                   9044:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9045:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20      ben      9046:             class="pkgname">audio/realplayer</a>, <a xmlns=
                   9047:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9048:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
                   9049:             class="pkgname">cad/simian</a>, <a xmlns=
                   9050:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9051:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
                   9052:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
                   9053:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9054:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
                   9055:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
                   9056:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9057:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
                   9058:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
                   9059:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9060:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
                   9061:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
                   9062:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9063:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
                   9064:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
                   9065:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9066:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
                   9067:             class="pkgname">www/openacs</a>. Try to be consistent
                   9068:             with them.</p>
1.1       grant    9069:           </div>
                   9070: 
                   9071:           <div class="sect2" lang="en" xml:lang="en">
                   9072:             <div class="titlepage">
                   9073:               <div>
                   9074:                 <div>
1.24    ! wiz      9075:                   <h3 class="title"><a name="id2633194" id=
        !          9076:                   "id2633194"></a>12.2.2.&nbsp;How to handle
1.1       grant    9077:                   modified distfiles with the 'old' name</h3>
                   9078:                 </div>
                   9079:               </div>
                   9080:             </div>
                   9081: 
                   9082:             <p>Sometimes authors of a software package make some
                   9083:             modifications after the software was released, and they
                   9084:             put up a new distfile without changing the package's
                   9085:             version number. If a package is already in pkgsrc at
                   9086:             that time, the md5 checksum will no longer match. The
                   9087:             correct way to work around this is to update the
                   9088:             package's md5 checksum to match the package on the
                   9089:             master site (beware, any mirrors may not be up to date
                   9090:             yet!), and to remove the old distfile from
1.14      xtraeme  9091:             ftp.NetBSD.org's <code class=
                   9092:             "filename">/pub/NetBSD/packages/distfiles</code>
1.1       grant    9093:             directory. Furthermore, a mail to the package's author
                   9094:             seems appropriate making sure the distfile was really
                   9095:             updated on purpose, and that no trojan horse or so
                   9096:             crept in.</p>
                   9097:           </div>
                   9098:         </div>
                   9099: 
                   9100:         <div class="sect1" lang="en" xml:lang="en">
                   9101:           <div class="titlepage">
                   9102:             <div>
                   9103:               <div>
                   9104:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      9105:                 "id2633206" id=
        !          9106:                 "id2633206"></a>12.3.&nbsp;Configuration
1.1       grant    9107:                 gotchas</h2>
                   9108:               </div>
                   9109:             </div>
                   9110:           </div>
                   9111: 
                   9112:           <div class="sect2" lang="en" xml:lang="en">
                   9113:             <div class="titlepage">
                   9114:               <div>
                   9115:                 <div>
                   9116:                   <h3 class="title"><a name="fixes.libtool" id=
                   9117:                   "fixes.libtool"></a>12.3.1.&nbsp;Shared libraries
                   9118:                   - libtool</h3>
                   9119:                 </div>
                   9120:               </div>
                   9121:             </div>
                   9122: 
                   9123:             <p>pkgsrc supports many different machines, with
                   9124:             different object formats like a.out and ELF, and
                   9125:             varying abilities to do shared library and dynamic
                   9126:             loading at all. To accompany this, varying commands and
                   9127:             options have to be passed to the compiler, linker, etc.
                   9128:             to get the Right Thing, which can be pretty annoying
                   9129:             especially if you don't have all the machines at your
                   9130:             hand to test things. The <a xmlns=
                   9131:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9132:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20      ben      9133:             class="pkgname">devel/libtool</a> pkg can help here, as
                   9134:             it just &#8220;<span class="quote">knows</span>&#8221;
                   9135:             how to build both static and dynamic libraries from a
                   9136:             set of source files, thus being platform
                   9137:             independent.</p>
1.1       grant    9138: 
                   9139:             <p>Here's how to use libtool in a pkg in seven simple
                   9140:             steps:</p>
                   9141: 
                   9142:             <div class="orderedlist">
                   9143:               <ol type="1">
                   9144:                 <li>
1.14      xtraeme  9145:                   <p>Add <code class=
                   9146:                   "varname">USE_LIBTOOL=yes</code> to the package
                   9147:                   Makefile.</p>
1.1       grant    9148:                 </li>
                   9149: 
                   9150:                 <li>
                   9151:                   <p>For library objects, use &#8220;<span class=
                   9152:                   "quote">${LIBTOOL} --mode=compile
                   9153:                   ${CC}</span>&#8221; in place of
                   9154:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   9155:                   You could even add it to the definition of
1.14      xtraeme  9156:                   <code class="varname">CC</code>, if only
                   9157:                   libraries are being built in a given Makefile.
                   9158:                   This one command will build both PIC and non-PIC
                   9159:                   library objects, so you need not have separate
                   9160:                   shared and non-shared library rules.</p>
1.1       grant    9161:                 </li>
                   9162: 
                   9163:                 <li>
                   9164:                   <p>For the linking of the library, remove any
                   9165:                   &#8220;<span class="quote">ar</span>&#8221;,
                   9166:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   9167:                   and &#8220;<span class="quote">ld
                   9168:                   -Bshareable</span>&#8221; commands, and instead
                   9169:                   use:</p>
                   9170:                   <pre class="programlisting">
                   9171: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   9172: </pre>
                   9173: 
                   9174:                   <p>Note that the library is changed to have a
1.14      xtraeme  9175:                   <code class="filename">.la</code> extension, and
                   9176:                   the objects are changed to have a <code class=
                   9177:                   "filename">.lo</code> extension. Change
                   9178:                   <code class="varname">OBJS</code> as necessary.
                   9179:                   This automatically creates all of the
                   9180:                   <code class="filename">.a</code>, <code class=
                   9181:                   "filename">.so.major.minor</code>, and ELF
                   9182:                   symlinks (if necessary) in the build directory.
                   9183:                   Be sure to include &#8220;<span class=
1.1       grant    9184:                   "quote">-version-info</span>&#8221;, especially
                   9185:                   when major and minor are zero, as libtool will
                   9186:                   otherwise strip off the shared library
                   9187:                   version.</p>
                   9188: 
                   9189:                   <p>From the libtool manual:</p>
                   9190:                   <pre class="programlisting">
                   9191:      So, libtool library versions are described by three integers:
                   9192: 
                   9193: CURRENT
                   9194:        The most recent interface number that this library implements.
                   9195: 
                   9196: REVISION
                   9197:        The implementation number of the CURRENT interface.
                   9198: 
                   9199: AGE
                   9200:        The difference between the newest and oldest interfaces that this
                   9201:        library implements.  In other words, the library implements all the
                   9202:        interface numbers in the range from number `CURRENT - AGE' to
                   9203:        `CURRENT'.
                   9204:        
                   9205:      If two libraries have identical CURRENT and AGE numbers, then the
                   9206: dynamic linker chooses the library with the greater REVISION number. 
                   9207: </pre>
                   9208: 
                   9209:                   <p>The &#8220;<span class=
                   9210:                   "quote">-release</span>&#8221; option will
                   9211:                   produce different results for a.out and ELF
                   9212:                   (excluding symlinks) in only one case. An ELF
                   9213:                   library of the form &#8220;<span class=
                   9214:                   "quote">libfoo-release.so.<span class=
                   9215:                   "emphasis"><em>x</em></span>.<span class=
                   9216:                   "emphasis"><em>y</em></span></span>&#8221; will
                   9217:                   have a symlink of &#8220;<span class=
                   9218:                   "quote">libfoo.so.<span class=
                   9219:                   "emphasis"><em>x</em></span>.<span class=
                   9220:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   9221:                   a.out platform. This is handled
                   9222:                   automatically.</p>
                   9223: 
                   9224:                   <p>The &#8220;<span class="quote">-rpath
                   9225:                   argument</span>&#8221; is the install directory
                   9226:                   of the library being built.</p>
                   9227: 
1.14      xtraeme  9228:                   <p>In the <code class="filename">PLIST</code>,
1.19      hubertf  9229:                   include only the <code class=
                   9230:                   "filename">.la</code> file, the other files will
                   9231:                   be added automatically.</p>
1.1       grant    9232:                 </li>
                   9233: 
                   9234:                 <li>
1.14      xtraeme  9235:                   <p>When linking shared object (<code class=
                   9236:                   "filename">.so</code>) files, i.e. files that are
1.24    ! wiz      9237:                   loaded via <a href=
        !          9238:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
        !          9239:                   <span class="citerefentry"><span class=
        !          9240:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
        !          9241:                   shared libraries, use &#8220;<span class=
        !          9242:                   "quote">-module -avoid-version</span>&#8221; to
        !          9243:                   prevent them getting version tacked on.</p>
1.1       grant    9244: 
1.14      xtraeme  9245:                   <p>The <code class="filename">PLIST</code> file
                   9246:                   gets the <code class="filename">foo.so</code>
                   9247:                   entry.</p>
1.1       grant    9248:                 </li>
                   9249: 
                   9250:                 <li>
                   9251:                   <p>When linking programs that depend on these
                   9252:                   libraries <span class=
                   9253:                   "emphasis"><em>before</em></span> they are
                   9254:                   installed, preface the <a href=
                   9255:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   9256:                   <span class="citerefentry"><span class=
                   9257:                   "refentrytitle">cc</span>(1)</span></a> or
                   9258:                   <a href=
                   9259:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   9260:                   <span class="citerefentry"><span class=
                   9261:                   "refentrytitle">ld</span>(1)</span></a> line with
                   9262:                   &#8220;<span class="quote">${LIBTOOL}
                   9263:                   --mode=link</span>&#8221;, and it will find the
                   9264:                   correct libraries (static or shared), but please
                   9265:                   be aware that libtool will not allow you to
                   9266:                   specify a relative path in -L (such as
                   9267:                   &#8220;<span class=
                   9268:                   "quote">-L../somelib</span>&#8221;), because it
                   9269:                   expects you to change that argument to be the
1.14      xtraeme  9270:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    9271:                   <pre class="programlisting">
                   9272: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   9273: </pre>
                   9274: 
                   9275:                   <p>should be changed to:</p>
                   9276:                   <pre class="programlisting">
1.14      xtraeme  9277: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   9278: "replaceable"><code>someprog</code></em> <em class=
                   9279: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    9280: </pre>
                   9281: 
                   9282:                   <p>and it will do the right thing with the
                   9283:                   libraries.</p>
                   9284:                 </li>
                   9285: 
                   9286:                 <li>
                   9287:                   <p>When installing libraries, preface the
                   9288:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   9289:                   <span class="citerefentry"><span class=
                   9290:                   "refentrytitle">install</span>(1)</span></a> or
                   9291:                   <a href=
                   9292:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   9293:                   <span class="citerefentry"><span class=
                   9294:                   "refentrytitle">cp</span>(1)</span></a> command
                   9295:                   with &#8220;<span class="quote">${LIBTOOL}
                   9296:                   --mode=install</span>&#8221;, and change the
1.14      xtraeme  9297:                   library name to <code class=
                   9298:                   "filename">.la</code>. e.g.</p>
1.1       grant    9299:                   <pre class="programlisting">
                   9300: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   9301: </pre>
                   9302: 
1.14      xtraeme  9303:                   <p>This will install the static <code class=
                   9304:                   "filename">.a</code>, shared library, any needed
1.1       grant    9305:                   symlinks, and run <a href=
                   9306:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   9307:                   <span class="citerefentry"><span class=
                   9308:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   9309:                 </li>
                   9310: 
                   9311:                 <li>
1.14      xtraeme  9312:                   <p>In your <code class="filename">PLIST</code>,
1.23      wiz      9313:                   include only the <code class=
                   9314:                   "filename">.la</code> file (this is a change from
                   9315:                   previous behaviour).</p>
1.1       grant    9316:                 </li>
                   9317:               </ol>
                   9318:             </div>
                   9319:           </div>
                   9320: 
                   9321:           <div class="sect2" lang="en" xml:lang="en">
                   9322:             <div class="titlepage">
                   9323:               <div>
                   9324:                 <div>
1.24    ! wiz      9325:                   <h3 class="title"><a name="id2633640" id=
        !          9326:                   "id2633640"></a>12.3.2.&nbsp;Using libtool on GNU
1.1       grant    9327:                   packages that already support libtool</h3>
                   9328:                 </div>
                   9329:               </div>
                   9330:             </div>
                   9331: 
1.14      xtraeme  9332:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   9333:             the package Makefile. This will override the package's
                   9334:             own libtool in most cases. For older libtool using
1.1       grant    9335:             packages, libtool is made by ltconfig script during the
                   9336:             do-configure step; you can check the libtool script
1.14      xtraeme  9337:             location by doing <span><strong class="command">make
                   9338:             configure; find work*/ -name
                   9339:             libtool</strong></span>.</p>
                   9340: 
                   9341:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   9342:             specifies which libtool scripts, relative to
                   9343:             <code class="varname">WRKSRC</code>, to override. By
                   9344:             default, it is set to &#8220;<span class=
                   9345:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   9346:             this does not match the location of the package's
                   9347:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  9348: 
1.14      xtraeme  9349:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    9350:             static libraries built and installed, then use
1.14      xtraeme  9351:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    9352:             instead.</p>
                   9353: 
                   9354:             <p>If your package makes use of the platform
                   9355:             independent library for loading dynamic shared objects,
                   9356:             that comes with libtool (libltdl), you should include
1.22      tv       9357:             devel/libltdl/buildlink3.mk.</p>
1.1       grant    9358: 
                   9359:             <p>Some packages use libtool incorrectly so that the
                   9360:             package may not work or build in some circumstances.
                   9361:             Some of the more common errors are:</p>
                   9362: 
                   9363:             <div class="itemizedlist">
                   9364:               <ul type="disc">
                   9365:                 <li>
                   9366:                   <p>The inclusion of a shared object (-module) as
                   9367:                   a dependent library in an executable or library.
                   9368:                   This in itself isn't a problem if one of two
                   9369:                   things has been done:</p>
                   9370: 
                   9371:                   <div class="orderedlist">
                   9372:                     <ol type="1">
                   9373:                       <li>
                   9374:                         <p>The shared object is named correctly,
1.14      xtraeme  9375:                         i.e. <code class=
                   9376:                         "filename">libfoo.la</code>, not
                   9377:                         <code class="filename">foo.la</code></p>
1.1       grant    9378:                       </li>
                   9379: 
                   9380:                       <li>
                   9381:                         <p>The -dlopen option is used when linking
                   9382:                         an executable.</p>
                   9383:                       </li>
                   9384:                     </ol>
                   9385:                   </div>
                   9386:                 </li>
                   9387: 
                   9388:                 <li>
                   9389:                   <p>The use of libltdl without the correct calls
                   9390:                   to initialisation routines. The function
                   9391:                   lt_dlinit() should be called and the macro
1.14      xtraeme  9392:                   <code class=
                   9393:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    9394:                   included in executables.</p>
                   9395:                 </li>
                   9396:               </ul>
                   9397:             </div>
                   9398:           </div>
                   9399: 
                   9400:           <div class="sect2" lang="en" xml:lang="en">
                   9401:             <div class="titlepage">
                   9402:               <div>
                   9403:                 <div>
1.24    ! wiz      9404:                   <h3 class="title"><a name="id2633721" id=
        !          9405:                   "id2633721"></a>12.3.3.&nbsp;GNU
1.1       grant    9406:                   Autoconf/Automake</h3>
                   9407:                 </div>
                   9408:               </div>
                   9409:             </div>
                   9410: 
                   9411:             <p>If a package needs GNU autoconf or automake to be
                   9412:             executed to regenerate the configure script and
                   9413:             Makefile.in makefile templates, then they should be
                   9414:             executed in a pre-configure target. Two Makefile
1.14      xtraeme  9415:             fragments are provided in <code class=
                   9416:             "filename">pkgsrc/mk/autoconf.mk</code> and
                   9417:             <code class="filename">pkgsrc/mk/automake.mk</code> to
                   9418:             help dealing with these tools. See comments in these
                   9419:             files for details.</p>
1.1       grant    9420: 
                   9421:             <p>For packages that need only autoconf:</p>
                   9422:             <pre class="programlisting">
                   9423: AUTOCONF_REQD=    2.50    # if default version is not good enough
                   9424: ...
                   9425: 
                   9426: pre-configure:
                   9427:           cd ${WRKSRC}; ${AUTOCONF}
                   9428: 
                   9429: ...
                   9430: .include "../../mk/autoconf.mk"
                   9431: </pre>
                   9432: 
                   9433:             <p>and for packages that need automake and
                   9434:             autoconf:</p>
                   9435:             <pre class="programlisting">
                   9436: AUTOMAKE_REQD=  1.7.1   # if default version is not good enough
                   9437: ...
                   9438: 
                   9439: pre-configure:
                   9440:           cd ${WRKSRC};                                           \
                   9441:           ${ACLOCAL};                                             \
                   9442:           ${AUTOHEADER};                                          \
                   9443:           ${AUTOMAKE} -a --foreign -i;                            \
                   9444:           ${AUTOCONF}
                   9445: 
                   9446: ...
                   9447: .include "../mk/automake.mk"
                   9448: </pre>
                   9449: 
                   9450:             <p>Packages which use GNU Automake will almost
                   9451:             certainly require GNU Make, but that's automatically
1.14      xtraeme  9452:             provided for you in <code class=
                   9453:             "filename">mk/automake.mk</code>.</p>
1.1       grant    9454: 
                   9455:             <p>There are times when the configure process makes
                   9456:             additional changes to the generated files, which then
                   9457:             causes the build process to try to re-execute the
                   9458:             automake sequence. This is prevented by touching
                   9459:             various files in the configure stage. If this causes
1.14      xtraeme  9460:             problems with your package you can set <code class=
                   9461:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    9462:             Makefile.</p>
                   9463:           </div>
                   9464:         </div>
                   9465: 
                   9466:         <div class="sect1" lang="en" xml:lang="en">
                   9467:           <div class="titlepage">
                   9468:             <div>
                   9469:               <div>
                   9470:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      9471:                 "id2633834" id="id2633834"></a>12.4.&nbsp;Building
1.1       grant    9472:                 considerations</h2>
                   9473:               </div>
                   9474:             </div>
                   9475:           </div>
                   9476: 
                   9477:           <div class="sect2" lang="en" xml:lang="en">
                   9478:             <div class="titlepage">
                   9479:               <div>
                   9480:                 <div>
1.24    ! wiz      9481:                   <h3 class="title"><a name="id2633837" id=
        !          9482:                   "id2633837"></a>12.4.1.&nbsp;CPP defines</h3>
1.1       grant    9483:                 </div>
                   9484:               </div>
                   9485:             </div>
                   9486: 
                   9487:             <p>To port an application to NetBSD, it's usually
                   9488:             necessary for the compiler to be able to judge the
                   9489:             system on which it's compiling, and we use definitions
                   9490:             so that the C pre-processor can do this.</p>
                   9491: 
                   9492:             <p>To test whether you are working on a 4.4 BSD-derived
                   9493:             system, you should use the BSD definition, which is
1.14      xtraeme  9494:             defined in <code class=
                   9495:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    9496:             systems.</p>
                   9497:             <pre class="programlisting">
                   9498: #include &lt;sys/param.h&gt;
                   9499: </pre>
                   9500: 
                   9501:             <p>and then you can surround the BSD-specific parts of
                   9502:             your package's C/C++ code using this conditional:</p>
                   9503:             <pre class="programlisting">
                   9504: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   9505:     ...
                   9506: #endif
                   9507: </pre>
                   9508: 
                   9509:             <p>Please use the &#8220;<span class=
                   9510:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   9511:             it should only apply to features of NetBSD that are not
                   9512:             present in other 4.4-lite derived BSDs.</p>
                   9513:           </div>
                   9514:         </div>
                   9515: 
                   9516:         <div class="sect1" lang="en" xml:lang="en">
                   9517:           <div class="titlepage">
                   9518:             <div>
                   9519:               <div>
                   9520:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      9521:                 "id2633867" id="id2633867"></a>12.5.&nbsp;Package
1.1       grant    9522:                 specific actions</h2>
                   9523:               </div>
                   9524:             </div>
                   9525:           </div>
                   9526: 
                   9527:           <div class="sect2" lang="en" xml:lang="en">
                   9528:             <div class="titlepage">
                   9529:               <div>
                   9530:                 <div>
1.24    ! wiz      9531:                   <h3 class="title"><a name="id2633870" id=
        !          9532:                   "id2633870"></a>12.5.1.&nbsp;Package
1.1       grant    9533:                   configuration files</h3>
                   9534:                 </div>
                   9535:               </div>
                   9536:             </div>
                   9537: 
                   9538:             <p>Packages should be taught to look for their
1.14      xtraeme  9539:             configuration files in <code class=
                   9540:             "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1       grant    9541:             through to the configure and build processes.
1.14      xtraeme  9542:             <code class="varname">PKG_SYSCONFDIR</code> may be
1.1       grant    9543:             customized in various ways by setting other make
                   9544:             variables:</p>
                   9545: 
                   9546:             <div class="itemizedlist">
                   9547:               <ul type="disc">
                   9548:                 <li>
1.14      xtraeme  9549:                   <p><code class="varname">PKG_SYSCONFBASE</code>
                   9550:                   is the main config directory under which all
                   9551:                   package configuration files are to be found. This
                   9552:                   defaults to <code class=
                   9553:                   "filename">${PREFIX}/etc</code>, but may be
                   9554:                   overridden in <code class=
                   9555:                   "filename">/etc/mk.conf</code>.</p>
1.1       grant    9556:                 </li>
                   9557: 
                   9558:                 <li>
1.14      xtraeme  9559:                   <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   9560:                   is the subdirectory of <code class=
                   9561:                   "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    9562:                   configuration files for a particular package may
                   9563:                   be found, e.g. the Apache configuration files may
1.14      xtraeme  9564:                   all be found under the <code class=
                   9565:                   "filename">httpd/</code> subdirectory of
                   9566:                   <code class="varname">${PKG_SYSCONFBASE}</code>.
                   9567:                   This should be set in the package Makefile.</p>
1.1       grant    9568:                 </li>
                   9569: 
                   9570:                 <li>
1.14      xtraeme  9571:                   <p>By default, <code class=
                   9572:                   "varname">PKG_SYSCONFDIR</code> is set to
                   9573:                   <code class=
                   9574:                   "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
                   9575:                   but this may be overridden by setting
                   9576:                   <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9577:                   for a particular package, where <code class=
                   9578:                   "varname">PKG_SYSCONFVAR</code> defaults to
                   9579:                   <code class="varname">${PKGBASE}</code>. This is
                   9580:                   not meant to be set by a package Makefile, but is
1.1       grant    9581:                   reserved for users who wish to override the
1.14      xtraeme  9582:                   <code class="varname">PKG_SYSCONFDIR</code>
                   9583:                   setting for a particular package with a special
1.1       grant    9584:                   location.</p>
                   9585:                 </li>
                   9586:               </ul>
                   9587:             </div>
                   9588: 
                   9589:             <p>The only variables that users should customize are
1.14      xtraeme  9590:             <code class="varname">PKG_SYSCONFBASE</code> and
                   9591:             <code class=
                   9592:             "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
                   9593:             Users will typically want to set <code class=
                   9594:             "varname">PKG_SYSCONFBASE</code> to <code class=
                   9595:             "filename">/etc</code>, or to accept the default
                   9596:             location of <code class=
                   9597:             "filename">${PREFIX}/etc</code>.</p>
1.1       grant    9598:           </div>
                   9599: 
                   9600:           <div class="sect2" lang="en" xml:lang="en">
                   9601:             <div class="titlepage">
                   9602:               <div>
                   9603:                 <div>
1.24    ! wiz      9604:                   <h3 class="title"><a name="id2633973" id=
        !          9605:                   "id2633973"></a>12.5.2.&nbsp;User
1.2       hubertf  9606:                   interaction</h3>
1.1       grant    9607:                 </div>
                   9608:               </div>
                   9609:             </div>
                   9610: 
                   9611:             <p>Occasionally, packages require interaction from the
                   9612:             user, and this can be in a number of ways:</p>
                   9613: 
                   9614:             <div class="itemizedlist">
                   9615:               <ul type="disc">
                   9616:                 <li>
                   9617:                   <p>help in fetching the distfiles</p>
                   9618:                 </li>
                   9619: 
                   9620:                 <li>
                   9621:                   <p>help to configure the package before it is
                   9622:                   built</p>
                   9623:                 </li>
                   9624: 
                   9625:                 <li>
                   9626:                   <p>help during the build process</p>
                   9627:                 </li>
                   9628: 
                   9629:                 <li>
                   9630:                   <p>help during the installation of a package</p>
                   9631:                 </li>
                   9632:               </ul>
                   9633:             </div>
                   9634: 
1.14      xtraeme  9635:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    9636:             definition is provided to notify the pkgsrc mechanism
                   9637:             of an interactive stage which will be needed, and this
1.14      xtraeme  9638:             should be set in the package's <code class=
                   9639:             "filename">Makefile</code>. e.g.</p>
1.1       grant    9640:             <pre class="programlisting">
                   9641: INTERACTIVE_STAGE= build
                   9642: </pre>
                   9643: 
                   9644:             <p>Multiple interactive stages can be specified:</p>
                   9645:             <pre class="programlisting">
                   9646: INTERACTIVE_STAGE= configure install
                   9647: </pre>
                   9648:           </div>
                   9649: 
                   9650:           <div class="sect2" lang="en" xml:lang="en">
                   9651:             <div class="titlepage">
                   9652:               <div>
                   9653:                 <div>
1.24    ! wiz      9654:                   <h3 class="title"><a name="id2634018" id=
        !          9655:                   "id2634018"></a>12.5.3.&nbsp;Handling
1.1       grant    9656:                   licenses</h3>
                   9657:                 </div>
                   9658:               </div>
                   9659:             </div>
                   9660: 
                   9661:             <p>A package may underly a license which the user has
                   9662:             or has not agreed to accept. Usually, packages that
                   9663:             underly well-known Open Source licenses (e.g. the GNU
                   9664:             Public License, GPL) won't have any special license
                   9665:             tags added in pkgsrc which require special action by
                   9666:             the user of such packages, but there are quite a number
                   9667:             of other licenses out there that pkgsrc users may not
                   9668:             be able to follow, for whatever reasons. For these
                   9669:             cases, pkgsrc contains a mechanism to note that a
                   9670:             package underlies a certain license, and the user has
                   9671:             to accept the license before the package can be
                   9672:             installed.</p>
                   9673: 
                   9674:             <p>Placing a certain package under a certain license
1.14      xtraeme  9675:             works by setting the <code class=
                   9676:             "varname">LICENSE</code> variable to a string
                   9677:             identifying the license, e.g. in <a xmlns=
                   9678:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9679:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20      ben      9680:             class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    9681:             <pre class="programlisting">
                   9682: LICENSE=        graphviz-license
                   9683: </pre>
                   9684: 
                   9685:             <p>When trying to build, the user will get a notice
                   9686:             that the package underlies a license which he hasn't
                   9687:             accepted (yet):</p>
                   9688:             <pre class="programlisting">
1.14      xtraeme  9689: <code class="prompt">%</code> <strong class=
                   9690: "userinput"><code>make</code></strong>
1.1       grant    9691: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   9692: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   9693: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   9694: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   9695: *** Error code 1
                   9696: </pre>
                   9697: 
1.14      xtraeme  9698:             <p>The license can be viewed with <span><strong class=
                   9699:             "command">make show-license</strong></span>, and if it
                   9700:             is considered appropriate, the line printed above can
                   9701:             be added to <code class="filename">/etc/mk.conf</code>
                   9702:             to indicate acceptance of the particular license:</p>
1.1       grant    9703:             <pre class="programlisting">
                   9704: ACCEPTABLE_LICENSES+=graphviz-license
                   9705: </pre>
                   9706: 
                   9707:             <p>When adding a package with a new license, the
1.14      xtraeme  9708:             license text should be added to <code class=
                   9709:             "filename">pkgsrc/licenses</code> for displaying. A
                   9710:             list of known licenses can be seen in this directory as
                   9711:             well as by looking at the list of (commented out)
                   9712:             <code class="varname">ACCEPTABLE_LICENSES</code>
                   9713:             variable settings in <code class=
                   9714:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    9715: 
1.17      sketch   9716:             <p>If there is a <span class=
1.1       grant    9717:             "emphasis"><em>really</em></span> pressing need to
                   9718:             accept all licenses at once, like when trying to
                   9719:             download or mirror all distfiles or doing a bulk build
                   9720:             to test if all packages in pkgsrc build, this can be
1.14      xtraeme  9721:             done by setting <code class=
                   9722:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    9723:           </div>
                   9724: 
                   9725:           <div class="sect2" lang="en" xml:lang="en">
                   9726:             <div class="titlepage">
                   9727:               <div>
                   9728:                 <div>
1.24    ! wiz      9729:                   <h3 class="title"><a name="id2634169" id=
        !          9730:                   "id2634169"></a>12.5.4.&nbsp;Creating an account
1.1       grant    9731:                   from a package</h3>
                   9732:                 </div>
                   9733:               </div>
                   9734:             </div>
                   9735: 
                   9736:             <p>There are two make variables used to control the
                   9737:             creation of package-specific groups and users at
1.14      xtraeme  9738:             pre-install time. The first is <code class=
                   9739:             "varname">PKG_GROUPS</code>, which is a list of
1.1       grant    9740:             group[:groupid] elements, where the groupid is
1.14      xtraeme  9741:             optional. The second is <code class=
                   9742:             "varname">PKG_USERS</code>, which is a list of elements
1.1       grant    9743:             of the form:</p>
                   9744:             <pre class="programlisting">
                   9745: user:group[:[userid][:[description][:[home][:shell]]]]
                   9746: </pre>
                   9747: 
                   9748:             <p>where only the user and group are required, the rest
                   9749:             being optional. A simple example is:</p>
                   9750:             <pre class="programlisting">
                   9751:   PKG_GROUPS=       foogroup
                   9752:     PKG_USERS=    foouser:foogroup
                   9753: </pre>
                   9754: 
                   9755:             <p>A more complex example is that creates two groups
                   9756:             and two users is:</p>
                   9757:             <pre class="programlisting">
                   9758:   PKG_GROUPS=       group1 group2:1005
                   9759:     PKG_USERS=    first:group1::First\\ User                      \
                   9760:                   second:group2::Second\\ User:/home/second:${SH}
                   9761: </pre>
                   9762: 
                   9763:             <p>By default, a new user will have home directory
1.14      xtraeme  9764:             <code class="filename">/nonexistent</code>, and login
                   9765:             shell <code class="filename">/sbin/nologin</code>
                   9766:             unless they are specified as part of the user
                   9767:             element.</p>
1.1       grant    9768: 
1.14      xtraeme  9769:             <p>The package <code class="filename">Makefile</code>
                   9770:             must also set <code class=
                   9771:             "varname">USE_PKGINSTALL=YES</code>. This will cause
                   9772:             the users and groups to be created at pre-install time,
                   9773:             and the admin will be prompted to remove them at
                   9774:             post-deinstall time. Automatic creation of the users
                   9775:             and groups can be toggled on and off by setting the
                   9776:             <code class="varname">PKG_CREATE_USERGROUP</code>
                   9777:             variable prior to package installation.</p>
1.1       grant    9778:           </div>
                   9779: 
                   9780:           <div class="sect2" lang="en" xml:lang="en">
                   9781:             <div class="titlepage">
                   9782:               <div>
                   9783:                 <div>
1.24    ! wiz      9784:                   <h3 class="title"><a name="id2634231" id=
        !          9785:                   "id2634231"></a>12.5.5.&nbsp;Installing score
1.1       grant    9786:                   files</h3>
                   9787:                 </div>
                   9788:               </div>
                   9789:             </div>
                   9790: 
                   9791:             <p>Certain packages, most of them in the games
                   9792:             category, install a score file that allows all users on
                   9793:             the system to record their highscores. In order for
                   9794:             this to work, the binaries need to be installed setgid
                   9795:             and the score files owned by the appropriate group
                   9796:             and/or owner (traditionally the "games" user/group).
                   9797:             The following variables, documented in more detail in
1.14      xtraeme  9798:             <code class="filename">mk/defaults/mk.conf</code>,
                   9799:             control this behaviour: <code class=
                   9800:             "varname">SETGIDGAME</code>, <code class=
                   9801:             "varname">GAMEDATAMODE</code>, <code class=
                   9802:             "varname">GAMEGRP</code>, <code class=
                   9803:             "varname">GAMEMODE</code>, <code class=
                   9804:             "varname">GAMEOWN</code>.</p>
1.1       grant    9805: 
                   9806:             <p>Note that per default, setgid installation of games
1.14      xtraeme  9807:             is disabled; setting <code class=
                   9808:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    9809:             variables accordingly.</p>
                   9810: 
                   9811:             <p>A package should therefor never hard code file
1.14      xtraeme  9812:             ownership or access permissions but rely on
                   9813:             <code class="varname">INSTALL_GAME</code> and
                   9814:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   9815:             these correctly.</p>
1.1       grant    9816:           </div>
                   9817: 
                   9818:           <div class="sect2" lang="en" xml:lang="en">
                   9819:             <div class="titlepage">
                   9820:               <div>
                   9821:                 <div>
1.24    ! wiz      9822:                   <h3 class="title"><a name="id2634411" id=
        !          9823:                   "id2634411"></a>12.5.6.&nbsp;Packages providing
1.1       grant    9824:                   login shells</h3>
                   9825:                 </div>
                   9826:               </div>
                   9827:             </div>
                   9828: 
                   9829:             <p>If the purpose of the package is to provide a login
1.14      xtraeme  9830:             shell, the variable <code class=
                   9831:             "varname">PKG_SHELL</code> should contain the full
                   9832:             pathname of the shell executable installed by this
                   9833:             package. The package <code class=
                   9834:             "filename">Makefile</code> must also set <code class=
                   9835:             "varname">USE_PKGINSTALL=YES</code> to use the
                   9836:             automatically generated <code class=
                   9837:             "filename">INSTALL</code>/<code class=
                   9838:             "filename">DEINSTALL</code> scripts.</p>
1.1       grant    9839: 
                   9840:             <p>An example taken from shells/zsh:</p>
                   9841:             <pre class="programlisting">
                   9842:   USE_PKGINSTALL=   YES
                   9843:     PKG_SHELL=    ${PREFIX}/bin/zsh
                   9844: </pre>
                   9845: 
1.14      xtraeme  9846:             <p>The shell is registered into <code class=
                   9847:             "filename">/etc/shells</code> file automatically in the
                   9848:             post-install target by the generated <code class=
                   9849:             "filename">INSTALL</code> script and removed in the
                   9850:             deinstall target by the <code class=
                   9851:             "filename">DEINSTALL</code> script.</p>
1.1       grant    9852:           </div>
                   9853: 
                   9854:           <div class="sect2" lang="en" xml:lang="en">
                   9855:             <div class="titlepage">
                   9856:               <div>
                   9857:                 <div>
1.24    ! wiz      9858:                   <h3 class="title"><a name="id2634469" id=
        !          9859:                   "id2634469"></a>12.5.7.&nbsp;Packages containing
1.1       grant    9860:                   perl scripts</h3>
                   9861:                 </div>
                   9862:               </div>
                   9863:             </div>
                   9864: 
                   9865:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  9866:             set <code class="varname">REPLACE_PERL</code> to ensure
                   9867:             that the proper interpreter path is set. <code class=
                   9868:             "varname">REPLACE_PERL</code> should contain a list of
                   9869:             scripts, relative to <code class=
                   9870:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    9871:           </div>
                   9872: 
                   9873:           <div class="sect2" lang="en" xml:lang="en">
                   9874:             <div class="titlepage">
                   9875:               <div>
                   9876:                 <div>
1.24    ! wiz      9877:                   <h3 class="title"><a name="id2634555" id=
        !          9878:                   "id2634555"></a>12.5.8.&nbsp;Packages with
1.1       grant    9879:                   hardcoded paths to other interpreters</h3>
                   9880:                 </div>
                   9881:               </div>
                   9882:             </div>
                   9883: 
                   9884:             <p>Your package may also contain scripts with hardcoded
                   9885:             paths to other interpreters besides (or as well as)
                   9886:             perl. To correct the full pathname to the script
                   9887:             interpreter, you need to set the following definitions
1.14      xtraeme  9888:             in your <code class="filename">Makefile</code> (we
                   9889:             shall use <span><strong class=
                   9890:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    9891:             <pre class="programlisting">
                   9892:   REPLACE_INTERPRETER+=     tcl
                   9893:     _REPLACE.tcl.old=     .*/bin/tclsh
                   9894:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   9895:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   9896:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   9897: </pre>
                   9898:           </div>
                   9899: 
                   9900:           <div class="sect2" lang="en" xml:lang="en">
                   9901:             <div class="titlepage">
                   9902:               <div>
                   9903:                 <div>
1.24    ! wiz      9904:                   <h3 class="title"><a name="id2634577" id=
        !          9905:                   "id2634577"></a>12.5.9.&nbsp;Packages installing
1.1       grant    9906:                   perl modules</h3>
                   9907:                 </div>
                   9908:               </div>
                   9909:             </div>
                   9910: 
                   9911:             <p>Makefiles of packages providing perl5 modules should
1.14      xtraeme  9912:             include the Makefile fragment <code class=
                   9913:             "filename">../../lang/perl5/module.mk</code>. It
                   9914:             provides a <span><strong class=
                   9915:             "command">do-configure</strong></span> target for the
                   9916:             standard perl configuration for such modules as well as
                   9917:             various hooks to tune this configuration. See comments
                   9918:             in this file for details.</p>
1.1       grant    9919: 
                   9920:             <p>Perl5 modules will install into different places
                   9921:             depending on the version of perl used during the build
                   9922:             process. To address this, pkgsrc will append lines to
1.14      xtraeme  9923:             the <code class="filename">PLIST</code> corresponding
                   9924:             to the files listed in the installed <code class=
                   9925:             "filename">.packlist</code> file generated by most
                   9926:             perl5 modules. This is invoked by defining <code class=
                   9927:             "varname">PERL5_PACKLIST</code> to a space-separated
                   9928:             list of paths to packlist files, e.g.:</p>
1.1       grant    9929:             <pre class="programlisting">
                   9930: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   9931: </pre>
                   9932: 
1.14      xtraeme  9933:             <p>The variables <code class=
                   9934:             "varname">PERL5_SITELIB</code>, <code class=
                   9935:             "varname">PERL5_SITEARCH</code>, and <code class=
                   9936:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    9937:             locations in which perl5 modules may be installed, and
                   9938:             may be used by perl5 packages that don't have a
                   9939:             packlist. These three variables are also substituted
1.14      xtraeme  9940:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    9941:           </div>
                   9942: 
                   9943:           <div class="sect2" lang="en" xml:lang="en">
                   9944:             <div class="titlepage">
                   9945:               <div>
                   9946:                 <div>
                   9947:                   <h3 class="title"><a name="faq.info-files" id=
                   9948:                   "faq.info-files"></a>12.5.10.&nbsp;Packages
                   9949:                   installing info files</h3>
                   9950:                 </div>
                   9951:               </div>
                   9952:             </div>
                   9953: 
                   9954:             <p>Some packages install info files or use the
                   9955:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   9956:             &#8220;<span class="quote">install-info</span>&#8221;
                   9957:             commands. Each of the info files:</p>
                   9958: 
                   9959:             <div class="itemizedlist">
                   9960:               <ul type="disc">
                   9961:                 <li>
                   9962:                   <p>is considered to be installed in the directory
1.14      xtraeme  9963:                   <code class=
                   9964:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    9965:                 </li>
                   9966: 
                   9967:                 <li>
                   9968:                   <p>is registered in the Info directory file
1.14      xtraeme  9969:                   <code class=
                   9970:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    9971:                 </li>
                   9972: 
                   9973:                 <li>
                   9974:                   <p>and must be listed as a filename in the
1.14      xtraeme  9975:                   <code class="varname">INFO_FILES</code> variable
                   9976:                   in the package Makefile.</p>
1.1       grant    9977:                 </li>
                   9978:               </ul>
                   9979:             </div>
                   9980: 
1.14      xtraeme  9981:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    9982:             &#8220;<span class="quote">info</span>&#8221; and can
1.14      xtraeme  9983:             be overridden in the package Makefile. <code class=
                   9984:             "filename">INSTALL</code> and <code class=
                   9985:             "filename">DEINSTALL</code> scripts will be generated
                   9986:             to handle registration of the info files in the Info
1.1       grant    9987:             directory file. The &#8220;<span class=
                   9988:             "quote">install-info</span>&#8221; command used for the
                   9989:             info files registration is either provided by the
                   9990:             system, or by a special purpose package automatically
                   9991:             added as dependency if needed.</p>
                   9992: 
                   9993:             <p>A package which needs the &#8220;<span class=
                   9994:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  9995:             must define the variable <code class=
                   9996:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    9997:             minimum version of the &#8220;<span class=
                   9998:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  9999:             should be noted with the <code class=
                   10000:             "varname">TEXINFO_REQD</code> variable in the package
                   10001:             <code class="filename">Makefile</code>. By default, a
1.1       grant    10002:             minimum version of 3.12 is required. If the system does
1.14      xtraeme  10003:             not provide a <span><strong class=
                   10004:             "command">makeinfo</strong></span> command or if it
                   10005:             does not match the required minimum, a build dependency
                   10006:             on the <a xmlns=
                   10007:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10008:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20      ben      10009:             class="pkgname">devel/gtexinfo</a> package will be
                   10010:             added automatically.</p>
1.1       grant    10011: 
                   10012:             <p>The build and installation process of the software
                   10013:             provided by the package should not use the
1.14      xtraeme  10014:             <span><strong class=
                   10015:             "command">install-info</strong></span> command as the
                   10016:             registration of info files is the task of the package
                   10017:             <code class="filename">INSTALL</code> script, and it
                   10018:             must use the appropriate <span><strong class=
                   10019:             "command">makeinfo</strong></span> command.</p>
1.1       grant    10020: 
                   10021:             <p>To achieve this goal the pkgsrc infrastructure
1.14      xtraeme  10022:             creates overriding scripts for the <span><strong class=
                   10023:             "command">install-info</strong></span> and
                   10024:             <span><strong class="command">makeinfo</strong></span>
                   10025:             commands in a directory listed early in <code class=
                   10026:             "varname">PATH</code>.</p>
1.1       grant    10027: 
1.14      xtraeme  10028:             <p>The script overriding <span><strong class=
                   10029:             "command">install-info</strong></span> has no effect
                   10030:             except the logging of a message. The script overriding
                   10031:             <span><strong class="command">makeinfo</strong></span>
                   10032:             logs a message and according to the value of
                   10033:             <code class="varname">USE_MAKEINFO</code> and
                   10034:             <code class="varname">TEXINFO_REQD</code> either run
                   10035:             the appropriate <span><strong class=
                   10036:             "command">makeinfo</strong></span> command or exit on
                   10037:             error.</p>
1.1       grant    10038:           </div>
                   10039: 
                   10040:           <div class="sect2" lang="en" xml:lang="en">
                   10041:             <div class="titlepage">
                   10042:               <div>
                   10043:                 <div>
1.24    ! wiz      10044:                   <h3 class="title"><a name="id2634865" id=
        !          10045:                   "id2634865"></a>12.5.11.&nbsp;Packages installing
1.1       grant    10046:                   GConf2 data files</h3>
                   10047:                 </div>
                   10048:               </div>
                   10049:             </div>
                   10050: 
1.14      xtraeme  10051:             <p>If a package installs <code class=
                   10052:             "filename">.schemas</code> or <code class=
                   10053:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    10054:             need to take some extra steps to make sure they get
                   10055:             registered in the database:</p>
                   10056: 
                   10057:             <div class="orderedlist">
                   10058:               <ol type="1">
                   10059:                 <li>
1.14      xtraeme  10060:                   <p>Include <code class=
                   10061:                   "filename">../../devel/GConf2/schemas.mk</code>
                   10062:                   instead of its <code class=
                   10063:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    10064:                   care of rebuilding the GConf2 database at
                   10065:                   installation and deinstallation time, and tells
                   10066:                   the package where to install GConf2 data files
                   10067:                   using some standard configure arguments. It also
                   10068:                   disallows any access to the database directly
                   10069:                   from the package.</p>
                   10070:                 </li>
                   10071: 
                   10072:                 <li>
                   10073:                   <p>Ensure that the package installs its
1.14      xtraeme  10074:                   <code class="filename">.schemas</code> files
                   10075:                   under <code class=
                   10076:                   "filename">${PREFIX}/share/gconf/schemas</code>.
                   10077:                   If they get installed under <code class=
                   10078:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    10079:                   manually patch the package.</p>
                   10080:                 </li>
                   10081: 
                   10082:                 <li>
                   10083:                   <p>Check the PLIST and remove any entries under
                   10084:                   the etc/gconf directory, as they will be handled
                   10085:                   automatically. See <a href="#faq.conf" title=
1.14      xtraeme  10086:                   "6.14.&nbsp;Configuration files handling and placement">
                   10087:                   Section&nbsp;6.14, &#8220;Configuration files
1.1       grant    10088:                   handling and placement&#8221;</a> for more
                   10089:                   information.</p>
                   10090:                 </li>
                   10091: 
                   10092:                 <li>
1.14      xtraeme  10093:                   <p>Define the <code class=
                   10094:                   "varname">GCONF2_SCHEMAS</code> variable in your
                   10095:                   <code class="filename">Makefile</code> with a
                   10096:                   list of all <code class=
                   10097:                   "filename">.schemas</code> files installed by the
                   10098:                   package, if any. Names must not contain any
                   10099:                   directories in them.</p>
1.1       grant    10100:                 </li>
                   10101: 
                   10102:                 <li>
1.14      xtraeme  10103:                   <p>Define the <code class=
                   10104:                   "varname">GCONF2_ENTRIES</code> variable in your
                   10105:                   <code class="filename">Makefile</code> with a
                   10106:                   list of all <code class=
                   10107:                   "filename">.entries</code> files installed by the
                   10108:                   package, if any. Names must not contain any
                   10109:                   directories in them.</p>
1.1       grant    10110:                 </li>
                   10111:               </ol>
                   10112:             </div>
                   10113:           </div>
                   10114: 
                   10115:           <div class="sect2" lang="en" xml:lang="en">
                   10116:             <div class="titlepage">
                   10117:               <div>
                   10118:                 <div>
1.24    ! wiz      10119:                   <h3 class="title"><a name="id2634965" id=
        !          10120:                   "id2634965"></a>12.5.12.&nbsp;Packages installing
1.1       grant    10121:                   scrollkeeper data files</h3>
                   10122:                 </div>
                   10123:               </div>
                   10124:             </div>
                   10125: 
1.14      xtraeme  10126:             <p>If a package installs <code class=
                   10127:             "filename">.omf</code> files, used by scrollkeeper, you
                   10128:             need to take some extra steps to make sure they get
                   10129:             registered in the database:</p>
1.1       grant    10130: 
                   10131:             <div class="orderedlist">
                   10132:               <ol type="1">
                   10133:                 <li>
1.14      xtraeme  10134:                   <p>Include <code class=
                   10135:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
                   10136:                   instead of its <code class=
                   10137:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    10138:                   care of rebuilding the scrollkeeper database at
                   10139:                   installation and deinstallation time, and
                   10140:                   disallows any access to it directly from the
                   10141:                   package.</p>
                   10142:                 </li>
                   10143: 
                   10144:                 <li>
                   10145:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10146:                   the <code class=
                   10147:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    10148:                   as they will be handled automatically.</p>
                   10149:                 </li>
                   10150: 
                   10151:                 <li>
1.14      xtraeme  10152:                   <p>Remove the <code class=
                   10153:                   "filename">share/omf</code> directory from the
                   10154:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    10155:                 </li>
                   10156:               </ol>
                   10157:             </div>
                   10158:           </div>
                   10159: 
                   10160:           <div class="sect2" lang="en" xml:lang="en">
                   10161:             <div class="titlepage">
                   10162:               <div>
                   10163:                 <div>
1.24    ! wiz      10164:                   <h3 class="title"><a name="id2635016" id=
        !          10165:                   "id2635016"></a>12.5.13.&nbsp;Packages installing
1.1       grant    10166:                   X11 fonts</h3>
                   10167:                 </div>
                   10168:               </div>
                   10169:             </div>
                   10170: 
                   10171:             <p>If a package installs font files, you will need to
                   10172:             rebuild the fonts database in the directory where they
                   10173:             get installed at installation and deinstallation time.
1.14      xtraeme  10174:             This can be automatically done by using <code class=
                   10175:             "filename">mk/fonts.mk</code>, which you need to
                   10176:             include in your <code class=
                   10177:             "filename">Makefile</code>.</p>
1.1       grant    10178: 
                   10179:             <p>When the file is included, you can list the
1.14      xtraeme  10180:             directories where fonts are installed in the
                   10181:             <code class="varname">FONTS_<em class=
                   10182:             "replaceable"><code>type</code></em>_DIRS</code>
                   10183:             variables, where <em class=
                   10184:             "replaceable"><code>type</code></em> can be one of
                   10185:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    10186:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   10187:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.14      xtraeme  10188:             sure that the database file <code class=
                   10189:             "filename">fonts.dir</code> is not listed in the
1.1       grant    10190:             PLIST.</p>
                   10191: 
                   10192:             <p>Note that you should not create new directories for
                   10193:             fonts; instead use the standard ones to avoid that the
                   10194:             user needs to manually configure his X server to find
                   10195:             them.</p>
                   10196:           </div>
                   10197: 
                   10198:           <div class="sect2" lang="en" xml:lang="en">
                   10199:             <div class="titlepage">
                   10200:               <div>
                   10201:                 <div>
1.24    ! wiz      10202:                   <h3 class="title"><a name="id2635063" id=
        !          10203:                   "id2635063"></a>12.5.14.&nbsp;Packages installing
1.1       grant    10204:                   GTK2 modules</h3>
                   10205:                 </div>
                   10206:               </div>
                   10207:             </div>
                   10208: 
                   10209:             <p>If a package installs gtk2 immodules or loaders, you
                   10210:             need to take some extra steps to get them registered in
                   10211:             the GTK2 database properly:</p>
                   10212: 
                   10213:             <div class="orderedlist">
                   10214:               <ol type="1">
                   10215:                 <li>
1.14      xtraeme  10216:                   <p>Include <code class=
                   10217:                   "filename">../../x11/gtk2/modules.mk</code>
                   10218:                   instead of its <code class=
                   10219:                   "filename">buildlink3.mk</code> file. This takes
                   10220:                   care of rebuilding the database at installation
                   10221:                   and deinstallation time.</p>
1.1       grant    10222:                 </li>
                   10223: 
                   10224:                 <li>
1.14      xtraeme  10225:                   <p>Set <code class=
                   10226:                   "varname">GTK2_IMMODULES=YES</code> if your
                   10227:                   package installs GTK2 immodules.</p>
1.1       grant    10228:                 </li>
                   10229: 
                   10230:                 <li>
1.14      xtraeme  10231:                   <p>Set <code class=
                   10232:                   "varname">GTK2_LOADERS=YES</code> if your package
                   10233:                   installs GTK2 loaders.</p>
1.1       grant    10234:                 </li>
                   10235: 
                   10236:                 <li>
                   10237:                   <p>Patch the package to not touch any of the gtk2
                   10238:                   databases directly. These are:</p>
                   10239: 
                   10240:                   <div class="itemizedlist">
                   10241:                     <ul type="disc">
                   10242:                       <li>
1.14      xtraeme  10243:                         <p><code class=
                   10244:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    10245:                       </li>
                   10246: 
                   10247:                       <li>
1.14      xtraeme  10248:                         <p><code class=
                   10249:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    10250:                       </li>
                   10251:                     </ul>
                   10252:                   </div>
                   10253:                 </li>
                   10254: 
                   10255:                 <li>
                   10256:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10257:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    10258:                   directory, as they will be handled
                   10259:                   automatically.</p>
                   10260:                 </li>
                   10261:               </ol>
                   10262:             </div>
                   10263:           </div>
                   10264: 
                   10265:           <div class="sect2" lang="en" xml:lang="en">
                   10266:             <div class="titlepage">
                   10267:               <div>
                   10268:                 <div>
1.24    ! wiz      10269:                   <h3 class="title"><a name="id2635201" id=
        !          10270:                   "id2635201"></a>12.5.15.&nbsp;Packages installing
1.1       grant    10271:                   SGML or XML data</h3>
                   10272:                 </div>
                   10273:               </div>
                   10274:             </div>
                   10275: 
                   10276:             <p>If a package installs SGML or XML data files that
                   10277:             need to be registered in system-wide catalogs (like
                   10278:             DTDs, sub-catalogs, etc.), you need to take some extra
                   10279:             steps:</p>
                   10280: 
                   10281:             <div class="orderedlist">
                   10282:               <ol type="1">
                   10283:                 <li>
1.14      xtraeme  10284:                   <p>Include <code class=
                   10285:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
                   10286:                   in your <code class="filename">Makefile</code>,
                   10287:                   which takes care of registering those files in
1.1       grant    10288:                   system-wide catalogs at installation and
                   10289:                   deinstallation time.</p>
                   10290:                 </li>
                   10291: 
                   10292:                 <li>
1.14      xtraeme  10293:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   10294:                   to the full path of any SGML catalogs installed
                   10295:                   by the package.</p>
1.1       grant    10296:                 </li>
                   10297: 
                   10298:                 <li>
1.14      xtraeme  10299:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   10300:                   to the full path of any XML catalogs installed by
1.1       grant    10301:                   the package.</p>
                   10302:                 </li>
                   10303: 
                   10304:                 <li>
1.14      xtraeme  10305:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   10306:                   to individual entries to be added to the SGML
1.1       grant    10307:                   catalog. These come in groups of three strings;
                   10308:                   see xmlcatmgr(1) for more information
                   10309:                   (specifically, arguments recognized by the 'add'
                   10310:                   action). Note that you will normally not use this
                   10311:                   variable.</p>
                   10312:                 </li>
                   10313: 
                   10314:                 <li>
1.14      xtraeme  10315:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   10316:                   to individual entries to be added to the XML
1.1       grant    10317:                   catalog. These come in groups of three strings;
                   10318:                   see xmlcatmgr(1) for more information
                   10319:                   (specifically, arguments recognized by the 'add'
                   10320:                   action). Note that you will normally not use this
                   10321:                   variable.</p>
                   10322:                 </li>
                   10323:               </ol>
                   10324:             </div>
                   10325:           </div>
                   10326: 
                   10327:           <div class="sect2" lang="en" xml:lang="en">
                   10328:             <div class="titlepage">
                   10329:               <div>
                   10330:                 <div>
1.24    ! wiz      10331:                   <h3 class="title"><a name="id2635253" id=
        !          10332:                   "id2635253"></a>12.5.16.&nbsp;Packages installing
1.1       grant    10333:                   extensions to the MIME database</h3>
                   10334:                 </div>
                   10335:               </div>
                   10336:             </div>
                   10337: 
                   10338:             <p>If a package provides extensions to the MIME
1.14      xtraeme  10339:             database by installing <code class=
                   10340:             "filename">.xml</code> files inside <code class=
                   10341:             "filename">${PREFIX}/share/mime/packages</code>, you
                   10342:             need to take some extra steps to ensure that the
                   10343:             database is kept consistent with respect to these new
                   10344:             files:</p>
1.1       grant    10345: 
                   10346:             <div class="orderedlist">
                   10347:               <ol type="1">
                   10348:                 <li>
1.14      xtraeme  10349:                   <p>Include <code class=
                   10350:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
                   10351:                   (avoid using the <code class=
                   10352:                   "filename">buildlink3.mk</code> file from this
                   10353:                   same directory, which is reserved for inclusion
                   10354:                   from other <code class=
                   10355:                   "filename">buildlink3.mk</code> files). It takes
                   10356:                   care of rebuilding the MIME database at
                   10357:                   installation and deinstallation time, and
                   10358:                   disallows any access to it directly from the
1.1       grant    10359:                   package.</p>
                   10360:                 </li>
                   10361: 
                   10362:                 <li>
                   10363:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10364:                   the <code class="filename">share/mime</code>
1.1       grant    10365:                   directory, <span class=
                   10366:                   "emphasis"><em>except</em></span> for files saved
1.14      xtraeme  10367:                   under <code class=
                   10368:                   "filename">share/mime/packages</code>. The former
1.1       grant    10369:                   are handled automatically by the
                   10370:                   update-mime-database program, but the later are
                   10371:                   package-dependent and must be removed by the
                   10372:                   package that installed them in the first
                   10373:                   place.</p>
                   10374:                 </li>
                   10375: 
                   10376:                 <li>
1.14      xtraeme  10377:                   <p>Remove any <code class=
                   10378:                   "filename">share/mime/*</code> directories from
                   10379:                   the PLIST. They will be handled by the
1.1       grant    10380:                   shared-mime-info package.</p>
                   10381:                 </li>
                   10382:               </ol>
                   10383:             </div>
                   10384:           </div>
                   10385: 
                   10386:           <div class="sect2" lang="en" xml:lang="en">
                   10387:             <div class="titlepage">
                   10388:               <div>
                   10389:                 <div>
1.24    ! wiz      10390:                   <h3 class="title"><a name="id2635323" id=
        !          10391:                   "id2635323"></a>12.5.17.&nbsp;Packages using
1.1       grant    10392:                   intltool</h3>
                   10393:                 </div>
                   10394:               </div>
                   10395:             </div>
                   10396: 
                   10397:             <p>If a package uses intltool during its build, include
1.14      xtraeme  10398:             the <code class=
                   10399:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    10400:             file, which forces it to use the intltool package
                   10401:             provided by pkgsrc, instead of the one bundled with the
                   10402:             distribution file.</p>
                   10403: 
                   10404:             <p>This tracks intltool's build-time dependencies and
                   10405:             uses the latest available version; this way, the
                   10406:             package benefits of any bug fixes that may have
                   10407:             appeared since it was released.</p>
                   10408:           </div>
1.18      xtraeme  10409: 
                   10410:           <div class="sect2" lang="en" xml:lang="en">
                   10411:             <div class="titlepage">
                   10412:               <div>
                   10413:                 <div>
1.24    ! wiz      10414:                   <h3 class="title"><a name="id2635337" id=
        !          10415:                   "id2635337"></a>12.5.18.&nbsp;Packages installing
1.18      xtraeme  10416:                   startup scripts</h3>
                   10417:                 </div>
                   10418:               </div>
                   10419:             </div>
                   10420: 
                   10421:             <p>If a package contains a rc.d script, it won't be
                   10422:             copied into the startup directory by default, but you
                   10423:             can enable it, by adding the option <code class=
                   10424:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
                   10425:             "filename">/etc/mk.conf</code>. This option will copy
                   10426:             the scripts into <code class=
                   10427:             "filename">/etc/rc.d</code> when a package is
                   10428:             installed, and it will automatically remove the scripts
                   10429:             when the package is deinstalled.</p>
                   10430:           </div>
1.1       grant    10431:         </div>
                   10432: 
                   10433:         <div class="sect1" lang="en" xml:lang="en">
                   10434:           <div class="titlepage">
                   10435:             <div>
                   10436:               <div>
                   10437:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      10438:                 "id2635358" id="id2635358"></a>12.6.&nbsp;Feedback
1.1       grant    10439:                 to the author</h2>
                   10440:               </div>
                   10441:             </div>
                   10442:           </div>
                   10443: 
                   10444:           <p>If you have found any bugs in the package you make
                   10445:           available, if you had to do special steps to make it run
                   10446:           under NetBSD or if you enhanced the software in various
                   10447:           other ways, be sure to report these changes back to the
                   10448:           original author of the program! With that kind of
                   10449:           support, the next release of the program can incorporate
                   10450:           these fixes, and people not using the NetBSD packages
                   10451:           system can win from your efforts.</p>
                   10452: 
                   10453:           <p>Support the idea of free software!</p>
                   10454:         </div>
                   10455:       </div>
                   10456: 
                   10457:       <div class="chapter" lang="en" xml:lang="en">
                   10458:         <div class="titlepage">
                   10459:           <div>
                   10460:             <div>
                   10461:               <h2 class="title"><a name="debug" id=
                   10462:               "debug"></a>Chapter&nbsp;13.&nbsp;Debugging</h2>
                   10463:             </div>
                   10464:           </div>
                   10465:         </div>
                   10466: 
                   10467:         <p>To check out all the gotchas when building a package,
                   10468:         here are the steps that I do in order to get a package
                   10469:         working. Please note this is basically the same as what was
                   10470:         explained in the previous sections, only with some
                   10471:         debugging aids.</p>
                   10472: 
                   10473:         <div class="itemizedlist">
                   10474:           <ul type="disc">
                   10475:             <li>
1.14      xtraeme  10476:               <p>Be sure to set <code class=
                   10477:               "varname">PKG_DEVELOPER=1</code> in <code class=
                   10478:               "filename">/etc/mk.conf</code></p>
1.1       grant    10479:             </li>
                   10480: 
                   10481:             <li>
                   10482:               <p>Install <a xmlns=
                   10483:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10484:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20      ben      10485:               class="pkgname">pkgtools/url2pkg</a>, create a
                   10486:               directory for a new package, change into it, then run
                   10487:               <span><strong class=
                   10488:               "command">url2pkg</strong></span>:</p>
1.1       grant    10489:               <pre class="screen">
1.14      xtraeme  10490: <code class="prompt">%</code> <strong class=
                   10491: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   10492: "replaceable"><code>category</code></em>/<em class=
                   10493: "replaceable"><code>examplepkg</code></em></code></strong>
                   10494: <code class="prompt">%</code> <strong class=
                   10495: "userinput"><code>cd /usr/pkgsrc/<em class=
                   10496: "replaceable"><code>category</code></em>/<em class=
                   10497: "replaceable"><code>examplepkg</code></em></code></strong>
                   10498: <code class="prompt">%</code> <strong class=
                   10499: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    10500: </pre>
                   10501:             </li>
                   10502: 
                   10503:             <li>
1.14      xtraeme  10504:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    10505:               requested.</p>
                   10506:             </li>
                   10507: 
                   10508:             <li>
1.14      xtraeme  10509:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    10510:               file</p>
                   10511:             </li>
                   10512: 
                   10513:             <li>
1.14      xtraeme  10514:               <p>Run <span><strong class="command">make
                   10515:               configure</strong></span></p>
1.1       grant    10516:             </li>
                   10517: 
                   10518:             <li>
                   10519:               <p>Add any dependencies glimpsed from documentation
1.14      xtraeme  10520:               and the configure step to the package's <code class=
                   10521:               "filename">Makefile</code>.</p>
1.1       grant    10522:             </li>
                   10523: 
                   10524:             <li>
                   10525:               <p>Make the package compile, doing multiple rounds
                   10526:               of</p>
                   10527:               <pre class="screen">
1.14      xtraeme  10528: <code class="prompt">%</code> <strong class=
                   10529: "userinput"><code>make</code></strong>
                   10530: <code class="prompt">%</code> <strong class=
                   10531: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   10532: <code class="prompt">%</code> <strong class=
                   10533: "userinput"><code>mkpatches</code></strong>
                   10534: <code class="prompt">%</code> <strong class=
                   10535: "userinput"><code>patchdiff</code></strong>
                   10536: <code class="prompt">%</code> <strong class=
                   10537: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   10538: <code class="prompt">%</code> <strong class=
                   10539: "userinput"><code>make mps</code></strong>
                   10540: <code class="prompt">%</code> <strong class=
                   10541: "userinput"><code>make clean</code></strong>
1.1       grant    10542: </pre>
                   10543: 
                   10544:               <p>Doing as non-root user will ensure that no files
                   10545:               are modified that shouldn't be, especially during the
1.14      xtraeme  10546:               build phase. <span><strong class=
                   10547:               "command">mkpatches</strong></span>,
                   10548:               <span><strong class=
                   10549:               "command">patchdiff</strong></span> and
                   10550:               <span><strong class="command">pkgvi</strong></span>
                   10551:               are from the <a xmlns=
1.1       grant    10552:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10553:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      10554:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    10555:             </li>
                   10556: 
                   10557:             <li>
1.14      xtraeme  10558:               <p>Look at the <code class=
                   10559:               "filename">Makefile</code>, fix if necessary; see
                   10560:               <a href="#components.Makefile" title=
                   10561:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
                   10562:               &#8220;<code class=
                   10563:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    10564:             </li>
                   10565: 
                   10566:             <li>
1.14      xtraeme  10567:               <p>Generate a <code class=
                   10568:               "filename">PLIST</code>:</p>
1.1       grant    10569:               <pre class="screen">
1.14      xtraeme  10570: <code class="prompt">#</code> <strong class=
                   10571: "userinput"><code>make install</code></strong>
                   10572: <code class="prompt">#</code> <strong class=
                   10573: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   10574: <code class="prompt">#</code> <strong class=
                   10575: "userinput"><code>make deinstall</code></strong>
                   10576: <code class="prompt">#</code> <strong class=
                   10577: "userinput"><code>make install</code></strong>
                   10578: <code class="prompt">#</code> <strong class=
                   10579: "userinput"><code>make deinstall</code></strong>
1.1       grant    10580: </pre>
                   10581: 
1.14      xtraeme  10582:               <p>You usually need to be <code class=
                   10583:               "username">root</code> to do this. Look if there are
1.1       grant    10584:               any files left:</p>
                   10585:               <pre class="screen">
1.14      xtraeme  10586: <code class="prompt">#</code> <strong class=
                   10587: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10588: </pre>
                   10589: 
                   10590:               <p>If this reveals any files that are missing in
1.14      xtraeme  10591:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    10592:             </li>
                   10593: 
                   10594:             <li>
1.14      xtraeme  10595:               <p>Now that the <code class="filename">PLIST</code>
                   10596:               is OK, install the package again and make a binary
1.1       grant    10597:               package:</p>
                   10598:               <pre class="screen">
1.14      xtraeme  10599: <code class="prompt">#</code> <strong class=
                   10600: "userinput"><code>make reinstall</code></strong>
                   10601: <code class="prompt">#</code> <strong class=
                   10602: "userinput"><code>make package</code></strong>
1.1       grant    10603: </pre>
                   10604:             </li>
                   10605: 
                   10606:             <li>
                   10607:               <p>Delete the installed package:</p>
                   10608:               <pre class="screen">
1.14      xtraeme  10609: <code class="prompt">#</code> <strong class=
                   10610: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    10611: </pre>
                   10612:             </li>
                   10613: 
                   10614:             <li>
1.14      xtraeme  10615:               <p>Repeat the above <span><strong class=
                   10616:               "command">make print-PLIST</strong></span> command,
                   10617:               which shouldn't find anything now:</p>
1.1       grant    10618:               <pre class="screen">
1.14      xtraeme  10619: <code class="prompt">#</code> <strong class=
                   10620: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10621: </pre>
                   10622:             </li>
                   10623: 
                   10624:             <li>
                   10625:               <p>Reinstall the binary package:</p>
                   10626:               <pre class="screen">
1.14      xtraeme  10627: <code class="prompt">#</code> <strong class=
                   10628: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    10629: </pre>
                   10630:             </li>
                   10631: 
                   10632:             <li>
                   10633:               <p>Play with it. Make sure everything works.</p>
                   10634:             </li>
                   10635: 
                   10636:             <li>
1.14      xtraeme  10637:               <p>Run <span><strong class=
                   10638:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    10639:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10640:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      10641:               class="pkgname">pkgtools/pkglint</a>, and fix the
                   10642:               problems it reports:</p>
1.1       grant    10643:               <pre class="screen">
1.14      xtraeme  10644: <code class="prompt">#</code> <strong class=
                   10645: "userinput"><code>pkglint</code></strong>
1.1       grant    10646: </pre>
                   10647:             </li>
                   10648: 
                   10649:             <li>
                   10650:               <p>Submit (or commit, if you have cvs access); see
                   10651:               <a href="#submit" title=
                   10652:               "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter&nbsp;14,
                   10653:               <i>Submitting and Committing</i></a>.</p>
                   10654:             </li>
                   10655:           </ul>
                   10656:         </div>
                   10657:       </div>
                   10658: 
                   10659:       <div class="chapter" lang="en" xml:lang="en">
                   10660:         <div class="titlepage">
                   10661:           <div>
                   10662:             <div>
                   10663:               <h2 class="title"><a name="submit" id=
                   10664:               "submit"></a>Chapter&nbsp;14.&nbsp;Submitting and
                   10665:               Committing</h2>
                   10666:             </div>
                   10667:           </div>
                   10668:         </div>
                   10669: 
                   10670:         <div class="toc">
                   10671:           <p><b>Table of Contents</b></p>
                   10672: 
                   10673:           <dl>
1.24    ! wiz      10674:             <dt><span class="sect1"><a href="#id2635957">14.1.
1.1       grant    10675:             Submitting your packages</a></span></dt>
                   10676: 
1.24    ! wiz      10677:             <dt><span class="sect1"><a href="#id2636014">14.2.
1.1       grant    10678:             Committing: Importing a package into
                   10679:             CVS</a></span></dt>
                   10680: 
1.24    ! wiz      10681:             <dt><span class="sect1"><a href="#id2636077">14.3.
1.2       hubertf  10682:             Updating a package to a newer version</a></span></dt>
1.1       grant    10683: 
1.24    ! wiz      10684:             <dt><span class="sect1"><a href="#id2636097">14.4.
1.2       hubertf  10685:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    10686:           </dl>
                   10687:         </div>
                   10688: 
                   10689:         <div class="sect1" lang="en" xml:lang="en">
                   10690:           <div class="titlepage">
                   10691:             <div>
                   10692:               <div>
                   10693:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      10694:                 "id2635957" id=
        !          10695:                 "id2635957"></a>14.1.&nbsp;Submitting your
1.1       grant    10696:                 packages</h2>
                   10697:               </div>
                   10698:             </div>
                   10699:           </div>
                   10700: 
                   10701:           <p>You have to separate between binary and
                   10702:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   10703:           packages here:</p>
                   10704: 
                   10705:           <div class="itemizedlist">
                   10706:             <ul type="disc">
                   10707:               <li>
                   10708:                 <p>precompiled binary packages</p>
                   10709: 
                   10710:                 <p>Our policy is that we accept binaries only from
                   10711:                 pkgsrc developers to guarantee that the packages
                   10712:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  10713:                 annoy anyone but rather to protect our users!
1.1       grant    10714:                 You're still free to put up your home-made binary
1.13      hubertf  10715:                 packages and tell the world where to get them.
                   10716:                 NetBSD developers doing bulk builds and wanting to
                   10717:                 upload them please see <a href="#bulk-upload"
                   10718:                 title="5.3.8.&nbsp;Uploading results of a bulk build">
                   10719:                 Section&nbsp;5.3.8, &#8220;Uploading results of a
                   10720:                 bulk build&#8221;</a>.</p>
1.1       grant    10721:               </li>
                   10722: 
                   10723:               <li>
                   10724:                 <p>packages</p>
                   10725: 
                   10726:                 <p>First, check that your package is complete,
                   10727:                 compiles and runs well; see <a href="#debug" title=
                   10728:                 "Chapter&nbsp;13.&nbsp;Debugging">Chapter&nbsp;13,
                   10729:                 <i>Debugging</i></a> and the rest of this document.
1.24    ! wiz      10730:                 Next, generate an uuencoded gzipped <a href=
        !          10731:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
        !          10732:                 <span class="citerefentry"><span class=
        !          10733:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    10734:                 preferably with all files in a single directory.
1.14      xtraeme  10735:                 Finally, <span><strong class=
                   10736:                 "command">send-pr</strong></span> with category
1.1       grant    10737:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   10738:                 synopsis which includes the package name and
                   10739:                 version number, a short description of your package
                   10740:                 (contents of the COMMENT variable or DESCR file are
                   10741:                 OK) and attach the archive to your PR.</p>
                   10742: 
                   10743:                 <p>If you want to submit several packages, please
                   10744:                 send a separate PR for each one, it's easier for us
                   10745:                 to track things that way.</p>
                   10746: 
                   10747:                 <p>Alternatively, you can also import new packages
                   10748:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   10749:                 work-in-progress</span>&#8221;); see the homepage
                   10750:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   10751:                 target=
                   10752:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   10753:                 details.</p>
                   10754:               </li>
                   10755:             </ul>
                   10756:           </div>
                   10757:         </div>
                   10758: 
                   10759:         <div class="sect1" lang="en" xml:lang="en">
                   10760:           <div class="titlepage">
                   10761:             <div>
                   10762:               <div>
                   10763:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      10764:                 "id2636014" id=
        !          10765:                 "id2636014"></a>14.2.&nbsp;Committing: Importing a
1.1       grant    10766:                 package into CVS</h2>
                   10767:               </div>
                   10768:             </div>
                   10769:           </div>
                   10770: 
                   10771:           <p>This section is only of interest for pkgsrc developers
                   10772:           with write access to the pkgsrc repository. Please
                   10773:           remember that cvs imports files relative to the current
                   10774:           working directory, and that the pathname that you give
1.14      xtraeme  10775:           the <span><strong class="command">cvs
                   10776:           import</strong></span> command is so that it knows where
                   10777:           to place the files in the repository. Newly created
                   10778:           packages should be imported with a vendor tag of
                   10779:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   10780:           release tag of &#8220;<span class=
                   10781:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    10782:           <pre class="programlisting">
                   10783:   % cd .../pkgsrc/category/pkgname
                   10784:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   10785: </pre>
                   10786: 
                   10787:           <p>Remember to move the directory from which you imported
                   10788:           out of the way, or cvs will complain the next time you
                   10789:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   10790:           source tree. Also don't forget to add the new package to
1.14      xtraeme  10791:           the category's <code class=
                   10792:           "filename">Makefile</code>.</p>
1.1       grant    10793: 
                   10794:           <p>The commit message of the initial import should
1.14      xtraeme  10795:           include part of the <code class="filename">DESCR</code>
                   10796:           file, so people reading the mailing lists know what the
                   10797:           package is/does.</p>
1.1       grant    10798: 
                   10799:           <p>Please note all package updates/additions in
1.14      xtraeme  10800:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
                   10801:           very important to keep this file up to date and
                   10802:           conforming to the existing format, because it will be
                   10803:           used by scripts to automatically update pages on <a href=
1.1       grant    10804:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   10805:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   10806:           file and remove the entry for the package you updated, in
                   10807:           case it was mentioned there.</p>
                   10808: 
                   10809:           <p>For new packages, &#8220;<span class="quote">cvs
                   10810:           import</span>&#8221; is preferred to &#8220;<span class=
                   10811:           "quote">cvs add</span>&#8221; because the former gets
                   10812:           everything with a single command, and provides a
                   10813:           consistent tag.</p>
                   10814:         </div>
                   10815: 
                   10816:         <div class="sect1" lang="en" xml:lang="en">
                   10817:           <div class="titlepage">
                   10818:             <div>
                   10819:               <div>
                   10820:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      10821:                 "id2636077" id="id2636077"></a>14.3.&nbsp;Updating
1.2       hubertf  10822:                 a package to a newer version</h2>
1.1       grant    10823:               </div>
                   10824:             </div>
                   10825:           </div>
                   10826: 
                   10827:           <p>Please always put a concise, appropriate and relevant
                   10828:           summary of the changes between old and new versions into
                   10829:           the commit log when updating a package. There are various
                   10830:           reasons for this:</p>
                   10831: 
                   10832:           <div class="itemizedlist">
                   10833:             <ul type="disc">
                   10834:               <li>
                   10835:                 <p>A URL is volatile, and can change over time. It
                   10836:                 may go away completely or its information may be
                   10837:                 overwritten by newer information.</p>
                   10838:               </li>
                   10839: 
                   10840:               <li>
                   10841:                 <p>Having the change information between old and
                   10842:                 new versions in our CVS repository is very useful
                   10843:                 for people who use either cvs or anoncvs.</p>
                   10844:               </li>
                   10845: 
                   10846:               <li>
                   10847:                 <p>Having the change information between old and
                   10848:                 new versions in our CVS repository is very useful
                   10849:                 for people who read the pkgsrc-changes mailing
                   10850:                 list, so that they can make tactical decisions
                   10851:                 about when to upgrade the package.</p>
                   10852:               </li>
                   10853:             </ul>
                   10854:           </div>
                   10855: 
1.18      xtraeme  10856:           <p>Please also recognize that, just because a new version
1.1       grant    10857:           of a package has been released, it should not
                   10858:           automatically be upgraded in the CVS repository. We
                   10859:           prefer to be conservative in the packages that are
                   10860:           included in pkgsrc - development or beta packages are not
                   10861:           really the best thing for most places in which pkgsrc is
                   10862:           used. Please use your judgement about what should go into
                   10863:           pkgsrc, and bear in mind that stability is to be
                   10864:           preferred above new and possibly untested features.</p>
                   10865:         </div>
                   10866: 
                   10867:         <div class="sect1" lang="en" xml:lang="en">
                   10868:           <div class="titlepage">
                   10869:             <div>
                   10870:               <div>
                   10871:                 <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      10872:                 "id2636097" id="id2636097"></a>14.4.&nbsp;Moving a
1.2       hubertf  10873:                 package in pkgsrc</h2>
1.1       grant    10874:               </div>
                   10875:             </div>
                   10876:           </div>
                   10877: 
                   10878:           <div class="orderedlist">
                   10879:             <ol type="1">
                   10880:               <li>
                   10881:                 <p>Make a copy of the directory somewhere else.</p>
                   10882:               </li>
                   10883: 
                   10884:               <li>
                   10885:                 <p>Remove all CVS dirs.</p>
                   10886: 
                   10887:                 <p>Alternatively to the first two steps you can
                   10888:                 also do:</p>
                   10889:                 <pre class="screen">
1.14      xtraeme  10890: <code class="prompt">%</code> <strong class=
                   10891: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    10892: </pre>
                   10893: 
                   10894:                 <p>and use that for further work.</p>
                   10895:               </li>
                   10896: 
                   10897:               <li>
1.14      xtraeme  10898:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   10899:                 any <code class="varname">DEPENDS</code> paths that
                   10900:                 just did &#8220;<span class=
1.1       grant    10901:                 "quote">../package</span>&#8221; instead of
                   10902:                 &#8220;<span class=
                   10903:                 "quote">../../category/package</span>&#8221;.</p>
                   10904:               </li>
                   10905: 
                   10906:               <li>
1.14      xtraeme  10907:                 <p><span><strong class="command">cvs
                   10908:                 import</strong></span> the modified package in the
                   10909:                 new place.</p>
1.1       grant    10910:               </li>
                   10911: 
                   10912:               <li>
                   10913:                 <p>Check if any package depends on it:</p>
                   10914:                 <pre class="screen">
1.14      xtraeme  10915: <code class="prompt">%</code> <strong class=
                   10916: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   10917: <code class="prompt">%</code> <strong class=
                   10918: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    10919: </pre>
                   10920:               </li>
                   10921: 
                   10922:               <li>
                   10923:                 <p>Fix paths in packages from step 5 to point to
                   10924:                 new location.</p>
                   10925:               </li>
                   10926: 
                   10927:               <li>
1.14      xtraeme  10928:                 <p><span><strong class="command">cvs rm
                   10929:                 (-f)</strong></span> the package at the old
                   10930:                 location.</p>
1.1       grant    10931:               </li>
                   10932: 
                   10933:               <li>
1.14      xtraeme  10934:                 <p>Remove from <code class=
                   10935:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    10936:               </li>
                   10937: 
                   10938:               <li>
1.14      xtraeme  10939:                 <p>Add to <code class=
                   10940:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    10941:               </li>
                   10942: 
                   10943:               <li>
                   10944:                 <p>Commit the changed and removed files:</p>
                   10945:                 <pre class="screen">
1.14      xtraeme  10946: <code class="prompt">%</code> <strong class=
                   10947: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    10948: </pre>
                   10949: 
                   10950:                 <p>(and any packages from step 5, of course).</p>
                   10951:               </li>
                   10952:             </ol>
                   10953:           </div>
                   10954:         </div>
                   10955:       </div>
                   10956:     </div>
                   10957: 
                   10958:     <div class="appendix" lang="en" xml:lang="en">
                   10959:       <div class="titlepage">
                   10960:         <div>
                   10961:           <div>
                   10962:             <h2 class="title"><a name="examples" id=
                   10963:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   10964:             package: bison</h2>
                   10965:           </div>
                   10966:         </div>
                   10967:       </div>
                   10968: 
                   10969:       <div class="toc">
                   10970:         <p><b>Table of Contents</b></p>
                   10971: 
                   10972:         <dl>
1.24    ! wiz      10973:           <dt><span class="sect1"><a href="#id2636323">A.1.
1.1       grant    10974:           files</a></span></dt>
                   10975: 
                   10976:           <dd>
                   10977:             <dl>
1.24    ! wiz      10978:               <dt><span class="sect2"><a href="#id2636326">A.1.1.
1.1       grant    10979:               Makefile</a></span></dt>
                   10980: 
1.24    ! wiz      10981:               <dt><span class="sect2"><a href="#id2636333">A.1.2.
1.1       grant    10982:               DESCR</a></span></dt>
                   10983: 
1.24    ! wiz      10984:               <dt><span class="sect2"><a href="#id2636348">A.1.3.
1.1       grant    10985:               PLIST</a></span></dt>
                   10986: 
1.24    ! wiz      10987:               <dt><span class="sect2"><a href="#id2636356">A.1.4.
1.14      xtraeme  10988:               Checking a package with <span><strong class=
                   10989:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    10990:             </dl>
                   10991:           </dd>
                   10992: 
1.24    ! wiz      10993:           <dt><span class="sect1"><a href="#id2636465">A.2. Steps
1.1       grant    10994:           for building, installing, packaging</a></span></dt>
                   10995:         </dl>
                   10996:       </div>
                   10997: 
                   10998:       <p>We checked to find a piece of software that wasn't in the
                   10999:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  11000:       would want to have <span><strong class=
                   11001:       "command">bison</strong></span> when Berkeley
                   11002:       <span><strong class="command">yacc</strong></span> is already
                   11003:       present in the tree is beyond us, but it's useful for the
                   11004:       purposes of this exercise.</p>
1.1       grant    11005: 
                   11006:       <div class="sect1" lang="en" xml:lang="en">
                   11007:         <div class="titlepage">
                   11008:           <div>
                   11009:             <div>
                   11010:               <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      11011:               "id2636323" id="id2636323"></a>A.1.&nbsp;files</h2>
1.1       grant    11012:             </div>
                   11013:           </div>
                   11014:         </div>
                   11015: 
                   11016:         <div class="sect2" lang="en" xml:lang="en">
                   11017:           <div class="titlepage">
                   11018:             <div>
                   11019:               <div>
1.24    ! wiz      11020:                 <h3 class="title"><a name="id2636326" id=
        !          11021:                 "id2636326"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    11022:               </div>
                   11023:             </div>
                   11024:           </div>
                   11025:           <pre class="programlisting">
1.17      sketch   11026: # $NetBSD$
1.1       grant    11027: #
                   11028: 
                   11029: DISTNAME=       bison-1.25
                   11030: CATEGORIES=     devel
                   11031: MASTER_SITES=   ${MASTER_SITE_GNU}
                   11032: 
                   11033: MAINTAINER=     thorpej@NetBSD.org
                   11034: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   11035: COMMENT=        GNU yacc clone
                   11036: 
                   11037: GNU_CONFIGURE=  yes
                   11038: INFO_FILES=     bison.info
                   11039: 
                   11040: .include "../../mk/bsd.pkg.mk"
                   11041: </pre>
                   11042:         </div>
                   11043: 
                   11044:         <div class="sect2" lang="en" xml:lang="en">
                   11045:           <div class="titlepage">
                   11046:             <div>
                   11047:               <div>
1.24    ! wiz      11048:                 <h3 class="title"><a name="id2636333" id=
        !          11049:                 "id2636333"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    11050:               </div>
                   11051:             </div>
                   11052:           </div>
                   11053:           <pre class="programlisting">
                   11054: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   11055: improvements.  Why you would want this when Berkeley <a href=
                   11056: "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
                   11057: of the NetBSD source tree is beyond me.
                   11058: </pre>
                   11059:         </div>
                   11060: 
                   11061:         <div class="sect2" lang="en" xml:lang="en">
                   11062:           <div class="titlepage">
                   11063:             <div>
                   11064:               <div>
1.24    ! wiz      11065:                 <h3 class="title"><a name="id2636348" id=
        !          11066:                 "id2636348"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    11067:               </div>
                   11068:             </div>
                   11069:           </div>
                   11070:           <pre class="programlisting">
1.17      sketch   11071: @comment $NetBSD$
1.1       grant    11072: bin/bison
                   11073: man/man1/bison.1.gz
                   11074: share/bison.simple
                   11075: share/bison.hairy
                   11076: </pre>
                   11077:         </div>
                   11078: 
                   11079:         <div class="sect2" lang="en" xml:lang="en">
                   11080:           <div class="titlepage">
                   11081:             <div>
                   11082:               <div>
1.24    ! wiz      11083:                 <h3 class="title"><a name="id2636356" id=
        !          11084:                 "id2636356"></a>A.1.4.&nbsp;Checking a package with
1.14      xtraeme  11085:                 <span><strong class=
                   11086:                 "command">pkglint</strong></span></h3>
1.1       grant    11087:               </div>
                   11088:             </div>
                   11089:           </div>
                   11090: 
                   11091:           <p>The NetBSD package system comes with <a xmlns=
                   11092:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   11093:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      11094:           class="pkgname">pkgtools/pkglint</a> which helps to check
                   11095:           the contents of these files. After installation it is
                   11096:           quite easy to use, just change to the directory of the
                   11097:           package you wish to examine and execute
                   11098:           <span><strong class=
                   11099:           "command">pkglint</strong></span>:</p>
1.1       grant    11100:           <pre class="screen">
1.14      xtraeme  11101: <code class="prompt">$</code> <strong class=
                   11102: "userinput"><code>pkglint</code></strong>
1.1       grant    11103: OK: checking ./DESCR.
                   11104: OK: checking Makefile.
                   11105: OK: checking distinfo.
                   11106: OK: checking patches/patch-aa.
                   11107: looks fine.
                   11108: </pre>
                   11109: 
                   11110:           <p>Depending on the supplied command line arguments (see
                   11111:           pkglint(1)) more verbose checks will be performed. Use
1.14      xtraeme  11112:           e.g. <span><strong class="command">pkglint
                   11113:           -v</strong></span> for a very verbose check.</p>
1.1       grant    11114:         </div>
                   11115:       </div>
                   11116: 
                   11117:       <div class="sect1" lang="en" xml:lang="en">
                   11118:         <div class="titlepage">
                   11119:           <div>
                   11120:             <div>
                   11121:               <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      11122:               "id2636465" id="id2636465"></a>A.2.&nbsp;Steps for
1.1       grant    11123:               building, installing, packaging</h2>
                   11124:             </div>
                   11125:           </div>
                   11126:         </div>
                   11127: 
                   11128:         <p>Create the directory where the package lives, plus any
                   11129:         auxiliary directories:</p>
                   11130:         <pre class="screen">
1.14      xtraeme  11131: <code class="prompt">#</code> <strong class=
                   11132: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   11133: <code class="prompt">#</code> <strong class=
                   11134: "userinput"><code>mkdir bison</code></strong>
                   11135: <code class="prompt">#</code> <strong class=
                   11136: "userinput"><code>cd bison</code></strong>
                   11137: <code class="prompt">#</code> <strong class=
                   11138: "userinput"><code>mkdir patches</code></strong>
1.1       grant    11139: </pre>
                   11140: 
1.14      xtraeme  11141:         <p>Create <code class="filename">Makefile</code>,
                   11142:         <code class="filename">DESCR</code> and <code class=
                   11143:         "filename">PLIST</code> (see <a href="#components" title=
1.1       grant    11144:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   11145:         Chapter 7, <i>Package components - files, directories and
                   11146:         contents</i></a>) then continue with fetching the
                   11147:         distfile:</p>
                   11148:         <pre class="screen">
1.14      xtraeme  11149: <code class="prompt">#</code> <strong class=
                   11150: "userinput"><code>make fetch</code></strong>
1.1       grant    11151: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   11152: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   11153: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11154: ftp: Error retrieving file: 500 Internal error
                   11155: 
                   11156: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   11157: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11158: ftp: Error retrieving file: 500 Internal error
                   11159: 
                   11160: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   11161: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11162: Successfully retrieved file.
                   11163: </pre>
                   11164: 
1.14      xtraeme  11165:         <p>Generate the checksum of the distfile into <code class=
                   11166:         "filename">distinfo</code>:</p>
1.1       grant    11167:         <pre class="screen">
1.14      xtraeme  11168: <code class="prompt">#</code> <strong class=
                   11169: "userinput"><code>make makesum</code></strong>
1.1       grant    11170: </pre>
                   11171: 
                   11172:         <p>Now compile:</p>
                   11173:         <pre class="screen">
1.14      xtraeme  11174: <code class="prompt">#</code> <strong class=
                   11175: "userinput"><code>make</code></strong>
1.1       grant    11176: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11177: ===&gt;  Extracting for bison-1.25
                   11178: ===&gt;  Patching for bison-1.25
                   11179: ===&gt;   Ignoring empty patch directory
                   11180: ===&gt;  Configuring for bison-1.25
                   11181: creating cache ./config.cache
                   11182: checking for gcc... cc
                   11183: checking whether we are using GNU C... yes
                   11184: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   11185: checking how to run the C preprocessor... cc -E
                   11186: checking for minix/config.h... no
                   11187: checking for POSIXized ISC... no
                   11188: checking whether cross-compiling... no
                   11189: checking for ANSI C header files... yes
                   11190: checking for string.h... yes
                   11191: checking for stdlib.h... yes
                   11192: checking for memory.h... yes
                   11193: checking for working const... yes
                   11194: checking for working alloca.h... no
                   11195: checking for alloca... yes
                   11196: checking for strerror... yes
                   11197: updating cache ./config.cache
                   11198: creating ./config.status
                   11199: creating Makefile
                   11200: ===&gt;  Building for bison-1.25
                   11201: 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
                   11202: 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
                   11203: 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
                   11204: 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
                   11205: 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
                   11206: 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 
                   11207: 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
                   11208: 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
                   11209: 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
                   11210: 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
                   11211: 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
                   11212: 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
                   11213: 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
                   11214: 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
                   11215: 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
                   11216: 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
                   11217: 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
                   11218: 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
                   11219: 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
                   11220: 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
                   11221: 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
                   11222: 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
                   11223: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   11224: rm -f bison.s1
                   11225: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   11226: </pre>
                   11227: 
                   11228:         <p>Everything seems OK, so install the files:</p>
                   11229:         <pre class="screen">
1.14      xtraeme  11230: <code class="prompt">#</code> <strong class=
                   11231: "userinput"><code>make install</code></strong>
1.1       grant    11232: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11233: ===&gt;  Installing for bison-1.25
                   11234: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   11235: rm -f /usr/pkg/bin/bison
                   11236: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   11237: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   11238: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   11239: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   11240: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   11241: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   11242: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   11243: ===&gt;  Registering installation for bison-1.25
                   11244: </pre>
                   11245: 
                   11246:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  11247:         remove it with <span><strong class="command">pkg_delete
                   11248:         bison</strong></span>. Should you decide that you want a
                   11249:         binary package, do this now:</p>
1.1       grant    11250:         <pre class="screen">
1.14      xtraeme  11251: <code class="prompt">#</code> <strong class=
                   11252: "userinput"><code>make package</code></strong>
1.1       grant    11253: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11254: ===&gt;  Building package for bison-1.25
                   11255: Creating package bison-1.25.tgz
                   11256: Registering depends:.
                   11257: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   11258: </pre>
                   11259: 
                   11260:         <p>Now that you don't need the source and object files any
                   11261:         more, clean up:</p>
                   11262:         <pre class="screen">
1.14      xtraeme  11263: <code class="prompt">#</code> <strong class=
                   11264: "userinput"><code>make clean</code></strong>
1.1       grant    11265: ===&gt;  Cleaning for bison-1.25
                   11266: </pre>
                   11267:       </div>
                   11268:     </div>
                   11269: 
                   11270:     <div class="appendix" lang="en" xml:lang="en">
                   11271:       <div class="titlepage">
                   11272:         <div>
                   11273:           <div>
                   11274:             <h2 class="title"><a name="logs" id=
                   11275:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   11276:           </div>
                   11277:         </div>
                   11278:       </div>
                   11279: 
                   11280:       <div class="toc">
                   11281:         <p><b>Table of Contents</b></p>
                   11282: 
                   11283:         <dl>
                   11284:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   11285:           Building figlet</a></span></dt>
                   11286: 
                   11287:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   11288:           Packaging figlet</a></span></dt>
                   11289:         </dl>
                   11290:       </div>
                   11291: 
                   11292:       <div class="sect1" lang="en" xml:lang="en">
                   11293:         <div class="titlepage">
                   11294:           <div>
                   11295:             <div>
                   11296:               <h2 class="title" style="clear: both"><a name=
                   11297:               "logs.building" id=
                   11298:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   11299:             </div>
                   11300:           </div>
                   11301:         </div>
                   11302:         <pre class="screen">
1.14      xtraeme  11303: <code class="prompt">#</code> <strong class=
                   11304: "userinput"><code>make</code></strong>
1.1       grant    11305: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11306: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   11307: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   11308: =&gt; [172219 bytes]
                   11309: Connected to ftp.plig.net.
                   11310: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   11311: 331 Guest login ok, send your complete e-mail address as password.
                   11312: 230-You are user #5 of 500 simultaneous users allowed.
                   11313: 230-
                   11314: 230-  ___ _             _ _                   
                   11315: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   11316: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   11317: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   11318: 230-         |_|   |_|     |___|         |___|
                   11319: 230-
                   11320: 230-** Welcome to ftp.plig.org **
                   11321: 230-
                   11322: 230-Please note that all transfers from this FTP site are logged. If you
                   11323: 230-do not like this, please disconnect now.
                   11324: 230-
                   11325: 230-This arhive is available via
                   11326: 230-
                   11327: 230-HTTP:  http://ftp.plig.org/
                   11328: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   11329: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   11330: 230-
                   11331: 230-Please email comments, bug reports and requests for packages to be
                   11332: 230-mirrored to ftp-admin@plig.org.   
                   11333: 230-
                   11334: 230-
                   11335: 230 Logged in anonymously.
                   11336: Remote system type is UNIX.
                   11337: Using binary mode to transfer files.
                   11338: 200 Type okay.
                   11339: 250 "/pub" is new cwd.
                   11340: 250-"/pub/figlet" is new cwd.
                   11341: 250-
                   11342: 250-Welcome to the figlet archive at ftp.figlet.org
                   11343: 250-    
                   11344: 250-    ftp://ftp.figlet.org/pub/figlet/
                   11345: 250-
                   11346: 250-The official FIGlet web page is:
                   11347: 250-    http://www.figlet.org/
                   11348: 250-
                   11349: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   11350: 250-contribute a font or something else, you can email us.
                   11351: 250 
                   11352: 250 "/pub/figlet/program" is new cwd.
                   11353: 250 "/pub/figlet/program/unix" is new cwd.
                   11354: local: figlet221.tar.gz remote: figlet221.tar.gz
                   11355: 502 Unimplemented command.
                   11356: 227 Entering Passive Mode (195,40,6,41,246,104)
                   11357: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   11358: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   11359: 226 Transfer completed.
                   11360: 172219 bytes received in 00:02 (75.99 KB/s)
                   11361: 221 Goodbye.
                   11362: =&gt; Checksum OK for figlet221.tar.gz.
                   11363: ===&gt; Extracting for figlet-2.2.1nb2
                   11364: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   11365: ===&gt; Patching for figlet-2.2.1nb2
                   11366: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   11367: ===&gt; Overriding tools for figlet-2.2.1nb2
                   11368: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   11369: ===&gt; Configuring for figlet-2.2.1nb2
                   11370: ===&gt; Building for figlet-2.2.1nb2
                   11371: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   11372: chmod a+x figlet
                   11373: gcc -O2 -o chkfont chkfont.c
                   11374: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  11375: <code class="prompt">#</code>
                   11376: <code class="prompt">#</code> <strong class=
                   11377: "userinput"><code>make install</code></strong>
1.1       grant    11378: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11379: ===&gt; Installing for figlet-2.2.1nb2
                   11380: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   11381: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   11382: mkdir -p /usr/pkg/share/figlet
                   11383: cp figlet /usr/pkg/bin
                   11384: cp chkfont /usr/pkg/bin
                   11385: chmod 555 figlist showfigfonts
                   11386: cp figlist /usr/pkg/bin
                   11387: cp showfigfonts /usr/pkg/bin
                   11388: cp fonts/*.flf /usr/pkg/share/figlet
                   11389: cp fonts/*.flc /usr/pkg/share/figlet
                   11390: cp figlet.6 /usr/pkg/man/man6
                   11391: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  11392: <code class="prompt">#</code>
1.1       grant    11393: </pre>
                   11394:       </div>
                   11395: 
                   11396:       <div class="sect1" lang="en" xml:lang="en">
                   11397:         <div class="titlepage">
                   11398:           <div>
                   11399:             <div>
                   11400:               <h2 class="title" style="clear: both"><a name=
                   11401:               "logs.package" id=
                   11402:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   11403:             </div>
                   11404:           </div>
                   11405:         </div>
                   11406:         <pre class="screen">
1.14      xtraeme  11407: <code class="prompt">#</code> <strong class=
                   11408: "userinput"><code>make package</code></strong>
1.1       grant    11409: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11410: ===&gt; Packaging figlet-2.2.1nb2
                   11411: ===&gt; Building binary package for figlet-2.2.1nb2
                   11412: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   11413: Using SrcDir value of /usr/pkg
                   11414: Registering depends:.  
1.14      xtraeme  11415: <code class="prompt">#</code>
1.1       grant    11416: </pre>
                   11417:       </div>
                   11418:     </div>
                   11419: 
                   11420:     <div class="appendix" lang="en" xml:lang="en">
                   11421:       <div class="titlepage">
                   11422:         <div>
                   11423:           <div>
                   11424:             <h2 class="title"><a name="ftp-layout" id=
                   11425:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   11426:             FTP server's package archive</h2>
                   11427:           </div>
                   11428:         </div>
                   11429:       </div>
                   11430: 
                   11431:       <p>Layout for precompiled binary packages on
                   11432:       ftp.NetBSD.org:</p>
                   11433:       <pre class="programlisting">
                   11434: /pub/NetBSD/packages/
                   11435:                 distfiles/
                   11436: 
                   11437:                 # Unpacked pkgsrc trees
                   11438:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   11439:                 pkgsrc-2003Q4 -&gt; N/A
                   11440:                 pkgsrc-2004Q1/pkgsrc
                   11441: 
                   11442:                 # pkgsrc archives
                   11443:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   11444:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   11445:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   11446: 
                   11447:                 # Per pkgsrc-release/OS-release/arch package archives
                   11448:                 pkgsrc-2003Q4/
                   11449:                         NetBSD-1.6.2/
                   11450:                                 i386/
                   11451:                                         All/
                   11452:                                         archivers/
                   11453:                                                 foo -&gt; ../All/foo
                   11454:                                         ...
                   11455:                 pkgsrc-2004Q1/
                   11456:                         NetBSD-1.6.2/
                   11457:                                 i386/
                   11458:                                         All/
                   11459:                                         ...
                   11460:                         NetBSD-2.0/
                   11461:                                 i386/
                   11462:                                         All/
                   11463:                                         ...
                   11464:                         SunOS-5.9/
                   11465:                                 sparc/
                   11466:                                         All/
                   11467:                                         ...
                   11468:                                 x86/
                   11469:                                         All/
                   11470:                                         ...
                   11471: 
                   11472:                 # Per os-release package archive convenience links
                   11473:                 NetBSD-1.6.2 -&gt; 1.6.2
                   11474:                 1.6.2/
                   11475:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   11476:                         m68k/
                   11477:                                 All/
                   11478:                                 archivers/
                   11479:                                         foo -&gt; ../All/foo
                   11480:                                 ...
                   11481:                         amiga -&gt; m68k
                   11482:                         atari -&gt; m68k
                   11483:                         ...
                   11484: 
                   11485:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   11486:                 NetBSD-2.0/
                   11487:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   11488:                 SunOS-5.9/
                   11489:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   11490:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   11491:                         
                   11492: </pre>
                   11493: 
                   11494:       <p>To create:</p>
                   11495: 
                   11496:       <div class="orderedlist">
                   11497:         <ol type="1">
                   11498:           <li>
                   11499:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   11500:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   11501:             5.3, &#8220;Doing a bulk build of all
                   11502:             packages&#8221;</a></p>
                   11503:           </li>
                   11504: 
                   11505:           <li>
                   11506:             <p>Upload /usr/pkgsrc/packages to</p>
                   11507:             <pre class="programlisting">
                   11508:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  11509:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    11510:         `uname -s`-`uname -r`/                  # OS &amp; version
                   11511:         `uname -p`                              # architecture
                   11512:        
                   11513: </pre>
                   11514:           </li>
                   11515: 
                   11516:           <li>
1.14      xtraeme  11517:             <p>If necessary, create a symlink <span><strong class=
                   11518:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   11519:             (amiga -&gt; m68k, ...)</p>
1.1       grant    11520:           </li>
                   11521:         </ol>
                   11522:       </div>
                   11523:     </div>
1.2       hubertf  11524: 
                   11525:     <div class="appendix" lang="en" xml:lang="en">
                   11526:       <div class="titlepage">
                   11527:         <div>
                   11528:           <div>
                   11529:             <h2 class="title"><a name="editing" id=
                   11530:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   11531:             for the pkgsrc guide</h2>
                   11532:           </div>
                   11533:         </div>
                   11534:       </div>
                   11535: 
                   11536:       <div class="toc">
                   11537:         <p><b>Table of Contents</b></p>
                   11538: 
                   11539:         <dl>
1.24    ! wiz      11540:           <dt><span class="sect1"><a href="#id2637111">D.1.
1.2       hubertf  11541:           Targets</a></span></dt>
                   11542: 
1.24    ! wiz      11543:           <dt><span class="sect1"><a href="#id2637517">D.2.
1.2       hubertf  11544:           Procedure</a></span></dt>
                   11545:         </dl>
                   11546:       </div>
                   11547: 
                   11548:       <p>This section contains information on editing the pkgsrc
                   11549:       guide itself.</p>
                   11550: 
                   11551:       <div class="sect1" lang="en" xml:lang="en">
                   11552:         <div class="titlepage">
                   11553:           <div>
                   11554:             <div>
                   11555:               <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      11556:               "id2637111" id="id2637111"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  11557:             </div>
                   11558:           </div>
                   11559:         </div>
                   11560: 
1.14      xtraeme  11561:         <p>The pkgsrc guide's source code is stored in <code class=
                   11562:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  11563:         are created from it:</p>
                   11564: 
                   11565:         <div class="itemizedlist">
                   11566:           <ul type="disc">
                   11567:             <li>
1.14      xtraeme  11568:               <p><code class=
1.23      wiz      11569:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  11570:             </li>
                   11571: 
                   11572:             <li>
1.14      xtraeme  11573:               <p><code class=
                   11574:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  11575:             </li>
                   11576: 
                   11577:             <li>
1.14      xtraeme  11578:               <p><code class=
                   11579:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  11580:               the documentation on the NetBSD website will be built
                   11581:               from pkgsrc and kept up to date on the web server
                   11582:               itself. This means you <span class=
                   11583:               "emphasis"><em>must</em></span> make sure that your
                   11584:               changes haven't broken the build!</p>
                   11585:             </li>
1.6       hubertf  11586: 
                   11587:             <li>
1.14      xtraeme  11588:               <p><code class=
                   11589:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  11590:               PDF version of the pkgsrc guide.</p>
                   11591:             </li>
                   11592: 
                   11593:             <li>
1.14      xtraeme  11594:               <p><code class=
                   11595:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  11596:               PostScript version of the pkgsrc guide.</p>
                   11597:             </li>
1.2       hubertf  11598:           </ul>
                   11599:         </div>
                   11600:       </div>
                   11601: 
                   11602:       <div class="sect1" lang="en" xml:lang="en">
                   11603:         <div class="titlepage">
                   11604:           <div>
                   11605:             <div>
                   11606:               <h2 class="title" style="clear: both"><a name=
1.24    ! wiz      11607:               "id2637517" id=
        !          11608:               "id2637517"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  11609:             </div>
                   11610:           </div>
                   11611:         </div>
                   11612: 
                   11613:         <p>The procedure to edit the pkgsrc guide is:</p>
                   11614: 
                   11615:         <div class="itemizedlist">
                   11616:           <ul type="disc">
                   11617:             <li>
1.6       hubertf  11618:               <p>Make sure you have the packages needed to
                   11619:               re-generate the pkgsrc guide (and other XML-based
                   11620:               NetBSD documentation) installed. These are
1.11      ben      11621:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  11622:               for creating the ASCII- and HTML-version, and
                   11623:               &#8220;<span class=
1.11      ben      11624:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  11625:               PostScript- and PDF version. You will need both
                   11626:               packages installed, to make sure documentation is
                   11627:               consistent across all formats. The packages can be
1.14      xtraeme  11628:               found in <code class=
                   11629:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
                   11630:               <code class=
                   11631:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  11632:             </li>
                   11633: 
                   11634:             <li>
1.14      xtraeme  11635:               <p>Edit the XML file(s) in <code class=
                   11636:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  11637:             </li>
                   11638: 
                   11639:             <li>
1.14      xtraeme  11640:               <p>Run <span><strong class="command">make extract
                   11641:               &amp;&amp; make do-lint</strong></span> in
                   11642:               <code class="filename">pkgsrc/doc/guide</code> to
                   11643:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  11644:             </li>
                   11645: 
                   11646:             <li>
1.14      xtraeme  11647:               <p>Run <span><strong class=
                   11648:               "command">make</strong></span> in <code class=
                   11649:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   11650:               and ASCII version.</p>
1.2       hubertf  11651:             </li>
                   11652: 
                   11653:             <li>
1.14      xtraeme  11654:               <p>If all is well, run <span><strong class=
                   11655:               "command">make install-doc</strong></span> to put the
                   11656:               generated files into <code class=
                   11657:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  11658:             </li>
                   11659: 
                   11660:             <li>
1.14      xtraeme  11661:               <p><span><strong class="command">cvs commit
                   11662:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  11663:             </li>
                   11664: 
                   11665:             <li>
1.14      xtraeme  11666:               <p><span><strong class="command">cvs commit -m
                   11667:               re-generate
                   11668:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  11669:             </li>
1.4       hubertf  11670: 
                   11671:             <li>
                   11672:               <p>Until the webserver on www.NetBSD.org is really
                   11673:               updated automatically to pick up changes to the
1.14      xtraeme  11674:               pkgsrc guide automatically, also run
1.18      xtraeme  11675:               <span><strong class="command">make install-htdocs
1.14      xtraeme  11676:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   11677:               similar, adjust <code class=
                   11678:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  11679:             </li>
                   11680: 
                   11681:             <li>
1.14      xtraeme  11682:               <p><span><strong class="command">cvs commit
                   11683:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  11684:             </li>
1.2       hubertf  11685:           </ul>
                   11686:         </div>
                   11687:       </div>
                   11688:     </div>
1.1       grant    11689:   </div>
                   11690: </body>
                   11691: </html>

CVSweb <webmaster@jp.NetBSD.org>