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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.7       wiz         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.7       wiz        11:   "DocBook XSL Stylesheets V1.67.0" />
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.11    ! ben        22:           <h1 class="title"><a name="id2458324" id=
        !            23:           "id2458324"></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.7       wiz        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.7       wiz        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: 
                     68:         <div>
1.3       hubertf    69:           <p class="pubdate">$NetBSD: pkgsrc.xml,v 1.3 2004/10/22
                     70:           00:24:48 hubertf 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.11    ! ben        96:             <dt><span class="sect1"><a href="#id2514205">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.11    ! ben       120:                 <dt><span class="sect1"><a href="#id2514784">2.1.
1.1       grant     121:                 As tar file</a></span></dt>
                    122: 
1.11    ! ben       123:                 <dt><span class="sect1"><a href="#id2514800">2.2.
1.1       grant     124:                 Via SUP</a></span></dt>
                    125: 
1.11    ! ben       126:                 <dt><span class="sect1"><a href="#id2514900">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.11    ! ben       136:                 <dt><span class="sect1"><a href="#id2515010">3.1.
1.1       grant     137:                 Bootstrapping pkgsrc</a></span></dt>
                    138: 
1.11    ! ben       139:                 <dt><span class="sect1"><a href="#id2515185">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.11    ! ben       145:                     "#id2515191">3.2.1. Darwin (Mac OS
1.1       grant     146:                     X)</a></span></dt>
                    147: 
                    148:                     <dt><span class="sect2"><a href=
1.11    ! ben       149:                     "#id2515490">3.2.2. FreeBSD</a></span></dt>
1.1       grant     150: 
                    151:                     <dt><span class="sect2"><a href=
1.11    ! ben       152:                     "#id2515933">3.2.3. Interix</a></span></dt>
1.1       grant     153: 
                    154:                     <dt><span class="sect2"><a href=
1.11    ! ben       155:                     "#id2516024">3.2.4. IRIX</a></span></dt>
1.1       grant     156: 
                    157:                     <dt><span class="sect2"><a href=
1.11    ! ben       158:                     "#id2516210">3.2.5. OpenBSD</a></span></dt>
1.1       grant     159: 
                    160:                     <dt><span class="sect2"><a href=
1.11    ! ben       161:                     "#id2516322">3.2.6. Solaris</a></span></dt>
1.1       grant     162:                   </dl>
                    163:                 </dd>
                    164:               </dl>
                    165:             </dd>
                    166: 
                    167:             <dt><span class="chapter"><a href="#using">4. Using
                    168:             pkgsrc</a></span></dt>
                    169: 
                    170:             <dd>
                    171:               <dl>
                    172:                 <dt><span class="sect1"><a href=
                    173:                 "#getting-started">4.1. Working with binary
                    174:                 packages</a></span></dt>
                    175: 
                    176:                 <dd>
                    177:                   <dl>
                    178:                     <dt><span class="sect2"><a href=
1.11    ! ben       179:                     "#id2516458">4.1.1. Where to get binary
1.1       grant     180:                     packages</a></span></dt>
                    181: 
                    182:                     <dt><span class="sect2"><a href=
1.11    ! ben       183:                     "#id2516499">4.1.2. How to use binary
1.1       grant     184:                     packages</a></span></dt>
                    185: 
                    186:                     <dt><span class="sect2"><a href=
1.11    ! ben       187:                     "#id2516633">4.1.3. A word of
1.1       grant     188:                     warning</a></span></dt>
                    189:                   </dl>
                    190:                 </dd>
                    191: 
1.11    ! ben       192:                 <dt><span class="sect1"><a href="#id2516645">4.2.
1.1       grant     193:                 Building packages from source</a></span></dt>
                    194: 
                    195:                 <dd>
                    196:                   <dl>
                    197:                     <dt><span class="sect2"><a href=
1.11    ! ben       198:                     "#id2516654">4.2.1.
1.1       grant     199:                     Requirements</a></span></dt>
                    200: 
                    201:                     <dt><span class="sect2"><a href=
1.11    ! ben       202:                     "#id2516675">4.2.2. Fetching
1.1       grant     203:                     distfiles</a></span></dt>
                    204: 
                    205:                     <dt><span class="sect2"><a href=
1.11    ! ben       206:                     "#id2516795">4.2.3. How to build and
1.1       grant     207:                     install</a></span></dt>
                    208: 
                    209:                     <dt><span class="sect2"><a href=
1.11    ! ben       210:                     "#id2517522">4.2.4. Selecting the
1.1       grant     211:                     compiler</a></span></dt>
                    212:                   </dl>
                    213:                 </dd>
                    214:               </dl>
                    215:             </dd>
                    216: 
                    217:             <dt><span class="chapter"><a href="#binary">5. Creating
                    218:             binary packages</a></span></dt>
                    219: 
                    220:             <dd>
                    221:               <dl>
1.11    ! ben       222:                 <dt><span class="sect1"><a href="#id2582803">5.1.
1.1       grant     223:                 Building a single binary package</a></span></dt>
                    224: 
1.11    ! ben       225:                 <dt><span class="sect1"><a href="#id2582881">5.2.
1.1       grant     226:                 Settings for creation of binary
                    227:                 packages</a></span></dt>
                    228: 
                    229:                 <dt><span class="sect1"><a href="#bulkbuild">5.3.
                    230:                 Doing a bulk build of all packages</a></span></dt>
                    231: 
                    232:                 <dd>
                    233:                   <dl>
                    234:                     <dt><span class="sect2"><a href=
                    235:                     "#binary.configuration">5.3.1.
                    236:                     Configuration</a></span></dt>
                    237: 
                    238:                     <dt><span class="sect2"><a href=
1.11    ! ben       239:                     "#id2583020">5.3.2. Other environmental
1.1       grant     240:                     considerations</a></span></dt>
                    241: 
                    242:                     <dt><span class="sect2"><a href=
1.11    ! ben       243:                     "#id2583061">5.3.3. Operation</a></span></dt>
1.1       grant     244: 
                    245:                     <dt><span class="sect2"><a href=
1.11    ! ben       246:                     "#id2583200">5.3.4. What it
1.1       grant     247:                     does</a></span></dt>
                    248: 
                    249:                     <dt><span class="sect2"><a href=
1.11    ! ben       250:                     "#id2583256">5.3.5. Disk space
1.1       grant     251:                     requirements</a></span></dt>
                    252: 
                    253:                     <dt><span class="sect2"><a href=
1.11    ! ben       254:                     "#id2583351">5.3.6. Setting up a sandbox for
1.1       grant     255:                     chroot'ed builds</a></span></dt>
                    256: 
                    257:                     <dt><span class="sect2"><a href=
1.11    ! ben       258:                     "#id2583715">5.3.7. Building a partial set of
1.1       grant     259:                     packages</a></span></dt>
                    260:                   </dl>
                    261:                 </dd>
                    262: 
1.11    ! ben       263:                 <dt><span class="sect1"><a href="#id2583757">5.4.
1.1       grant     264:                 Creating a multiple CD-ROM packages
                    265:                 collection</a></span></dt>
                    266: 
                    267:                 <dd>
                    268:                   <dl>
                    269:                     <dt><span class="sect2"><a href=
1.11    ! ben       270:                     "#id2583772">5.4.1. Example of
1.1       grant     271:                     cdpack</a></span></dt>
                    272:                   </dl>
                    273:                 </dd>
                    274:               </dl>
                    275:             </dd>
                    276: 
                    277:             <dt><span class="chapter"><a href="#faq">6. Frequently
                    278:             Asked Questions</a></span></dt>
                    279: 
                    280:             <dd>
                    281:               <dl>
1.11    ! ben       282:                 <dt><span class="sect1"><a href="#id2584100">6.1.
1.1       grant     283:                 Is there a mailing list for pkg-related
                    284:                 discussion?</a></span></dt>
                    285: 
1.11    ! ben       286:                 <dt><span class="sect1"><a href="#id2584130">6.2.
1.1       grant     287:                 Where's the pkgviews documentation?</a></span></dt>
                    288: 
1.5       hubertf   289:                 <dt><span class="sect1"><a href=
                    290:                 "#faq-pkgtools">6.3. Utilities for package
                    291:                 management (pkgtools)</a></span></dt>
1.1       grant     292: 
1.11    ! ben       293:                 <dt><span class="sect1"><a href="#id2584382">6.4.
1.1       grant     294:                 How to use pkgsrc as non-root</a></span></dt>
                    295: 
1.11    ! ben       296:                 <dt><span class="sect1"><a href="#id2584394">6.5.
1.1       grant     297:                 How can I install/use XFree86 from
                    298:                 pkgsrc?</a></span></dt>
                    299: 
1.11    ! ben       300:                 <dt><span class="sect1"><a href="#id2584422">6.6.
1.1       grant     301:                 How can I install/use X.org from
                    302:                 pkgsrc?</a></span></dt>
                    303: 
1.11    ! ben       304:                 <dt><span class="sect1"><a href="#id2584518">6.7.
1.1       grant     305:                 How to fetch files from behind a
                    306:                 firewall</a></span></dt>
                    307: 
1.11    ! ben       308:                 <dt><span class="sect1"><a href="#id2584532">6.8.
1.7       wiz       309:                 How do I tell <span><strong class="command">make
                    310:                 fetch</strong></span> to do passive
1.1       grant     311:                 FTP?</a></span></dt>
                    312: 
1.11    ! ben       313:                 <dt><span class="sect1"><a href="#id2584651">6.9.
1.1       grant     314:                 How to fetch all distfiles at once</a></span></dt>
                    315: 
1.11    ! ben       316:                 <dt><span class="sect1"><a href="#id2584791">6.10.
1.7       wiz       317:                 What does &#8220;<span class="quote">Don't know how
                    318:                 to make /usr/share/tmac/tmac.andoc</span>&#8221;
                    319:                 mean?</a></span></dt>
1.1       grant     320: 
1.11    ! ben       321:                 <dt><span class="sect1"><a href="#id2584829">6.11.
1.7       wiz       322:                 What does &#8220;<span class="quote">Could not find
                    323:                 bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant     324: 
1.11    ! ben       325:                 <dt><span class="sect1"><a href="#id2584887">6.12.
1.1       grant     326:                 Using 'sudo' with pkgsrc</a></span></dt>
                    327: 
                    328:                 <dt><span class="sect1"><a href="#faq.conf">6.13.
                    329:                 Configuration files handling and
                    330:                 placement</a></span></dt>
                    331: 
                    332:                 <dt><span class="sect1"><a href=
                    333:                 "#audit-packages">6.14. Automated security
                    334:                 checks</a></span></dt>
                    335:               </dl>
                    336:             </dd>
                    337:           </dl>
                    338:         </dd>
                    339: 
1.2       hubertf   340:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     341:         pkgsrc developer's guide</a></span></dt>
                    342: 
                    343:         <dd>
                    344:           <dl>
                    345:             <dt><span class="chapter"><a href="#components">7.
                    346:             Package components - files, directories and
                    347:             contents</a></span></dt>
                    348: 
                    349:             <dd>
                    350:               <dl>
                    351:                 <dt><span class="sect1"><a href=
1.7       wiz       352:                 "#components.Makefile">7.1. <code class=
                    353:                 "filename">Makefile</code></a></span></dt>
1.1       grant     354: 
                    355:                 <dt><span class="sect1"><a href=
1.7       wiz       356:                 "#components.distinfo">7.2. <code class=
                    357:                 "filename">distinfo</code></a></span></dt>
1.1       grant     358: 
                    359:                 <dt><span class="sect1"><a href=
                    360:                 "#components.patches">7.3.
                    361:                 patches/*</a></span></dt>
                    362: 
1.11    ! ben       363:                 <dt><span class="sect1"><a href="#id2586001">7.4.
1.1       grant     364:                 Other mandatory files</a></span></dt>
                    365: 
                    366:                 <dt><span class="sect1"><a href=
                    367:                 "#components.optional">7.5. Optional
                    368:                 files</a></span></dt>
                    369: 
1.11    ! ben       370:                 <dt><span class="sect1"><a href="#id2586126">7.6.
1.7       wiz       371:                 <code class="filename">work*</code></a></span></dt>
1.1       grant     372: 
1.11    ! ben       373:                 <dt><span class="sect1"><a href="#id2586214">7.7.
1.7       wiz       374:                 <code class=
                    375:                 "filename">files/*</code></a></span></dt>
1.1       grant     376:               </dl>
                    377:             </dd>
                    378: 
                    379:             <dt><span class="chapter"><a href="#plist">8. PLIST
                    380:             issues</a></span></dt>
                    381: 
                    382:             <dd>
                    383:               <dl>
1.11    ! ben       384:                 <dt><span class="sect1"><a href="#id2586268">8.1.
1.1       grant     385:                 RCS ID</a></span></dt>
                    386: 
1.11    ! ben       387:                 <dt><span class="sect1"><a href="#id2586283">8.2.
1.7       wiz       388:                 Semi-automatic <code class="filename">PLIST</code>
                    389:                 generation</a></span></dt>
1.1       grant     390: 
                    391:                 <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.7       wiz       392:                 Tweaking output of <span><strong class=
                    393:                 "command">make
                    394:                 print-PLIST</strong></span></a></span></dt>
1.1       grant     395: 
                    396:                 <dt><span class="sect1"><a href="#plist.misc">8.4.
                    397:                 Variable substitution in PLIST</a></span></dt>
                    398: 
1.11    ! ben       399:                 <dt><span class="sect1"><a href="#id2586673">8.5.
1.1       grant     400:                 Manpage-compression</a></span></dt>
                    401: 
1.11    ! ben       402:                 <dt><span class="sect1"><a href="#id2586714">8.6.
1.7       wiz       403:                 Changing PLIST source with <code class=
                    404:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     405: 
1.11    ! ben       406:                 <dt><span class="sect1"><a href="#id2586731">8.7.
1.1       grant     407:                 Platform specific and differing
                    408:                 PLISTs</a></span></dt>
                    409: 
                    410:                 <dt><span class="sect1"><a href=
                    411:                 "#faq.common-dirs">8.8. Sharing directories between
                    412:                 packages</a></span></dt>
                    413:               </dl>
                    414:             </dd>
                    415: 
                    416:             <dt><span class="chapter"><a href="#buildlink">9.
                    417:             Buildlink methodology</a></span></dt>
                    418: 
                    419:             <dd>
                    420:               <dl>
1.11    ! ben       421:                 <dt><span class="sect1"><a href="#id2587003">9.1.
1.1       grant     422:                 Converting packages to use
                    423:                 buildlink3</a></span></dt>
                    424: 
1.11    ! ben       425:                 <dt><span class="sect1"><a href="#id2587194">9.2.
1.7       wiz       426:                 Writing <code class="filename">buildlink3.mk</code>
                    427:                 files</a></span></dt>
1.1       grant     428: 
                    429:                 <dd>
                    430:                   <dl>
                    431:                     <dt><span class="sect2"><a href=
1.11    ! ben       432:                     "#id2587400">9.2.1. Anatomy of a buildlink3.mk
1.1       grant     433:                     file</a></span></dt>
                    434: 
                    435:                     <dt><span class="sect2"><a href=
1.11    ! ben       436:                     "#id2587977">9.2.2. Updating <code class=
1.7       wiz       437:                     "varname">BUILDLINK_DEPENDS.<em class=
                    438:                     "replaceable"><code>pkg</code></em></code> in
                    439:                     <code class="filename">buildlink3.mk</code>
1.1       grant     440:                     files</a></span></dt>
                    441:                   </dl>
                    442:                 </dd>
                    443: 
1.11    ! ben       444:                 <dt><span class="sect1"><a href="#id2588056">9.3.
1.7       wiz       445:                 Writing <code class="filename">builtin.mk</code>
                    446:                 files</a></span></dt>
1.1       grant     447: 
                    448:                 <dd>
                    449:                   <dl>
                    450:                     <dt><span class="sect2"><a href=
1.11    ! ben       451:                     "#id2588137">9.3.1. Anatomy of a <code class=
1.7       wiz       452:                     "filename">builtin.mk</code>
1.1       grant     453:                     file</a></span></dt>
                    454: 
                    455:                     <dt><span class="sect2"><a href=
1.11    ! ben       456:                     "#id2588296">9.3.2. Global preferences for
1.1       grant     457:                     native or pkgsrc software</a></span></dt>
                    458:                   </dl>
                    459:                 </dd>
                    460:               </dl>
                    461:             </dd>
                    462: 
                    463:             <dt><span class="chapter"><a href="#options">10.
                    464:             Options handling</a></span></dt>
                    465: 
                    466:             <dd>
                    467:               <dl>
1.11    ! ben       468:                 <dt><span class="sect1"><a href="#id2588437">10.1.
1.1       grant     469:                 Global default options</a></span></dt>
                    470: 
1.11    ! ben       471:                 <dt><span class="sect1"><a href="#id2588452">10.2.
1.7       wiz       472:                 Converting packages to use <code class=
                    473:                 "filename">bsd.options.mk</code></a></span></dt>
1.1       grant     474:               </dl>
                    475:             </dd>
                    476: 
                    477:             <dt><span class="chapter"><a href="#build">11. The
                    478:             build process</a></span></dt>
                    479: 
                    480:             <dd>
                    481:               <dl>
                    482:                 <dt><span class="sect1"><a href=
                    483:                 "#build.prefix">11.1. Program
                    484:                 location</a></span></dt>
                    485: 
1.11    ! ben       486:                 <dt><span class="sect1"><a href="#id2589128">11.2.
1.1       grant     487:                 Main targets</a></span></dt>
                    488: 
                    489:                 <dt><span class="sect1"><a href=
                    490:                 "#build.helpful-targets">11.3. Other helpful
                    491:                 targets</a></span></dt>
                    492:               </dl>
                    493:             </dd>
                    494: 
                    495:             <dt><span class="chapter"><a href="#fixes">12. Notes on
                    496:             fixes for packages</a></span></dt>
                    497: 
                    498:             <dd>
                    499:               <dl>
1.11    ! ben       500:                 <dt><span class="sect1"><a href="#id2590529">12.1.
1.1       grant     501:                 General operation</a></span></dt>
                    502: 
                    503:                 <dd>
                    504:                   <dl>
                    505:                     <dt><span class="sect2"><a href=
1.11    ! ben       506:                     "#id2590532">12.1.1. How to pull in variables
1.1       grant     507:                     from /etc/mk.conf</a></span></dt>
                    508: 
                    509:                     <dt><span class="sect2"><a href=
1.11    ! ben       510:                     "#id2590615">12.1.2. Restricted
1.1       grant     511:                     packages</a></span></dt>
                    512: 
                    513:                     <dt><span class="sect2"><a href=
                    514:                     "#dependencies">12.1.3. Handling
                    515:                     dependencies</a></span></dt>
                    516: 
                    517:                     <dt><span class="sect2"><a href=
1.11    ! ben       518:                     "#id2591198">12.1.4. Handling conflicts with
1.1       grant     519:                     other packages</a></span></dt>
                    520: 
                    521:                     <dt><span class="sect2"><a href=
1.11    ! ben       522:                     "#id2591249">12.1.5. Packages that cannot or
1.1       grant     523:                     should not be built</a></span></dt>
                    524: 
                    525:                     <dt><span class="sect2"><a href=
1.11    ! ben       526:                     "#id2591342">12.1.6. Packages which should not
1.1       grant     527:                     be deleted, once installed</a></span></dt>
                    528: 
                    529:                     <dt><span class="sect2"><a href=
                    530:                     "#security-handling">12.1.7. Handling packages
                    531:                     with security problems</a></span></dt>
                    532: 
                    533:                     <dt><span class="sect2"><a href=
1.11    ! ben       534:                     "#id2591434">12.1.8. How to handle compiler
1.1       grant     535:                     bugs</a></span></dt>
                    536: 
                    537:                     <dt><span class="sect2"><a href=
1.11    ! ben       538:                     "#id2591457">12.1.9. How to handle incrementing
1.1       grant     539:                     versions when fixing an existing
                    540:                     package</a></span></dt>
                    541: 
                    542:                     <dt><span class="sect2"><a href=
1.11    ! ben       543:                     "#id2591574">12.1.10. Portability of
1.1       grant     544:                     packages</a></span></dt>
                    545:                   </dl>
                    546:                 </dd>
                    547: 
1.11    ! ben       548:                 <dt><span class="sect1"><a href="#id2591598">12.2.
1.1       grant     549:                 Possible downloading issues</a></span></dt>
                    550: 
                    551:                 <dd>
                    552:                   <dl>
                    553:                     <dt><span class="sect2"><a href=
1.11    ! ben       554:                     "#id2591602">12.2.1. Packages whose distfiles
1.1       grant     555:                     aren't available for plain
                    556:                     downloading</a></span></dt>
                    557: 
                    558:                     <dt><span class="sect2"><a href=
1.11    ! ben       559:                     "#id2591665">12.2.2. How to handle modified
1.1       grant     560:                     distfiles with the 'old' name</a></span></dt>
                    561:                   </dl>
                    562:                 </dd>
                    563: 
1.11    ! ben       564:                 <dt><span class="sect1"><a href="#id2591676">12.3.
1.1       grant     565:                 Configuration gotchas</a></span></dt>
                    566: 
                    567:                 <dd>
                    568:                   <dl>
                    569:                     <dt><span class="sect2"><a href=
                    570:                     "#fixes.libtool">12.3.1. Shared libraries -
                    571:                     libtool</a></span></dt>
                    572: 
                    573:                     <dt><span class="sect2"><a href=
1.11    ! ben       574:                     "#id2592016">12.3.2. Using libtool on GNU
1.1       grant     575:                     packages that already support
                    576:                     libtool</a></span></dt>
                    577: 
                    578:                     <dt><span class="sect2"><a href=
1.11    ! ben       579:                     "#id2592168">12.3.3. GNU
1.1       grant     580:                     Autoconf/Automake</a></span></dt>
                    581:                   </dl>
                    582:                 </dd>
                    583: 
1.11    ! ben       584:                 <dt><span class="sect1"><a href="#id2592213">12.4.
1.1       grant     585:                 Building considerations</a></span></dt>
                    586: 
                    587:                 <dd>
                    588:                   <dl>
                    589:                     <dt><span class="sect2"><a href=
1.11    ! ben       590:                     "#id2592216">12.4.1. CPP
1.1       grant     591:                     defines</a></span></dt>
                    592:                   </dl>
                    593:                 </dd>
                    594: 
1.11    ! ben       595:                 <dt><span class="sect1"><a href="#id2592314">12.5.
1.1       grant     596:                 Package specific actions</a></span></dt>
                    597: 
                    598:                 <dd>
                    599:                   <dl>
                    600:                     <dt><span class="sect2"><a href=
1.11    ! ben       601:                     "#id2592317">12.5.1. Package configuration
1.1       grant     602:                     files</a></span></dt>
                    603: 
                    604:                     <dt><span class="sect2"><a href=
1.11    ! ben       605:                     "#id2592420">12.5.2. User
1.2       hubertf   606:                     interaction</a></span></dt>
1.1       grant     607: 
                    608:                     <dt><span class="sect2"><a href=
1.11    ! ben       609:                     "#id2592465">12.5.3. Handling
1.1       grant     610:                     licenses</a></span></dt>
                    611: 
                    612:                     <dt><span class="sect2"><a href=
1.11    ! ben       613:                     "#id2592616">12.5.4. Creating an account from a
1.1       grant     614:                     package</a></span></dt>
                    615: 
                    616:                     <dt><span class="sect2"><a href=
1.11    ! ben       617:                     "#id2592678">12.5.5. Installing score
1.1       grant     618:                     files</a></span></dt>
                    619: 
                    620:                     <dt><span class="sect2"><a href=
1.11    ! ben       621:                     "#id2592858">12.5.6. Packages providing login
1.1       grant     622:                     shells</a></span></dt>
                    623: 
                    624:                     <dt><span class="sect2"><a href=
1.11    ! ben       625:                     "#id2592984">12.5.7. Packages containing perl
1.1       grant     626:                     scripts</a></span></dt>
                    627: 
                    628:                     <dt><span class="sect2"><a href=
1.11    ! ben       629:                     "#id2593002">12.5.8. Packages with hardcoded
1.1       grant     630:                     paths to other interpreters</a></span></dt>
                    631: 
                    632:                     <dt><span class="sect2"><a href=
1.11    ! ben       633:                     "#id2593024">12.5.9. Packages installing perl
1.1       grant     634:                     modules</a></span></dt>
                    635: 
                    636:                     <dt><span class="sect2"><a href=
                    637:                     "#faq.info-files">12.5.10. Packages installing
                    638:                     info files</a></span></dt>
                    639: 
                    640:                     <dt><span class="sect2"><a href=
1.11    ! ben       641:                     "#id2593380">12.5.11. Packages installing
1.1       grant     642:                     GConf2 data files</a></span></dt>
                    643: 
                    644:                     <dt><span class="sect2"><a href=
1.11    ! ben       645:                     "#id2593480">12.5.12. Packages installing
1.1       grant     646:                     scrollkeeper data files</a></span></dt>
                    647: 
                    648:                     <dt><span class="sect2"><a href=
1.11    ! ben       649:                     "#id2593531">12.5.13. Packages installing X11
1.1       grant     650:                     fonts</a></span></dt>
                    651: 
                    652:                     <dt><span class="sect2"><a href=
1.11    ! ben       653:                     "#id2593578">12.5.14. Packages installing GTK2
1.1       grant     654:                     modules</a></span></dt>
                    655: 
                    656:                     <dt><span class="sect2"><a href=
1.11    ! ben       657:                     "#id2593648">12.5.15. Packages installing SGML
1.1       grant     658:                     or XML data</a></span></dt>
                    659: 
                    660:                     <dt><span class="sect2"><a href=
1.11    ! ben       661:                     "#id2593700">12.5.16. Packages installing
1.1       grant     662:                     extensions to the MIME database</a></span></dt>
                    663: 
                    664:                     <dt><span class="sect2"><a href=
1.11    ! ben       665:                     "#id2593770">12.5.17. Packages using
1.1       grant     666:                     intltool</a></span></dt>
                    667:                   </dl>
                    668:                 </dd>
                    669: 
1.11    ! ben       670:                 <dt><span class="sect1"><a href="#id2593784">12.6.
1.1       grant     671:                 Feedback to the author</a></span></dt>
                    672:               </dl>
                    673:             </dd>
                    674: 
                    675:             <dt><span class="chapter"><a href="#debug">13.
                    676:             Debugging</a></span></dt>
                    677: 
                    678:             <dt><span class="chapter"><a href="#submit">14.
                    679:             Submitting and Committing</a></span></dt>
                    680: 
                    681:             <dd>
                    682:               <dl>
1.11    ! ben       683:                 <dt><span class="sect1"><a href="#id2594314">14.1.
1.1       grant     684:                 Submitting your packages</a></span></dt>
                    685: 
1.11    ! ben       686:                 <dt><span class="sect1"><a href="#id2594361">14.2.
1.1       grant     687:                 Committing: Importing a package into
                    688:                 CVS</a></span></dt>
                    689: 
1.11    ! ben       690:                 <dt><span class="sect1"><a href="#id2594492">14.3.
1.2       hubertf   691:                 Updating a package to a newer
                    692:                 version</a></span></dt>
1.1       grant     693: 
1.11    ! ben       694:                 <dt><span class="sect1"><a href="#id2594512">14.4.
1.2       hubertf   695:                 Moving a package in pkgsrc</a></span></dt>
1.1       grant     696:               </dl>
                    697:             </dd>
                    698:           </dl>
                    699:         </dd>
                    700: 
                    701:         <dt><span class="appendix"><a href="#examples">A. A simple
                    702:         example package: bison</a></span></dt>
                    703: 
                    704:         <dd>
                    705:           <dl>
1.11    ! ben       706:             <dt><span class="sect1"><a href="#id2594806">A.1.
1.1       grant     707:             files</a></span></dt>
                    708: 
                    709:             <dd>
                    710:               <dl>
1.11    ! ben       711:                 <dt><span class="sect2"><a href="#id2594809">A.1.1.
1.1       grant     712:                 Makefile</a></span></dt>
                    713: 
1.11    ! ben       714:                 <dt><span class="sect2"><a href="#id2594817">A.1.2.
1.1       grant     715:                 DESCR</a></span></dt>
                    716: 
1.11    ! ben       717:                 <dt><span class="sect2"><a href="#id2594832">A.1.3.
1.1       grant     718:                 PLIST</a></span></dt>
                    719: 
1.11    ! ben       720:                 <dt><span class="sect2"><a href="#id2594839">A.1.4.
1.7       wiz       721:                 Checking a package with <span><strong class=
                    722:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant     723:               </dl>
                    724:             </dd>
                    725: 
1.11    ! ben       726:             <dt><span class="sect1"><a href="#id2594880">A.2. Steps
1.1       grant     727:             for building, installing, packaging</a></span></dt>
                    728:           </dl>
                    729:         </dd>
                    730: 
                    731:         <dt><span class="appendix"><a href="#logs">B. Build
                    732:         logs</a></span></dt>
                    733: 
                    734:         <dd>
                    735:           <dl>
                    736:             <dt><span class="sect1"><a href="#logs.building">B.1.
                    737:             Building figlet</a></span></dt>
                    738: 
                    739:             <dt><span class="sect1"><a href="#logs.package">B.2.
                    740:             Packaging figlet</a></span></dt>
                    741:           </dl>
                    742:         </dd>
                    743: 
                    744:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
                    745:         of the FTP server's package archive</a></span></dt>
1.2       hubertf   746: 
                    747:         <dt><span class="appendix"><a href="#editing">D. Editing
                    748:         guidelines for the pkgsrc guide</a></span></dt>
                    749: 
                    750:         <dd>
                    751:           <dl>
1.11    ! ben       752:             <dt><span class="sect1"><a href="#id2595799">D.1.
1.2       hubertf   753:             Targets</a></span></dt>
                    754: 
1.11    ! ben       755:             <dt><span class="sect1"><a href="#id2595869">D.2.
1.2       hubertf   756:             Procedure</a></span></dt>
                    757:           </dl>
                    758:         </dd>
1.1       grant     759:       </dl>
                    760:     </div>
                    761: 
                    762:     <div class="chapter" lang="en" xml:lang="en">
                    763:       <div class="titlepage">
                    764:         <div>
                    765:           <div>
                    766:             <h2 class="title"><a name="introduction" id=
                    767:             "introduction"></a>Chapter&nbsp;1.&nbsp;Introduction</h2>
                    768:           </div>
                    769:         </div>
                    770:       </div>
                    771: 
                    772:       <div class="toc">
                    773:         <p><b>Table of Contents</b></p>
                    774: 
                    775:         <dl>
1.11    ! ben       776:           <dt><span class="sect1"><a href="#id2514205">1.1.
1.1       grant     777:           Introduction</a></span></dt>
                    778: 
                    779:           <dt><span class="sect1"><a href="#overview">1.2.
                    780:           Overview</a></span></dt>
                    781: 
                    782:           <dt><span class="sect1"><a href="#terminology">1.3.
                    783:           Terminology</a></span></dt>
                    784: 
                    785:           <dt><span class="sect1"><a href="#typography">1.4.
                    786:           Typography</a></span></dt>
                    787:         </dl>
                    788:       </div>
                    789: 
                    790:       <div class="sect1" lang="en" xml:lang="en">
                    791:         <div class="titlepage">
                    792:           <div>
                    793:             <div>
                    794:               <h2 class="title" style="clear: both"><a name=
1.11    ! ben       795:               "id2514205" id=
        !           796:               "id2514205"></a>1.1.&nbsp;Introduction</h2>
1.1       grant     797:             </div>
                    798:           </div>
                    799:         </div>
                    800: 
                    801:         <p>There is a lot of software freely available for Unix
                    802:         based systems, which usually runs on NetBSD and other
                    803:         Unix-flavoured systems, too, sometimes with some
                    804:         modifications. The NetBSD Packages Collection (pkgsrc)
                    805:         incorporates any such changes necessary to make that
                    806:         software run, and makes the installation (and
                    807:         de-installation) of the software package easy by means of a
                    808:         single command.</p>
                    809: 
                    810:         <p>Once the software has been built, it is manipulated with
1.7       wiz       811:         the <span><strong class="command">pkg_*</strong></span>
                    812:         tools so that installation and de-installation, printing of
                    813:         an inventory of all installed packages and retrieval of
                    814:         one-line comments or more verbose descriptions are all
                    815:         simple.</p>
1.1       grant     816: 
                    817:         <p>pkgsrc currently contains several thousand packages,
                    818:         including:</p>
                    819: 
                    820:         <div class="itemizedlist">
                    821:           <ul type="disc">
                    822:             <li>
                    823:               <p><a xmlns=
                    824:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    825:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.7       wiz       826:               class="pkgname">www/apache</a> - The Apache web
                    827:               server</p>
1.1       grant     828:             </li>
                    829: 
                    830:             <li>
                    831:               <p><a xmlns=
                    832:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    833:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.7       wiz       834:               class="pkgname">www/mozilla</a> - The Mozilla web
                    835:               browser</p>
1.1       grant     836:             </li>
                    837: 
                    838:             <li>
                    839:               <p><a xmlns=
                    840:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    841:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.7       wiz       842:               class="pkgname">meta-pkgs/gnome</a> - The GNOME
                    843:               Desktop Environment</p>
1.1       grant     844:             </li>
                    845: 
                    846:             <li>
                    847:               <p><a xmlns=
                    848:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    849:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.7       wiz       850:               class="pkgname">meta-pkgs/kde3</a> - The K Desktop
                    851:               Environment</p>
1.1       grant     852:             </li>
                    853:           </ul>
                    854:         </div>
                    855: 
                    856:         <p>...just to name a few.</p>
                    857: 
                    858:         <p>pkgsrc has built-in support for handling varying
                    859:         dependencies, such as pthreads and X11, and extended
                    860:         features such as IPv6 support on a range of platforms.</p>
                    861: 
                    862:         <p>pkgsrc was derived from FreeBSD's ports system, and
                    863:         initially developed for NetBSD only. Since then, pkgsrc has
                    864:         grown a lot, and now supports the following platforms:</p>
                    865: 
                    866:         <div class="itemizedlist">
                    867:           <ul type="disc">
                    868:             <li>
                    869:               <p><a href="http://developer.apple.com/darwin/"
                    870:               target="_top">Darwin</a> (<a href=
                    871:               "http://www.apple.com/macosx/" target="_top">Mac OS
                    872:               X</a>)</p>
                    873:             </li>
                    874: 
                    875:             <li>
1.3       hubertf   876:               <p><a href="http://www.DragonFlyBSD.org/" target=
                    877:               "_top">DragonFlyBSD</a></p>
                    878:             </li>
                    879: 
                    880:             <li>
1.1       grant     881:               <p><a href="http://www.FreeBSD.org/" target=
                    882:               "_top">FreeBSD</a></p>
                    883:             </li>
                    884: 
                    885:             <li>
1.3       hubertf   886:               <p>Microsoft Windows, via <a href=
                    887:               "http://www.microsoft.com/windows/sfu/" target=
                    888:               "_top">Interix</a></p>
1.1       grant     889:             </li>
                    890: 
                    891:             <li>
                    892:               <p><a href="http://www.sgi.com/software/irix6.5/"
                    893:               target="_top">IRIX</a></p>
                    894:             </li>
                    895: 
                    896:             <li>
                    897:               <p><a href="http://www.linux.org/" target=
                    898:               "_top">Linux</a></p>
                    899:             </li>
                    900: 
                    901:             <li>
                    902:               <p><a href="http://www.NetBSD.org/" target=
                    903:               "_top">NetBSD</a> (of course)</p>
                    904:             </li>
                    905: 
                    906:             <li>
                    907:               <p><a href="http://www.openbsd.org/" target=
                    908:               "_top">OpenBSD</a></p>
                    909:             </li>
                    910: 
                    911:             <li>
                    912:               <p><a href="http://www.sun.com/solaris/" target=
                    913:               "_top">Solaris</a></p>
                    914:             </li>
                    915:           </ul>
                    916:         </div>
                    917:       </div>
                    918: 
                    919:       <div class="sect1" lang="en" xml:lang="en">
                    920:         <div class="titlepage">
                    921:           <div>
                    922:             <div>
                    923:               <h2 class="title" style="clear: both"><a name=
                    924:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
                    925:             </div>
                    926:           </div>
                    927:         </div>
                    928: 
                    929:         <p>This document is divided into two parts. The first,
                    930:         <a href="#users-guide" title=
1.2       hubertf   931:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
                    932:         user's guide</a>, describes how one can use one of the
                    933:         packages in the Package Collection, either by installing a
                    934:         precompiled binary package, or by building one's own copy
                    935:         using the NetBSD package system. The second part, <a href=
1.1       grant     936:         "#developers-guide" title=
1.2       hubertf   937:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                    938:         pkgsrc developer's guide</a>, explains how to prepare a
                    939:         package so it can be easily built by other NetBSD users
                    940:         without knowing about the package's building details.</p>
1.1       grant     941: 
                    942:         <p>This document is available in various formats:</p>
                    943: 
                    944:         <div class="itemizedlist">
                    945:           <ul type="disc">
                    946:             <li>
                    947:               <p><a href="index.html" target="_top">HTML</a></p>
                    948:             </li>
                    949: 
                    950:             <li>
                    951:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                    952:             </li>
                    953: 
                    954:             <li>
                    955:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                    956:             </li>
                    957: 
                    958:             <li>
                    959:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                    960:             </li>
                    961:           </ul>
                    962:         </div>
                    963:       </div>
                    964: 
                    965:       <div class="sect1" lang="en" xml:lang="en">
                    966:         <div class="titlepage">
                    967:           <div>
                    968:             <div>
                    969:               <h2 class="title" style="clear: both"><a name=
                    970:               "terminology" id=
                    971:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                    972:             </div>
                    973:           </div>
                    974:         </div>
                    975: 
                    976:         <p>There has been a lot of talk about &#8220;<span class=
                    977:         "quote">ports</span>&#8221;, &#8220;<span class=
                    978:         "quote">packages</span>&#8221;, etc. so far. Here is a
                    979:         description of all the terminology used within this
                    980:         document.</p>
                    981: 
                    982:         <div class="variablelist">
                    983:           <dl>
                    984:             <dt><span class="term">Package</span></dt>
                    985: 
                    986:             <dd>
                    987:               <p>A set of files and building instructions that
                    988:               describe what's necessary to build a certain piece of
                    989:               software using pkgsrc. Packages are traditionally
1.7       wiz       990:               stored under <code class=
                    991:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant     992:             </dd>
                    993: 
                    994:             <dt><span class="term">The NetBSD package
                    995:             system</span></dt>
                    996: 
                    997:             <dd>
                    998:               <p>This is the former name of &#8220;<span class=
                    999:               "quote">pkgsrc</span>&#8221;. It is part of the
                   1000:               NetBSD operating system and can be bootstrap to run
                   1001:               on non-NetBSD operating systems as well. It handles
                   1002:               building (compiling), installing, and removing of
                   1003:               packages.</p>
                   1004:             </dd>
                   1005: 
                   1006:             <dt><span class="term">Distfile</span></dt>
                   1007: 
                   1008:             <dd>
                   1009:               <p>This term describes the file or files that are
                   1010:               provided by the author of the piece of software to
                   1011:               distribute his work. All the changes necessary to
                   1012:               build on NetBSD are reflected in the corresponding
                   1013:               package. Usually the distfile is in the form of a
                   1014:               compressed tar-archive, but other types are possible,
1.7       wiz      1015:               too. Distfiles are usually stored below <code class=
                   1016:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1017:             </dd>
                   1018: 
                   1019:             <dt><span class="term">Port</span></dt>
                   1020: 
                   1021:             <dd>
                   1022:               <p>This is the term used by FreeBSD and OpenBSD
                   1023:               people for what we call a package. In NetBSD
                   1024:               terminology, &#8220;<span class=
                   1025:               "quote">port</span>&#8221; refers to a different
                   1026:               architecture.</p>
                   1027:             </dd>
                   1028: 
                   1029:             <dt><span class="term">Precompiled/binary
                   1030:             package</span></dt>
                   1031: 
                   1032:             <dd>
                   1033:               <p>A set of binaries built with pkgsrc from a
1.7       wiz      1034:               distfile and stuffed together in a single
                   1035:               <code class="filename">.tgz</code> file so it can be
                   1036:               installed on machines of the same machine
                   1037:               architecture without the need to recompile. Packages
                   1038:               are usually generated in <code class=
                   1039:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1040:               an archive on <a href=
1.1       grant    1041:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1042:               "_top">ftp.NetBSD.org</a>.</p>
                   1043: 
                   1044:               <p>Sometimes, this is referred to by the term
                   1045:               &#8220;<span class="quote">package</span>&#8221; too,
                   1046:               especially in the context of precompiled
                   1047:               packages.</p>
                   1048:             </dd>
                   1049: 
                   1050:             <dt><span class="term">Program</span></dt>
                   1051: 
                   1052:             <dd>
                   1053:               <p>The piece of software to be installed which will
                   1054:               be constructed from all the files in the Distfile by
                   1055:               the actions defined in the corresponding package.</p>
                   1056:             </dd>
                   1057:           </dl>
                   1058:         </div>
                   1059:       </div>
                   1060: 
                   1061:       <div class="sect1" lang="en" xml:lang="en">
                   1062:         <div class="titlepage">
                   1063:           <div>
                   1064:             <div>
                   1065:               <h2 class="title" style="clear: both"><a name=
                   1066:               "typography" id=
                   1067:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1068:             </div>
                   1069:           </div>
                   1070:         </div>
                   1071: 
                   1072:         <p>When giving examples for commands, shell prompts are
                   1073:         used to show if the command should/can be issued as root,
                   1074:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.7       wiz      1075:         privileges are sufficient. We use a <code class=
                   1076:         "prompt">#</code> for root's shell prompt, and a
                   1077:         <code class="prompt">$</code> for users' shell prompt,
                   1078:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1079:       </div>
                   1080:     </div>
                   1081: 
                   1082:     <div class="part" lang="en" xml:lang="en">
                   1083:       <div class="titlepage">
                   1084:         <div>
                   1085:           <div>
                   1086:             <h1 class="title"><a name="users-guide" id=
1.2       hubertf  1087:             "users-guide"></a>The pkgsrc user's guide</h1>
1.1       grant    1088:           </div>
                   1089:         </div>
                   1090:       </div>
                   1091: 
                   1092:       <div class="toc">
                   1093:         <p><b>Table of Contents</b></p>
                   1094: 
                   1095:         <dl>
                   1096:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1097:           get pkgsrc</a></span></dt>
                   1098: 
                   1099:           <dd>
                   1100:             <dl>
1.11    ! ben      1101:               <dt><span class="sect1"><a href="#id2514784">2.1. As
1.1       grant    1102:               tar file</a></span></dt>
                   1103: 
1.11    ! ben      1104:               <dt><span class="sect1"><a href="#id2514800">2.2. Via
1.1       grant    1105:               SUP</a></span></dt>
                   1106: 
1.11    ! ben      1107:               <dt><span class="sect1"><a href="#id2514900">2.3. Via
1.1       grant    1108:               CVS</a></span></dt>
                   1109:             </dl>
                   1110:           </dd>
                   1111: 
                   1112:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1113:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1114: 
                   1115:           <dd>
                   1116:             <dl>
1.11    ! ben      1117:               <dt><span class="sect1"><a href="#id2515010">3.1.
1.1       grant    1118:               Bootstrapping pkgsrc</a></span></dt>
                   1119: 
1.11    ! ben      1120:               <dt><span class="sect1"><a href="#id2515185">3.2.
1.1       grant    1121:               Platform specific notes</a></span></dt>
                   1122: 
                   1123:               <dd>
                   1124:                 <dl>
                   1125:                   <dt><span class="sect2"><a href=
1.11    ! ben      1126:                   "#id2515191">3.2.1. Darwin (Mac OS
1.1       grant    1127:                   X)</a></span></dt>
                   1128: 
                   1129:                   <dt><span class="sect2"><a href=
1.11    ! ben      1130:                   "#id2515490">3.2.2. FreeBSD</a></span></dt>
1.1       grant    1131: 
                   1132:                   <dt><span class="sect2"><a href=
1.11    ! ben      1133:                   "#id2515933">3.2.3. Interix</a></span></dt>
1.1       grant    1134: 
                   1135:                   <dt><span class="sect2"><a href=
1.11    ! ben      1136:                   "#id2516024">3.2.4. IRIX</a></span></dt>
1.1       grant    1137: 
                   1138:                   <dt><span class="sect2"><a href=
1.11    ! ben      1139:                   "#id2516210">3.2.5. OpenBSD</a></span></dt>
1.1       grant    1140: 
                   1141:                   <dt><span class="sect2"><a href=
1.11    ! ben      1142:                   "#id2516322">3.2.6. Solaris</a></span></dt>
1.1       grant    1143:                 </dl>
                   1144:               </dd>
                   1145:             </dl>
                   1146:           </dd>
                   1147: 
                   1148:           <dt><span class="chapter"><a href="#using">4. Using
                   1149:           pkgsrc</a></span></dt>
                   1150: 
                   1151:           <dd>
                   1152:             <dl>
                   1153:               <dt><span class="sect1"><a href=
                   1154:               "#getting-started">4.1. Working with binary
                   1155:               packages</a></span></dt>
                   1156: 
                   1157:               <dd>
                   1158:                 <dl>
                   1159:                   <dt><span class="sect2"><a href=
1.11    ! ben      1160:                   "#id2516458">4.1.1. Where to get binary
1.1       grant    1161:                   packages</a></span></dt>
                   1162: 
                   1163:                   <dt><span class="sect2"><a href=
1.11    ! ben      1164:                   "#id2516499">4.1.2. How to use binary
1.1       grant    1165:                   packages</a></span></dt>
                   1166: 
                   1167:                   <dt><span class="sect2"><a href=
1.11    ! ben      1168:                   "#id2516633">4.1.3. A word of
1.1       grant    1169:                   warning</a></span></dt>
                   1170:                 </dl>
                   1171:               </dd>
                   1172: 
1.11    ! ben      1173:               <dt><span class="sect1"><a href="#id2516645">4.2.
1.1       grant    1174:               Building packages from source</a></span></dt>
                   1175: 
                   1176:               <dd>
                   1177:                 <dl>
                   1178:                   <dt><span class="sect2"><a href=
1.11    ! ben      1179:                   "#id2516654">4.2.1. Requirements</a></span></dt>
1.1       grant    1180: 
                   1181:                   <dt><span class="sect2"><a href=
1.11    ! ben      1182:                   "#id2516675">4.2.2. Fetching
1.1       grant    1183:                   distfiles</a></span></dt>
                   1184: 
                   1185:                   <dt><span class="sect2"><a href=
1.11    ! ben      1186:                   "#id2516795">4.2.3. How to build and
1.1       grant    1187:                   install</a></span></dt>
                   1188: 
                   1189:                   <dt><span class="sect2"><a href=
1.11    ! ben      1190:                   "#id2517522">4.2.4. Selecting the
1.1       grant    1191:                   compiler</a></span></dt>
                   1192:                 </dl>
                   1193:               </dd>
                   1194:             </dl>
                   1195:           </dd>
                   1196: 
                   1197:           <dt><span class="chapter"><a href="#binary">5. Creating
                   1198:           binary packages</a></span></dt>
                   1199: 
                   1200:           <dd>
                   1201:             <dl>
1.11    ! ben      1202:               <dt><span class="sect1"><a href="#id2582803">5.1.
1.1       grant    1203:               Building a single binary package</a></span></dt>
                   1204: 
1.11    ! ben      1205:               <dt><span class="sect1"><a href="#id2582881">5.2.
1.1       grant    1206:               Settings for creation of binary
                   1207:               packages</a></span></dt>
                   1208: 
                   1209:               <dt><span class="sect1"><a href="#bulkbuild">5.3.
                   1210:               Doing a bulk build of all packages</a></span></dt>
                   1211: 
                   1212:               <dd>
                   1213:                 <dl>
                   1214:                   <dt><span class="sect2"><a href=
                   1215:                   "#binary.configuration">5.3.1.
                   1216:                   Configuration</a></span></dt>
                   1217: 
                   1218:                   <dt><span class="sect2"><a href=
1.11    ! ben      1219:                   "#id2583020">5.3.2. Other environmental
1.1       grant    1220:                   considerations</a></span></dt>
                   1221: 
                   1222:                   <dt><span class="sect2"><a href=
1.11    ! ben      1223:                   "#id2583061">5.3.3. Operation</a></span></dt>
1.1       grant    1224: 
                   1225:                   <dt><span class="sect2"><a href=
1.11    ! ben      1226:                   "#id2583200">5.3.4. What it does</a></span></dt>
1.1       grant    1227: 
                   1228:                   <dt><span class="sect2"><a href=
1.11    ! ben      1229:                   "#id2583256">5.3.5. Disk space
1.1       grant    1230:                   requirements</a></span></dt>
                   1231: 
                   1232:                   <dt><span class="sect2"><a href=
1.11    ! ben      1233:                   "#id2583351">5.3.6. Setting up a sandbox for
1.1       grant    1234:                   chroot'ed builds</a></span></dt>
                   1235: 
                   1236:                   <dt><span class="sect2"><a href=
1.11    ! ben      1237:                   "#id2583715">5.3.7. Building a partial set of
1.1       grant    1238:                   packages</a></span></dt>
                   1239:                 </dl>
                   1240:               </dd>
                   1241: 
1.11    ! ben      1242:               <dt><span class="sect1"><a href="#id2583757">5.4.
1.1       grant    1243:               Creating a multiple CD-ROM packages
                   1244:               collection</a></span></dt>
                   1245: 
                   1246:               <dd>
                   1247:                 <dl>
                   1248:                   <dt><span class="sect2"><a href=
1.11    ! ben      1249:                   "#id2583772">5.4.1. Example of
1.1       grant    1250:                   cdpack</a></span></dt>
                   1251:                 </dl>
                   1252:               </dd>
                   1253:             </dl>
                   1254:           </dd>
                   1255: 
                   1256:           <dt><span class="chapter"><a href="#faq">6. Frequently
                   1257:           Asked Questions</a></span></dt>
                   1258: 
                   1259:           <dd>
                   1260:             <dl>
1.11    ! ben      1261:               <dt><span class="sect1"><a href="#id2584100">6.1. Is
1.1       grant    1262:               there a mailing list for pkg-related
                   1263:               discussion?</a></span></dt>
                   1264: 
1.11    ! ben      1265:               <dt><span class="sect1"><a href="#id2584130">6.2.
1.1       grant    1266:               Where's the pkgviews documentation?</a></span></dt>
                   1267: 
1.5       hubertf  1268:               <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    1269:               Utilities for package management
                   1270:               (pkgtools)</a></span></dt>
                   1271: 
1.11    ! ben      1272:               <dt><span class="sect1"><a href="#id2584382">6.4. How
1.1       grant    1273:               to use pkgsrc as non-root</a></span></dt>
                   1274: 
1.11    ! ben      1275:               <dt><span class="sect1"><a href="#id2584394">6.5. How
1.1       grant    1276:               can I install/use XFree86 from
                   1277:               pkgsrc?</a></span></dt>
                   1278: 
1.11    ! ben      1279:               <dt><span class="sect1"><a href="#id2584422">6.6. How
1.1       grant    1280:               can I install/use X.org from pkgsrc?</a></span></dt>
                   1281: 
1.11    ! ben      1282:               <dt><span class="sect1"><a href="#id2584518">6.7. How
1.1       grant    1283:               to fetch files from behind a firewall</a></span></dt>
                   1284: 
1.11    ! ben      1285:               <dt><span class="sect1"><a href="#id2584532">6.8. How
1.7       wiz      1286:               do I tell <span><strong class="command">make
                   1287:               fetch</strong></span> to do passive
1.1       grant    1288:               FTP?</a></span></dt>
                   1289: 
1.11    ! ben      1290:               <dt><span class="sect1"><a href="#id2584651">6.9. How
1.1       grant    1291:               to fetch all distfiles at once</a></span></dt>
                   1292: 
1.11    ! ben      1293:               <dt><span class="sect1"><a href="#id2584791">6.10.
1.7       wiz      1294:               What does &#8220;<span class="quote">Don't know how
                   1295:               to make /usr/share/tmac/tmac.andoc</span>&#8221;
                   1296:               mean?</a></span></dt>
1.1       grant    1297: 
1.11    ! ben      1298:               <dt><span class="sect1"><a href="#id2584829">6.11.
1.7       wiz      1299:               What does &#8220;<span class="quote">Could not find
                   1300:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1301: 
1.11    ! ben      1302:               <dt><span class="sect1"><a href="#id2584887">6.12.
1.1       grant    1303:               Using 'sudo' with pkgsrc</a></span></dt>
                   1304: 
                   1305:               <dt><span class="sect1"><a href="#faq.conf">6.13.
                   1306:               Configuration files handling and
                   1307:               placement</a></span></dt>
                   1308: 
                   1309:               <dt><span class="sect1"><a href=
                   1310:               "#audit-packages">6.14. Automated security
                   1311:               checks</a></span></dt>
                   1312:             </dl>
                   1313:           </dd>
                   1314:         </dl>
                   1315:       </div>
                   1316: 
                   1317:       <div class="chapter" lang="en" xml:lang="en">
                   1318:         <div class="titlepage">
                   1319:           <div>
                   1320:             <div>
                   1321:               <h2 class="title"><a name="getting" id=
                   1322:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1323:               pkgsrc</h2>
                   1324:             </div>
                   1325:           </div>
                   1326:         </div>
                   1327: 
                   1328:         <div class="toc">
                   1329:           <p><b>Table of Contents</b></p>
                   1330: 
                   1331:           <dl>
1.11    ! ben      1332:             <dt><span class="sect1"><a href="#id2514784">2.1. As
1.1       grant    1333:             tar file</a></span></dt>
                   1334: 
1.11    ! ben      1335:             <dt><span class="sect1"><a href="#id2514800">2.2. Via
1.1       grant    1336:             SUP</a></span></dt>
                   1337: 
1.11    ! ben      1338:             <dt><span class="sect1"><a href="#id2514900">2.3. Via
1.1       grant    1339:             CVS</a></span></dt>
                   1340:           </dl>
                   1341:         </div>
                   1342: 
                   1343:         <p>There are three ways to get pkgsrc. Either as a tar
                   1344:         file, via SUP, or via CVS. All three ways are described
                   1345:         here.</p>
                   1346: 
                   1347:         <div class="sect1" lang="en" xml:lang="en">
                   1348:           <div class="titlepage">
                   1349:             <div>
                   1350:               <div>
                   1351:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      1352:                 "id2514784" id="id2514784"></a>2.1.&nbsp;As tar
1.1       grant    1353:                 file</h2>
                   1354:               </div>
                   1355:             </div>
                   1356:           </div>
                   1357: 
                   1358:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1359:           file from <a href=
1.11    ! ben      1360:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.7       wiz      1361:           target="_top">ftp.NetBSD.org</a> and unpack it into
                   1362:           <code class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1363:         </div>
                   1364: 
                   1365:         <div class="sect1" lang="en" xml:lang="en">
                   1366:           <div class="titlepage">
                   1367:             <div>
                   1368:               <div>
                   1369:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      1370:                 "id2514800" id="id2514800"></a>2.2.&nbsp;Via
1.1       grant    1371:                 SUP</h2>
                   1372:               </div>
                   1373:             </div>
                   1374:           </div>
                   1375: 
                   1376:           <p>As an alternative to the tar file, you can get pkgsrc
                   1377:           via the Software Update Protocol, SUP. To do so, make
                   1378:           sure your supfile has a line</p>
                   1379:           <pre class="programlisting">
                   1380: release=pkgsrc
                   1381: </pre>
                   1382: 
1.7       wiz      1383:           <p>in it, see the examples in <code class=
                   1384:           "filename">/usr/share/examples/supfiles</code>, and that
                   1385:           the <code class="filename">/usr/pkgsrc</code> directory
                   1386:           exists. Then, simply run <span><strong class=
                   1387:           "command">sup -v <em class=
                   1388:           "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1389:         </div>
                   1390: 
                   1391:         <div class="sect1" lang="en" xml:lang="en">
                   1392:           <div class="titlepage">
                   1393:             <div>
                   1394:               <div>
                   1395:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      1396:                 "id2514900" id="id2514900"></a>2.3.&nbsp;Via
1.1       grant    1397:                 CVS</h2>
                   1398:               </div>
                   1399:             </div>
                   1400:           </div>
                   1401: 
                   1402:           <p>To get pkgsrc via CVS, make sure you have
                   1403:           &#8220;<span class="quote">cvs</span>&#8221; installed.
                   1404:           If not present on your system, it can be found as
                   1405:           precompiled binary on ftp.NetBSD.org. To do an initial
                   1406:           (full) checkout of pkgsrc, do the following steps:</p>
                   1407:           <pre class="screen">
1.7       wiz      1408: <code class="prompt">%</code> <strong class=
                   1409: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1410: <code class="prompt">%</code> <strong class=
                   1411: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1412: <code class="prompt">%</code> <strong class=
                   1413: "userinput"><code>cd /usr</code></strong>
                   1414: <code class="prompt">%</code> <strong class=
                   1415: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1416: </pre>
                   1417: 
                   1418:           <p>This will create the <code class=
                   1419:           "filename">pkgsrc</code> directory in your <code class=
                   1420:           "filename">/usr</code>, and all the package source will
                   1421:           be stored under <code class=
                   1422:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1423:           initial checkout, make sure you have <code class=
                   1424:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1425:           <pre class="screen">
1.7       wiz      1426: <code class="prompt">%</code> <strong class=
                   1427: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1428: <code class="prompt">%</code> <strong class=
                   1429: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1430: </pre>
                   1431: 
                   1432:           <p>Please also note that it is possible to have multiple
                   1433:           copies of the pkgsrc hierarchy in use at any one time -
                   1434:           all work is done relatively within the pkgsrc tree.</p>
                   1435:         </div>
                   1436:       </div>
                   1437: 
                   1438:       <div class="chapter" lang="en" xml:lang="en">
                   1439:         <div class="titlepage">
                   1440:           <div>
                   1441:             <div>
                   1442:               <h2 class="title"><a name="platforms" id=
                   1443:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1444:               systems other than NetBSD</h2>
                   1445:             </div>
                   1446:           </div>
                   1447:         </div>
                   1448: 
                   1449:         <div class="toc">
                   1450:           <p><b>Table of Contents</b></p>
                   1451: 
                   1452:           <dl>
1.11    ! ben      1453:             <dt><span class="sect1"><a href="#id2515010">3.1.
1.1       grant    1454:             Bootstrapping pkgsrc</a></span></dt>
                   1455: 
1.11    ! ben      1456:             <dt><span class="sect1"><a href="#id2515185">3.2.
1.1       grant    1457:             Platform specific notes</a></span></dt>
                   1458: 
                   1459:             <dd>
                   1460:               <dl>
1.11    ! ben      1461:                 <dt><span class="sect2"><a href="#id2515191">3.2.1.
1.1       grant    1462:                 Darwin (Mac OS X)</a></span></dt>
                   1463: 
1.11    ! ben      1464:                 <dt><span class="sect2"><a href="#id2515490">3.2.2.
1.1       grant    1465:                 FreeBSD</a></span></dt>
                   1466: 
1.11    ! ben      1467:                 <dt><span class="sect2"><a href="#id2515933">3.2.3.
1.1       grant    1468:                 Interix</a></span></dt>
                   1469: 
1.11    ! ben      1470:                 <dt><span class="sect2"><a href="#id2516024">3.2.4.
1.1       grant    1471:                 IRIX</a></span></dt>
                   1472: 
1.11    ! ben      1473:                 <dt><span class="sect2"><a href="#id2516210">3.2.5.
1.1       grant    1474:                 OpenBSD</a></span></dt>
                   1475: 
1.11    ! ben      1476:                 <dt><span class="sect2"><a href="#id2516322">3.2.6.
1.1       grant    1477:                 Solaris</a></span></dt>
                   1478:               </dl>
                   1479:             </dd>
                   1480:           </dl>
                   1481:         </div>
                   1482: 
                   1483:         <div class="sect1" lang="en" xml:lang="en">
                   1484:           <div class="titlepage">
                   1485:             <div>
                   1486:               <div>
                   1487:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      1488:                 "id2515010" id=
        !          1489:                 "id2515010"></a>3.1.&nbsp;Bootstrapping pkgsrc</h2>
1.1       grant    1490:               </div>
                   1491:             </div>
                   1492:           </div>
                   1493: 
                   1494:           <p>For Operating Systems other than NetBSD, we provide a
                   1495:           bootstrap kit to build the required tools to use pkgsrc
                   1496:           on your platform. Besides support for native NetBSD,
                   1497:           pkgsrc and the bootstrap kit have support for the
                   1498:           following operating systems:</p>
                   1499: 
                   1500:           <div class="itemizedlist">
                   1501:             <ul type="disc">
                   1502:               <li>
                   1503:                 <p>Darwin (Mac OS X)</p>
                   1504:               </li>
                   1505: 
                   1506:               <li>
                   1507:                 <p>FreeBSD</p>
                   1508:               </li>
                   1509: 
                   1510:               <li>
                   1511:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1512:               </li>
                   1513: 
                   1514:               <li>
                   1515:                 <p>IRIX</p>
                   1516:               </li>
                   1517: 
                   1518:               <li>
                   1519:                 <p>Linux</p>
                   1520:               </li>
                   1521: 
                   1522:               <li>
                   1523:                 <p>OpenBSD</p>
                   1524:               </li>
                   1525: 
                   1526:               <li>
                   1527:                 <p>Solaris</p>
                   1528:               </li>
                   1529:             </ul>
                   1530:           </div>
                   1531: 
                   1532:           <p>Support for other platforms is under development.</p>
                   1533: 
                   1534:           <p>Installing the bootstrap kit should be as simple
                   1535:           as:</p>
                   1536:           <pre class="screen">
1.7       wiz      1537: <code class="prompt">#</code> <strong class=
                   1538: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1539: <code class="prompt">#</code> <strong class=
                   1540: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1541: <code class="prompt">#</code> <strong class=
                   1542: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1543: </pre>
                   1544: 
                   1545:           <p>See <a href="#getting" title=
                   1546:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter 2,
                   1547:           <i>Where to get pkgsrc</i></a> for other ways to get
1.7       wiz      1548:           pkgsrc before bootstrapping. The given
                   1549:           <span><strong class="command">bootstrap</strong></span>
                   1550:           command will use the defaults of <code class=
                   1551:           "filename">/usr/pkg</code> for the <span class=
                   1552:           "emphasis"><em>prefix</em></span> where programs will be
                   1553:           installed in, and <code class=
                   1554:           "filename">/var/db/pkg</code> for the package database
1.1       grant    1555:           directory where pkgsrc will do it's internal bookkeeping.
                   1556:           However, these can also be set using command-line
                   1557:           parameters.</p>
                   1558: 
                   1559:           <p>Binary packages for the pkgsrc tools and an initial
                   1560:           set of packages is available for supported platforms. An
                   1561:           up-to-date list of these can be found on <a href=
                   1562:           "http://www.pkgsrc.org/" target=
                   1563:           "_top">www.pkgsrc.org</a>.</p>
                   1564:         </div>
                   1565: 
                   1566:         <div class="sect1" lang="en" xml:lang="en">
                   1567:           <div class="titlepage">
                   1568:             <div>
                   1569:               <div>
                   1570:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      1571:                 "id2515185" id="id2515185"></a>3.2.&nbsp;Platform
1.1       grant    1572:                 specific notes</h2>
                   1573:               </div>
                   1574:             </div>
                   1575:           </div>
                   1576: 
                   1577:           <p>Here are some platform-specific notes you should be
                   1578:           aware of.</p>
                   1579: 
                   1580:           <div class="sect2" lang="en" xml:lang="en">
                   1581:             <div class="titlepage">
                   1582:               <div>
                   1583:                 <div>
1.11    ! ben      1584:                   <h3 class="title"><a name="id2515191" id=
        !          1585:                   "id2515191"></a>3.2.1.&nbsp;Darwin (Mac OS
1.1       grant    1586:                   X)</h3>
                   1587:                 </div>
                   1588:               </div>
                   1589:             </div>
                   1590: 
                   1591:             <p>Darwin 5.x and 6.x are supported. There are two
                   1592:             methods of using pkgsrc on Mac OS X, by using a
                   1593:             <a href="#platform.osx-image" title=
                   1594:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1595:             <a href="#platform.osx-ufs" title=
                   1596:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1597:             partition</a>.</p>
                   1598: 
                   1599:             <p>Before you start, you will need to download and
                   1600:             install the Mac OS X Developer Tools from Apple's
                   1601:             Developer Connection. See <a href=
                   1602:             "http://developer.apple.com/macosx/" target=
                   1603:             "_top">http://developer.apple.com/macosx/</a> for
                   1604:             details. Also, make sure you install X11 for Mac OS X
                   1605:             and the X11 SDK from <a href=
                   1606:             "http://www.apple.com/macosx/x11/download/" target=
                   1607:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1608:             you intend to build packages that use the X11 Window
                   1609:             System.</p>
                   1610: 
                   1611:             <p>If you already have a UFS partition, or have a spare
                   1612:             partition that you can format as UFS, it is recommended
                   1613:             to use that instead of the disk image. It'll be
                   1614:             somewhat faster and will mount automatically at boot
                   1615:             time, where you must manually mount a disk image.</p>
                   1616: 
                   1617:             <div class="note" style=
                   1618:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1619:               <h3 class="title">Note</h3>
                   1620: 
                   1621:               <p>You cannot use a HFS+ file system for pkgsrc,
                   1622:               because pkgsrc currently requires the filesystem to
                   1623:               be case-sensitive, and HFS+ is not.</p>
                   1624:             </div>
                   1625: 
                   1626:             <div class="sect3" lang="en" xml:lang="en">
                   1627:               <div class="titlepage">
                   1628:                 <div>
                   1629:                   <div>
                   1630:                     <h4 class="title"><a name="platform.osx-image"
                   1631:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
                   1632:                     a disk image</h4>
                   1633:                   </div>
                   1634:                 </div>
                   1635:               </div>
                   1636: 
                   1637:               <p>Create the disk image:</p>
                   1638:               <pre class="screen">
1.7       wiz      1639: <code class="prompt">#</code> <strong class=
                   1640: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1641: <code class="prompt">#</code> <strong class=
                   1642: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   1643: <code class="prompt">#</code> <strong class=
                   1644: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   1645: <code class="prompt">#</code> <strong class=
                   1646: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    1647: </pre>
                   1648: 
                   1649:               <p>That's it!</p>
                   1650:             </div>
                   1651: 
                   1652:             <div class="sect3" lang="en" xml:lang="en">
                   1653:               <div class="titlepage">
                   1654:                 <div>
                   1655:                   <div>
                   1656:                     <h4 class="title"><a name="platform.osx-ufs"
                   1657:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
                   1658:                     UFS partition</h4>
                   1659:                   </div>
                   1660:                 </div>
                   1661:               </div>
                   1662: 
1.7       wiz      1663:               <p>By default, <code class="filename">/usr</code>
                   1664:               will be on your root file system, normally HFS+. It
                   1665:               is possible to use the default <span class=
                   1666:               "emphasis"><em>prefix</em></span> of <code class=
                   1667:               "filename">/usr/pkg</code> by symlinking <code class=
                   1668:               "filename">/usr/pkg</code> to a directory on a UFS
                   1669:               file system. Obviously, another symlink is required
                   1670:               if you want to place the package database directory
                   1671:               outside the <span class=
                   1672:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    1673:               <pre class="screen">
1.7       wiz      1674: <code class="prompt">#</code> <strong class=
                   1675: "userinput"><code>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</code></strong>
1.1       grant    1676: </pre>
                   1677: 
                   1678:               <p>If you created your partitions at the time of
                   1679:               installing Mac OS X and formatted the target
                   1680:               partition as UFS, it should automatically mount on
1.7       wiz      1681:               <code class="filename">/Volumes/&lt;volume
                   1682:               name&gt;</code> when the machine boots. If you are
1.1       grant    1683:               (re)formatting a partition as UFS, you need to ensure
                   1684:               that the partition map correctly reflects
                   1685:               &#8220;<span class="quote">Apple_UFS</span>&#8221;
                   1686:               and not &#8220;<span class=
                   1687:               "quote">Apple_HFS</span>&#8221;.</p>
                   1688: 
                   1689:               <p>The problem is that none of the disk tools will
                   1690:               let you touch a disk that is booted from. You can
                   1691:               unmount the partition, but even if you newfs it, the
                   1692:               partition type will be incorrect and the automounter
                   1693:               won't mount it. It can be mounted manually, but it
                   1694:               won't appear in Finder.</p>
                   1695: 
                   1696:               <p>You'll need to boot off of the OS X Installation
                   1697:               (User) CD. When the Installation program starts, go
                   1698:               up to the menu and select Disk Utility. Now, you will
                   1699:               be able to select the partition you want to be UFS,
                   1700:               and Format it Apple UFS. Quit the Disk Utility, quit
                   1701:               the installer which will reboot your machine. The new
                   1702:               UFS file system will appear in Finder.</p>
                   1703: 
                   1704:               <p>Be aware that the permissions on the new file
                   1705:               system will be writable by root only.</p>
                   1706: 
                   1707:               <p>This note is as of 10.2 (Jaguar) and applies to
                   1708:               earlier versions. Hopefully Apple will fix Disk
                   1709:               Utility in 10.3 (Panther).</p>
                   1710:             </div>
                   1711:           </div>
                   1712: 
                   1713:           <div class="sect2" lang="en" xml:lang="en">
                   1714:             <div class="titlepage">
                   1715:               <div>
                   1716:                 <div>
1.11    ! ben      1717:                   <h3 class="title"><a name="id2515490" id=
        !          1718:                   "id2515490"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    1719:                 </div>
                   1720:               </div>
                   1721:             </div>
                   1722: 
                   1723:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   1724:             supported, other versions may work.</p>
                   1725: 
                   1726:             <p>Care should be taken so that the tools that this kit
                   1727:             installs do not conflict with the FreeBSD userland
                   1728:             tools. There are several steps:</p>
                   1729: 
                   1730:             <div class="orderedlist">
                   1731:               <ol type="1">
                   1732:                 <li>
                   1733:                   <p>FreeBSD stores its ports pkg database in
1.7       wiz      1734:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    1735:                   therefore recommended that you choose a different
1.7       wiz      1736:                   location (e.g. <code class=
                   1737:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    1738:                   --pkgdbdir option to the bootstrap script.</p>
                   1739:                 </li>
                   1740: 
                   1741:                 <li>
                   1742:                   <p>If you do not intend to use the FreeBSD ports
                   1743:                   tools, it's probably a good idea to move them out
                   1744:                   of the way to avoid confusion, e.g.</p>
                   1745:                   <pre class="screen">
1.7       wiz      1746: <code class="prompt">#</code> <strong class=
                   1747: "userinput"><code>cd /usr/sbin</code></strong>
                   1748: <code class="prompt">#</code> <strong class=
                   1749: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   1750: <code class="prompt">#</code> <strong class=
                   1751: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   1752: <code class="prompt">#</code> <strong class=
                   1753: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   1754: <code class="prompt">#</code> <strong class=
                   1755: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    1756: </pre>
                   1757:                 </li>
                   1758: 
                   1759:                 <li>
1.7       wiz      1760:                   <p>An example <code class=
                   1761:                   "filename">/etc/mk.conf</code> file will be
                   1762:                   placed in <code class=
                   1763:                   "filename">/etc/mk.conf.example</code> file when
                   1764:                   you use the bootstrap script.</p>
1.1       grant    1765:                 </li>
                   1766:               </ol>
                   1767:             </div>
                   1768:           </div>
                   1769: 
                   1770:           <div class="sect2" lang="en" xml:lang="en">
                   1771:             <div class="titlepage">
                   1772:               <div>
                   1773:                 <div>
1.11    ! ben      1774:                   <h3 class="title"><a name="id2515933" id=
        !          1775:                   "id2515933"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    1776:                 </div>
                   1777:               </div>
                   1778:             </div>
                   1779: 
                   1780:             <p>Interix is a POSIX compatible subsystem for the
                   1781:             Windows NT kernel, providing a Unix-like environment
                   1782:             with a tighter kernel integration than available with
                   1783:             Cygwin. It is part of the Windows Services for Unix
                   1784:             package, available for free for any licensed copy of
                   1785:             Windows 2000, XP, or 2003. SFU can be downloaded from
                   1786:             <a href="http://www.microsoft.com/windows/sfu/" target=
                   1787:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   1788: 
                   1789:             <p>Services for Unix 3.5, current as of this writing,
                   1790:             has been tested. 3.0 or 3.1 may work, but are not
                   1791:             officially supported. (The main difference in 3.0/3.1
                   1792:             is lack of pthreads.)</p>
                   1793: 
                   1794:             <div class="sect3" lang="en" xml:lang="en">
                   1795:               <div class="titlepage">
                   1796:                 <div>
                   1797:                   <div>
                   1798:                     <h4 class="title"><a name=
                   1799:                     "platform.interix-sfu-install" id=
                   1800:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  1801:                     installing Interix/SFU</h4>
1.1       grant    1802:                   </div>
                   1803:                 </div>
                   1804:               </div>
                   1805: 
                   1806:               <p>At an absolute minimum, the following packages
                   1807:               must be installed from the Windows Services for Unix
                   1808:               3.5 distribution in order to use pkgsrc:</p>
                   1809: 
                   1810:               <div class="itemizedlist">
                   1811:                 <ul type="disc">
                   1812:                   <li>
                   1813:                     <p>Utilities -&gt; Base Utilities</p>
                   1814:                   </li>
                   1815: 
                   1816:                   <li>
                   1817:                     <p>Interix GNU Components -&gt; (all)</p>
                   1818:                   </li>
                   1819: 
                   1820:                   <li>
                   1821:                     <p>Remote Connectivity</p>
                   1822:                   </li>
                   1823: 
                   1824:                   <li>
                   1825:                     <p>Interix SDK</p>
                   1826:                   </li>
                   1827:                 </ul>
                   1828:               </div>
                   1829: 
                   1830:               <p>When using pkgsrc on Interix, DO NOT install the
                   1831:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   1832:               without shared module support, installed to
                   1833:               /usr/local, and will only cause confusion. Instead,
                   1834:               install Perl 5.8 from pkgsrc (or from a binary
                   1835:               package).</p>
                   1836: 
                   1837:               <p>The Remote Connectivity subcomponent "Windows
                   1838:               Remote Shell Service" does not need to be installed,
                   1839:               but Remote Connectivity itself should be installed in
                   1840:               order to have a working inetd.</p>
                   1841: 
                   1842:               <p>Finally, during installation you may be asked
                   1843:               whether to enable setuid behavior for Interix
                   1844:               programs, and whether to make pathnames default to
                   1845:               case-sensitive. Setuid should be enabled, and
                   1846:               case-sensitivity MUST be enabled. (Without
                   1847:               case-sensitivity, a large number of packages
                   1848:               including perl will not build.)</p>
                   1849:             </div>
                   1850: 
                   1851:             <div class="sect3" lang="en" xml:lang="en">
                   1852:               <div class="titlepage">
                   1853:                 <div>
                   1854:                   <div>
                   1855:                     <h4 class="title"><a name=
                   1856:                     "platform.interix-sfu-postinstall" id=
                   1857:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   1858:                     to do if Interix/SFU is already installed</h4>
                   1859:                   </div>
                   1860:                 </div>
                   1861:               </div>
                   1862: 
                   1863:               <p>If SFU is already installed and you wish to alter
                   1864:               these settings to work with pkgsrc, note the
                   1865:               following things.</p>
                   1866: 
                   1867:               <div class="itemizedlist">
                   1868:                 <ul type="disc">
                   1869:                   <li>
                   1870:                     <p>To uninstall UNIX Perl, use Add/Remove
                   1871:                     Programs, select Microsoft Windows Services for
                   1872:                     UNIX, then click Change. In the installer,
                   1873:                     choose Add or Remove, then uncheck
                   1874:                     Utilities-&gt;UNIX Perl.</p>
                   1875:                   </li>
                   1876: 
                   1877:                   <li>
                   1878:                     <p>To enable case-sensitivity for the
                   1879:                     filesystem, run REGEDIT.EXE, and change the
                   1880:                     following registry key:</p>
                   1881: 
                   1882:                     <p>
                   1883:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   1884:                     Manager\kernel</p>
                   1885: 
                   1886:                     <p>Set the DWORD value "obcaseinsensitive" to
                   1887:                     0; then reboot.</p>
                   1888:                   </li>
                   1889: 
                   1890:                   <li>
                   1891:                     <p>To enable setuid binaries (optional), run
                   1892:                     REGEDIT.EXE, and change the following registry
                   1893:                     key:</p>
                   1894: 
                   1895:                     <p>
                   1896:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   1897:                     for UNIX</p>
                   1898: 
                   1899:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   1900:                     to 1; then reboot.</p>
                   1901:                   </li>
                   1902:                 </ul>
                   1903:               </div>
                   1904:             </div>
                   1905: 
                   1906:             <div class="sect3" lang="en" xml:lang="en">
                   1907:               <div class="titlepage">
                   1908:                 <div>
                   1909:                   <div>
                   1910:                     <h4 class="title"><a name=
                   1911:                     "platform.interix-notes" id=
                   1912:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   1913:                     notes for using pkgsrc</h4>
                   1914:                   </div>
                   1915:                 </div>
                   1916:               </div>
                   1917: 
                   1918:               <p>The package imanager (either the pkgsrc "su" user,
                   1919:               or the user running "pkg_add") must be a member of
                   1920:               the local Administrators group. Such a user must also
                   1921:               be used to run the bootstrap. This is slightly
                   1922:               relaxed from the normal pkgsrc requirement of
                   1923:               "root".</p>
                   1924: 
                   1925:               <p>The package manager should use a umask of 002.
                   1926:               "make install" will automatically complain if this is
                   1927:               not the case. This ensures that directories written
                   1928:               in /var/db/pkg are Administrators-group
                   1929:               writeable.</p>
                   1930: 
                   1931:               <p>The popular Interix binary packages from
                   1932:               http://www.interopsystems.com/ use an older version
                   1933:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   1934:               used in conjunction with pkgsrc. If you choose to use
                   1935:               them at the same time as the pkgsrc packages, ensure
                   1936:               that you use the proper pkg_* tools for each type of
                   1937:               binary package.</p>
                   1938:             </div>
                   1939:           </div>
                   1940: 
                   1941:           <div class="sect2" lang="en" xml:lang="en">
                   1942:             <div class="titlepage">
                   1943:               <div>
                   1944:                 <div>
1.11    ! ben      1945:                   <h3 class="title"><a name="id2516024" id=
        !          1946:                   "id2516024"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    1947:                 </div>
                   1948:               </div>
                   1949:             </div>
                   1950: 
                   1951:             <p>You will need a working C compiler, either gcc or
                   1952:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.7       wiz      1953:             the <code class="varname">CC</code> environment
                   1954:             variable according to your preference. If you do not
                   1955:             have a license for the MIPSpro compiler suite, you can
1.1       grant    1956:             download a gcc tardist file from <a href=
                   1957:             "http://freeware.sgi.com/" target=
                   1958:             "_top">http://freeware.sgi.com/</a>.</p>
                   1959: 
                   1960:             <p>Please note that you will need IRIX 6.5.17 or
                   1961:             higher, as this is the earliest version of IRIX
                   1962:             providing support for if_indextoname(3),
                   1963:             if_nametoindex(3), etc.</p>
                   1964: 
                   1965:             <p>At this point in time, pkgsrc only supports one ABI.
                   1966:             That is, you can not switch between the old 32-bit ABI,
                   1967:             the new 32-bit ABI and the 64-bit ABI. If you start out
                   1968:             using "abi=n32", that's what all your packages will be
                   1969:             built with.</p>
                   1970: 
                   1971:             <p>Therefore, please make sure that you have no
1.7       wiz      1972:             conflicting <code class="varname">CFLAGS</code> in your
                   1973:             environment or the <code class=
                   1974:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    1975:             that you do not try to link n32 object files with lib64
1.7       wiz      1976:             or vice versa. Check your <code class=
                   1977:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    1978: 
                   1979:             <p>If you have the actual pkgsrc tree mounted via NFS
                   1980:             from a different host, please make sure to set
1.7       wiz      1981:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    1982:             directory, as it appears that IRIX linker occasionally
                   1983:             runs into issues when trying to link over a network
                   1984:             mounted filesystem.</p>
                   1985: 
                   1986:             <p>The bootstrapping process should set all the right
                   1987:             options for programs such as imake(1), but you may want
                   1988:             to set some options depending on your local setup.
1.7       wiz      1989:             Please see <code class=
1.11    ! ben      1990:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.1       grant    1991:             course, your compilers man pages for details.</p>
                   1992:           </div>
                   1993: 
                   1994:           <div class="sect2" lang="en" xml:lang="en">
                   1995:             <div class="titlepage">
                   1996:               <div>
                   1997:                 <div>
1.11    ! ben      1998:                   <h3 class="title"><a name="id2516210" id=
        !          1999:                   "id2516210"></a>3.2.5.&nbsp;OpenBSD</h3>
1.1       grant    2000:                 </div>
                   2001:               </div>
                   2002:             </div>
                   2003: 
                   2004:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2005: 
                   2006:             <p>Care should be taken so that the tools that this kit
                   2007:             installs do not conflict with the OpenBSD userland
                   2008:             tools. There are several steps:</p>
                   2009: 
                   2010:             <div class="orderedlist">
                   2011:               <ol type="1">
                   2012:                 <li>
                   2013:                   <p>OpenBSD stores its ports pkg database in
1.7       wiz      2014:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    2015:                   therefore recommended that you choose a different
1.7       wiz      2016:                   location (e.g. <code class=
                   2017:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2018:                   --pkgdbdir option to the bootstrap script.</p>
                   2019:                 </li>
                   2020: 
                   2021:                 <li>
                   2022:                   <p>If you do not intend to use the OpenBSD ports
                   2023:                   tools, it's probably a good idea to move them out
                   2024:                   of the way to avoid confusion, e.g.</p>
                   2025:                   <pre class="screen">
1.7       wiz      2026: <code class="prompt">#</code> <strong class=
                   2027: "userinput"><code>cd /usr/sbin</code></strong>
                   2028: <code class="prompt">#</code> <strong class=
                   2029: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2030: <code class="prompt">#</code> <strong class=
                   2031: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2032: <code class="prompt">#</code> <strong class=
                   2033: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2034: <code class="prompt">#</code> <strong class=
                   2035: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2036: </pre>
                   2037:                 </li>
                   2038: 
                   2039:                 <li>
1.7       wiz      2040:                   <p>An example <code class=
                   2041:                   "filename">/etc/mk.conf</code> file will be
                   2042:                   placed in <code class=
                   2043:                   "filename">/etc/mk.conf.example</code> file when
                   2044:                   you use the bootstrap script. OpenBSD's make
                   2045:                   program uses <code class=
                   2046:                   "filename">/etc/mk.conf</code> as well. You can
1.1       grant    2047:                   work around this by enclosing all the pkgsrc
                   2048:                   specific parts of the file with:</p>
                   2049:                   <pre class="programlisting">
                   2050: .ifdef BSD_PKG_MK
1.11    ! ben      2051: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1       grant    2052: .else
                   2053: # OpenBSD stuff
                   2054: .endif
                   2055: </pre>
                   2056:                 </li>
                   2057:               </ol>
                   2058:             </div>
                   2059:           </div>
                   2060: 
                   2061:           <div class="sect2" lang="en" xml:lang="en">
                   2062:             <div class="titlepage">
                   2063:               <div>
                   2064:                 <div>
1.11    ! ben      2065:                   <h3 class="title"><a name="id2516322" id=
        !          2066:                   "id2516322"></a>3.2.6.&nbsp;Solaris</h3>
1.1       grant    2067:                 </div>
                   2068:               </div>
                   2069:             </div>
                   2070: 
                   2071:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2072:             sparc. You will need a working C compiler. Both gcc
                   2073:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2074: 
                   2075:             <p>The following packages are required on Solaris 8 for
                   2076:             the bootstrap process and to build packages.</p>
                   2077: 
                   2078:             <div class="itemizedlist">
                   2079:               <ul type="disc">
                   2080:                 <li>
                   2081:                   <p>SUNWsprot</p>
                   2082:                 </li>
                   2083: 
                   2084:                 <li>
                   2085:                   <p>SUNWarc</p>
                   2086:                 </li>
                   2087: 
                   2088:                 <li>
                   2089:                   <p>SUNWbtool</p>
                   2090:                 </li>
                   2091: 
                   2092:                 <li>
                   2093:                   <p>SUNWtoo</p>
                   2094:                 </li>
                   2095: 
                   2096:                 <li>
                   2097:                   <p>SUNWlibm</p>
                   2098:                 </li>
                   2099:               </ul>
                   2100:             </div>
                   2101: 
                   2102:             <p>Please note the use of GNU binutils on Solaris is
                   2103:             <span class="emphasis"><em>not</em></span>
                   2104:             supported.</p>
                   2105: 
                   2106:             <div class="sect3" lang="en" xml:lang="en">
                   2107:               <div class="titlepage">
                   2108:                 <div>
                   2109:                   <div>
1.11    ! ben      2110:                     <h4 class="title"><a name="id2516353" id=
        !          2111:                     "id2516353"></a>3.2.6.1.&nbsp;If you are using
1.1       grant    2112:                     gcc</h4>
                   2113:                   </div>
                   2114:                 </div>
                   2115:               </div>
                   2116: 
                   2117:               <p>It makes life much simpler if you only use the
                   2118:               same gcc consistently for building all packages.</p>
                   2119: 
                   2120:               <p>It is recommended that an external gcc be used
                   2121:               only for bootstrapping, then either build gcc from
                   2122:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2123:               href=
                   2124:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.7       wiz      2125:               class="pkgname">lang/gcc</a> or install a binary gcc
                   2126:               package, then remove gcc used during
                   2127:               bootstrapping.</p>
1.1       grant    2128: 
                   2129:               <p>Binary packages of gcc can be found through
                   2130:               <a href=
                   2131:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.7       wiz      2132:               target=
                   2133:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2134:             </div>
                   2135: 
                   2136:             <div class="sect3" lang="en" xml:lang="en">
                   2137:               <div class="titlepage">
                   2138:                 <div>
                   2139:                   <div>
1.11    ! ben      2140:                     <h4 class="title"><a name="id2516374" id=
        !          2141:                     "id2516374"></a>3.2.6.2.&nbsp;If you are using
1.1       grant    2142:                     Sun WorkShop</h4>
                   2143:                   </div>
                   2144:                 </div>
                   2145:               </div>
                   2146: 
                   2147:               <p>You will need at least the following packages
                   2148:               installed (from WorkShop 5.0)</p>
                   2149: 
                   2150:               <div class="itemizedlist">
                   2151:                 <ul type="disc">
                   2152:                   <li>
                   2153:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2154:                   </li>
                   2155: 
                   2156:                   <li>
                   2157:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2158:                   </li>
                   2159: 
                   2160:                   <li>
                   2161:                     <p>SPROild - Sun WorkShop Incremental
                   2162:                     Linker</p>
                   2163:                   </li>
                   2164: 
                   2165:                   <li>
                   2166:                     <p>SPROlang - Sun WorkShop Compilers common
                   2167:                     components</p>
                   2168:                   </li>
                   2169:                 </ul>
                   2170:               </div>
                   2171: 
1.7       wiz      2172:               <p>You should set <code class="varname">CC</code>,
                   2173:               <code class="varname">CXX</code> and optionally,
                   2174:               <code class="varname">CPP</code> in <code class=
                   2175:               "filename">/etc/mk.conf</code>, eg.</p>
1.1       grant    2176:               <pre class="programlisting">
                   2177: CC=        cc
                   2178: CXX=    CC
                   2179: CPP=    /usr/ccs/lib/cpp
                   2180: </pre>
                   2181: 
                   2182:               <p>You may also want to build 64-bit binaries,
                   2183:               eg.</p>
                   2184:               <pre class="programlisting">
                   2185: CFLAGS= -xtarget=ultra -xarch=v9
                   2186: </pre>
                   2187: 
                   2188:               <p>Whichever compiler you use, please ensure the
                   2189:               compiler tools and your $prefix are in your
1.7       wiz      2190:               <code class="varname">PATH</code>. This includes
                   2191:               <code class="filename">/usr/ccs/{bin,lib}</code> and
                   2192:               eg. <code class=
                   2193:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2194:             </div>
                   2195:           </div>
                   2196:         </div>
                   2197:       </div>
                   2198: 
                   2199:       <div class="chapter" lang="en" xml:lang="en">
                   2200:         <div class="titlepage">
                   2201:           <div>
                   2202:             <div>
                   2203:               <h2 class="title"><a name="using" id=
                   2204:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2205:             </div>
                   2206:           </div>
                   2207:         </div>
                   2208: 
                   2209:         <div class="toc">
                   2210:           <p><b>Table of Contents</b></p>
                   2211: 
                   2212:           <dl>
                   2213:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2214:             Working with binary packages</a></span></dt>
                   2215: 
                   2216:             <dd>
                   2217:               <dl>
1.11    ! ben      2218:                 <dt><span class="sect2"><a href="#id2516458">4.1.1.
1.1       grant    2219:                 Where to get binary packages</a></span></dt>
                   2220: 
1.11    ! ben      2221:                 <dt><span class="sect2"><a href="#id2516499">4.1.2.
1.1       grant    2222:                 How to use binary packages</a></span></dt>
                   2223: 
1.11    ! ben      2224:                 <dt><span class="sect2"><a href="#id2516633">4.1.3.
1.1       grant    2225:                 A word of warning</a></span></dt>
                   2226:               </dl>
                   2227:             </dd>
                   2228: 
1.11    ! ben      2229:             <dt><span class="sect1"><a href="#id2516645">4.2.
1.1       grant    2230:             Building packages from source</a></span></dt>
                   2231: 
                   2232:             <dd>
                   2233:               <dl>
1.11    ! ben      2234:                 <dt><span class="sect2"><a href="#id2516654">4.2.1.
1.1       grant    2235:                 Requirements</a></span></dt>
                   2236: 
1.11    ! ben      2237:                 <dt><span class="sect2"><a href="#id2516675">4.2.2.
1.1       grant    2238:                 Fetching distfiles</a></span></dt>
                   2239: 
1.11    ! ben      2240:                 <dt><span class="sect2"><a href="#id2516795">4.2.3.
1.1       grant    2241:                 How to build and install</a></span></dt>
                   2242: 
1.11    ! ben      2243:                 <dt><span class="sect2"><a href="#id2517522">4.2.4.
1.1       grant    2244:                 Selecting the compiler</a></span></dt>
                   2245:               </dl>
                   2246:             </dd>
                   2247:           </dl>
                   2248:         </div>
                   2249: 
                   2250:         <div class="sect1" lang="en" xml:lang="en">
                   2251:           <div class="titlepage">
                   2252:             <div>
                   2253:               <div>
                   2254:                 <h2 class="title" style="clear: both"><a name=
                   2255:                 "getting-started" id=
                   2256:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2257:                 packages</h2>
                   2258:               </div>
                   2259:             </div>
                   2260:           </div>
                   2261: 
                   2262:           <p>This section describes how to find, retrieve and
                   2263:           install a precompiled binary package that someone else
                   2264:           already prepared for your type of machine.</p>
                   2265: 
                   2266:           <div class="sect2" lang="en" xml:lang="en">
                   2267:             <div class="titlepage">
                   2268:               <div>
                   2269:                 <div>
1.11    ! ben      2270:                   <h3 class="title"><a name="id2516458" id=
        !          2271:                   "id2516458"></a>4.1.1.&nbsp;Where to get binary
1.1       grant    2272:                   packages</h3>
                   2273:                 </div>
                   2274:               </div>
                   2275:             </div>
                   2276: 
                   2277:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.7       wiz      2278:             and its mirrors in the directory <code class=
                   2279:             "filename">/pub/NetBSD/packages</code> for anonymous
                   2280:             FTP access. Please pick the right subdirectory there as
                   2281:             indicated by <span><strong class="command">uname
                   2282:             -p</strong></span>. In that directory, there is a
1.1       grant    2283:             subdirectory for each category plus a subdirectory
1.7       wiz      2284:             <code class="filename">All</code> which includes the
                   2285:             actual binaries in <code class="filename">.tgz</code>
                   2286:             files. The category subdirectories use symbolic links
                   2287:             to those files (this is the same directory layout as in
                   2288:             <code class=
                   2289:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2290: 
                   2291:             <p>This same directory layout applies for CDROM
                   2292:             distributions, only that the directory may be rooted
1.7       wiz      2293:             somewhere else, probably somewhere below <code class=
                   2294:             "filename">/cdrom</code>. Please consult your CDROMs
1.1       grant    2295:             documentation for the exact location.</p>
                   2296:           </div>
                   2297: 
                   2298:           <div class="sect2" lang="en" xml:lang="en">
                   2299:             <div class="titlepage">
                   2300:               <div>
                   2301:                 <div>
1.11    ! ben      2302:                   <h3 class="title"><a name="id2516499" id=
        !          2303:                   "id2516499"></a>4.1.2.&nbsp;How to use binary
1.1       grant    2304:                   packages</h3>
                   2305:                 </div>
                   2306:               </div>
                   2307:             </div>
                   2308: 
                   2309:             <p>If you have the files on a CDROM or downloaded them
                   2310:             to your hard disk, youcan install them with the
1.7       wiz      2311:             following command (be sure to<span><strong class=
                   2312:             "command">su</strong></span> to root first):</p>
1.1       grant    2313:             <pre class="screen">
1.7       wiz      2314: <code class="prompt">#</code> <strong class=
                   2315: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    2316: </pre>
                   2317: 
                   2318:             <p>If you have FTP access and you don't want to
                   2319:             download the packages via FTP prior to installation,
1.7       wiz      2320:             you can do this automatically by giving
                   2321:             <span><strong class="command">pkg_add</strong></span>
                   2322:             an FTP URL:</p>
1.1       grant    2323:             <pre class="screen">
1.7       wiz      2324: <code class="prompt">#</code> <strong class=
                   2325: "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    2326: </pre>
                   2327: 
                   2328:             <p>If there is any doubt, the uname utility can be used
                   2329:             to determine the &lt;OSvers&gt;, and &lt;arch&gt; by
1.7       wiz      2330:             running <span><strong class="command">uname
                   2331:             -rp</strong></span>.</p>
1.1       grant    2332: 
                   2333:             <p>Also note that any prerequisite packages needed to
                   2334:             run the package in question will be installed, too,
                   2335:             assuming they are present where you install from.</p>
                   2336: 
                   2337:             <p>After you've installed packages, be sure to have
1.7       wiz      2338:             <code class="filename">/usr/pkg/bin</code> in your
                   2339:             <code class="varname">PATH</code> so you can actually
                   2340:             start the just installed program.</p>
1.1       grant    2341:           </div>
                   2342: 
                   2343:           <div class="sect2" lang="en" xml:lang="en">
                   2344:             <div class="titlepage">
                   2345:               <div>
                   2346:                 <div>
1.11    ! ben      2347:                   <h3 class="title"><a name="id2516633" id=
        !          2348:                   "id2516633"></a>4.1.3.&nbsp;A word of
1.1       grant    2349:                   warning</h3>
                   2350:                 </div>
                   2351:               </div>
                   2352:             </div>
                   2353: 
                   2354:             <p>Please pay very careful attention to the warnings
                   2355:             expressed in the <a href=
                   2356:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2357:             <span class="citerefentry"><span class=
                   2358:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2359:             page about the inherent dangers of installing binary
                   2360:             packages which you did not create yourself, and the
                   2361:             security holes that can be introduced onto your system
                   2362:             by indiscriminate adding of such files.</p>
                   2363:           </div>
                   2364:         </div>
                   2365: 
                   2366:         <div class="sect1" lang="en" xml:lang="en">
                   2367:           <div class="titlepage">
                   2368:             <div>
                   2369:               <div>
                   2370:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      2371:                 "id2516645" id="id2516645"></a>4.2.&nbsp;Building
1.1       grant    2372:                 packages from source</h2>
                   2373:               </div>
                   2374:             </div>
                   2375:           </div>
                   2376: 
                   2377:           <p>This assumes that the package is already in pkgsrc. If
                   2378:           it is not, see <a href="#developers-guide" title=
1.2       hubertf  2379:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
                   2380:           &#8220;The pkgsrc developer's guide&#8221;</a>.</p>
1.1       grant    2381: 
                   2382:           <div class="sect2" lang="en" xml:lang="en">
                   2383:             <div class="titlepage">
                   2384:               <div>
                   2385:                 <div>
1.11    ! ben      2386:                   <h3 class="title"><a name="id2516654" id=
        !          2387:                   "id2516654"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2388:                 </div>
                   2389:               </div>
                   2390:             </div>
                   2391: 
                   2392:             <p>To build packages from source on a NetBSD system the
                   2393:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2394:             &#8220;<span class="quote">text</span>&#8221;
                   2395:             distribution sets must be installed. If you want to
                   2396:             build X11 related packages the &#8220;<span class=
                   2397:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2398:             "quote">xcomp</span>&#8221; distribution sets are
                   2399:             required, too.</p>
                   2400:           </div>
                   2401: 
                   2402:           <div class="sect2" lang="en" xml:lang="en">
                   2403:             <div class="titlepage">
                   2404:               <div>
                   2405:                 <div>
1.11    ! ben      2406:                   <h3 class="title"><a name="id2516675" id=
        !          2407:                   "id2516675"></a>4.2.2.&nbsp;Fetching
1.1       grant    2408:                   distfiles</h3>
                   2409:                 </div>
                   2410:               </div>
                   2411:             </div>
                   2412: 
                   2413:             <p>The distfile (i.e. the unmodified source) must exist
                   2414:             on your system for the packages system to be able to
                   2415:             build it. If it does not exist, pkgsrc will use
                   2416:             <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   2417:             <span class="citerefentry"><span class=
                   2418:             "refentrytitle">ftp</span>(1)</span></a> to fetch it
                   2419:             automatically.</p>
                   2420: 
                   2421:             <p>You can overwrite some of the major distribution
                   2422:             sites to fit to sites that are close to your own. Have
1.7       wiz      2423:             a look at <code class=
1.11    ! ben      2424:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.7       wiz      2425:             some examples - in particular, look for the
                   2426:             <code class="varname">MASTER_SORT</code>, <code class=
                   2427:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   2428:             "varname">INET_COUNTRY</code> definitions. This may
                   2429:             save some of your bandwidth and time.</p>
1.1       grant    2430: 
                   2431:             <p>You can change these settings either in your shell's
                   2432:             environment, or, if you want to keep the settings, by
1.7       wiz      2433:             editing the <code class="filename">/etc/mk.conf</code>
1.1       grant    2434:             file, and adding the definitions there.</p>
                   2435: 
                   2436:             <p>If you don't have a permanent Internet connection
                   2437:             and you want to know which files to download,
1.7       wiz      2438:             <span><strong class="command">make
                   2439:             fetch-list</strong></span> will tell you what you'll
                   2440:             need. Put these distfiles into <code class=
                   2441:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    2442:           </div>
                   2443: 
                   2444:           <div class="sect2" lang="en" xml:lang="en">
                   2445:             <div class="titlepage">
                   2446:               <div>
                   2447:                 <div>
1.11    ! ben      2448:                   <h3 class="title"><a name="id2516795" id=
        !          2449:                   "id2516795"></a>4.2.3.&nbsp;How to build and
1.1       grant    2450:                   install</h3>
                   2451:                 </div>
                   2452:               </div>
                   2453:             </div>
                   2454: 
                   2455:             <p>Assuming that the distfile has been fetched (see
                   2456:             previous section), become root and change into the
1.7       wiz      2457:             relevant directory and running <span><strong class=
                   2458:             "command">make</strong></span>. For example, type</p>
1.1       grant    2459:             <pre class="screen">
1.7       wiz      2460: <code class="prompt">%</code> <strong class=
                   2461: "userinput"><code>cd misc/figlet</code></strong>
                   2462: <code class="prompt">%</code> <strong class=
                   2463: "userinput"><code>make</code></strong>
1.1       grant    2464: </pre>
                   2465: 
                   2466:             <p>at the shell prompt to build the various components
                   2467:             of the package, and</p>
                   2468:             <pre class="screen">
1.7       wiz      2469: <code class="prompt">#</code> <strong class=
                   2470: "userinput"><code>make install</code></strong>
1.1       grant    2471: </pre>
                   2472: 
                   2473:             <p>to install the various components into the correct
                   2474:             places on your system. Installing the package on your
                   2475:             system requires you to be root. However, pkgsrc has a
                   2476:             <span class="emphasis"><em>just-in-time-su</em></span>
                   2477:             feature, which allows you to only become root for the
                   2478:             actual installation step</p>
                   2479: 
                   2480:             <p>Taking the figlet utility as an example, we can
                   2481:             install it on our system by building as shown in
                   2482:             <a href="#logs" title=
                   2483:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
                   2484:             logs</i></a>.</p>
                   2485: 
                   2486:             <p>The program is installed under the default root of
1.7       wiz      2487:             the packages tree - <code class=
                   2488:             "filename">/usr/pkg</code>. Should this not conform to
                   2489:             your tastes, set the <code class=
                   2490:             "varname">LOCALBASE</code> variable in your
1.1       grant    2491:             environment, and it will use that value as the root of
1.7       wiz      2492:             your packages tree. So, to use <code class=
                   2493:             "filename">/usr/local</code>, set <code class=
                   2494:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    2495:             environment. Please note that you should use a
                   2496:             directory which is dedicated to packages and not shared
1.7       wiz      2497:             with other programs (ie, do not try and use
                   2498:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   2499:             should not try to add any of your own files or
                   2500:             directories (such as <code class=
                   2501:             "filename">src/</code>, <code class=
                   2502:             "filename">obj/</code>, or <code class=
                   2503:             "filename">pkgsrc/</code>) below the <code class=
                   2504:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    2505:             possible conflicts between programs and other files
                   2506:             installed by the package system and whatever else may
                   2507:             have been installed there.</p>
                   2508: 
1.7       wiz      2509:             <p>Some packages look in <code class=
                   2510:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    2511:             configuration options at build time. Have a look at
1.7       wiz      2512:             <code class=
1.11    ! ben      2513:             "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
        !          2514:             overview of what will be set there by default.
1.7       wiz      2515:             Environment variables such as <code class=
                   2516:             "varname">LOCALBASE</code> can be set in <code class=
                   2517:             "filename">/etc/mk.conf</code> to save having to
                   2518:             remember to set them each time you want to use
                   2519:             pkgsrc.</p>
1.1       grant    2520: 
                   2521:             <p>Occasionally, people want to &#8220;<span class=
                   2522:             "quote">look under the covers</span>&#8221; to see what
                   2523:             is going on when a package is building or being
                   2524:             installed. This may be for debugging purposes, or out
                   2525:             of simple curiosity. A number of utility values have
                   2526:             been added to help with this.</p>
                   2527: 
                   2528:             <div class="orderedlist">
                   2529:               <ol type="1">
                   2530:                 <li>
                   2531:                   <p>If you invoke the <a href=
                   2532:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2533:                   <span class="citerefentry"><span class=
                   2534:                   "refentrytitle">make</span>(1)</span></a> command
1.7       wiz      2535:                   with <code class=
                   2536:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   2537:                   amount of information will be displayed. For
                   2538:                   example,</p>
1.1       grant    2539:                   <pre class="screen">
1.7       wiz      2540: <strong class=
                   2541: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    2542: </pre>
                   2543: 
                   2544:                   <p>will show all the commands that are invoked,
                   2545:                   up to and including the &#8220;<span class=
                   2546:                   "quote">patch</span>&#8221; stage.</p>
                   2547:                 </li>
                   2548: 
                   2549:                 <li>
                   2550:                   <p>If you want to know the value of a certain
1.7       wiz      2551:                   make(1) definition, then the <code class=
                   2552:                   "varname">VARNAME</code> definition should be
                   2553:                   used, in conjunction with the show-var target.
                   2554:                   e.g. to show the expansion of the <a href=
1.1       grant    2555:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2556:                   <span class="citerefentry"><span class=
                   2557:                   "refentrytitle">make</span>(1)</span></a>
1.7       wiz      2558:                   variable <code class=
                   2559:                   "varname">DISTFILES</code>:</p>
1.1       grant    2560:                   <pre class="screen">
1.7       wiz      2561: <code class="prompt">%</code> <strong class=
                   2562: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    2563: /usr/pkg
1.7       wiz      2564: <code class="prompt">%</code>
1.1       grant    2565:           
                   2566: </pre>
                   2567:                 </li>
                   2568:               </ol>
                   2569:             </div>
                   2570: 
                   2571:             <p>If you want to install a binary package that you've
                   2572:             either created yourself (see next section), that you
                   2573:             put into pkgsrc/packages manually or that is located on
1.8       wiz      2574:             a remote FTP server, you can use the "bin-install"
1.1       grant    2575:             target. This target will install a binary package - if
                   2576:             available - via <a href=
                   2577:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2578:             <span class="citerefentry"><span class=
                   2579:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.7       wiz      2580:             <span><strong class="command">make
                   2581:             package</strong></span>. The list of remote FTP sites
                   2582:             searched is kept in the variable <code class=
1.11    ! ben      2583:             "varname">BINPKG_SITES</code>, which defaults to
1.7       wiz      2584:             ftp.NetBSD.org. Any flags that should be added to
                   2585:             <a href=
1.1       grant    2586:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2587:             <span class="citerefentry"><span class=
                   2588:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.7       wiz      2589:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
                   2590:             See <code class=
1.11    ! ben      2591:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
        !          2592:             details.</p>
1.1       grant    2593: 
                   2594:             <p>A final word of warning: If you setup a system that
1.7       wiz      2595:             has a non-standard setting for <code class=
                   2596:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    2597:             any packages are installed, as you can not use several
                   2598:             directories for the same purpose. Doing so will result
                   2599:             in pkgsrc not being able to properly detect your
                   2600:             installed packages, and fail miserably. Note also that
                   2601:             precompiled binary packages are usually built with the
1.7       wiz      2602:             default <code class="varname">LOCALBASE</code> of
                   2603:             <code class="filename">/usr/pkg</code>, and that you
                   2604:             should <span class="emphasis"><em>not</em></span>
                   2605:             install any if you use a non-standard <code class=
                   2606:             "varname">LOCALBASE</code>.</p>
1.1       grant    2607:           </div>
                   2608: 
                   2609:           <div class="sect2" lang="en" xml:lang="en">
                   2610:             <div class="titlepage">
                   2611:               <div>
                   2612:                 <div>
1.11    ! ben      2613:                   <h3 class="title"><a name="id2517522" id=
        !          2614:                   "id2517522"></a>4.2.4.&nbsp;Selecting the
1.1       grant    2615:                   compiler</h3>
                   2616:                 </div>
                   2617:               </div>
                   2618:             </div>
                   2619: 
                   2620:             <p>By default, pkgsrc will use GCC to build packages.
                   2621:             This may be overridden by setting the following
                   2622:             variables in /etc/mk.conf:</p>
                   2623: 
                   2624:             <div class="variablelist">
                   2625:               <dl>
1.7       wiz      2626:                 <dt><span class="term"><code class=
                   2627:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    2628: 
                   2629:                 <dd>
                   2630:                   <p>This is a list of values specifying the chain
                   2631:                   of compilers to invoke when building packages.
                   2632:                   Valid values are:</p>
                   2633: 
                   2634:                   <div class="itemizedlist">
                   2635:                     <ul type="disc">
                   2636:                       <li>
1.7       wiz      2637:                         <p><code class="varname">distcc</code>:
1.1       grant    2638:                         distributed C/C++ (chainable)</p>
                   2639:                       </li>
                   2640: 
                   2641:                       <li>
1.7       wiz      2642:                         <p><code class="varname">ccache</code>:
1.1       grant    2643:                         compiler cache (chainable)</p>
                   2644:                       </li>
                   2645: 
                   2646:                       <li>
1.7       wiz      2647:                         <p><code class="varname">gcc</code>: GNU
                   2648:                         C/C++ Compiler</p>
1.1       grant    2649:                       </li>
                   2650: 
                   2651:                       <li>
1.7       wiz      2652:                         <p><code class="varname">mipspro</code>:
1.1       grant    2653:                         Silicon Graphics, Inc. MIPSpro
                   2654:                         (n32/n64)</p>
                   2655:                       </li>
                   2656: 
                   2657:                       <li>
1.7       wiz      2658:                         <p><code class="varname">mipspro</code>:
1.1       grant    2659:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   2660:                       </li>
                   2661: 
                   2662:                       <li>
1.7       wiz      2663:                         <p><code class="varname">sunpro</code>:
1.1       grant    2664:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   2665:                         Studio</p>
                   2666:                       </li>
                   2667:                     </ul>
                   2668:                   </div>
                   2669: 
                   2670:                   <p>The default is &#8220;<span class=
1.7       wiz      2671:                   "quote"><code class=
                   2672:                   "varname">gcc</code></span>&#8221;. You can use
                   2673:                   <code class="varname">ccache</code> and/or
                   2674:                   <code class="varname">distcc</code> with an
                   2675:                   appropriate <code class=
                   2676:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   2677:                   &#8220;<span class="quote"><code class=
                   2678:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    2679:                   variable should always be terminated with a value
                   2680:                   for a real compiler.</p>
                   2681:                 </dd>
                   2682: 
1.7       wiz      2683:                 <dt><span class="term"><code class=
                   2684:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    2685: 
                   2686:                 <dd>
                   2687:                   <p>This specifies the minimum version of GCC to
                   2688:                   use when building packages. If the system GCC
                   2689:                   doesn't satisfy this requirement, then pkgsrc
                   2690:                   will build and install one of the GCC packages to
                   2691:                   use instead.</p>
                   2692:                 </dd>
                   2693:               </dl>
                   2694:             </div>
                   2695:           </div>
                   2696:         </div>
                   2697:       </div>
                   2698: 
                   2699:       <div class="chapter" lang="en" xml:lang="en">
                   2700:         <div class="titlepage">
                   2701:           <div>
                   2702:             <div>
                   2703:               <h2 class="title"><a name="binary" id=
                   2704:               "binary"></a>Chapter&nbsp;5.&nbsp;Creating binary
                   2705:               packages</h2>
                   2706:             </div>
                   2707:           </div>
                   2708:         </div>
                   2709: 
                   2710:         <div class="toc">
                   2711:           <p><b>Table of Contents</b></p>
                   2712: 
                   2713:           <dl>
1.11    ! ben      2714:             <dt><span class="sect1"><a href="#id2582803">5.1.
1.1       grant    2715:             Building a single binary package</a></span></dt>
                   2716: 
1.11    ! ben      2717:             <dt><span class="sect1"><a href="#id2582881">5.2.
1.1       grant    2718:             Settings for creation of binary
                   2719:             packages</a></span></dt>
                   2720: 
                   2721:             <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
                   2722:             a bulk build of all packages</a></span></dt>
                   2723: 
                   2724:             <dd>
                   2725:               <dl>
                   2726:                 <dt><span class="sect2"><a href=
                   2727:                 "#binary.configuration">5.3.1.
                   2728:                 Configuration</a></span></dt>
                   2729: 
1.11    ! ben      2730:                 <dt><span class="sect2"><a href="#id2583020">5.3.2.
1.1       grant    2731:                 Other environmental considerations</a></span></dt>
                   2732: 
1.11    ! ben      2733:                 <dt><span class="sect2"><a href="#id2583061">5.3.3.
1.1       grant    2734:                 Operation</a></span></dt>
                   2735: 
1.11    ! ben      2736:                 <dt><span class="sect2"><a href="#id2583200">5.3.4.
1.1       grant    2737:                 What it does</a></span></dt>
                   2738: 
1.11    ! ben      2739:                 <dt><span class="sect2"><a href="#id2583256">5.3.5.
1.1       grant    2740:                 Disk space requirements</a></span></dt>
                   2741: 
1.11    ! ben      2742:                 <dt><span class="sect2"><a href="#id2583351">5.3.6.
1.1       grant    2743:                 Setting up a sandbox for chroot'ed
                   2744:                 builds</a></span></dt>
                   2745: 
1.11    ! ben      2746:                 <dt><span class="sect2"><a href="#id2583715">5.3.7.
1.1       grant    2747:                 Building a partial set of packages</a></span></dt>
                   2748:               </dl>
                   2749:             </dd>
                   2750: 
1.11    ! ben      2751:             <dt><span class="sect1"><a href="#id2583757">5.4.
1.1       grant    2752:             Creating a multiple CD-ROM packages
                   2753:             collection</a></span></dt>
                   2754: 
                   2755:             <dd>
                   2756:               <dl>
1.11    ! ben      2757:                 <dt><span class="sect2"><a href="#id2583772">5.4.1.
1.1       grant    2758:                 Example of cdpack</a></span></dt>
                   2759:               </dl>
                   2760:             </dd>
                   2761:           </dl>
                   2762:         </div>
                   2763: 
                   2764:         <div class="sect1" lang="en" xml:lang="en">
                   2765:           <div class="titlepage">
                   2766:             <div>
                   2767:               <div>
                   2768:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      2769:                 "id2582803" id="id2582803"></a>5.1.&nbsp;Building a
1.1       grant    2770:                 single binary package</h2>
                   2771:               </div>
                   2772:             </div>
                   2773:           </div>
                   2774: 
                   2775:           <p>Once you have built and installed a package, you can
                   2776:           create a <span class="emphasis"><em>binary
                   2777:           package</em></span> which can be installed on another
                   2778:           system with <a href=
                   2779:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2780:           <span class="citerefentry"><span class=
                   2781:           "refentrytitle">pkg_add</span>(1)</span></a> This saves
                   2782:           having to build the same package on a group of hosts and
                   2783:           wasting CPU time. It also provides a simple means for
                   2784:           others to install your package, should you distribute
                   2785:           it.</p>
                   2786: 
                   2787:           <p>To create a binary package, change into the
1.7       wiz      2788:           appropriate directory in pkgsrc, and run
                   2789:           <span><strong class="command">make
                   2790:           package</strong></span>:</p>
1.1       grant    2791:           <pre class="screen">
1.7       wiz      2792: <code class="prompt">#</code> <strong class=
                   2793: "userinput"><code>cd misc/figlet</code></strong>
                   2794: <code class="prompt">#</code> <strong class=
                   2795: "userinput"><code>make package</code></strong>
1.1       grant    2796: </pre>
                   2797: 
                   2798:           <p>This will build and install your package (if not
                   2799:           already done), and then build a binary package from what
1.7       wiz      2800:           was installed. You can then use the <span><strong class=
                   2801:           "command">pkg_*</strong></span> tools to manipulate it.
                   2802:           Binary packages are created by default in <code class=
                   2803:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    2804:           gzipped tar file. See <a href="#logs.package" title=
                   2805:           "B.2.&nbsp;Packaging figlet">Section B.2,
                   2806:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   2807:           the above <a xmlns=
                   2808:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   2809:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.7       wiz      2810:           class="pkgname">misc/figlet</a> example.</p>
1.1       grant    2811: 
                   2812:           <p>See <a href="#submit" title=
                   2813:           "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter
                   2814:           14, <i>Submitting and Committing</i></a> for information
                   2815:           on how to submit such a binary package.</p>
                   2816:         </div>
                   2817: 
                   2818:         <div class="sect1" lang="en" xml:lang="en">
                   2819:           <div class="titlepage">
                   2820:             <div>
                   2821:               <div>
                   2822:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      2823:                 "id2582881" id="id2582881"></a>5.2.&nbsp;Settings
1.1       grant    2824:                 for creation of binary packages</h2>
                   2825:               </div>
                   2826:             </div>
                   2827:           </div>
                   2828: 
                   2829:           <p>See <a href="#build.helpful-targets" title=
                   2830:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   2831:           &#8220;Other helpful targets&#8221;</a>.</p>
                   2832:         </div>
                   2833: 
                   2834:         <div class="sect1" lang="en" xml:lang="en">
                   2835:           <div class="titlepage">
                   2836:             <div>
                   2837:               <div>
                   2838:                 <h2 class="title" style="clear: both"><a name=
                   2839:                 "bulkbuild" id="bulkbuild"></a>5.3.&nbsp;Doing a
                   2840:                 bulk build of all packages</h2>
                   2841:               </div>
                   2842:             </div>
                   2843:           </div>
                   2844: 
                   2845:           <p>If you want to get a full set of precompiled binary
                   2846:           packages, this section describes how to get them. Beware
                   2847:           that the bulk build will remove all currently installed
                   2848:           packages from your system! Having a FTP server configured
                   2849:           either on the machine doing the bulk builds or on a
                   2850:           nearby NFS server can help to make the packages available
                   2851:           to everyone. See <a href=
                   2852:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   2853:           <span class="citerefentry"><span class=
                   2854:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   2855:           information. If you use a remote NFS server's storage, be
                   2856:           sure to not actually compile on NFS storage, as this
                   2857:           slows things down a lot.</p>
                   2858: 
                   2859:           <div class="sect2" lang="en" xml:lang="en">
                   2860:             <div class="titlepage">
                   2861:               <div>
                   2862:                 <div>
                   2863:                   <h3 class="title"><a name="binary.configuration"
                   2864:                   id=
                   2865:                   "binary.configuration"></a>5.3.1.&nbsp;Configuration</h3>
                   2866:                 </div>
                   2867:               </div>
                   2868:             </div>
                   2869: 
                   2870:             <div class="sect3" lang="en" xml:lang="en">
                   2871:               <div class="titlepage">
                   2872:                 <div>
                   2873:                   <div>
                   2874:                     <h4 class="title"><a name="binary.mk.conf" id=
                   2875:                     "binary.mk.conf"></a>5.3.1.1.&nbsp;/etc/mk.conf</h4>
                   2876:                   </div>
                   2877:                 </div>
                   2878:               </div>
                   2879: 
1.7       wiz      2880:               <p>You may want to set things in <code class=
                   2881:               "filename">/etc/mk.conf</code>. Look at <code class=
1.11    ! ben      2882:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    2883:               details of the default settings. You will want to
1.7       wiz      2884:               ensure that <code class=
                   2885:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   2886:               policy. As used in this example, <code class=
                   2887:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    2888:               "emphasis"><em>all</em></span> licenses.</p>
                   2889:               <pre class="programlisting">
                   2890: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   2891: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   2892: BSDSRCDIR=      /usr/src
                   2893: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   2894: OBJHOSTNAME?=   yes               # use work.`hostname`
                   2895: FAILOVER_FETCH= yes               # insist on the correct checksum
                   2896: PKG_DEVELOPER?= yes
                   2897: _ACCEPTABLE=    yes
                   2898: </pre>
                   2899:             </div>
                   2900: 
                   2901:             <div class="sect3" lang="en" xml:lang="en">
                   2902:               <div class="titlepage">
                   2903:                 <div>
                   2904:                   <div>
1.11    ! ben      2905:                     <h4 class="title"><a name="id2582945" id=
        !          2906:                     "id2582945"></a>5.3.1.2.&nbsp;<code class=
1.7       wiz      2907:                     "filename">build.conf</code></h4>
1.1       grant    2908:                   </div>
                   2909:                 </div>
                   2910:               </div>
                   2911: 
1.7       wiz      2912:               <p>In <code class="filename">pkgsrc/mk/bulk</code>,
                   2913:               copy <code class="filename">build.conf-example</code>
                   2914:               to <code class="filename">build.conf</code> and edit
                   2915:               it, following the comments in that file. This is the
1.1       grant    2916:               config file that determines where log files are
                   2917:               generated after the build, where to mail the build
                   2918:               report to, where your pkgsrc tree is located and
                   2919:               which user to <a href=
                   2920:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   2921:               <span class="citerefentry"><span class=
                   2922:               "refentrytitle">su</span>(8)</span></a> to to do a
1.7       wiz      2923:               <span><strong class="command">cvs
                   2924:               update</strong></span>.</p>
1.1       grant    2925:             </div>
                   2926: 
                   2927:             <div class="sect3" lang="en" xml:lang="en">
                   2928:               <div class="titlepage">
                   2929:                 <div>
                   2930:                   <div>
1.11    ! ben      2931:                     <h4 class="title"><a name="id2582981" id=
        !          2932:                     "id2582981"></a>5.3.1.3.&nbsp;<code class=
1.7       wiz      2933:                     "filename">pre-build.local</code></h4>
1.1       grant    2934:                   </div>
                   2935:                 </div>
                   2936:               </div>
                   2937: 
                   2938:               <p>It is possible to configure the bulk build to
                   2939:               perform certain site specific tasks at the end of the
1.7       wiz      2940:               pre-build stage. If the file <code class=
                   2941:               "filename">pre-build.local</code> exists in
                   2942:               <code class="filename">/usr/pkgsrc/mk/bulk</code> it
                   2943:               will be executed (as a sh(1) script) at the end of
                   2944:               the usual pre-build stage. An example use of
                   2945:               <code class="filename">pre-build.local</code> is to
                   2946:               have the line:</p>
1.1       grant    2947:               <pre class="screen">
1.7       wiz      2948: <code class="prompt">#</code> <strong class=
                   2949: "userinput"><code>echo "I do not have enough disk space to build this pig." \
                   2950:     &gt; pkgsrc/games/crafty-book-enormous/$BROKENF</code></strong>
1.1       grant    2951: </pre>
                   2952: 
                   2953:               <p>to prevent the system from trying to build a
                   2954:               particular package which requires nearly 3 GB of disk
                   2955:               space.</p>
                   2956:             </div>
                   2957:           </div>
                   2958: 
                   2959:           <div class="sect2" lang="en" xml:lang="en">
                   2960:             <div class="titlepage">
                   2961:               <div>
                   2962:                 <div>
1.11    ! ben      2963:                   <h3 class="title"><a name="id2583020" id=
        !          2964:                   "id2583020"></a>5.3.2.&nbsp;Other environmental
1.1       grant    2965:                   considerations</h3>
                   2966:                 </div>
                   2967:               </div>
                   2968:             </div>
                   2969: 
1.7       wiz      2970:             <p>As <code class="filename">/usr/pkg</code> will be
1.1       grant    2971:             completely deleted at the start of bulk builds, make
                   2972:             sure your login shell is placed somewhere else. Either
1.7       wiz      2973:             drop it into <code class=
                   2974:             "filename">/usr/local/bin</code> (and adjust your login
                   2975:             shell in the passwd file), or (re-)install it via
                   2976:             <a href=
1.1       grant    2977:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2978:             <span class="citerefentry"><span class=
                   2979:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.7       wiz      2980:             <code class="filename">/etc/rc.local</code>, so you can
1.1       grant    2981:             login after a reboot (remember that your current
                   2982:             process won't die if the package is removed, you just
                   2983:             can't start any new instances of the shell any more).
                   2984:             Also, if you use NetBSD earlier than 1.5, or you still
                   2985:             want to use the pkgsrc version of ssh for some reason,
                   2986:             be sure to install ssh before starting it from
1.7       wiz      2987:             <code class="filename">rc.local</code>:</p>
1.1       grant    2988:             <pre class="programlisting">
                   2989: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   2990: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   2991:     /usr/pkg/etc/rc.d/sshd
                   2992: fi
                   2993: </pre>
                   2994: 
                   2995:             <p>Not doing so will result in you being not able to
                   2996:             log in via ssh after the bulk build is finished or if
                   2997:             the machine gets rebooted or crashes. You have been
                   2998:             warned! :)</p>
                   2999:           </div>
                   3000: 
                   3001:           <div class="sect2" lang="en" xml:lang="en">
                   3002:             <div class="titlepage">
                   3003:               <div>
                   3004:                 <div>
1.11    ! ben      3005:                   <h3 class="title"><a name="id2583061" id=
        !          3006:                   "id2583061"></a>5.3.3.&nbsp;Operation</h3>
1.1       grant    3007:                 </div>
                   3008:               </div>
                   3009:             </div>
                   3010: 
                   3011:             <p>Make sure you don't need any of the packages still
                   3012:             installed.</p>
                   3013: 
                   3014:             <div class="warning" style=
                   3015:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3016:               <h3 class="title">Warning</h3>
                   3017: 
                   3018:               <p>During the bulk build, <span class=
                   3019:               "emphasis"><em>all packages will be
                   3020:               removed!</em></span></p>
                   3021:             </div>
                   3022: 
                   3023:             <p>Be sure to remove all other things that might
                   3024:             interfere with builds, like some libs installed in
1.7       wiz      3025:             <code class="filename">/usr/local</code>, etc. then
                   3026:             become root and type:</p>
1.1       grant    3027:             <pre class="screen">
1.7       wiz      3028: <code class="prompt">#</code> <strong class=
                   3029: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   3030: <code class="prompt">#</code> <strong class=
                   3031: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    3032: </pre>
                   3033: 
                   3034:             <p>If for some reason your last build didn't complete
                   3035:             (power failure, system panic, ...), you can continue it
                   3036:             by running:</p>
                   3037:             <pre class="screen">
1.7       wiz      3038: <code class="prompt">#</code> <strong class=
                   3039: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    3040: </pre>
                   3041: 
                   3042:             <p>At the end of the bulk build, you will get a summary
                   3043:             via mail, and find build logs in the directory
1.7       wiz      3044:             specified by <code class="varname">FTP</code> in the
                   3045:             <code class="filename">build.conf</code> file.</p>
1.1       grant    3046:           </div>
                   3047: 
                   3048:           <div class="sect2" lang="en" xml:lang="en">
                   3049:             <div class="titlepage">
                   3050:               <div>
                   3051:                 <div>
1.11    ! ben      3052:                   <h3 class="title"><a name="id2583200" id=
        !          3053:                   "id2583200"></a>5.3.4.&nbsp;What it does</h3>
1.1       grant    3054:                 </div>
                   3055:               </div>
                   3056:             </div>
                   3057: 
                   3058:             <p>The bulk builds consist of three steps:</p>
                   3059: 
                   3060:             <div class="variablelist">
                   3061:               <dl>
                   3062:                 <dt><span class="term">1. pre-build</span></dt>
                   3063: 
                   3064:                 <dd>
                   3065:                   <p>The script updates your pkgsrc tree via
                   3066:                   (anon)cvs, then cleans out any broken distfiles,
                   3067:                   and removes all packages installed.</p>
                   3068:                 </dd>
                   3069: 
                   3070:                 <dt><span class="term">2. the bulk
                   3071:                 build</span></dt>
                   3072: 
                   3073:                 <dd>
                   3074:                   <p>This is basically &#8220;<span class=
                   3075:                   "quote">make bulk-package</span>&#8221; with an
                   3076:                   optimised order in which packages will be built.
                   3077:                   Packages that don't require other packages will
                   3078:                   be built first, and packages with many
                   3079:                   dependencies will be built later.</p>
                   3080:                 </dd>
                   3081: 
                   3082:                 <dt><span class="term">3. post-build</span></dt>
                   3083: 
                   3084:                 <dd>
                   3085:                   <p>Generates a report that's placed in the
1.7       wiz      3086:                   directory specified in the <code class=
                   3087:                   "filename">build.conf</code> file named
                   3088:                   <code class="filename">broken.html</code>, a
                   3089:                   short version of that report will also be mailed
                   3090:                   to the build's admin.</p>
1.1       grant    3091:                 </dd>
                   3092:               </dl>
                   3093:             </div>
                   3094: 
                   3095:             <p>During the build, a list of broken packages will be
1.7       wiz      3096:             compiled in <code class=
                   3097:             "filename">/usr/pkgsrc/.broken</code> (or <code class=
                   3098:             "filename">.../.broken.${MACHINE}</code> if
                   3099:             <code class="varname">OBJMACHINE</code> is set),
                   3100:             individual build logs of broken builds can be found in
                   3101:             the package's directory. These files are used by the
                   3102:             bulk-targets to mark broken builds to not waste time
                   3103:             trying to rebuild them, and they can be used to debug
                   3104:             these broken package builds later.</p>
1.1       grant    3105:           </div>
                   3106: 
                   3107:           <div class="sect2" lang="en" xml:lang="en">
                   3108:             <div class="titlepage">
                   3109:               <div>
                   3110:                 <div>
1.11    ! ben      3111:                   <h3 class="title"><a name="id2583256" id=
        !          3112:                   "id2583256"></a>5.3.5.&nbsp;Disk space
1.1       grant    3113:                   requirements</h3>
                   3114:                 </div>
                   3115:               </div>
                   3116:             </div>
                   3117: 
                   3118:             <p>Currently, roughly the following requirements are
                   3119:             valid for NetBSD 2.0/i386:</p>
                   3120: 
                   3121:             <div class="itemizedlist">
                   3122:               <ul type="disc">
                   3123:                 <li>
                   3124:                   <p>10 GB - distfiles (NFS ok)</p>
                   3125:                 </li>
                   3126: 
                   3127:                 <li>
                   3128:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   3129:                 </li>
                   3130: 
                   3131:                 <li>
                   3132:                   <p>5 GB - temp space for compiling (local disk
                   3133:                   recommended)</p>
                   3134:                 </li>
                   3135:               </ul>
                   3136:             </div>
                   3137: 
                   3138:             <p>Note that all pkgs will be de-installed as soon as
                   3139:             they are turned into a binary package, and that sources
                   3140:             are removed, so there is no excessively huge demand to
                   3141:             disk space. Afterwards, if the package is needed again,
                   3142:             it will be installed via <a href=
                   3143:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3144:             <span class="citerefentry"><span class=
                   3145:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   3146:             building again, so there are no cycles wasted by
                   3147:             recompiling.</p>
                   3148:           </div>
                   3149: 
                   3150:           <div class="sect2" lang="en" xml:lang="en">
                   3151:             <div class="titlepage">
                   3152:               <div>
                   3153:                 <div>
1.11    ! ben      3154:                   <h3 class="title"><a name="id2583351" id=
        !          3155:                   "id2583351"></a>5.3.6.&nbsp;Setting up a sandbox
1.1       grant    3156:                   for chroot'ed builds</h3>
                   3157:                 </div>
                   3158:               </div>
                   3159:             </div>
                   3160: 
                   3161:             <p>If you don't want all the pkgs nuked from a machine
                   3162:             (rendering it useless for anything but pkg compiling),
                   3163:             there is the possibility of doing the pkg bulk build
                   3164:             inside a chroot environment.</p>
                   3165: 
                   3166:             <p>The first step to do so is setting up a chroot
1.7       wiz      3167:             sandbox, e.g. <code class=
                   3168:             "filename">/usr/sandbox</code>. After extracting all
                   3169:             the sets from a NetBSD installation or doing a
                   3170:             <span><strong class="command">make distribution
                   3171:             DESTDIR=/usr/sandbox</strong></span> in <code class=
                   3172:             "filename">/usr/src/etc</code>, be sure the following
                   3173:             items are present and properly configured:</p>
1.1       grant    3174: 
                   3175:             <div class="procedure">
                   3176:               <ol type="1">
                   3177:                 <li>
                   3178:                   <p>Kernel</p>
                   3179:                   <pre class="screen">
1.7       wiz      3180: <code class="prompt">#</code> <strong class=
                   3181: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    3182: </pre>
                   3183:                 </li>
                   3184: 
                   3185:                 <li>
1.7       wiz      3186:                   <p><code class="filename">/dev/*</code></p>
1.1       grant    3187:                   <pre class="screen">
1.7       wiz      3188: <code class="prompt">#</code> <strong class=
                   3189: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    3190: </pre>
                   3191:                 </li>
                   3192: 
                   3193:                 <li>
1.7       wiz      3194:                   <p><code class="filename">/etc/resolv.conf</code>
1.1       grant    3195:                   (for <a xmlns=
                   3196:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3197:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.7       wiz      3198:                   class="pkgname">security/smtpd</a> and mail):</p>
1.1       grant    3199:                   <pre class="screen">
1.7       wiz      3200: <code class="prompt">#</code> <strong class=
                   3201: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    3202: </pre>
                   3203:                 </li>
                   3204: 
                   3205:                 <li>
                   3206:                   <p>Working(!) mail config (hostname,
                   3207:                   sendmail.cf):</p>
                   3208:                   <pre class="screen">
1.7       wiz      3209: <code class="prompt">#</code> <strong class=
                   3210: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    3211: </pre>
                   3212:                 </li>
                   3213: 
                   3214:                 <li>
1.7       wiz      3215:                   <p><code class="filename">/etc/localtime</code>
                   3216:                   (for <a xmlns=
1.1       grant    3217:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3218:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.7       wiz      3219:                   class="pkgname">security/smtpd</a>):</p>
1.1       grant    3220:                   <pre class="screen">
1.7       wiz      3221: <code class="prompt">#</code> <strong class=
                   3222: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    3223: </pre>
                   3224:                 </li>
                   3225: 
                   3226:                 <li>
1.7       wiz      3227:                   <p><code class="filename">/usr/src</code> (system
1.1       grant    3228:                   sources, for <a xmlns=
                   3229:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3230:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.7       wiz      3231:                   class="pkgname">sysutils/aperture</a>, <a xmlns=
                   3232:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3233:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
                   3234:                   class="pkgname">net/ppp-mppe</a>):</p>
1.1       grant    3235:                   <pre class="screen">
1.7       wiz      3236: <code class="prompt">#</code> <strong class=
                   3237: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   3238: <code class="prompt">#</code> <strong class=
                   3239: "userinput"><code>ln -s cvs/src-1.6 src</code></strong>
1.1       grant    3240: </pre>
                   3241:                 </li>
                   3242: 
                   3243:                 <li>
1.7       wiz      3244:                   <p>Create <code class=
                   3245:                   "filename">/var/db/pkg</code> (not part of
                   3246:                   default install):</p>
1.1       grant    3247:                   <pre class="screen">
1.7       wiz      3248: <code class="prompt">#</code> <strong class=
                   3249: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    3250: </pre>
                   3251:                 </li>
                   3252: 
                   3253:                 <li>
1.7       wiz      3254:                   <p>Create <code class="filename">/usr/pkg</code>
                   3255:                   (not part of default install):</p>
1.1       grant    3256:                   <pre class="screen">
1.7       wiz      3257: <code class="prompt">#</code> <strong class=
                   3258: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    3259: </pre>
                   3260:                 </li>
                   3261: 
                   3262:                 <li>
1.7       wiz      3263:                   <p>Checkout pkgsrc via cvs into <code class=
                   3264:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    3265:                   <pre class="screen">
1.7       wiz      3266: <code class="prompt">#</code> <strong class=
                   3267: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   3268: <code class="prompt">#</code> <strong class=
                   3269: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    3270: </pre>
                   3271: 
                   3272:                   <p>Do not mount/link this to the copy of your
                   3273:                   pkgsrc tree you do development in, as this will
                   3274:                   likely cause problems!</p>
                   3275:                 </li>
                   3276: 
                   3277:                 <li>
1.7       wiz      3278:                   <p>Make <code class=
                   3279:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
                   3280:                   and <code class="filename">.../distfiles</code>
                   3281:                   point somewhere appropriate. NFS- and/or
                   3282:                   nullfs-mounts may come in handy!</p>
1.1       grant    3283:                 </li>
                   3284: 
                   3285:                 <li>
1.7       wiz      3286:                   <p>Edit <code class=
                   3287:                   "filename">/etc/mk.conf</code>, see <a href=
                   3288:                   "#binary.mk.conf" title=
1.1       grant    3289:                   "5.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;5.3.1.1,
                   3290:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   3291:                 </li>
                   3292: 
                   3293:                 <li>
1.7       wiz      3294:                   <p>Adjust <code class=
                   3295:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    3296:                   needs.</p>
                   3297:                 </li>
                   3298: 
                   3299:                 <li>
1.7       wiz      3300:                   <p>If you have set <code class=
                   3301:                   "varname">CVS_USER</code> in <code class=
                   3302:                   "filename">build.conf</code>, make sure that
                   3303:                   account exists and can do a <span><strong class=
                   3304:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    3305:                   properly!</p>
                   3306:                 </li>
                   3307:               </ol>
                   3308:             </div>
                   3309: 
                   3310:             <p>When the chroot sandbox is setup, you can start the
                   3311:             build with the following steps:</p>
                   3312:             <pre class="screen">
1.7       wiz      3313: <code class="prompt">#</code> <strong class=
                   3314: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   3315: <code class="prompt">#</code> <strong class=
                   3316: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    3317: </pre>
                   3318: 
                   3319:             <p>This will just jump inside the sandbox and start
                   3320:             building. At the end of the build, mail will be sent
                   3321:             with the results of the build. Created binary pkgs will
1.7       wiz      3322:             be in <code class=
                   3323:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    3324:             (wherever that points/mounts to/from).</p>
                   3325:           </div>
                   3326: 
                   3327:           <div class="sect2" lang="en" xml:lang="en">
                   3328:             <div class="titlepage">
                   3329:               <div>
                   3330:                 <div>
1.11    ! ben      3331:                   <h3 class="title"><a name="id2583715" id=
        !          3332:                   "id2583715"></a>5.3.7.&nbsp;Building a partial
1.1       grant    3333:                   set of packages</h3>
                   3334:                 </div>
                   3335:               </div>
                   3336:             </div>
                   3337: 
                   3338:             <p>In addition to building a complete set of all
1.7       wiz      3339:             packages in pkgsrc, the <code class=
                   3340:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   3341:             used to build a subset of the packages contained in
                   3342:             pkgsrc. By setting defining <code class=
                   3343:             "varname">SPECIFIC_PKGS</code> in <code class=
                   3344:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    3345: 
                   3346:             <div class="itemizedlist">
                   3347:               <ul type="disc">
                   3348:                 <li>
                   3349:                   <p>SITE_SPECIFIC_PKGS</p>
                   3350:                 </li>
                   3351: 
                   3352:                 <li>
                   3353:                   <p>HOST_SPECIFIC_PKGS</p>
                   3354:                 </li>
                   3355: 
                   3356:                 <li>
                   3357:                   <p>GROUP_SPECIFIC_PKGS</p>
                   3358:                 </li>
                   3359: 
                   3360:                 <li>
                   3361:                   <p>USER_SPECIFIC_PKGS</p>
                   3362:                 </li>
                   3363:               </ul>
                   3364:             </div>
                   3365: 
                   3366:             <p>will define the set of packages which should be
                   3367:             built. The bulk build code will also include any
                   3368:             packages which are needed as dependencies for the
                   3369:             explicitly listed packages.</p>
                   3370: 
                   3371:             <p>One use of this is to do a bulk build with
1.7       wiz      3372:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    3373:             sandbox periodically to have a complete set of the
                   3374:             binary packages needed for your site available without
                   3375:             the overhead of building extra packages that are not
                   3376:             needed.</p>
                   3377:           </div>
                   3378:         </div>
                   3379: 
                   3380:         <div class="sect1" lang="en" xml:lang="en">
                   3381:           <div class="titlepage">
                   3382:             <div>
                   3383:               <div>
                   3384:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      3385:                 "id2583757" id="id2583757"></a>5.4.&nbsp;Creating a
1.1       grant    3386:                 multiple CD-ROM packages collection</h2>
                   3387:               </div>
                   3388:             </div>
                   3389:           </div>
                   3390: 
                   3391:           <p>After your pkgsrc bulk-build has completed, you may
                   3392:           wish to create a CD-ROM set of the resulting binary
                   3393:           packages to assist in installing packages on other
                   3394:           machines. The <a xmlns=
                   3395:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3396:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.7       wiz      3397:           class="pkgname">pkgtools/cdpack</a> package provides a
                   3398:           simple tool for creating the ISO 9660 images.
                   3399:           <span><strong class="command">cdpack</strong></span>
                   3400:           arranges the packages on the CD-ROMs in a way that keeps
                   3401:           all the dependencies for given package on the same CD as
                   3402:           that package.</p>
1.1       grant    3403: 
                   3404:           <div class="sect2" lang="en" xml:lang="en">
                   3405:             <div class="titlepage">
                   3406:               <div>
                   3407:                 <div>
1.11    ! ben      3408:                   <h3 class="title"><a name="id2583772" id=
        !          3409:                   "id2583772"></a>5.4.1.&nbsp;Example of
1.1       grant    3410:                   cdpack</h3>
                   3411:                 </div>
                   3412:               </div>
                   3413:             </div>
                   3414: 
                   3415:             <p>Complete documentation for cdpack is found in the
                   3416:             cdpack(1) manpage. The following short example assumes
1.7       wiz      3417:             that the binary packages are left in <code class=
                   3418:             "filename">/usr/pkgsrc/packages/All</code> and that
                   3419:             sufficient disk space exists in <code class=
                   3420:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    3421:             <pre class="screen">
1.7       wiz      3422: <code class="prompt">#</code> <strong class=
                   3423: "userinput"><code>mkdir /u2/images</code></strong>
                   3424: <code class="prompt">#</code> <strong class=
                   3425: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   3426: <code class="prompt">#</code> <strong class=
                   3427: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3428: </pre>
                   3429: 
                   3430:             <p>If you wish to include a common set of files
1.7       wiz      3431:             (<code class="filename">COPYRIGHT</code>, <code class=
                   3432:             "filename">README</code>, etc.) on each CD in the
1.1       grant    3433:             collection, then you need to create a directory which
                   3434:             contains these files. e.g.</p>
                   3435:             <pre class="screen">
1.7       wiz      3436: <code class="prompt">#</code> <strong class=
                   3437: "userinput"><code>mkdir /tmp/common</code></strong>
                   3438: <code class="prompt">#</code> <strong class=
                   3439: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   3440: <code class="prompt">#</code> <strong class=
                   3441: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   3442: <code class="prompt">#</code> <strong class=
                   3443: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   3444: <code class="prompt">#</code> <strong class=
                   3445: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   3446: <code class="prompt">#</code> <strong class=
                   3447: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   3448: <code class="prompt">#</code> <strong class=
                   3449: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    3450: </pre>
                   3451: 
                   3452:             <p>Now create the images:</p>
                   3453:             <pre class="screen">
1.7       wiz      3454: <code class="prompt">#</code> <strong class=
                   3455: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3456: </pre>
                   3457: 
1.7       wiz      3458:             <p>Each image will contain <code class=
                   3459:             "filename">README</code>, <code class=
                   3460:             "filename">COPYING</code>, and <code class=
                   3461:             "filename">bin/myscript</code> in their root
1.1       grant    3462:             directories.</p>
                   3463:           </div>
                   3464:         </div>
                   3465:       </div>
                   3466: 
                   3467:       <div class="chapter" lang="en" xml:lang="en">
                   3468:         <div class="titlepage">
                   3469:           <div>
                   3470:             <div>
                   3471:               <h2 class="title"><a name="faq" id=
                   3472:               "faq"></a>Chapter&nbsp;6.&nbsp;Frequently Asked
                   3473:               Questions</h2>
                   3474:             </div>
                   3475:           </div>
                   3476:         </div>
                   3477: 
                   3478:         <div class="toc">
                   3479:           <p><b>Table of Contents</b></p>
                   3480: 
                   3481:           <dl>
1.11    ! ben      3482:             <dt><span class="sect1"><a href="#id2584100">6.1. Is
1.1       grant    3483:             there a mailing list for pkg-related
                   3484:             discussion?</a></span></dt>
                   3485: 
1.11    ! ben      3486:             <dt><span class="sect1"><a href="#id2584130">6.2.
1.1       grant    3487:             Where's the pkgviews documentation?</a></span></dt>
                   3488: 
1.5       hubertf  3489:             <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    3490:             Utilities for package management
                   3491:             (pkgtools)</a></span></dt>
                   3492: 
1.11    ! ben      3493:             <dt><span class="sect1"><a href="#id2584382">6.4. How
1.1       grant    3494:             to use pkgsrc as non-root</a></span></dt>
                   3495: 
1.11    ! ben      3496:             <dt><span class="sect1"><a href="#id2584394">6.5. How
1.1       grant    3497:             can I install/use XFree86 from pkgsrc?</a></span></dt>
                   3498: 
1.11    ! ben      3499:             <dt><span class="sect1"><a href="#id2584422">6.6. How
1.1       grant    3500:             can I install/use X.org from pkgsrc?</a></span></dt>
                   3501: 
1.11    ! ben      3502:             <dt><span class="sect1"><a href="#id2584518">6.7. How
1.1       grant    3503:             to fetch files from behind a firewall</a></span></dt>
                   3504: 
1.11    ! ben      3505:             <dt><span class="sect1"><a href="#id2584532">6.8. How
1.7       wiz      3506:             do I tell <span><strong class="command">make
                   3507:             fetch</strong></span> to do passive
                   3508:             FTP?</a></span></dt>
1.1       grant    3509: 
1.11    ! ben      3510:             <dt><span class="sect1"><a href="#id2584651">6.9. How
1.1       grant    3511:             to fetch all distfiles at once</a></span></dt>
                   3512: 
1.11    ! ben      3513:             <dt><span class="sect1"><a href="#id2584791">6.10. What
1.7       wiz      3514:             does &#8220;<span class="quote">Don't know how to make
                   3515:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    3516:             mean?</a></span></dt>
                   3517: 
1.11    ! ben      3518:             <dt><span class="sect1"><a href="#id2584829">6.11. What
1.7       wiz      3519:             does &#8220;<span class="quote">Could not find
                   3520:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    3521: 
1.11    ! ben      3522:             <dt><span class="sect1"><a href="#id2584887">6.12.
1.1       grant    3523:             Using 'sudo' with pkgsrc</a></span></dt>
                   3524: 
                   3525:             <dt><span class="sect1"><a href="#faq.conf">6.13.
                   3526:             Configuration files handling and
                   3527:             placement</a></span></dt>
                   3528: 
                   3529:             <dt><span class="sect1"><a href="#audit-packages">6.14.
                   3530:             Automated security checks</a></span></dt>
                   3531:           </dl>
                   3532:         </div>
                   3533: 
                   3534:         <p>This section contains hints, tips &amp; tricks on
                   3535:         special things in pkgsrc that we didn't find a better place
                   3536:         for in the previous chapters, and it contains items for
                   3537:         both pkgsrc users and developers.</p>
                   3538: 
                   3539:         <div class="sect1" lang="en" xml:lang="en">
                   3540:           <div class="titlepage">
                   3541:             <div>
                   3542:               <div>
                   3543:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      3544:                 "id2584100" id="id2584100"></a>6.1.&nbsp;Is there a
1.1       grant    3545:                 mailing list for pkg-related discussion?</h2>
                   3546:               </div>
                   3547:             </div>
                   3548:           </div>
                   3549: 
1.7       wiz      3550:           <p>Yes, <code class="email">&lt;<a href=
                   3551:           "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>
1.1       grant    3552:           is the list for discussing package related issues. To
                   3553:           subscribe do:</p>
                   3554:           <pre class="programlisting">
1.7       wiz      3555: <code class=
                   3556: "prompt">%</code> echo subscribe tech-pkg | mail majordomo@NetBSD.org
1.1       grant    3557: </pre>
                   3558: 
                   3559:           <p>An archive of the list is available at <a href=
                   3560:           "http://mail-index.NetBSD.org/tech-pkg/" target=
                   3561:           "_top">http://mail-index.NetBSD.org/tech-pkg/</a>.</p>
                   3562:         </div>
                   3563: 
                   3564:         <div class="sect1" lang="en" xml:lang="en">
                   3565:           <div class="titlepage">
                   3566:             <div>
                   3567:               <div>
                   3568:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      3569:                 "id2584130" id="id2584130"></a>6.2.&nbsp;Where's
1.1       grant    3570:                 the pkgviews documentation?</h2>
                   3571:               </div>
                   3572:             </div>
                   3573:           </div>
                   3574: 
                   3575:           <p>Pkgviews is tightly integrated with buildlink. You can
1.7       wiz      3576:           find a pkgviews User's guide in <code class=
                   3577:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    3578:         </div>
                   3579: 
                   3580:         <div class="sect1" lang="en" xml:lang="en">
                   3581:           <div class="titlepage">
                   3582:             <div>
                   3583:               <div>
                   3584:                 <h2 class="title" style="clear: both"><a name=
1.5       hubertf  3585:                 "faq-pkgtools" id=
                   3586:                 "faq-pkgtools"></a>6.3.&nbsp;Utilities for package
                   3587:                 management (pkgtools)</h2>
1.1       grant    3588:               </div>
                   3589:             </div>
                   3590:           </div>
                   3591: 
1.7       wiz      3592:           <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1       grant    3593:           directory pkgtools contains a number of useful utilities
                   3594:           for both users and developers of pkgsrc. This section
                   3595:           attempts only to make the reader aware of the utilities
                   3596:           and when they might be useful, and not to duplicate the
                   3597:           documentation that comes with each package.</p>
                   3598: 
                   3599:           <p>Utilities used by pkgsrc (automatically installed when
                   3600:           needed):</p>
                   3601: 
                   3602:           <div class="itemizedlist">
                   3603:             <ul type="disc">
                   3604:               <li>
                   3605:                 <p><a xmlns=
                   3606:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3607:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.7       wiz      3608:                 class="pkgname">pkgtools/x11-links</a>: symlinks
                   3609:                 for use by buildlink</p>
1.1       grant    3610:               </li>
                   3611:             </ul>
                   3612:           </div>
                   3613: 
                   3614:           <p>OS tool augmentation (automatically installed when
                   3615:           needed):</p>
                   3616: 
                   3617:           <div class="itemizedlist">
                   3618:             <ul type="disc">
                   3619:               <li>
                   3620:                 <p><a xmlns=
                   3621:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3622:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.7       wiz      3623:                 class="pkgname">pkgtools/digest</a>: calculates
                   3624:                 SHA1 checksums (and other kinds)</p>
1.1       grant    3625:               </li>
                   3626: 
                   3627:               <li>
                   3628:                 <p><a xmlns=
                   3629:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3630:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.7       wiz      3631:                 class="pkgname">pkgtools/libnbcompat</a>: compat
                   3632:                 library for pkg tools</p>
1.1       grant    3633:               </li>
                   3634: 
                   3635:               <li>
                   3636:                 <p><a xmlns=
                   3637:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3638:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.7       wiz      3639:                 class="pkgname">pkgtools/mtree</a>: installed on
                   3640:                 non-BSD systems due to lack of native mtree</p>
1.1       grant    3641:               </li>
                   3642: 
                   3643:               <li>
                   3644:                 <p><a xmlns=
                   3645:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3646:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.7       wiz      3647:                 class="pkgname">pkgtools/pkg_install</a>:
                   3648:                 up-to-date replacement for /usr/sbin/pkg_install,
                   3649:                 or for use on operating systems where pkg_install
                   3650:                 is not present</p>
1.1       grant    3651:               </li>
                   3652:             </ul>
                   3653:           </div>
                   3654: 
                   3655:           <p>Utilities used by pkgsrc (not automatically
                   3656:           installed):</p>
                   3657: 
                   3658:           <div class="itemizedlist">
                   3659:             <ul type="disc">
                   3660:               <li>
                   3661:                 <p><a xmlns=
                   3662:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3663:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.7       wiz      3664:                 class="pkgname">pkgtools/pkg_tarup</a>: create a
                   3665:                 binary package from an already-installed package.
                   3666:                 used by 'make replace' to save the old package</p>
1.1       grant    3667:               </li>
                   3668: 
                   3669:               <li>
                   3670:                 <p><a xmlns=
                   3671:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  3672:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.7       wiz      3673:                 class="pkgname">pkgtools/dfdisk</a>: adds extra
                   3674:                 functionality to pkgsrc, allowing it to fetch
                   3675:                 distfiles from multiple locations. It currently
                   3676:                 supports the following methods: multiple CD-ROMs
                   3677:                 and network FTP/HTTP connections.</p>
1.5       hubertf  3678:               </li>
                   3679: 
                   3680:               <li>
                   3681:                 <p><a xmlns=
                   3682:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    3683:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.7       wiz      3684:                 class="pkgname">pkgtools/xpkgwedge</a>: put X11
                   3685:                 packages someplace else (enabled by default)</p>
1.1       grant    3686:               </li>
1.5       hubertf  3687: 
                   3688:               <li>
                   3689:                 <p><a xmlns=
                   3690:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3691:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.7       wiz      3692:                 class="pkgname">devel/cpuflags</a>: will determine
                   3693:                 the best compiler flags to optimise code for your
                   3694:                 current CPU and compiler.</p>
1.5       hubertf  3695:               </li>
1.1       grant    3696:             </ul>
                   3697:           </div>
                   3698: 
                   3699:           <p>Utilities for keeping track of installed packages,
                   3700:           being up to date, etc:</p>
                   3701: 
                   3702:           <div class="itemizedlist">
                   3703:             <ul type="disc">
                   3704:               <li>
                   3705:                 <p><a xmlns=
                   3706:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3707:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.7       wiz      3708:                 class="pkgname">pkgtools/pkg_chk</a>: installs
                   3709:                 pkg_chk, which reports on packages whose installed
                   3710:                 versions do not match the latest pkgsrc entries</p>
1.1       grant    3711:               </li>
                   3712: 
                   3713:               <li>
                   3714:                 <p><a xmlns=
                   3715:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3716:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.7       wiz      3717:                 class="pkgname">pkgtools/pkgdep</a>: makes
                   3718:                 dependency graphs of packages, to aid in choosing a
                   3719:                 strategy for updating</p>
1.1       grant    3720:               </li>
                   3721: 
                   3722:               <li>
                   3723:                 <p><a xmlns=
                   3724:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3725:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.7       wiz      3726:                 class="pkgname">pkgtools/pkgdepgraph</a>: make
                   3727:                 graph from above (uses graphviz)</p>
1.1       grant    3728:               </li>
                   3729: 
                   3730:               <li>
                   3731:                 <p><a xmlns=
                   3732:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3733:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.7       wiz      3734:                 class="pkgname">pkgtools/pkglint</a>: This provides
                   3735:                 two distinct abilities: check a pkgsrc entry for
                   3736:                 correctness (pkglint) check for and remove
                   3737:                 out-of-date distfiles and binary packages
                   3738:                 (lintpkgsrc)</p>
1.1       grant    3739:               </li>
                   3740: 
                   3741:               <li>
                   3742:                 <p><a xmlns=
                   3743:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3744:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.7       wiz      3745:                 class="pkgname">pkgtools/pkgsurvey</a>: report what
                   3746:                 packages you have installed</p>
1.1       grant    3747:               </li>
                   3748:             </ul>
                   3749:           </div>
                   3750: 
                   3751:           <p>Utilities for people maintaining or creating
                   3752:           individual packages:</p>
                   3753: 
                   3754:           <div class="itemizedlist">
                   3755:             <ul type="disc">
                   3756:               <li>
                   3757:                 <p><a xmlns=
                   3758:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3759:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.7       wiz      3760:                 class="pkgname">pkgtools/pkgdiff</a>: automate
                   3761:                 making and maintaining patches for a package
                   3762:                 (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1       grant    3763:               </li>
                   3764: 
                   3765:               <li>
                   3766:                 <p><a xmlns=
                   3767:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3768:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.7       wiz      3769:                 class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
                   3770:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3771:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
                   3772:                 class="pkgname">pkgtools/url2pkg</a>: aids in
                   3773:                 converting to pkgsrc</p>
1.1       grant    3774:               </li>
                   3775: 
                   3776:               <li>
                   3777:                 <p><a xmlns=
                   3778:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3779:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.7       wiz      3780:                 class="pkgname">pkgtools/gensolpkg</a>: convert
                   3781:                 pkgsrc to a Solaris package</p>
1.1       grant    3782:               </li>
                   3783:             </ul>
                   3784:           </div>
                   3785: 
                   3786:           <p>Utilities for people maintaining pkgsrc (or more
                   3787:           obscure pkg utilities)</p>
                   3788: 
                   3789:           <div class="itemizedlist">
                   3790:             <ul type="disc">
                   3791:               <li>
                   3792:                 <p><a xmlns=
                   3793:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3794:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.7       wiz      3795:                 class="pkgname">pkgtools/pkgconflict</a>: find
                   3796:                 packages that conflict but aren't marked as
                   3797:                 such</p>
1.1       grant    3798:               </li>
                   3799: 
                   3800:               <li>
                   3801:                 <p><a xmlns=
                   3802:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3803:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.7       wiz      3804:                 class="pkgname">pkgtools/pkg_comp</a>: build
                   3805:                 packages in a chrooted area</p>
1.1       grant    3806:               </li>
                   3807: 
                   3808:               <li>
                   3809:                 <p><a xmlns=
                   3810:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3811:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.7       wiz      3812:                 class="pkgname">pkgtools/libkver</a>: spoof kernel
                   3813:                 version for chrooted cross builds</p>
1.1       grant    3814:               </li>
                   3815:             </ul>
                   3816:           </div>
                   3817:         </div>
                   3818: 
                   3819:         <div class="sect1" lang="en" xml:lang="en">
                   3820:           <div class="titlepage">
                   3821:             <div>
                   3822:               <div>
                   3823:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      3824:                 "id2584382" id="id2584382"></a>6.4.&nbsp;How to use
1.1       grant    3825:                 pkgsrc as non-root</h2>
                   3826:               </div>
                   3827:             </div>
                   3828:           </div>
                   3829: 
                   3830:           <p>If you want to use pkgsrc as non-root user, you can
                   3831:           set some variables to make pkgsrc work under these
                   3832:           conditions. Please see <a href=
                   3833:           "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.7       wiz      3834:           target="_top">this message</a> for more details.</p>
1.1       grant    3835:         </div>
                   3836: 
                   3837:         <div class="sect1" lang="en" xml:lang="en">
                   3838:           <div class="titlepage">
                   3839:             <div>
                   3840:               <div>
                   3841:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      3842:                 "id2584394" id="id2584394"></a>6.5.&nbsp;How can I
1.1       grant    3843:                 install/use XFree86 from pkgsrc?</h2>
                   3844:               </div>
                   3845:             </div>
                   3846:           </div>
                   3847: 
                   3848:           <p>If you want to use XFree86 from pkgsrc instead of your
1.7       wiz      3849:           system's own X11 (<code class=
                   3850:           "filename">/usr/X11R6</code>, <code class=
                   3851:           "filename">/usr/openwin</code>, ...), you will have to
                   3852:           add the following lines into <code class=
                   3853:           "filename">mk.conf</code>:</p>
1.1       grant    3854:           <pre class="programlisting">
                   3855:       X11_TYPE=XFree86
                   3856:     
                   3857: </pre>
                   3858:         </div>
                   3859: 
                   3860:         <div class="sect1" lang="en" xml:lang="en">
                   3861:           <div class="titlepage">
                   3862:             <div>
                   3863:               <div>
                   3864:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      3865:                 "id2584422" id="id2584422"></a>6.6.&nbsp;How can I
1.1       grant    3866:                 install/use X.org from pkgsrc?</h2>
                   3867:               </div>
                   3868:             </div>
                   3869:           </div>
                   3870: 
                   3871:           <p>If you want to use X.org from pkgsrc instead of your
1.7       wiz      3872:           system's own X11 (<code class=
                   3873:           "filename">/usr/X11R6</code>, <code class=
                   3874:           "filename">/usr/openwin</code>, ...) you will have to add
                   3875:           the following lines into <code class=
                   3876:           "filename">mk.conf</code>:</p>
1.1       grant    3877:           <pre class="programlisting">
                   3878:       X11_TYPE=xorg
                   3879:     
                   3880: </pre>
                   3881:         </div>
                   3882: 
                   3883:         <div class="sect1" lang="en" xml:lang="en">
                   3884:           <div class="titlepage">
                   3885:             <div>
                   3886:               <div>
                   3887:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      3888:                 "id2584518" id="id2584518"></a>6.7.&nbsp;How to
1.1       grant    3889:                 fetch files from behind a firewall</h2>
                   3890:               </div>
                   3891:             </div>
                   3892:           </div>
                   3893: 
                   3894:           <p>If you are sitting behind a firewall which does not
                   3895:           allow direct connections to Internet hosts (i.e.
                   3896:           non-NAT), you may specify the relevant proxy hosts. This
                   3897:           is done using an environment variable in the form of a
                   3898:           URL e.g. in Amdahl, the machine &#8220;<span class=
                   3899:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   3900:           firewalls, and it uses port 80 as the proxy port number.
                   3901:           So the proxy environment variables are:</p>
                   3902:           <pre class="programlisting">
                   3903:   ftp_proxy=ftp://orpheus.amdahl.com:80/
                   3904: http_proxy=http://orpheus.amdahl.com:80/
                   3905: </pre>
                   3906:         </div>
                   3907: 
                   3908:         <div class="sect1" lang="en" xml:lang="en">
                   3909:           <div class="titlepage">
                   3910:             <div>
                   3911:               <div>
                   3912:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      3913:                 "id2584532" id="id2584532"></a>6.8.&nbsp;How do I
1.7       wiz      3914:                 tell <span><strong class="command">make
                   3915:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    3916:               </div>
                   3917:             </div>
                   3918:           </div>
                   3919: 
                   3920:           <p>This depends on which utility is used to retrieve
1.7       wiz      3921:           distfiles. From <code class="filename">bsd.pkg.mk</code>,
                   3922:           <code class="varname">FETCH_CMD</code> is assigned the
                   3923:           first available command from the following list:</p>
1.1       grant    3924:           <pre class="programlisting">
                   3925: ${LOCALBASE}/bin/ftp
                   3926: /usr/bin/ftp
                   3927: </pre>
                   3928: 
                   3929:           <p>On a default NetBSD installation, this will be
1.7       wiz      3930:           <code class="filename">/usr/bin/ftp</code>, which
1.1       grant    3931:           automatically tries passive connections first, and falls
                   3932:           back to active connections if the server refuses to do
                   3933:           passive. For the other tools, add the following to your
1.7       wiz      3934:           <code class="filename">/etc/mk.conf</code> file:
                   3935:           <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    3936: 
1.7       wiz      3937:           <p>Having that option present will prevent <code class=
                   3938:           "filename">/usr/bin/ftp</code> from falling back to
                   3939:           active transfers.</p>
1.1       grant    3940:         </div>
                   3941: 
                   3942:         <div class="sect1" lang="en" xml:lang="en">
                   3943:           <div class="titlepage">
                   3944:             <div>
                   3945:               <div>
                   3946:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      3947:                 "id2584651" id="id2584651"></a>6.9.&nbsp;How to
1.1       grant    3948:                 fetch all distfiles at once</h2>
                   3949:               </div>
                   3950:             </div>
                   3951:           </div>
                   3952: 
                   3953:           <p>You would like to download all the distfiles in a
                   3954:           single batch from work or university, where you can't run
1.7       wiz      3955:           a <span><strong class="command">make
                   3956:           fetch</strong></span>. There is an archive of distfiles
                   3957:           on <a href=
1.1       grant    3958:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   3959:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   3960:           entire directory may not be appropriate.</p>
                   3961: 
1.7       wiz      3962:           <p>The answer here is to do a <span><strong class=
                   3963:           "command">make fetch-list</strong></span> in <code class=
                   3964:           "filename">/usr/pkgsrc</code> or one of it's
1.1       grant    3965:           subdirectories, carry the resulting list to your machine
                   3966:           at work/school and use it there If you don't have a
                   3967:           NetBSD-compatible ftp(1) (like lukemftp) at work, don't
1.7       wiz      3968:           forget to set <code class="varname">FETCH_CMD</code> to
1.1       grant    3969:           something that fetches a URL:</p>
                   3970: 
                   3971:           <p>At home:</p>
                   3972:           <pre class="screen">
1.7       wiz      3973: <code class="prompt">%</code> <strong class=
                   3974: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   3975: <code class="prompt">%</code> <strong class=
                   3976: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   3977: <code class="prompt">%</code> <strong class=
                   3978: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    3979: </pre>
                   3980: 
                   3981:           <p>At work:</p>
                   3982:           <pre class="screen">
1.7       wiz      3983: <code class="prompt">%</code> <strong class=
                   3984: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    3985: </pre>
                   3986: 
1.7       wiz      3987:           <p>then tar up <code class=
                   3988:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    3989: 
                   3990:           <p>If you have a machine running NetBSD, and you want to
                   3991:           get <span class="emphasis"><em>all</em></span> distfiles
                   3992:           (even ones that aren't for your machine architecture),
                   3993:           you can do so by using the above-mentioned
1.7       wiz      3994:           <span><strong class="command">make
                   3995:           fetch-list</strong></span> approach, or fetch the
                   3996:           distfiles directly by running:</p>
1.1       grant    3997:           <pre class="screen">
1.7       wiz      3998: <code class="prompt">%</code> <strong class=
                   3999: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    4000: </pre>
                   4001: 
1.7       wiz      4002:           <p>If you even decide to ignore <code class=
                   4003:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   4004:           can get everything by running:</p>
1.1       grant    4005:           <pre class="screen">
1.7       wiz      4006: <code class="prompt">%</code> <strong class=
                   4007: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    4008: </pre>
                   4009:         </div>
                   4010: 
                   4011:         <div class="sect1" lang="en" xml:lang="en">
                   4012:           <div class="titlepage">
                   4013:             <div>
                   4014:               <div>
                   4015:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      4016:                 "id2584791" id="id2584791"></a>6.10.&nbsp;What does
1.1       grant    4017:                 &#8220;<span class="quote">Don't know how to make
                   4018:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   4019:               </div>
                   4020:             </div>
                   4021:           </div>
                   4022: 
                   4023:           <p>When compiling the <a xmlns=
                   4024:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4025:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.7       wiz      4026:           class="pkgname">pkgtools/pkg_install</a> package, you get
                   4027:           the error from make that it doesn't know how to make
                   4028:           <code class="filename">/usr/share/tmac/tmac.andoc</code>?
                   4029:           This indicates that you don't have installed the
                   4030:           &#8220;<span class="quote">text</span>&#8221; set on your
                   4031:           machine (nroff, ...). It is recommended to do that to
                   4032:           format manpages.</p>
1.1       grant    4033: 
                   4034:           <p>In the case of the <a xmlns=
                   4035:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4036:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.7       wiz      4037:           class="pkgname">pkgtools/pkg_install</a> package, you can
                   4038:           get away with setting <code class=
                   4039:           "varname">NOMAN=YES</code> either in the environment or
                   4040:           in <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    4041:         </div>
                   4042: 
                   4043:         <div class="sect1" lang="en" xml:lang="en">
                   4044:           <div class="titlepage">
                   4045:             <div>
                   4046:               <div>
                   4047:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      4048:                 "id2584829" id="id2584829"></a>6.11.&nbsp;What does
1.1       grant    4049:                 &#8220;<span class="quote">Could not find
                   4050:                 bsd.own.mk</span>&#8221; mean?</h2>
                   4051:               </div>
                   4052:             </div>
                   4053:           </div>
                   4054: 
1.7       wiz      4055:           <p>You didn't install the compiler set, <code class=
                   4056:           "filename">comp.tgz</code>, when you installed your
                   4057:           NetBSD machine. Please get it and install it, by
                   4058:           extracting it in <code class="filename">/</code>:</p>
1.1       grant    4059:           <pre class="screen">
1.7       wiz      4060: <code class="prompt">#</code> <strong class=
                   4061: "userinput"><code>cd /</code></strong>
                   4062: <code class="prompt">#</code> <strong class=
                   4063: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    4064: </pre>
                   4065: 
1.7       wiz      4066:           <p><code class="filename">comp.tgz</code> is part of
                   4067:           every NetBSD release. Get the one that corresponds to
                   4068:           your release (determine via <span><strong class=
                   4069:           "command">uname -r</strong></span>).</p>
1.1       grant    4070:         </div>
                   4071: 
                   4072:         <div class="sect1" lang="en" xml:lang="en">
                   4073:           <div class="titlepage">
                   4074:             <div>
                   4075:               <div>
                   4076:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      4077:                 "id2584887" id="id2584887"></a>6.12.&nbsp;Using
1.1       grant    4078:                 'sudo' with pkgsrc</h2>
                   4079:               </div>
                   4080:             </div>
                   4081:           </div>
                   4082: 
                   4083:           <p>When installing packages as non-root user and using
                   4084:           the just-in-time su(1) feature of pkgsrc, it can become
                   4085:           annoying to type in the root password for each required
                   4086:           package installed. To avoid this, the sudo package can be
                   4087:           used, which does password caching over a limited time. To
                   4088:           use it, install sudo (either as binary package or from
                   4089:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   4090:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.7       wiz      4091:           class="pkgname">security/sudo</a>) and then put the
                   4092:           following into your <code class=
                   4093:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4094:           <pre class="programlisting">
                   4095:         .if exists(/usr/pkg/bin/sudo)
                   4096:         SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
                   4097:         .endif
                   4098:     
                   4099: </pre>
                   4100:         </div>
                   4101: 
                   4102:         <div class="sect1" lang="en" xml:lang="en">
                   4103:           <div class="titlepage">
                   4104:             <div>
                   4105:               <div>
                   4106:                 <h2 class="title" style="clear: both"><a name=
                   4107:                 "faq.conf" id=
                   4108:                 "faq.conf"></a>6.13.&nbsp;Configuration files
                   4109:                 handling and placement</h2>
                   4110:               </div>
                   4111:             </div>
                   4112:           </div>
                   4113: 
1.7       wiz      4114:           <p>The global variable <code class=
                   4115:           "varname">PKG_SYSCONFBASE</code> (and some others) can be
                   4116:           set by the system administrator in <code class=
                   4117:           "filename">/etc/mk.conf</code> to define the place where
1.1       grant    4118:           configuration files get installed. Therefore, packages
                   4119:           must be adapted to support this feature. Keep in mind
                   4120:           that you should only install files that are strictly
                   4121:           necessary in the configuration directory, files that can
1.7       wiz      4122:           go to <code class="filename">$PREFIX/share</code> should
                   4123:           go there.</p>
1.1       grant    4124: 
                   4125:           <p>We will take a look at available variables first
1.7       wiz      4126:           (<code class="filename">bsd.pkg.mk</code> contains more
                   4127:           information). <code class="varname">PKG_SYSCONFDIR</code>
                   4128:           is where the configuration files for a package may be
                   4129:           found (that is, the full path, e.g. <code class=
                   4130:           "filename">/etc</code> or <code class=
                   4131:           "filename">/usr/pkg/etc</code>). This value may be
1.1       grant    4132:           customized in various ways:</p>
                   4133: 
                   4134:           <div class="orderedlist">
                   4135:             <ol type="1">
                   4136:               <li>
1.7       wiz      4137:                 <p><code class="varname">PKG_SYSCONFBASE</code> is
                   4138:                 the main config directory under which all package
1.1       grant    4139:                 configuration files are to be found. Users will
1.7       wiz      4140:                 typically want to set it to <code class=
                   4141:                 "filename">/etc</code>, or accept the default
                   4142:                 location of <code class=
                   4143:                 "filename">$PREFIX/etc</code>.</p>
1.1       grant    4144:               </li>
                   4145: 
                   4146:               <li>
1.7       wiz      4147:                 <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   4148:                 is the subdirectory of <code class=
                   4149:                 "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    4150:                 configuration files for a particular package may be
1.7       wiz      4151:                 found. Defaults to <code class=
                   4152:                 "varname">${SYSCONFBASE}</code>.</p>
1.1       grant    4153:               </li>
                   4154: 
                   4155:               <li>
1.7       wiz      4156:                 <p><code class="varname">PKG_SYSCONFVAR</code> is
                   4157:                 the special suffix used to distinguish any
                   4158:                 overriding values for a particular package (see
                   4159:                 next item). It defaults to <code class=
                   4160:                 "varname">${PKGBASE}</code>, but for a collection
                   4161:                 of related packages that should all have the same
                   4162:                 <code class="varname">PKG_SYSCONFDIR</code> value,
                   4163:                 it can be set in each of the package Makefiles to a
                   4164:                 common value.</p>
1.1       grant    4165:               </li>
                   4166: 
                   4167:               <li>
1.7       wiz      4168:                 <p><code class=
                   4169:                 "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   4170:                 overrides the value of <code class=
                   4171:                 "varname">${PKG_SYSCONFDIR}</code> for packages
                   4172:                 with the same value for <code class=
                   4173:                 "varname">PKG_SYSCONFVAR</code>.</p>
1.1       grant    4174: 
                   4175:                 <p>As an example, all the various KDE packages may
1.7       wiz      4176:                 want to set <code class=
                   4177:                 "varname">PKG_SYSCONFVAR</code> to
                   4178:                 &#8220;<span class="quote">kde</span>&#8221; so
                   4179:                 admins can set <code class=
                   4180:                 "varname">PKG_SYSCONFDIR.kde</code> in <code class=
                   4181:                 "filename">/etc/mk.conf</code> to define where to
1.1       grant    4182:                 install KDE config files.</p>
                   4183:               </li>
                   4184:             </ol>
                   4185:           </div>
                   4186: 
                   4187:           <p>Programs' configuration directory should be defined
                   4188:           during the configure stage. Packages that use GNU
                   4189:           autoconf can usually do this by using the
                   4190:           &#8220;<span class="quote">--sysconfdir</span>&#8221;
                   4191:           parameter, but this brings some problems as we will see
                   4192:           now. When you change this pathname in packages, you
                   4193:           should not allow them to install files in that directory
                   4194:           directly. Instead they need to install those files under
1.7       wiz      4195:           <code class="filename">share/examples/${PKGNAME}</code>
                   4196:           so <code class="filename">PLIST</code> can register
                   4197:           them.</p>
1.1       grant    4198: 
                   4199:           <p>Once you have the required configuration files in
1.7       wiz      4200:           place (under the <code class=
                   4201:           "filename">share/examples</code> directory) the variable
                   4202:           <code class="varname">CONF_FILES</code> should be set to
                   4203:           copy them into <code class=
                   4204:           "varname">PKG_SYSCONFDIR</code>. The contents of this
                   4205:           variable is formed by pairs of filenames; the first
1.1       grant    4206:           element of the pair specifies the file inside the
1.7       wiz      4207:           examples directory (registered by <code class=
                   4208:           "filename">PLIST</code>) and the second element specifies
1.1       grant    4209:           the target file. This is done this way to allow binary
                   4210:           packages to place files in the right directory using
1.7       wiz      4211:           <code class="filename">INSTALL</code>/<code class=
                   4212:           "filename">DEINSTALL</code> scripts which are created
                   4213:           automatically. The package <code class=
                   4214:           "filename">Makefile</code> must also set <code class=
                   4215:           "varname">USE_PKGINSTALL=YES</code> to use these
1.1       grant    4216:           automatically generated scripts. The automatic copying of
                   4217:           config files can be toggled by setting the environment
1.7       wiz      4218:           variable <code class="varname">PKG_CONFIG</code> prior to
1.1       grant    4219:           package installation.</p>
                   4220: 
                   4221:           <p>Here is an example, taken from mail/mutt/Makefile:</p>
                   4222:           <pre class="programlisting">
                   4223:   EGDIR=            ${PREFIX}/share/doc/mutt/samples
                   4224: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   4225: </pre>
                   4226: 
                   4227:           <p>As you can see, this package installs configuration
1.7       wiz      4228:           files inside <code class="varname">EGDIR</code>, which
                   4229:           are registered by <code class="filename">PLIST</code>.
                   4230:           After that, the variable <code class=
                   4231:           "varname">CONF_FILES</code> lists the installed file
                   4232:           first and then the target file. Users will also get an
                   4233:           automatic message when files are installed using this
                   4234:           method.</p>
1.1       grant    4235:         </div>
                   4236: 
                   4237:         <div class="sect1" lang="en" xml:lang="en">
                   4238:           <div class="titlepage">
                   4239:             <div>
                   4240:               <div>
                   4241:                 <h2 class="title" style="clear: both"><a name=
                   4242:                 "audit-packages" id=
                   4243:                 "audit-packages"></a>6.14.&nbsp;Automated security
                   4244:                 checks</h2>
                   4245:               </div>
                   4246:             </div>
                   4247:           </div>
                   4248: 
                   4249:           <p>Please be aware that there can often be bugs in
                   4250:           third-party software, and some of these bugs can leave a
                   4251:           machine vulnerable to exploitation by attackers. In an
                   4252:           effort to lessen the exposure, the NetBSD packages team
                   4253:           maintains a database of known-exploits to packages which
                   4254:           have at one time been included in pkgsrc. The database
                   4255:           can be downloaded automatically, and a security audit of
                   4256:           all packages installed on a system can take place. To do
                   4257:           this, install the <a xmlns=
                   4258:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4259:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.7       wiz      4260:           class="pkgname">security/audit-packages</a> package. It
                   4261:           has two components:</p>
1.1       grant    4262: 
                   4263:           <div class="orderedlist">
                   4264:             <ol type="1">
                   4265:               <li>
                   4266:                 <p>&#8220;<span class=
                   4267:                 "quote">download-vulnerability-list</span>&#8221;,
                   4268:                 an easy way to download a list of the security
                   4269:                 vulnerabilities information. This list is kept up
                   4270:                 to date by the NetBSD security officer and the
                   4271:                 NetBSD packages team, and is distributed from the
                   4272:                 NetBSD ftp server:</p>
                   4273: 
                   4274:                 <p><a href=
                   4275:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.7       wiz      4276:                 target=
                   4277:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    4278:               </li>
                   4279: 
                   4280:               <li>
                   4281:                 <p>&#8220;<span class=
                   4282:                 "quote">audit-packages</span>&#8221;, an easy way
                   4283:                 to audit the current machine, checking each
                   4284:                 vulnerability which is known. If a vulnerable
                   4285:                 package is installed, it will be shown by output to
                   4286:                 stdout, including a description of the type of
                   4287:                 vulnerability, and a URL containing more
                   4288:                 information.</p>
                   4289:               </li>
                   4290:             </ol>
                   4291:           </div>
                   4292: 
                   4293:           <p>Use of the audit-packages package is strongly
                   4294:           recommended!</p>
                   4295: 
                   4296:           <p>The following message is displayed as part of the
                   4297:           audit-packages installation procedure:</p>
                   4298:           <pre class="screen">
                   4299: ===========================================================================
1.11    ! ben      4300: $NetBSD: faq.xml,v 1.2 2004/11/20 13:25:22 hubertf Exp $
1.1       grant    4301: 
                   4302: You may wish to have the vulnerabilities file downloaded daily so that
                   4303: it remains current.  This may be done by adding an appropriate entry
                   4304: to the root users crontab(5) entry.  For example the entry
                   4305: 
                   4306: # download vulnerabilities file
                   4307: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list &gt;/dev/null 2&gt;&amp;1
                   4308: 
                   4309: will update the vulnerability list every day at 3AM. You may wish to do
                   4310: this more often than once a day.
                   4311: 
                   4312: In addition, you may wish to run the package audit from the daily
                   4313: security script.  This may be accomplished by adding the following
                   4314: lines to /etc/security.local
                   4315: 
                   4316: if [ -x ${PREFIX}/sbin/audit-packages ]; then
                   4317:           ${PREFIX}/sbin/audit-packages
                   4318: fi
                   4319: 
                   4320: ===========================================================================
                   4321:     
                   4322: </pre>
                   4323:         </div>
                   4324:       </div>
                   4325:     </div>
                   4326: 
                   4327:     <div class="part" lang="en" xml:lang="en">
                   4328:       <div class="titlepage">
                   4329:         <div>
                   4330:           <div>
                   4331:             <h1 class="title"><a name="developers-guide" id=
1.2       hubertf  4332:             "developers-guide"></a>The pkgsrc developer's
                   4333:             guide</h1>
1.1       grant    4334:           </div>
                   4335:         </div>
                   4336:       </div>
                   4337: 
                   4338:       <div class="toc">
                   4339:         <p><b>Table of Contents</b></p>
                   4340: 
                   4341:         <dl>
                   4342:           <dt><span class="chapter"><a href="#components">7.
                   4343:           Package components - files, directories and
                   4344:           contents</a></span></dt>
                   4345: 
                   4346:           <dd>
                   4347:             <dl>
                   4348:               <dt><span class="sect1"><a href=
1.7       wiz      4349:               "#components.Makefile">7.1. <code class=
                   4350:               "filename">Makefile</code></a></span></dt>
1.1       grant    4351: 
                   4352:               <dt><span class="sect1"><a href=
1.7       wiz      4353:               "#components.distinfo">7.2. <code class=
                   4354:               "filename">distinfo</code></a></span></dt>
1.1       grant    4355: 
                   4356:               <dt><span class="sect1"><a href=
                   4357:               "#components.patches">7.3. patches/*</a></span></dt>
                   4358: 
1.11    ! ben      4359:               <dt><span class="sect1"><a href="#id2586001">7.4.
1.1       grant    4360:               Other mandatory files</a></span></dt>
                   4361: 
                   4362:               <dt><span class="sect1"><a href=
                   4363:               "#components.optional">7.5. Optional
                   4364:               files</a></span></dt>
                   4365: 
1.11    ! ben      4366:               <dt><span class="sect1"><a href="#id2586126">7.6.
1.7       wiz      4367:               <code class="filename">work*</code></a></span></dt>
1.1       grant    4368: 
1.11    ! ben      4369:               <dt><span class="sect1"><a href="#id2586214">7.7.
1.7       wiz      4370:               <code class="filename">files/*</code></a></span></dt>
1.1       grant    4371:             </dl>
                   4372:           </dd>
                   4373: 
                   4374:           <dt><span class="chapter"><a href="#plist">8. PLIST
                   4375:           issues</a></span></dt>
                   4376: 
                   4377:           <dd>
                   4378:             <dl>
1.11    ! ben      4379:               <dt><span class="sect1"><a href="#id2586268">8.1. RCS
1.1       grant    4380:               ID</a></span></dt>
                   4381: 
1.11    ! ben      4382:               <dt><span class="sect1"><a href="#id2586283">8.2.
1.7       wiz      4383:               Semi-automatic <code class="filename">PLIST</code>
                   4384:               generation</a></span></dt>
1.1       grant    4385: 
                   4386:               <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.7       wiz      4387:               Tweaking output of <span><strong class="command">make
                   4388:               print-PLIST</strong></span></a></span></dt>
1.1       grant    4389: 
                   4390:               <dt><span class="sect1"><a href="#plist.misc">8.4.
                   4391:               Variable substitution in PLIST</a></span></dt>
                   4392: 
1.11    ! ben      4393:               <dt><span class="sect1"><a href="#id2586673">8.5.
1.1       grant    4394:               Manpage-compression</a></span></dt>
                   4395: 
1.11    ! ben      4396:               <dt><span class="sect1"><a href="#id2586714">8.6.
1.7       wiz      4397:               Changing PLIST source with <code class=
                   4398:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    4399: 
1.11    ! ben      4400:               <dt><span class="sect1"><a href="#id2586731">8.7.
1.1       grant    4401:               Platform specific and differing
                   4402:               PLISTs</a></span></dt>
                   4403: 
                   4404:               <dt><span class="sect1"><a href=
                   4405:               "#faq.common-dirs">8.8. Sharing directories between
                   4406:               packages</a></span></dt>
                   4407:             </dl>
                   4408:           </dd>
                   4409: 
                   4410:           <dt><span class="chapter"><a href="#buildlink">9.
                   4411:           Buildlink methodology</a></span></dt>
                   4412: 
                   4413:           <dd>
                   4414:             <dl>
1.11    ! ben      4415:               <dt><span class="sect1"><a href="#id2587003">9.1.
1.1       grant    4416:               Converting packages to use buildlink3</a></span></dt>
                   4417: 
1.11    ! ben      4418:               <dt><span class="sect1"><a href="#id2587194">9.2.
1.7       wiz      4419:               Writing <code class="filename">buildlink3.mk</code>
                   4420:               files</a></span></dt>
1.1       grant    4421: 
                   4422:               <dd>
                   4423:                 <dl>
                   4424:                   <dt><span class="sect2"><a href=
1.11    ! ben      4425:                   "#id2587400">9.2.1. Anatomy of a buildlink3.mk
1.1       grant    4426:                   file</a></span></dt>
                   4427: 
                   4428:                   <dt><span class="sect2"><a href=
1.11    ! ben      4429:                   "#id2587977">9.2.2. Updating <code class=
1.7       wiz      4430:                   "varname">BUILDLINK_DEPENDS.<em class=
                   4431:                   "replaceable"><code>pkg</code></em></code> in
                   4432:                   <code class="filename">buildlink3.mk</code>
1.1       grant    4433:                   files</a></span></dt>
                   4434:                 </dl>
                   4435:               </dd>
                   4436: 
1.11    ! ben      4437:               <dt><span class="sect1"><a href="#id2588056">9.3.
1.7       wiz      4438:               Writing <code class="filename">builtin.mk</code>
                   4439:               files</a></span></dt>
1.1       grant    4440: 
                   4441:               <dd>
                   4442:                 <dl>
                   4443:                   <dt><span class="sect2"><a href=
1.11    ! ben      4444:                   "#id2588137">9.3.1. Anatomy of a <code class=
1.7       wiz      4445:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    4446: 
                   4447:                   <dt><span class="sect2"><a href=
1.11    ! ben      4448:                   "#id2588296">9.3.2. Global preferences for native
1.1       grant    4449:                   or pkgsrc software</a></span></dt>
                   4450:                 </dl>
                   4451:               </dd>
                   4452:             </dl>
                   4453:           </dd>
                   4454: 
                   4455:           <dt><span class="chapter"><a href="#options">10. Options
                   4456:           handling</a></span></dt>
                   4457: 
                   4458:           <dd>
                   4459:             <dl>
1.11    ! ben      4460:               <dt><span class="sect1"><a href="#id2588437">10.1.
1.1       grant    4461:               Global default options</a></span></dt>
                   4462: 
1.11    ! ben      4463:               <dt><span class="sect1"><a href="#id2588452">10.2.
1.7       wiz      4464:               Converting packages to use <code class=
                   4465:               "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    4466:             </dl>
                   4467:           </dd>
                   4468: 
                   4469:           <dt><span class="chapter"><a href="#build">11. The build
                   4470:           process</a></span></dt>
                   4471: 
                   4472:           <dd>
                   4473:             <dl>
                   4474:               <dt><span class="sect1"><a href="#build.prefix">11.1.
                   4475:               Program location</a></span></dt>
                   4476: 
1.11    ! ben      4477:               <dt><span class="sect1"><a href="#id2589128">11.2.
1.1       grant    4478:               Main targets</a></span></dt>
                   4479: 
                   4480:               <dt><span class="sect1"><a href=
                   4481:               "#build.helpful-targets">11.3. Other helpful
                   4482:               targets</a></span></dt>
                   4483:             </dl>
                   4484:           </dd>
                   4485: 
                   4486:           <dt><span class="chapter"><a href="#fixes">12. Notes on
                   4487:           fixes for packages</a></span></dt>
                   4488: 
                   4489:           <dd>
                   4490:             <dl>
1.11    ! ben      4491:               <dt><span class="sect1"><a href="#id2590529">12.1.
1.1       grant    4492:               General operation</a></span></dt>
                   4493: 
                   4494:               <dd>
                   4495:                 <dl>
                   4496:                   <dt><span class="sect2"><a href=
1.11    ! ben      4497:                   "#id2590532">12.1.1. How to pull in variables
1.1       grant    4498:                   from /etc/mk.conf</a></span></dt>
                   4499: 
                   4500:                   <dt><span class="sect2"><a href=
1.11    ! ben      4501:                   "#id2590615">12.1.2. Restricted
1.1       grant    4502:                   packages</a></span></dt>
                   4503: 
                   4504:                   <dt><span class="sect2"><a href=
                   4505:                   "#dependencies">12.1.3. Handling
                   4506:                   dependencies</a></span></dt>
                   4507: 
                   4508:                   <dt><span class="sect2"><a href=
1.11    ! ben      4509:                   "#id2591198">12.1.4. Handling conflicts with
1.1       grant    4510:                   other packages</a></span></dt>
                   4511: 
                   4512:                   <dt><span class="sect2"><a href=
1.11    ! ben      4513:                   "#id2591249">12.1.5. Packages that cannot or
1.1       grant    4514:                   should not be built</a></span></dt>
                   4515: 
                   4516:                   <dt><span class="sect2"><a href=
1.11    ! ben      4517:                   "#id2591342">12.1.6. Packages which should not be
1.1       grant    4518:                   deleted, once installed</a></span></dt>
                   4519: 
                   4520:                   <dt><span class="sect2"><a href=
                   4521:                   "#security-handling">12.1.7. Handling packages
                   4522:                   with security problems</a></span></dt>
                   4523: 
                   4524:                   <dt><span class="sect2"><a href=
1.11    ! ben      4525:                   "#id2591434">12.1.8. How to handle compiler
1.1       grant    4526:                   bugs</a></span></dt>
                   4527: 
                   4528:                   <dt><span class="sect2"><a href=
1.11    ! ben      4529:                   "#id2591457">12.1.9. How to handle incrementing
1.1       grant    4530:                   versions when fixing an existing
                   4531:                   package</a></span></dt>
                   4532: 
                   4533:                   <dt><span class="sect2"><a href=
1.11    ! ben      4534:                   "#id2591574">12.1.10. Portability of
1.1       grant    4535:                   packages</a></span></dt>
                   4536:                 </dl>
                   4537:               </dd>
                   4538: 
1.11    ! ben      4539:               <dt><span class="sect1"><a href="#id2591598">12.2.
1.1       grant    4540:               Possible downloading issues</a></span></dt>
                   4541: 
                   4542:               <dd>
                   4543:                 <dl>
                   4544:                   <dt><span class="sect2"><a href=
1.11    ! ben      4545:                   "#id2591602">12.2.1. Packages whose distfiles
1.1       grant    4546:                   aren't available for plain
                   4547:                   downloading</a></span></dt>
                   4548: 
                   4549:                   <dt><span class="sect2"><a href=
1.11    ! ben      4550:                   "#id2591665">12.2.2. How to handle modified
1.1       grant    4551:                   distfiles with the 'old' name</a></span></dt>
                   4552:                 </dl>
                   4553:               </dd>
                   4554: 
1.11    ! ben      4555:               <dt><span class="sect1"><a href="#id2591676">12.3.
1.1       grant    4556:               Configuration gotchas</a></span></dt>
                   4557: 
                   4558:               <dd>
                   4559:                 <dl>
                   4560:                   <dt><span class="sect2"><a href=
                   4561:                   "#fixes.libtool">12.3.1. Shared libraries -
                   4562:                   libtool</a></span></dt>
                   4563: 
                   4564:                   <dt><span class="sect2"><a href=
1.11    ! ben      4565:                   "#id2592016">12.3.2. Using libtool on GNU
1.1       grant    4566:                   packages that already support
                   4567:                   libtool</a></span></dt>
                   4568: 
                   4569:                   <dt><span class="sect2"><a href=
1.11    ! ben      4570:                   "#id2592168">12.3.3. GNU
1.1       grant    4571:                   Autoconf/Automake</a></span></dt>
                   4572:                 </dl>
                   4573:               </dd>
                   4574: 
1.11    ! ben      4575:               <dt><span class="sect1"><a href="#id2592213">12.4.
1.1       grant    4576:               Building considerations</a></span></dt>
                   4577: 
                   4578:               <dd>
                   4579:                 <dl>
                   4580:                   <dt><span class="sect2"><a href=
1.11    ! ben      4581:                   "#id2592216">12.4.1. CPP defines</a></span></dt>
1.1       grant    4582:                 </dl>
                   4583:               </dd>
                   4584: 
1.11    ! ben      4585:               <dt><span class="sect1"><a href="#id2592314">12.5.
1.1       grant    4586:               Package specific actions</a></span></dt>
                   4587: 
                   4588:               <dd>
                   4589:                 <dl>
                   4590:                   <dt><span class="sect2"><a href=
1.11    ! ben      4591:                   "#id2592317">12.5.1. Package configuration
1.1       grant    4592:                   files</a></span></dt>
                   4593: 
                   4594:                   <dt><span class="sect2"><a href=
1.11    ! ben      4595:                   "#id2592420">12.5.2. User
1.2       hubertf  4596:                   interaction</a></span></dt>
1.1       grant    4597: 
                   4598:                   <dt><span class="sect2"><a href=
1.11    ! ben      4599:                   "#id2592465">12.5.3. Handling
1.1       grant    4600:                   licenses</a></span></dt>
                   4601: 
                   4602:                   <dt><span class="sect2"><a href=
1.11    ! ben      4603:                   "#id2592616">12.5.4. Creating an account from a
1.1       grant    4604:                   package</a></span></dt>
                   4605: 
                   4606:                   <dt><span class="sect2"><a href=
1.11    ! ben      4607:                   "#id2592678">12.5.5. Installing score
1.1       grant    4608:                   files</a></span></dt>
                   4609: 
                   4610:                   <dt><span class="sect2"><a href=
1.11    ! ben      4611:                   "#id2592858">12.5.6. Packages providing login
1.1       grant    4612:                   shells</a></span></dt>
                   4613: 
                   4614:                   <dt><span class="sect2"><a href=
1.11    ! ben      4615:                   "#id2592984">12.5.7. Packages containing perl
1.1       grant    4616:                   scripts</a></span></dt>
                   4617: 
                   4618:                   <dt><span class="sect2"><a href=
1.11    ! ben      4619:                   "#id2593002">12.5.8. Packages with hardcoded
1.1       grant    4620:                   paths to other interpreters</a></span></dt>
                   4621: 
                   4622:                   <dt><span class="sect2"><a href=
1.11    ! ben      4623:                   "#id2593024">12.5.9. Packages installing perl
1.1       grant    4624:                   modules</a></span></dt>
                   4625: 
                   4626:                   <dt><span class="sect2"><a href=
                   4627:                   "#faq.info-files">12.5.10. Packages installing
                   4628:                   info files</a></span></dt>
                   4629: 
                   4630:                   <dt><span class="sect2"><a href=
1.11    ! ben      4631:                   "#id2593380">12.5.11. Packages installing GConf2
1.1       grant    4632:                   data files</a></span></dt>
                   4633: 
                   4634:                   <dt><span class="sect2"><a href=
1.11    ! ben      4635:                   "#id2593480">12.5.12. Packages installing
1.1       grant    4636:                   scrollkeeper data files</a></span></dt>
                   4637: 
                   4638:                   <dt><span class="sect2"><a href=
1.11    ! ben      4639:                   "#id2593531">12.5.13. Packages installing X11
1.1       grant    4640:                   fonts</a></span></dt>
                   4641: 
                   4642:                   <dt><span class="sect2"><a href=
1.11    ! ben      4643:                   "#id2593578">12.5.14. Packages installing GTK2
1.1       grant    4644:                   modules</a></span></dt>
                   4645: 
                   4646:                   <dt><span class="sect2"><a href=
1.11    ! ben      4647:                   "#id2593648">12.5.15. Packages installing SGML or
1.1       grant    4648:                   XML data</a></span></dt>
                   4649: 
                   4650:                   <dt><span class="sect2"><a href=
1.11    ! ben      4651:                   "#id2593700">12.5.16. Packages installing
1.1       grant    4652:                   extensions to the MIME database</a></span></dt>
                   4653: 
                   4654:                   <dt><span class="sect2"><a href=
1.11    ! ben      4655:                   "#id2593770">12.5.17. Packages using
1.1       grant    4656:                   intltool</a></span></dt>
                   4657:                 </dl>
                   4658:               </dd>
                   4659: 
1.11    ! ben      4660:               <dt><span class="sect1"><a href="#id2593784">12.6.
1.1       grant    4661:               Feedback to the author</a></span></dt>
                   4662:             </dl>
                   4663:           </dd>
                   4664: 
                   4665:           <dt><span class="chapter"><a href="#debug">13.
                   4666:           Debugging</a></span></dt>
                   4667: 
                   4668:           <dt><span class="chapter"><a href="#submit">14.
                   4669:           Submitting and Committing</a></span></dt>
                   4670: 
                   4671:           <dd>
                   4672:             <dl>
1.11    ! ben      4673:               <dt><span class="sect1"><a href="#id2594314">14.1.
1.1       grant    4674:               Submitting your packages</a></span></dt>
                   4675: 
1.11    ! ben      4676:               <dt><span class="sect1"><a href="#id2594361">14.2.
1.1       grant    4677:               Committing: Importing a package into
                   4678:               CVS</a></span></dt>
                   4679: 
1.11    ! ben      4680:               <dt><span class="sect1"><a href="#id2594492">14.3.
1.2       hubertf  4681:               Updating a package to a newer version</a></span></dt>
1.1       grant    4682: 
1.11    ! ben      4683:               <dt><span class="sect1"><a href="#id2594512">14.4.
1.2       hubertf  4684:               Moving a package in pkgsrc</a></span></dt>
1.1       grant    4685:             </dl>
                   4686:           </dd>
                   4687:         </dl>
                   4688:       </div>
                   4689: 
                   4690:       <div class="chapter" lang="en" xml:lang="en">
                   4691:         <div class="titlepage">
                   4692:           <div>
                   4693:             <div>
                   4694:               <h2 class="title"><a name="components" id=
                   4695:               "components"></a>Chapter&nbsp;7.&nbsp;Package
                   4696:               components - files, directories and contents</h2>
                   4697:             </div>
                   4698:           </div>
                   4699:         </div>
                   4700: 
                   4701:         <div class="toc">
                   4702:           <p><b>Table of Contents</b></p>
                   4703: 
                   4704:           <dl>
                   4705:             <dt><span class="sect1"><a href=
1.7       wiz      4706:             "#components.Makefile">7.1. <code class=
                   4707:             "filename">Makefile</code></a></span></dt>
1.1       grant    4708: 
                   4709:             <dt><span class="sect1"><a href=
1.7       wiz      4710:             "#components.distinfo">7.2. <code class=
                   4711:             "filename">distinfo</code></a></span></dt>
1.1       grant    4712: 
                   4713:             <dt><span class="sect1"><a href=
                   4714:             "#components.patches">7.3. patches/*</a></span></dt>
                   4715: 
1.11    ! ben      4716:             <dt><span class="sect1"><a href="#id2586001">7.4. Other
1.1       grant    4717:             mandatory files</a></span></dt>
                   4718: 
                   4719:             <dt><span class="sect1"><a href=
                   4720:             "#components.optional">7.5. Optional
                   4721:             files</a></span></dt>
                   4722: 
1.11    ! ben      4723:             <dt><span class="sect1"><a href="#id2586126">7.6.
1.7       wiz      4724:             <code class="filename">work*</code></a></span></dt>
1.1       grant    4725: 
1.11    ! ben      4726:             <dt><span class="sect1"><a href="#id2586214">7.7.
1.7       wiz      4727:             <code class="filename">files/*</code></a></span></dt>
1.1       grant    4728:           </dl>
                   4729:         </div>
                   4730: 
                   4731:         <p>Whenever you're preparing a package, there are a number
                   4732:         of files involved which are described in the following
                   4733:         sections.</p>
                   4734: 
                   4735:         <div class="sect1" lang="en" xml:lang="en">
                   4736:           <div class="titlepage">
                   4737:             <div>
                   4738:               <div>
                   4739:                 <h2 class="title" style="clear: both"><a name=
                   4740:                 "components.Makefile" id=
1.7       wiz      4741:                 "components.Makefile"></a>7.1.&nbsp;<code class=
                   4742:                 "filename">Makefile</code></h2>
1.1       grant    4743:               </div>
                   4744:             </div>
                   4745:           </div>
                   4746: 
                   4747:           <p>Building, installation and creation of a binary
1.7       wiz      4748:           package are all controlled by the package's <code class=
                   4749:           "filename">Makefile</code>.</p>
1.1       grant    4750: 
1.7       wiz      4751:           <p>There is a <code class="filename">Makefile</code> for
                   4752:           each package. This file includes the standard
                   4753:           <code class="filename">bsd.pkg.mk</code> file (referenced
                   4754:           as <code class="filename">../../mk/bsd.pkg.mk</code>),
                   4755:           which sets all the definitions and actions necessary for
                   4756:           the package to compile and install itself. The mandatory
                   4757:           variables are the <code class="varname">DISTNAME</code>
                   4758:           which specifies the base name of the distribution file to
                   4759:           be downloaded from the site on the Internet, <code class=
                   4760:           "varname">MASTER_SITES</code> which specifies that site,
                   4761:           <code class="varname">CATEGORIES</code> which denotes the
                   4762:           categories into which the package falls, <code class=
                   4763:           "varname">PKGNAME</code> which is the name of the
                   4764:           package, the <code class="varname">MAINTAINER</code>'s
                   4765:           name, and the <code class="varname">COMMENT</code>
                   4766:           variable, which should contain a one-line description of
                   4767:           the package (the package name should not appear, it will
                   4768:           be added automatically). The maintainer variable is there
                   4769:           so that anyone who quibbles with the (always completely
                   4770:           correct) decisions taken by the guy who maintains the
                   4771:           package can complain vigorously, or send chocolate as a
                   4772:           sign of appreciation.</p>
1.1       grant    4773: 
1.7       wiz      4774:           <p>The <code class="varname">MASTER_SITES</code> may be
                   4775:           set to one of the predefined sites:</p>
1.1       grant    4776:           <pre class="programlisting">
                   4777:         ${MASTER_SITE_APACHE}
                   4778:         ${MASTER_SITE_DEBIAN}
                   4779:         ${MASTER_SITE_GNOME}
                   4780:         ${MASTER_SITE_GNU}
                   4781:         ${MASTER_SITE_GNUSTEP}
1.9       dillo    4782:         ${MASTER_SITE_IFARCHIVE}
1.1       grant    4783:         ${MASTER_SITE_MOZILLA}
                   4784:         ${MASTER_SITE_PERL_CPAN}
                   4785:         ${MASTER_SITE_SOURCEFORGE}
                   4786:         ${MASTER_SITE_SUNSITE}
                   4787:         ${MASTER_SITE_R_CRAN}
                   4788:         ${MASTER_SITE_SUSE}
                   4789:         ${MASTER_SITE_TEX_CTAN}
                   4790:         ${MASTER_SITE_XCONTRIB}
                   4791:         ${MASTER_SITE_XEMACS} 
                   4792: </pre>
                   4793: 
                   4794:           <p>If one of these predefined sites is chosen, you may
                   4795:           require the ability to specify a subdirectory of that
                   4796:           site. Since these macros may expand to more than one
                   4797:           actual site, you <span class=
                   4798:           "emphasis"><em>must</em></span> use the following
                   4799:           construct to specify a subdirectory:</p>
                   4800:           <pre class="programlisting">
                   4801:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   4802:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   4803: </pre>
                   4804: 
                   4805:           <p>Note the trailing slash after the subdirectory
                   4806:           name.</p>
                   4807: 
                   4808:           <div class="note" style=
                   4809:           "margin-left: 0.5in; margin-right: 0.5in;">
                   4810:             <h3 class="title">Note</h3>
                   4811: 
1.7       wiz      4812:             <p><code class="varname">MASTER_SITE_SUBDIR</code> has
                   4813:             been deprecated and <span class="emphasis"><em>should
                   4814:             no longer be used</em></span>.</p>
1.1       grant    4815:           </div>
                   4816: 
1.7       wiz      4817:           <p>If the package has multiple <code class=
                   4818:           "varname">DISTFILES</code> or multiple <code class=
                   4819:           "varname">PATCHFILES</code> from different sites, set
                   4820:           <code class="varname">SITES_foo</code> to a list of URI's
1.1       grant    4821:           where file &#8220;<span class="quote">foo</span>&#8221;
                   4822:           may be found. &#8220;<span class=
                   4823:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   4824:           <pre class="programlisting">
                   4825: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   4826: DISTFILES+=     foo-file.tar.gz
                   4827: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   4828:         http://www.somewhereelse.com/mirror/somehow/
                   4829: </pre>
                   4830: 
1.7       wiz      4831:           <p>Note that the normal default setting of <code class=
                   4832:           "varname">DISTFILES</code> must be made explicit if you
1.1       grant    4833:           want to add to it (rather than replace it), as you
                   4834:           usually would.</p>
                   4835: 
                   4836:           <p>Currently the following values are available for
1.7       wiz      4837:           <code class="varname">CATEGORIES</code>. If more than one
                   4838:           is used, they need to be separated by spaces:</p>
1.1       grant    4839:           <pre class="programlisting">
                   4840: archivers     cross         geography     meta-pkgs     security
                   4841: audio         databases     graphics      misc          shells
                   4842: benchmarks    devel         ham           multimedia    sysutils
                   4843: biology       editors       inputmethod   net           textproc
                   4844: cad           emulators     lang          news          time
                   4845: chat          finance       mail          parallel      wm
                   4846: comms         fonts         math          pkgtools      www
                   4847: converters    games         mbone         print         x11
                   4848: </pre>
                   4849: 
                   4850:           <p>Please pay attention to the following gotchas:</p>
                   4851: 
                   4852:           <div class="itemizedlist">
                   4853:             <ul type="disc">
                   4854:               <li>
1.7       wiz      4855:                 <p>Add <code class="varname">MANCOMPRESSED</code>
                   4856:                 if manpages are installed in compressed form by the
                   4857:                 package; see comment in <code class=
                   4858:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    4859:               </li>
                   4860: 
                   4861:               <li>
1.7       wiz      4862:                 <p>Replace <code class="filename">/usr/local</code>
1.1       grant    4863:                 with &#8220;<span class=
                   4864:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   4865:                 patches, below).</p>
                   4866:               </li>
                   4867: 
                   4868:               <li>
                   4869:                 <p>If the package installs any info files, see
                   4870:                 <a href="#faq.info-files" title=
                   4871:                 "12.5.10.&nbsp;Packages installing info files">Section
                   4872:                 12.5.10, &#8220;Packages installing info
                   4873:                 files&#8221;</a>.</p>
                   4874:               </li>
                   4875: 
                   4876:               <li>
1.7       wiz      4877:                 <p>Set <code class="varname">MAINTAINER</code> to
                   4878:                 be yourself. If you really can't maintain the
                   4879:                 package for future updates, set it to <code class=
1.1       grant    4880:                 "email">&lt;<a href=
1.7       wiz      4881:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.1       grant    4882:               </li>
                   4883: 
                   4884:               <li>
                   4885:                 <p>If a home page for the software in question
1.7       wiz      4886:                 exists, add the variable <code class=
                   4887:                 "varname">HOMEPAGE</code> right after <code class=
                   4888:                 "varname">MAINTAINER</code>. The value of this
1.1       grant    4889:                 variable should be the URL for the home page.</p>
                   4890:               </li>
                   4891: 
                   4892:               <li>
1.7       wiz      4893:                 <p>Be sure to set the <code class=
                   4894:                 "varname">COMMENT</code> variable to a short
1.1       grant    4895:                 description of the package, not containing the
                   4896:                 pkg's name.</p>
                   4897:               </li>
                   4898:             </ul>
                   4899:           </div>
                   4900:         </div>
                   4901: 
                   4902:         <div class="sect1" lang="en" xml:lang="en">
                   4903:           <div class="titlepage">
                   4904:             <div>
                   4905:               <div>
                   4906:                 <h2 class="title" style="clear: both"><a name=
                   4907:                 "components.distinfo" id=
1.7       wiz      4908:                 "components.distinfo"></a>7.2.&nbsp;<code class=
                   4909:                 "filename">distinfo</code></h2>
1.1       grant    4910:               </div>
                   4911:             </div>
                   4912:           </div>
                   4913: 
                   4914:           <p>Most important, the mandatory message digest, or
                   4915:           checksum, of all the distfiles needed for the package to
                   4916:           compile, confirming they match the original file
                   4917:           distributed by the author. This ensures that the distfile
                   4918:           retrieved from the Internet has not been corrupted during
                   4919:           transfer or altered by a malign force to introduce a
1.7       wiz      4920:           security hole. It is generated using the
                   4921:           <span><strong class="command">make
                   4922:           makesum</strong></span> command. The digest algorithm
                   4923:           used was, at one stage, md5, but that was felt lacking
                   4924:           compared to sha1, and so sha1 is now the default
1.1       grant    4925:           algorithm. The distfile size is also generated and stored
                   4926:           in new distinfo files. The <a xmlns=
                   4927:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4928:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.7       wiz      4929:           class="pkgname">pkgtools/digest</a> utility calculates
                   4930:           all of the digests in the distinfo file, and it provides
                   4931:           various different algorithms. At the current time, the
                   4932:           algorithms provided are: <span class=
                   4933:           "emphasis"><em>md5</em></span>, <span class=
                   4934:           "emphasis"><em>rmd160</em></span>, <span class=
                   4935:           "emphasis"><em>sha1</em></span>, <span class=
                   4936:           "emphasis"><em>sha256</em></span>, <span class=
                   4937:           "emphasis"><em>sha384</em></span> and <span class=
                   4938:           "emphasis"><em>sha512</em></span>.</p>
1.1       grant    4939: 
                   4940:           <p>Some packages have different sets of distfiles on a
                   4941:           per architecture basis, for example <a xmlns=
                   4942:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4943:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.7       wiz      4944:           class="pkgname">www/navigator</a>). These are kept in the
                   4945:           same distinfo file and care should be taken when
                   4946:           upgrading such a package to ensure distfile information
                   4947:           is not lost.</p>
1.1       grant    4948: 
                   4949:           <p>The message digest/checksum for all the official
1.7       wiz      4950:           patches found in the <code class=
                   4951:           "filename">patches/</code> directory (see <a href=
                   4952:           "#components.patches" title=
1.1       grant    4953:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   4954:           &#8220;patches/*&#8221;</a>) for the package is also
1.7       wiz      4955:           stored in the <code class="filename">distinfo</code>
                   4956:           file. This is a message digest/checksum of all lines in
                   4957:           the patch file except the NetBSD RCS Id. This file is
                   4958:           generated by invoking <span><strong class="command">make
                   4959:           makepatchsum</strong></span> (or <span><strong class=
                   4960:           "command">make mps</strong></span> if you're in a
                   4961:           hurry).</p>
1.1       grant    4962:         </div>
                   4963: 
                   4964:         <div class="sect1" lang="en" xml:lang="en">
                   4965:           <div class="titlepage">
                   4966:             <div>
                   4967:               <div>
                   4968:                 <h2 class="title" style="clear: both"><a name=
                   4969:                 "components.patches" id=
                   4970:                 "components.patches"></a>7.3.&nbsp;patches/*</h2>
                   4971:               </div>
                   4972:             </div>
                   4973:           </div>
                   4974: 
                   4975:           <p>This directory contains files that are used by the
                   4976:           <a href=
                   4977:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   4978:           <span class="citerefentry"><span class=
                   4979:           "refentrytitle">patch</span>(1)</span></a> command to
                   4980:           modify the sources as distributed in the distribution
                   4981:           file into a form that will compile and run perfectly on
                   4982:           NetBSD. The files are applied successively in alphabetic
                   4983:           order (as returned by a shell &#8220;<span class=
                   4984:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.7       wiz      4985:           <code class="filename">patch-aa</code> is applied before
                   4986:           <code class="filename">patch-ab</code>, etc.</p>
1.1       grant    4987: 
1.7       wiz      4988:           <p>The <code class="filename">patch-*</code> files should
                   4989:           be in <span><strong class="command">diff
                   4990:           -bu</strong></span> format, and apply without a fuzz to
                   4991:           avoid problems. (To force patches to apply with fuzz you
                   4992:           can set <code class=
                   4993:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    4994:           not put changes for more than one file into a single
                   4995:           patch-file, as this will make future modifications more
                   4996:           difficult.</p>
                   4997: 
                   4998:           <p>Similar, a file should be patched at most once, not
                   4999:           several times by several different patches. If a file
                   5000:           needs several patches, they should be combined into one
                   5001:           file.</p>
                   5002: 
                   5003:           <p>One important thing to mention is to pay attention
                   5004:           that no RCS IDs get stored in the patch files, as these
                   5005:           will cause problems when later checked into the NetBSD
1.7       wiz      5006:           CVS tree. Use the <span><strong class=
                   5007:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    5008:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5009:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.7       wiz      5010:           class="pkgname">pkgtools/pkgdiff</a> package to avoid
                   5011:           these problems.</p>
1.1       grant    5012: 
                   5013:           <p>For even more automation, we recommend using
1.7       wiz      5014:           <span><strong class="command">mkpatches</strong></span>
                   5015:           from the same package to make a whole set of patches. You
                   5016:           just have to backup files before you edit them to
                   5017:           <code class="filename">filename.orig</code>, e.g. with
                   5018:           <span><strong class="command">cp -p filename
                   5019:           filename.orig</strong></span> or, easier, by using
                   5020:           <span><strong class="command">pkgvi</strong></span> again
                   5021:           from the same package. If you upgrade a package this way,
                   5022:           you can easily compare the new set of patches with the
                   5023:           previously existing one with <span><strong class=
                   5024:           "command">patchdiff</strong></span>.</p>
1.1       grant    5025: 
                   5026:           <p>When you have finished a package, remember to generate
                   5027:           the checksums for the patch files by using the
1.7       wiz      5028:           <span><strong class="command">make
                   5029:           makepatchsum</strong></span> command, see <a href=
                   5030:           "#components.distinfo" title=
1.5       hubertf  5031:           "7.2.&nbsp;distinfo">Section&nbsp;7.2,
1.7       wiz      5032:           &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    5033: 
                   5034:           <p>Patch files that are distributed by the author or
1.7       wiz      5035:           other maintainers can be listed in <code class=
                   5036:           "varname">$PATCHFILES</code>.</p>
1.1       grant    5037: 
                   5038:           <p>If it is desired to store any patches that should not
                   5039:           be committed into pkgsrc, they can be kept outside the
1.7       wiz      5040:           pkgsrc tree in the <code class=
                   5041:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    5042:           tree there is expected to have the same
                   5043:           &#8220;<span class="quote">category/package</span>&#8221;
                   5044:           structure as pkgsrc, and patches are expected to be
1.7       wiz      5045:           stored inside these dirs (also known as <code class=
                   5046:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
                   5047:           you want to keep a private patch for <code class=
                   5048:           "filename">pkgsrc/graphics/png</code>, keep it in
                   5049:           <code class=
                   5050:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   5051:           files in the named directory are expected to be patch
1.1       grant    5052:           files, and <span class="emphasis"><em>they are applied
                   5053:           after pkgsrc patches are applied</em></span>.</p>
                   5054:         </div>
                   5055: 
                   5056:         <div class="sect1" lang="en" xml:lang="en">
                   5057:           <div class="titlepage">
                   5058:             <div>
                   5059:               <div>
                   5060:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      5061:                 "id2586001" id="id2586001"></a>7.4.&nbsp;Other
1.1       grant    5062:                 mandatory files</h2>
                   5063:               </div>
                   5064:             </div>
                   5065:           </div>
                   5066: 
                   5067:           <div class="variablelist">
                   5068:             <dl>
1.7       wiz      5069:               <dt><span class="term"><code class=
                   5070:               "filename">DESCR</code></span></dt>
1.1       grant    5071: 
                   5072:               <dd>
                   5073:                 <p>A multi-line description of the piece of
                   5074:                 software. This should include any credits where
                   5075:                 they are due. Please bear in mind that others do
                   5076:                 not share your sense of humour (or spelling
                   5077:                 idiosyncrasies), and that others will read
                   5078:                 everything that you write here.</p>
                   5079:               </dd>
                   5080: 
1.7       wiz      5081:               <dt><span class="term"><code class=
                   5082:               "filename">PLIST</code></span></dt>
1.1       grant    5083: 
                   5084:               <dd>
                   5085:                 <p>This file governs the files that are installed
                   5086:                 on your system: all the binaries, manual pages,
                   5087:                 etc. There are other directives which may be
                   5088:                 entered in this file, to control the creation and
                   5089:                 deletion of directories, and the location of
                   5090:                 inserted files. See <a href="#plist" title=
                   5091:                 "Chapter&nbsp;8.&nbsp;PLIST issues">Chapter&nbsp;8,
                   5092:                 <i>PLIST issues</i></a> for more information.</p>
                   5093:               </dd>
                   5094:             </dl>
                   5095:           </div>
                   5096:         </div>
                   5097: 
                   5098:         <div class="sect1" lang="en" xml:lang="en">
                   5099:           <div class="titlepage">
                   5100:             <div>
                   5101:               <div>
                   5102:                 <h2 class="title" style="clear: both"><a name=
                   5103:                 "components.optional" id=
                   5104:                 "components.optional"></a>7.5.&nbsp;Optional
                   5105:                 files</h2>
                   5106:               </div>
                   5107:             </div>
                   5108:           </div>
                   5109: 
                   5110:           <div class="variablelist">
                   5111:             <dl>
1.7       wiz      5112:               <dt><span class="term"><code class=
                   5113:               "filename">INSTALL</code></span></dt>
1.1       grant    5114: 
                   5115:               <dd>
                   5116:                 <p>This shell script is invoked twice by <a href=
                   5117:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5118:                 <span class="citerefentry"><span class=
                   5119:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   5120:                 time after package extraction and before files are
                   5121:                 moved in place, the second time after the files to
                   5122:                 install are moved in place. This can be used to do
                   5123:                 any custom procedures not possible with @exec
1.7       wiz      5124:                 commands in <code class="filename">PLIST</code>.
                   5125:                 See <a href=
1.1       grant    5126:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5127:                 <span class="citerefentry"><span class=
                   5128:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   5129:                 <a href=
                   5130:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5131:                 <span class="citerefentry"><span class=
                   5132:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5133:                 more information.</p>
                   5134:               </dd>
                   5135: 
1.7       wiz      5136:               <dt><span class="term"><code class=
                   5137:               "filename">DEINSTALL</code></span></dt>
1.1       grant    5138: 
                   5139:               <dd>
                   5140:                 <p>This script is executed before and after any
                   5141:                 files are removed. It is this script's
                   5142:                 responsibility to clean up any additional messy
                   5143:                 details around the package's installation, since
                   5144:                 all pkg_delete knows is how to delete the files
                   5145:                 created in the original distribution. See <a href=
                   5146:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   5147:                 <span class="citerefentry"><span class=
                   5148:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   5149:                 <a href=
                   5150:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5151:                 <span class="citerefentry"><span class=
                   5152:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5153:                 more information.</p>
                   5154:               </dd>
                   5155: 
1.7       wiz      5156:               <dt><span class="term"><code class=
                   5157:               "filename">MESSAGE</code></span></dt>
1.1       grant    5158: 
                   5159:               <dd>
                   5160:                 <p>Display this file after installation of the
                   5161:                 package. Useful for things like legal notices on
                   5162:                 almost-free software and hints for updating config
                   5163:                 files after installing modules for apache, PHP etc.
                   5164:                 Please note that you can modify variables in it
1.7       wiz      5165:                 easily by using <code class=
                   5166:                 "varname">MESSAGE_SUBST</code> in the package's
                   5167:                 <code class="filename">Makefile</code>:</p>
1.1       grant    5168:                 <pre class="programlisting">
                   5169: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   5170: </pre>
                   5171: 
                   5172:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.7       wiz      5173:                 "quote">somevalue</span>&#8221; in <code class=
                   5174:                 "filename">MESSAGE</code>.</p>
1.1       grant    5175:               </dd>
                   5176:             </dl>
                   5177:           </div>
                   5178:         </div>
                   5179: 
                   5180:         <div class="sect1" lang="en" xml:lang="en">
                   5181:           <div class="titlepage">
                   5182:             <div>
                   5183:               <div>
                   5184:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      5185:                 "id2586126" id=
        !          5186:                 "id2586126"></a>7.6.&nbsp;<code class=
1.7       wiz      5187:                 "filename">work*</code></h2>
1.1       grant    5188:               </div>
                   5189:             </div>
                   5190:           </div>
                   5191: 
1.7       wiz      5192:           <p>When you type <span><strong class=
                   5193:           "command">make</strong></span> the distribution files are
                   5194:           unpacked into this directory. It can be removed by
                   5195:           running <span><strong class="command">make
                   5196:           clean</strong></span>. Besides the sources, this
                   5197:           directory is also used to keep various timestamp
1.1       grant    5198:           files.</p>
                   5199: 
                   5200:           <p>If a package doesn't create a subdirectory for itself
                   5201:           (like GNU software does, for instance), but extracts
                   5202:           itself in the current directory, you should set
1.7       wiz      5203:           <code class="varname">WRKSRC</code> accordingly, e.g.
1.1       grant    5204:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   5205:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.7       wiz      5206:           class="pkgname">editors/sam</a> again, but the quick
                   5207:           answer is:</p>
1.1       grant    5208:           <pre class="programlisting">
                   5209: WRKSRC=                ${WRKDIR}
                   5210: </pre>
                   5211: 
1.7       wiz      5212:           <p>Please note that the old <code class=
                   5213:           "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1       grant    5214:           should not be used. Also, if your package doesn't create
1.7       wiz      5215:           a subdir with the name of <code class=
                   5216:           "varname">DISTNAME</code> but some different name, set
                   5217:           <code class="varname">WRKSRC</code> to point to the
                   5218:           proper name in <code class="filename">${WRKDIR}</code>.
                   5219:           See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5220:           href=
1.1       grant    5221:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.7       wiz      5222:           class="pkgname">lang/tcl</a> and <a xmlns=
                   5223:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5224:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   5225:           class="pkgname">x11/tk</a> for examples, and here is
                   5226:           another one:</p>
1.1       grant    5227:           <pre class="programlisting">
                   5228: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   5229: </pre>
                   5230: 
                   5231:           <p>The name of the working directory created by pkgsrc is
1.7       wiz      5232:           <code class="filename">work</code> by default. If the
                   5233:           same pkgsrc tree should be used on several different
                   5234:           platforms, the variable <code class=
                   5235:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1       grant    5236:           attach the platform to the directory name, e.g.
1.7       wiz      5237:           <code class="filename">work.i386</code> or <code class=
                   5238:           "filename">work.sparc</code>.</p>
1.1       grant    5239:         </div>
                   5240: 
                   5241:         <div class="sect1" lang="en" xml:lang="en">
                   5242:           <div class="titlepage">
                   5243:             <div>
                   5244:               <div>
                   5245:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      5246:                 "id2586214" id=
        !          5247:                 "id2586214"></a>7.7.&nbsp;<code class=
1.7       wiz      5248:                 "filename">files/*</code></h2>
1.1       grant    5249:               </div>
                   5250:             </div>
                   5251:           </div>
                   5252: 
                   5253:           <p>If you have any files that you wish to be placed in
                   5254:           the package prior to configuration or building, you could
                   5255:           place these files here and use a &#8220;<span class=
                   5256:           "quote">${CP}</span>&#8221; command in the
                   5257:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   5258:           target to achieve this. Alternatively, you could simply
1.7       wiz      5259:           diff the file against <code class=
                   5260:           "filename">/dev/null</code> and use the patch mechanism
                   5261:           to manage the creation of this file.</p>
1.1       grant    5262:         </div>
                   5263:       </div>
                   5264: 
                   5265:       <div class="chapter" lang="en" xml:lang="en">
                   5266:         <div class="titlepage">
                   5267:           <div>
                   5268:             <div>
                   5269:               <h2 class="title"><a name="plist" id=
                   5270:               "plist"></a>Chapter&nbsp;8.&nbsp;PLIST issues</h2>
                   5271:             </div>
                   5272:           </div>
                   5273:         </div>
                   5274: 
                   5275:         <div class="toc">
                   5276:           <p><b>Table of Contents</b></p>
                   5277: 
                   5278:           <dl>
1.11    ! ben      5279:             <dt><span class="sect1"><a href="#id2586268">8.1. RCS
1.1       grant    5280:             ID</a></span></dt>
                   5281: 
1.11    ! ben      5282:             <dt><span class="sect1"><a href="#id2586283">8.2.
1.7       wiz      5283:             Semi-automatic <code class="filename">PLIST</code>
                   5284:             generation</a></span></dt>
1.1       grant    5285: 
                   5286:             <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.7       wiz      5287:             Tweaking output of <span><strong class="command">make
                   5288:             print-PLIST</strong></span></a></span></dt>
1.1       grant    5289: 
                   5290:             <dt><span class="sect1"><a href="#plist.misc">8.4.
                   5291:             Variable substitution in PLIST</a></span></dt>
                   5292: 
1.11    ! ben      5293:             <dt><span class="sect1"><a href="#id2586673">8.5.
1.1       grant    5294:             Manpage-compression</a></span></dt>
                   5295: 
1.11    ! ben      5296:             <dt><span class="sect1"><a href="#id2586714">8.6.
1.7       wiz      5297:             Changing PLIST source with <code class=
                   5298:             "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5299: 
1.11    ! ben      5300:             <dt><span class="sect1"><a href="#id2586731">8.7.
1.1       grant    5301:             Platform specific and differing PLISTs</a></span></dt>
                   5302: 
                   5303:             <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
                   5304:             Sharing directories between packages</a></span></dt>
                   5305:           </dl>
                   5306:         </div>
                   5307: 
1.7       wiz      5308:         <p>The <code class="filename">PLIST</code> file contains a
1.1       grant    5309:         package's &#8220;<span class="quote">packing
                   5310:         list</span>&#8221;, i.e. a list of files that belong to the
1.7       wiz      5311:         package (relative to the <code class=
                   5312:         "filename">${PREFIX}</code> directory it's been installed
                   5313:         in) plus some additional statements - see the <a href=
1.1       grant    5314:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5315:         <span class="citerefentry"><span class=
                   5316:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   5317:         a full list. This chapter addresses some issues that need
1.7       wiz      5318:         attention when dealing with the <code class=
                   5319:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    5320: 
                   5321:         <div class="sect1" lang="en" xml:lang="en">
                   5322:           <div class="titlepage">
                   5323:             <div>
                   5324:               <div>
                   5325:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      5326:                 "id2586268" id="id2586268"></a>8.1.&nbsp;RCS
1.1       grant    5327:                 ID</h2>
                   5328:               </div>
                   5329:             </div>
                   5330:           </div>
                   5331: 
                   5332:           <p>Be sure to add a RCS ID line as the first thing in any
1.7       wiz      5333:           <code class="filename">PLIST</code> file you write:</p>
1.1       grant    5334:           <pre class="programlisting">
1.11    ! ben      5335: @comment $NetBSD$
1.1       grant    5336: </pre>
                   5337:         </div>
                   5338: 
                   5339:         <div class="sect1" lang="en" xml:lang="en">
                   5340:           <div class="titlepage">
                   5341:             <div>
                   5342:               <div>
                   5343:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      5344:                 "id2586283" id=
        !          5345:                 "id2586283"></a>8.2.&nbsp;Semi-automatic
1.7       wiz      5346:                 <code class="filename">PLIST</code> generation</h2>
1.1       grant    5347:               </div>
                   5348:             </div>
                   5349:           </div>
                   5350: 
1.7       wiz      5351:           <p>You can use the <span><strong class="command">make
                   5352:           print-PLIST</strong></span> command to output a PLIST
                   5353:           that matches any new files since the package was
                   5354:           extracted. See <a href="#build.helpful-targets" title=
1.1       grant    5355:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   5356:           &#8220;Other helpful targets&#8221;</a> for more
                   5357:           information on this target.</p>
                   5358:         </div>
                   5359: 
                   5360:         <div class="sect1" lang="en" xml:lang="en">
                   5361:           <div class="titlepage">
                   5362:             <div>
                   5363:               <div>
                   5364:                 <h2 class="title" style="clear: both"><a name=
                   5365:                 "print-PLIST" id=
                   5366:                 "print-PLIST"></a>8.3.&nbsp;Tweaking output of
1.7       wiz      5367:                 <span><strong class="command">make
                   5368:                 print-PLIST</strong></span></h2>
1.1       grant    5369:               </div>
                   5370:             </div>
                   5371:           </div>
                   5372: 
                   5373:           <p>If you have used any of the *-dirs packages, as
                   5374:           explained in <a href="#faq.common-dirs" title=
                   5375:           "8.8.&nbsp;Sharing directories between packages">Section&nbsp;8.8,
                   5376:           &#8220;Sharing directories between packages&#8221;</a>,
1.7       wiz      5377:           you may have noticed that <span><strong class=
                   5378:           "command">make print-PLIST</strong></span> outputs a set
                   5379:           of <code class="varname">@comment</code>s instead of real
                   5380:           <code class="varname">@dirrm</code> lines. You can also
                   5381:           do this for specific directories and files, so that the
                   5382:           results of that command are very close to reality. This
                   5383:           helps <span class="emphasis"><em>a lot</em></span> during
                   5384:           the update of packages.</p>
                   5385: 
                   5386:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   5387:           variable takes a set of AWK patterns and actions that are
                   5388:           used to filter the output of print-PLIST. You can
                   5389:           <span class="emphasis"><em>append</em></span> any chunk
                   5390:           of AWK scripting you like to it, but be careful with
1.1       grant    5391:           quoting.</p>
                   5392: 
1.7       wiz      5393:           <p>For example, to get all files inside the <code class=
                   5394:           "filename">libdata/foo</code> directory removed from the
1.1       grant    5395:           resulting PLIST:</p>
                   5396:           <pre class="programlisting">
                   5397:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   5398:     
                   5399: </pre>
                   5400: 
1.7       wiz      5401:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    5402:           lines referring to a specific (shared) directory
1.7       wiz      5403:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    5404:           <pre class="programlisting">
                   5405:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   5406:     
                   5407: </pre>
                   5408:         </div>
                   5409: 
                   5410:         <div class="sect1" lang="en" xml:lang="en">
                   5411:           <div class="titlepage">
                   5412:             <div>
                   5413:               <div>
                   5414:                 <h2 class="title" style="clear: both"><a name=
                   5415:                 "plist.misc" id="plist.misc"></a>8.4.&nbsp;Variable
                   5416:                 substitution in PLIST</h2>
                   5417:               </div>
                   5418:             </div>
                   5419:           </div>
                   5420: 
                   5421:           <p>A number of variables are substituted automatically in
                   5422:           PLISTs when a package is installed on a system. This
                   5423:           includes the following variables:</p>
                   5424: 
                   5425:           <div class="variablelist">
                   5426:             <dl>
1.7       wiz      5427:               <dt><span class="term"><code class=
                   5428:               "varname">${MACHINE_ARCH}</code>, <code class=
                   5429:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    5430: 
                   5431:               <dd>
                   5432:                 <p>Some packages like emacs and perl embed
                   5433:                 information about which architecture they were
                   5434:                 built on into the pathnames where they install
                   5435:                 their file. To handle this case, PLIST will be
                   5436:                 preprocessed before actually used, and the symbol
1.7       wiz      5437:                 &#8220;<span class="quote"><code class=
                   5438:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   5439:                 be replaced by what <span><strong class=
                   5440:                 "command">uname -p</strong></span> gives. The same
                   5441:                 is done if the string <code class=
                   5442:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   5443:                 PLIST somewhere - use this on packages that have
                   5444:                 GNU autoconf created configure scripts.</p>
1.1       grant    5445: 
                   5446:                 <div class="note" style=
                   5447:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   5448:                   <h3 class="title">Legacy note</h3>
                   5449: 
                   5450:                   <p>There used to be a symbol &#8220;<span class=
1.7       wiz      5451:                   "quote"><code class=
                   5452:                   "varname">$ARCH</code></span>&#8221; that was
                   5453:                   replaced by the output of <span><strong class=
                   5454:                   "command">uname -m</strong></span>, but that's no
1.1       grant    5455:                   longer supported and has been removed.</p>
                   5456:                 </div>
                   5457:               </dd>
                   5458: 
1.7       wiz      5459:               <dt><span class="term"><code class=
                   5460:               "varname">${OPSYS}</code>, <code class=
                   5461:               "varname">${LOWER_OPSYS}</code>, <code class=
                   5462:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    5463: 
                   5464:               <dd>
                   5465:                 <p>Some packages want to embed the OS name and
                   5466:                 version into some paths. To do this, use these
1.7       wiz      5467:                 variables in the <code class=
                   5468:                 "filename">PLIST</code>:</p>
1.1       grant    5469: 
                   5470:                 <div class="itemizedlist">
                   5471:                   <ul type="disc">
                   5472:                     <li>
1.7       wiz      5473:                       <p><code class="varname">${OPSYS}</code> -
                   5474:                       output of &#8220;<span class=
                   5475:                       "quote"><span><strong class="command">uname
                   5476:                       -s</strong></span></span>&#8221;</p>
1.1       grant    5477:                     </li>
                   5478: 
                   5479:                     <li>
1.7       wiz      5480:                       <p><code class=
                   5481:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   5482:                       common name (eg. &#8220;<span class=
                   5483:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    5484:                     </li>
                   5485: 
                   5486:                     <li>
1.7       wiz      5487:                       <p><code class="varname">${OS_VERSION}</code>
                   5488:                       - &#8220;<span class=
                   5489:                       "quote"><span><strong class="command">uname
                   5490:                       -r</strong></span></span>&#8221;</p>
1.1       grant    5491:                     </li>
                   5492:                   </ul>
                   5493:                 </div>
                   5494:               </dd>
                   5495: 
1.7       wiz      5496:               <dt><span class="term"><code class=
                   5497:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    5498: 
                   5499:               <dd>
                   5500:                 <p>Packages that install locale files should list
                   5501:                 them in the PLIST as &#8220;<span class=
                   5502:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   5503:                 instead of &#8220;<span class=
                   5504:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   5505:                 This properly handles the fact that different
                   5506:                 operating systems expect locale files to be either
1.7       wiz      5507:                 in <code class="filename">share</code> or
                   5508:                 <code class="filename">lib</code> by default.</p>
1.1       grant    5509:               </dd>
                   5510:             </dl>
                   5511:           </div>
                   5512: 
                   5513:           <p>For a complete list of values which are replaced by
1.7       wiz      5514:           default, please look in <code class=
                   5515:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    5516:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   5517: 
                   5518:           <p>If you want to change other variables not listed
                   5519:           above, you can add variables and their expansions to this
1.7       wiz      5520:           variable in the following way, similar to <code class=
                   5521:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    5522:           "#components.optional" title=
                   5523:           "7.5.&nbsp;Optional files">Section&nbsp;7.5,
                   5524:           &#8220;Optional files&#8221;</a>):</p>
                   5525:           <pre class="programlisting">
                   5526: PLIST_SUBST+=    SOMEVAR="somevalue"
                   5527: </pre>
                   5528: 
                   5529:           <p>This replaces all occurrences of &#8220;<span class=
                   5530:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   5531:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   5532:         </div>
                   5533: 
                   5534:         <div class="sect1" lang="en" xml:lang="en">
                   5535:           <div class="titlepage">
                   5536:             <div>
                   5537:               <div>
                   5538:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      5539:                 "id2586673" id=
        !          5540:                 "id2586673"></a>8.5.&nbsp;Manpage-compression</h2>
1.1       grant    5541:               </div>
                   5542:             </div>
                   5543:           </div>
                   5544: 
                   5545:           <p>Manpages should be installed in compressed form if
1.7       wiz      5546:           <code class="varname">MANZ</code> is set (in <code class=
                   5547:           "filename">bsd.own.mk</code>), and uncompressed
                   5548:           otherwise. To handle this in the <code class=
                   5549:           "filename">PLIST</code> file, the suffix
                   5550:           &#8220;<span class="quote">.gz</span>&#8221; is
                   5551:           appended/removed automatically for manpages according to
                   5552:           <code class="varname">MANZ</code> and <code class=
                   5553:           "varname">MANCOMPRESSED</code> being set or not, see
                   5554:           above for details. This modification of the <code class=
                   5555:           "filename">PLIST</code> file is done on a copy of it, not
                   5556:           <code class="filename">PLIST</code> itself.</p>
1.1       grant    5557:         </div>
                   5558: 
                   5559:         <div class="sect1" lang="en" xml:lang="en">
                   5560:           <div class="titlepage">
                   5561:             <div>
                   5562:               <div>
                   5563:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      5564:                 "id2586714" id="id2586714"></a>8.6.&nbsp;Changing
1.7       wiz      5565:                 PLIST source with <code class=
                   5566:                 "varname">PLIST_SRC</code></h2>
1.1       grant    5567:               </div>
                   5568:             </div>
                   5569:           </div>
                   5570: 
1.7       wiz      5571:           <p>To use one or more files as source for the
                   5572:           <code class="filename">PLIST</code> used in generating
                   5573:           the binary package, set the variable <code class=
                   5574:           "varname">PLIST_SRC</code> to the names of that file(s).
1.1       grant    5575:           The files are later concatenated using cat(1), and order
                   5576:           of things is important.</p>
                   5577:         </div>
                   5578: 
                   5579:         <div class="sect1" lang="en" xml:lang="en">
                   5580:           <div class="titlepage">
                   5581:             <div>
                   5582:               <div>
                   5583:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      5584:                 "id2586731" id="id2586731"></a>8.7.&nbsp;Platform
1.1       grant    5585:                 specific and differing PLISTs</h2>
                   5586:               </div>
                   5587:             </div>
                   5588:           </div>
                   5589: 
                   5590:           <p>Some packages decide to install a different set of
                   5591:           files based on the operating system being used. These
                   5592:           differences can be automatically handled by using the
                   5593:           following files:</p>
                   5594: 
                   5595:           <div class="itemizedlist">
                   5596:             <ul type="disc">
                   5597:               <li>
1.7       wiz      5598:                 <p><code class="filename">PLIST.common</code></p>
1.1       grant    5599:               </li>
                   5600: 
                   5601:               <li>
1.7       wiz      5602:                 <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1       grant    5603:               </li>
                   5604: 
                   5605:               <li>
1.7       wiz      5606:                 <p><code class=
                   5607:                 "filename">PLIST.common_end</code></p>
1.1       grant    5608:               </li>
                   5609:             </ul>
                   5610:           </div>
                   5611: 
1.7       wiz      5612:           <p>If <code class="filename">PLIST.${OPSYS}</code>
                   5613:           exists, these files are used instead of <code class=
                   5614:           "filename">PLIST</code>. This allows packages which
                   5615:           behave in this way to be handled gracefully. Manually
                   5616:           overriding <code class="varname">PLIST_SRC</code> for
                   5617:           other more exotic uses is also possible.</p>
1.1       grant    5618:         </div>
                   5619: 
                   5620:         <div class="sect1" lang="en" xml:lang="en">
                   5621:           <div class="titlepage">
                   5622:             <div>
                   5623:               <div>
                   5624:                 <h2 class="title" style="clear: both"><a name=
                   5625:                 "faq.common-dirs" id=
                   5626:                 "faq.common-dirs"></a>8.8.&nbsp;Sharing directories
                   5627:                 between packages</h2>
                   5628:               </div>
                   5629:             </div>
                   5630:           </div>
                   5631: 
                   5632:           <p>A &#8220;<span class="quote">shared
                   5633:           directory</span>&#8221; is a directory where multiple
                   5634:           (and unrelated) packages install files. These directories
                   5635:           are problematic because you have to add special tricks in
                   5636:           the PLIST to conditionally remove them, or have some
                   5637:           centralized package handle them.</p>
                   5638: 
                   5639:           <p>Within pkgsrc, you'll find both approaches. If a
                   5640:           directory is shared by a few unrelated packages, it's
                   5641:           often not worth to add an extra package to remove it.
                   5642:           Therefore, one simply does:</p>
                   5643:           <pre class="programlisting">
                   5644:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   5645:     
                   5646: </pre>
                   5647: 
                   5648:           <p>in the PLISTs of all affected packages, instead of the
                   5649:           regular "@dirrm" line.</p>
                   5650: 
                   5651:           <p>However, if the directory is shared across many
                   5652:           packages, two different solutions are available:</p>
                   5653: 
                   5654:           <div class="orderedlist">
                   5655:             <ol type="1">
                   5656:               <li>
                   5657:                 <p>If the packages have a common dependency, the
                   5658:                 directory can be removed in that. For example, see
                   5659:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5660:                 href=
                   5661:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.7       wiz      5662:                 class="pkgname">textproc/scrollkeeper</a>, which
                   5663:                 removes the shared directory <code class=
                   5664:                 "filename">share/omf</code>.</p>
1.1       grant    5665:               </li>
                   5666: 
                   5667:               <li>
                   5668:                 <p>If the packages using the directory are not
                   5669:                 related at all (they have no common dependencies),
                   5670:                 a *-dirs package is used.</p>
                   5671:               </li>
                   5672:             </ol>
                   5673:           </div>
                   5674: 
                   5675:           <p>From now on, we'll discuss the second solution. To get
                   5676:           an idea of the *-dirs packages available, issue:</p>
                   5677:           <pre class="programlisting">
1.7       wiz      5678:       <code class="prompt">%</code> cd .../pkgsrc
                   5679:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    5680:     
                   5681: </pre>
                   5682: 
                   5683:           <p>Their use from other packages is very simple. The
1.7       wiz      5684:           <code class="varname">USE_DIRS</code> variable takes a
                   5685:           list of package names (without the &#8220;<span class=
1.1       grant    5686:           "quote">-dirs</span>&#8221; part) together with the
                   5687:           required version number (always pick the latest one when
                   5688:           writting new packages).</p>
                   5689: 
                   5690:           <p>For example, if a package installs files under
1.7       wiz      5691:           <code class="filename">share/applications</code>, it
                   5692:           should have the following line in it:</p>
1.1       grant    5693:           <pre class="programlisting">
                   5694:       USE_DIRS+= xdg-1.1
                   5695:     
                   5696: </pre>
                   5697: 
1.7       wiz      5698:           <p>After regenerating the PLIST using
                   5699:           <span><strong class="command">make
                   5700:           print-PLIST</strong></span>, you should get the right
                   5701:           (commented out) lines.</p>
1.1       grant    5702: 
1.7       wiz      5703:           <p>Note that, even if your package is using <code class=
                   5704:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    5705:           *-x11-dirs packages. Just specify the name without that
1.7       wiz      5706:           part and pkgsrc (in particular, <code class=
                   5707:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    5708:         </div>
                   5709:       </div>
                   5710: 
                   5711:       <div class="chapter" lang="en" xml:lang="en">
                   5712:         <div class="titlepage">
                   5713:           <div>
                   5714:             <div>
                   5715:               <h2 class="title"><a name="buildlink" id=
                   5716:               "buildlink"></a>Chapter&nbsp;9.&nbsp;Buildlink
                   5717:               methodology</h2>
                   5718:             </div>
                   5719:           </div>
                   5720:         </div>
                   5721: 
                   5722:         <div class="toc">
                   5723:           <p><b>Table of Contents</b></p>
                   5724: 
                   5725:           <dl>
1.11    ! ben      5726:             <dt><span class="sect1"><a href="#id2587003">9.1.
1.1       grant    5727:             Converting packages to use buildlink3</a></span></dt>
                   5728: 
1.11    ! ben      5729:             <dt><span class="sect1"><a href="#id2587194">9.2.
1.7       wiz      5730:             Writing <code class="filename">buildlink3.mk</code>
                   5731:             files</a></span></dt>
1.1       grant    5732: 
                   5733:             <dd>
                   5734:               <dl>
1.11    ! ben      5735:                 <dt><span class="sect2"><a href="#id2587400">9.2.1.
1.1       grant    5736:                 Anatomy of a buildlink3.mk file</a></span></dt>
                   5737: 
1.11    ! ben      5738:                 <dt><span class="sect2"><a href="#id2587977">9.2.2.
1.7       wiz      5739:                 Updating <code class=
                   5740:                 "varname">BUILDLINK_DEPENDS.<em class=
                   5741:                 "replaceable"><code>pkg</code></em></code> in
                   5742:                 <code class="filename">buildlink3.mk</code>
1.1       grant    5743:                 files</a></span></dt>
                   5744:               </dl>
                   5745:             </dd>
                   5746: 
1.11    ! ben      5747:             <dt><span class="sect1"><a href="#id2588056">9.3.
1.7       wiz      5748:             Writing <code class="filename">builtin.mk</code>
                   5749:             files</a></span></dt>
1.1       grant    5750: 
                   5751:             <dd>
                   5752:               <dl>
1.11    ! ben      5753:                 <dt><span class="sect2"><a href="#id2588137">9.3.1.
1.7       wiz      5754:                 Anatomy of a <code class=
                   5755:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    5756: 
1.11    ! ben      5757:                 <dt><span class="sect2"><a href="#id2588296">9.3.2.
1.1       grant    5758:                 Global preferences for native or pkgsrc
                   5759:                 software</a></span></dt>
                   5760:               </dl>
                   5761:             </dd>
                   5762:           </dl>
                   5763:         </div>
                   5764: 
                   5765:         <p>Buildlink is a framework in pkgsrc that controls what
                   5766:         headers and libraries are seen by a package's configure and
                   5767:         build processes. This is implemented in a two step
                   5768:         process:</p>
                   5769: 
                   5770:         <div class="orderedlist">
                   5771:           <ol type="1">
                   5772:             <li>
                   5773:               <p>Symlink headers and libraries for dependencies
1.7       wiz      5774:               into <code class="varname">BUILDLINK_DIR</code>,
                   5775:               which by default is a subdirectory of <code class=
                   5776:               "varname">WRKDIR</code>.</p>
1.1       grant    5777:             </li>
                   5778: 
                   5779:             <li>
                   5780:               <p>Create wrapper scripts that are used in place of
1.7       wiz      5781:               the normal compiler tools that translate <code class=
                   5782:               "option">-I${LOCALBASE}/include</code> and
                   5783:               <code class="option">-L${LOCALBASE}/lib</code> into
                   5784:               references to <code class=
                   5785:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   5786:               also make native compiler on some operating systems
                   5787:               look like GCC, so that packages that expect GCC won't
                   5788:               require modifications to build with those native
                   5789:               compilers.</p>
1.1       grant    5790:             </li>
                   5791:           </ol>
                   5792:         </div>
                   5793: 
                   5794:         <p>This normalizes the environment in which a package is
                   5795:         built so that the package may be built consistently despite
                   5796:         what other software may be installed. Please note that the
1.7       wiz      5797:         normal system header and library paths, e.g. <code class=
                   5798:         "filename">/usr/include</code>, <code class=
                   5799:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    5800:         buildlink3 is designed to insulate the package build from
                   5801:         non-system-supplied software.</p>
                   5802: 
                   5803:         <div class="sect1" lang="en" xml:lang="en">
                   5804:           <div class="titlepage">
                   5805:             <div>
                   5806:               <div>
                   5807:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      5808:                 "id2587003" id="id2587003"></a>9.1.&nbsp;Converting
1.1       grant    5809:                 packages to use buildlink3</h2>
                   5810:               </div>
                   5811:             </div>
                   5812:           </div>
                   5813: 
                   5814:           <p>The process of converting packages to use the
                   5815:           buildlink3 framework (&#8220;<span class=
                   5816:           "quote">bl3ifying</span>&#8221;) is fairly
                   5817:           straightforward. The things to keep in mind are:</p>
                   5818: 
                   5819:           <div class="orderedlist">
                   5820:             <ol type="1">
                   5821:               <li>
1.7       wiz      5822:                 <p>Set <code class="varname">USE_BUILDLINK3</code>
                   5823:                 to &#8220;<span class=
                   5824:                 "quote">yes</span>&#8221;.</p>
1.1       grant    5825:               </li>
                   5826: 
                   5827:               <li>
                   5828:                 <p>Ensure that the build always calls the wrapper
                   5829:                 scripts instead of the actual toolchain. Some
                   5830:                 packages are tricky, and the only way to know for
1.7       wiz      5831:                 sure is the check <code class=
                   5832:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    5833:                 wrappers are being invoked.</p>
                   5834:               </li>
                   5835: 
                   5836:               <li>
1.7       wiz      5837:                 <p>Don't override <code class=
                   5838:                 "varname">PREFIX</code> from within the package
                   5839:                 Makefile, e.g. Java VMs, standalone shells, etc.,
                   5840:                 because the code to symlink files into <code class=
                   5841:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    5842:                 relative to &#8220;<span class="quote">pkg_info -qp
1.7       wiz      5843:                 <em class=
                   5844:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    5845:               </li>
                   5846: 
                   5847:               <li>
                   5848:                 <p>Remember that <span class=
1.7       wiz      5849:                 "emphasis"><em>only</em></span> the <code class=
                   5850:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    5851:                 in a package's Makefile are added as dependencies
                   5852:                 for that package.</p>
                   5853:               </li>
                   5854:             </ol>
                   5855:           </div>
                   5856: 
                   5857:           <p>If a dependency on a particular package is required
                   5858:           for its libraries and headers, then we replace:</p>
                   5859:           <pre class="programlisting">
                   5860: DEPENDS+=       foo&gt;=1.1.0:../../category/foo
                   5861: </pre>
                   5862: 
                   5863:           <p>with</p>
                   5864:           <pre class="programlisting">
                   5865: .include "../../category/foo/buildlink3.mk"
                   5866: </pre>
                   5867: 
1.7       wiz      5868:           <p>There are several <code class=
                   5869:           "filename">buildlink3.mk</code> files in <code class=
                   5870:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    5871:           issues:</p>
                   5872: 
                   5873:           <div class="itemizedlist">
                   5874:             <ul type="disc">
                   5875:               <li>
1.7       wiz      5876:                 <p><code class="filename">bdb.buildlink3.mk</code>
1.1       grant    5877:                 chooses either the native or a pkgsrc Berkeley DB
1.7       wiz      5878:                 implementation based on the values of <code class=
                   5879:                 "varname">BDB_ACCEPTED</code> and <code class=
                   5880:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    5881:               </li>
                   5882: 
                   5883:               <li>
1.7       wiz      5884:                 <p><code class=
                   5885:                 "filename">curses.buildlink3.mk</code> If the
                   5886:                 system comes with neither Curses nor NCurses, this
                   5887:                 will take care to install the <a xmlns=
                   5888:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5889:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.7       wiz      5890:                 class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    5891:               </li>
                   5892: 
                   5893:               <li>
1.7       wiz      5894:                 <p><code class="filename">krb5.buildlink3.mk</code>
                   5895:                 uses the value of <code class=
                   5896:                 "varname">KRB5_ACCEPTED</code> to choose between
1.1       grant    5897:                 adding a dependency on Heimdal or MIT-krb5 for
                   5898:                 packages that require a Kerberos 5
                   5899:                 implementation.</p>
                   5900:               </li>
                   5901: 
                   5902:               <li>
1.7       wiz      5903:                 <p><code class=
                   5904:                 "filename">motif.buildlink3.mk</code> checks for a
                   5905:                 system-provided Motif installation or adds a
                   5906:                 dependency on <a xmlns=
1.1       grant    5907:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5908:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.7       wiz      5909:                 class="pkgname">x11/lesstif</a> or <a xmlns=
                   5910:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5911:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
                   5912:                 class="pkgname">x11/openmotif</a>;</p>
1.1       grant    5913:               </li>
                   5914: 
                   5915:               <li>
1.7       wiz      5916:                 <p><code class=
                   5917:                 "filename">ossaudio.buildlink3.mk</code> defines
                   5918:                 several variables that may be used by packages that
                   5919:                 use the Open Sound System (OSS) API;</p>
1.1       grant    5920:               </li>
                   5921: 
                   5922:               <li>
1.7       wiz      5923:                 <p><code class=
                   5924:                 "filename">pgsql.buildlink3.mk</code> will accept
                   5925:                 either Postgres 7.3 or 7.4, whichever is found
                   5926:                 installed. See the file for more information.</p>
1.1       grant    5927:               </li>
                   5928: 
                   5929:               <li>
1.7       wiz      5930:                 <p><code class=
                   5931:                 "filename">pthread.buildlink3.mk</code> uses the
                   5932:                 value of <code class="varname">PTHREAD_OPTS</code>
                   5933:                 and checks for native pthreads or adds a dependency
                   5934:                 on <a xmlns=
1.1       grant    5935:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5936:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.7       wiz      5937:                 class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    5938:               </li>
                   5939: 
                   5940:               <li>
1.7       wiz      5941:                 <p><code class="filename">xaw.buildlink3.mk</code>
                   5942:                 uses the value of <code class=
                   5943:                 "varname">XAW_TYPE</code> to choose a particular
                   5944:                 Athena widgets library.</p>
1.1       grant    5945:               </li>
                   5946:             </ul>
                   5947:           </div>
                   5948: 
1.7       wiz      5949:           <p>The comments in those <code class=
                   5950:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    5951:           complete description of how to use them properly.</p>
                   5952:         </div>
                   5953: 
                   5954:         <div class="sect1" lang="en" xml:lang="en">
                   5955:           <div class="titlepage">
                   5956:             <div>
                   5957:               <div>
                   5958:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      5959:                 "id2587194" id="id2587194"></a>9.2.&nbsp;Writing
1.7       wiz      5960:                 <code class="filename">buildlink3.mk</code>
                   5961:                 files</h2>
1.1       grant    5962:               </div>
                   5963:             </div>
                   5964:           </div>
                   5965: 
1.7       wiz      5966:           <p>A package's <code class=
                   5967:           "filename">buildlink3.mk</code> file is included by
                   5968:           Makefiles to indicate the need to compile and link
                   5969:           against header files and libraries provided by the
                   5970:           package. A <code class="filename">buildlink3.mk</code>
                   5971:           file should always provide enough information to add the
                   5972:           correct type of dependency relationship and include any
                   5973:           other <code class="filename">buildlink3.mk</code> files
                   5974:           that it needs to find headers and libraries that it needs
                   5975:           in turn.</p>
1.1       grant    5976: 
1.7       wiz      5977:           <p>To generate an initial <code class=
                   5978:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    5979:           Rene Hexel's <a xmlns=
                   5980:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5981:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.7       wiz      5982:           class="pkgname">pkgtools/createbuildlink</a> package is
                   5983:           highly recommended. For most packages, the following
                   5984:           command will generate a good starting point for
                   5985:           <code class="filename">buildlink3.mk</code> files:</p>
1.1       grant    5986:           <pre class="screen">
1.7       wiz      5987: <code class="prompt">%</code> <strong class=
                   5988: "userinput"><code>cd pkgsrc/<em class=
                   5989: "replaceable"><code>category</code></em>/<em class=
                   5990: "replaceable"><code>pkgdir</code></em>
                   5991: <code class=
                   5992: "prompt">%</code> createbuildlink -3 &gt;buildlink3.mk</code></strong>
1.1       grant    5993: </pre>
                   5994: 
                   5995:           <div class="sect2" lang="en" xml:lang="en">
                   5996:             <div class="titlepage">
                   5997:               <div>
                   5998:                 <div>
1.11    ! ben      5999:                   <h3 class="title"><a name="id2587400" id=
        !          6000:                   "id2587400"></a>9.2.1. Anatomy of a buildlink3.mk
1.1       grant    6001:                   file</h3>
                   6002:                 </div>
                   6003:               </div>
                   6004:             </div>
                   6005: 
1.7       wiz      6006:             <p>The following real-life example <code class=
                   6007:             "filename">buildlink3.mk</code> is taken from
                   6008:             <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    6009:             <pre class="programlisting">
1.11    ! ben      6010: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    6011: 
                   6012: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   6013: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   6014: 
                   6015: .if !empty(BUILDLINK_DEPTH:M+)
                   6016: BUILDLINK_DEPENDS+=     tiff
                   6017: .endif
                   6018: 
                   6019: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   6020: BUILDLINK_PACKAGES+=    tiff
                   6021: 
                   6022: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   6023: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   6024: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   6025: .endif  # TIFF_BUILDLINK3_MK
                   6026: 
                   6027: .include "../../devel/zlib/buildlink3.mk"
                   6028: .include "../../graphics/jpeg/buildlink3.mk"
                   6029: 
                   6030: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   6031: </pre>
                   6032: 
1.7       wiz      6033:             <p>The header and footer manipulate <code class=
                   6034:             "varname">BUILDLINK_DEPTH</code>, which is common
                   6035:             across all <code class="filename">buildlink3.mk</code>
                   6036:             files and is used to track at what depth we are
                   6037:             including <code class="filename">buildlink3.mk</code>
                   6038:             files.</p>
1.1       grant    6039: 
                   6040:             <p>The first section controls if the dependency on
1.7       wiz      6041:             <em class="replaceable"><code>pkg</code></em> is added.
                   6042:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    6043:             global list of packages for which dependencies are
                   6044:             added by buildlink3.</p>
                   6045: 
                   6046:             <p>The second section advises pkgsrc that the
1.7       wiz      6047:             <code class="filename">buildlink3.mk</code> file for
                   6048:             <em class="replaceable"><code>pkg</code></em> has been
                   6049:             included at some point. <code class=
                   6050:             "varname">BUILDLINK_PACKAGES</code> is the global list
                   6051:             of packages for which <code class=
                   6052:             "filename">buildlink3.mk</code> files have been
                   6053:             included. It must <span class=
                   6054:             "emphasis"><em>always</em></span> be appended to within
                   6055:             a <code class="filename">buildlink3.mk</code> file.</p>
1.1       grant    6056: 
                   6057:             <p>The third section is protected from multiple
1.7       wiz      6058:             inclusion and controls how the dependency on <em class=
                   6059:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    6060:             important variables are set in the section:</p>
                   6061: 
                   6062:             <div class="itemizedlist">
                   6063:               <ul type="disc">
                   6064:                 <li>
1.7       wiz      6065:                   <p><code class=
                   6066:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6067:                   "replaceable"><code>pkg</code></em></code> is the
                   6068:                   actual dependency recorded in the installed
                   6069:                   package; this should always be set using
                   6070:                   <span><strong class="command">+=</strong></span>
                   6071:                   to ensure that we're appending to any
                   6072:                   pre-existing list of values. This variable should
                   6073:                   be set to the first version of the package that
                   6074:                   had the last change in the major number of a
                   6075:                   shared library or that had a major API
                   6076:                   change.</p>
1.1       grant    6077:                 </li>
                   6078: 
                   6079:                 <li>
1.7       wiz      6080:                   <p><code class=
                   6081:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   6082:                   "replaceable"><code>pkg</code></em></code> is the
                   6083:                   location of the <em class=
                   6084:                   "replaceable"><code>pkg</code></em> pkgsrc
1.1       grant    6085:                   directory;</p>
                   6086:                 </li>
                   6087: 
                   6088:                 <li>
1.7       wiz      6089:                   <p><code class=
                   6090:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6091:                   "replaceable"><code>pkg</code></em></code> (not
                   6092:                   shown above) controls whether we use <code class=
                   6093:                   "varname">BUILD_DEPENDS</code> or <code class=
                   6094:                   "varname">DEPENDS</code> to add the dependency on
                   6095:                   <em class="replaceable"><code>pkg</code></em>.
                   6096:                   The build dependency is selected by setting
                   6097:                   <code class=
                   6098:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6099:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    6100:                   &#8220;<span class="quote">build</span>&#8221;.
                   6101:                   By default, the full dependency is used.</p>
                   6102:                 </li>
                   6103: 
                   6104:                 <li>
1.7       wiz      6105:                   <p><code class=
                   6106:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6107:                   "replaceable"><code>pkg</code></em></code> and
                   6108:                   <code class=
                   6109:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
                   6110:                   <code>pkg</code></em></code> (not shown above)
                   6111:                   are lists of subdirectories of <code class=
                   6112:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6113:                   "replaceable"><code>pkg</code></em>}</code> to
                   6114:                   add to the header and library search paths. These
1.1       grant    6115:                   default to &#8220;<span class=
                   6116:                   "quote">include</span>&#8221; and
                   6117:                   &#8220;<span class="quote">lib</span>&#8221;
                   6118:                   respectively.</p>
                   6119:                 </li>
                   6120: 
                   6121:                 <li>
1.7       wiz      6122:                   <p><code class=
                   6123:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   6124:                   "replaceable"><code>pkg</code></em></code> (not
                   6125:                   shown above) is the list of preprocessor flags to
                   6126:                   add to <code class="varname">CPPFLAGS</code>,
                   6127:                   which are passed on to the configure and build
                   6128:                   phases. The &#8220;<span class=
                   6129:                   "quote">-I</span>&#8221; option should be avoided
                   6130:                   and instead be handled using <code class=
                   6131:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6132:                   "replaceable"><code>pkg</code></em></code> as
                   6133:                   above.</p>
1.1       grant    6134:                 </li>
                   6135:               </ul>
                   6136:             </div>
                   6137: 
                   6138:             <p>The following variables are all optionally defined
                   6139:             within this second section (protected against multiple
                   6140:             inclusion) and control which package files are
1.7       wiz      6141:             symlinked into <code class=
                   6142:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    6143:             are transformed during the symlinking:</p>
                   6144: 
                   6145:             <div class="itemizedlist">
                   6146:               <ul type="disc">
                   6147:                 <li>
1.7       wiz      6148:                   <p><code class=
                   6149:                   "varname">BUILDLINK_FILES.<em class=
                   6150:                   "replaceable"><code>pkg</code></em></code> (not
                   6151:                   shown above) is a shell glob pattern relative to
                   6152:                   <code class=
                   6153:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6154:                   "replaceable"><code>pkg</code></em>}</code> to be
                   6155:                   symlinked into <code class=
                   6156:                   "filename">${BUILDLINK_DIR}</code>, e.g.
                   6157:                   <code class="filename">include/*.h</code>.</p>
1.1       grant    6158:                 </li>
                   6159: 
                   6160:                 <li>
1.7       wiz      6161:                   <p><code class=
                   6162:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   6163:                   "replaceable"><code>pkg</code></em></code> (not
                   6164:                   shown above) is a shell pipeline that outputs to
                   6165:                   stdout a list of files relative to <code class=
                   6166:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6167:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    6168:                   resulting files are to be symlinked into
1.7       wiz      6169:                   <code class="filename">${BUILDLINK_DIR}</code>.
                   6170:                   By default, this takes the <code class=
                   6171:                   "filename">+CONTENTS</code> of a <em class=
                   6172:                   "replaceable"><code>pkg</code></em> and filters
                   6173:                   it through <code class=
                   6174:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   6175:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    6176:                 </li>
                   6177: 
                   6178:                 <li>
1.7       wiz      6179:                   <p><code class=
                   6180:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6181:                   "replaceable"><code>pkg</code></em></code> (not
                   6182:                   shown above) is a filter command that filters
                   6183:                   <code class="filename">+CONTENTS</code> input
                   6184:                   into a list of files relative to <code class=
                   6185:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6186:                   "replaceable"><code>pkg</code></em>}</code> on
                   6187:                   stdout. By default for overwrite packages,
                   6188:                   <code class=
                   6189:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6190:                   "replaceable"><code>pkg</code></em></code>
                   6191:                   outputs the contents of the <code class=
                   6192:                   "filename">include</code> and <code class=
                   6193:                   "filename">lib</code> directories in the package
                   6194:                   <code class="filename">+CONTENTS</code>, and for
                   6195:                   pkgviews packages, it outputs any libtool
                   6196:                   archives in <code class="filename">lib</code>
1.1       grant    6197:                   directories.</p>
                   6198:                 </li>
                   6199: 
                   6200:                 <li>
1.7       wiz      6201:                   <p><code class=
                   6202:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   6203:                   "replaceable"><code>pkg</code></em></code> (not
                   6204:                   shown above) is a list of sed arguments used to
1.1       grant    6205:                   transform the name of the source filename into a
1.7       wiz      6206:                   destination filename, e.g. <span><strong class=
1.1       grant    6207:                   "command">-e
1.7       wiz      6208:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    6209:                 </li>
                   6210:               </ul>
                   6211:             </div>
                   6212: 
1.7       wiz      6213:             <p>The last section includes any <code class=
                   6214:             "filename">buildlink3.mk</code> needed for <em class=
                   6215:             "replaceable"><code>pkg</code></em>'s library
                   6216:             dependencies. Including these <code class=
                   6217:             "filename">buildlink3.mk</code> files means that the
                   6218:             headers and libraries for these dependencies are also
                   6219:             symlinked into <code class=
                   6220:             "filename">${BUILDLINK_DIR}</code> whenever the
                   6221:             <em class="replaceable"><code>pkg</code></em>
                   6222:             <code class="filename">buildlink3.mk</code> file is
                   6223:             included.</p>
1.1       grant    6224:           </div>
                   6225: 
                   6226:           <div class="sect2" lang="en" xml:lang="en">
                   6227:             <div class="titlepage">
                   6228:               <div>
                   6229:                 <div>
1.11    ! ben      6230:                   <h3 class="title"><a name="id2587977" id=
        !          6231:                   "id2587977"></a>9.2.2. Updating <code class=
1.7       wiz      6232:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6233:                   "replaceable"><code>pkg</code></em></code> in
                   6234:                   <code class="filename">buildlink3.mk</code>
                   6235:                   files</h3>
1.1       grant    6236:                 </div>
                   6237:               </div>
                   6238:             </div>
                   6239: 
                   6240:             <p>There are two situations that require increasing the
1.7       wiz      6241:             dependency listed in <code class=
                   6242:             "varname">BUILDLINK_DEPENDS.<em class=
                   6243:             "replaceable"><code>pkg</code></em></code> after a
                   6244:             package update:</p>
1.1       grant    6245: 
                   6246:             <div class="orderedlist">
                   6247:               <ol type="1">
                   6248:                 <li>
                   6249:                   <p>if the sonames (major number of the library
                   6250:                   version) of any installed shared libraries
                   6251:                   change;</p>
                   6252:                 </li>
                   6253: 
                   6254:                 <li>
                   6255:                   <p>if the API or interface to the header files
                   6256:                   change.</p>
                   6257:                 </li>
                   6258:               </ol>
                   6259:             </div>
                   6260: 
1.7       wiz      6261:             <p>In these cases, <code class=
                   6262:             "varname">BUILDLINK_DEPENDS.<em class=
                   6263:             "replaceable"><code>pkg</code></em></code> should be
                   6264:             adjusted to require at least the new package version.
                   6265:             In some cases, the packages that depend on this new
                   6266:             version may need their <code class=
                   6267:             "varname">PKGREVISION</code>s increased and, if they
                   6268:             have <code class="filename">buildlink3.mk</code> files,
                   6269:             their <code class=
                   6270:             "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
                   6271:             pkg</code></em></code> adjusted, too. This is needed so
                   6272:             that binary packages made using it will require the
                   6273:             correct package dependency and not settle for an older
                   6274:             one which will not contain the necessary shared
                   6275:             libraries.</p>
1.1       grant    6276: 
                   6277:             <p>Please take careful consideration before adjusting
1.7       wiz      6278:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   6279:             "replaceable"><code>pkg</code></em></code> as we don't
                   6280:             want to cause unneeded package deletions and rebuilds.
                   6281:             In many cases, new versions of packages work just fine
                   6282:             with older dependencies. See <a href="#dependencies"
                   6283:             title="12.1.3.&nbsp;Handling dependencies">Section
                   6284:             12.1.3, &#8220;Handling dependencies&#8221;</a> and
                   6285:             <a href="#buildlink" title=
1.1       grant    6286:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter 9,
                   6287:             <i>Buildlink methodology</i></a> for more information
                   6288:             about dependencies on other packages, including the
1.7       wiz      6289:             <code class="varname">BUILDLINK_RECOMMENDED</code> and
                   6290:             <code class="varname">RECOMMENDED</code>
                   6291:             definitions.</p>
1.1       grant    6292:           </div>
                   6293:         </div>
                   6294: 
                   6295:         <div class="sect1" lang="en" xml:lang="en">
                   6296:           <div class="titlepage">
                   6297:             <div>
                   6298:               <div>
                   6299:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      6300:                 "id2588056" id="id2588056"></a>9.3.&nbsp;Writing
1.7       wiz      6301:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    6302:               </div>
                   6303:             </div>
                   6304:           </div>
                   6305: 
                   6306:           <p>Some packages in pkgsrc install headers and libraries
                   6307:           that coincide with headers and libraries present in the
1.7       wiz      6308:           base system. Aside from a <code class=
                   6309:           "filename">buildlink3.mk</code> file, these packages
                   6310:           should also include a <code class=
                   6311:           "filename">builtin.mk</code> file that includes the
                   6312:           necessary checks to decide whether using the built-in
                   6313:           software or the pkgsrc software is appropriate.</p>
1.1       grant    6314: 
                   6315:           <p>The only requirements of a builtin.mk file for
1.7       wiz      6316:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    6317: 
                   6318:           <div class="orderedlist">
                   6319:             <ol type="1">
                   6320:               <li>
1.7       wiz      6321:                 <p>It should set <code class=
                   6322:                 "varname">USE_BUILTIN.<em class=
                   6323:                 "replaceable"><code>pkg</code></em></code> to
                   6324:                 either &#8220;<span class="quote">yes</span>&#8221;
                   6325:                 or &#8220;<span class="quote">no</span>&#8221;
                   6326:                 after it is included.</p>
1.1       grant    6327:               </li>
                   6328: 
                   6329:               <li>
                   6330:                 <p>It should <span class=
                   6331:                 "emphasis"><em>not</em></span> override any
1.7       wiz      6332:                 <code class="varname">USE_BUILTIN.<em class=
                   6333:                 "replaceable"><code>pkg</code></em></code> which is
                   6334:                 already set before the <code class=
                   6335:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    6336:               </li>
                   6337: 
                   6338:               <li>
                   6339:                 <p>It should be written to allow multiple
                   6340:                 inclusion. This is <span class=
                   6341:                 "emphasis"><em>very</em></span> important and takes
1.7       wiz      6342:                 careful attention to <code class=
                   6343:                 "filename">Makefile</code> coding.</p>
1.1       grant    6344:               </li>
                   6345:             </ol>
                   6346:           </div>
                   6347: 
                   6348:           <div class="sect2" lang="en" xml:lang="en">
                   6349:             <div class="titlepage">
                   6350:               <div>
                   6351:                 <div>
1.11    ! ben      6352:                   <h3 class="title"><a name="id2588137" id=
        !          6353:                   "id2588137"></a>9.3.1.&nbsp;Anatomy of a
1.7       wiz      6354:                   <code class="filename">builtin.mk</code>
                   6355:                   file</h3>
1.1       grant    6356:                 </div>
                   6357:               </div>
                   6358:             </div>
                   6359: 
                   6360:             <p>The following is the recommended template for
                   6361:             builtin.mk files:</p>
                   6362:             <pre class="programlisting">
                   6363: .if !defined(IS_BUILTIN.foo)
                   6364: #
                   6365: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   6366: # genuinely exists in the system or not.
                   6367: #
                   6368: IS_BUILTIN.foo?=        no
                   6369: 
                   6370: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   6371: # version can be determined.
                   6372: #
                   6373: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   6374: BUILTIN_PKG.foo?=       foo-1.0
                   6375: .  endif
                   6376: .endif  # IS_BUILTIN.foo
                   6377: 
                   6378: .if !defined(USE_BUILTIN.foo)
                   6379: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   6380: .  if defined(BUILTIN_PKG.foo)
                   6381: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   6382: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   6383: USE_BUILTIN.foo!=                                                       \
                   6384:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   6385:               ${ECHO} "yes";                                            \
                   6386:       else                                                              \
                   6387:               ${ECHO} "no";                                             \
                   6388:       fi
                   6389: .      endif
                   6390: .    endfor
                   6391: .  endif
                   6392: .endif  # USE_BUILTIN.foo
                   6393: 
                   6394: CHECK_BUILTIN.foo?=     no
                   6395: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   6396: #
                   6397: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   6398: # "yes" or "no".
                   6399: #
                   6400: .endif  # CHECK_BUILTIN.foo
                   6401:       
                   6402: </pre>
                   6403: 
1.7       wiz      6404:             <p>The first section sets <code class=
                   6405:             "varname">IS_BUILTIN.<em class=
                   6406:             "replaceable"><code>pkg</code></em></code> depending on
                   6407:             if <em class="replaceable"><code>pkg</code></em> really
                   6408:             exists in the base system. This should not be a base
                   6409:             system software with similar functionality to
                   6410:             <em class="replaceable"><code>pkg</code></em>; it
                   6411:             should only be &#8220;<span class=
                   6412:             "quote">yes</span>&#8221; if the actual package is
                   6413:             included as part of the base system. This variable is
                   6414:             only used internally within the <code class=
                   6415:             "filename">builtin.mk</code> file.</p>
                   6416: 
                   6417:             <p>The second section sets <code class=
                   6418:             "varname">BUILTIN_PKG.<em class=
                   6419:             "replaceable"><code>pkg</code></em></code> to the
                   6420:             version of <em class=
                   6421:             "replaceable"><code>pkg</code></em> in the base system
                   6422:             if it exists (if <code class=
                   6423:             "varname">IS_BUILTIN.<em class=
                   6424:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6425:             &#8220;<span class="quote">yes</span>&#8221;). This
1.7       wiz      6426:             variable is only used internally within the
                   6427:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    6428: 
1.7       wiz      6429:             <p>The third section sets <code class=
                   6430:             "varname">USE_BUILTIN.<em class=
                   6431:             "replaceable"><code>pkg</code></em></code> and is
                   6432:             <span class="emphasis"><em>required</em></span> in all
                   6433:             <code class="filename">builtin.mk</code> files. The
                   6434:             code in this section must make the determination
                   6435:             whether the built-in software is adequate to satisfy
                   6436:             the dependencies listed in <code class=
                   6437:             "varname">BUILDLINK_DEPENDS.<em class=
                   6438:             "replaceable"><code>pkg</code></em></code>. This is
                   6439:             typically done by comparing <code class=
                   6440:             "varname">BUILTIN_PKG.<em class=
                   6441:             "replaceable"><code>pkg</code></em></code> against each
                   6442:             of the dependencies in <code class=
                   6443:             "varname">BUILDLINK_DEPENDS.<em class=
                   6444:             "replaceable"><code>pkg</code></em></code>.
                   6445:             <code class="varname">USE_BUILTIN.<em class=
                   6446:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    6447:             "emphasis"><em>must</em></span> be set to the correct
1.7       wiz      6448:             value by the end of the <code class=
                   6449:             "filename">builtin.mk</code> file. Note that
                   6450:             <code class="varname">USE_BUILTIN.<em class=
                   6451:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    6452:             &#8220;<span class="quote">yes</span>&#8221; even if
1.7       wiz      6453:             <code class="varname">IS_BUILTIN.<em class=
                   6454:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6455:             &#8220;<span class="quote">no</span>&#8221; because we
                   6456:             may make the determination that the built-in version of
                   6457:             the software is similar enough to be used as a
                   6458:             replacement.</p>
                   6459: 
1.7       wiz      6460:             <p>The last section is guarded by <code class=
                   6461:             "varname">CHECK_BUILTIN.<em class=
                   6462:             "replaceable"><code>pkg</code></em></code>, and
                   6463:             includes code that uses the value of <code class=
                   6464:             "varname">USE_BUILTIN.<em class=
                   6465:             "replaceable"><code>pkg</code></em></code> set in the
                   6466:             previous section. This typically includes, e.g., adding
1.1       grant    6467:             additional dependency restrictions and listing
1.7       wiz      6468:             additional files to symlink into <code class=
                   6469:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   6470:             "varname">BUILDLINK_FILES.<em class=
                   6471:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    6472:           </div>
                   6473: 
                   6474:           <div class="sect2" lang="en" xml:lang="en">
                   6475:             <div class="titlepage">
                   6476:               <div>
                   6477:                 <div>
1.11    ! ben      6478:                   <h3 class="title"><a name="id2588296" id=
        !          6479:                   "id2588296"></a>9.3.2.&nbsp;Global preferences
1.1       grant    6480:                   for native or pkgsrc software</h3>
                   6481:                 </div>
                   6482:               </div>
                   6483:             </div>
                   6484: 
                   6485:             <p>When building packages, it's possible to choose
                   6486:             whether to set a global preference for using either the
                   6487:             built-in (native) version or the pkgsrc version of
                   6488:             software to satisfy a dependency. This is controlled by
1.7       wiz      6489:             setting <code class="varname">PREFER_PKGSRC</code> and
                   6490:             <code class="varname">PREFER_NATIVE</code>. These
                   6491:             variables take values of either &#8220;<span class=
1.1       grant    6492:             "quote">yes</span>&#8221;, &#8220;<span class=
                   6493:             "quote">no</span>&#8221;, or a list of packages.
1.7       wiz      6494:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   6495:             to use the pkgsrc versions of software, while
                   6496:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   6497:             to use the built-in versions. Preferences are
                   6498:             determined by the most specific instance of the package
                   6499:             in either <code class="varname">PREFER_PKGSRC</code> or
                   6500:             <code class="varname">PREFER_NATIVE</code>. If a
                   6501:             package is specified in neither or in both variables,
                   6502:             then <code class="varname">PREFER_PKGSRC</code> has
                   6503:             precedence over <code class=
                   6504:             "varname">PREFER_NATIVE</code>. For example, to require
                   6505:             using pkgsrc versions of software for all but the most
                   6506:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    6507:             <pre class="programlisting">
                   6508:         PREFER_PKGSRC=  yes
                   6509:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   6510:       
                   6511: </pre>
                   6512: 
                   6513:             <p>A package <span class=
1.7       wiz      6514:             "emphasis"><em>must</em></span> have a <code class=
                   6515:             "filename">builtin.mk</code> file to be listed in
                   6516:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   6517:             it is simply ignored in that list.</p>
1.1       grant    6518:           </div>
                   6519:         </div>
                   6520:       </div>
                   6521: 
                   6522:       <div class="chapter" lang="en" xml:lang="en">
                   6523:         <div class="titlepage">
                   6524:           <div>
                   6525:             <div>
                   6526:               <h2 class="title"><a name="options" id=
                   6527:               "options"></a>Chapter&nbsp;10.&nbsp;Options
                   6528:               handling</h2>
                   6529:             </div>
                   6530:           </div>
                   6531:         </div>
                   6532: 
                   6533:         <div class="toc">
                   6534:           <p><b>Table of Contents</b></p>
                   6535: 
                   6536:           <dl>
1.11    ! ben      6537:             <dt><span class="sect1"><a href="#id2588437">10.1.
1.1       grant    6538:             Global default options</a></span></dt>
                   6539: 
1.11    ! ben      6540:             <dt><span class="sect1"><a href="#id2588452">10.2.
1.7       wiz      6541:             Converting packages to use <code class=
                   6542:             "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    6543:           </dl>
                   6544:         </div>
                   6545: 
                   6546:         <p>Many packages have the ability to be built to support
1.7       wiz      6547:         different sets of features. <code class=
                   6548:         "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1       grant    6549:         that provides generic handling of those options that
                   6550:         determine different ways in which the packages can be
                   6551:         built. It's possible for the user to specify exactly which
                   6552:         sets of options will be built into a package or to allow a
                   6553:         set of global default options apply.</p>
                   6554: 
                   6555:         <div class="sect1" lang="en" xml:lang="en">
                   6556:           <div class="titlepage">
                   6557:             <div>
                   6558:               <div>
                   6559:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      6560:                 "id2588437" id="id2588437"></a>10.1.&nbsp;Global
1.1       grant    6561:                 default options</h2>
                   6562:               </div>
                   6563:             </div>
                   6564:           </div>
                   6565: 
1.7       wiz      6566:           <p>Global default options are listed in <code class=
                   6567:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1       grant    6568:           the options that should be built into every package if
                   6569:           that option is supported. This variable should be set in
1.7       wiz      6570:           <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    6571:         </div>
                   6572: 
                   6573:         <div class="sect1" lang="en" xml:lang="en">
                   6574:           <div class="titlepage">
                   6575:             <div>
                   6576:               <div>
                   6577:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      6578:                 "id2588452" id=
        !          6579:                 "id2588452"></a>10.2.&nbsp;Converting packages to
1.7       wiz      6580:                 use <code class=
                   6581:                 "filename">bsd.options.mk</code></h2>
1.1       grant    6582:               </div>
                   6583:             </div>
                   6584:           </div>
                   6585: 
1.7       wiz      6586:           <p>The following example shows how <code class=
                   6587:           "filename">bsd.options.mk</code> should be use in a
                   6588:           package <code class="filename">Makefile</code>, or in a
                   6589:           file, e.g. <code class="filename">options.mk</code>, that
                   6590:           is included by the main package <code class=
                   6591:           "filename">Makefile</code>.</p>
1.1       grant    6592:           <pre class="programlisting">
                   6593: # Global and legacy options
                   6594: .if defined(WIBBLE_USE_OPENLDAP) &amp;&amp; !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
                   6595: PKG_DEFAULT_OPTIONS+=   ldap
                   6596: .endif
                   6597: .if defined(USE_SASL2) &amp;&amp; !empty(USE_SASL2:M[yY][eE][sS])
                   6598: PKG_DEFAULT_OPTIONS+=   sasl
                   6599: .endif
                   6600: 
                   6601: PKG_OPTIONS_VAR=        PKG_OPTIONS.wibble
                   6602: PKG_SUPPORTED_OPTIONS=  ldap sasl
                   6603: #
                   6604: # Default options for "wibble" package.
                   6605: #
                   6606: .if !defined(PKG_OPTIONS.wibble)
                   6607: PKG_DEFAULT_OPTIONS+=   sasl
                   6608: endif
                   6609: .include "../../mk/bsd.options.mk"
                   6610: 
                   6611: # Package-specific option-handling
                   6612: 
                   6613: ###
                   6614: ### LDAP support
                   6615: ###
                   6616: .if !empty(PKG_OPTIONS:Mldap)
                   6617: .  include "../../databases/openldap/buildlink3.mk"
                   6618: CONFIGURE_ARGS+=      --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   6619: .endif
                   6620: 
                   6621: ###
                   6622: ### SASL authentication
                   6623: ###
                   6624: .if !empty(PKG_OPTIONS:Msasl)
                   6625: .  include "../../security/cyrus-sasl2/buildlink3.mk"
                   6626: CONFIGURE_ARGS+=        --enable-sasl=${BUILDLINK_PREFIX.sasl}
                   6627: .endif
                   6628:       
                   6629: </pre>
                   6630: 
                   6631:           <p>The first section only exists if you are converting a
                   6632:           package that had its own ad-hoc options handling to use
1.7       wiz      6633:           <code class="filename">bsd.options.mk</code>. It converts
1.1       grant    6634:           global or legacy options variables into an equivalent
1.7       wiz      6635:           <code class="varname">PKG_OPTIONS.<em class=
                   6636:           "replaceable"><code>pkg</code></em></code> value. These
                   6637:           sections will be removed over time as the old options are
                   6638:           in turn deprecated and removed.</p>
1.1       grant    6639: 
                   6640:           <p>The second section contains the information about
                   6641:           which build options are supported by the package, and any
                   6642:           default options settings if needed.</p>
                   6643: 
                   6644:           <div class="orderedlist">
                   6645:             <ol type="1">
                   6646:               <li>
1.7       wiz      6647:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
                   6648:                 a list of the name of the <a href=
1.1       grant    6649:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6650:                 <span class="citerefentry"><span class=
                   6651:                 "refentrytitle">make</span>(1)</span></a> variables
                   6652:                 that contain the options the user wishes to select.
                   6653:                 The recommended value is &#8220;<span class=
1.7       wiz      6654:                 "quote">PKG_OPTIONS.<em class=
                   6655:                 "replaceable"><code>pkg</code></em></span>&#8221;
                   6656:                 but any package-specific value may be used. This
1.1       grant    6657:                 variable should be set in a package Makefile.</p>
                   6658:               </li>
                   6659: 
                   6660:               <li>
1.7       wiz      6661:                 <p><code class=
                   6662:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
                   6663:                 build options supported by the package. This
                   6664:                 variable should be set in a package Makefile.</p>
1.1       grant    6665:               </li>
                   6666: 
                   6667:               <li>
1.7       wiz      6668:                 <p><code class="varname">${PKG_OPTIONS_VAR}</code>
                   6669:                 (the variables named in <code class=
                   6670:                 "varname">PKG_OPTIONS_VAR</code>) are variables
                   6671:                 that list the selected build options and override
                   6672:                 any default options given in <code class=
                   6673:                 "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1       grant    6674:                 options begin with a &#8220;<span class=
                   6675:                 "quote">-</span>&#8221;, then that option is always
                   6676:                 removed from the selected build options, e.g.</p>
                   6677:                 <pre class="programlisting">
                   6678:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   6679:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6680:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
                   6681:         # implies PKG_OPTIONS == "kerberos ldap"
                   6682:           
                   6683: </pre>
                   6684: 
                   6685:                 <p>or</p>
                   6686:                 <pre class="programlisting">
                   6687:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6688:         WIBBLE_OPTIONS=         kerberos -ldap ldap
                   6689:         # implies PKG_OPTIONS == "kerberos"
                   6690:           
                   6691: </pre>
                   6692: 
1.7       wiz      6693:                 <p>This variable should be set in <code class=
                   6694:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    6695:               </li>
                   6696:             </ol>
                   6697:           </div>
                   6698: 
                   6699:           <p>After the inclusion of bsd.options.mk, the following
                   6700:           variables are set:</p>
                   6701: 
                   6702:           <div class="itemizedlist">
                   6703:             <ul type="disc">
                   6704:               <li>
1.7       wiz      6705:                 <p><code class="varname">PKG_OPTIONS</code>
                   6706:                 contains the list of the selected build options,
                   6707:                 properly filtered to remove unsupported and
                   6708:                 duplicate options.</p>
1.1       grant    6709:               </li>
                   6710:             </ul>
                   6711:           </div>
                   6712: 
                   6713:           <p>The remaining sections contain the logic that is
                   6714:           specific to each option. There should be a check for
1.7       wiz      6715:           every option listed in <code class=
                   6716:           "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
                   6717:           be clear documentation on what turning on the option will
                   6718:           do in the comments preceding each section. The correct
                   6719:           way to check for an option is to check whether it is
                   6720:           listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1       grant    6721:         </div>
                   6722:       </div>
                   6723: 
                   6724:       <div class="chapter" lang="en" xml:lang="en">
                   6725:         <div class="titlepage">
                   6726:           <div>
                   6727:             <div>
                   6728:               <h2 class="title"><a name="build" id=
                   6729:               "build"></a>Chapter&nbsp;11.&nbsp;The build
                   6730:               process</h2>
                   6731:             </div>
                   6732:           </div>
                   6733:         </div>
                   6734: 
                   6735:         <div class="toc">
                   6736:           <p><b>Table of Contents</b></p>
                   6737: 
                   6738:           <dl>
                   6739:             <dt><span class="sect1"><a href="#build.prefix">11.1.
                   6740:             Program location</a></span></dt>
                   6741: 
1.11    ! ben      6742:             <dt><span class="sect1"><a href="#id2589128">11.2. Main
1.1       grant    6743:             targets</a></span></dt>
                   6744: 
                   6745:             <dt><span class="sect1"><a href=
                   6746:             "#build.helpful-targets">11.3. Other helpful
                   6747:             targets</a></span></dt>
                   6748:           </dl>
                   6749:         </div>
                   6750: 
                   6751:         <p>The basic steps for building a program are always the
                   6752:         same. First the program's source (<span class=
                   6753:         "emphasis"><em>distfile</em></span>) must be brought to the
                   6754:         local system and then extracted. After any patches to
                   6755:         compile properly on NetBSD are applied, the software can be
                   6756:         configured, then built (usually by compiling), and finally
                   6757:         the generated binaries, etc. can be put into place on the
                   6758:         system. These are exactly the steps performed by the NetBSD
                   6759:         package system, which is implemented as a series of targets
1.7       wiz      6760:         in a central Makefile, <code class=
                   6761:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    6762: 
                   6763:         <div class="sect1" lang="en" xml:lang="en">
                   6764:           <div class="titlepage">
                   6765:             <div>
                   6766:               <div>
                   6767:                 <h2 class="title" style="clear: both"><a name=
                   6768:                 "build.prefix" id=
                   6769:                 "build.prefix"></a>11.1.&nbsp;Program location</h2>
                   6770:               </div>
                   6771:             </div>
                   6772:           </div>
                   6773: 
                   6774:           <p>Before outlining the process performed by the NetBSD
                   6775:           package system in the next section, here's a brief
                   6776:           discussion on where programs are installed, and which
                   6777:           variables influence this.</p>
                   6778: 
1.7       wiz      6779:           <p>The automatic variable <code class=
                   6780:           "varname">PREFIX</code> indicates where all files of the
                   6781:           final program shall be installed. It is usually set to
                   6782:           <code class="varname">LOCALBASE</code> (<code class=
                   6783:           "filename">/usr/pkg</code>), or <code class=
                   6784:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    6785:           &#8220;<span class="quote">cross</span>&#8221; category.
1.7       wiz      6786:           The value of <code class="varname">PREFIX</code> needs to
                   6787:           be put into the various places in the program's source
                   6788:           where paths to these files are encoded. See <a href=
1.1       grant    6789:           "#components.patches" title=
                   6790:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   6791:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   6792:           title=
                   6793:           "12.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;12.3.1,
                   6794:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   6795:           details.</p>
                   6796: 
                   6797:           <p>When choosing which of these variables to use, follow
                   6798:           the following rules:</p>
                   6799: 
                   6800:           <div class="itemizedlist">
                   6801:             <ul type="disc">
                   6802:               <li>
1.7       wiz      6803:                 <p><code class="varname">PREFIX</code> always
                   6804:                 points to the location where the current pkg will
                   6805:                 be installed. When referring to a pkg's own
1.1       grant    6806:                 installation path, use &#8220;<span class=
                   6807:                 "quote">${PREFIX}</span>&#8221;.</p>
                   6808:               </li>
                   6809: 
                   6810:               <li>
1.7       wiz      6811:                 <p><code class="varname">LOCALBASE</code> is where
                   6812:                 all non-X11 pkgs are installed. If you need to
1.1       grant    6813:                 construct a -I or -L argument to the compiler to
                   6814:                 find includes and libraries installed by another
                   6815:                 non-X11 pkg, use &#8220;<span class=
                   6816:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   6817:               </li>
                   6818: 
                   6819:               <li>
1.7       wiz      6820:                 <p><code class="varname">X11BASE</code> is where
                   6821:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    6822:                 installed. When looking for <span class=
                   6823:                 "emphasis"><em>standard</em></span> X11 includes
                   6824:                 (not those installed by a pkg), use
                   6825:                 &#8220;<span class=
                   6826:                 "quote">${X11BASE}</span>&#8221;.</p>
                   6827:               </li>
                   6828: 
                   6829:               <li>
                   6830:                 <p>X11 based are special in that they may be
1.7       wiz      6831:                 installed in either <code class=
                   6832:                 "varname">X11BASE</code> or <code class=
                   6833:                 "varname">LOCALBASE</code>.</p>
1.1       grant    6834: 
                   6835:                 <p>Usually, X11 packages should be installed under
1.7       wiz      6836:                 <code class="varname">LOCALBASE</code> whenever
                   6837:                 possible. Note that you will need to set
                   6838:                 <code class="varname">USE_X11</code> in them to
                   6839:                 request the presence of X11 and to get the right
                   6840:                 compilation flags.</p>
1.1       grant    6841: 
                   6842:                 <p>Even though, there are some packages that cannot
1.7       wiz      6843:                 be installed under <code class=
                   6844:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    6845:                 app-defaults files. These packages are special and
1.7       wiz      6846:                 they must be placed under <code class=
                   6847:                 "varname">X11BASE</code>. To accomplish this, set
                   6848:                 either <code class="varname">USE_X11BASE</code> or
                   6849:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    6850:                 package.</p>
                   6851: 
1.7       wiz      6852:                 <p>Some notes: <code class="varname">USE_X11</code>
                   6853:                 and <code class="varname">USE_X11BASE</code> are
                   6854:                 mutually exclusive. If you need to find includes or
                   6855:                 libraries installed by a pkg that has <code class=
                   6856:                 "varname">USE_IMAKE</code> or <code class=
                   6857:                 "varname">USE_X11BASE</code> in its pkg
                   6858:                 <code class="filename">Makefile</code>, you need to
                   6859:                 use <span class="emphasis"><em>both</em></span>
                   6860:                 <code class="filename">${X11BASE}</code> and
                   6861:                 <code class="filename">${LOCALBASE}</code>. To
                   6862:                 force installation of all X11 packages in
                   6863:                 <code class="varname">LOCALBASE</code>, the
                   6864:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6865:                 href=
1.1       grant    6866:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.7       wiz      6867:                 class="pkgname">pkgtools/xpkgwedge</a> is enabled
                   6868:                 by default.</p>
1.1       grant    6869:               </li>
                   6870: 
                   6871:               <li>
1.7       wiz      6872:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    6873:                 used to refer to the installed location of an X11
1.7       wiz      6874:                 package. <code class="varname">X11PREFIX</code>
                   6875:                 will be set to <code class="varname">X11BASE</code>
                   6876:                 if xpkgwedge is not installed, and to <code class=
                   6877:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    6878:                 installed.</p>
                   6879:               </li>
                   6880: 
                   6881:               <li>
                   6882:                 <p>If xpkgwedge is installed, it is possible to
1.7       wiz      6883:                 have some packages installed in <code class=
                   6884:                 "varname">X11BASE</code> and some in <code class=
                   6885:                 "varname">LOCALBASE</code>. To determine the prefix
                   6886:                 of an installed package, the <code class=
                   6887:                 "varname">EVAL_PREFIX</code> definition can be
                   6888:                 used. It takes pairs in the format
                   6889:                 &#8220;<span class=
1.1       grant    6890:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.7       wiz      6891:                 the make(1) variable <code class=
                   6892:                 "varname">DIRNAME</code> will be set to the prefix
                   6893:                 of the installed package &lt;package&gt;, or
1.1       grant    6894:                 &#8220;<span class=
                   6895:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   6896:                 is not installed.</p>
                   6897: 
                   6898:                 <p>This is best illustrated by example.</p>
                   6899: 
1.7       wiz      6900:                 <p>The following lines are taken from <code class=
                   6901:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    6902:                 <pre class="programlisting">
1.7       wiz      6903: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    6904: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   6905:                         --with-gtk-prefix="${GTKDIR}"           \
                   6906:                         --enable-multibyte
                   6907: </pre>
                   6908: 
                   6909:                 <p>Specific defaults can be defined for the
1.7       wiz      6910:                 packages evaluated using <code class=
                   6911:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    6912:                 of the form:</p>
                   6913:                 <pre class="programlisting">
                   6914: GTKDIR_DEFAULT= ${LOCALBASE}
                   6915: </pre>
                   6916: 
1.7       wiz      6917:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    6918:                 corresponds to the first definition in the
1.7       wiz      6919:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    6920:               </li>
                   6921: 
                   6922:               <li>
1.7       wiz      6923:                 <p>Within <code class="filename">${PREFIX}</code>,
1.1       grant    6924:                 packages should install files according to hier(7),
                   6925:                 with the exception that manual pages go into
1.7       wiz      6926:                 <code class="filename">${PREFIX}/man</code>, not
                   6927:                 <code class=
                   6928:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    6929:               </li>
                   6930:             </ul>
                   6931:           </div>
                   6932:         </div>
                   6933: 
                   6934:         <div class="sect1" lang="en" xml:lang="en">
                   6935:           <div class="titlepage">
                   6936:             <div>
                   6937:               <div>
                   6938:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      6939:                 "id2589128" id="id2589128"></a>11.2.&nbsp;Main
1.1       grant    6940:                 targets</h2>
                   6941:               </div>
                   6942:             </div>
                   6943:           </div>
                   6944: 
                   6945:           <p>The main targets used during the build process defined
1.7       wiz      6946:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    6947: 
                   6948:           <div class="variablelist">
                   6949:             <dl>
                   6950:               <dt><span class="term">fetch</span></dt>
                   6951: 
                   6952:               <dd>
                   6953:                 <p>This will check if the file(s) given in the
1.7       wiz      6954:                 variables <code class="varname">DISTFILES</code>
                   6955:                 and <code class="varname">PATCHFILES</code> (as
                   6956:                 defined in the package's Makefile) are present on
                   6957:                 the local system in <code class=
                   6958:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   6959:                 are not present, an attempt will be made to fetch
                   6960:                 them using commands of the form:</p>
1.1       grant    6961:                 <pre class="programlisting">
                   6962: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   6963: </pre>
                   6964: 
                   6965:                 <p>where ${site} varies through several
1.7       wiz      6966:                 possibilities in turn: first, <code class=
                   6967:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   6968:                 then the sites specified in either <code class=
                   6969:                 "varname">SITES_file</code> if defined, else
                   6970:                 <code class="varname">MASTER_SITES</code> or
                   6971:                 <code class="varname">PATCH_SITES</code>, as
                   6972:                 applies, then finally the value of <code class=
                   6973:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   6974:                 all except the first can be optionally sorted by
                   6975:                 the user, via setting either <code class=
                   6976:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   6977:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    6978:               </dd>
                   6979: 
                   6980:               <dt><span class="term">checksum</span></dt>
                   6981: 
                   6982:               <dd>
                   6983:                 <p>After the distfile(s) are fetched, their
                   6984:                 checksum is generated and compared with the
                   6985:                 checksums stored in the distinfo file. If the
                   6986:                 checksums don't match, the build is aborted. This
                   6987:                 is to ensure the same distfile is used for
                   6988:                 building, and that the distfile wasn't changed,
                   6989:                 e.g. by some malign force, deliberately changed
                   6990:                 distfiles on the master distribution site or
                   6991:                 network lossage.</p>
                   6992:               </dd>
                   6993: 
                   6994:               <dt><span class="term">extract</span></dt>
                   6995: 
                   6996:               <dd>
                   6997:                 <p>When the distfiles are present on the local
                   6998:                 system, they need to be extracted, as they are
                   6999:                 usually in the form of some compressed archive
1.7       wiz      7000:                 format, most commonly <code class=
                   7001:                 "filename">.tar.gz</code>.</p>
1.1       grant    7002: 
                   7003:                 <p>If only some of the distfiles need to be
                   7004:                 uncompressed, the files to be uncompressed should
1.7       wiz      7005:                 be put into <code class=
                   7006:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    7007: 
1.7       wiz      7008:                 <p>If the distfiles are not in <code class=
                   7009:                 "filename">.tar.gz</code> format, they can be
                   7010:                 extracted by setting either <code class=
                   7011:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   7012:                 "varname">EXTRACT_CMD</code>, <code class=
                   7013:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   7014:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   7015:                 the former case, pkgsrc knows how to extract a
                   7016:                 number of suffixes (<code class=
                   7017:                 "filename">.tar.gz</code>, <code class=
                   7018:                 "filename">.tgz</code>, <code class=
                   7019:                 "filename">.tar.gz2</code>, <code class=
                   7020:                 "filename">.tbz</code>, <code class=
                   7021:                 "filename">.tar.Z</code>, <code class=
                   7022:                 "filename">.tar</code>, <code class=
                   7023:                 "filename">.shar.gz</code>, <code class=
                   7024:                 "filename">.shar.bz2</code>, <code class=
                   7025:                 "filename">.shar.Z</code>, <code class=
                   7026:                 "filename">.shar</code>, <code class=
                   7027:                 "filename">.Z</code>, <code class=
                   7028:                 "filename">.bz2</code> and <code class=
                   7029:                 "filename">.gz</code>; see the definition of the
                   7030:                 various <code class="varname">DECOMPRESS_CMD</code>
                   7031:                 variables <code class="filename">bsd.pkg.mk</code>
                   7032:                 for a complete list). Here's an example on how to
                   7033:                 use the other variables for a program that comes
                   7034:                 with a compressed shell archive whose name ends in
                   7035:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    7036:                 <pre class="programlisting">
                   7037:      EXTRACT_SUFX=   .msg.gz
                   7038:      EXTRACT_CMD=            zcat
                   7039:      EXTRACT_BEFORE_ARGS=
                   7040:      EXTRACT_AFTER_ARGS=     |sh
                   7041: </pre>
                   7042:               </dd>
                   7043: 
                   7044:               <dt><span class="term">patch</span></dt>
                   7045: 
                   7046:               <dd>
                   7047:                 <p>After extraction, all the patches named by the
1.7       wiz      7048:                 <code class="varname">PATCHFILES</code>, those
                   7049:                 present in the patches subdirectory of the package
                   7050:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
                   7051:                 <code class=
                   7052:                 "filename">/usr/local/patches/graphics/png</code>)
                   7053:                 are applied. Patchfiles ending in <code class=
                   7054:                 "filename">.Z</code> or <code class=
                   7055:                 "filename">.gz</code> are uncompressed before they
                   7056:                 are applied, files ending in <code class=
                   7057:                 "filename">.orig</code> or <code class=
                   7058:                 "filename">.rej</code> are ignored. Any special
                   7059:                 options to patch(1) can be handed in <code class=
                   7060:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   7061:                 "#components.patches" title=
1.1       grant    7062:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   7063:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   7064: 
                   7065:                 <p>By default patch(1) is given special args to
                   7066:                 make it fail if the patches apply with some lines
                   7067:                 of fuzz. Please fix (regen) the patches so that
                   7068:                 they apply cleanly. The rationale behind this is
                   7069:                 that patches that don't apply cleanly may end up
                   7070:                 being applied in the wrong place, and cause severe
                   7071:                 harm there.</p>
                   7072:               </dd>
                   7073: 
                   7074:               <dt><span class="term">configure</span></dt>
                   7075: 
                   7076:               <dd>
                   7077:                 <p>Most pieces of software need information on the
                   7078:                 header files, system calls, and library routines
                   7079:                 which are available in NetBSD. This is the process
                   7080:                 known as configuration, and is usually automated.
                   7081:                 In most cases, a script is supplied with the
                   7082:                 source, and its invocation results in generation of
                   7083:                 header files, Makefiles, etc.</p>
                   7084: 
                   7085:                 <p>If the program's distfile contains its own
                   7086:                 configure script, this can be invoked by setting
1.7       wiz      7087:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    7088:                 configure script is a GNU autoconf script,
1.7       wiz      7089:                 <code class="varname">GNU_CONFIGURE</code> should
                   7090:                 be specified instead. In either case, any arguments
                   7091:                 to the configure script can be specified in the
                   7092:                 <code class="varname">CONFIGURE_ARGS</code>
                   7093:                 variable, and the configure script's name can be
                   7094:                 set in <code class=
                   7095:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   7096:                 from the default &#8220;<span class=
1.1       grant    7097:                 "quote">configure</span>&#8221;. Here's an example
                   7098:                 from the <a xmlns=
                   7099:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7100:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.7       wiz      7101:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    7102:                 <pre class="programlisting">
                   7103: HAS_CONFIGURE=          yes
                   7104: CONFIGURE_SCRIPT=       Configure
                   7105: CONFIGURE_ARGS+=        netbsd13
                   7106: </pre>
                   7107: 
                   7108:                 <p>If the program uses an Imakefile for
                   7109:                 configuration, the appropriate steps can be invoked
1.7       wiz      7110:                 by setting <code class="varname">USE_IMAKE</code>
                   7111:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   7112:                 (If you only want the package installed in
                   7113:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   7114:                 not being run, set <code class=
                   7115:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    7116:               </dd>
                   7117: 
                   7118:               <dt><span class="term">build</span></dt>
                   7119: 
                   7120:               <dd>
                   7121:                 <p>Once configuration has taken place, the software
1.7       wiz      7122:                 will be built by invoking <code class=
                   7123:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   7124:                 "varname">$MAKEFILE</code> with <code class=
1.10      wiz      7125:                 "varname">$BUILD_TARGET</code> as the target to
1.7       wiz      7126:                 build. The default <code class=
                   7127:                 "varname">MAKE_PROGRAM</code> is
                   7128:                 &#8220;<span class="quote">gmake</span>&#8221; if
                   7129:                 <code class="varname">USE_GNU_TOOLS</code> contains
                   7130:                 &#8220;<span class="quote">make</span>&#8221;,
1.1       grant    7131:                 &#8220;<span class="quote">make</span>&#8221;
1.7       wiz      7132:                 otherwise. <code class="varname">MAKEFILE</code> is
                   7133:                 set to &#8220;<span class=
1.1       grant    7134:                 "quote">Makefile</span>&#8221; by default, and
1.11    ! ben      7135:                 <code class="varname">BUILD_TARGET</code> defaults
        !          7136:                 to &#8220;<span class="quote">all</span>&#8221;.
        !          7137:                 Any of these variables can be set in the package's
1.1       grant    7138:                 Makefile to change the default build process.</p>
                   7139:               </dd>
                   7140: 
                   7141:               <dt><span class="term">install</span></dt>
                   7142: 
                   7143:               <dd>
                   7144:                 <p>Once the build stage has completed, the final
                   7145:                 step is to install the software in public
                   7146:                 directories, so users can access the programs and
1.7       wiz      7147:                 files. As in the build-target, <code class=
                   7148:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   7149:                 <code class="varname">$MAKEFILE</code> here, but
                   7150:                 with the <code class=
                   7151:                 "varname">$INSTALL_TARGET</code> instead, the
                   7152:                 latter defaulting to &#8220;<span class=
                   7153:                 "quote">install</span>&#8221; (plus
                   7154:                 &#8220;<span class=
                   7155:                 "quote">install.man</span>&#8221;, if <code class=
                   7156:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    7157:               </dd>
                   7158:             </dl>
                   7159:           </div>
                   7160: 
                   7161:           <p>If no target is specified, the default is
                   7162:           &#8220;<span class="quote">build</span>&#8221;. If a
                   7163:           subsequent stage is requested, all prior stages are made:
1.7       wiz      7164:           e.g. <span><strong class="command">make
                   7165:           build</strong></span> will also perform the equivalent
                   7166:           of:</p>
1.1       grant    7167:           <pre class="programlisting">
                   7168: make fetch
                   7169: make checksum
                   7170: make extract
                   7171: make patch
                   7172: make configure
                   7173: make build
                   7174: </pre>
                   7175:         </div>
                   7176: 
                   7177:         <div class="sect1" lang="en" xml:lang="en">
                   7178:           <div class="titlepage">
                   7179:             <div>
                   7180:               <div>
                   7181:                 <h2 class="title" style="clear: both"><a name=
                   7182:                 "build.helpful-targets" id=
                   7183:                 "build.helpful-targets"></a>11.3.&nbsp;Other
                   7184:                 helpful targets</h2>
                   7185:               </div>
                   7186:             </div>
                   7187:           </div>
                   7188: 
                   7189:           <div class="variablelist">
                   7190:             <dl>
                   7191:               <dt><span class="term">pre/post-*</span></dt>
                   7192: 
                   7193:               <dd>
                   7194:                 <p>For any of the main targets described in the
                   7195:                 previous section, two auxiliary targets exist with
                   7196:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   7197:                 &#8220;<span class="quote">post-</span>&#8221; used
                   7198:                 as a prefix for the main target's name. These
                   7199:                 targets are invoked before and after the main
                   7200:                 target is called, allowing extra configuration or
                   7201:                 installation steps be performed from a package's
                   7202:                 Makefile, for example, which a program's configure
                   7203:                 script or install target omitted.</p>
                   7204:               </dd>
                   7205: 
                   7206:               <dt><span class="term">do-*</span></dt>
                   7207: 
                   7208:               <dd>
                   7209:                 <p>Should one of the main targets do the wrong
                   7210:                 thing, and should there be no variable to fix this,
                   7211:                 you can redefine it with the do-* target. (Note
                   7212:                 that redefining the target itself instead of the
                   7213:                 do-* target is a bad idea, as the pre-* and post-*
                   7214:                 targets won't be called anymore, etc.) You will not
                   7215:                 usually need to do this.</p>
                   7216:               </dd>
                   7217: 
                   7218:               <dt><span class="term">reinstall</span></dt>
                   7219: 
                   7220:               <dd>
1.7       wiz      7221:                 <p>If you did a <span><strong class="command">make
                   7222:                 install</strong></span> and you noticed some file
                   7223:                 was not installed properly, you can repeat the
1.1       grant    7224:                 installation with this target, which will ignore
                   7225:                 the &#8220;<span class="quote">already
                   7226:                 installed</span>&#8221; flag.</p>
                   7227:               </dd>
                   7228: 
                   7229:               <dt><span class="term">deinstall</span></dt>
                   7230: 
                   7231:               <dd>
                   7232:                 <p>This target does a pkg_delete(1) in the current
                   7233:                 directory, effectively de-installing the package.
                   7234:                 The following variables can be used to tune the
                   7235:                 behaviour:</p>
                   7236: 
                   7237:                 <div class="variablelist">
                   7238:                   <dl>
1.7       wiz      7239:                     <dt><span class="term"><code class=
                   7240:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    7241: 
                   7242:                     <dd>
                   7243:                       <p>Add a "-v" to the <a href=
                   7244:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7245:                       <span class="citerefentry"><span class=
                   7246:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7247:                       command.</p>
                   7248:                     </dd>
                   7249: 
1.7       wiz      7250:                     <dt><span class="term"><code class=
                   7251:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    7252: 
                   7253:                     <dd>
                   7254:                       <p>Remove all packages that require (depend
                   7255:                       on) the given package. This can be used to
                   7256:                       remove any packages that may have been pulled
                   7257:                       in by a given package, e.g. if
1.7       wiz      7258:                       <span><strong class="command">make deinstall
                   7259:                       DEINSTALLDEPENDS=1</strong></span> is done in
                   7260:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    7261:                       this is likely to remove whole KDE. Works by
                   7262:                       adding &#8220;<span class=
                   7263:                       "quote">-R</span>&#8221; to the <a href=
                   7264:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7265:                       <span class="citerefentry"><span class=
                   7266:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7267:                       command line.</p>
                   7268:                     </dd>
                   7269:                   </dl>
                   7270:                 </div>
                   7271:               </dd>
                   7272: 
                   7273:               <dt><span class="term">update</span></dt>
                   7274: 
                   7275:               <dd>
                   7276:                 <p>This target causes the current package to be
                   7277:                 updated to the latest version. The package and all
                   7278:                 depending packages first get de-installed, then
                   7279:                 current versions of the corresponding packages get
                   7280:                 compiled and installed. This is similar to manually
                   7281:                 noting which packages are currently installed, then
1.7       wiz      7282:                 performing a series of <span><strong class=
                   7283:                 "command">make deinstall</strong></span> and
                   7284:                 <span><strong class="command">make
                   7285:                 install</strong></span> (or whatever <code class=
                   7286:                 "varname">UPDATE_TARGET</code> is set to) for these
                   7287:                 packages.</p>
1.1       grant    7288: 
                   7289:                 <p>You can use the &#8220;<span class=
                   7290:                 "quote">update</span>&#8221; target to resume
1.7       wiz      7291:                 package updating in case a previous
                   7292:                 <span><strong class="command">make
                   7293:                 update</strong></span> was interrupted for some
                   7294:                 reason. However, in this case, make sure you don't
                   7295:                 call <span><strong class="command">make
                   7296:                 clean</strong></span> or otherwise remove the list
                   7297:                 of dependent packages in <code class=
                   7298:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    7299:                 ability to automatically update the current package
                   7300:                 along with the dependent packages you have
                   7301:                 installed.</p>
                   7302: 
1.7       wiz      7303:                 <p>Resuming an interrupted <span><strong class=
                   7304:                 "command">make update</strong></span> will only
                   7305:                 work as long as the package tree remains unchanged.
                   7306:                 If the source code for one of the packages to be
                   7307:                 updated has been changed, resuming
                   7308:                 <span><strong class="command">make
                   7309:                 update</strong></span> will most certainly
                   7310:                 fail!</p>
1.1       grant    7311: 
                   7312:                 <p>The following variables can be used either on
1.7       wiz      7313:                 the command line or in <code class=
                   7314:                 "filename">/etc/mk.conf</code> to alter the
                   7315:                 behaviour of <span><strong class="command">make
                   7316:                 update</strong></span>:</p>
1.1       grant    7317: 
                   7318:                 <div class="variablelist">
                   7319:                   <dl>
1.7       wiz      7320:                     <dt><span class="term"><code class=
                   7321:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    7322: 
                   7323:                     <dd>
                   7324:                       <p>Install target to recursively use for the
                   7325:                       updated package and the dependent packages.
1.7       wiz      7326:                       Defaults to <code class=
                   7327:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    7328:                       &#8220;<span class=
                   7329:                       "quote">install</span>&#8221; otherwise for
1.7       wiz      7330:                       <span><strong class="command">make
                   7331:                       update</strong></span>. e.g.
                   7332:                       <span><strong class="command">make update
                   7333:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    7334:                     </dd>
                   7335: 
1.7       wiz      7336:                     <dt><span class="term"><code class=
                   7337:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    7338: 
                   7339:                     <dd>
                   7340:                       <p>Don't clean up after updating. Useful if
                   7341:                       you want to leave the work sources of the
                   7342:                       updated packages around for inspection or
                   7343:                       other purposes. Be sure you eventually clean
                   7344:                       up the source tree (see the
                   7345:                       &#8220;<span class=
                   7346:                       "quote">clean-update</span>&#8221; target
                   7347:                       below) or you may run into troubles with old
                   7348:                       source code still lying around on your next
1.7       wiz      7349:                       <span><strong class=
                   7350:                       "command">make</strong></span> or
                   7351:                       <span><strong class="command">make
                   7352:                       update</strong></span>.</p>
1.1       grant    7353:                     </dd>
                   7354: 
1.7       wiz      7355:                     <dt><span class="term"><code class=
                   7356:                     "varname">REINSTALL</code></span></dt>
1.1       grant    7357: 
                   7358:                     <dd>
                   7359:                       <p>Deinstall each package before installing
1.7       wiz      7360:                       (making <code class=
                   7361:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    7362:                       necessary if the &#8220;<span class=
                   7363:                       "quote">clean-update</span>&#8221; target
                   7364:                       (see below) was called after interrupting a
1.7       wiz      7365:                       running <span><strong class="command">make
                   7366:                       update</strong></span>.</p>
1.1       grant    7367:                     </dd>
                   7368: 
1.7       wiz      7369:                     <dt><span class="term"><code class=
                   7370:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    7371: 
                   7372:                     <dd>
                   7373:                       <p>Allows you to disable recursion and
                   7374:                       hardcode the target for packages. The default
                   7375:                       is &#8220;<span class=
                   7376:                       "quote">update</span>&#8221; for the update
                   7377:                       target, facilitating a recursive update of
1.7       wiz      7378:                       prerequisite packages. Only set <code class=
                   7379:                       "varname">DEPENDS_TARGET</code> if you want
                   7380:                       to disable recursive updates. Use
                   7381:                       <code class="varname">UPDATE_TARGET</code>
                   7382:                       instead to just set a specific target for
                   7383:                       each package to be installed during
                   7384:                       <span><strong class="command">make
                   7385:                       update</strong></span> (see above).</p>
1.1       grant    7386:                     </dd>
                   7387:                   </dl>
                   7388:                 </div>
                   7389:               </dd>
                   7390: 
                   7391:               <dt><span class="term">clean-update</span></dt>
                   7392: 
                   7393:               <dd>
                   7394:                 <p>Clean the source tree for all packages that
1.7       wiz      7395:                 would get updated if <span><strong class=
                   7396:                 "command">make update</strong></span> was called
                   7397:                 from the current directory. This target should not
                   7398:                 be used if the current package (or any of its
                   7399:                 depending packages) have already been de-installed
                   7400:                 (e.g., after calling <span><strong class=
                   7401:                 "command">make update</strong></span>) or you may
                   7402:                 lose some packages you intended to update. As a
                   7403:                 rule of thumb: only use this target <span class=
                   7404:                 "emphasis"><em>before</em></span> the first time
                   7405:                 you run <span><strong class="command">make
                   7406:                 update</strong></span> and only if you have a dirty
                   7407:                 package tree (e.g., if you used <code class=
                   7408:                 "varname">NOCLEAN</code>).</p>
1.1       grant    7409: 
                   7410:                 <p>If you unsure about whether your tree is clean
1.7       wiz      7411:                 you can either perform a <span><strong class=
                   7412:                 "command">make clean</strong></span> at the top of
                   7413:                 the tree, or use the following sequence of commands
1.1       grant    7414:                 from the directory of the package you want to
                   7415:                 update (<span class=
                   7416:                 "emphasis"><em>before</em></span> running
1.7       wiz      7417:                 <span><strong class="command">make
                   7418:                 update</strong></span> for the first time,
                   7419:                 otherwise you lose all the packages you wanted to
                   7420:                 update!):</p>
1.1       grant    7421:                 <pre class="screen">
1.7       wiz      7422: <code class="prompt">#</code> <strong class=
                   7423: "userinput"><code>make clean-update</code></strong>
                   7424: <code class="prompt">#</code> <strong class=
                   7425: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   7426: <code class="prompt">#</code> <strong class=
                   7427: "userinput"><code>make update</code></strong>
1.1       grant    7428: </pre>
                   7429: 
                   7430:                 <p>The following variables can be used either on
1.7       wiz      7431:                 the command line or in <code class=
                   7432:                 "filename">/etc/mk.conf</code> to alter the
                   7433:                 behaviour of <span><strong class="command">make
                   7434:                 clean-update</strong></span>:</p>
1.1       grant    7435: 
                   7436:                 <div class="variablelist">
                   7437:                   <dl>
1.7       wiz      7438:                     <dt><span class="term"><code class=
                   7439:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    7440: 
                   7441:                     <dd>
1.7       wiz      7442:                       <p>After <span><strong class="command">make
                   7443:                       clean</strong></span>, do not reconstruct the
                   7444:                       list of directories to update for this
                   7445:                       package. Only use this if
                   7446:                       <span><strong class="command">make
                   7447:                       update</strong></span> successfully installed
                   7448:                       all packages you wanted to update. Normally,
                   7449:                       this is done automatically on
                   7450:                       <span><strong class="command">make
                   7451:                       update</strong></span>, but may have been
                   7452:                       suppressed by the <code class=
                   7453:                       "varname">NOCLEAN</code> variable (see
1.1       grant    7454:                       above).</p>
                   7455:                     </dd>
                   7456:                   </dl>
                   7457:                 </div>
                   7458:               </dd>
                   7459: 
                   7460:               <dt><span class="term">info</span></dt>
                   7461: 
                   7462:               <dd>
                   7463:                 <p>This target invokes <a href=
                   7464:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   7465:                 <span class="citerefentry"><span class=
                   7466:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   7467:                 the current package. You can use this to check
                   7468:                 which version of a package is installed.</p>
                   7469:               </dd>
                   7470: 
                   7471:               <dt><span class="term">readme</span></dt>
                   7472: 
                   7473:               <dd>
1.7       wiz      7474:                 <p>This target generates a <code class=
                   7475:                 "filename">README.html</code> file, which can be
1.1       grant    7476:                 viewed using a browser such as <a xmlns=
                   7477:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7478:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.7       wiz      7479:                 class="pkgname">www/mozilla</a> or <a xmlns=
                   7480:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7481:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
                   7482:                 class="pkgname">www/links</a>. The generated files
                   7483:                 contain references to any packages which are in the
                   7484:                 <code class="varname">PACKAGES</code> directory on
                   7485:                 the local host. The generated files can be made to
                   7486:                 refer to URLs based on <code class=
                   7487:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   7488:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
                   7489:                 wanted to generate <code class=
                   7490:                 "filename">README.html</code> files which pointed
                   7491:                 to binary packages on the local machine, in the
                   7492:                 directory <code class=
                   7493:                 "filename">/usr/packages</code>, set <code class=
                   7494:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   7495:                 and <code class=
                   7496:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   7497:                 <code class="varname">${PACKAGES}</code> directory
                   7498:                 and its subdirectories will be searched for all the
                   7499:                 binary packages.</p>
1.1       grant    7500:               </dd>
                   7501: 
                   7502:               <dt><span class="term">readme-all</span></dt>
                   7503: 
                   7504:               <dd>
1.7       wiz      7505:                 <p>Use this target to create a file <code class=
                   7506:                 "filename">README-all.html</code> which contains a
1.1       grant    7507:                 list of all packages currently available in the
                   7508:                 NetBSD Packages Collection, together with the
                   7509:                 category they belong to and a short description.
1.7       wiz      7510:                 This file is compiled from the <code class=
                   7511:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    7512:                 sure to run this <span class=
1.7       wiz      7513:                 "emphasis"><em>after</em></span> a
                   7514:                 <span><strong class="command">make
                   7515:                 readme</strong></span>.</p>
1.1       grant    7516:               </dd>
                   7517: 
                   7518:               <dt><span class="term">cdrom-readme</span></dt>
                   7519: 
                   7520:               <dd>
                   7521:                 <p>This is very much the same as the
                   7522:                 &#8220;<span class="quote">readme</span>&#8221;
                   7523:                 target (see above), but is to be used when
                   7524:                 generating a pkgsrc tree to be written to a CD-ROM.
1.7       wiz      7525:                 This target also produces <code class=
                   7526:                 "filename">README.html</code> files, and can be
                   7527:                 made to refer to URLs based on <code class=
                   7528:                 "varname">CDROM_PKG_URL_HOST</code> and
                   7529:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    7530:               </dd>
                   7531: 
                   7532:               <dt><span class="term">show-distfiles</span></dt>
                   7533: 
                   7534:               <dd>
                   7535:                 <p>This target shows which distfiles and patchfiles
1.7       wiz      7536:                 are needed to build the package. (<code class=
                   7537:                 "varname">DISTFILES</code> and <code class=
                   7538:                 "varname">PATCHFILES</code>, but not <code class=
                   7539:                 "filename">patches/*</code>)</p>
1.1       grant    7540:               </dd>
                   7541: 
                   7542:               <dt><span class="term">show-downlevel</span></dt>
                   7543: 
                   7544:               <dd>
                   7545:                 <p>This target shows nothing if the package is not
                   7546:                 installed. If a version of this package is
                   7547:                 installed, but is not the version provided in this
                   7548:                 version of pkgsrc, then a warning message is
                   7549:                 displayed. This target can be used to show which of
                   7550:                 your installed packages are downlevel, and so the
                   7551:                 old versions can be deleted, and the current ones
                   7552:                 added.</p>
                   7553:               </dd>
                   7554: 
                   7555:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   7556: 
                   7557:               <dd>
                   7558:                 <p>This target shows the directory in the pkgsrc
                   7559:                 hierarchy from which the package can be built and
                   7560:                 installed. This may not be the same directory as
                   7561:                 the one from which the package was installed. This
                   7562:                 target is intended to be used by people who may
                   7563:                 wish to upgrade many packages on a single host, and
                   7564:                 can be invoked from the top-level pkgsrc Makefile
                   7565:                 by using the &#8220;<span class=
                   7566:                 "quote">show-host-specific-pkgs</span>&#8221;
                   7567:                 target.</p>
                   7568:               </dd>
                   7569: 
                   7570:               <dt><span class=
                   7571:               "term">show-installed-depends</span></dt>
                   7572: 
                   7573:               <dd>
                   7574:                 <p>This target shows which installed packages match
1.7       wiz      7575:                 the current package's <code class=
                   7576:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    7577:                 dependencies are causing build problems.</p>
                   7578:               </dd>
                   7579: 
                   7580:               <dt><span class="term">check-shlibs</span></dt>
                   7581: 
                   7582:               <dd>
                   7583:                 <p>After a package is installed, check all its
                   7584:                 binaries and (on ELF platforms) shared libraries to
                   7585:                 see if they find the shared libs they need. Run by
1.7       wiz      7586:                 default if <code class=
                   7587:                 "varname">PKG_DEVELOPER</code> is set in
                   7588:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    7589:               </dd>
                   7590: 
                   7591:               <dt><span class="term">print-PLIST</span></dt>
                   7592: 
                   7593:               <dd>
                   7594:                 <p>After a &#8220;<span class="quote">make
                   7595:                 install</span>&#8221; from a new or upgraded pkg,
                   7596:                 this prints out an attempt to generate a new
1.7       wiz      7597:                 <code class="filename">PLIST</code> from a
                   7598:                 <span><strong class="command">find -newer
                   7599:                 work/.extract_done</strong></span>. An attempt is
                   7600:                 made to care for shared libs etc., but it is
1.1       grant    7601:                 <span class="emphasis"><em>strongly</em></span>
                   7602:                 recommended to review the result before putting it
1.7       wiz      7603:                 into <code class="filename">PLIST</code>. On
                   7604:                 upgrades, it's useful to diff the output of this
                   7605:                 command against an already existing <code class=
                   7606:                 "filename">PLIST</code> file.</p>
1.1       grant    7607: 
                   7608:                 <p>If the package installs files via tar(1) or
                   7609:                 other methods that don't update file access times,
                   7610:                 be sure to add these files manually to your
1.7       wiz      7611:                 <code class="filename">PLIST</code>, as the
1.1       grant    7612:                 &#8220;<span class="quote">find
                   7613:                 -newer</span>&#8221; command used by this target
                   7614:                 won't catch them!</p>
                   7615: 
                   7616:                 <p>See <a href="#print-PLIST" title=
                   7617:                 "8.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;8.3,
1.7       wiz      7618:                 &#8220;Tweaking output of <span><strong class=
                   7619:                 "command">make
                   7620:                 print-PLIST</strong></span>&#8221;</a> for more
                   7621:                 information on this target.</p>
1.1       grant    7622:               </dd>
                   7623: 
                   7624:               <dt><span class="term">bulk-package</span></dt>
                   7625: 
                   7626:               <dd>
                   7627:                 <p>Used to do bulk builds. If an appropriate binary
                   7628:                 package already exists, no action is taken. If not,
                   7629:                 this target will compile, install and package it
1.7       wiz      7630:                 (and it's depends, if <code class=
                   7631:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    7632:                 <a href="#binary.configuration" title=
                   7633:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   7634:                 &#8220;Configuration&#8221;</a>. After creating the
                   7635:                 binary package, the sources, the just-installed
                   7636:                 package and it's required packages are removed,
                   7637:                 preserving free disk space.</p>
                   7638: 
                   7639:                 <p><span class="emphasis"><em>Beware that this
                   7640:                 target may deinstall all packages installed on a
                   7641:                 system!</em></span></p>
                   7642:               </dd>
                   7643: 
                   7644:               <dt><span class="term">bulk-install</span></dt>
                   7645: 
                   7646:               <dd>
                   7647:                 <p>Used during bulk-installs to install required
                   7648:                 packages. If an upto-date binary package is
                   7649:                 available, it will be installed via <a href=
                   7650:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7651:                 <span class="citerefentry"><span class=
                   7652:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.7       wiz      7653:                 not, <span><strong class="command">make
                   7654:                 bulk-package</strong></span> will be executed, but
                   7655:                 the installed binary not be removed.</p>
1.1       grant    7656: 
                   7657:                 <p>A binary package is considered
                   7658:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   7659:                 to be installed via <a href=
                   7660:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7661:                 <span class="citerefentry"><span class=
                   7662:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   7663:                 if:</p>
                   7664: 
                   7665:                 <div class="itemizedlist">
                   7666:                   <ul type="disc">
                   7667:                     <li>
1.7       wiz      7668:                       <p>None of the package's files (<code class=
                   7669:                       "filename">Makefile</code>, ...) were
                   7670:                       modified since it was built.</p>
1.1       grant    7671:                     </li>
                   7672: 
                   7673:                     <li>
                   7674:                       <p>None of the package's required (binary)
                   7675:                       packages were modified since it was
                   7676:                       built.</p>
                   7677:                     </li>
                   7678:                   </ul>
                   7679:                 </div>
                   7680: 
                   7681:                 <p><span class="emphasis"><em>Beware that this
                   7682:                 target may deinstall all packages installed on a
                   7683:                 system!</em></span></p>
                   7684:               </dd>
                   7685:             </dl>
                   7686:           </div>
                   7687:         </div>
                   7688:       </div>
                   7689: 
                   7690:       <div class="chapter" lang="en" xml:lang="en">
                   7691:         <div class="titlepage">
                   7692:           <div>
                   7693:             <div>
                   7694:               <h2 class="title"><a name="fixes" id=
                   7695:               "fixes"></a>Chapter&nbsp;12.&nbsp;Notes on fixes for
                   7696:               packages</h2>
                   7697:             </div>
                   7698:           </div>
                   7699:         </div>
                   7700: 
                   7701:         <div class="toc">
                   7702:           <p><b>Table of Contents</b></p>
                   7703: 
                   7704:           <dl>
1.11    ! ben      7705:             <dt><span class="sect1"><a href="#id2590529">12.1.
1.1       grant    7706:             General operation</a></span></dt>
                   7707: 
                   7708:             <dd>
                   7709:               <dl>
                   7710:                 <dt><span class="sect2"><a href=
1.11    ! ben      7711:                 "#id2590532">12.1.1. How to pull in variables from
1.1       grant    7712:                 /etc/mk.conf</a></span></dt>
                   7713: 
                   7714:                 <dt><span class="sect2"><a href=
1.11    ! ben      7715:                 "#id2590615">12.1.2. Restricted
1.1       grant    7716:                 packages</a></span></dt>
                   7717: 
                   7718:                 <dt><span class="sect2"><a href=
                   7719:                 "#dependencies">12.1.3. Handling
                   7720:                 dependencies</a></span></dt>
                   7721: 
                   7722:                 <dt><span class="sect2"><a href=
1.11    ! ben      7723:                 "#id2591198">12.1.4. Handling conflicts with other
1.1       grant    7724:                 packages</a></span></dt>
                   7725: 
                   7726:                 <dt><span class="sect2"><a href=
1.11    ! ben      7727:                 "#id2591249">12.1.5. Packages that cannot or should
1.1       grant    7728:                 not be built</a></span></dt>
                   7729: 
                   7730:                 <dt><span class="sect2"><a href=
1.11    ! ben      7731:                 "#id2591342">12.1.6. Packages which should not be
1.1       grant    7732:                 deleted, once installed</a></span></dt>
                   7733: 
                   7734:                 <dt><span class="sect2"><a href=
                   7735:                 "#security-handling">12.1.7. Handling packages with
                   7736:                 security problems</a></span></dt>
                   7737: 
                   7738:                 <dt><span class="sect2"><a href=
1.11    ! ben      7739:                 "#id2591434">12.1.8. How to handle compiler
1.1       grant    7740:                 bugs</a></span></dt>
                   7741: 
                   7742:                 <dt><span class="sect2"><a href=
1.11    ! ben      7743:                 "#id2591457">12.1.9. How to handle incrementing
1.1       grant    7744:                 versions when fixing an existing
                   7745:                 package</a></span></dt>
                   7746: 
                   7747:                 <dt><span class="sect2"><a href=
1.11    ! ben      7748:                 "#id2591574">12.1.10. Portability of
1.1       grant    7749:                 packages</a></span></dt>
                   7750:               </dl>
                   7751:             </dd>
                   7752: 
1.11    ! ben      7753:             <dt><span class="sect1"><a href="#id2591598">12.2.
1.1       grant    7754:             Possible downloading issues</a></span></dt>
                   7755: 
                   7756:             <dd>
                   7757:               <dl>
                   7758:                 <dt><span class="sect2"><a href=
1.11    ! ben      7759:                 "#id2591602">12.2.1. Packages whose distfiles
1.1       grant    7760:                 aren't available for plain
                   7761:                 downloading</a></span></dt>
                   7762: 
                   7763:                 <dt><span class="sect2"><a href=
1.11    ! ben      7764:                 "#id2591665">12.2.2. How to handle modified
1.1       grant    7765:                 distfiles with the 'old' name</a></span></dt>
                   7766:               </dl>
                   7767:             </dd>
                   7768: 
1.11    ! ben      7769:             <dt><span class="sect1"><a href="#id2591676">12.3.
1.1       grant    7770:             Configuration gotchas</a></span></dt>
                   7771: 
                   7772:             <dd>
                   7773:               <dl>
                   7774:                 <dt><span class="sect2"><a href=
                   7775:                 "#fixes.libtool">12.3.1. Shared libraries -
                   7776:                 libtool</a></span></dt>
                   7777: 
                   7778:                 <dt><span class="sect2"><a href=
1.11    ! ben      7779:                 "#id2592016">12.3.2. Using libtool on GNU packages
1.1       grant    7780:                 that already support libtool</a></span></dt>
                   7781: 
                   7782:                 <dt><span class="sect2"><a href=
1.11    ! ben      7783:                 "#id2592168">12.3.3. GNU
1.1       grant    7784:                 Autoconf/Automake</a></span></dt>
                   7785:               </dl>
                   7786:             </dd>
                   7787: 
1.11    ! ben      7788:             <dt><span class="sect1"><a href="#id2592213">12.4.
1.1       grant    7789:             Building considerations</a></span></dt>
                   7790: 
                   7791:             <dd>
                   7792:               <dl>
                   7793:                 <dt><span class="sect2"><a href=
1.11    ! ben      7794:                 "#id2592216">12.4.1. CPP defines</a></span></dt>
1.1       grant    7795:               </dl>
                   7796:             </dd>
                   7797: 
1.11    ! ben      7798:             <dt><span class="sect1"><a href="#id2592314">12.5.
1.1       grant    7799:             Package specific actions</a></span></dt>
                   7800: 
                   7801:             <dd>
                   7802:               <dl>
                   7803:                 <dt><span class="sect2"><a href=
1.11    ! ben      7804:                 "#id2592317">12.5.1. Package configuration
1.1       grant    7805:                 files</a></span></dt>
                   7806: 
                   7807:                 <dt><span class="sect2"><a href=
1.11    ! ben      7808:                 "#id2592420">12.5.2. User
1.2       hubertf  7809:                 interaction</a></span></dt>
1.1       grant    7810: 
                   7811:                 <dt><span class="sect2"><a href=
1.11    ! ben      7812:                 "#id2592465">12.5.3. Handling
1.1       grant    7813:                 licenses</a></span></dt>
                   7814: 
                   7815:                 <dt><span class="sect2"><a href=
1.11    ! ben      7816:                 "#id2592616">12.5.4. Creating an account from a
1.1       grant    7817:                 package</a></span></dt>
                   7818: 
                   7819:                 <dt><span class="sect2"><a href=
1.11    ! ben      7820:                 "#id2592678">12.5.5. Installing score
1.1       grant    7821:                 files</a></span></dt>
                   7822: 
                   7823:                 <dt><span class="sect2"><a href=
1.11    ! ben      7824:                 "#id2592858">12.5.6. Packages providing login
1.1       grant    7825:                 shells</a></span></dt>
                   7826: 
                   7827:                 <dt><span class="sect2"><a href=
1.11    ! ben      7828:                 "#id2592984">12.5.7. Packages containing perl
1.1       grant    7829:                 scripts</a></span></dt>
                   7830: 
                   7831:                 <dt><span class="sect2"><a href=
1.11    ! ben      7832:                 "#id2593002">12.5.8. Packages with hardcoded paths
1.1       grant    7833:                 to other interpreters</a></span></dt>
                   7834: 
                   7835:                 <dt><span class="sect2"><a href=
1.11    ! ben      7836:                 "#id2593024">12.5.9. Packages installing perl
1.1       grant    7837:                 modules</a></span></dt>
                   7838: 
                   7839:                 <dt><span class="sect2"><a href=
                   7840:                 "#faq.info-files">12.5.10. Packages installing info
                   7841:                 files</a></span></dt>
                   7842: 
                   7843:                 <dt><span class="sect2"><a href=
1.11    ! ben      7844:                 "#id2593380">12.5.11. Packages installing GConf2
1.1       grant    7845:                 data files</a></span></dt>
                   7846: 
                   7847:                 <dt><span class="sect2"><a href=
1.11    ! ben      7848:                 "#id2593480">12.5.12. Packages installing
1.1       grant    7849:                 scrollkeeper data files</a></span></dt>
                   7850: 
                   7851:                 <dt><span class="sect2"><a href=
1.11    ! ben      7852:                 "#id2593531">12.5.13. Packages installing X11
1.1       grant    7853:                 fonts</a></span></dt>
                   7854: 
                   7855:                 <dt><span class="sect2"><a href=
1.11    ! ben      7856:                 "#id2593578">12.5.14. Packages installing GTK2
1.1       grant    7857:                 modules</a></span></dt>
                   7858: 
                   7859:                 <dt><span class="sect2"><a href=
1.11    ! ben      7860:                 "#id2593648">12.5.15. Packages installing SGML or
1.1       grant    7861:                 XML data</a></span></dt>
                   7862: 
                   7863:                 <dt><span class="sect2"><a href=
1.11    ! ben      7864:                 "#id2593700">12.5.16. Packages installing
1.1       grant    7865:                 extensions to the MIME database</a></span></dt>
                   7866: 
                   7867:                 <dt><span class="sect2"><a href=
1.11    ! ben      7868:                 "#id2593770">12.5.17. Packages using
1.1       grant    7869:                 intltool</a></span></dt>
                   7870:               </dl>
                   7871:             </dd>
                   7872: 
1.11    ! ben      7873:             <dt><span class="sect1"><a href="#id2593784">12.6.
1.1       grant    7874:             Feedback to the author</a></span></dt>
                   7875:           </dl>
                   7876:         </div>
                   7877: 
                   7878:         <div class="sect1" lang="en" xml:lang="en">
                   7879:           <div class="titlepage">
                   7880:             <div>
                   7881:               <div>
                   7882:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      7883:                 "id2590529" id="id2590529"></a>12.1.&nbsp;General
1.1       grant    7884:                 operation</h2>
                   7885:               </div>
                   7886:             </div>
                   7887:           </div>
                   7888: 
                   7889:           <div class="sect2" lang="en" xml:lang="en">
                   7890:             <div class="titlepage">
                   7891:               <div>
                   7892:                 <div>
1.11    ! ben      7893:                   <h3 class="title"><a name="id2590532" id=
        !          7894:                   "id2590532"></a>12.1.1.&nbsp;How to pull in
1.1       grant    7895:                   variables from /etc/mk.conf</h3>
                   7896:                 </div>
                   7897:               </div>
                   7898:             </div>
                   7899: 
                   7900:             <p>The problem with package-defined variables that can
1.7       wiz      7901:             be overridden via <code class="varname">MAKECONF</code>
                   7902:             or <code class="filename">/etc/mk.conf</code> is that
                   7903:             <a href=
1.1       grant    7904:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7905:             <span class="citerefentry"><span class=
                   7906:             "refentrytitle">make</span>(1)</span></a> expands a
                   7907:             variable as it is used, but evaluates preprocessor like
                   7908:             statements (.if, .ifdef and .ifndef) as they are read.
1.7       wiz      7909:             So, to use any variable (which may be set in
                   7910:             <code class="filename">/etc/mk.conf</code>) in one of
                   7911:             the .if* statements, the file <code class=
                   7912:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    7913:             that .if* statement.</p>
                   7914: 
                   7915:             <p>Rather than have a number of ad-hoc ways of
1.7       wiz      7916:             including <code class="filename">/etc/mk.conf</code>,
                   7917:             should it exist, or <code class=
                   7918:             "varname">MAKECONF</code>, should it exist, include the
                   7919:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
                   7920:             file in the package Makefile before any
                   7921:             preprocessor-like .if, .ifdef, or .ifndef
                   7922:             statements:</p>
1.1       grant    7923:             <pre class="programlisting">
                   7924: .include "../../mk/bsd.prefs.mk"
                   7925:     
                   7926:     .if defined(USE_MENUS)
                   7927:       ...
                   7928:     .endif
                   7929: </pre>
                   7930: 
1.7       wiz      7931:             <p>If you wish to set the <code class=
                   7932:             "varname">CFLAGS</code> variable in <code class=
                   7933:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    7934:             use:</p>
                   7935:             <pre class="programlisting">
                   7936: CFLAGS+=  -your -flags
                   7937: </pre>
                   7938: 
1.7       wiz      7939:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   7940:             without the &#8220;<span class="quote">+</span>&#8221;)
                   7941:             may lead to problems with packages that need to add
                   7942:             their own flags. Also, you may want to take a look at
                   7943:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    7944:             href=
                   7945:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.7       wiz      7946:             class="pkgname">devel/cpuflags</a> package if you're
                   7947:             interested in optimization for the current CPU.</p>
1.1       grant    7948:           </div>
                   7949: 
                   7950:           <div class="sect2" lang="en" xml:lang="en">
                   7951:             <div class="titlepage">
                   7952:               <div>
                   7953:                 <div>
1.11    ! ben      7954:                   <h3 class="title"><a name="id2590615" id=
        !          7955:                   "id2590615"></a>12.1.2.&nbsp;Restricted
1.1       grant    7956:                   packages</h3>
                   7957:                 </div>
                   7958:               </div>
                   7959:             </div>
                   7960: 
                   7961:             <p>Some licenses restrict how software may be
                   7962:             re-distributed. In order to satisfy these restrictions,
                   7963:             the package system defines five make variables that can
                   7964:             be set to note these restrictions:</p>
                   7965: 
                   7966:             <div class="itemizedlist">
                   7967:               <ul type="disc">
                   7968:                 <li>
1.7       wiz      7969:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    7970: 
                   7971:                   <p>This variable should be set whenever a
                   7972:                   restriction exists (regardless of its kind). Set
                   7973:                   this variable to a string containing the reason
                   7974:                   for the restriction.</p>
                   7975:                 </li>
                   7976: 
                   7977:                 <li>
1.7       wiz      7978:                   <p><code class=
                   7979:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    7980: 
                   7981:                   <p>Binaries may not be placed on CD-ROM. Set this
1.7       wiz      7982:                   variable to <code class=
                   7983:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    7984:                   package may not be included on a CD-ROM.</p>
                   7985:                 </li>
                   7986: 
                   7987:                 <li>
1.7       wiz      7988:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    7989: 
                   7990:                   <p>Binaries may not be placed on an FTP server.
1.7       wiz      7991:                   Set this variable to <code class=
                   7992:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    7993:                   package may not not be made available on the
                   7994:                   Internet.</p>
                   7995:                 </li>
                   7996: 
                   7997:                 <li>
1.7       wiz      7998:                   <p><code class=
                   7999:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    8000: 
                   8001:                   <p>Distfiles may not be placed on CD-ROM. Set
1.7       wiz      8002:                   this variable to <code class=
                   8003:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8004:                   of the source code or other distfile(s) is not
                   8005:                   allowed on CD-ROMs.</p>
                   8006:                 </li>
                   8007: 
                   8008:                 <li>
1.7       wiz      8009:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    8010: 
                   8011:                   <p>Distfiles may not be placed on FTP. Set this
1.7       wiz      8012:                   variable to <code class=
                   8013:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8014:                   of the source code or other distfile(s) via the
                   8015:                   Internet is not allowed.</p>
                   8016:                 </li>
                   8017:               </ul>
                   8018:             </div>
                   8019: 
1.7       wiz      8020:             <p>Please note that the use of <code class=
                   8021:             "varname">NO_PACKAGE</code>, <code class=
                   8022:             "varname">IGNORE</code>, <code class=
                   8023:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    8024:             variables to denote restrictions is deprecated, because
                   8025:             they unconditionally prevent users from generating
                   8026:             binary packages!</p>
                   8027:           </div>
                   8028: 
                   8029:           <div class="sect2" lang="en" xml:lang="en">
                   8030:             <div class="titlepage">
                   8031:               <div>
                   8032:                 <div>
                   8033:                   <h3 class="title"><a name="dependencies" id=
                   8034:                   "dependencies"></a>12.1.3.&nbsp;Handling
                   8035:                   dependencies</h3>
                   8036:                 </div>
                   8037:               </div>
                   8038:             </div>
                   8039: 
                   8040:             <p>Your package may depend on some other package being
                   8041:             present - and there are various ways of expressing this
1.7       wiz      8042:             dependency. pkgsrc supports the <code class=
                   8043:             "varname">BUILD_DEPENDS</code> and <code class=
                   8044:             "varname">DEPENDS</code> definitions, as well as
                   8045:             dependencies via <code class=
                   8046:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    8047:             way to handle dependencies, and which uses the
                   8048:             variables named above. See <a href="#buildlink" title=
                   8049:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8050:             <i>Buildlink methodology</i></a> for more
                   8051:             information.</p>
                   8052: 
                   8053:             <p>The basic difference between the two variables is as
1.7       wiz      8054:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    8055:             definition registers that pre-requisite in the binary
                   8056:             package so it will be pulled in when the binary package
1.7       wiz      8057:             is later installed, whilst the <code class=
                   8058:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    8059:             marking a dependency that is only needed for building
                   8060:             the package.</p>
                   8061: 
                   8062:             <p>This means that if you only need a package present
                   8063:             whilst you are building, it should be noted as a
1.7       wiz      8064:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    8065: 
1.7       wiz      8066:             <p>The format for a <code class=
                   8067:             "varname">BUILD_DEPENDS</code> and a <code class=
                   8068:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    8069:             <pre class="programlisting">
                   8070: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   8071: </pre>
                   8072: 
                   8073:             <p>Please note that the &#8220;<span class=
                   8074:             "quote">pre-req-package-name</span>&#8221; may include
                   8075:             any of the wildcard version numbers recognised by
                   8076:             <a href=
                   8077:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   8078:             <span class="citerefentry"><span class=
                   8079:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   8080: 
                   8081:             <div class="orderedlist">
                   8082:               <ol type="1">
                   8083:                 <li>
                   8084:                   <p>If your package needs another package's
                   8085:                   binaries or libraries to build or run, and if
1.7       wiz      8086:                   that package has a <code class=
                   8087:                   "filename">buildlink3.mk</code> file available,
                   8088:                   use it:</p>
1.1       grant    8089:                   <pre class="programlisting">
                   8090:     .include "../../graphics/jpeg/buildlink3.mk"
                   8091:     
                   8092: </pre>
                   8093:                 </li>
                   8094: 
                   8095:                 <li>
                   8096:                   <p>If your package needs to use another package
1.7       wiz      8097:                   to build itself and there is no <code class=
                   8098:                   "filename">buildlink3.mk</code> file available,
                   8099:                   use the <code class=
                   8100:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    8101:                   <pre class="programlisting">
                   8102: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   8103: </pre>
                   8104:                 </li>
                   8105: 
                   8106:                 <li>
                   8107:                   <p>If your package needs a library with which to
1.7       wiz      8108:                   link and again there is no <code class=
                   8109:                   "filename">buildlink3.mk</code> file available,
                   8110:                   this is specified using the <code class=
                   8111:                   "varname">DEPENDS</code> definition. An example
                   8112:                   of this is the <a xmlns=
1.1       grant    8113:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8114:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.7       wiz      8115:                   class="pkgname">print/lyx</a> package, which uses
                   8116:                   the xpm library, version 3.4j to build:</p>
1.1       grant    8117:                   <pre class="programlisting">
                   8118: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   8119: </pre>
                   8120: 
                   8121:                   <p>You can also use wildcards in package
                   8122:                   dependences:</p>
                   8123:                   <pre class="programlisting">
                   8124: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   8125: </pre>
                   8126: 
                   8127:                   <p>Note that such wildcard dependencies are
                   8128:                   retained when creating binary packages. The
                   8129:                   dependency is checked when installing the binary
                   8130:                   package and any package which matches the pattern
                   8131:                   will be used. Wildcard dependencies should be
                   8132:                   used with care.</p>
                   8133: 
                   8134:                   <p>The &#8220;<span class=
                   8135:                   "quote">-[0-9]*</span>&#8221; should be used
                   8136:                   instead of &#8220;<span class=
                   8137:                   "quote">-*</span>&#8221; to avoid potentially
                   8138:                   ambiguous matches such as &#8220;<span class=
                   8139:                   "quote">tk-postgresql</span>&#8221; matching a
                   8140:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.7       wiz      8141:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    8142: 
                   8143:                   <p>Wildcards can also be used to specify that a
                   8144:                   package will only build against a certain minimum
                   8145:                   version of a pre-requisite:</p>
                   8146:                   <pre class="programlisting">
                   8147: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   8148: </pre>
                   8149: 
                   8150:                   <p>This means that the package will build against
                   8151:                   version 3.5.4 of the tiff library or newer. Such
                   8152:                   a dependency may be warranted if, for example,
                   8153:                   the API of the library has changed with version
                   8154:                   3.5.4 and a package would not compile against an
                   8155:                   earlier version of tiff.</p>
                   8156: 
                   8157:                   <p>Please note that such dependencies should only
                   8158:                   be updated if a package requires a newer
                   8159:                   pre-requisite, but not to denote recommendations
                   8160:                   such as security updates or ABI changes that do
                   8161:                   not prevent a package from building correctly.
                   8162:                   Such recommendations can be expressed using
1.7       wiz      8163:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    8164:                   <pre class="programlisting">
                   8165: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   8166: </pre>
                   8167: 
1.7       wiz      8168:                   <p>In addition to the above <code class=
                   8169:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    8170:                   while a package will build against
                   8171:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.7       wiz      8172:                   recommended. <code class=
                   8173:                   "varname">RECOMMENDED</code> entries will be
                   8174:                   turned into dependencies unless explicitly
                   8175:                   ignored (in which case a warning will be
                   8176:                   printed). Packages that are built with
1.1       grant    8177:                   recommendations ignored may not be uploaded to
                   8178:                   ftp.NetBSD.org by developers and should not be
                   8179:                   used across different systems that may have
                   8180:                   different versions of binary packages
                   8181:                   installed.</p>
                   8182: 
                   8183:                   <p>For security fixes, please update the package
                   8184:                   vulnerabilities file as well as setting
1.7       wiz      8185:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    8186:                   <a href="#security-handling" title=
                   8187:                   "12.1.7.&nbsp;Handling packages with security problems">
                   8188:                   Section 12.1.7, &#8220;Handling packages with
                   8189:                   security problems&#8221;</a> for more
                   8190:                   information.</p>
                   8191:                 </li>
                   8192: 
                   8193:                 <li>
                   8194:                   <p>If your package needs some executable to be
                   8195:                   able to run correctly and if there's agail no
1.7       wiz      8196:                   <code class="filename">buildlink3.mk</code> file,
                   8197:                   this is specified using the <code class=
                   8198:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    8199:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8200:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.7       wiz      8201:                   class="pkgname">print/lyx</a> package needs to be
                   8202:                   able to execute the latex binary from the teTeX
                   8203:                   package when it runs, and that is specified:</p>
1.1       grant    8204:                   <pre class="programlisting">
                   8205: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   8206: </pre>
                   8207: 
                   8208:                   <p>The comment about wildcard dependencies from
                   8209:                   previous paragraph applies here, too.</p>
                   8210:                 </li>
                   8211:               </ol>
                   8212:             </div>
                   8213: 
                   8214:             <p>If your package needs files from another package to
                   8215:             build, see the first part of the &#8220;<span class=
                   8216:             "quote">do-configure</span>&#8221; target <a xmlns=
                   8217:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8218:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.7       wiz      8219:             class="pkgname">print/ghostscript5</a> package (it
                   8220:             relies on the jpeg sources being present in source form
                   8221:             during the build):</p>
1.1       grant    8222:             <pre class="programlisting">
                   8223: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   8224:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   8225:     fi
                   8226: </pre>
                   8227: 
                   8228:             <p>If you build any other packages that way, please
                   8229:             make sure the working files are deleted too when this
                   8230:             package's working files are cleaned up. The easiest way
                   8231:             to do so is by adding a pre-clean target:</p>
                   8232:             <pre class="programlisting">
                   8233: pre-clean:
                   8234:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   8235: </pre>
                   8236: 
1.7       wiz      8237:             <p>Please also note the <code class=
                   8238:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   8239:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   8240:             which are provided as convenience definitions. The
                   8241:             former works out whether msgfmt(1) is part of the base
                   8242:             system, and, if it isn't, installs the <a xmlns=
1.1       grant    8243:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8244:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.7       wiz      8245:             class="pkgname">devel/gettext</a> package. The latter
                   8246:             adds a build dependency on either an installed version
                   8247:             of an older gettext package, or if it isn't, installs
                   8248:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8249:             href=
                   8250:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
                   8251:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    8252:           </div>
                   8253: 
                   8254:           <div class="sect2" lang="en" xml:lang="en">
                   8255:             <div class="titlepage">
                   8256:               <div>
                   8257:                 <div>
1.11    ! ben      8258:                   <h3 class="title"><a name="id2591198" id=
        !          8259:                   "id2591198"></a>12.1.4.&nbsp;Handling conflicts
1.1       grant    8260:                   with other packages</h3>
                   8261:                 </div>
                   8262:               </div>
                   8263:             </div>
                   8264: 
                   8265:             <p>Your package may conflict with other packages a user
                   8266:             might already have installed on his system, e.g. if
                   8267:             your package installs the same set of files like
                   8268:             another package in our pkgsrc tree.</p>
                   8269: 
1.7       wiz      8270:             <p>In this case you can set <code class=
                   8271:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    8272:             packages (including version string) your package
                   8273:             conflicts with.</p>
                   8274: 
                   8275:             <p>For example <a xmlns=
                   8276:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8277:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.7       wiz      8278:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
                   8279:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8280:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
                   8281:             class="pkgname">x11/Xaw-Xpm</a> install provide the
                   8282:             same shared library, thus you set in <code class=
                   8283:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    8284:             <pre class="programlisting">
                   8285: CONFLICTS=      Xaw-Xpm-[0-9]*
                   8286: </pre>
                   8287: 
1.7       wiz      8288:             <p>and in <code class=
                   8289:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    8290:             <pre class="programlisting">
                   8291: CONFLICTS=      Xaw3d-[0-9]*
                   8292: </pre>
                   8293: 
                   8294:             <p>Packages will automatically conflict with other
                   8295:             packages with the name prefix and a different version
                   8296:             string. &#8220;<span class=
                   8297:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   8298:             conflict with the older version &#8220;<span class=
                   8299:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   8300:           </div>
                   8301: 
                   8302:           <div class="sect2" lang="en" xml:lang="en">
                   8303:             <div class="titlepage">
                   8304:               <div>
                   8305:                 <div>
1.11    ! ben      8306:                   <h3 class="title"><a name="id2591249" id=
        !          8307:                   "id2591249"></a>12.1.5.&nbsp;Packages that cannot
1.1       grant    8308:                   or should not be built</h3>
                   8309:                 </div>
                   8310:               </div>
                   8311:             </div>
                   8312: 
                   8313:             <p>There are several reasons why a package might be
                   8314:             instructed to not build under certain circumstances. If
                   8315:             the package builds and runs on most platforms, the
1.7       wiz      8316:             exceptions should be noted with <code class=
                   8317:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   8318:             builds and runs on a small handful of platforms, set
                   8319:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
                   8320:             If the package should be skipped (for example, because
                   8321:             it provides functionality already provided by the
                   8322:             system), set <code class=
                   8323:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   8324:             message. If the package should fail because some
                   8325:             preconditions are not met, set <code class=
                   8326:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    8327:             message.</p>
                   8328: 
1.7       wiz      8329:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    8330:             because it didn't provide enough information to
                   8331:             determine whether the build should fail.</p>
                   8332:           </div>
                   8333: 
                   8334:           <div class="sect2" lang="en" xml:lang="en">
                   8335:             <div class="titlepage">
                   8336:               <div>
                   8337:                 <div>
1.11    ! ben      8338:                   <h3 class="title"><a name="id2591342" id=
        !          8339:                   "id2591342"></a>12.1.6.&nbsp;Packages which
1.1       grant    8340:                   should not be deleted, once installed</h3>
                   8341:                 </div>
                   8342:               </div>
                   8343:             </div>
                   8344: 
                   8345:             <p>To ensure that a package may not be deleted, once it
1.7       wiz      8346:             has been installed, the <code class=
                   8347:             "varname">PKG_PRESERVE</code> definition should be set
                   8348:             in the package Makefile. This will be carried into any
1.1       grant    8349:             binary package that is made from this pkgsrc entry. A
                   8350:             &#8220;<span class="quote">preserved</span>&#8221;
                   8351:             package will not be deleted using <a href=
                   8352:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8353:             <span class="citerefentry"><span class=
                   8354:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   8355:             the &#8220;<span class="quote">-f</span>&#8221; option
                   8356:             is used.</p>
                   8357:           </div>
                   8358: 
                   8359:           <div class="sect2" lang="en" xml:lang="en">
                   8360:             <div class="titlepage">
                   8361:               <div>
                   8362:                 <div>
                   8363:                   <h3 class="title"><a name="security-handling" id=
                   8364:                   "security-handling"></a>12.1.7.&nbsp;Handling
                   8365:                   packages with security problems</h3>
                   8366:                 </div>
                   8367:               </div>
                   8368:             </div>
                   8369: 
                   8370:             <p>When a vulnerability is found, this should be noted
1.7       wiz      8371:             in <code class=
                   8372:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    8373:             and after the commit of that file, it should be copied
1.7       wiz      8374:             to both <code class=
                   8375:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
                   8376:             and <code class=
                   8377:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
                   8378:             on ftp.NetBSD.org using <code class=
                   8379:             "filename">localsrc/security/advisories/Makefile</code>.
                   8380:             In addition, if a <code class=
                   8381:             "filename">buildlink3.mk</code> file exists for an
                   8382:             affected package, bumping <code class=
                   8383:             "varname">PKGREVISION</code> and creating a
                   8384:             corresponding <code class=
                   8385:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   8386:             "replaceable"><code>pkg</code></em></code> entry should
                   8387:             be considered. See <a href="#buildlink" title=
1.1       grant    8388:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8389:             <i>Buildlink methodology</i></a> for more information
1.7       wiz      8390:             about writing <code class=
                   8391:             "filename">buildlink3.mk</code> files and <code class=
                   8392:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    8393: 
                   8394:             <p>Also, if the fix should be applied to the stable
                   8395:             pkgsrc branch, be sure to submit a pullup request!</p>
                   8396:           </div>
                   8397: 
                   8398:           <div class="sect2" lang="en" xml:lang="en">
                   8399:             <div class="titlepage">
                   8400:               <div>
                   8401:                 <div>
1.11    ! ben      8402:                   <h3 class="title"><a name="id2591434" id=
        !          8403:                   "id2591434"></a>12.1.8.&nbsp;How to handle
1.1       grant    8404:                   compiler bugs</h3>
                   8405:                 </div>
                   8406:               </div>
                   8407:             </div>
                   8408: 
                   8409:             <p>Some source files trigger bugs in the compiler,
                   8410:             based on combinations of compiler version and
                   8411:             architecture and almost always relation to optimisation
                   8412:             being enabled. Common symptoms are gcc internal errors
                   8413:             or never finishing compiling a file.</p>
                   8414: 
                   8415:             <p>Typically a workaround involves testing the
1.7       wiz      8416:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    8417:             version, disabling optimisation for that
1.7       wiz      8418:             file/<code class="varname">MACHINE_ARCH</code>/compiler
                   8419:             combination, and documenting it in <code class=
                   8420:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    8421:             number of examples!</p>
                   8422:           </div>
                   8423: 
                   8424:           <div class="sect2" lang="en" xml:lang="en">
                   8425:             <div class="titlepage">
                   8426:               <div>
                   8427:                 <div>
1.11    ! ben      8428:                   <h3 class="title"><a name="id2591457" id=
        !          8429:                   "id2591457"></a>12.1.9.&nbsp;How to handle
1.1       grant    8430:                   incrementing versions when fixing an existing
                   8431:                   package</h3>
                   8432:                 </div>
                   8433:               </div>
                   8434:             </div>
                   8435: 
                   8436:             <p>When making fixes to an existing package it can be
1.7       wiz      8437:             useful to change the version number in <code class=
                   8438:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    8439:             future versions by the original author, a
                   8440:             &#8220;<span class="quote">nb1</span>&#8221;,
                   8441:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   8442:             suffix can be used on package versions by setting
1.7       wiz      8443:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   8444:             The &#8220;<span class="quote">nb</span>&#8221; is
                   8445:             treated like a &#8220;<span class=
                   8446:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    8447:             <pre class="programlisting">
                   8448:   DISTNAME= foo-17.42
                   8449:     PKGREVISION=  9
                   8450: </pre>
                   8451: 
1.7       wiz      8452:             <p>will result in a <code class=
                   8453:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    8454:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   8455: 
                   8456:             <p>When a new release of the package is released, the
1.7       wiz      8457:             <code class="varname">PKGREVISION</code> should be
                   8458:             removed. e.g. on a new minor release of the above
                   8459:             package, things should be like:</p>
1.1       grant    8460:             <pre class="programlisting">
                   8461: DISTNAME=   foo-17.43
                   8462: </pre>
                   8463:           </div>
                   8464: 
                   8465:           <div class="sect2" lang="en" xml:lang="en">
                   8466:             <div class="titlepage">
                   8467:               <div>
                   8468:                 <div>
1.11    ! ben      8469:                   <h3 class="title"><a name="id2591574" id=
        !          8470:                   "id2591574"></a>12.1.10.&nbsp;Portability of
1.1       grant    8471:                   packages</h3>
                   8472:                 </div>
                   8473:               </div>
                   8474:             </div>
                   8475: 
                   8476:             <p>One appealing feature of pkgsrc is that it runs on
                   8477:             many different platforms. As a result, it is important
                   8478:             to ensure, where possible, that packages in pkgsrc are
                   8479:             portable. There are some particular details you should
                   8480:             pay attention to while working on pkgsrc.</p>
                   8481: 
                   8482:             <div class="sect3" lang="en" xml:lang="en">
                   8483:               <div class="titlepage">
                   8484:                 <div>
                   8485:                   <div>
1.11    ! ben      8486:                     <h4 class="title"><a name="id2591579" id=
        !          8487:                     "id2591579"></a>12.1.10.1.&nbsp;${INSTALL},
1.1       grant    8488:                     ${INSTALL_DATA_DIR}, ...</h4>
                   8489:                   </div>
                   8490:                 </div>
                   8491:               </div>
                   8492: 
1.7       wiz      8493:               <p>The BSD-compatible <span><strong class=
                   8494:               "command">install</strong></span> supplied with some
1.1       grant    8495:               operating systems will not perform more than one
                   8496:               operation at a time. As such, you should call
                   8497:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   8498:               etc. like this:</p>
                   8499:               <pre class="programlisting">
                   8500: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   8501: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   8502: </pre>
                   8503:             </div>
                   8504:           </div>
                   8505:         </div>
                   8506: 
                   8507:         <div class="sect1" lang="en" xml:lang="en">
                   8508:           <div class="titlepage">
                   8509:             <div>
                   8510:               <div>
                   8511:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      8512:                 "id2591598" id="id2591598"></a>12.2.&nbsp;Possible
1.1       grant    8513:                 downloading issues</h2>
                   8514:               </div>
                   8515:             </div>
                   8516:           </div>
                   8517: 
                   8518:           <div class="sect2" lang="en" xml:lang="en">
                   8519:             <div class="titlepage">
                   8520:               <div>
                   8521:                 <div>
1.11    ! ben      8522:                   <h3 class="title"><a name="id2591602" id=
        !          8523:                   "id2591602"></a>12.2.1.&nbsp;Packages whose
1.1       grant    8524:                   distfiles aren't available for plain
                   8525:                   downloading</h3>
                   8526:                 </div>
                   8527:               </div>
                   8528:             </div>
                   8529: 
                   8530:             <p>If you need to download from a dynamic URL you can
1.7       wiz      8531:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   8532:             and a <span><strong class="command">make
                   8533:             fetch</strong></span> will call <code class=
                   8534:             "filename">files/getsite.sh</code> with the name of
                   8535:             each file to download as an argument, expecting it to
                   8536:             output the URL of the directory from which to download
                   8537:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8538:             href=
1.1       grant    8539:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.7       wiz      8540:             class="pkgname">graphics/ns-cult3d</a> is an example of
                   8541:             this usage.</p>
1.1       grant    8542: 
                   8543:             <p>If the download can't be automated, because the user
                   8544:             must submit personal information to apply for a
                   8545:             password, or must pay for the source, or whatever, you
1.7       wiz      8546:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   8547:             a macro which displays a message explaining the
                   8548:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   8549:             must be executable shell commands, not just a message.
                   8550:             (Generally, it executes <code class=
                   8551:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    8552:             following packages use this: <a xmlns=
                   8553:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8554:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.7       wiz      8555:             class="pkgname">audio/realplayer</a>, <a xmlns=
                   8556:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8557:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
                   8558:             class="pkgname">cad/simian</a>, <a xmlns=
                   8559:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8560:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
                   8561:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
                   8562:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8563:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
                   8564:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
                   8565:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8566:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
                   8567:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
                   8568:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8569:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
                   8570:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
                   8571:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8572:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
                   8573:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
                   8574:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8575:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
                   8576:             class="pkgname">www/openacs</a>. Try to be consistent
                   8577:             with them.</p>
1.1       grant    8578:           </div>
                   8579: 
                   8580:           <div class="sect2" lang="en" xml:lang="en">
                   8581:             <div class="titlepage">
                   8582:               <div>
                   8583:                 <div>
1.11    ! ben      8584:                   <h3 class="title"><a name="id2591665" id=
        !          8585:                   "id2591665"></a>12.2.2.&nbsp;How to handle
1.1       grant    8586:                   modified distfiles with the 'old' name</h3>
                   8587:                 </div>
                   8588:               </div>
                   8589:             </div>
                   8590: 
                   8591:             <p>Sometimes authors of a software package make some
                   8592:             modifications after the software was released, and they
                   8593:             put up a new distfile without changing the package's
                   8594:             version number. If a package is already in pkgsrc at
                   8595:             that time, the md5 checksum will no longer match. The
                   8596:             correct way to work around this is to update the
                   8597:             package's md5 checksum to match the package on the
                   8598:             master site (beware, any mirrors may not be up to date
                   8599:             yet!), and to remove the old distfile from
1.7       wiz      8600:             ftp.NetBSD.org's <code class=
                   8601:             "filename">/pub/NetBSD/packages/distfiles</code>
1.1       grant    8602:             directory. Furthermore, a mail to the package's author
                   8603:             seems appropriate making sure the distfile was really
                   8604:             updated on purpose, and that no trojan horse or so
                   8605:             crept in.</p>
                   8606:           </div>
                   8607:         </div>
                   8608: 
                   8609:         <div class="sect1" lang="en" xml:lang="en">
                   8610:           <div class="titlepage">
                   8611:             <div>
                   8612:               <div>
                   8613:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      8614:                 "id2591676" id=
        !          8615:                 "id2591676"></a>12.3.&nbsp;Configuration
1.1       grant    8616:                 gotchas</h2>
                   8617:               </div>
                   8618:             </div>
                   8619:           </div>
                   8620: 
                   8621:           <div class="sect2" lang="en" xml:lang="en">
                   8622:             <div class="titlepage">
                   8623:               <div>
                   8624:                 <div>
                   8625:                   <h3 class="title"><a name="fixes.libtool" id=
                   8626:                   "fixes.libtool"></a>12.3.1.&nbsp;Shared libraries
                   8627:                   - libtool</h3>
                   8628:                 </div>
                   8629:               </div>
                   8630:             </div>
                   8631: 
                   8632:             <p>pkgsrc supports many different machines, with
                   8633:             different object formats like a.out and ELF, and
                   8634:             varying abilities to do shared library and dynamic
                   8635:             loading at all. To accompany this, varying commands and
                   8636:             options have to be passed to the compiler, linker, etc.
                   8637:             to get the Right Thing, which can be pretty annoying
                   8638:             especially if you don't have all the machines at your
                   8639:             hand to test things. The <a xmlns=
                   8640:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8641:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.7       wiz      8642:             class="pkgname">devel/libtool</a> pkg can help here, as
                   8643:             it just &#8220;<span class="quote">knows</span>&#8221;
                   8644:             how to build both static and dynamic libraries from a
                   8645:             set of source files, thus being platform
                   8646:             independent.</p>
1.1       grant    8647: 
                   8648:             <p>Here's how to use libtool in a pkg in seven simple
                   8649:             steps:</p>
                   8650: 
                   8651:             <div class="orderedlist">
                   8652:               <ol type="1">
                   8653:                 <li>
1.7       wiz      8654:                   <p>Add <code class=
                   8655:                   "varname">USE_LIBTOOL=yes</code> to the package
                   8656:                   Makefile.</p>
1.1       grant    8657:                 </li>
                   8658: 
                   8659:                 <li>
                   8660:                   <p>For library objects, use &#8220;<span class=
                   8661:                   "quote">${LIBTOOL} --mode=compile
                   8662:                   ${CC}</span>&#8221; in place of
                   8663:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   8664:                   You could even add it to the definition of
1.7       wiz      8665:                   <code class="varname">CC</code>, if only
                   8666:                   libraries are being built in a given Makefile.
                   8667:                   This one command will build both PIC and non-PIC
                   8668:                   library objects, so you need not have separate
                   8669:                   shared and non-shared library rules.</p>
1.1       grant    8670:                 </li>
                   8671: 
                   8672:                 <li>
                   8673:                   <p>For the linking of the library, remove any
                   8674:                   &#8220;<span class="quote">ar</span>&#8221;,
                   8675:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   8676:                   and &#8220;<span class="quote">ld
                   8677:                   -Bshareable</span>&#8221; commands, and instead
                   8678:                   use:</p>
                   8679:                   <pre class="programlisting">
                   8680: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   8681: </pre>
                   8682: 
                   8683:                   <p>Note that the library is changed to have a
1.7       wiz      8684:                   <code class="filename">.la</code> extension, and
                   8685:                   the objects are changed to have a <code class=
                   8686:                   "filename">.lo</code> extension. Change
                   8687:                   <code class="varname">OBJS</code> as necessary.
                   8688:                   This automatically creates all of the
                   8689:                   <code class="filename">.a</code>, <code class=
                   8690:                   "filename">.so.major.minor</code>, and ELF
                   8691:                   symlinks (if necessary) in the build directory.
                   8692:                   Be sure to include &#8220;<span class=
1.1       grant    8693:                   "quote">-version-info</span>&#8221;, especially
                   8694:                   when major and minor are zero, as libtool will
                   8695:                   otherwise strip off the shared library
                   8696:                   version.</p>
                   8697: 
                   8698:                   <p>From the libtool manual:</p>
                   8699:                   <pre class="programlisting">
                   8700:      So, libtool library versions are described by three integers:
                   8701: 
                   8702: CURRENT
                   8703:        The most recent interface number that this library implements.
                   8704: 
                   8705: REVISION
                   8706:        The implementation number of the CURRENT interface.
                   8707: 
                   8708: AGE
                   8709:        The difference between the newest and oldest interfaces that this
                   8710:        library implements.  In other words, the library implements all the
                   8711:        interface numbers in the range from number `CURRENT - AGE' to
                   8712:        `CURRENT'.
                   8713:        
                   8714:      If two libraries have identical CURRENT and AGE numbers, then the
                   8715: dynamic linker chooses the library with the greater REVISION number. 
                   8716: </pre>
                   8717: 
                   8718:                   <p>The &#8220;<span class=
                   8719:                   "quote">-release</span>&#8221; option will
                   8720:                   produce different results for a.out and ELF
                   8721:                   (excluding symlinks) in only one case. An ELF
                   8722:                   library of the form &#8220;<span class=
                   8723:                   "quote">libfoo-release.so.<span class=
                   8724:                   "emphasis"><em>x</em></span>.<span class=
                   8725:                   "emphasis"><em>y</em></span></span>&#8221; will
                   8726:                   have a symlink of &#8220;<span class=
                   8727:                   "quote">libfoo.so.<span class=
                   8728:                   "emphasis"><em>x</em></span>.<span class=
                   8729:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   8730:                   a.out platform. This is handled
                   8731:                   automatically.</p>
                   8732: 
                   8733:                   <p>The &#8220;<span class="quote">-rpath
                   8734:                   argument</span>&#8221; is the install directory
                   8735:                   of the library being built.</p>
                   8736: 
1.7       wiz      8737:                   <p>In the <code class="filename">PLIST</code>,
                   8738:                   include all of the <code class=
                   8739:                   "filename">.a</code>, <code class=
                   8740:                   "filename">.la</code>, and <code class=
                   8741:                   "filename">.so</code>, <code class=
                   8742:                   "filename">.so.<em class=
                   8743:                   "replaceable"><code>major</code></em></code> and
                   8744:                   <code class="filename">.so.<em class=
                   8745:                   "replaceable"><code>major</code></em>.<em class=
                   8746:                   "replaceable"><code>minor</code></em></code>
                   8747:                   files.</p>
1.1       grant    8748:                 </li>
                   8749: 
                   8750:                 <li>
1.7       wiz      8751:                   <p>When linking shared object (<code class=
                   8752:                   "filename">.so</code>) files, i.e. files that are
1.1       grant    8753:                   loaded via dlopen(3), NOT shared libraries, use
                   8754:                   &#8220;<span class="quote">-module
                   8755:                   -avoid-version</span>&#8221; to prevent them
                   8756:                   getting version tacked on.</p>
                   8757: 
1.7       wiz      8758:                   <p>The <code class="filename">PLIST</code> file
                   8759:                   gets the <code class="filename">foo.so</code>
                   8760:                   entry.</p>
1.1       grant    8761:                 </li>
                   8762: 
                   8763:                 <li>
                   8764:                   <p>When linking programs that depend on these
                   8765:                   libraries <span class=
                   8766:                   "emphasis"><em>before</em></span> they are
                   8767:                   installed, preface the <a href=
                   8768:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   8769:                   <span class="citerefentry"><span class=
                   8770:                   "refentrytitle">cc</span>(1)</span></a> or
                   8771:                   <a href=
                   8772:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   8773:                   <span class="citerefentry"><span class=
                   8774:                   "refentrytitle">ld</span>(1)</span></a> line with
                   8775:                   &#8220;<span class="quote">${LIBTOOL}
                   8776:                   --mode=link</span>&#8221;, and it will find the
                   8777:                   correct libraries (static or shared), but please
                   8778:                   be aware that libtool will not allow you to
                   8779:                   specify a relative path in -L (such as
                   8780:                   &#8220;<span class=
                   8781:                   "quote">-L../somelib</span>&#8221;), because it
                   8782:                   expects you to change that argument to be the
1.7       wiz      8783:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    8784:                   <pre class="programlisting">
                   8785: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   8786: </pre>
                   8787: 
                   8788:                   <p>should be changed to:</p>
                   8789:                   <pre class="programlisting">
1.7       wiz      8790: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   8791: "replaceable"><code>someprog</code></em> <em class=
                   8792: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    8793: </pre>
                   8794: 
                   8795:                   <p>and it will do the right thing with the
                   8796:                   libraries.</p>
                   8797:                 </li>
                   8798: 
                   8799:                 <li>
                   8800:                   <p>When installing libraries, preface the
                   8801:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   8802:                   <span class="citerefentry"><span class=
                   8803:                   "refentrytitle">install</span>(1)</span></a> or
                   8804:                   <a href=
                   8805:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   8806:                   <span class="citerefentry"><span class=
                   8807:                   "refentrytitle">cp</span>(1)</span></a> command
                   8808:                   with &#8220;<span class="quote">${LIBTOOL}
                   8809:                   --mode=install</span>&#8221;, and change the
1.7       wiz      8810:                   library name to <code class=
                   8811:                   "filename">.la</code>. e.g.</p>
1.1       grant    8812:                   <pre class="programlisting">
                   8813: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   8814: </pre>
                   8815: 
1.7       wiz      8816:                   <p>This will install the static <code class=
                   8817:                   "filename">.a</code>, shared library, any needed
1.1       grant    8818:                   symlinks, and run <a href=
                   8819:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   8820:                   <span class="citerefentry"><span class=
                   8821:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   8822:                 </li>
                   8823: 
                   8824:                 <li>
1.7       wiz      8825:                   <p>In your <code class="filename">PLIST</code>,
                   8826:                   include all of the <code class=
                   8827:                   "filename">.a</code>, <code class=
                   8828:                   "filename">.la</code>, and <code class=
                   8829:                   "filename">.so</code>, <code class=
                   8830:                   "filename">.so.CURRENT</code> and <code class=
                   8831:                   "filename">.so.CURRENT.REVISION</code> files
                   8832:                   (this is a change from the previous
                   8833:                   behaviour).</p>
1.1       grant    8834:                 </li>
                   8835:               </ol>
                   8836:             </div>
                   8837:           </div>
                   8838: 
                   8839:           <div class="sect2" lang="en" xml:lang="en">
                   8840:             <div class="titlepage">
                   8841:               <div>
                   8842:                 <div>
1.11    ! ben      8843:                   <h3 class="title"><a name="id2592016" id=
        !          8844:                   "id2592016"></a>12.3.2.&nbsp;Using libtool on GNU
1.1       grant    8845:                   packages that already support libtool</h3>
                   8846:                 </div>
                   8847:               </div>
                   8848:             </div>
                   8849: 
1.7       wiz      8850:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   8851:             the package Makefile. This will override the package's
                   8852:             own libtool in most cases. For older libtool using
1.1       grant    8853:             packages, libtool is made by ltconfig script during the
                   8854:             do-configure step; you can check the libtool script
1.7       wiz      8855:             location by doing <span><strong class="command">make
                   8856:             configure; find work*/ -name
                   8857:             libtool</strong></span>.</p>
                   8858: 
                   8859:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   8860:             specifies which libtool scripts, relative to
                   8861:             <code class="varname">WRKSRC</code>, to override. By
                   8862:             default, it is set to &#8220;<span class=
                   8863:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   8864:             this does not match the location of the package's
                   8865:             libtool script(s), set it as appropriate.</p>
1.1       grant    8866: 
1.7       wiz      8867:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    8868:             static libraries built and installed, then use
1.7       wiz      8869:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    8870:             instead.</p>
                   8871: 
                   8872:             <p>If your package makes use of the platform
                   8873:             independent library for loading dynamic shared objects,
                   8874:             that comes with libtool (libltdl), you should include
1.7       wiz      8875:             the libtool buildlink3.mk (and set <code class=
                   8876:             "varname">USE_BUILDLINK3=YES</code>).</p>
1.1       grant    8877: 
                   8878:             <p>Some packages use libtool incorrectly so that the
                   8879:             package may not work or build in some circumstances.
                   8880:             Some of the more common errors are:</p>
                   8881: 
                   8882:             <div class="itemizedlist">
                   8883:               <ul type="disc">
                   8884:                 <li>
                   8885:                   <p>The inclusion of a shared object (-module) as
                   8886:                   a dependent library in an executable or library.
                   8887:                   This in itself isn't a problem if one of two
                   8888:                   things has been done:</p>
                   8889: 
                   8890:                   <div class="orderedlist">
                   8891:                     <ol type="1">
                   8892:                       <li>
                   8893:                         <p>The shared object is named correctly,
1.7       wiz      8894:                         i.e. <code class=
                   8895:                         "filename">libfoo.la</code>, not
                   8896:                         <code class="filename">foo.la</code></p>
1.1       grant    8897:                       </li>
                   8898: 
                   8899:                       <li>
                   8900:                         <p>The -dlopen option is used when linking
                   8901:                         an executable.</p>
                   8902:                       </li>
                   8903:                     </ol>
                   8904:                   </div>
                   8905:                 </li>
                   8906: 
                   8907:                 <li>
                   8908:                   <p>The use of libltdl without the correct calls
                   8909:                   to initialisation routines. The function
                   8910:                   lt_dlinit() should be called and the macro
1.7       wiz      8911:                   <code class=
                   8912:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    8913:                   included in executables.</p>
                   8914:                 </li>
                   8915:               </ul>
                   8916:             </div>
                   8917:           </div>
                   8918: 
                   8919:           <div class="sect2" lang="en" xml:lang="en">
                   8920:             <div class="titlepage">
                   8921:               <div>
                   8922:                 <div>
1.11    ! ben      8923:                   <h3 class="title"><a name="id2592168" id=
        !          8924:                   "id2592168"></a>12.3.3.&nbsp;GNU
1.1       grant    8925:                   Autoconf/Automake</h3>
                   8926:                 </div>
                   8927:               </div>
                   8928:             </div>
                   8929: 
                   8930:             <p>If a package needs GNU autoconf or automake to be
                   8931:             executed to regenerate the configure script and
                   8932:             Makefile.in makefile templates, then they should be
                   8933:             executed in a pre-configure target. Two Makefile
1.7       wiz      8934:             fragments are provided in <code class=
                   8935:             "filename">pkgsrc/mk/autoconf.mk</code> and
                   8936:             <code class="filename">pkgsrc/mk/automake.mk</code> to
                   8937:             help dealing with these tools. See comments in these
                   8938:             files for details.</p>
1.1       grant    8939: 
                   8940:             <p>For packages that need only autoconf:</p>
                   8941:             <pre class="programlisting">
                   8942: AUTOCONF_REQD=    2.50    # if default version is not good enough
                   8943: ...
                   8944: 
                   8945: pre-configure:
                   8946:           cd ${WRKSRC}; ${AUTOCONF}
                   8947: 
                   8948: ...
                   8949: .include "../../mk/autoconf.mk"
                   8950: </pre>
                   8951: 
                   8952:             <p>and for packages that need automake and
                   8953:             autoconf:</p>
                   8954:             <pre class="programlisting">
                   8955: AUTOMAKE_REQD=  1.7.1   # if default version is not good enough
                   8956: ...
                   8957: 
                   8958: pre-configure:
                   8959:           cd ${WRKSRC};                                           \
                   8960:           ${ACLOCAL};                                             \
                   8961:           ${AUTOHEADER};                                          \
                   8962:           ${AUTOMAKE} -a --foreign -i;                            \
                   8963:           ${AUTOCONF}
                   8964: 
                   8965: ...
                   8966: .include "../mk/automake.mk"
                   8967: </pre>
                   8968: 
                   8969:             <p>Packages which use GNU Automake will almost
                   8970:             certainly require GNU Make, but that's automatically
1.7       wiz      8971:             provided for you in <code class=
                   8972:             "filename">mk/automake.mk</code>.</p>
1.1       grant    8973: 
                   8974:             <p>There are times when the configure process makes
                   8975:             additional changes to the generated files, which then
                   8976:             causes the build process to try to re-execute the
                   8977:             automake sequence. This is prevented by touching
                   8978:             various files in the configure stage. If this causes
1.7       wiz      8979:             problems with your package you can set <code class=
                   8980:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    8981:             Makefile.</p>
                   8982:           </div>
                   8983:         </div>
                   8984: 
                   8985:         <div class="sect1" lang="en" xml:lang="en">
                   8986:           <div class="titlepage">
                   8987:             <div>
                   8988:               <div>
                   8989:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      8990:                 "id2592213" id="id2592213"></a>12.4.&nbsp;Building
1.1       grant    8991:                 considerations</h2>
                   8992:               </div>
                   8993:             </div>
                   8994:           </div>
                   8995: 
                   8996:           <div class="sect2" lang="en" xml:lang="en">
                   8997:             <div class="titlepage">
                   8998:               <div>
                   8999:                 <div>
1.11    ! ben      9000:                   <h3 class="title"><a name="id2592216" id=
        !          9001:                   "id2592216"></a>12.4.1.&nbsp;CPP defines</h3>
1.1       grant    9002:                 </div>
                   9003:               </div>
                   9004:             </div>
                   9005: 
                   9006:             <p>To port an application to NetBSD, it's usually
                   9007:             necessary for the compiler to be able to judge the
                   9008:             system on which it's compiling, and we use definitions
                   9009:             so that the C pre-processor can do this.</p>
                   9010: 
                   9011:             <p>To test whether you are working on a 4.4 BSD-derived
                   9012:             system, you should use the BSD definition, which is
1.7       wiz      9013:             defined in <code class=
                   9014:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    9015:             systems.</p>
                   9016:             <pre class="programlisting">
                   9017: #include &lt;sys/param.h&gt;
                   9018: </pre>
                   9019: 
                   9020:             <p>and then you can surround the BSD-specific parts of
                   9021:             your package's C/C++ code using this conditional:</p>
                   9022:             <pre class="programlisting">
                   9023: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   9024:     ...
                   9025: #endif
                   9026: </pre>
                   9027: 
                   9028:             <p>Please use the &#8220;<span class=
                   9029:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   9030:             it should only apply to features of NetBSD that are not
                   9031:             present in other 4.4-lite derived BSDs.</p>
                   9032:           </div>
                   9033:         </div>
                   9034: 
                   9035:         <div class="sect1" lang="en" xml:lang="en">
                   9036:           <div class="titlepage">
                   9037:             <div>
                   9038:               <div>
                   9039:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      9040:                 "id2592314" id="id2592314"></a>12.5.&nbsp;Package
1.1       grant    9041:                 specific actions</h2>
                   9042:               </div>
                   9043:             </div>
                   9044:           </div>
                   9045: 
                   9046:           <div class="sect2" lang="en" xml:lang="en">
                   9047:             <div class="titlepage">
                   9048:               <div>
                   9049:                 <div>
1.11    ! ben      9050:                   <h3 class="title"><a name="id2592317" id=
        !          9051:                   "id2592317"></a>12.5.1.&nbsp;Package
1.1       grant    9052:                   configuration files</h3>
                   9053:                 </div>
                   9054:               </div>
                   9055:             </div>
                   9056: 
                   9057:             <p>Packages should be taught to look for their
1.7       wiz      9058:             configuration files in <code class=
                   9059:             "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1       grant    9060:             through to the configure and build processes.
1.7       wiz      9061:             <code class="varname">PKG_SYSCONFDIR</code> may be
1.1       grant    9062:             customized in various ways by setting other make
                   9063:             variables:</p>
                   9064: 
                   9065:             <div class="itemizedlist">
                   9066:               <ul type="disc">
                   9067:                 <li>
1.7       wiz      9068:                   <p><code class="varname">PKG_SYSCONFBASE</code>
                   9069:                   is the main config directory under which all
                   9070:                   package configuration files are to be found. This
                   9071:                   defaults to <code class=
                   9072:                   "filename">${PREFIX}/etc</code>, but may be
                   9073:                   overridden in <code class=
                   9074:                   "filename">/etc/mk.conf</code>.</p>
1.1       grant    9075:                 </li>
                   9076: 
                   9077:                 <li>
1.7       wiz      9078:                   <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   9079:                   is the subdirectory of <code class=
                   9080:                   "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    9081:                   configuration files for a particular package may
                   9082:                   be found, e.g. the Apache configuration files may
1.7       wiz      9083:                   all be found under the <code class=
                   9084:                   "filename">httpd/</code> subdirectory of
                   9085:                   <code class="varname">${PKG_SYSCONFBASE}</code>.
                   9086:                   This should be set in the package Makefile.</p>
1.1       grant    9087:                 </li>
                   9088: 
                   9089:                 <li>
1.7       wiz      9090:                   <p>By default, <code class=
                   9091:                   "varname">PKG_SYSCONFDIR</code> is set to
                   9092:                   <code class=
                   9093:                   "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
                   9094:                   but this may be overridden by setting
                   9095:                   <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9096:                   for a particular package, where <code class=
                   9097:                   "varname">PKG_SYSCONFVAR</code> defaults to
                   9098:                   <code class="varname">${PKGBASE}</code>. This is
                   9099:                   not meant to be set by a package Makefile, but is
1.1       grant    9100:                   reserved for users who wish to override the
1.7       wiz      9101:                   <code class="varname">PKG_SYSCONFDIR</code>
                   9102:                   setting for a particular package with a special
1.1       grant    9103:                   location.</p>
                   9104:                 </li>
                   9105:               </ul>
                   9106:             </div>
                   9107: 
                   9108:             <p>The only variables that users should customize are
1.7       wiz      9109:             <code class="varname">PKG_SYSCONFBASE</code> and
                   9110:             <code class=
                   9111:             "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
                   9112:             Users will typically want to set <code class=
                   9113:             "varname">PKG_SYSCONFBASE</code> to <code class=
                   9114:             "filename">/etc</code>, or to accept the default
                   9115:             location of <code class=
                   9116:             "filename">${PREFIX}/etc</code>.</p>
1.1       grant    9117:           </div>
                   9118: 
                   9119:           <div class="sect2" lang="en" xml:lang="en">
                   9120:             <div class="titlepage">
                   9121:               <div>
                   9122:                 <div>
1.11    ! ben      9123:                   <h3 class="title"><a name="id2592420" id=
        !          9124:                   "id2592420"></a>12.5.2.&nbsp;User
1.2       hubertf  9125:                   interaction</h3>
1.1       grant    9126:                 </div>
                   9127:               </div>
                   9128:             </div>
                   9129: 
                   9130:             <p>Occasionally, packages require interaction from the
                   9131:             user, and this can be in a number of ways:</p>
                   9132: 
                   9133:             <div class="itemizedlist">
                   9134:               <ul type="disc">
                   9135:                 <li>
                   9136:                   <p>help in fetching the distfiles</p>
                   9137:                 </li>
                   9138: 
                   9139:                 <li>
                   9140:                   <p>help to configure the package before it is
                   9141:                   built</p>
                   9142:                 </li>
                   9143: 
                   9144:                 <li>
                   9145:                   <p>help during the build process</p>
                   9146:                 </li>
                   9147: 
                   9148:                 <li>
                   9149:                   <p>help during the installation of a package</p>
                   9150:                 </li>
                   9151:               </ul>
                   9152:             </div>
                   9153: 
1.7       wiz      9154:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    9155:             definition is provided to notify the pkgsrc mechanism
                   9156:             of an interactive stage which will be needed, and this
1.7       wiz      9157:             should be set in the package's <code class=
                   9158:             "filename">Makefile</code>. e.g.</p>
1.1       grant    9159:             <pre class="programlisting">
                   9160: INTERACTIVE_STAGE= build
                   9161: </pre>
                   9162: 
                   9163:             <p>Multiple interactive stages can be specified:</p>
                   9164:             <pre class="programlisting">
                   9165: INTERACTIVE_STAGE= configure install
                   9166: </pre>
                   9167:           </div>
                   9168: 
                   9169:           <div class="sect2" lang="en" xml:lang="en">
                   9170:             <div class="titlepage">
                   9171:               <div>
                   9172:                 <div>
1.11    ! ben      9173:                   <h3 class="title"><a name="id2592465" id=
        !          9174:                   "id2592465"></a>12.5.3.&nbsp;Handling
1.1       grant    9175:                   licenses</h3>
                   9176:                 </div>
                   9177:               </div>
                   9178:             </div>
                   9179: 
                   9180:             <p>A package may underly a license which the user has
                   9181:             or has not agreed to accept. Usually, packages that
                   9182:             underly well-known Open Source licenses (e.g. the GNU
                   9183:             Public License, GPL) won't have any special license
                   9184:             tags added in pkgsrc which require special action by
                   9185:             the user of such packages, but there are quite a number
                   9186:             of other licenses out there that pkgsrc users may not
                   9187:             be able to follow, for whatever reasons. For these
                   9188:             cases, pkgsrc contains a mechanism to note that a
                   9189:             package underlies a certain license, and the user has
                   9190:             to accept the license before the package can be
                   9191:             installed.</p>
                   9192: 
                   9193:             <p>Placing a certain package under a certain license
1.7       wiz      9194:             works by setting the <code class=
                   9195:             "varname">LICENSE</code> variable to a string
                   9196:             identifying the license, e.g. in <a xmlns=
                   9197:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9198:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.7       wiz      9199:             class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    9200:             <pre class="programlisting">
                   9201: LICENSE=        graphviz-license
                   9202: </pre>
                   9203: 
                   9204:             <p>When trying to build, the user will get a notice
                   9205:             that the package underlies a license which he hasn't
                   9206:             accepted (yet):</p>
                   9207:             <pre class="programlisting">
1.7       wiz      9208: <code class="prompt">%</code> <strong class=
                   9209: "userinput"><code>make</code></strong>
1.1       grant    9210: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   9211: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   9212: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   9213: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   9214: *** Error code 1
                   9215: </pre>
                   9216: 
1.7       wiz      9217:             <p>The license can be viewed with <span><strong class=
                   9218:             "command">make show-license</strong></span>, and if it
                   9219:             is considered appropriate, the line printed above can
                   9220:             be added to <code class="filename">/etc/mk.conf</code>
                   9221:             to indicate acceptance of the particular license:</p>
1.1       grant    9222:             <pre class="programlisting">
                   9223: ACCEPTABLE_LICENSES+=graphviz-license
                   9224: </pre>
                   9225: 
                   9226:             <p>When adding a package with a new license, the
1.7       wiz      9227:             license text should be added to <code class=
                   9228:             "filename">pkgsrc/licenses</code> for displaying. A
                   9229:             list of known licenses can be seen in this directory as
                   9230:             well as by looking at the list of (commented out)
                   9231:             <code class="varname">ACCEPTABLE_LICENSES</code>
                   9232:             variable settings in <code class=
1.11    ! ben      9233:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    9234: 
                   9235:             <p>Is there is a <span class=
                   9236:             "emphasis"><em>really</em></span> pressing need to
                   9237:             accept all licenses at once, like when trying to
                   9238:             download or mirror all distfiles or doing a bulk build
                   9239:             to test if all packages in pkgsrc build, this can be
1.7       wiz      9240:             done by setting <code class=
                   9241:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    9242:           </div>
                   9243: 
                   9244:           <div class="sect2" lang="en" xml:lang="en">
                   9245:             <div class="titlepage">
                   9246:               <div>
                   9247:                 <div>
1.11    ! ben      9248:                   <h3 class="title"><a name="id2592616" id=
        !          9249:                   "id2592616"></a>12.5.4.&nbsp;Creating an account
1.1       grant    9250:                   from a package</h3>
                   9251:                 </div>
                   9252:               </div>
                   9253:             </div>
                   9254: 
                   9255:             <p>There are two make variables used to control the
                   9256:             creation of package-specific groups and users at
1.7       wiz      9257:             pre-install time. The first is <code class=
                   9258:             "varname">PKG_GROUPS</code>, which is a list of
1.1       grant    9259:             group[:groupid] elements, where the groupid is
1.7       wiz      9260:             optional. The second is <code class=
                   9261:             "varname">PKG_USERS</code>, which is a list of elements
1.1       grant    9262:             of the form:</p>
                   9263:             <pre class="programlisting">
                   9264: user:group[:[userid][:[description][:[home][:shell]]]]
                   9265: </pre>
                   9266: 
                   9267:             <p>where only the user and group are required, the rest
                   9268:             being optional. A simple example is:</p>
                   9269:             <pre class="programlisting">
                   9270:   PKG_GROUPS=       foogroup
                   9271:     PKG_USERS=    foouser:foogroup
                   9272: </pre>
                   9273: 
                   9274:             <p>A more complex example is that creates two groups
                   9275:             and two users is:</p>
                   9276:             <pre class="programlisting">
                   9277:   PKG_GROUPS=       group1 group2:1005
                   9278:     PKG_USERS=    first:group1::First\\ User                      \
                   9279:                   second:group2::Second\\ User:/home/second:${SH}
                   9280: </pre>
                   9281: 
                   9282:             <p>By default, a new user will have home directory
1.7       wiz      9283:             <code class="filename">/nonexistent</code>, and login
                   9284:             shell <code class="filename">/sbin/nologin</code>
                   9285:             unless they are specified as part of the user
                   9286:             element.</p>
1.1       grant    9287: 
1.7       wiz      9288:             <p>The package <code class="filename">Makefile</code>
                   9289:             must also set <code class=
                   9290:             "varname">USE_PKGINSTALL=YES</code>. This will cause
                   9291:             the users and groups to be created at pre-install time,
                   9292:             and the admin will be prompted to remove them at
                   9293:             post-deinstall time. Automatic creation of the users
                   9294:             and groups can be toggled on and off by setting the
                   9295:             <code class="varname">PKG_CREATE_USERGROUP</code>
                   9296:             variable prior to package installation.</p>
1.1       grant    9297:           </div>
                   9298: 
                   9299:           <div class="sect2" lang="en" xml:lang="en">
                   9300:             <div class="titlepage">
                   9301:               <div>
                   9302:                 <div>
1.11    ! ben      9303:                   <h3 class="title"><a name="id2592678" id=
        !          9304:                   "id2592678"></a>12.5.5.&nbsp;Installing score
1.1       grant    9305:                   files</h3>
                   9306:                 </div>
                   9307:               </div>
                   9308:             </div>
                   9309: 
                   9310:             <p>Certain packages, most of them in the games
                   9311:             category, install a score file that allows all users on
                   9312:             the system to record their highscores. In order for
                   9313:             this to work, the binaries need to be installed setgid
                   9314:             and the score files owned by the appropriate group
                   9315:             and/or owner (traditionally the "games" user/group).
                   9316:             The following variables, documented in more detail in
1.11    ! ben      9317:             <code class="filename">mk/defaults/mk.conf</code>,
1.7       wiz      9318:             control this behaviour: <code class=
                   9319:             "varname">SETGIDGAME</code>, <code class=
                   9320:             "varname">GAMEDATAMODE</code>, <code class=
                   9321:             "varname">GAMEGRP</code>, <code class=
                   9322:             "varname">GAMEMODE</code>, <code class=
                   9323:             "varname">GAMEOWN</code>.</p>
1.1       grant    9324: 
                   9325:             <p>Note that per default, setgid installation of games
1.7       wiz      9326:             is disabled; setting <code class=
                   9327:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    9328:             variables accordingly.</p>
                   9329: 
                   9330:             <p>A package should therefor never hard code file
1.7       wiz      9331:             ownership or access permissions but rely on
                   9332:             <code class="varname">INSTALL_GAME</code> and
                   9333:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   9334:             these correctly.</p>
1.1       grant    9335:           </div>
                   9336: 
                   9337:           <div class="sect2" lang="en" xml:lang="en">
                   9338:             <div class="titlepage">
                   9339:               <div>
                   9340:                 <div>
1.11    ! ben      9341:                   <h3 class="title"><a name="id2592858" id=
        !          9342:                   "id2592858"></a>12.5.6.&nbsp;Packages providing
1.1       grant    9343:                   login shells</h3>
                   9344:                 </div>
                   9345:               </div>
                   9346:             </div>
                   9347: 
                   9348:             <p>If the purpose of the package is to provide a login
1.7       wiz      9349:             shell, the variable <code class=
                   9350:             "varname">PKG_SHELL</code> should contain the full
                   9351:             pathname of the shell executable installed by this
                   9352:             package. The package <code class=
                   9353:             "filename">Makefile</code> must also set <code class=
                   9354:             "varname">USE_PKGINSTALL=YES</code> to use the
                   9355:             automatically generated <code class=
                   9356:             "filename">INSTALL</code>/<code class=
                   9357:             "filename">DEINSTALL</code> scripts.</p>
1.1       grant    9358: 
                   9359:             <p>An example taken from shells/zsh:</p>
                   9360:             <pre class="programlisting">
                   9361:   USE_PKGINSTALL=   YES
                   9362:     PKG_SHELL=    ${PREFIX}/bin/zsh
                   9363: </pre>
                   9364: 
1.7       wiz      9365:             <p>The shell is registered into <code class=
                   9366:             "filename">/etc/shells</code> file automatically in the
                   9367:             post-install target by the generated <code class=
                   9368:             "filename">INSTALL</code> script and removed in the
                   9369:             deinstall target by the <code class=
                   9370:             "filename">DEINSTALL</code> script.</p>
1.1       grant    9371:           </div>
                   9372: 
                   9373:           <div class="sect2" lang="en" xml:lang="en">
                   9374:             <div class="titlepage">
                   9375:               <div>
                   9376:                 <div>
1.11    ! ben      9377:                   <h3 class="title"><a name="id2592984" id=
        !          9378:                   "id2592984"></a>12.5.7.&nbsp;Packages containing
1.1       grant    9379:                   perl scripts</h3>
                   9380:                 </div>
                   9381:               </div>
                   9382:             </div>
                   9383: 
                   9384:             <p>If your package contains interpreted perl scripts,
1.7       wiz      9385:             set <code class="varname">REPLACE_PERL</code> to ensure
                   9386:             that the proper interpreter path is set. <code class=
                   9387:             "varname">REPLACE_PERL</code> should contain a list of
                   9388:             scripts, relative to <code class=
                   9389:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    9390:           </div>
                   9391: 
                   9392:           <div class="sect2" lang="en" xml:lang="en">
                   9393:             <div class="titlepage">
                   9394:               <div>
                   9395:                 <div>
1.11    ! ben      9396:                   <h3 class="title"><a name="id2593002" id=
        !          9397:                   "id2593002"></a>12.5.8.&nbsp;Packages with
1.1       grant    9398:                   hardcoded paths to other interpreters</h3>
                   9399:                 </div>
                   9400:               </div>
                   9401:             </div>
                   9402: 
                   9403:             <p>Your package may also contain scripts with hardcoded
                   9404:             paths to other interpreters besides (or as well as)
                   9405:             perl. To correct the full pathname to the script
                   9406:             interpreter, you need to set the following definitions
1.7       wiz      9407:             in your <code class="filename">Makefile</code> (we
                   9408:             shall use <span><strong class=
                   9409:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    9410:             <pre class="programlisting">
                   9411:   REPLACE_INTERPRETER+=     tcl
                   9412:     _REPLACE.tcl.old=     .*/bin/tclsh
                   9413:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   9414:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   9415:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   9416: </pre>
                   9417:           </div>
                   9418: 
                   9419:           <div class="sect2" lang="en" xml:lang="en">
                   9420:             <div class="titlepage">
                   9421:               <div>
                   9422:                 <div>
1.11    ! ben      9423:                   <h3 class="title"><a name="id2593024" id=
        !          9424:                   "id2593024"></a>12.5.9.&nbsp;Packages installing
1.1       grant    9425:                   perl modules</h3>
                   9426:                 </div>
                   9427:               </div>
                   9428:             </div>
                   9429: 
                   9430:             <p>Makefiles of packages providing perl5 modules should
1.7       wiz      9431:             include the Makefile fragment <code class=
                   9432:             "filename">../../lang/perl5/module.mk</code>. It
                   9433:             provides a <span><strong class=
                   9434:             "command">do-configure</strong></span> target for the
                   9435:             standard perl configuration for such modules as well as
                   9436:             various hooks to tune this configuration. See comments
                   9437:             in this file for details.</p>
1.1       grant    9438: 
                   9439:             <p>Perl5 modules will install into different places
                   9440:             depending on the version of perl used during the build
                   9441:             process. To address this, pkgsrc will append lines to
1.7       wiz      9442:             the <code class="filename">PLIST</code> corresponding
                   9443:             to the files listed in the installed <code class=
                   9444:             "filename">.packlist</code> file generated by most
                   9445:             perl5 modules. This is invoked by defining <code class=
                   9446:             "varname">PERL5_PACKLIST</code> to a space-separated
                   9447:             list of paths to packlist files, e.g.:</p>
1.1       grant    9448:             <pre class="programlisting">
                   9449: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   9450: </pre>
                   9451: 
1.7       wiz      9452:             <p>The variables <code class=
                   9453:             "varname">PERL5_SITELIB</code>, <code class=
                   9454:             "varname">PERL5_SITEARCH</code>, and <code class=
                   9455:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    9456:             locations in which perl5 modules may be installed, and
                   9457:             may be used by perl5 packages that don't have a
                   9458:             packlist. These three variables are also substituted
1.7       wiz      9459:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    9460:           </div>
                   9461: 
                   9462:           <div class="sect2" lang="en" xml:lang="en">
                   9463:             <div class="titlepage">
                   9464:               <div>
                   9465:                 <div>
                   9466:                   <h3 class="title"><a name="faq.info-files" id=
                   9467:                   "faq.info-files"></a>12.5.10.&nbsp;Packages
                   9468:                   installing info files</h3>
                   9469:                 </div>
                   9470:               </div>
                   9471:             </div>
                   9472: 
                   9473:             <p>Some packages install info files or use the
                   9474:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   9475:             &#8220;<span class="quote">install-info</span>&#8221;
                   9476:             commands. Each of the info files:</p>
                   9477: 
                   9478:             <div class="itemizedlist">
                   9479:               <ul type="disc">
                   9480:                 <li>
                   9481:                   <p>is considered to be installed in the directory
1.7       wiz      9482:                   <code class=
                   9483:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    9484:                 </li>
                   9485: 
                   9486:                 <li>
                   9487:                   <p>is registered in the Info directory file
1.7       wiz      9488:                   <code class=
                   9489:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    9490:                 </li>
                   9491: 
                   9492:                 <li>
                   9493:                   <p>and must be listed as a filename in the
1.7       wiz      9494:                   <code class="varname">INFO_FILES</code> variable
                   9495:                   in the package Makefile.</p>
1.1       grant    9496:                 </li>
                   9497:               </ul>
                   9498:             </div>
                   9499: 
1.7       wiz      9500:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    9501:             &#8220;<span class="quote">info</span>&#8221; and can
1.7       wiz      9502:             be overridden in the package Makefile. <code class=
                   9503:             "filename">INSTALL</code> and <code class=
                   9504:             "filename">DEINSTALL</code> scripts will be generated
                   9505:             to handle registration of the info files in the Info
1.1       grant    9506:             directory file. The &#8220;<span class=
                   9507:             "quote">install-info</span>&#8221; command used for the
                   9508:             info files registration is either provided by the
                   9509:             system, or by a special purpose package automatically
                   9510:             added as dependency if needed.</p>
                   9511: 
                   9512:             <p>A package which needs the &#8220;<span class=
                   9513:             "quote">makeinfo</span>&#8221; command at build time
1.7       wiz      9514:             must define the variable <code class=
                   9515:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    9516:             minimum version of the &#8220;<span class=
                   9517:             "quote">makeinfo</span>&#8221; command is needed it
1.7       wiz      9518:             should be noted with the <code class=
                   9519:             "varname">TEXINFO_REQD</code> variable in the package
                   9520:             <code class="filename">Makefile</code>. By default, a
1.1       grant    9521:             minimum version of 3.12 is required. If the system does
1.7       wiz      9522:             not provide a <span><strong class=
                   9523:             "command">makeinfo</strong></span> command or if it
                   9524:             does not match the required minimum, a build dependency
                   9525:             on the <a xmlns=
                   9526:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9527:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.7       wiz      9528:             class="pkgname">devel/gtexinfo</a> package will be
                   9529:             added automatically.</p>
1.1       grant    9530: 
                   9531:             <p>The build and installation process of the software
                   9532:             provided by the package should not use the
1.7       wiz      9533:             <span><strong class=
                   9534:             "command">install-info</strong></span> command as the
                   9535:             registration of info files is the task of the package
                   9536:             <code class="filename">INSTALL</code> script, and it
                   9537:             must use the appropriate <span><strong class=
                   9538:             "command">makeinfo</strong></span> command.</p>
1.1       grant    9539: 
                   9540:             <p>To achieve this goal the pkgsrc infrastructure
1.7       wiz      9541:             creates overriding scripts for the <span><strong class=
                   9542:             "command">install-info</strong></span> and
                   9543:             <span><strong class="command">makeinfo</strong></span>
                   9544:             commands in a directory listed early in <code class=
                   9545:             "varname">PATH</code>.</p>
1.1       grant    9546: 
1.7       wiz      9547:             <p>The script overriding <span><strong class=
                   9548:             "command">install-info</strong></span> has no effect
                   9549:             except the logging of a message. The script overriding
                   9550:             <span><strong class="command">makeinfo</strong></span>
                   9551:             logs a message and according to the value of
                   9552:             <code class="varname">USE_MAKEINFO</code> and
                   9553:             <code class="varname">TEXINFO_REQD</code> either run
                   9554:             the appropriate <span><strong class=
                   9555:             "command">makeinfo</strong></span> command or exit on
                   9556:             error.</p>
1.1       grant    9557:           </div>
                   9558: 
                   9559:           <div class="sect2" lang="en" xml:lang="en">
                   9560:             <div class="titlepage">
                   9561:               <div>
                   9562:                 <div>
1.11    ! ben      9563:                   <h3 class="title"><a name="id2593380" id=
        !          9564:                   "id2593380"></a>12.5.11.&nbsp;Packages installing
1.1       grant    9565:                   GConf2 data files</h3>
                   9566:                 </div>
                   9567:               </div>
                   9568:             </div>
                   9569: 
1.7       wiz      9570:             <p>If a package installs <code class=
                   9571:             "filename">.schemas</code> or <code class=
                   9572:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    9573:             need to take some extra steps to make sure they get
                   9574:             registered in the database:</p>
                   9575: 
                   9576:             <div class="orderedlist">
                   9577:               <ol type="1">
                   9578:                 <li>
1.7       wiz      9579:                   <p>Include <code class=
                   9580:                   "filename">../../devel/GConf2/schemas.mk</code>
                   9581:                   instead of its <code class=
                   9582:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9583:                   care of rebuilding the GConf2 database at
                   9584:                   installation and deinstallation time, and tells
                   9585:                   the package where to install GConf2 data files
                   9586:                   using some standard configure arguments. It also
                   9587:                   disallows any access to the database directly
                   9588:                   from the package.</p>
                   9589:                 </li>
                   9590: 
                   9591:                 <li>
                   9592:                   <p>Ensure that the package installs its
1.7       wiz      9593:                   <code class="filename">.schemas</code> files
                   9594:                   under <code class=
                   9595:                   "filename">${PREFIX}/share/gconf/schemas</code>.
                   9596:                   If they get installed under <code class=
                   9597:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    9598:                   manually patch the package.</p>
                   9599:                 </li>
                   9600: 
                   9601:                 <li>
                   9602:                   <p>Check the PLIST and remove any entries under
                   9603:                   the etc/gconf directory, as they will be handled
                   9604:                   automatically. See <a href="#faq.conf" title=
                   9605:                   "6.13.&nbsp;Configuration files handling and placement">
                   9606:                   Section&nbsp;6.13, &#8220;Configuration files
                   9607:                   handling and placement&#8221;</a> for more
                   9608:                   information.</p>
                   9609:                 </li>
                   9610: 
                   9611:                 <li>
1.7       wiz      9612:                   <p>Define the <code class=
                   9613:                   "varname">GCONF2_SCHEMAS</code> variable in your
                   9614:                   <code class="filename">Makefile</code> with a
                   9615:                   list of all <code class=
                   9616:                   "filename">.schemas</code> files installed by the
                   9617:                   package, if any. Names must not contain any
                   9618:                   directories in them.</p>
1.1       grant    9619:                 </li>
                   9620: 
                   9621:                 <li>
1.7       wiz      9622:                   <p>Define the <code class=
                   9623:                   "varname">GCONF2_ENTRIES</code> variable in your
                   9624:                   <code class="filename">Makefile</code> with a
                   9625:                   list of all <code class=
                   9626:                   "filename">.entries</code> files installed by the
                   9627:                   package, if any. Names must not contain any
                   9628:                   directories in them.</p>
1.1       grant    9629:                 </li>
                   9630:               </ol>
                   9631:             </div>
                   9632:           </div>
                   9633: 
                   9634:           <div class="sect2" lang="en" xml:lang="en">
                   9635:             <div class="titlepage">
                   9636:               <div>
                   9637:                 <div>
1.11    ! ben      9638:                   <h3 class="title"><a name="id2593480" id=
        !          9639:                   "id2593480"></a>12.5.12.&nbsp;Packages installing
1.1       grant    9640:                   scrollkeeper data files</h3>
                   9641:                 </div>
                   9642:               </div>
                   9643:             </div>
                   9644: 
1.7       wiz      9645:             <p>If a package installs <code class=
                   9646:             "filename">.omf</code> files, used by scrollkeeper, you
                   9647:             need to take some extra steps to make sure they get
                   9648:             registered in the database:</p>
1.1       grant    9649: 
                   9650:             <div class="orderedlist">
                   9651:               <ol type="1">
                   9652:                 <li>
1.7       wiz      9653:                   <p>Include <code class=
                   9654:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
                   9655:                   instead of its <code class=
                   9656:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9657:                   care of rebuilding the scrollkeeper database at
                   9658:                   installation and deinstallation time, and
                   9659:                   disallows any access to it directly from the
                   9660:                   package.</p>
                   9661:                 </li>
                   9662: 
                   9663:                 <li>
                   9664:                   <p>Check the PLIST and remove any entries under
1.7       wiz      9665:                   the <code class=
                   9666:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    9667:                   as they will be handled automatically.</p>
                   9668:                 </li>
                   9669: 
                   9670:                 <li>
1.7       wiz      9671:                   <p>Remove the <code class=
                   9672:                   "filename">share/omf</code> directory from the
                   9673:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    9674:                 </li>
                   9675:               </ol>
                   9676:             </div>
                   9677:           </div>
                   9678: 
                   9679:           <div class="sect2" lang="en" xml:lang="en">
                   9680:             <div class="titlepage">
                   9681:               <div>
                   9682:                 <div>
1.11    ! ben      9683:                   <h3 class="title"><a name="id2593531" id=
        !          9684:                   "id2593531"></a>12.5.13.&nbsp;Packages installing
1.1       grant    9685:                   X11 fonts</h3>
                   9686:                 </div>
                   9687:               </div>
                   9688:             </div>
                   9689: 
                   9690:             <p>If a package installs font files, you will need to
                   9691:             rebuild the fonts database in the directory where they
                   9692:             get installed at installation and deinstallation time.
1.7       wiz      9693:             This can be automatically done by using <code class=
                   9694:             "filename">mk/fonts.mk</code>, which you need to
                   9695:             include in your <code class=
                   9696:             "filename">Makefile</code>.</p>
1.1       grant    9697: 
                   9698:             <p>When the file is included, you can list the
1.7       wiz      9699:             directories where fonts are installed in the
                   9700:             <code class="varname">FONTS_<em class=
                   9701:             "replaceable"><code>type</code></em>_DIRS</code>
                   9702:             variables, where <em class=
                   9703:             "replaceable"><code>type</code></em> can be one of
                   9704:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    9705:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   9706:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.7       wiz      9707:             sure that the database file <code class=
                   9708:             "filename">fonts.dir</code> is not listed in the
1.1       grant    9709:             PLIST.</p>
                   9710: 
                   9711:             <p>Note that you should not create new directories for
                   9712:             fonts; instead use the standard ones to avoid that the
                   9713:             user needs to manually configure his X server to find
                   9714:             them.</p>
                   9715:           </div>
                   9716: 
                   9717:           <div class="sect2" lang="en" xml:lang="en">
                   9718:             <div class="titlepage">
                   9719:               <div>
                   9720:                 <div>
1.11    ! ben      9721:                   <h3 class="title"><a name="id2593578" id=
        !          9722:                   "id2593578"></a>12.5.14.&nbsp;Packages installing
1.1       grant    9723:                   GTK2 modules</h3>
                   9724:                 </div>
                   9725:               </div>
                   9726:             </div>
                   9727: 
                   9728:             <p>If a package installs gtk2 immodules or loaders, you
                   9729:             need to take some extra steps to get them registered in
                   9730:             the GTK2 database properly:</p>
                   9731: 
                   9732:             <div class="orderedlist">
                   9733:               <ol type="1">
                   9734:                 <li>
1.7       wiz      9735:                   <p>Include <code class=
                   9736:                   "filename">../../x11/gtk2/modules.mk</code>
                   9737:                   instead of its <code class=
                   9738:                   "filename">buildlink3.mk</code> file. This takes
                   9739:                   care of rebuilding the database at installation
                   9740:                   and deinstallation time.</p>
1.1       grant    9741:                 </li>
                   9742: 
                   9743:                 <li>
1.7       wiz      9744:                   <p>Set <code class=
                   9745:                   "varname">GTK2_IMMODULES=YES</code> if your
                   9746:                   package installs GTK2 immodules.</p>
1.1       grant    9747:                 </li>
                   9748: 
                   9749:                 <li>
1.7       wiz      9750:                   <p>Set <code class=
                   9751:                   "varname">GTK2_LOADERS=YES</code> if your package
                   9752:                   installs GTK2 loaders.</p>
1.1       grant    9753:                 </li>
                   9754: 
                   9755:                 <li>
                   9756:                   <p>Patch the package to not touch any of the gtk2
                   9757:                   databases directly. These are:</p>
                   9758: 
                   9759:                   <div class="itemizedlist">
                   9760:                     <ul type="disc">
                   9761:                       <li>
1.7       wiz      9762:                         <p><code class=
                   9763:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    9764:                       </li>
                   9765: 
                   9766:                       <li>
1.7       wiz      9767:                         <p><code class=
                   9768:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    9769:                       </li>
                   9770:                     </ul>
                   9771:                   </div>
                   9772:                 </li>
                   9773: 
                   9774:                 <li>
                   9775:                   <p>Check the PLIST and remove any entries under
1.7       wiz      9776:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    9777:                   directory, as they will be handled
                   9778:                   automatically.</p>
                   9779:                 </li>
                   9780:               </ol>
                   9781:             </div>
                   9782:           </div>
                   9783: 
                   9784:           <div class="sect2" lang="en" xml:lang="en">
                   9785:             <div class="titlepage">
                   9786:               <div>
                   9787:                 <div>
1.11    ! ben      9788:                   <h3 class="title"><a name="id2593648" id=
        !          9789:                   "id2593648"></a>12.5.15.&nbsp;Packages installing
1.1       grant    9790:                   SGML or XML data</h3>
                   9791:                 </div>
                   9792:               </div>
                   9793:             </div>
                   9794: 
                   9795:             <p>If a package installs SGML or XML data files that
                   9796:             need to be registered in system-wide catalogs (like
                   9797:             DTDs, sub-catalogs, etc.), you need to take some extra
                   9798:             steps:</p>
                   9799: 
                   9800:             <div class="orderedlist">
                   9801:               <ol type="1">
                   9802:                 <li>
1.7       wiz      9803:                   <p>Include <code class=
                   9804:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
                   9805:                   in your <code class="filename">Makefile</code>,
                   9806:                   which takes care of registering those files in
1.1       grant    9807:                   system-wide catalogs at installation and
                   9808:                   deinstallation time.</p>
                   9809:                 </li>
                   9810: 
                   9811:                 <li>
1.7       wiz      9812:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   9813:                   to the full path of any SGML catalogs installed
                   9814:                   by the package.</p>
1.1       grant    9815:                 </li>
                   9816: 
                   9817:                 <li>
1.7       wiz      9818:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   9819:                   to the full path of any XML catalogs installed by
1.1       grant    9820:                   the package.</p>
                   9821:                 </li>
                   9822: 
                   9823:                 <li>
1.7       wiz      9824:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   9825:                   to individual entries to be added to the SGML
1.1       grant    9826:                   catalog. These come in groups of three strings;
                   9827:                   see xmlcatmgr(1) for more information
                   9828:                   (specifically, arguments recognized by the 'add'
                   9829:                   action). Note that you will normally not use this
                   9830:                   variable.</p>
                   9831:                 </li>
                   9832: 
                   9833:                 <li>
1.7       wiz      9834:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   9835:                   to individual entries to be added to the XML
1.1       grant    9836:                   catalog. These come in groups of three strings;
                   9837:                   see xmlcatmgr(1) for more information
                   9838:                   (specifically, arguments recognized by the 'add'
                   9839:                   action). Note that you will normally not use this
                   9840:                   variable.</p>
                   9841:                 </li>
                   9842:               </ol>
                   9843:             </div>
                   9844:           </div>
                   9845: 
                   9846:           <div class="sect2" lang="en" xml:lang="en">
                   9847:             <div class="titlepage">
                   9848:               <div>
                   9849:                 <div>
1.11    ! ben      9850:                   <h3 class="title"><a name="id2593700" id=
        !          9851:                   "id2593700"></a>12.5.16.&nbsp;Packages installing
1.1       grant    9852:                   extensions to the MIME database</h3>
                   9853:                 </div>
                   9854:               </div>
                   9855:             </div>
                   9856: 
                   9857:             <p>If a package provides extensions to the MIME
1.7       wiz      9858:             database by installing <code class=
                   9859:             "filename">.xml</code> files inside <code class=
                   9860:             "filename">${PREFIX}/share/mime/packages</code>, you
                   9861:             need to take some extra steps to ensure that the
                   9862:             database is kept consistent with respect to these new
                   9863:             files:</p>
1.1       grant    9864: 
                   9865:             <div class="orderedlist">
                   9866:               <ol type="1">
                   9867:                 <li>
1.7       wiz      9868:                   <p>Include <code class=
                   9869:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
                   9870:                   (avoid using the <code class=
                   9871:                   "filename">buildlink3.mk</code> file from this
                   9872:                   same directory, which is reserved for inclusion
                   9873:                   from other <code class=
                   9874:                   "filename">buildlink3.mk</code> files). It takes
                   9875:                   care of rebuilding the MIME database at
                   9876:                   installation and deinstallation time, and
                   9877:                   disallows any access to it directly from the
1.1       grant    9878:                   package.</p>
                   9879:                 </li>
                   9880: 
                   9881:                 <li>
                   9882:                   <p>Check the PLIST and remove any entries under
1.7       wiz      9883:                   the <code class="filename">share/mime</code>
1.1       grant    9884:                   directory, <span class=
                   9885:                   "emphasis"><em>except</em></span> for files saved
1.7       wiz      9886:                   under <code class=
                   9887:                   "filename">share/mime/packages</code>. The former
1.1       grant    9888:                   are handled automatically by the
                   9889:                   update-mime-database program, but the later are
                   9890:                   package-dependent and must be removed by the
                   9891:                   package that installed them in the first
                   9892:                   place.</p>
                   9893:                 </li>
                   9894: 
                   9895:                 <li>
1.7       wiz      9896:                   <p>Remove any <code class=
                   9897:                   "filename">share/mime/*</code> directories from
                   9898:                   the PLIST. They will be handled by the
1.1       grant    9899:                   shared-mime-info package.</p>
                   9900:                 </li>
                   9901:               </ol>
                   9902:             </div>
                   9903:           </div>
                   9904: 
                   9905:           <div class="sect2" lang="en" xml:lang="en">
                   9906:             <div class="titlepage">
                   9907:               <div>
                   9908:                 <div>
1.11    ! ben      9909:                   <h3 class="title"><a name="id2593770" id=
        !          9910:                   "id2593770"></a>12.5.17.&nbsp;Packages using
1.1       grant    9911:                   intltool</h3>
                   9912:                 </div>
                   9913:               </div>
                   9914:             </div>
                   9915: 
                   9916:             <p>If a package uses intltool during its build, include
1.7       wiz      9917:             the <code class=
                   9918:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    9919:             file, which forces it to use the intltool package
                   9920:             provided by pkgsrc, instead of the one bundled with the
                   9921:             distribution file.</p>
                   9922: 
                   9923:             <p>This tracks intltool's build-time dependencies and
                   9924:             uses the latest available version; this way, the
                   9925:             package benefits of any bug fixes that may have
                   9926:             appeared since it was released.</p>
                   9927:           </div>
                   9928:         </div>
                   9929: 
                   9930:         <div class="sect1" lang="en" xml:lang="en">
                   9931:           <div class="titlepage">
                   9932:             <div>
                   9933:               <div>
                   9934:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      9935:                 "id2593784" id="id2593784"></a>12.6.&nbsp;Feedback
1.1       grant    9936:                 to the author</h2>
                   9937:               </div>
                   9938:             </div>
                   9939:           </div>
                   9940: 
                   9941:           <p>If you have found any bugs in the package you make
                   9942:           available, if you had to do special steps to make it run
                   9943:           under NetBSD or if you enhanced the software in various
                   9944:           other ways, be sure to report these changes back to the
                   9945:           original author of the program! With that kind of
                   9946:           support, the next release of the program can incorporate
                   9947:           these fixes, and people not using the NetBSD packages
                   9948:           system can win from your efforts.</p>
                   9949: 
                   9950:           <p>Support the idea of free software!</p>
                   9951:         </div>
                   9952:       </div>
                   9953: 
                   9954:       <div class="chapter" lang="en" xml:lang="en">
                   9955:         <div class="titlepage">
                   9956:           <div>
                   9957:             <div>
                   9958:               <h2 class="title"><a name="debug" id=
                   9959:               "debug"></a>Chapter&nbsp;13.&nbsp;Debugging</h2>
                   9960:             </div>
                   9961:           </div>
                   9962:         </div>
                   9963: 
                   9964:         <p>To check out all the gotchas when building a package,
                   9965:         here are the steps that I do in order to get a package
                   9966:         working. Please note this is basically the same as what was
                   9967:         explained in the previous sections, only with some
                   9968:         debugging aids.</p>
                   9969: 
                   9970:         <div class="itemizedlist">
                   9971:           <ul type="disc">
                   9972:             <li>
1.7       wiz      9973:               <p>Be sure to set <code class=
                   9974:               "varname">PKG_DEVELOPER=1</code> in <code class=
                   9975:               "filename">/etc/mk.conf</code></p>
1.1       grant    9976:             </li>
                   9977: 
                   9978:             <li>
                   9979:               <p>Install <a xmlns=
                   9980:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   9981:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.7       wiz      9982:               class="pkgname">pkgtools/url2pkg</a>, create a
                   9983:               directory for a new package, change into it, then run
                   9984:               <span><strong class=
                   9985:               "command">url2pkg</strong></span>:</p>
1.1       grant    9986:               <pre class="screen">
1.7       wiz      9987: <code class="prompt">%</code> <strong class=
                   9988: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   9989: "replaceable"><code>category</code></em>/<em class=
                   9990: "replaceable"><code>examplepkg</code></em></code></strong>
                   9991: <code class="prompt">%</code> <strong class=
                   9992: "userinput"><code>cd /usr/pkgsrc/<em class=
                   9993: "replaceable"><code>category</code></em>/<em class=
                   9994: "replaceable"><code>examplepkg</code></em></code></strong>
                   9995: <code class="prompt">%</code> <strong class=
                   9996: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    9997: </pre>
                   9998:             </li>
                   9999: 
                   10000:             <li>
1.7       wiz      10001:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    10002:               requested.</p>
                   10003:             </li>
                   10004: 
                   10005:             <li>
1.7       wiz      10006:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    10007:               file</p>
                   10008:             </li>
                   10009: 
                   10010:             <li>
1.7       wiz      10011:               <p>Run <span><strong class="command">make
                   10012:               configure</strong></span></p>
1.1       grant    10013:             </li>
                   10014: 
                   10015:             <li>
                   10016:               <p>Add any dependencies glimpsed from documentation
1.7       wiz      10017:               and the configure step to the package's <code class=
                   10018:               "filename">Makefile</code>.</p>
1.1       grant    10019:             </li>
                   10020: 
                   10021:             <li>
                   10022:               <p>Make the package compile, doing multiple rounds
                   10023:               of</p>
                   10024:               <pre class="screen">
1.7       wiz      10025: <code class="prompt">%</code> <strong class=
                   10026: "userinput"><code>make</code></strong>
                   10027: <code class="prompt">%</code> <strong class=
                   10028: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   10029: <code class="prompt">%</code> <strong class=
                   10030: "userinput"><code>mkpatches</code></strong>
                   10031: <code class="prompt">%</code> <strong class=
                   10032: "userinput"><code>patchdiff</code></strong>
                   10033: <code class="prompt">%</code> <strong class=
                   10034: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   10035: <code class="prompt">%</code> <strong class=
                   10036: "userinput"><code>make mps</code></strong>
                   10037: <code class="prompt">%</code> <strong class=
                   10038: "userinput"><code>make clean</code></strong>
1.1       grant    10039: </pre>
                   10040: 
                   10041:               <p>Doing as non-root user will ensure that no files
                   10042:               are modified that shouldn't be, especially during the
1.7       wiz      10043:               build phase. <span><strong class=
                   10044:               "command">mkpatches</strong></span>,
                   10045:               <span><strong class=
                   10046:               "command">patchdiff</strong></span> and
                   10047:               <span><strong class="command">pkgvi</strong></span>
                   10048:               are from the <a xmlns=
1.1       grant    10049:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10050:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.7       wiz      10051:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    10052:             </li>
                   10053: 
                   10054:             <li>
1.7       wiz      10055:               <p>Look at the <code class=
                   10056:               "filename">Makefile</code>, fix if necessary; see
                   10057:               <a href="#components.Makefile" title=
                   10058:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
                   10059:               &#8220;<code class=
                   10060:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    10061:             </li>
                   10062: 
                   10063:             <li>
1.7       wiz      10064:               <p>Generate a <code class=
                   10065:               "filename">PLIST</code>:</p>
1.1       grant    10066:               <pre class="screen">
1.7       wiz      10067: <code class="prompt">#</code> <strong class=
                   10068: "userinput"><code>make install</code></strong>
                   10069: <code class="prompt">#</code> <strong class=
                   10070: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   10071: <code class="prompt">#</code> <strong class=
                   10072: "userinput"><code>make deinstall</code></strong>
                   10073: <code class="prompt">#</code> <strong class=
                   10074: "userinput"><code>make install</code></strong>
                   10075: <code class="prompt">#</code> <strong class=
                   10076: "userinput"><code>make deinstall</code></strong>
1.1       grant    10077: </pre>
                   10078: 
1.7       wiz      10079:               <p>You usually need to be <code class=
                   10080:               "username">root</code> to do this. Look if there are
1.1       grant    10081:               any files left:</p>
                   10082:               <pre class="screen">
1.7       wiz      10083: <code class="prompt">#</code> <strong class=
                   10084: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10085: </pre>
                   10086: 
                   10087:               <p>If this reveals any files that are missing in
1.7       wiz      10088:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    10089:             </li>
                   10090: 
                   10091:             <li>
1.7       wiz      10092:               <p>Now that the <code class="filename">PLIST</code>
                   10093:               is OK, install the package again and make a binary
1.1       grant    10094:               package:</p>
                   10095:               <pre class="screen">
1.7       wiz      10096: <code class="prompt">#</code> <strong class=
                   10097: "userinput"><code>make reinstall</code></strong>
                   10098: <code class="prompt">#</code> <strong class=
                   10099: "userinput"><code>make package</code></strong>
1.1       grant    10100: </pre>
                   10101:             </li>
                   10102: 
                   10103:             <li>
                   10104:               <p>Delete the installed package:</p>
                   10105:               <pre class="screen">
1.7       wiz      10106: <code class="prompt">#</code> <strong class=
                   10107: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    10108: </pre>
                   10109:             </li>
                   10110: 
                   10111:             <li>
1.7       wiz      10112:               <p>Repeat the above <span><strong class=
                   10113:               "command">make print-PLIST</strong></span> command,
                   10114:               which shouldn't find anything now:</p>
1.1       grant    10115:               <pre class="screen">
1.7       wiz      10116: <code class="prompt">#</code> <strong class=
                   10117: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10118: </pre>
                   10119:             </li>
                   10120: 
                   10121:             <li>
                   10122:               <p>Reinstall the binary package:</p>
                   10123:               <pre class="screen">
1.7       wiz      10124: <code class="prompt">#</code> <strong class=
                   10125: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    10126: </pre>
                   10127:             </li>
                   10128: 
                   10129:             <li>
                   10130:               <p>Play with it. Make sure everything works.</p>
                   10131:             </li>
                   10132: 
                   10133:             <li>
1.7       wiz      10134:               <p>Run <span><strong class=
                   10135:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    10136:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10137:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.7       wiz      10138:               class="pkgname">pkgtools/pkglint</a>, and fix the
                   10139:               problems it reports:</p>
1.1       grant    10140:               <pre class="screen">
1.7       wiz      10141: <code class="prompt">#</code> <strong class=
                   10142: "userinput"><code>pkglint</code></strong>
1.1       grant    10143: </pre>
                   10144:             </li>
                   10145: 
                   10146:             <li>
                   10147:               <p>Submit (or commit, if you have cvs access); see
                   10148:               <a href="#submit" title=
                   10149:               "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter&nbsp;14,
                   10150:               <i>Submitting and Committing</i></a>.</p>
                   10151:             </li>
                   10152:           </ul>
                   10153:         </div>
                   10154:       </div>
                   10155: 
                   10156:       <div class="chapter" lang="en" xml:lang="en">
                   10157:         <div class="titlepage">
                   10158:           <div>
                   10159:             <div>
                   10160:               <h2 class="title"><a name="submit" id=
                   10161:               "submit"></a>Chapter&nbsp;14.&nbsp;Submitting and
                   10162:               Committing</h2>
                   10163:             </div>
                   10164:           </div>
                   10165:         </div>
                   10166: 
                   10167:         <div class="toc">
                   10168:           <p><b>Table of Contents</b></p>
                   10169: 
                   10170:           <dl>
1.11    ! ben      10171:             <dt><span class="sect1"><a href="#id2594314">14.1.
1.1       grant    10172:             Submitting your packages</a></span></dt>
                   10173: 
1.11    ! ben      10174:             <dt><span class="sect1"><a href="#id2594361">14.2.
1.1       grant    10175:             Committing: Importing a package into
                   10176:             CVS</a></span></dt>
                   10177: 
1.11    ! ben      10178:             <dt><span class="sect1"><a href="#id2594492">14.3.
1.2       hubertf  10179:             Updating a package to a newer version</a></span></dt>
1.1       grant    10180: 
1.11    ! ben      10181:             <dt><span class="sect1"><a href="#id2594512">14.4.
1.2       hubertf  10182:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    10183:           </dl>
                   10184:         </div>
                   10185: 
                   10186:         <div class="sect1" lang="en" xml:lang="en">
                   10187:           <div class="titlepage">
                   10188:             <div>
                   10189:               <div>
                   10190:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      10191:                 "id2594314" id=
        !          10192:                 "id2594314"></a>14.1.&nbsp;Submitting your
1.1       grant    10193:                 packages</h2>
                   10194:               </div>
                   10195:             </div>
                   10196:           </div>
                   10197: 
                   10198:           <p>You have to separate between binary and
                   10199:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   10200:           packages here:</p>
                   10201: 
                   10202:           <div class="itemizedlist">
                   10203:             <ul type="disc">
                   10204:               <li>
                   10205:                 <p>precompiled binary packages</p>
                   10206: 
                   10207:                 <p>Our policy is that we accept binaries only from
                   10208:                 pkgsrc developers to guarantee that the packages
                   10209:                 don't contain any trojan horses etc. This is not to
                   10210:                 piss anyone off but rather to protect our users!
                   10211:                 You're still free to put up your home-made binary
                   10212:                 packages and tell the world where to get them.</p>
                   10213:               </li>
                   10214: 
                   10215:               <li>
                   10216:                 <p>packages</p>
                   10217: 
                   10218:                 <p>First, check that your package is complete,
                   10219:                 compiles and runs well; see <a href="#debug" title=
                   10220:                 "Chapter&nbsp;13.&nbsp;Debugging">Chapter&nbsp;13,
                   10221:                 <i>Debugging</i></a> and the rest of this document.
                   10222:                 Next, generate an uuencoded gzipped tar(1) archive,
                   10223:                 preferably with all files in a single directory.
1.7       wiz      10224:                 Finally, <span><strong class=
                   10225:                 "command">send-pr</strong></span> with category
1.1       grant    10226:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   10227:                 synopsis which includes the package name and
                   10228:                 version number, a short description of your package
                   10229:                 (contents of the COMMENT variable or DESCR file are
                   10230:                 OK) and attach the archive to your PR.</p>
                   10231: 
                   10232:                 <p>If you want to submit several packages, please
                   10233:                 send a separate PR for each one, it's easier for us
                   10234:                 to track things that way.</p>
                   10235: 
                   10236:                 <p>Alternatively, you can also import new packages
                   10237:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   10238:                 work-in-progress</span>&#8221;); see the homepage
                   10239:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   10240:                 target=
                   10241:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   10242:                 details.</p>
                   10243:               </li>
                   10244:             </ul>
                   10245:           </div>
                   10246:         </div>
                   10247: 
                   10248:         <div class="sect1" lang="en" xml:lang="en">
                   10249:           <div class="titlepage">
                   10250:             <div>
                   10251:               <div>
                   10252:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      10253:                 "id2594361" id=
        !          10254:                 "id2594361"></a>14.2.&nbsp;Committing: Importing a
1.1       grant    10255:                 package into CVS</h2>
                   10256:               </div>
                   10257:             </div>
                   10258:           </div>
                   10259: 
                   10260:           <p>This section is only of interest for pkgsrc developers
                   10261:           with write access to the pkgsrc repository. Please
                   10262:           remember that cvs imports files relative to the current
                   10263:           working directory, and that the pathname that you give
1.7       wiz      10264:           the <span><strong class="command">cvs
                   10265:           import</strong></span> command is so that it knows where
                   10266:           to place the files in the repository. Newly created
                   10267:           packages should be imported with a vendor tag of
                   10268:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   10269:           release tag of &#8220;<span class=
                   10270:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    10271:           <pre class="programlisting">
                   10272:   % cd .../pkgsrc/category/pkgname
                   10273:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   10274: </pre>
                   10275: 
                   10276:           <p>Remember to move the directory from which you imported
                   10277:           out of the way, or cvs will complain the next time you
                   10278:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   10279:           source tree. Also don't forget to add the new package to
1.7       wiz      10280:           the category's <code class=
                   10281:           "filename">Makefile</code>.</p>
1.1       grant    10282: 
                   10283:           <p>The commit message of the initial import should
1.7       wiz      10284:           include part of the <code class="filename">DESCR</code>
                   10285:           file, so people reading the mailing lists know what the
                   10286:           package is/does.</p>
1.1       grant    10287: 
                   10288:           <p>Please note all package updates/additions in
1.7       wiz      10289:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
                   10290:           very important to keep this file up to date and
                   10291:           conforming to the existing format, because it will be
                   10292:           used by scripts to automatically update pages on <a href=
1.1       grant    10293:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   10294:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   10295:           file and remove the entry for the package you updated, in
                   10296:           case it was mentioned there.</p>
                   10297: 
                   10298:           <p>For new packages, &#8220;<span class="quote">cvs
                   10299:           import</span>&#8221; is preferred to &#8220;<span class=
                   10300:           "quote">cvs add</span>&#8221; because the former gets
                   10301:           everything with a single command, and provides a
                   10302:           consistent tag.</p>
                   10303:         </div>
                   10304: 
                   10305:         <div class="sect1" lang="en" xml:lang="en">
                   10306:           <div class="titlepage">
                   10307:             <div>
                   10308:               <div>
                   10309:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      10310:                 "id2594492" id="id2594492"></a>14.3.&nbsp;Updating
1.2       hubertf  10311:                 a package to a newer version</h2>
1.1       grant    10312:               </div>
                   10313:             </div>
                   10314:           </div>
                   10315: 
                   10316:           <p>Please always put a concise, appropriate and relevant
                   10317:           summary of the changes between old and new versions into
                   10318:           the commit log when updating a package. There are various
                   10319:           reasons for this:</p>
                   10320: 
                   10321:           <div class="itemizedlist">
                   10322:             <ul type="disc">
                   10323:               <li>
                   10324:                 <p>A URL is volatile, and can change over time. It
                   10325:                 may go away completely or its information may be
                   10326:                 overwritten by newer information.</p>
                   10327:               </li>
                   10328: 
                   10329:               <li>
                   10330:                 <p>Having the change information between old and
                   10331:                 new versions in our CVS repository is very useful
                   10332:                 for people who use either cvs or anoncvs.</p>
                   10333:               </li>
                   10334: 
                   10335:               <li>
                   10336:                 <p>Having the change information between old and
                   10337:                 new versions in our CVS repository is very useful
                   10338:                 for people who read the pkgsrc-changes mailing
                   10339:                 list, so that they can make tactical decisions
                   10340:                 about when to upgrade the package.</p>
                   10341:               </li>
                   10342:             </ul>
                   10343:           </div>
                   10344: 
                   10345:           <p>Please also recognise that, just because a new version
                   10346:           of a package has been released, it should not
                   10347:           automatically be upgraded in the CVS repository. We
                   10348:           prefer to be conservative in the packages that are
                   10349:           included in pkgsrc - development or beta packages are not
                   10350:           really the best thing for most places in which pkgsrc is
                   10351:           used. Please use your judgement about what should go into
                   10352:           pkgsrc, and bear in mind that stability is to be
                   10353:           preferred above new and possibly untested features.</p>
                   10354:         </div>
                   10355: 
                   10356:         <div class="sect1" lang="en" xml:lang="en">
                   10357:           <div class="titlepage">
                   10358:             <div>
                   10359:               <div>
                   10360:                 <h2 class="title" style="clear: both"><a name=
1.11    ! ben      10361:                 "id2594512" id="id2594512"></a>14.4.&nbsp;Moving a
1.2       hubertf  10362:                 package in pkgsrc</h2>
1.1       grant    10363:               </div>
                   10364:             </div>
                   10365:           </div>
                   10366: 
                   10367:           <div class="orderedlist">
                   10368:             <ol type="1">
                   10369:               <li>
                   10370:                 <p>Make a copy of the directory somewhere else.</p>
                   10371:               </li>
                   10372: 
                   10373:               <li>
                   10374:                 <p>Remove all CVS dirs.</p>
                   10375: 
                   10376:                 <p>Alternatively to the first two steps you can
                   10377:                 also do:</p>
                   10378:                 <pre class="screen">
1.7       wiz      10379: <code class="prompt">%</code> <strong class=
                   10380: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    10381: </pre>
                   10382: 
                   10383:                 <p>and use that for further work.</p>
                   10384:               </li>
                   10385: 
                   10386:               <li>
1.7       wiz      10387:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   10388:                 any <code class="varname">DEPENDS</code> paths that
                   10389:                 just did &#8220;<span class=
1.1       grant    10390:                 "quote">../package</span>&#8221; instead of
                   10391:                 &#8220;<span class=
                   10392:                 "quote">../../category/package</span>&#8221;.</p>
                   10393:               </li>
                   10394: 
                   10395:               <li>
1.7       wiz      10396:                 <p><span><strong class="command">cvs
                   10397:                 import</strong></span> the modified package in the
                   10398:                 new place.</p>
1.1       grant    10399:               </li>
                   10400: 
                   10401:               <li>
                   10402:                 <p>Check if any package depends on it:</p>
                   10403:                 <pre class="screen">
1.7       wiz      10404: <code class="prompt">%</code> <strong class=
                   10405: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   10406: <code class="prompt">%</code> <strong class=
                   10407: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    10408: </pre>
                   10409:               </li>
                   10410: 
                   10411:               <li>
                   10412:                 <p>Fix paths in packages from step 5 to point to
                   10413:                 new location.</p>
                   10414:               </li>
                   10415: 
                   10416:               <li>
1.7       wiz      10417:                 <p><span><strong class="command">cvs rm
                   10418:                 (-f)</strong></span> the package at the old
                   10419:                 location.</p>
1.1       grant    10420:               </li>
                   10421: 
                   10422:               <li>
1.7       wiz      10423:                 <p>Remove from <code class=
                   10424:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    10425:               </li>
                   10426: 
                   10427:               <li>
1.7       wiz      10428:                 <p>Add to <code class=
                   10429:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    10430:               </li>
                   10431: 
                   10432:               <li>
                   10433:                 <p>Commit the changed and removed files:</p>
                   10434:                 <pre class="screen">
1.7       wiz      10435: <code class="prompt">%</code> <strong class=
                   10436: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    10437: </pre>
                   10438: 
                   10439:                 <p>(and any packages from step 5, of course).</p>
                   10440:               </li>
                   10441:             </ol>
                   10442:           </div>
                   10443:         </div>
                   10444:       </div>
                   10445:     </div>
                   10446: 
                   10447:     <div class="appendix" lang="en" xml:lang="en">
                   10448:       <div class="titlepage">
                   10449:         <div>
                   10450:           <div>
                   10451:             <h2 class="title"><a name="examples" id=
                   10452:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   10453:             package: bison</h2>
                   10454:           </div>
                   10455:         </div>
                   10456:       </div>
                   10457: 
                   10458:       <div class="toc">
                   10459:         <p><b>Table of Contents</b></p>
                   10460: 
                   10461:         <dl>
1.11    ! ben      10462:           <dt><span class="sect1"><a href="#id2594806">A.1.
1.1       grant    10463:           files</a></span></dt>
                   10464: 
                   10465:           <dd>
                   10466:             <dl>
1.11    ! ben      10467:               <dt><span class="sect2"><a href="#id2594809">A.1.1.
1.1       grant    10468:               Makefile</a></span></dt>
                   10469: 
1.11    ! ben      10470:               <dt><span class="sect2"><a href="#id2594817">A.1.2.
1.1       grant    10471:               DESCR</a></span></dt>
                   10472: 
1.11    ! ben      10473:               <dt><span class="sect2"><a href="#id2594832">A.1.3.
1.1       grant    10474:               PLIST</a></span></dt>
                   10475: 
1.11    ! ben      10476:               <dt><span class="sect2"><a href="#id2594839">A.1.4.
1.7       wiz      10477:               Checking a package with <span><strong class=
                   10478:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    10479:             </dl>
                   10480:           </dd>
                   10481: 
1.11    ! ben      10482:           <dt><span class="sect1"><a href="#id2594880">A.2. Steps
1.1       grant    10483:           for building, installing, packaging</a></span></dt>
                   10484:         </dl>
                   10485:       </div>
                   10486: 
                   10487:       <p>We checked to find a piece of software that wasn't in the
                   10488:       packages collection, and picked GNU bison. Quite why someone
1.7       wiz      10489:       would want to have <span><strong class=
                   10490:       "command">bison</strong></span> when Berkeley
                   10491:       <span><strong class="command">yacc</strong></span> is already
                   10492:       present in the tree is beyond us, but it's useful for the
                   10493:       purposes of this exercise.</p>
1.1       grant    10494: 
                   10495:       <div class="sect1" lang="en" xml:lang="en">
                   10496:         <div class="titlepage">
                   10497:           <div>
                   10498:             <div>
                   10499:               <h2 class="title" style="clear: both"><a name=
1.11    ! ben      10500:               "id2594806" id="id2594806"></a>A.1.&nbsp;files</h2>
1.1       grant    10501:             </div>
                   10502:           </div>
                   10503:         </div>
                   10504: 
                   10505:         <div class="sect2" lang="en" xml:lang="en">
                   10506:           <div class="titlepage">
                   10507:             <div>
                   10508:               <div>
1.11    ! ben      10509:                 <h3 class="title"><a name="id2594809" id=
        !          10510:                 "id2594809"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    10511:               </div>
                   10512:             </div>
                   10513:           </div>
                   10514:           <pre class="programlisting">
1.11    ! ben      10515: # $NetBSD$
1.1       grant    10516: #
                   10517: 
                   10518: DISTNAME=       bison-1.25
                   10519: CATEGORIES=     devel
                   10520: MASTER_SITES=   ${MASTER_SITE_GNU}
                   10521: 
                   10522: MAINTAINER=     thorpej@NetBSD.org
                   10523: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   10524: COMMENT=        GNU yacc clone
                   10525: 
                   10526: GNU_CONFIGURE=  yes
                   10527: INFO_FILES=     bison.info
                   10528: 
                   10529: .include "../../mk/bsd.pkg.mk"
                   10530: </pre>
                   10531:         </div>
                   10532: 
                   10533:         <div class="sect2" lang="en" xml:lang="en">
                   10534:           <div class="titlepage">
                   10535:             <div>
                   10536:               <div>
1.11    ! ben      10537:                 <h3 class="title"><a name="id2594817" id=
        !          10538:                 "id2594817"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    10539:               </div>
                   10540:             </div>
                   10541:           </div>
                   10542:           <pre class="programlisting">
                   10543: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   10544: improvements.  Why you would want this when Berkeley <a href=
                   10545: "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
                   10546: of the NetBSD source tree is beyond me.
                   10547: </pre>
                   10548:         </div>
                   10549: 
                   10550:         <div class="sect2" lang="en" xml:lang="en">
                   10551:           <div class="titlepage">
                   10552:             <div>
                   10553:               <div>
1.11    ! ben      10554:                 <h3 class="title"><a name="id2594832" id=
        !          10555:                 "id2594832"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    10556:               </div>
                   10557:             </div>
                   10558:           </div>
                   10559:           <pre class="programlisting">
1.11    ! ben      10560: @comment $NetBSD$
1.1       grant    10561: bin/bison
                   10562: man/man1/bison.1.gz
                   10563: share/bison.simple
                   10564: share/bison.hairy
                   10565: </pre>
                   10566:         </div>
                   10567: 
                   10568:         <div class="sect2" lang="en" xml:lang="en">
                   10569:           <div class="titlepage">
                   10570:             <div>
                   10571:               <div>
1.11    ! ben      10572:                 <h3 class="title"><a name="id2594839" id=
        !          10573:                 "id2594839"></a>A.1.4.&nbsp;Checking a package with
1.7       wiz      10574:                 <span><strong class=
                   10575:                 "command">pkglint</strong></span></h3>
1.1       grant    10576:               </div>
                   10577:             </div>
                   10578:           </div>
                   10579: 
                   10580:           <p>The NetBSD package system comes with <a xmlns=
                   10581:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   10582:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.7       wiz      10583:           class="pkgname">pkgtools/pkglint</a> which helps to check
                   10584:           the contents of these files. After installation it is
                   10585:           quite easy to use, just change to the directory of the
                   10586:           package you wish to examine and execute
                   10587:           <span><strong class=
                   10588:           "command">pkglint</strong></span>:</p>
1.1       grant    10589:           <pre class="screen">
1.7       wiz      10590: <code class="prompt">$</code> <strong class=
                   10591: "userinput"><code>pkglint</code></strong>
1.1       grant    10592: OK: checking ./DESCR.
                   10593: OK: checking Makefile.
                   10594: OK: checking distinfo.
                   10595: OK: checking patches/patch-aa.
                   10596: looks fine.
                   10597: </pre>
                   10598: 
                   10599:           <p>Depending on the supplied command line arguments (see
                   10600:           pkglint(1)) more verbose checks will be performed. Use
1.7       wiz      10601:           e.g. <span><strong class="command">pkglint
                   10602:           -v</strong></span> for a very verbose check.</p>
1.1       grant    10603:         </div>
                   10604:       </div>
                   10605: 
                   10606:       <div class="sect1" lang="en" xml:lang="en">
                   10607:         <div class="titlepage">
                   10608:           <div>
                   10609:             <div>
                   10610:               <h2 class="title" style="clear: both"><a name=
1.11    ! ben      10611:               "id2594880" id="id2594880"></a>A.2.&nbsp;Steps for
1.1       grant    10612:               building, installing, packaging</h2>
                   10613:             </div>
                   10614:           </div>
                   10615:         </div>
                   10616: 
                   10617:         <p>Create the directory where the package lives, plus any
                   10618:         auxiliary directories:</p>
                   10619:         <pre class="screen">
1.7       wiz      10620: <code class="prompt">#</code> <strong class=
                   10621: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   10622: <code class="prompt">#</code> <strong class=
                   10623: "userinput"><code>mkdir bison</code></strong>
                   10624: <code class="prompt">#</code> <strong class=
                   10625: "userinput"><code>cd bison</code></strong>
                   10626: <code class="prompt">#</code> <strong class=
                   10627: "userinput"><code>mkdir patches</code></strong>
1.1       grant    10628: </pre>
                   10629: 
1.7       wiz      10630:         <p>Create <code class="filename">Makefile</code>,
                   10631:         <code class="filename">DESCR</code> and <code class=
                   10632:         "filename">PLIST</code> (see <a href="#components" title=
1.1       grant    10633:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   10634:         Chapter 7, <i>Package components - files, directories and
                   10635:         contents</i></a>) then continue with fetching the
                   10636:         distfile:</p>
                   10637:         <pre class="screen">
1.7       wiz      10638: <code class="prompt">#</code> <strong class=
                   10639: "userinput"><code>make fetch</code></strong>
1.1       grant    10640: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   10641: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   10642: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10643: ftp: Error retrieving file: 500 Internal error
                   10644: 
                   10645: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   10646: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10647: ftp: Error retrieving file: 500 Internal error
                   10648: 
                   10649: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   10650: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10651: Successfully retrieved file.
                   10652: </pre>
                   10653: 
1.7       wiz      10654:         <p>Generate the checksum of the distfile into <code class=
                   10655:         "filename">distinfo</code>:</p>
1.1       grant    10656:         <pre class="screen">
1.7       wiz      10657: <code class="prompt">#</code> <strong class=
                   10658: "userinput"><code>make makesum</code></strong>
1.1       grant    10659: </pre>
                   10660: 
                   10661:         <p>Now compile:</p>
                   10662:         <pre class="screen">
1.7       wiz      10663: <code class="prompt">#</code> <strong class=
                   10664: "userinput"><code>make</code></strong>
1.1       grant    10665: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10666: ===&gt;  Extracting for bison-1.25
                   10667: ===&gt;  Patching for bison-1.25
                   10668: ===&gt;   Ignoring empty patch directory
                   10669: ===&gt;  Configuring for bison-1.25
                   10670: creating cache ./config.cache
                   10671: checking for gcc... cc
                   10672: checking whether we are using GNU C... yes
                   10673: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   10674: checking how to run the C preprocessor... cc -E
                   10675: checking for minix/config.h... no
                   10676: checking for POSIXized ISC... no
                   10677: checking whether cross-compiling... no
                   10678: checking for ANSI C header files... yes
                   10679: checking for string.h... yes
                   10680: checking for stdlib.h... yes
                   10681: checking for memory.h... yes
                   10682: checking for working const... yes
                   10683: checking for working alloca.h... no
                   10684: checking for alloca... yes
                   10685: checking for strerror... yes
                   10686: updating cache ./config.cache
                   10687: creating ./config.status
                   10688: creating Makefile
                   10689: ===&gt;  Building for bison-1.25
                   10690: 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
                   10691: 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
                   10692: 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
                   10693: 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
                   10694: 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
                   10695: 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 
                   10696: 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
                   10697: 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
                   10698: 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
                   10699: 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
                   10700: 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
                   10701: 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
                   10702: 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
                   10703: 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
                   10704: 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
                   10705: 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
                   10706: 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
                   10707: 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
                   10708: 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
                   10709: 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
                   10710: 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
                   10711: 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
                   10712: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   10713: rm -f bison.s1
                   10714: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   10715: </pre>
                   10716: 
                   10717:         <p>Everything seems OK, so install the files:</p>
                   10718:         <pre class="screen">
1.7       wiz      10719: <code class="prompt">#</code> <strong class=
                   10720: "userinput"><code>make install</code></strong>
1.1       grant    10721: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10722: ===&gt;  Installing for bison-1.25
                   10723: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   10724: rm -f /usr/pkg/bin/bison
                   10725: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   10726: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   10727: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   10728: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   10729: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   10730: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   10731: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   10732: ===&gt;  Registering installation for bison-1.25
                   10733: </pre>
                   10734: 
                   10735:         <p>You can now use bison, and also - if you decide so -
1.7       wiz      10736:         remove it with <span><strong class="command">pkg_delete
                   10737:         bison</strong></span>. Should you decide that you want a
                   10738:         binary package, do this now:</p>
1.1       grant    10739:         <pre class="screen">
1.7       wiz      10740: <code class="prompt">#</code> <strong class=
                   10741: "userinput"><code>make package</code></strong>
1.1       grant    10742: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10743: ===&gt;  Building package for bison-1.25
                   10744: Creating package bison-1.25.tgz
                   10745: Registering depends:.
                   10746: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   10747: </pre>
                   10748: 
                   10749:         <p>Now that you don't need the source and object files any
                   10750:         more, clean up:</p>
                   10751:         <pre class="screen">
1.7       wiz      10752: <code class="prompt">#</code> <strong class=
                   10753: "userinput"><code>make clean</code></strong>
1.1       grant    10754: ===&gt;  Cleaning for bison-1.25
                   10755: </pre>
                   10756:       </div>
                   10757:     </div>
                   10758: 
                   10759:     <div class="appendix" lang="en" xml:lang="en">
                   10760:       <div class="titlepage">
                   10761:         <div>
                   10762:           <div>
                   10763:             <h2 class="title"><a name="logs" id=
                   10764:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   10765:           </div>
                   10766:         </div>
                   10767:       </div>
                   10768: 
                   10769:       <div class="toc">
                   10770:         <p><b>Table of Contents</b></p>
                   10771: 
                   10772:         <dl>
                   10773:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   10774:           Building figlet</a></span></dt>
                   10775: 
                   10776:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   10777:           Packaging figlet</a></span></dt>
                   10778:         </dl>
                   10779:       </div>
                   10780: 
                   10781:       <div class="sect1" lang="en" xml:lang="en">
                   10782:         <div class="titlepage">
                   10783:           <div>
                   10784:             <div>
                   10785:               <h2 class="title" style="clear: both"><a name=
                   10786:               "logs.building" id=
                   10787:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   10788:             </div>
                   10789:           </div>
                   10790:         </div>
                   10791:         <pre class="screen">
1.7       wiz      10792: <code class="prompt">#</code> <strong class=
                   10793: "userinput"><code>make</code></strong>
1.1       grant    10794: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10795: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   10796: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   10797: =&gt; [172219 bytes]
                   10798: Connected to ftp.plig.net.
                   10799: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   10800: 331 Guest login ok, send your complete e-mail address as password.
                   10801: 230-You are user #5 of 500 simultaneous users allowed.
                   10802: 230-
                   10803: 230-  ___ _             _ _                   
                   10804: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   10805: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   10806: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   10807: 230-         |_|   |_|     |___|         |___|
                   10808: 230-
                   10809: 230-** Welcome to ftp.plig.org **
                   10810: 230-
                   10811: 230-Please note that all transfers from this FTP site are logged. If you
                   10812: 230-do not like this, please disconnect now.
                   10813: 230-
                   10814: 230-This arhive is available via
                   10815: 230-
                   10816: 230-HTTP:  http://ftp.plig.org/
                   10817: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   10818: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   10819: 230-
                   10820: 230-Please email comments, bug reports and requests for packages to be
                   10821: 230-mirrored to ftp-admin@plig.org.   
                   10822: 230-
                   10823: 230-
                   10824: 230 Logged in anonymously.
                   10825: Remote system type is UNIX.
                   10826: Using binary mode to transfer files.
                   10827: 200 Type okay.
                   10828: 250 "/pub" is new cwd.
                   10829: 250-"/pub/figlet" is new cwd.
                   10830: 250-
                   10831: 250-Welcome to the figlet archive at ftp.figlet.org
                   10832: 250-    
                   10833: 250-    ftp://ftp.figlet.org/pub/figlet/
                   10834: 250-
                   10835: 250-The official FIGlet web page is:
                   10836: 250-    http://www.figlet.org/
                   10837: 250-
                   10838: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   10839: 250-contribute a font or something else, you can email us.
                   10840: 250 
                   10841: 250 "/pub/figlet/program" is new cwd.
                   10842: 250 "/pub/figlet/program/unix" is new cwd.
                   10843: local: figlet221.tar.gz remote: figlet221.tar.gz
                   10844: 502 Unimplemented command.
                   10845: 227 Entering Passive Mode (195,40,6,41,246,104)
                   10846: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   10847: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   10848: 226 Transfer completed.
                   10849: 172219 bytes received in 00:02 (75.99 KB/s)
                   10850: 221 Goodbye.
                   10851: =&gt; Checksum OK for figlet221.tar.gz.
                   10852: ===&gt; Extracting for figlet-2.2.1nb2
                   10853: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   10854: ===&gt; Patching for figlet-2.2.1nb2
                   10855: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   10856: ===&gt; Overriding tools for figlet-2.2.1nb2
                   10857: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   10858: ===&gt; Configuring for figlet-2.2.1nb2
                   10859: ===&gt; Building for figlet-2.2.1nb2
                   10860: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   10861: chmod a+x figlet
                   10862: gcc -O2 -o chkfont chkfont.c
                   10863: =&gt; Unwrapping files-to-be-installed.
1.7       wiz      10864: <code class="prompt">#</code>
                   10865: <code class="prompt">#</code> <strong class=
                   10866: "userinput"><code>make install</code></strong>
1.1       grant    10867: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10868: ===&gt; Installing for figlet-2.2.1nb2
                   10869: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   10870: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   10871: mkdir -p /usr/pkg/share/figlet
                   10872: cp figlet /usr/pkg/bin
                   10873: cp chkfont /usr/pkg/bin
                   10874: chmod 555 figlist showfigfonts
                   10875: cp figlist /usr/pkg/bin
                   10876: cp showfigfonts /usr/pkg/bin
                   10877: cp fonts/*.flf /usr/pkg/share/figlet
                   10878: cp fonts/*.flc /usr/pkg/share/figlet
                   10879: cp figlet.6 /usr/pkg/man/man6
                   10880: ===&gt; Registering installation for figlet-2.2.1nb2
1.7       wiz      10881: <code class="prompt">#</code>
1.1       grant    10882: </pre>
                   10883:       </div>
                   10884: 
                   10885:       <div class="sect1" lang="en" xml:lang="en">
                   10886:         <div class="titlepage">
                   10887:           <div>
                   10888:             <div>
                   10889:               <h2 class="title" style="clear: both"><a name=
                   10890:               "logs.package" id=
                   10891:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   10892:             </div>
                   10893:           </div>
                   10894:         </div>
                   10895:         <pre class="screen">
1.7       wiz      10896: <code class="prompt">#</code> <strong class=
                   10897: "userinput"><code>make package</code></strong>
1.1       grant    10898: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10899: ===&gt; Packaging figlet-2.2.1nb2
                   10900: ===&gt; Building binary package for figlet-2.2.1nb2
                   10901: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   10902: Using SrcDir value of /usr/pkg
                   10903: Registering depends:.  
1.7       wiz      10904: <code class="prompt">#</code>
1.1       grant    10905: </pre>
                   10906:       </div>
                   10907:     </div>
                   10908: 
                   10909:     <div class="appendix" lang="en" xml:lang="en">
                   10910:       <div class="titlepage">
                   10911:         <div>
                   10912:           <div>
                   10913:             <h2 class="title"><a name="ftp-layout" id=
                   10914:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   10915:             FTP server's package archive</h2>
                   10916:           </div>
                   10917:         </div>
                   10918:       </div>
                   10919: 
                   10920:       <p>Layout for precompiled binary packages on
                   10921:       ftp.NetBSD.org:</p>
                   10922:       <pre class="programlisting">
                   10923: /pub/NetBSD/packages/
                   10924:                 distfiles/
                   10925: 
                   10926:                 # Unpacked pkgsrc trees
                   10927:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   10928:                 pkgsrc-2003Q4 -&gt; N/A
                   10929:                 pkgsrc-2004Q1/pkgsrc
                   10930: 
                   10931:                 # pkgsrc archives
                   10932:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   10933:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   10934:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   10935: 
                   10936:                 # Per pkgsrc-release/OS-release/arch package archives
                   10937:                 pkgsrc-2003Q4/
                   10938:                         NetBSD-1.6.2/
                   10939:                                 i386/
                   10940:                                         All/
                   10941:                                         archivers/
                   10942:                                                 foo -&gt; ../All/foo
                   10943:                                         ...
                   10944:                 pkgsrc-2004Q1/
                   10945:                         NetBSD-1.6.2/
                   10946:                                 i386/
                   10947:                                         All/
                   10948:                                         ...
                   10949:                         NetBSD-2.0/
                   10950:                                 i386/
                   10951:                                         All/
                   10952:                                         ...
                   10953:                         SunOS-5.9/
                   10954:                                 sparc/
                   10955:                                         All/
                   10956:                                         ...
                   10957:                                 x86/
                   10958:                                         All/
                   10959:                                         ...
                   10960: 
                   10961:                 # Per os-release package archive convenience links
                   10962:                 NetBSD-1.6.2 -&gt; 1.6.2
                   10963:                 1.6.2/
                   10964:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   10965:                         m68k/
                   10966:                                 All/
                   10967:                                 archivers/
                   10968:                                         foo -&gt; ../All/foo
                   10969:                                 ...
                   10970:                         amiga -&gt; m68k
                   10971:                         atari -&gt; m68k
                   10972:                         ...
                   10973: 
                   10974:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   10975:                 NetBSD-2.0/
                   10976:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   10977:                 SunOS-5.9/
                   10978:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   10979:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   10980:                         
                   10981: </pre>
                   10982: 
                   10983:       <p>To create:</p>
                   10984: 
                   10985:       <div class="orderedlist">
                   10986:         <ol type="1">
                   10987:           <li>
                   10988:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   10989:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   10990:             5.3, &#8220;Doing a bulk build of all
                   10991:             packages&#8221;</a></p>
                   10992:           </li>
                   10993: 
                   10994:           <li>
                   10995:             <p>Upload /usr/pkgsrc/packages to</p>
                   10996:             <pre class="programlisting">
                   10997:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
                   10998:         pkgsrc-2004Q3/\                         # pkgsrc-branch
                   10999:         `uname -s`-`uname -r`/                  # OS &amp; version
                   11000:         `uname -p`                              # architecture
                   11001:        
                   11002: </pre>
                   11003:           </li>
                   11004: 
                   11005:           <li>
1.7       wiz      11006:             <p>If necessary, create a symlink <span><strong class=
                   11007:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   11008:             (amiga -&gt; m68k, ...)</p>
1.1       grant    11009:           </li>
                   11010:         </ol>
                   11011:       </div>
                   11012:     </div>
1.2       hubertf  11013: 
                   11014:     <div class="appendix" lang="en" xml:lang="en">
                   11015:       <div class="titlepage">
                   11016:         <div>
                   11017:           <div>
                   11018:             <h2 class="title"><a name="editing" id=
                   11019:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   11020:             for the pkgsrc guide</h2>
                   11021:           </div>
                   11022:         </div>
                   11023:       </div>
                   11024: 
                   11025:       <div class="toc">
                   11026:         <p><b>Table of Contents</b></p>
                   11027: 
                   11028:         <dl>
1.11    ! ben      11029:           <dt><span class="sect1"><a href="#id2595799">D.1.
1.2       hubertf  11030:           Targets</a></span></dt>
                   11031: 
1.11    ! ben      11032:           <dt><span class="sect1"><a href="#id2595869">D.2.
1.2       hubertf  11033:           Procedure</a></span></dt>
                   11034:         </dl>
                   11035:       </div>
                   11036: 
                   11037:       <p>This section contains information on editing the pkgsrc
                   11038:       guide itself.</p>
                   11039: 
                   11040:       <div class="sect1" lang="en" xml:lang="en">
                   11041:         <div class="titlepage">
                   11042:           <div>
                   11043:             <div>
                   11044:               <h2 class="title" style="clear: both"><a name=
1.11    ! ben      11045:               "id2595799" id="id2595799"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  11046:             </div>
                   11047:           </div>
                   11048:         </div>
                   11049: 
1.7       wiz      11050:         <p>The pkgsrc guide's source code is stored in <code class=
                   11051:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  11052:         are created from it:</p>
                   11053: 
                   11054:         <div class="itemizedlist">
                   11055:           <ul type="disc">
                   11056:             <li>
1.7       wiz      11057:               <p><code class=
                   11058:               "filename">pkgsrc/doc/pkgsrc.txt</code>, which
                   11059:               replaces <code class=
                   11060:               "filename">pkgsrc/Packages.txt</code></p>
1.2       hubertf  11061:             </li>
                   11062: 
                   11063:             <li>
1.7       wiz      11064:               <p><code class=
                   11065:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  11066:             </li>
                   11067: 
                   11068:             <li>
1.7       wiz      11069:               <p><code class=
                   11070:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  11071:               the documentation on the NetBSD website will be built
                   11072:               from pkgsrc and kept up to date on the web server
                   11073:               itself. This means you <span class=
                   11074:               "emphasis"><em>must</em></span> make sure that your
                   11075:               changes haven't broken the build!</p>
                   11076:             </li>
1.6       hubertf  11077: 
                   11078:             <li>
1.7       wiz      11079:               <p><code class=
                   11080:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  11081:               PDF version of the pkgsrc guide.</p>
                   11082:             </li>
                   11083: 
                   11084:             <li>
1.7       wiz      11085:               <p><code class=
                   11086:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  11087:               PostScript version of the pkgsrc guide.</p>
                   11088:             </li>
1.2       hubertf  11089:           </ul>
                   11090:         </div>
                   11091:       </div>
                   11092: 
                   11093:       <div class="sect1" lang="en" xml:lang="en">
                   11094:         <div class="titlepage">
                   11095:           <div>
                   11096:             <div>
                   11097:               <h2 class="title" style="clear: both"><a name=
1.11    ! ben      11098:               "id2595869" id=
        !          11099:               "id2595869"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  11100:             </div>
                   11101:           </div>
                   11102:         </div>
                   11103: 
                   11104:         <p>The procedure to edit the pkgsrc guide is:</p>
                   11105: 
                   11106:         <div class="itemizedlist">
                   11107:           <ul type="disc">
                   11108:             <li>
1.6       hubertf  11109:               <p>Make sure you have the packages needed to
                   11110:               re-generate the pkgsrc guide (and other XML-based
                   11111:               NetBSD documentation) installed. These are
1.11    ! ben      11112:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  11113:               for creating the ASCII- and HTML-version, and
                   11114:               &#8220;<span class=
1.11    ! ben      11115:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  11116:               PostScript- and PDF version. You will need both
                   11117:               packages installed, to make sure documentation is
                   11118:               consistent across all formats. The packages can be
1.7       wiz      11119:               found in <code class=
                   11120:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
                   11121:               <code class=
                   11122:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  11123:             </li>
                   11124: 
                   11125:             <li>
1.7       wiz      11126:               <p>Edit the XML file(s) in <code class=
                   11127:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  11128:             </li>
                   11129: 
                   11130:             <li>
1.7       wiz      11131:               <p>Run <span><strong class="command">make extract
                   11132:               &amp;&amp; make do-lint</strong></span> in
                   11133:               <code class="filename">pkgsrc/doc/guide</code> to
                   11134:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  11135:             </li>
                   11136: 
                   11137:             <li>
1.7       wiz      11138:               <p>Run <span><strong class=
                   11139:               "command">make</strong></span> in <code class=
                   11140:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   11141:               and ASCII version.</p>
1.2       hubertf  11142:             </li>
                   11143: 
                   11144:             <li>
1.7       wiz      11145:               <p>If all is well, run <span><strong class=
                   11146:               "command">make install-doc</strong></span> to put the
                   11147:               generated files into <code class=
                   11148:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  11149:             </li>
                   11150: 
                   11151:             <li>
1.7       wiz      11152:               <p><span><strong class="command">cvs commit
                   11153:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  11154:             </li>
                   11155: 
                   11156:             <li>
1.7       wiz      11157:               <p><span><strong class="command">cvs commit -m
                   11158:               re-generate
                   11159:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  11160:             </li>
1.4       hubertf  11161: 
                   11162:             <li>
                   11163:               <p>Until the webserver on www.NetBSD.org is really
                   11164:               updated automatically to pick up changes to the
1.7       wiz      11165:               pkgsrc guide automatically, also run
                   11166:               <span><strong class="command">make install-htdoc
                   11167:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   11168:               similar, adjust <code class=
                   11169:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  11170:             </li>
                   11171: 
                   11172:             <li>
1.7       wiz      11173:               <p><span><strong class="command">cvs commit
                   11174:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  11175:             </li>
1.2       hubertf  11176:           </ul>
                   11177:         </div>
                   11178:       </div>
                   11179:     </div>
1.1       grant    11180:   </div>
                   11181: </body>
                   11182: </html>

CVSweb <webmaster@jp.NetBSD.org>