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

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.7     ! wiz        22:           <h1 class="title"><a name="id2458394" id=
        !            23:           "id2458394"></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.7     ! wiz        96:             <dt><span class="sect1"><a href="#id2514275">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.7     ! wiz       120:                 <dt><span class="sect1"><a href="#id2514853">2.1.
1.1       grant     121:                 As tar file</a></span></dt>
                    122: 
1.7     ! wiz       123:                 <dt><span class="sect1"><a href="#id2514870">2.2.
1.1       grant     124:                 Via SUP</a></span></dt>
                    125: 
1.7     ! wiz       126:                 <dt><span class="sect1"><a href="#id2514970">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.7     ! wiz       136:                 <dt><span class="sect1"><a href="#id2515148">3.1.
1.1       grant     137:                 Bootstrapping pkgsrc</a></span></dt>
                    138: 
1.7     ! wiz       139:                 <dt><span class="sect1"><a href="#id2515255">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.7     ! wiz       145:                     "#id2515261">3.2.1. Darwin (Mac OS
1.1       grant     146:                     X)</a></span></dt>
                    147: 
                    148:                     <dt><span class="sect2"><a href=
1.7     ! wiz       149:                     "#id2515492">3.2.2. FreeBSD</a></span></dt>
1.1       grant     150: 
                    151:                     <dt><span class="sect2"><a href=
1.7     ! wiz       152:                     "#id2515662">3.2.3. Interix</a></span></dt>
1.1       grant     153: 
                    154:                     <dt><span class="sect2"><a href=
1.7     ! wiz       155:                     "#id2515753">3.2.4. IRIX</a></span></dt>
1.1       grant     156: 
                    157:                     <dt><span class="sect2"><a href=
1.7     ! wiz       158:                     "#id2516280">3.2.5. OpenBSD</a></span></dt>
1.1       grant     159: 
                    160:                     <dt><span class="sect2"><a href=
1.7     ! wiz       161:                     "#id2516392">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.7     ! wiz       179:                     "#id2516529">4.1.1. Where to get binary
1.1       grant     180:                     packages</a></span></dt>
                    181: 
                    182:                     <dt><span class="sect2"><a href=
1.7     ! wiz       183:                     "#id2516569">4.1.2. How to use binary
1.1       grant     184:                     packages</a></span></dt>
                    185: 
                    186:                     <dt><span class="sect2"><a href=
1.7     ! wiz       187:                     "#id2516704">4.1.3. A word of
1.1       grant     188:                     warning</a></span></dt>
                    189:                   </dl>
                    190:                 </dd>
                    191: 
1.7     ! wiz       192:                 <dt><span class="sect1"><a href="#id2516715">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.7     ! wiz       198:                     "#id2516725">4.2.1.
1.1       grant     199:                     Requirements</a></span></dt>
                    200: 
                    201:                     <dt><span class="sect2"><a href=
1.7     ! wiz       202:                     "#id2516745">4.2.2. Fetching
1.1       grant     203:                     distfiles</a></span></dt>
                    204: 
                    205:                     <dt><span class="sect2"><a href=
1.7     ! wiz       206:                     "#id2516866">4.2.3. How to build and
1.1       grant     207:                     install</a></span></dt>
                    208: 
                    209:                     <dt><span class="sect2"><a href=
1.7     ! wiz       210:                     "#id2517182">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.7     ! wiz       222:                 <dt><span class="sect1"><a href="#id2517337">5.1.
1.1       grant     223:                 Building a single binary package</a></span></dt>
                    224: 
1.7     ! wiz       225:                 <dt><span class="sect1"><a href="#id2517825">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.7     ! wiz       239:                     "#id2517964">5.3.2. Other environmental
1.1       grant     240:                     considerations</a></span></dt>
                    241: 
                    242:                     <dt><span class="sect2"><a href=
1.7     ! wiz       243:                     "#id2518005">5.3.3. Operation</a></span></dt>
1.1       grant     244: 
                    245:                     <dt><span class="sect2"><a href=
1.7     ! wiz       246:                     "#id2583270">5.3.4. What it
1.1       grant     247:                     does</a></span></dt>
                    248: 
                    249:                     <dt><span class="sect2"><a href=
1.7     ! wiz       250:                     "#id2583326">5.3.5. Disk space
1.1       grant     251:                     requirements</a></span></dt>
                    252: 
                    253:                     <dt><span class="sect2"><a href=
1.7     ! wiz       254:                     "#id2583421">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.7     ! wiz       258:                     "#id2583785">5.3.7. Building a partial set of
1.1       grant     259:                     packages</a></span></dt>
                    260:                   </dl>
                    261:                 </dd>
                    262: 
1.7     ! wiz       263:                 <dt><span class="sect1"><a href="#id2583828">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.7     ! wiz       270:                     "#id2583843">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.7     ! wiz       282:                 <dt><span class="sect1"><a href="#id2584170">6.1.
1.1       grant     283:                 Is there a mailing list for pkg-related
                    284:                 discussion?</a></span></dt>
                    285: 
1.7     ! wiz       286:                 <dt><span class="sect1"><a href="#id2584200">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.7     ! wiz       293:                 <dt><span class="sect1"><a href="#id2584453">6.4.
1.1       grant     294:                 How to use pkgsrc as non-root</a></span></dt>
                    295: 
1.7     ! wiz       296:                 <dt><span class="sect1"><a href="#id2584465">6.5.
1.1       grant     297:                 How can I install/use XFree86 from
                    298:                 pkgsrc?</a></span></dt>
                    299: 
1.7     ! wiz       300:                 <dt><span class="sect1"><a href="#id2584492">6.6.
1.1       grant     301:                 How can I install/use X.org from
                    302:                 pkgsrc?</a></span></dt>
                    303: 
1.7     ! wiz       304:                 <dt><span class="sect1"><a href="#id2584520">6.7.
1.1       grant     305:                 How to fetch files from behind a
                    306:                 firewall</a></span></dt>
                    307: 
1.7     ! wiz       308:                 <dt><span class="sect1"><a href="#id2584534">6.8.
        !           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.7     ! wiz       313:                 <dt><span class="sect1"><a href="#id2584722">6.9.
1.1       grant     314:                 How to fetch all distfiles at once</a></span></dt>
                    315: 
1.7     ! wiz       316:                 <dt><span class="sect1"><a href="#id2584861">6.10.
        !           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.7     ! wiz       321:                 <dt><span class="sect1"><a href="#id2584900">6.11.
        !           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.7     ! wiz       325:                 <dt><span class="sect1"><a href="#id2584957">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.7     ! wiz       363:                 <dt><span class="sect1"><a href="#id2586071">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.7     ! wiz       370:                 <dt><span class="sect1"><a href="#id2586197">7.6.
        !           371:                 <code class="filename">work*</code></a></span></dt>
1.1       grant     372: 
1.7     ! wiz       373:                 <dt><span class="sect1"><a href="#id2586284">7.7.
        !           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.7     ! wiz       384:                 <dt><span class="sect1"><a href="#id2586339">8.1.
1.1       grant     385:                 RCS ID</a></span></dt>
                    386: 
1.7     ! wiz       387:                 <dt><span class="sect1"><a href="#id2586354">8.2.
        !           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.7     ! wiz       399:                 <dt><span class="sect1"><a href="#id2586743">8.5.
1.1       grant     400:                 Manpage-compression</a></span></dt>
                    401: 
1.7     ! wiz       402:                 <dt><span class="sect1"><a href="#id2586785">8.6.
        !           403:                 Changing PLIST source with <code class=
        !           404:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     405: 
1.7     ! wiz       406:                 <dt><span class="sect1"><a href="#id2586802">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.7     ! wiz       421:                 <dt><span class="sect1"><a href="#id2587074">9.1.
1.1       grant     422:                 Converting packages to use
                    423:                 buildlink3</a></span></dt>
                    424: 
1.7     ! wiz       425:                 <dt><span class="sect1"><a href="#id2587265">9.2.
        !           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.7     ! wiz       432:                     "#id2587470">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.7     ! wiz       436:                     "#id2588048">9.2.2. Updating <code class=
        !           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.7     ! wiz       444:                 <dt><span class="sect1"><a href="#id2588126">9.3.
        !           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.7     ! wiz       451:                     "#id2588208">9.3.1. Anatomy of a <code class=
        !           452:                     "filename">builtin.mk</code>
1.1       grant     453:                     file</a></span></dt>
                    454: 
                    455:                     <dt><span class="sect2"><a href=
1.7     ! wiz       456:                     "#id2588366">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.7     ! wiz       468:                 <dt><span class="sect1"><a href="#id2588507">10.1.
1.1       grant     469:                 Global default options</a></span></dt>
                    470: 
1.7     ! wiz       471:                 <dt><span class="sect1"><a href="#id2588522">10.2.
        !           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.7     ! wiz       486:                 <dt><span class="sect1"><a href="#id2589198">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.7     ! wiz       500:                 <dt><span class="sect1"><a href="#id2590531">12.1.
1.1       grant     501:                 General operation</a></span></dt>
                    502: 
                    503:                 <dd>
                    504:                   <dl>
                    505:                     <dt><span class="sect2"><a href=
1.7     ! wiz       506:                     "#id2590534">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.7     ! wiz       510:                     "#id2590685">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.7     ! wiz       518:                     "#id2591201">12.1.4. Handling conflicts with
1.1       grant     519:                     other packages</a></span></dt>
                    520: 
                    521:                     <dt><span class="sect2"><a href=
1.7     ! wiz       522:                     "#id2591251">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.7     ! wiz       526:                     "#id2591413">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.7     ! wiz       534:                     "#id2591505">12.1.8. How to handle compiler
1.1       grant     535:                     bugs</a></span></dt>
                    536: 
                    537:                     <dt><span class="sect2"><a href=
1.7     ! wiz       538:                     "#id2591527">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.7     ! wiz       543:                     "#id2591644">12.1.10. Portability of
1.1       grant     544:                     packages</a></span></dt>
                    545:                   </dl>
                    546:                 </dd>
                    547: 
1.7     ! wiz       548:                 <dt><span class="sect1"><a href="#id2591669">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.7     ! wiz       554:                     "#id2591672">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.7     ! wiz       559:                     "#id2591735">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.7     ! wiz       564:                 <dt><span class="sect1"><a href="#id2591747">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.7     ! wiz       574:                     "#id2592086">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.7     ! wiz       579:                     "#id2592238">12.3.3. GNU
1.1       grant     580:                     Autoconf/Automake</a></span></dt>
                    581:                   </dl>
                    582:                 </dd>
                    583: 
1.7     ! wiz       584:                 <dt><span class="sect1"><a href="#id2592283">12.4.
1.1       grant     585:                 Building considerations</a></span></dt>
                    586: 
                    587:                 <dd>
                    588:                   <dl>
                    589:                     <dt><span class="sect2"><a href=
1.7     ! wiz       590:                     "#id2592286">12.4.1. CPP
1.1       grant     591:                     defines</a></span></dt>
                    592:                   </dl>
                    593:                 </dd>
                    594: 
1.7     ! wiz       595:                 <dt><span class="sect1"><a href="#id2592316">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.7     ! wiz       601:                     "#id2592320">12.5.1. Package configuration
1.1       grant     602:                     files</a></span></dt>
                    603: 
                    604:                     <dt><span class="sect2"><a href=
1.7     ! wiz       605:                     "#id2592490">12.5.2. User
1.2       hubertf   606:                     interaction</a></span></dt>
1.1       grant     607: 
                    608:                     <dt><span class="sect2"><a href=
1.7     ! wiz       609:                     "#id2592535">12.5.3. Handling
1.1       grant     610:                     licenses</a></span></dt>
                    611: 
                    612:                     <dt><span class="sect2"><a href=
1.7     ! wiz       613:                     "#id2592686">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.7     ! wiz       617:                     "#id2592748">12.5.5. Installing score
1.1       grant     618:                     files</a></span></dt>
                    619: 
                    620:                     <dt><span class="sect2"><a href=
1.7     ! wiz       621:                     "#id2592929">12.5.6. Packages providing login
1.1       grant     622:                     shells</a></span></dt>
                    623: 
                    624:                     <dt><span class="sect2"><a href=
1.7     ! wiz       625:                     "#id2593054">12.5.7. Packages containing perl
1.1       grant     626:                     scripts</a></span></dt>
                    627: 
                    628:                     <dt><span class="sect2"><a href=
1.7     ! wiz       629:                     "#id2593073">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.7     ! wiz       633:                     "#id2593094">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.7     ! wiz       641:                     "#id2593450">12.5.11. Packages installing
1.1       grant     642:                     GConf2 data files</a></span></dt>
                    643: 
                    644:                     <dt><span class="sect2"><a href=
1.7     ! wiz       645:                     "#id2593550">12.5.12. Packages installing
1.1       grant     646:                     scrollkeeper data files</a></span></dt>
                    647: 
                    648:                     <dt><span class="sect2"><a href=
1.7     ! wiz       649:                     "#id2593602">12.5.13. Packages installing X11
1.1       grant     650:                     fonts</a></span></dt>
                    651: 
                    652:                     <dt><span class="sect2"><a href=
1.7     ! wiz       653:                     "#id2593649">12.5.14. Packages installing GTK2
1.1       grant     654:                     modules</a></span></dt>
                    655: 
                    656:                     <dt><span class="sect2"><a href=
1.7     ! wiz       657:                     "#id2593718">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.7     ! wiz       661:                     "#id2593770">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.7     ! wiz       665:                     "#id2593841">12.5.17. Packages using
1.1       grant     666:                     intltool</a></span></dt>
                    667:                   </dl>
                    668:                 </dd>
                    669: 
1.7     ! wiz       670:                 <dt><span class="sect1"><a href="#id2593854">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.7     ! wiz       683:                 <dt><span class="sect1"><a href="#id2594385">14.1.
1.1       grant     684:                 Submitting your packages</a></span></dt>
                    685: 
1.7     ! wiz       686:                 <dt><span class="sect1"><a href="#id2594432">14.2.
1.1       grant     687:                 Committing: Importing a package into
                    688:                 CVS</a></span></dt>
                    689: 
1.7     ! wiz       690:                 <dt><span class="sect1"><a href="#id2594563">14.3.
1.2       hubertf   691:                 Updating a package to a newer
                    692:                 version</a></span></dt>
1.1       grant     693: 
1.7     ! wiz       694:                 <dt><span class="sect1"><a href="#id2594582">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.7     ! wiz       706:             <dt><span class="sect1"><a href="#id2594808">A.1.
1.1       grant     707:             files</a></span></dt>
                    708: 
                    709:             <dd>
                    710:               <dl>
1.7     ! wiz       711:                 <dt><span class="sect2"><a href="#id2594811">A.1.1.
1.1       grant     712:                 Makefile</a></span></dt>
                    713: 
1.7     ! wiz       714:                 <dt><span class="sect2"><a href="#id2594887">A.1.2.
1.1       grant     715:                 DESCR</a></span></dt>
                    716: 
1.7     ! wiz       717:                 <dt><span class="sect2"><a href="#id2594902">A.1.3.
1.1       grant     718:                 PLIST</a></span></dt>
                    719: 
1.7     ! wiz       720:                 <dt><span class="sect2"><a href="#id2594909">A.1.4.
        !           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.7     ! wiz       726:             <dt><span class="sect1"><a href="#id2594950">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.7     ! wiz       752:             <dt><span class="sect1"><a href="#id2595665">D.1.
1.2       hubertf   753:             Targets</a></span></dt>
                    754: 
1.7     ! wiz       755:             <dt><span class="sect1"><a href="#id2595940">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.7     ! wiz       776:           <dt><span class="sect1"><a href="#id2514275">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.7     ! wiz       795:               "id2514275" id=
        !           796:               "id2514275"></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.7     ! wiz      1101:               <dt><span class="sect1"><a href="#id2514853">2.1. As
1.1       grant    1102:               tar file</a></span></dt>
                   1103: 
1.7     ! wiz      1104:               <dt><span class="sect1"><a href="#id2514870">2.2. Via
1.1       grant    1105:               SUP</a></span></dt>
                   1106: 
1.7     ! wiz      1107:               <dt><span class="sect1"><a href="#id2514970">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.7     ! wiz      1117:               <dt><span class="sect1"><a href="#id2515148">3.1.
1.1       grant    1118:               Bootstrapping pkgsrc</a></span></dt>
                   1119: 
1.7     ! wiz      1120:               <dt><span class="sect1"><a href="#id2515255">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.7     ! wiz      1126:                   "#id2515261">3.2.1. Darwin (Mac OS
1.1       grant    1127:                   X)</a></span></dt>
                   1128: 
                   1129:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1130:                   "#id2515492">3.2.2. FreeBSD</a></span></dt>
1.1       grant    1131: 
                   1132:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1133:                   "#id2515662">3.2.3. Interix</a></span></dt>
1.1       grant    1134: 
                   1135:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1136:                   "#id2515753">3.2.4. IRIX</a></span></dt>
1.1       grant    1137: 
                   1138:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1139:                   "#id2516280">3.2.5. OpenBSD</a></span></dt>
1.1       grant    1140: 
                   1141:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1142:                   "#id2516392">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.7     ! wiz      1160:                   "#id2516529">4.1.1. Where to get binary
1.1       grant    1161:                   packages</a></span></dt>
                   1162: 
                   1163:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1164:                   "#id2516569">4.1.2. How to use binary
1.1       grant    1165:                   packages</a></span></dt>
                   1166: 
                   1167:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1168:                   "#id2516704">4.1.3. A word of
1.1       grant    1169:                   warning</a></span></dt>
                   1170:                 </dl>
                   1171:               </dd>
                   1172: 
1.7     ! wiz      1173:               <dt><span class="sect1"><a href="#id2516715">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.7     ! wiz      1179:                   "#id2516725">4.2.1. Requirements</a></span></dt>
1.1       grant    1180: 
                   1181:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1182:                   "#id2516745">4.2.2. Fetching
1.1       grant    1183:                   distfiles</a></span></dt>
                   1184: 
                   1185:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1186:                   "#id2516866">4.2.3. How to build and
1.1       grant    1187:                   install</a></span></dt>
                   1188: 
                   1189:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1190:                   "#id2517182">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.7     ! wiz      1202:               <dt><span class="sect1"><a href="#id2517337">5.1.
1.1       grant    1203:               Building a single binary package</a></span></dt>
                   1204: 
1.7     ! wiz      1205:               <dt><span class="sect1"><a href="#id2517825">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.7     ! wiz      1219:                   "#id2517964">5.3.2. Other environmental
1.1       grant    1220:                   considerations</a></span></dt>
                   1221: 
                   1222:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1223:                   "#id2518005">5.3.3. Operation</a></span></dt>
1.1       grant    1224: 
                   1225:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1226:                   "#id2583270">5.3.4. What it does</a></span></dt>
1.1       grant    1227: 
                   1228:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1229:                   "#id2583326">5.3.5. Disk space
1.1       grant    1230:                   requirements</a></span></dt>
                   1231: 
                   1232:                   <dt><span class="sect2"><a href=
1.7     ! wiz      1233:                   "#id2583421">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.7     ! wiz      1237:                   "#id2583785">5.3.7. Building a partial set of
1.1       grant    1238:                   packages</a></span></dt>
                   1239:                 </dl>
                   1240:               </dd>
                   1241: 
1.7     ! wiz      1242:               <dt><span class="sect1"><a href="#id2583828">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.7     ! wiz      1249:                   "#id2583843">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.7     ! wiz      1261:               <dt><span class="sect1"><a href="#id2584170">6.1. Is
1.1       grant    1262:               there a mailing list for pkg-related
                   1263:               discussion?</a></span></dt>
                   1264: 
1.7     ! wiz      1265:               <dt><span class="sect1"><a href="#id2584200">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.7     ! wiz      1272:               <dt><span class="sect1"><a href="#id2584453">6.4. How
1.1       grant    1273:               to use pkgsrc as non-root</a></span></dt>
                   1274: 
1.7     ! wiz      1275:               <dt><span class="sect1"><a href="#id2584465">6.5. How
1.1       grant    1276:               can I install/use XFree86 from
                   1277:               pkgsrc?</a></span></dt>
                   1278: 
1.7     ! wiz      1279:               <dt><span class="sect1"><a href="#id2584492">6.6. How
1.1       grant    1280:               can I install/use X.org from pkgsrc?</a></span></dt>
                   1281: 
1.7     ! wiz      1282:               <dt><span class="sect1"><a href="#id2584520">6.7. How
1.1       grant    1283:               to fetch files from behind a firewall</a></span></dt>
                   1284: 
1.7     ! wiz      1285:               <dt><span class="sect1"><a href="#id2584534">6.8. How
        !          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.7     ! wiz      1290:               <dt><span class="sect1"><a href="#id2584722">6.9. How
1.1       grant    1291:               to fetch all distfiles at once</a></span></dt>
                   1292: 
1.7     ! wiz      1293:               <dt><span class="sect1"><a href="#id2584861">6.10.
        !          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.7     ! wiz      1298:               <dt><span class="sect1"><a href="#id2584900">6.11.
        !          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.7     ! wiz      1302:               <dt><span class="sect1"><a href="#id2584957">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.7     ! wiz      1332:             <dt><span class="sect1"><a href="#id2514853">2.1. As
1.1       grant    1333:             tar file</a></span></dt>
                   1334: 
1.7     ! wiz      1335:             <dt><span class="sect1"><a href="#id2514870">2.2. Via
1.1       grant    1336:             SUP</a></span></dt>
                   1337: 
1.7     ! wiz      1338:             <dt><span class="sect1"><a href="#id2514970">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.7     ! wiz      1352:                 "id2514853" id="id2514853"></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=
                   1360:           "ftp://ftp.NetBSD.org/pub/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.7     ! wiz      1370:                 "id2514870" id="id2514870"></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.7     ! wiz      1396:                 "id2514970" id="id2514970"></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.7     ! wiz      1453:             <dt><span class="sect1"><a href="#id2515148">3.1.
1.1       grant    1454:             Bootstrapping pkgsrc</a></span></dt>
                   1455: 
1.7     ! wiz      1456:             <dt><span class="sect1"><a href="#id2515255">3.2.
1.1       grant    1457:             Platform specific notes</a></span></dt>
                   1458: 
                   1459:             <dd>
                   1460:               <dl>
1.7     ! wiz      1461:                 <dt><span class="sect2"><a href="#id2515261">3.2.1.
1.1       grant    1462:                 Darwin (Mac OS X)</a></span></dt>
                   1463: 
1.7     ! wiz      1464:                 <dt><span class="sect2"><a href="#id2515492">3.2.2.
1.1       grant    1465:                 FreeBSD</a></span></dt>
                   1466: 
1.7     ! wiz      1467:                 <dt><span class="sect2"><a href="#id2515662">3.2.3.
1.1       grant    1468:                 Interix</a></span></dt>
                   1469: 
1.7     ! wiz      1470:                 <dt><span class="sect2"><a href="#id2515753">3.2.4.
1.1       grant    1471:                 IRIX</a></span></dt>
                   1472: 
1.7     ! wiz      1473:                 <dt><span class="sect2"><a href="#id2516280">3.2.5.
1.1       grant    1474:                 OpenBSD</a></span></dt>
                   1475: 
1.7     ! wiz      1476:                 <dt><span class="sect2"><a href="#id2516392">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.7     ! wiz      1488:                 "id2515148" id=
        !          1489:                 "id2515148"></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.7     ! wiz      1571:                 "id2515255" id="id2515255"></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.7     ! wiz      1584:                   <h3 class="title"><a name="id2515261" id=
        !          1585:                   "id2515261"></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.7     ! wiz      1717:                   <h3 class="title"><a name="id2515492" id=
        !          1718:                   "id2515492"></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.7     ! wiz      1774:                   <h3 class="title"><a name="id2515662" id=
        !          1775:                   "id2515662"></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.7     ! wiz      1945:                   <h3 class="title"><a name="id2515753" id=
        !          1946:                   "id2515753"></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=
        !          1990:             "filename">pkgsrc/mk/bsd.pkg.defaults.mk</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.7     ! wiz      1998:                   <h3 class="title"><a name="id2516280" id=
        !          1999:                   "id2516280"></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
                   2051: # pkgsrc stuff, e.g. insert bsd.pkg.defaults.mk or similar here
                   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.7     ! wiz      2065:                   <h3 class="title"><a name="id2516392" id=
        !          2066:                   "id2516392"></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.7     ! wiz      2110:                     <h4 class="title"><a name="id2516423" id=
        !          2111:                     "id2516423"></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.7     ! wiz      2140:                     <h4 class="title"><a name="id2516444" id=
        !          2141:                     "id2516444"></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.7     ! wiz      2218:                 <dt><span class="sect2"><a href="#id2516529">4.1.1.
1.1       grant    2219:                 Where to get binary packages</a></span></dt>
                   2220: 
1.7     ! wiz      2221:                 <dt><span class="sect2"><a href="#id2516569">4.1.2.
1.1       grant    2222:                 How to use binary packages</a></span></dt>
                   2223: 
1.7     ! wiz      2224:                 <dt><span class="sect2"><a href="#id2516704">4.1.3.
1.1       grant    2225:                 A word of warning</a></span></dt>
                   2226:               </dl>
                   2227:             </dd>
                   2228: 
1.7     ! wiz      2229:             <dt><span class="sect1"><a href="#id2516715">4.2.
1.1       grant    2230:             Building packages from source</a></span></dt>
                   2231: 
                   2232:             <dd>
                   2233:               <dl>
1.7     ! wiz      2234:                 <dt><span class="sect2"><a href="#id2516725">4.2.1.
1.1       grant    2235:                 Requirements</a></span></dt>
                   2236: 
1.7     ! wiz      2237:                 <dt><span class="sect2"><a href="#id2516745">4.2.2.
1.1       grant    2238:                 Fetching distfiles</a></span></dt>
                   2239: 
1.7     ! wiz      2240:                 <dt><span class="sect2"><a href="#id2516866">4.2.3.
1.1       grant    2241:                 How to build and install</a></span></dt>
                   2242: 
1.7     ! wiz      2243:                 <dt><span class="sect2"><a href="#id2517182">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.7     ! wiz      2270:                   <h3 class="title"><a name="id2516529" id=
        !          2271:                   "id2516529"></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.7     ! wiz      2302:                   <h3 class="title"><a name="id2516569" id=
        !          2303:                   "id2516569"></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.7     ! wiz      2347:                   <h3 class="title"><a name="id2516704" id=
        !          2348:                   "id2516704"></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.7     ! wiz      2371:                 "id2516715" id="id2516715"></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.7     ! wiz      2386:                   <h3 class="title"><a name="id2516725" id=
        !          2387:                   "id2516725"></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.7     ! wiz      2406:                   <h3 class="title"><a name="id2516745" id=
        !          2407:                   "id2516745"></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=
        !          2424:             "filename">pkgsrc/mk/bsd.pkg.defaults.mk</code> to find
        !          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.7     ! wiz      2448:                   <h3 class="title"><a name="id2516866" id=
        !          2449:                   "id2516866"></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=
        !          2513:             "filename">pkgsrc/mk/bsd.pkg.defaults.mk</code> to get
        !          2514:             an overview of what will be set there by default.
        !          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
                   2574:             a remote FTP server, you can use the the "bin-install"
                   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=
        !          2583:             "varname">BINPKG_SITE</code>, which defaults to
        !          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=
        !          2591:             "filename">pkgsrc/mk/bsd.pkg.defaults.mk</code> for
        !          2592:             more 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.7     ! wiz      2613:                   <h3 class="title"><a name="id2517182" id=
        !          2614:                   "id2517182"></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.7     ! wiz      2714:             <dt><span class="sect1"><a href="#id2517337">5.1.
1.1       grant    2715:             Building a single binary package</a></span></dt>
                   2716: 
1.7     ! wiz      2717:             <dt><span class="sect1"><a href="#id2517825">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.7     ! wiz      2730:                 <dt><span class="sect2"><a href="#id2517964">5.3.2.
1.1       grant    2731:                 Other environmental considerations</a></span></dt>
                   2732: 
1.7     ! wiz      2733:                 <dt><span class="sect2"><a href="#id2518005">5.3.3.
1.1       grant    2734:                 Operation</a></span></dt>
                   2735: 
1.7     ! wiz      2736:                 <dt><span class="sect2"><a href="#id2583270">5.3.4.
1.1       grant    2737:                 What it does</a></span></dt>
                   2738: 
1.7     ! wiz      2739:                 <dt><span class="sect2"><a href="#id2583326">5.3.5.
1.1       grant    2740:                 Disk space requirements</a></span></dt>
                   2741: 
1.7     ! wiz      2742:                 <dt><span class="sect2"><a href="#id2583421">5.3.6.
1.1       grant    2743:                 Setting up a sandbox for chroot'ed
                   2744:                 builds</a></span></dt>
                   2745: 
1.7     ! wiz      2746:                 <dt><span class="sect2"><a href="#id2583785">5.3.7.
1.1       grant    2747:                 Building a partial set of packages</a></span></dt>
                   2748:               </dl>
                   2749:             </dd>
                   2750: 
1.7     ! wiz      2751:             <dt><span class="sect1"><a href="#id2583828">5.4.
1.1       grant    2752:             Creating a multiple CD-ROM packages
                   2753:             collection</a></span></dt>
                   2754: 
                   2755:             <dd>
                   2756:               <dl>
1.7     ! wiz      2757:                 <dt><span class="sect2"><a href="#id2583843">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.7     ! wiz      2769:                 "id2517337" id="id2517337"></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.7     ! wiz      2823:                 "id2517825" id="id2517825"></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=
        !          2882:               "filename">pkgsrc/mk/bsd.pkg.defaults.mk</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.7     ! wiz      2905:                     <h4 class="title"><a name="id2517889" id=
        !          2906:                     "id2517889"></a>5.3.1.2.&nbsp;<code class=
        !          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.7     ! wiz      2931:                     <h4 class="title"><a name="id2517925" id=
        !          2932:                     "id2517925"></a>5.3.1.3.&nbsp;<code class=
        !          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.7     ! wiz      2963:                   <h3 class="title"><a name="id2517964" id=
        !          2964:                   "id2517964"></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.7     ! wiz      3005:                   <h3 class="title"><a name="id2518005" id=
        !          3006:                   "id2518005"></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.7     ! wiz      3052:                   <h3 class="title"><a name="id2583270" id=
        !          3053:                   "id2583270"></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.7     ! wiz      3111:                   <h3 class="title"><a name="id2583326" id=
        !          3112:                   "id2583326"></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.7     ! wiz      3154:                   <h3 class="title"><a name="id2583421" id=
        !          3155:                   "id2583421"></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.7     ! wiz      3331:                   <h3 class="title"><a name="id2583785" id=
        !          3332:                   "id2583785"></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.7     ! wiz      3385:                 "id2583828" id="id2583828"></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.7     ! wiz      3408:                   <h3 class="title"><a name="id2583843" id=
        !          3409:                   "id2583843"></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.7     ! wiz      3482:             <dt><span class="sect1"><a href="#id2584170">6.1. Is
1.1       grant    3483:             there a mailing list for pkg-related
                   3484:             discussion?</a></span></dt>
                   3485: 
1.7     ! wiz      3486:             <dt><span class="sect1"><a href="#id2584200">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.7     ! wiz      3493:             <dt><span class="sect1"><a href="#id2584453">6.4. How
1.1       grant    3494:             to use pkgsrc as non-root</a></span></dt>
                   3495: 
1.7     ! wiz      3496:             <dt><span class="sect1"><a href="#id2584465">6.5. How
1.1       grant    3497:             can I install/use XFree86 from pkgsrc?</a></span></dt>
                   3498: 
1.7     ! wiz      3499:             <dt><span class="sect1"><a href="#id2584492">6.6. How
1.1       grant    3500:             can I install/use X.org from pkgsrc?</a></span></dt>
                   3501: 
1.7     ! wiz      3502:             <dt><span class="sect1"><a href="#id2584520">6.7. How
1.1       grant    3503:             to fetch files from behind a firewall</a></span></dt>
                   3504: 
1.7     ! wiz      3505:             <dt><span class="sect1"><a href="#id2584534">6.8. How
        !          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.7     ! wiz      3510:             <dt><span class="sect1"><a href="#id2584722">6.9. How
1.1       grant    3511:             to fetch all distfiles at once</a></span></dt>
                   3512: 
1.7     ! wiz      3513:             <dt><span class="sect1"><a href="#id2584861">6.10. What
        !          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.7     ! wiz      3518:             <dt><span class="sect1"><a href="#id2584900">6.11. What
        !          3519:             does &#8220;<span class="quote">Could not find
        !          3520:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    3521: 
1.7     ! wiz      3522:             <dt><span class="sect1"><a href="#id2584957">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.7     ! wiz      3544:                 "id2584170" id="id2584170"></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.7     ! wiz      3569:                 "id2584200" id="id2584200"></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.7     ! wiz      3824:                 "id2584453" id="id2584453"></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.7     ! wiz      3842:                 "id2584465" id="id2584465"></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.7     ! wiz      3865:                 "id2584492" id="id2584492"></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.7     ! wiz      3888:                 "id2584520" id="id2584520"></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.7     ! wiz      3913:                 "id2584534" id="id2584534"></a>6.8.&nbsp;How do I
        !          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.7     ! wiz      3947:                 "id2584722" id="id2584722"></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.7     ! wiz      4016:                 "id2584861" id="id2584861"></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.7     ! wiz      4048:                 "id2584900" id="id2584900"></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.7     ! wiz      4077:                 "id2584957" id="id2584957"></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.6       hubertf  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.7     ! wiz      4359:               <dt><span class="sect1"><a href="#id2586071">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.7     ! wiz      4366:               <dt><span class="sect1"><a href="#id2586197">7.6.
        !          4367:               <code class="filename">work*</code></a></span></dt>
1.1       grant    4368: 
1.7     ! wiz      4369:               <dt><span class="sect1"><a href="#id2586284">7.7.
        !          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.7     ! wiz      4379:               <dt><span class="sect1"><a href="#id2586339">8.1. RCS
1.1       grant    4380:               ID</a></span></dt>
                   4381: 
1.7     ! wiz      4382:               <dt><span class="sect1"><a href="#id2586354">8.2.
        !          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.7     ! wiz      4393:               <dt><span class="sect1"><a href="#id2586743">8.5.
1.1       grant    4394:               Manpage-compression</a></span></dt>
                   4395: 
1.7     ! wiz      4396:               <dt><span class="sect1"><a href="#id2586785">8.6.
        !          4397:               Changing PLIST source with <code class=
        !          4398:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    4399: 
1.7     ! wiz      4400:               <dt><span class="sect1"><a href="#id2586802">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.7     ! wiz      4415:               <dt><span class="sect1"><a href="#id2587074">9.1.
1.1       grant    4416:               Converting packages to use buildlink3</a></span></dt>
                   4417: 
1.7     ! wiz      4418:               <dt><span class="sect1"><a href="#id2587265">9.2.
        !          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.7     ! wiz      4425:                   "#id2587470">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.7     ! wiz      4429:                   "#id2588048">9.2.2. Updating <code class=
        !          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.7     ! wiz      4437:               <dt><span class="sect1"><a href="#id2588126">9.3.
        !          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.7     ! wiz      4444:                   "#id2588208">9.3.1. Anatomy of a <code class=
        !          4445:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    4446: 
                   4447:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4448:                   "#id2588366">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.7     ! wiz      4460:               <dt><span class="sect1"><a href="#id2588507">10.1.
1.1       grant    4461:               Global default options</a></span></dt>
                   4462: 
1.7     ! wiz      4463:               <dt><span class="sect1"><a href="#id2588522">10.2.
        !          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.7     ! wiz      4477:               <dt><span class="sect1"><a href="#id2589198">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.7     ! wiz      4491:               <dt><span class="sect1"><a href="#id2590531">12.1.
1.1       grant    4492:               General operation</a></span></dt>
                   4493: 
                   4494:               <dd>
                   4495:                 <dl>
                   4496:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4497:                   "#id2590534">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.7     ! wiz      4501:                   "#id2590685">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.7     ! wiz      4509:                   "#id2591201">12.1.4. Handling conflicts with
1.1       grant    4510:                   other packages</a></span></dt>
                   4511: 
                   4512:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4513:                   "#id2591251">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.7     ! wiz      4517:                   "#id2591413">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.7     ! wiz      4525:                   "#id2591505">12.1.8. How to handle compiler
1.1       grant    4526:                   bugs</a></span></dt>
                   4527: 
                   4528:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4529:                   "#id2591527">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.7     ! wiz      4534:                   "#id2591644">12.1.10. Portability of
1.1       grant    4535:                   packages</a></span></dt>
                   4536:                 </dl>
                   4537:               </dd>
                   4538: 
1.7     ! wiz      4539:               <dt><span class="sect1"><a href="#id2591669">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.7     ! wiz      4545:                   "#id2591672">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.7     ! wiz      4550:                   "#id2591735">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.7     ! wiz      4555:               <dt><span class="sect1"><a href="#id2591747">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.7     ! wiz      4565:                   "#id2592086">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.7     ! wiz      4570:                   "#id2592238">12.3.3. GNU
1.1       grant    4571:                   Autoconf/Automake</a></span></dt>
                   4572:                 </dl>
                   4573:               </dd>
                   4574: 
1.7     ! wiz      4575:               <dt><span class="sect1"><a href="#id2592283">12.4.
1.1       grant    4576:               Building considerations</a></span></dt>
                   4577: 
                   4578:               <dd>
                   4579:                 <dl>
                   4580:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4581:                   "#id2592286">12.4.1. CPP defines</a></span></dt>
1.1       grant    4582:                 </dl>
                   4583:               </dd>
                   4584: 
1.7     ! wiz      4585:               <dt><span class="sect1"><a href="#id2592316">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.7     ! wiz      4591:                   "#id2592320">12.5.1. Package configuration
1.1       grant    4592:                   files</a></span></dt>
                   4593: 
                   4594:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4595:                   "#id2592490">12.5.2. User
1.2       hubertf  4596:                   interaction</a></span></dt>
1.1       grant    4597: 
                   4598:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4599:                   "#id2592535">12.5.3. Handling
1.1       grant    4600:                   licenses</a></span></dt>
                   4601: 
                   4602:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4603:                   "#id2592686">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.7     ! wiz      4607:                   "#id2592748">12.5.5. Installing score
1.1       grant    4608:                   files</a></span></dt>
                   4609: 
                   4610:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4611:                   "#id2592929">12.5.6. Packages providing login
1.1       grant    4612:                   shells</a></span></dt>
                   4613: 
                   4614:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4615:                   "#id2593054">12.5.7. Packages containing perl
1.1       grant    4616:                   scripts</a></span></dt>
                   4617: 
                   4618:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4619:                   "#id2593073">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.7     ! wiz      4623:                   "#id2593094">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.7     ! wiz      4631:                   "#id2593450">12.5.11. Packages installing GConf2
1.1       grant    4632:                   data files</a></span></dt>
                   4633: 
                   4634:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4635:                   "#id2593550">12.5.12. Packages installing
1.1       grant    4636:                   scrollkeeper data files</a></span></dt>
                   4637: 
                   4638:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4639:                   "#id2593602">12.5.13. Packages installing X11
1.1       grant    4640:                   fonts</a></span></dt>
                   4641: 
                   4642:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4643:                   "#id2593649">12.5.14. Packages installing GTK2
1.1       grant    4644:                   modules</a></span></dt>
                   4645: 
                   4646:                   <dt><span class="sect2"><a href=
1.7     ! wiz      4647:                   "#id2593718">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.7     ! wiz      4651:                   "#id2593770">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.7     ! wiz      4655:                   "#id2593841">12.5.17. Packages using
1.1       grant    4656:                   intltool</a></span></dt>
                   4657:                 </dl>
                   4658:               </dd>
                   4659: 
1.7     ! wiz      4660:               <dt><span class="sect1"><a href="#id2593854">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.7     ! wiz      4673:               <dt><span class="sect1"><a href="#id2594385">14.1.
1.1       grant    4674:               Submitting your packages</a></span></dt>
                   4675: 
1.7     ! wiz      4676:               <dt><span class="sect1"><a href="#id2594432">14.2.
1.1       grant    4677:               Committing: Importing a package into
                   4678:               CVS</a></span></dt>
                   4679: 
1.7     ! wiz      4680:               <dt><span class="sect1"><a href="#id2594563">14.3.
1.2       hubertf  4681:               Updating a package to a newer version</a></span></dt>
1.1       grant    4682: 
1.7     ! wiz      4683:               <dt><span class="sect1"><a href="#id2594582">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.7     ! wiz      4716:             <dt><span class="sect1"><a href="#id2586071">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.7     ! wiz      4723:             <dt><span class="sect1"><a href="#id2586197">7.6.
        !          4724:             <code class="filename">work*</code></a></span></dt>
1.1       grant    4725: 
1.7     ! wiz      4726:             <dt><span class="sect1"><a href="#id2586284">7.7.
        !          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}
                   4782:         ${MASTER_SITE_MOZILLA}
                   4783:         ${MASTER_SITE_PERL_CPAN}
                   4784:         ${MASTER_SITE_SOURCEFORGE}
                   4785:         ${MASTER_SITE_SUNSITE}
                   4786:         ${MASTER_SITE_R_CRAN}
                   4787:         ${MASTER_SITE_SUSE}
                   4788:         ${MASTER_SITE_TEX_CTAN}
                   4789:         ${MASTER_SITE_XCONTRIB}
                   4790:         ${MASTER_SITE_XEMACS} 
                   4791: </pre>
                   4792: 
                   4793:           <p>If one of these predefined sites is chosen, you may
                   4794:           require the ability to specify a subdirectory of that
                   4795:           site. Since these macros may expand to more than one
                   4796:           actual site, you <span class=
                   4797:           "emphasis"><em>must</em></span> use the following
                   4798:           construct to specify a subdirectory:</p>
                   4799:           <pre class="programlisting">
                   4800:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   4801:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   4802: </pre>
                   4803: 
                   4804:           <p>Note the trailing slash after the subdirectory
                   4805:           name.</p>
                   4806: 
                   4807:           <div class="note" style=
                   4808:           "margin-left: 0.5in; margin-right: 0.5in;">
                   4809:             <h3 class="title">Note</h3>
                   4810: 
1.7     ! wiz      4811:             <p><code class="varname">MASTER_SITE_SUBDIR</code> has
        !          4812:             been deprecated and <span class="emphasis"><em>should
        !          4813:             no longer be used</em></span>.</p>
1.1       grant    4814:           </div>
                   4815: 
1.7     ! wiz      4816:           <p>If the package has multiple <code class=
        !          4817:           "varname">DISTFILES</code> or multiple <code class=
        !          4818:           "varname">PATCHFILES</code> from different sites, set
        !          4819:           <code class="varname">SITES_foo</code> to a list of URI's
1.1       grant    4820:           where file &#8220;<span class="quote">foo</span>&#8221;
                   4821:           may be found. &#8220;<span class=
                   4822:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   4823:           <pre class="programlisting">
                   4824: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   4825: DISTFILES+=     foo-file.tar.gz
                   4826: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   4827:         http://www.somewhereelse.com/mirror/somehow/
                   4828: </pre>
                   4829: 
1.7     ! wiz      4830:           <p>Note that the normal default setting of <code class=
        !          4831:           "varname">DISTFILES</code> must be made explicit if you
1.1       grant    4832:           want to add to it (rather than replace it), as you
                   4833:           usually would.</p>
                   4834: 
                   4835:           <p>Currently the following values are available for
1.7     ! wiz      4836:           <code class="varname">CATEGORIES</code>. If more than one
        !          4837:           is used, they need to be separated by spaces:</p>
1.1       grant    4838:           <pre class="programlisting">
                   4839: archivers     cross         geography     meta-pkgs     security
                   4840: audio         databases     graphics      misc          shells
                   4841: benchmarks    devel         ham           multimedia    sysutils
                   4842: biology       editors       inputmethod   net           textproc
                   4843: cad           emulators     lang          news          time
                   4844: chat          finance       mail          parallel      wm
                   4845: comms         fonts         math          pkgtools      www
                   4846: converters    games         mbone         print         x11
                   4847: </pre>
                   4848: 
                   4849:           <p>Please pay attention to the following gotchas:</p>
                   4850: 
                   4851:           <div class="itemizedlist">
                   4852:             <ul type="disc">
                   4853:               <li>
1.7     ! wiz      4854:                 <p>Add <code class="varname">MANCOMPRESSED</code>
        !          4855:                 if manpages are installed in compressed form by the
        !          4856:                 package; see comment in <code class=
        !          4857:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    4858:               </li>
                   4859: 
                   4860:               <li>
1.7     ! wiz      4861:                 <p>Replace <code class="filename">/usr/local</code>
1.1       grant    4862:                 with &#8220;<span class=
                   4863:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   4864:                 patches, below).</p>
                   4865:               </li>
                   4866: 
                   4867:               <li>
                   4868:                 <p>If the package installs any info files, see
                   4869:                 <a href="#faq.info-files" title=
                   4870:                 "12.5.10.&nbsp;Packages installing info files">Section
                   4871:                 12.5.10, &#8220;Packages installing info
                   4872:                 files&#8221;</a>.</p>
                   4873:               </li>
                   4874: 
                   4875:               <li>
1.7     ! wiz      4876:                 <p>Set <code class="varname">MAINTAINER</code> to
        !          4877:                 be yourself. If you really can't maintain the
        !          4878:                 package for future updates, set it to <code class=
1.1       grant    4879:                 "email">&lt;<a href=
1.7     ! wiz      4880:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.1       grant    4881:               </li>
                   4882: 
                   4883:               <li>
                   4884:                 <p>If a home page for the software in question
1.7     ! wiz      4885:                 exists, add the variable <code class=
        !          4886:                 "varname">HOMEPAGE</code> right after <code class=
        !          4887:                 "varname">MAINTAINER</code>. The value of this
1.1       grant    4888:                 variable should be the URL for the home page.</p>
                   4889:               </li>
                   4890: 
                   4891:               <li>
1.7     ! wiz      4892:                 <p>Be sure to set the <code class=
        !          4893:                 "varname">COMMENT</code> variable to a short
1.1       grant    4894:                 description of the package, not containing the
                   4895:                 pkg's name.</p>
                   4896:               </li>
                   4897:             </ul>
                   4898:           </div>
                   4899:         </div>
                   4900: 
                   4901:         <div class="sect1" lang="en" xml:lang="en">
                   4902:           <div class="titlepage">
                   4903:             <div>
                   4904:               <div>
                   4905:                 <h2 class="title" style="clear: both"><a name=
                   4906:                 "components.distinfo" id=
1.7     ! wiz      4907:                 "components.distinfo"></a>7.2.&nbsp;<code class=
        !          4908:                 "filename">distinfo</code></h2>
1.1       grant    4909:               </div>
                   4910:             </div>
                   4911:           </div>
                   4912: 
                   4913:           <p>Most important, the mandatory message digest, or
                   4914:           checksum, of all the distfiles needed for the package to
                   4915:           compile, confirming they match the original file
                   4916:           distributed by the author. This ensures that the distfile
                   4917:           retrieved from the Internet has not been corrupted during
                   4918:           transfer or altered by a malign force to introduce a
1.7     ! wiz      4919:           security hole. It is generated using the
        !          4920:           <span><strong class="command">make
        !          4921:           makesum</strong></span> command. The digest algorithm
        !          4922:           used was, at one stage, md5, but that was felt lacking
        !          4923:           compared to sha1, and so sha1 is now the default
1.1       grant    4924:           algorithm. The distfile size is also generated and stored
                   4925:           in new distinfo files. The <a xmlns=
                   4926:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4927:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.7     ! wiz      4928:           class="pkgname">pkgtools/digest</a> utility calculates
        !          4929:           all of the digests in the distinfo file, and it provides
        !          4930:           various different algorithms. At the current time, the
        !          4931:           algorithms provided are: <span class=
        !          4932:           "emphasis"><em>md5</em></span>, <span class=
        !          4933:           "emphasis"><em>rmd160</em></span>, <span class=
        !          4934:           "emphasis"><em>sha1</em></span>, <span class=
        !          4935:           "emphasis"><em>sha256</em></span>, <span class=
        !          4936:           "emphasis"><em>sha384</em></span> and <span class=
        !          4937:           "emphasis"><em>sha512</em></span>.</p>
1.1       grant    4938: 
                   4939:           <p>Some packages have different sets of distfiles on a
                   4940:           per architecture basis, for example <a xmlns=
                   4941:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4942:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.7     ! wiz      4943:           class="pkgname">www/navigator</a>). These are kept in the
        !          4944:           same distinfo file and care should be taken when
        !          4945:           upgrading such a package to ensure distfile information
        !          4946:           is not lost.</p>
1.1       grant    4947: 
                   4948:           <p>The message digest/checksum for all the official
1.7     ! wiz      4949:           patches found in the <code class=
        !          4950:           "filename">patches/</code> directory (see <a href=
        !          4951:           "#components.patches" title=
1.1       grant    4952:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   4953:           &#8220;patches/*&#8221;</a>) for the package is also
1.7     ! wiz      4954:           stored in the <code class="filename">distinfo</code>
        !          4955:           file. This is a message digest/checksum of all lines in
        !          4956:           the patch file except the NetBSD RCS Id. This file is
        !          4957:           generated by invoking <span><strong class="command">make
        !          4958:           makepatchsum</strong></span> (or <span><strong class=
        !          4959:           "command">make mps</strong></span> if you're in a
        !          4960:           hurry).</p>
1.1       grant    4961:         </div>
                   4962: 
                   4963:         <div class="sect1" lang="en" xml:lang="en">
                   4964:           <div class="titlepage">
                   4965:             <div>
                   4966:               <div>
                   4967:                 <h2 class="title" style="clear: both"><a name=
                   4968:                 "components.patches" id=
                   4969:                 "components.patches"></a>7.3.&nbsp;patches/*</h2>
                   4970:               </div>
                   4971:             </div>
                   4972:           </div>
                   4973: 
                   4974:           <p>This directory contains files that are used by the
                   4975:           <a href=
                   4976:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   4977:           <span class="citerefentry"><span class=
                   4978:           "refentrytitle">patch</span>(1)</span></a> command to
                   4979:           modify the sources as distributed in the distribution
                   4980:           file into a form that will compile and run perfectly on
                   4981:           NetBSD. The files are applied successively in alphabetic
                   4982:           order (as returned by a shell &#8220;<span class=
                   4983:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.7     ! wiz      4984:           <code class="filename">patch-aa</code> is applied before
        !          4985:           <code class="filename">patch-ab</code>, etc.</p>
1.1       grant    4986: 
1.7     ! wiz      4987:           <p>The <code class="filename">patch-*</code> files should
        !          4988:           be in <span><strong class="command">diff
        !          4989:           -bu</strong></span> format, and apply without a fuzz to
        !          4990:           avoid problems. (To force patches to apply with fuzz you
        !          4991:           can set <code class=
        !          4992:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    4993:           not put changes for more than one file into a single
                   4994:           patch-file, as this will make future modifications more
                   4995:           difficult.</p>
                   4996: 
                   4997:           <p>Similar, a file should be patched at most once, not
                   4998:           several times by several different patches. If a file
                   4999:           needs several patches, they should be combined into one
                   5000:           file.</p>
                   5001: 
                   5002:           <p>One important thing to mention is to pay attention
                   5003:           that no RCS IDs get stored in the patch files, as these
                   5004:           will cause problems when later checked into the NetBSD
1.7     ! wiz      5005:           CVS tree. Use the <span><strong class=
        !          5006:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    5007:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5008:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.7     ! wiz      5009:           class="pkgname">pkgtools/pkgdiff</a> package to avoid
        !          5010:           these problems.</p>
1.1       grant    5011: 
                   5012:           <p>For even more automation, we recommend using
1.7     ! wiz      5013:           <span><strong class="command">mkpatches</strong></span>
        !          5014:           from the same package to make a whole set of patches. You
        !          5015:           just have to backup files before you edit them to
        !          5016:           <code class="filename">filename.orig</code>, e.g. with
        !          5017:           <span><strong class="command">cp -p filename
        !          5018:           filename.orig</strong></span> or, easier, by using
        !          5019:           <span><strong class="command">pkgvi</strong></span> again
        !          5020:           from the same package. If you upgrade a package this way,
        !          5021:           you can easily compare the new set of patches with the
        !          5022:           previously existing one with <span><strong class=
        !          5023:           "command">patchdiff</strong></span>.</p>
1.1       grant    5024: 
                   5025:           <p>When you have finished a package, remember to generate
                   5026:           the checksums for the patch files by using the
1.7     ! wiz      5027:           <span><strong class="command">make
        !          5028:           makepatchsum</strong></span> command, see <a href=
        !          5029:           "#components.distinfo" title=
1.5       hubertf  5030:           "7.2.&nbsp;distinfo">Section&nbsp;7.2,
1.7     ! wiz      5031:           &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    5032: 
                   5033:           <p>Patch files that are distributed by the author or
1.7     ! wiz      5034:           other maintainers can be listed in <code class=
        !          5035:           "varname">$PATCHFILES</code>.</p>
1.1       grant    5036: 
                   5037:           <p>If it is desired to store any patches that should not
                   5038:           be committed into pkgsrc, they can be kept outside the
1.7     ! wiz      5039:           pkgsrc tree in the <code class=
        !          5040:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    5041:           tree there is expected to have the same
                   5042:           &#8220;<span class="quote">category/package</span>&#8221;
                   5043:           structure as pkgsrc, and patches are expected to be
1.7     ! wiz      5044:           stored inside these dirs (also known as <code class=
        !          5045:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
        !          5046:           you want to keep a private patch for <code class=
        !          5047:           "filename">pkgsrc/graphics/png</code>, keep it in
        !          5048:           <code class=
        !          5049:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
        !          5050:           files in the named directory are expected to be patch
1.1       grant    5051:           files, and <span class="emphasis"><em>they are applied
                   5052:           after pkgsrc patches are applied</em></span>.</p>
                   5053:         </div>
                   5054: 
                   5055:         <div class="sect1" lang="en" xml:lang="en">
                   5056:           <div class="titlepage">
                   5057:             <div>
                   5058:               <div>
                   5059:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      5060:                 "id2586071" id="id2586071"></a>7.4.&nbsp;Other
1.1       grant    5061:                 mandatory files</h2>
                   5062:               </div>
                   5063:             </div>
                   5064:           </div>
                   5065: 
                   5066:           <div class="variablelist">
                   5067:             <dl>
1.7     ! wiz      5068:               <dt><span class="term"><code class=
        !          5069:               "filename">DESCR</code></span></dt>
1.1       grant    5070: 
                   5071:               <dd>
                   5072:                 <p>A multi-line description of the piece of
                   5073:                 software. This should include any credits where
                   5074:                 they are due. Please bear in mind that others do
                   5075:                 not share your sense of humour (or spelling
                   5076:                 idiosyncrasies), and that others will read
                   5077:                 everything that you write here.</p>
                   5078:               </dd>
                   5079: 
1.7     ! wiz      5080:               <dt><span class="term"><code class=
        !          5081:               "filename">PLIST</code></span></dt>
1.1       grant    5082: 
                   5083:               <dd>
                   5084:                 <p>This file governs the files that are installed
                   5085:                 on your system: all the binaries, manual pages,
                   5086:                 etc. There are other directives which may be
                   5087:                 entered in this file, to control the creation and
                   5088:                 deletion of directories, and the location of
                   5089:                 inserted files. See <a href="#plist" title=
                   5090:                 "Chapter&nbsp;8.&nbsp;PLIST issues">Chapter&nbsp;8,
                   5091:                 <i>PLIST issues</i></a> for more information.</p>
                   5092:               </dd>
                   5093:             </dl>
                   5094:           </div>
                   5095:         </div>
                   5096: 
                   5097:         <div class="sect1" lang="en" xml:lang="en">
                   5098:           <div class="titlepage">
                   5099:             <div>
                   5100:               <div>
                   5101:                 <h2 class="title" style="clear: both"><a name=
                   5102:                 "components.optional" id=
                   5103:                 "components.optional"></a>7.5.&nbsp;Optional
                   5104:                 files</h2>
                   5105:               </div>
                   5106:             </div>
                   5107:           </div>
                   5108: 
                   5109:           <div class="variablelist">
                   5110:             <dl>
1.7     ! wiz      5111:               <dt><span class="term"><code class=
        !          5112:               "filename">INSTALL</code></span></dt>
1.1       grant    5113: 
                   5114:               <dd>
                   5115:                 <p>This shell script is invoked twice by <a href=
                   5116:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5117:                 <span class="citerefentry"><span class=
                   5118:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   5119:                 time after package extraction and before files are
                   5120:                 moved in place, the second time after the files to
                   5121:                 install are moved in place. This can be used to do
                   5122:                 any custom procedures not possible with @exec
1.7     ! wiz      5123:                 commands in <code class="filename">PLIST</code>.
        !          5124:                 See <a href=
1.1       grant    5125:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5126:                 <span class="citerefentry"><span class=
                   5127:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   5128:                 <a href=
                   5129:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5130:                 <span class="citerefentry"><span class=
                   5131:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5132:                 more information.</p>
                   5133:               </dd>
                   5134: 
1.7     ! wiz      5135:               <dt><span class="term"><code class=
        !          5136:               "filename">DEINSTALL</code></span></dt>
1.1       grant    5137: 
                   5138:               <dd>
                   5139:                 <p>This script is executed before and after any
                   5140:                 files are removed. It is this script's
                   5141:                 responsibility to clean up any additional messy
                   5142:                 details around the package's installation, since
                   5143:                 all pkg_delete knows is how to delete the files
                   5144:                 created in the original distribution. See <a href=
                   5145:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   5146:                 <span class="citerefentry"><span class=
                   5147:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   5148:                 <a href=
                   5149:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5150:                 <span class="citerefentry"><span class=
                   5151:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5152:                 more information.</p>
                   5153:               </dd>
                   5154: 
1.7     ! wiz      5155:               <dt><span class="term"><code class=
        !          5156:               "filename">MESSAGE</code></span></dt>
1.1       grant    5157: 
                   5158:               <dd>
                   5159:                 <p>Display this file after installation of the
                   5160:                 package. Useful for things like legal notices on
                   5161:                 almost-free software and hints for updating config
                   5162:                 files after installing modules for apache, PHP etc.
                   5163:                 Please note that you can modify variables in it
1.7     ! wiz      5164:                 easily by using <code class=
        !          5165:                 "varname">MESSAGE_SUBST</code> in the package's
        !          5166:                 <code class="filename">Makefile</code>:</p>
1.1       grant    5167:                 <pre class="programlisting">
                   5168: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   5169: </pre>
                   5170: 
                   5171:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.7     ! wiz      5172:                 "quote">somevalue</span>&#8221; in <code class=
        !          5173:                 "filename">MESSAGE</code>.</p>
1.1       grant    5174:               </dd>
                   5175:             </dl>
                   5176:           </div>
                   5177:         </div>
                   5178: 
                   5179:         <div class="sect1" lang="en" xml:lang="en">
                   5180:           <div class="titlepage">
                   5181:             <div>
                   5182:               <div>
                   5183:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      5184:                 "id2586197" id=
        !          5185:                 "id2586197"></a>7.6.&nbsp;<code class=
        !          5186:                 "filename">work*</code></h2>
1.1       grant    5187:               </div>
                   5188:             </div>
                   5189:           </div>
                   5190: 
1.7     ! wiz      5191:           <p>When you type <span><strong class=
        !          5192:           "command">make</strong></span> the distribution files are
        !          5193:           unpacked into this directory. It can be removed by
        !          5194:           running <span><strong class="command">make
        !          5195:           clean</strong></span>. Besides the sources, this
        !          5196:           directory is also used to keep various timestamp
1.1       grant    5197:           files.</p>
                   5198: 
                   5199:           <p>If a package doesn't create a subdirectory for itself
                   5200:           (like GNU software does, for instance), but extracts
                   5201:           itself in the current directory, you should set
1.7     ! wiz      5202:           <code class="varname">WRKSRC</code> accordingly, e.g.
1.1       grant    5203:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   5204:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.7     ! wiz      5205:           class="pkgname">editors/sam</a> again, but the quick
        !          5206:           answer is:</p>
1.1       grant    5207:           <pre class="programlisting">
                   5208: WRKSRC=                ${WRKDIR}
                   5209: </pre>
                   5210: 
1.7     ! wiz      5211:           <p>Please note that the old <code class=
        !          5212:           "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1       grant    5213:           should not be used. Also, if your package doesn't create
1.7     ! wiz      5214:           a subdir with the name of <code class=
        !          5215:           "varname">DISTNAME</code> but some different name, set
        !          5216:           <code class="varname">WRKSRC</code> to point to the
        !          5217:           proper name in <code class="filename">${WRKDIR}</code>.
        !          5218:           See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          5219:           href=
1.1       grant    5220:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.7     ! wiz      5221:           class="pkgname">lang/tcl</a> and <a xmlns=
        !          5222:           "http://www.w3.org/TR/xhtml1/transitional" href=
        !          5223:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
        !          5224:           class="pkgname">x11/tk</a> for examples, and here is
        !          5225:           another one:</p>
1.1       grant    5226:           <pre class="programlisting">
                   5227: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   5228: </pre>
                   5229: 
                   5230:           <p>The name of the working directory created by pkgsrc is
1.7     ! wiz      5231:           <code class="filename">work</code> by default. If the
        !          5232:           same pkgsrc tree should be used on several different
        !          5233:           platforms, the variable <code class=
        !          5234:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1       grant    5235:           attach the platform to the directory name, e.g.
1.7     ! wiz      5236:           <code class="filename">work.i386</code> or <code class=
        !          5237:           "filename">work.sparc</code>.</p>
1.1       grant    5238:         </div>
                   5239: 
                   5240:         <div class="sect1" lang="en" xml:lang="en">
                   5241:           <div class="titlepage">
                   5242:             <div>
                   5243:               <div>
                   5244:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      5245:                 "id2586284" id=
        !          5246:                 "id2586284"></a>7.7.&nbsp;<code class=
        !          5247:                 "filename">files/*</code></h2>
1.1       grant    5248:               </div>
                   5249:             </div>
                   5250:           </div>
                   5251: 
                   5252:           <p>If you have any files that you wish to be placed in
                   5253:           the package prior to configuration or building, you could
                   5254:           place these files here and use a &#8220;<span class=
                   5255:           "quote">${CP}</span>&#8221; command in the
                   5256:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   5257:           target to achieve this. Alternatively, you could simply
1.7     ! wiz      5258:           diff the file against <code class=
        !          5259:           "filename">/dev/null</code> and use the patch mechanism
        !          5260:           to manage the creation of this file.</p>
1.1       grant    5261:         </div>
                   5262:       </div>
                   5263: 
                   5264:       <div class="chapter" lang="en" xml:lang="en">
                   5265:         <div class="titlepage">
                   5266:           <div>
                   5267:             <div>
                   5268:               <h2 class="title"><a name="plist" id=
                   5269:               "plist"></a>Chapter&nbsp;8.&nbsp;PLIST issues</h2>
                   5270:             </div>
                   5271:           </div>
                   5272:         </div>
                   5273: 
                   5274:         <div class="toc">
                   5275:           <p><b>Table of Contents</b></p>
                   5276: 
                   5277:           <dl>
1.7     ! wiz      5278:             <dt><span class="sect1"><a href="#id2586339">8.1. RCS
1.1       grant    5279:             ID</a></span></dt>
                   5280: 
1.7     ! wiz      5281:             <dt><span class="sect1"><a href="#id2586354">8.2.
        !          5282:             Semi-automatic <code class="filename">PLIST</code>
        !          5283:             generation</a></span></dt>
1.1       grant    5284: 
                   5285:             <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.7     ! wiz      5286:             Tweaking output of <span><strong class="command">make
        !          5287:             print-PLIST</strong></span></a></span></dt>
1.1       grant    5288: 
                   5289:             <dt><span class="sect1"><a href="#plist.misc">8.4.
                   5290:             Variable substitution in PLIST</a></span></dt>
                   5291: 
1.7     ! wiz      5292:             <dt><span class="sect1"><a href="#id2586743">8.5.
1.1       grant    5293:             Manpage-compression</a></span></dt>
                   5294: 
1.7     ! wiz      5295:             <dt><span class="sect1"><a href="#id2586785">8.6.
        !          5296:             Changing PLIST source with <code class=
        !          5297:             "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5298: 
1.7     ! wiz      5299:             <dt><span class="sect1"><a href="#id2586802">8.7.
1.1       grant    5300:             Platform specific and differing PLISTs</a></span></dt>
                   5301: 
                   5302:             <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
                   5303:             Sharing directories between packages</a></span></dt>
                   5304:           </dl>
                   5305:         </div>
                   5306: 
1.7     ! wiz      5307:         <p>The <code class="filename">PLIST</code> file contains a
1.1       grant    5308:         package's &#8220;<span class="quote">packing
                   5309:         list</span>&#8221;, i.e. a list of files that belong to the
1.7     ! wiz      5310:         package (relative to the <code class=
        !          5311:         "filename">${PREFIX}</code> directory it's been installed
        !          5312:         in) plus some additional statements - see the <a href=
1.1       grant    5313:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5314:         <span class="citerefentry"><span class=
                   5315:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   5316:         a full list. This chapter addresses some issues that need
1.7     ! wiz      5317:         attention when dealing with the <code class=
        !          5318:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    5319: 
                   5320:         <div class="sect1" lang="en" xml:lang="en">
                   5321:           <div class="titlepage">
                   5322:             <div>
                   5323:               <div>
                   5324:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      5325:                 "id2586339" id="id2586339"></a>8.1.&nbsp;RCS
1.1       grant    5326:                 ID</h2>
                   5327:               </div>
                   5328:             </div>
                   5329:           </div>
                   5330: 
                   5331:           <p>Be sure to add a RCS ID line as the first thing in any
1.7     ! wiz      5332:           <code class="filename">PLIST</code> file you write:</p>
1.1       grant    5333:           <pre class="programlisting">
                   5334: @comment $NetBSD$
                   5335: </pre>
                   5336:         </div>
                   5337: 
                   5338:         <div class="sect1" lang="en" xml:lang="en">
                   5339:           <div class="titlepage">
                   5340:             <div>
                   5341:               <div>
                   5342:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      5343:                 "id2586354" id=
        !          5344:                 "id2586354"></a>8.2.&nbsp;Semi-automatic
        !          5345:                 <code class="filename">PLIST</code> generation</h2>
1.1       grant    5346:               </div>
                   5347:             </div>
                   5348:           </div>
                   5349: 
1.7     ! wiz      5350:           <p>You can use the <span><strong class="command">make
        !          5351:           print-PLIST</strong></span> command to output a PLIST
        !          5352:           that matches any new files since the package was
        !          5353:           extracted. See <a href="#build.helpful-targets" title=
1.1       grant    5354:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   5355:           &#8220;Other helpful targets&#8221;</a> for more
                   5356:           information on this target.</p>
                   5357:         </div>
                   5358: 
                   5359:         <div class="sect1" lang="en" xml:lang="en">
                   5360:           <div class="titlepage">
                   5361:             <div>
                   5362:               <div>
                   5363:                 <h2 class="title" style="clear: both"><a name=
                   5364:                 "print-PLIST" id=
                   5365:                 "print-PLIST"></a>8.3.&nbsp;Tweaking output of
1.7     ! wiz      5366:                 <span><strong class="command">make
        !          5367:                 print-PLIST</strong></span></h2>
1.1       grant    5368:               </div>
                   5369:             </div>
                   5370:           </div>
                   5371: 
                   5372:           <p>If you have used any of the *-dirs packages, as
                   5373:           explained in <a href="#faq.common-dirs" title=
                   5374:           "8.8.&nbsp;Sharing directories between packages">Section&nbsp;8.8,
                   5375:           &#8220;Sharing directories between packages&#8221;</a>,
1.7     ! wiz      5376:           you may have noticed that <span><strong class=
        !          5377:           "command">make print-PLIST</strong></span> outputs a set
        !          5378:           of <code class="varname">@comment</code>s instead of real
        !          5379:           <code class="varname">@dirrm</code> lines. You can also
        !          5380:           do this for specific directories and files, so that the
        !          5381:           results of that command are very close to reality. This
        !          5382:           helps <span class="emphasis"><em>a lot</em></span> during
        !          5383:           the update of packages.</p>
        !          5384: 
        !          5385:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
        !          5386:           variable takes a set of AWK patterns and actions that are
        !          5387:           used to filter the output of print-PLIST. You can
        !          5388:           <span class="emphasis"><em>append</em></span> any chunk
        !          5389:           of AWK scripting you like to it, but be careful with
1.1       grant    5390:           quoting.</p>
                   5391: 
1.7     ! wiz      5392:           <p>For example, to get all files inside the <code class=
        !          5393:           "filename">libdata/foo</code> directory removed from the
1.1       grant    5394:           resulting PLIST:</p>
                   5395:           <pre class="programlisting">
                   5396:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   5397:     
                   5398: </pre>
                   5399: 
1.7     ! wiz      5400:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    5401:           lines referring to a specific (shared) directory
1.7     ! wiz      5402:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    5403:           <pre class="programlisting">
                   5404:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   5405:     
                   5406: </pre>
                   5407:         </div>
                   5408: 
                   5409:         <div class="sect1" lang="en" xml:lang="en">
                   5410:           <div class="titlepage">
                   5411:             <div>
                   5412:               <div>
                   5413:                 <h2 class="title" style="clear: both"><a name=
                   5414:                 "plist.misc" id="plist.misc"></a>8.4.&nbsp;Variable
                   5415:                 substitution in PLIST</h2>
                   5416:               </div>
                   5417:             </div>
                   5418:           </div>
                   5419: 
                   5420:           <p>A number of variables are substituted automatically in
                   5421:           PLISTs when a package is installed on a system. This
                   5422:           includes the following variables:</p>
                   5423: 
                   5424:           <div class="variablelist">
                   5425:             <dl>
1.7     ! wiz      5426:               <dt><span class="term"><code class=
        !          5427:               "varname">${MACHINE_ARCH}</code>, <code class=
        !          5428:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    5429: 
                   5430:               <dd>
                   5431:                 <p>Some packages like emacs and perl embed
                   5432:                 information about which architecture they were
                   5433:                 built on into the pathnames where they install
                   5434:                 their file. To handle this case, PLIST will be
                   5435:                 preprocessed before actually used, and the symbol
1.7     ! wiz      5436:                 &#8220;<span class="quote"><code class=
        !          5437:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
        !          5438:                 be replaced by what <span><strong class=
        !          5439:                 "command">uname -p</strong></span> gives. The same
        !          5440:                 is done if the string <code class=
        !          5441:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
        !          5442:                 PLIST somewhere - use this on packages that have
        !          5443:                 GNU autoconf created configure scripts.</p>
1.1       grant    5444: 
                   5445:                 <div class="note" style=
                   5446:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   5447:                   <h3 class="title">Legacy note</h3>
                   5448: 
                   5449:                   <p>There used to be a symbol &#8220;<span class=
1.7     ! wiz      5450:                   "quote"><code class=
        !          5451:                   "varname">$ARCH</code></span>&#8221; that was
        !          5452:                   replaced by the output of <span><strong class=
        !          5453:                   "command">uname -m</strong></span>, but that's no
1.1       grant    5454:                   longer supported and has been removed.</p>
                   5455:                 </div>
                   5456:               </dd>
                   5457: 
1.7     ! wiz      5458:               <dt><span class="term"><code class=
        !          5459:               "varname">${OPSYS}</code>, <code class=
        !          5460:               "varname">${LOWER_OPSYS}</code>, <code class=
        !          5461:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    5462: 
                   5463:               <dd>
                   5464:                 <p>Some packages want to embed the OS name and
                   5465:                 version into some paths. To do this, use these
1.7     ! wiz      5466:                 variables in the <code class=
        !          5467:                 "filename">PLIST</code>:</p>
1.1       grant    5468: 
                   5469:                 <div class="itemizedlist">
                   5470:                   <ul type="disc">
                   5471:                     <li>
1.7     ! wiz      5472:                       <p><code class="varname">${OPSYS}</code> -
        !          5473:                       output of &#8220;<span class=
        !          5474:                       "quote"><span><strong class="command">uname
        !          5475:                       -s</strong></span></span>&#8221;</p>
1.1       grant    5476:                     </li>
                   5477: 
                   5478:                     <li>
1.7     ! wiz      5479:                       <p><code class=
        !          5480:                       "varname">${LOWER_OPSYS}</code> - lowercase
        !          5481:                       common name (eg. &#8220;<span class=
        !          5482:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    5483:                     </li>
                   5484: 
                   5485:                     <li>
1.7     ! wiz      5486:                       <p><code class="varname">${OS_VERSION}</code>
        !          5487:                       - &#8220;<span class=
        !          5488:                       "quote"><span><strong class="command">uname
        !          5489:                       -r</strong></span></span>&#8221;</p>
1.1       grant    5490:                     </li>
                   5491:                   </ul>
                   5492:                 </div>
                   5493:               </dd>
                   5494: 
1.7     ! wiz      5495:               <dt><span class="term"><code class=
        !          5496:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    5497: 
                   5498:               <dd>
                   5499:                 <p>Packages that install locale files should list
                   5500:                 them in the PLIST as &#8220;<span class=
                   5501:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   5502:                 instead of &#8220;<span class=
                   5503:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   5504:                 This properly handles the fact that different
                   5505:                 operating systems expect locale files to be either
1.7     ! wiz      5506:                 in <code class="filename">share</code> or
        !          5507:                 <code class="filename">lib</code> by default.</p>
1.1       grant    5508:               </dd>
                   5509:             </dl>
                   5510:           </div>
                   5511: 
                   5512:           <p>For a complete list of values which are replaced by
1.7     ! wiz      5513:           default, please look in <code class=
        !          5514:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    5515:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   5516: 
                   5517:           <p>If you want to change other variables not listed
                   5518:           above, you can add variables and their expansions to this
1.7     ! wiz      5519:           variable in the following way, similar to <code class=
        !          5520:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    5521:           "#components.optional" title=
                   5522:           "7.5.&nbsp;Optional files">Section&nbsp;7.5,
                   5523:           &#8220;Optional files&#8221;</a>):</p>
                   5524:           <pre class="programlisting">
                   5525: PLIST_SUBST+=    SOMEVAR="somevalue"
                   5526: </pre>
                   5527: 
                   5528:           <p>This replaces all occurrences of &#8220;<span class=
                   5529:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   5530:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   5531:         </div>
                   5532: 
                   5533:         <div class="sect1" lang="en" xml:lang="en">
                   5534:           <div class="titlepage">
                   5535:             <div>
                   5536:               <div>
                   5537:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      5538:                 "id2586743" id=
        !          5539:                 "id2586743"></a>8.5.&nbsp;Manpage-compression</h2>
1.1       grant    5540:               </div>
                   5541:             </div>
                   5542:           </div>
                   5543: 
                   5544:           <p>Manpages should be installed in compressed form if
1.7     ! wiz      5545:           <code class="varname">MANZ</code> is set (in <code class=
        !          5546:           "filename">bsd.own.mk</code>), and uncompressed
        !          5547:           otherwise. To handle this in the <code class=
        !          5548:           "filename">PLIST</code> file, the suffix
        !          5549:           &#8220;<span class="quote">.gz</span>&#8221; is
        !          5550:           appended/removed automatically for manpages according to
        !          5551:           <code class="varname">MANZ</code> and <code class=
        !          5552:           "varname">MANCOMPRESSED</code> being set or not, see
        !          5553:           above for details. This modification of the <code class=
        !          5554:           "filename">PLIST</code> file is done on a copy of it, not
        !          5555:           <code class="filename">PLIST</code> itself.</p>
1.1       grant    5556:         </div>
                   5557: 
                   5558:         <div class="sect1" lang="en" xml:lang="en">
                   5559:           <div class="titlepage">
                   5560:             <div>
                   5561:               <div>
                   5562:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      5563:                 "id2586785" id="id2586785"></a>8.6.&nbsp;Changing
        !          5564:                 PLIST source with <code class=
        !          5565:                 "varname">PLIST_SRC</code></h2>
1.1       grant    5566:               </div>
                   5567:             </div>
                   5568:           </div>
                   5569: 
1.7     ! wiz      5570:           <p>To use one or more files as source for the
        !          5571:           <code class="filename">PLIST</code> used in generating
        !          5572:           the binary package, set the variable <code class=
        !          5573:           "varname">PLIST_SRC</code> to the names of that file(s).
1.1       grant    5574:           The files are later concatenated using cat(1), and order
                   5575:           of things is important.</p>
                   5576:         </div>
                   5577: 
                   5578:         <div class="sect1" lang="en" xml:lang="en">
                   5579:           <div class="titlepage">
                   5580:             <div>
                   5581:               <div>
                   5582:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      5583:                 "id2586802" id="id2586802"></a>8.7.&nbsp;Platform
1.1       grant    5584:                 specific and differing PLISTs</h2>
                   5585:               </div>
                   5586:             </div>
                   5587:           </div>
                   5588: 
                   5589:           <p>Some packages decide to install a different set of
                   5590:           files based on the operating system being used. These
                   5591:           differences can be automatically handled by using the
                   5592:           following files:</p>
                   5593: 
                   5594:           <div class="itemizedlist">
                   5595:             <ul type="disc">
                   5596:               <li>
1.7     ! wiz      5597:                 <p><code class="filename">PLIST.common</code></p>
1.1       grant    5598:               </li>
                   5599: 
                   5600:               <li>
1.7     ! wiz      5601:                 <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1       grant    5602:               </li>
                   5603: 
                   5604:               <li>
1.7     ! wiz      5605:                 <p><code class=
        !          5606:                 "filename">PLIST.common_end</code></p>
1.1       grant    5607:               </li>
                   5608:             </ul>
                   5609:           </div>
                   5610: 
1.7     ! wiz      5611:           <p>If <code class="filename">PLIST.${OPSYS}</code>
        !          5612:           exists, these files are used instead of <code class=
        !          5613:           "filename">PLIST</code>. This allows packages which
        !          5614:           behave in this way to be handled gracefully. Manually
        !          5615:           overriding <code class="varname">PLIST_SRC</code> for
        !          5616:           other more exotic uses is also possible.</p>
1.1       grant    5617:         </div>
                   5618: 
                   5619:         <div class="sect1" lang="en" xml:lang="en">
                   5620:           <div class="titlepage">
                   5621:             <div>
                   5622:               <div>
                   5623:                 <h2 class="title" style="clear: both"><a name=
                   5624:                 "faq.common-dirs" id=
                   5625:                 "faq.common-dirs"></a>8.8.&nbsp;Sharing directories
                   5626:                 between packages</h2>
                   5627:               </div>
                   5628:             </div>
                   5629:           </div>
                   5630: 
                   5631:           <p>A &#8220;<span class="quote">shared
                   5632:           directory</span>&#8221; is a directory where multiple
                   5633:           (and unrelated) packages install files. These directories
                   5634:           are problematic because you have to add special tricks in
                   5635:           the PLIST to conditionally remove them, or have some
                   5636:           centralized package handle them.</p>
                   5637: 
                   5638:           <p>Within pkgsrc, you'll find both approaches. If a
                   5639:           directory is shared by a few unrelated packages, it's
                   5640:           often not worth to add an extra package to remove it.
                   5641:           Therefore, one simply does:</p>
                   5642:           <pre class="programlisting">
                   5643:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   5644:     
                   5645: </pre>
                   5646: 
                   5647:           <p>in the PLISTs of all affected packages, instead of the
                   5648:           regular "@dirrm" line.</p>
                   5649: 
                   5650:           <p>However, if the directory is shared across many
                   5651:           packages, two different solutions are available:</p>
                   5652: 
                   5653:           <div class="orderedlist">
                   5654:             <ol type="1">
                   5655:               <li>
                   5656:                 <p>If the packages have a common dependency, the
                   5657:                 directory can be removed in that. For example, see
                   5658:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5659:                 href=
                   5660:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.7     ! wiz      5661:                 class="pkgname">textproc/scrollkeeper</a>, which
        !          5662:                 removes the shared directory <code class=
        !          5663:                 "filename">share/omf</code>.</p>
1.1       grant    5664:               </li>
                   5665: 
                   5666:               <li>
                   5667:                 <p>If the packages using the directory are not
                   5668:                 related at all (they have no common dependencies),
                   5669:                 a *-dirs package is used.</p>
                   5670:               </li>
                   5671:             </ol>
                   5672:           </div>
                   5673: 
                   5674:           <p>From now on, we'll discuss the second solution. To get
                   5675:           an idea of the *-dirs packages available, issue:</p>
                   5676:           <pre class="programlisting">
1.7     ! wiz      5677:       <code class="prompt">%</code> cd .../pkgsrc
        !          5678:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    5679:     
                   5680: </pre>
                   5681: 
                   5682:           <p>Their use from other packages is very simple. The
1.7     ! wiz      5683:           <code class="varname">USE_DIRS</code> variable takes a
        !          5684:           list of package names (without the &#8220;<span class=
1.1       grant    5685:           "quote">-dirs</span>&#8221; part) together with the
                   5686:           required version number (always pick the latest one when
                   5687:           writting new packages).</p>
                   5688: 
                   5689:           <p>For example, if a package installs files under
1.7     ! wiz      5690:           <code class="filename">share/applications</code>, it
        !          5691:           should have the following line in it:</p>
1.1       grant    5692:           <pre class="programlisting">
                   5693:       USE_DIRS+= xdg-1.1
                   5694:     
                   5695: </pre>
                   5696: 
1.7     ! wiz      5697:           <p>After regenerating the PLIST using
        !          5698:           <span><strong class="command">make
        !          5699:           print-PLIST</strong></span>, you should get the right
        !          5700:           (commented out) lines.</p>
1.1       grant    5701: 
1.7     ! wiz      5702:           <p>Note that, even if your package is using <code class=
        !          5703:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    5704:           *-x11-dirs packages. Just specify the name without that
1.7     ! wiz      5705:           part and pkgsrc (in particular, <code class=
        !          5706:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    5707:         </div>
                   5708:       </div>
                   5709: 
                   5710:       <div class="chapter" lang="en" xml:lang="en">
                   5711:         <div class="titlepage">
                   5712:           <div>
                   5713:             <div>
                   5714:               <h2 class="title"><a name="buildlink" id=
                   5715:               "buildlink"></a>Chapter&nbsp;9.&nbsp;Buildlink
                   5716:               methodology</h2>
                   5717:             </div>
                   5718:           </div>
                   5719:         </div>
                   5720: 
                   5721:         <div class="toc">
                   5722:           <p><b>Table of Contents</b></p>
                   5723: 
                   5724:           <dl>
1.7     ! wiz      5725:             <dt><span class="sect1"><a href="#id2587074">9.1.
1.1       grant    5726:             Converting packages to use buildlink3</a></span></dt>
                   5727: 
1.7     ! wiz      5728:             <dt><span class="sect1"><a href="#id2587265">9.2.
        !          5729:             Writing <code class="filename">buildlink3.mk</code>
        !          5730:             files</a></span></dt>
1.1       grant    5731: 
                   5732:             <dd>
                   5733:               <dl>
1.7     ! wiz      5734:                 <dt><span class="sect2"><a href="#id2587470">9.2.1.
1.1       grant    5735:                 Anatomy of a buildlink3.mk file</a></span></dt>
                   5736: 
1.7     ! wiz      5737:                 <dt><span class="sect2"><a href="#id2588048">9.2.2.
        !          5738:                 Updating <code class=
        !          5739:                 "varname">BUILDLINK_DEPENDS.<em class=
        !          5740:                 "replaceable"><code>pkg</code></em></code> in
        !          5741:                 <code class="filename">buildlink3.mk</code>
1.1       grant    5742:                 files</a></span></dt>
                   5743:               </dl>
                   5744:             </dd>
                   5745: 
1.7     ! wiz      5746:             <dt><span class="sect1"><a href="#id2588126">9.3.
        !          5747:             Writing <code class="filename">builtin.mk</code>
        !          5748:             files</a></span></dt>
1.1       grant    5749: 
                   5750:             <dd>
                   5751:               <dl>
1.7     ! wiz      5752:                 <dt><span class="sect2"><a href="#id2588208">9.3.1.
        !          5753:                 Anatomy of a <code class=
        !          5754:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    5755: 
1.7     ! wiz      5756:                 <dt><span class="sect2"><a href="#id2588366">9.3.2.
1.1       grant    5757:                 Global preferences for native or pkgsrc
                   5758:                 software</a></span></dt>
                   5759:               </dl>
                   5760:             </dd>
                   5761:           </dl>
                   5762:         </div>
                   5763: 
                   5764:         <p>Buildlink is a framework in pkgsrc that controls what
                   5765:         headers and libraries are seen by a package's configure and
                   5766:         build processes. This is implemented in a two step
                   5767:         process:</p>
                   5768: 
                   5769:         <div class="orderedlist">
                   5770:           <ol type="1">
                   5771:             <li>
                   5772:               <p>Symlink headers and libraries for dependencies
1.7     ! wiz      5773:               into <code class="varname">BUILDLINK_DIR</code>,
        !          5774:               which by default is a subdirectory of <code class=
        !          5775:               "varname">WRKDIR</code>.</p>
1.1       grant    5776:             </li>
                   5777: 
                   5778:             <li>
                   5779:               <p>Create wrapper scripts that are used in place of
1.7     ! wiz      5780:               the normal compiler tools that translate <code class=
        !          5781:               "option">-I${LOCALBASE}/include</code> and
        !          5782:               <code class="option">-L${LOCALBASE}/lib</code> into
        !          5783:               references to <code class=
        !          5784:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
        !          5785:               also make native compiler on some operating systems
        !          5786:               look like GCC, so that packages that expect GCC won't
        !          5787:               require modifications to build with those native
        !          5788:               compilers.</p>
1.1       grant    5789:             </li>
                   5790:           </ol>
                   5791:         </div>
                   5792: 
                   5793:         <p>This normalizes the environment in which a package is
                   5794:         built so that the package may be built consistently despite
                   5795:         what other software may be installed. Please note that the
1.7     ! wiz      5796:         normal system header and library paths, e.g. <code class=
        !          5797:         "filename">/usr/include</code>, <code class=
        !          5798:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    5799:         buildlink3 is designed to insulate the package build from
                   5800:         non-system-supplied software.</p>
                   5801: 
                   5802:         <div class="sect1" lang="en" xml:lang="en">
                   5803:           <div class="titlepage">
                   5804:             <div>
                   5805:               <div>
                   5806:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      5807:                 "id2587074" id="id2587074"></a>9.1.&nbsp;Converting
1.1       grant    5808:                 packages to use buildlink3</h2>
                   5809:               </div>
                   5810:             </div>
                   5811:           </div>
                   5812: 
                   5813:           <p>The process of converting packages to use the
                   5814:           buildlink3 framework (&#8220;<span class=
                   5815:           "quote">bl3ifying</span>&#8221;) is fairly
                   5816:           straightforward. The things to keep in mind are:</p>
                   5817: 
                   5818:           <div class="orderedlist">
                   5819:             <ol type="1">
                   5820:               <li>
1.7     ! wiz      5821:                 <p>Set <code class="varname">USE_BUILDLINK3</code>
        !          5822:                 to &#8220;<span class=
        !          5823:                 "quote">yes</span>&#8221;.</p>
1.1       grant    5824:               </li>
                   5825: 
                   5826:               <li>
                   5827:                 <p>Ensure that the build always calls the wrapper
                   5828:                 scripts instead of the actual toolchain. Some
                   5829:                 packages are tricky, and the only way to know for
1.7     ! wiz      5830:                 sure is the check <code class=
        !          5831:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    5832:                 wrappers are being invoked.</p>
                   5833:               </li>
                   5834: 
                   5835:               <li>
1.7     ! wiz      5836:                 <p>Don't override <code class=
        !          5837:                 "varname">PREFIX</code> from within the package
        !          5838:                 Makefile, e.g. Java VMs, standalone shells, etc.,
        !          5839:                 because the code to symlink files into <code class=
        !          5840:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    5841:                 relative to &#8220;<span class="quote">pkg_info -qp
1.7     ! wiz      5842:                 <em class=
        !          5843:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    5844:               </li>
                   5845: 
                   5846:               <li>
                   5847:                 <p>Remember that <span class=
1.7     ! wiz      5848:                 "emphasis"><em>only</em></span> the <code class=
        !          5849:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    5850:                 in a package's Makefile are added as dependencies
                   5851:                 for that package.</p>
                   5852:               </li>
                   5853:             </ol>
                   5854:           </div>
                   5855: 
                   5856:           <p>If a dependency on a particular package is required
                   5857:           for its libraries and headers, then we replace:</p>
                   5858:           <pre class="programlisting">
                   5859: DEPENDS+=       foo&gt;=1.1.0:../../category/foo
                   5860: </pre>
                   5861: 
                   5862:           <p>with</p>
                   5863:           <pre class="programlisting">
                   5864: .include "../../category/foo/buildlink3.mk"
                   5865: </pre>
                   5866: 
1.7     ! wiz      5867:           <p>There are several <code class=
        !          5868:           "filename">buildlink3.mk</code> files in <code class=
        !          5869:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    5870:           issues:</p>
                   5871: 
                   5872:           <div class="itemizedlist">
                   5873:             <ul type="disc">
                   5874:               <li>
1.7     ! wiz      5875:                 <p><code class="filename">bdb.buildlink3.mk</code>
1.1       grant    5876:                 chooses either the native or a pkgsrc Berkeley DB
1.7     ! wiz      5877:                 implementation based on the values of <code class=
        !          5878:                 "varname">BDB_ACCEPTED</code> and <code class=
        !          5879:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    5880:               </li>
                   5881: 
                   5882:               <li>
1.7     ! wiz      5883:                 <p><code class=
        !          5884:                 "filename">curses.buildlink3.mk</code> If the
        !          5885:                 system comes with neither Curses nor NCurses, this
        !          5886:                 will take care to install the <a xmlns=
        !          5887:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    5888:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.7     ! wiz      5889:                 class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    5890:               </li>
                   5891: 
                   5892:               <li>
1.7     ! wiz      5893:                 <p><code class="filename">krb5.buildlink3.mk</code>
        !          5894:                 uses the value of <code class=
        !          5895:                 "varname">KRB5_ACCEPTED</code> to choose between
1.1       grant    5896:                 adding a dependency on Heimdal or MIT-krb5 for
                   5897:                 packages that require a Kerberos 5
                   5898:                 implementation.</p>
                   5899:               </li>
                   5900: 
                   5901:               <li>
1.7     ! wiz      5902:                 <p><code class=
        !          5903:                 "filename">motif.buildlink3.mk</code> checks for a
        !          5904:                 system-provided Motif installation or adds a
        !          5905:                 dependency on <a xmlns=
1.1       grant    5906:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5907:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.7     ! wiz      5908:                 class="pkgname">x11/lesstif</a> or <a xmlns=
        !          5909:                 "http://www.w3.org/TR/xhtml1/transitional" href=
        !          5910:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
        !          5911:                 class="pkgname">x11/openmotif</a>;</p>
1.1       grant    5912:               </li>
                   5913: 
                   5914:               <li>
1.7     ! wiz      5915:                 <p><code class=
        !          5916:                 "filename">ossaudio.buildlink3.mk</code> defines
        !          5917:                 several variables that may be used by packages that
        !          5918:                 use the Open Sound System (OSS) API;</p>
1.1       grant    5919:               </li>
                   5920: 
                   5921:               <li>
1.7     ! wiz      5922:                 <p><code class=
        !          5923:                 "filename">pgsql.buildlink3.mk</code> will accept
        !          5924:                 either Postgres 7.3 or 7.4, whichever is found
        !          5925:                 installed. See the file for more information.</p>
1.1       grant    5926:               </li>
                   5927: 
                   5928:               <li>
1.7     ! wiz      5929:                 <p><code class=
        !          5930:                 "filename">pthread.buildlink3.mk</code> uses the
        !          5931:                 value of <code class="varname">PTHREAD_OPTS</code>
        !          5932:                 and checks for native pthreads or adds a dependency
        !          5933:                 on <a xmlns=
1.1       grant    5934:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5935:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.7     ! wiz      5936:                 class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    5937:               </li>
                   5938: 
                   5939:               <li>
1.7     ! wiz      5940:                 <p><code class="filename">xaw.buildlink3.mk</code>
        !          5941:                 uses the value of <code class=
        !          5942:                 "varname">XAW_TYPE</code> to choose a particular
        !          5943:                 Athena widgets library.</p>
1.1       grant    5944:               </li>
                   5945:             </ul>
                   5946:           </div>
                   5947: 
1.7     ! wiz      5948:           <p>The comments in those <code class=
        !          5949:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    5950:           complete description of how to use them properly.</p>
                   5951:         </div>
                   5952: 
                   5953:         <div class="sect1" lang="en" xml:lang="en">
                   5954:           <div class="titlepage">
                   5955:             <div>
                   5956:               <div>
                   5957:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      5958:                 "id2587265" id="id2587265"></a>9.2.&nbsp;Writing
        !          5959:                 <code class="filename">buildlink3.mk</code>
        !          5960:                 files</h2>
1.1       grant    5961:               </div>
                   5962:             </div>
                   5963:           </div>
                   5964: 
1.7     ! wiz      5965:           <p>A package's <code class=
        !          5966:           "filename">buildlink3.mk</code> file is included by
        !          5967:           Makefiles to indicate the need to compile and link
        !          5968:           against header files and libraries provided by the
        !          5969:           package. A <code class="filename">buildlink3.mk</code>
        !          5970:           file should always provide enough information to add the
        !          5971:           correct type of dependency relationship and include any
        !          5972:           other <code class="filename">buildlink3.mk</code> files
        !          5973:           that it needs to find headers and libraries that it needs
        !          5974:           in turn.</p>
1.1       grant    5975: 
1.7     ! wiz      5976:           <p>To generate an initial <code class=
        !          5977:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    5978:           Rene Hexel's <a xmlns=
                   5979:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5980:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.7     ! wiz      5981:           class="pkgname">pkgtools/createbuildlink</a> package is
        !          5982:           highly recommended. For most packages, the following
        !          5983:           command will generate a good starting point for
        !          5984:           <code class="filename">buildlink3.mk</code> files:</p>
1.1       grant    5985:           <pre class="screen">
1.7     ! wiz      5986: <code class="prompt">%</code> <strong class=
        !          5987: "userinput"><code>cd pkgsrc/<em class=
        !          5988: "replaceable"><code>category</code></em>/<em class=
        !          5989: "replaceable"><code>pkgdir</code></em>
        !          5990: <code class=
        !          5991: "prompt">%</code> createbuildlink -3 &gt;buildlink3.mk</code></strong>
1.1       grant    5992: </pre>
                   5993: 
                   5994:           <div class="sect2" lang="en" xml:lang="en">
                   5995:             <div class="titlepage">
                   5996:               <div>
                   5997:                 <div>
1.7     ! wiz      5998:                   <h3 class="title"><a name="id2587470" id=
        !          5999:                   "id2587470"></a>9.2.1. Anatomy of a buildlink3.mk
1.1       grant    6000:                   file</h3>
                   6001:                 </div>
                   6002:               </div>
                   6003:             </div>
                   6004: 
1.7     ! wiz      6005:             <p>The following real-life example <code class=
        !          6006:             "filename">buildlink3.mk</code> is taken from
        !          6007:             <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    6008:             <pre class="programlisting">
                   6009: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
                   6010: 
                   6011: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   6012: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   6013: 
                   6014: .if !empty(BUILDLINK_DEPTH:M+)
                   6015: BUILDLINK_DEPENDS+=     tiff
                   6016: .endif
                   6017: 
                   6018: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   6019: BUILDLINK_PACKAGES+=    tiff
                   6020: 
                   6021: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   6022: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   6023: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   6024: .endif  # TIFF_BUILDLINK3_MK
                   6025: 
                   6026: .include "../../devel/zlib/buildlink3.mk"
                   6027: .include "../../graphics/jpeg/buildlink3.mk"
                   6028: 
                   6029: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   6030: </pre>
                   6031: 
1.7     ! wiz      6032:             <p>The header and footer manipulate <code class=
        !          6033:             "varname">BUILDLINK_DEPTH</code>, which is common
        !          6034:             across all <code class="filename">buildlink3.mk</code>
        !          6035:             files and is used to track at what depth we are
        !          6036:             including <code class="filename">buildlink3.mk</code>
        !          6037:             files.</p>
1.1       grant    6038: 
                   6039:             <p>The first section controls if the dependency on
1.7     ! wiz      6040:             <em class="replaceable"><code>pkg</code></em> is added.
        !          6041:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    6042:             global list of packages for which dependencies are
                   6043:             added by buildlink3.</p>
                   6044: 
                   6045:             <p>The second section advises pkgsrc that the
1.7     ! wiz      6046:             <code class="filename">buildlink3.mk</code> file for
        !          6047:             <em class="replaceable"><code>pkg</code></em> has been
        !          6048:             included at some point. <code class=
        !          6049:             "varname">BUILDLINK_PACKAGES</code> is the global list
        !          6050:             of packages for which <code class=
        !          6051:             "filename">buildlink3.mk</code> files have been
        !          6052:             included. It must <span class=
        !          6053:             "emphasis"><em>always</em></span> be appended to within
        !          6054:             a <code class="filename">buildlink3.mk</code> file.</p>
1.1       grant    6055: 
                   6056:             <p>The third section is protected from multiple
1.7     ! wiz      6057:             inclusion and controls how the dependency on <em class=
        !          6058:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    6059:             important variables are set in the section:</p>
                   6060: 
                   6061:             <div class="itemizedlist">
                   6062:               <ul type="disc">
                   6063:                 <li>
1.7     ! wiz      6064:                   <p><code class=
        !          6065:                   "varname">BUILDLINK_DEPENDS.<em class=
        !          6066:                   "replaceable"><code>pkg</code></em></code> is the
        !          6067:                   actual dependency recorded in the installed
        !          6068:                   package; this should always be set using
        !          6069:                   <span><strong class="command">+=</strong></span>
        !          6070:                   to ensure that we're appending to any
        !          6071:                   pre-existing list of values. This variable should
        !          6072:                   be set to the first version of the package that
        !          6073:                   had the last change in the major number of a
        !          6074:                   shared library or that had a major API
        !          6075:                   change.</p>
1.1       grant    6076:                 </li>
                   6077: 
                   6078:                 <li>
1.7     ! wiz      6079:                   <p><code class=
        !          6080:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
        !          6081:                   "replaceable"><code>pkg</code></em></code> is the
        !          6082:                   location of the <em class=
        !          6083:                   "replaceable"><code>pkg</code></em> pkgsrc
1.1       grant    6084:                   directory;</p>
                   6085:                 </li>
                   6086: 
                   6087:                 <li>
1.7     ! wiz      6088:                   <p><code class=
        !          6089:                   "varname">BUILDLINK_DEPMETHOD.<em class=
        !          6090:                   "replaceable"><code>pkg</code></em></code> (not
        !          6091:                   shown above) controls whether we use <code class=
        !          6092:                   "varname">BUILD_DEPENDS</code> or <code class=
        !          6093:                   "varname">DEPENDS</code> to add the dependency on
        !          6094:                   <em class="replaceable"><code>pkg</code></em>.
        !          6095:                   The build dependency is selected by setting
        !          6096:                   <code class=
        !          6097:                   "varname">BUILDLINK_DEPMETHOD.<em class=
        !          6098:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    6099:                   &#8220;<span class="quote">build</span>&#8221;.
                   6100:                   By default, the full dependency is used.</p>
                   6101:                 </li>
                   6102: 
                   6103:                 <li>
1.7     ! wiz      6104:                   <p><code class=
        !          6105:                   "varname">BUILDLINK_INCDIRS.<em class=
        !          6106:                   "replaceable"><code>pkg</code></em></code> and
        !          6107:                   <code class=
        !          6108:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
        !          6109:                   <code>pkg</code></em></code> (not shown above)
        !          6110:                   are lists of subdirectories of <code class=
        !          6111:                   "filename">${BUILDLINK_PREFIX.<em class=
        !          6112:                   "replaceable"><code>pkg</code></em>}</code> to
        !          6113:                   add to the header and library search paths. These
1.1       grant    6114:                   default to &#8220;<span class=
                   6115:                   "quote">include</span>&#8221; and
                   6116:                   &#8220;<span class="quote">lib</span>&#8221;
                   6117:                   respectively.</p>
                   6118:                 </li>
                   6119: 
                   6120:                 <li>
1.7     ! wiz      6121:                   <p><code class=
        !          6122:                   "varname">BUILDLINK_CPPFLAGS.<em class=
        !          6123:                   "replaceable"><code>pkg</code></em></code> (not
        !          6124:                   shown above) is the list of preprocessor flags to
        !          6125:                   add to <code class="varname">CPPFLAGS</code>,
        !          6126:                   which are passed on to the configure and build
        !          6127:                   phases. The &#8220;<span class=
        !          6128:                   "quote">-I</span>&#8221; option should be avoided
        !          6129:                   and instead be handled using <code class=
        !          6130:                   "varname">BUILDLINK_INCDIRS.<em class=
        !          6131:                   "replaceable"><code>pkg</code></em></code> as
        !          6132:                   above.</p>
1.1       grant    6133:                 </li>
                   6134:               </ul>
                   6135:             </div>
                   6136: 
                   6137:             <p>The following variables are all optionally defined
                   6138:             within this second section (protected against multiple
                   6139:             inclusion) and control which package files are
1.7     ! wiz      6140:             symlinked into <code class=
        !          6141:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    6142:             are transformed during the symlinking:</p>
                   6143: 
                   6144:             <div class="itemizedlist">
                   6145:               <ul type="disc">
                   6146:                 <li>
1.7     ! wiz      6147:                   <p><code class=
        !          6148:                   "varname">BUILDLINK_FILES.<em class=
        !          6149:                   "replaceable"><code>pkg</code></em></code> (not
        !          6150:                   shown above) is a shell glob pattern relative to
        !          6151:                   <code class=
        !          6152:                   "filename">${BUILDLINK_PREFIX.<em class=
        !          6153:                   "replaceable"><code>pkg</code></em>}</code> to be
        !          6154:                   symlinked into <code class=
        !          6155:                   "filename">${BUILDLINK_DIR}</code>, e.g.
        !          6156:                   <code class="filename">include/*.h</code>.</p>
1.1       grant    6157:                 </li>
                   6158: 
                   6159:                 <li>
1.7     ! wiz      6160:                   <p><code class=
        !          6161:                   "varname">BUILDLINK_FILES_CMD.<em class=
        !          6162:                   "replaceable"><code>pkg</code></em></code> (not
        !          6163:                   shown above) is a shell pipeline that outputs to
        !          6164:                   stdout a list of files relative to <code class=
        !          6165:                   "filename">${BUILDLINK_PREFIX.<em class=
        !          6166:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    6167:                   resulting files are to be symlinked into
1.7     ! wiz      6168:                   <code class="filename">${BUILDLINK_DIR}</code>.
        !          6169:                   By default, this takes the <code class=
        !          6170:                   "filename">+CONTENTS</code> of a <em class=
        !          6171:                   "replaceable"><code>pkg</code></em> and filters
        !          6172:                   it through <code class=
        !          6173:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
        !          6174:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    6175:                 </li>
                   6176: 
                   6177:                 <li>
1.7     ! wiz      6178:                   <p><code class=
        !          6179:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
        !          6180:                   "replaceable"><code>pkg</code></em></code> (not
        !          6181:                   shown above) is a filter command that filters
        !          6182:                   <code class="filename">+CONTENTS</code> input
        !          6183:                   into a list of files relative to <code class=
        !          6184:                   "filename">${BUILDLINK_PREFIX.<em class=
        !          6185:                   "replaceable"><code>pkg</code></em>}</code> on
        !          6186:                   stdout. By default for overwrite packages,
        !          6187:                   <code class=
        !          6188:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
        !          6189:                   "replaceable"><code>pkg</code></em></code>
        !          6190:                   outputs the contents of the <code class=
        !          6191:                   "filename">include</code> and <code class=
        !          6192:                   "filename">lib</code> directories in the package
        !          6193:                   <code class="filename">+CONTENTS</code>, and for
        !          6194:                   pkgviews packages, it outputs any libtool
        !          6195:                   archives in <code class="filename">lib</code>
1.1       grant    6196:                   directories.</p>
                   6197:                 </li>
                   6198: 
                   6199:                 <li>
1.7     ! wiz      6200:                   <p><code class=
        !          6201:                   "varname">BUILDLINK_TRANSFORM.<em class=
        !          6202:                   "replaceable"><code>pkg</code></em></code> (not
        !          6203:                   shown above) is a list of sed arguments used to
1.1       grant    6204:                   transform the name of the source filename into a
1.7     ! wiz      6205:                   destination filename, e.g. <span><strong class=
1.1       grant    6206:                   "command">-e
1.7     ! wiz      6207:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    6208:                 </li>
                   6209:               </ul>
                   6210:             </div>
                   6211: 
1.7     ! wiz      6212:             <p>The last section includes any <code class=
        !          6213:             "filename">buildlink3.mk</code> needed for <em class=
        !          6214:             "replaceable"><code>pkg</code></em>'s library
        !          6215:             dependencies. Including these <code class=
        !          6216:             "filename">buildlink3.mk</code> files means that the
        !          6217:             headers and libraries for these dependencies are also
        !          6218:             symlinked into <code class=
        !          6219:             "filename">${BUILDLINK_DIR}</code> whenever the
        !          6220:             <em class="replaceable"><code>pkg</code></em>
        !          6221:             <code class="filename">buildlink3.mk</code> file is
        !          6222:             included.</p>
1.1       grant    6223:           </div>
                   6224: 
                   6225:           <div class="sect2" lang="en" xml:lang="en">
                   6226:             <div class="titlepage">
                   6227:               <div>
                   6228:                 <div>
1.7     ! wiz      6229:                   <h3 class="title"><a name="id2588048" id=
        !          6230:                   "id2588048"></a>9.2.2. Updating <code class=
        !          6231:                   "varname">BUILDLINK_DEPENDS.<em class=
        !          6232:                   "replaceable"><code>pkg</code></em></code> in
        !          6233:                   <code class="filename">buildlink3.mk</code>
        !          6234:                   files</h3>
1.1       grant    6235:                 </div>
                   6236:               </div>
                   6237:             </div>
                   6238: 
                   6239:             <p>There are two situations that require increasing the
1.7     ! wiz      6240:             dependency listed in <code class=
        !          6241:             "varname">BUILDLINK_DEPENDS.<em class=
        !          6242:             "replaceable"><code>pkg</code></em></code> after a
        !          6243:             package update:</p>
1.1       grant    6244: 
                   6245:             <div class="orderedlist">
                   6246:               <ol type="1">
                   6247:                 <li>
                   6248:                   <p>if the sonames (major number of the library
                   6249:                   version) of any installed shared libraries
                   6250:                   change;</p>
                   6251:                 </li>
                   6252: 
                   6253:                 <li>
                   6254:                   <p>if the API or interface to the header files
                   6255:                   change.</p>
                   6256:                 </li>
                   6257:               </ol>
                   6258:             </div>
                   6259: 
1.7     ! wiz      6260:             <p>In these cases, <code class=
        !          6261:             "varname">BUILDLINK_DEPENDS.<em class=
        !          6262:             "replaceable"><code>pkg</code></em></code> should be
        !          6263:             adjusted to require at least the new package version.
        !          6264:             In some cases, the packages that depend on this new
        !          6265:             version may need their <code class=
        !          6266:             "varname">PKGREVISION</code>s increased and, if they
        !          6267:             have <code class="filename">buildlink3.mk</code> files,
        !          6268:             their <code class=
        !          6269:             "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
        !          6270:             pkg</code></em></code> adjusted, too. This is needed so
        !          6271:             that binary packages made using it will require the
        !          6272:             correct package dependency and not settle for an older
        !          6273:             one which will not contain the necessary shared
        !          6274:             libraries.</p>
1.1       grant    6275: 
                   6276:             <p>Please take careful consideration before adjusting
1.7     ! wiz      6277:             <code class="varname">BUILDLINK_DEPENDS.<em class=
        !          6278:             "replaceable"><code>pkg</code></em></code> as we don't
        !          6279:             want to cause unneeded package deletions and rebuilds.
        !          6280:             In many cases, new versions of packages work just fine
        !          6281:             with older dependencies. See <a href="#dependencies"
        !          6282:             title="12.1.3.&nbsp;Handling dependencies">Section
        !          6283:             12.1.3, &#8220;Handling dependencies&#8221;</a> and
        !          6284:             <a href="#buildlink" title=
1.1       grant    6285:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter 9,
                   6286:             <i>Buildlink methodology</i></a> for more information
                   6287:             about dependencies on other packages, including the
1.7     ! wiz      6288:             <code class="varname">BUILDLINK_RECOMMENDED</code> and
        !          6289:             <code class="varname">RECOMMENDED</code>
        !          6290:             definitions.</p>
1.1       grant    6291:           </div>
                   6292:         </div>
                   6293: 
                   6294:         <div class="sect1" lang="en" xml:lang="en">
                   6295:           <div class="titlepage">
                   6296:             <div>
                   6297:               <div>
                   6298:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      6299:                 "id2588126" id="id2588126"></a>9.3.&nbsp;Writing
        !          6300:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    6301:               </div>
                   6302:             </div>
                   6303:           </div>
                   6304: 
                   6305:           <p>Some packages in pkgsrc install headers and libraries
                   6306:           that coincide with headers and libraries present in the
1.7     ! wiz      6307:           base system. Aside from a <code class=
        !          6308:           "filename">buildlink3.mk</code> file, these packages
        !          6309:           should also include a <code class=
        !          6310:           "filename">builtin.mk</code> file that includes the
        !          6311:           necessary checks to decide whether using the built-in
        !          6312:           software or the pkgsrc software is appropriate.</p>
1.1       grant    6313: 
                   6314:           <p>The only requirements of a builtin.mk file for
1.7     ! wiz      6315:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    6316: 
                   6317:           <div class="orderedlist">
                   6318:             <ol type="1">
                   6319:               <li>
1.7     ! wiz      6320:                 <p>It should set <code class=
        !          6321:                 "varname">USE_BUILTIN.<em class=
        !          6322:                 "replaceable"><code>pkg</code></em></code> to
        !          6323:                 either &#8220;<span class="quote">yes</span>&#8221;
        !          6324:                 or &#8220;<span class="quote">no</span>&#8221;
        !          6325:                 after it is included.</p>
1.1       grant    6326:               </li>
                   6327: 
                   6328:               <li>
                   6329:                 <p>It should <span class=
                   6330:                 "emphasis"><em>not</em></span> override any
1.7     ! wiz      6331:                 <code class="varname">USE_BUILTIN.<em class=
        !          6332:                 "replaceable"><code>pkg</code></em></code> which is
        !          6333:                 already set before the <code class=
        !          6334:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    6335:               </li>
                   6336: 
                   6337:               <li>
                   6338:                 <p>It should be written to allow multiple
                   6339:                 inclusion. This is <span class=
                   6340:                 "emphasis"><em>very</em></span> important and takes
1.7     ! wiz      6341:                 careful attention to <code class=
        !          6342:                 "filename">Makefile</code> coding.</p>
1.1       grant    6343:               </li>
                   6344:             </ol>
                   6345:           </div>
                   6346: 
                   6347:           <div class="sect2" lang="en" xml:lang="en">
                   6348:             <div class="titlepage">
                   6349:               <div>
                   6350:                 <div>
1.7     ! wiz      6351:                   <h3 class="title"><a name="id2588208" id=
        !          6352:                   "id2588208"></a>9.3.1.&nbsp;Anatomy of a
        !          6353:                   <code class="filename">builtin.mk</code>
        !          6354:                   file</h3>
1.1       grant    6355:                 </div>
                   6356:               </div>
                   6357:             </div>
                   6358: 
                   6359:             <p>The following is the recommended template for
                   6360:             builtin.mk files:</p>
                   6361:             <pre class="programlisting">
                   6362: .if !defined(IS_BUILTIN.foo)
                   6363: #
                   6364: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   6365: # genuinely exists in the system or not.
                   6366: #
                   6367: IS_BUILTIN.foo?=        no
                   6368: 
                   6369: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   6370: # version can be determined.
                   6371: #
                   6372: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   6373: BUILTIN_PKG.foo?=       foo-1.0
                   6374: .  endif
                   6375: .endif  # IS_BUILTIN.foo
                   6376: 
                   6377: .if !defined(USE_BUILTIN.foo)
                   6378: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   6379: .  if defined(BUILTIN_PKG.foo)
                   6380: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   6381: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   6382: USE_BUILTIN.foo!=                                                       \
                   6383:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   6384:               ${ECHO} "yes";                                            \
                   6385:       else                                                              \
                   6386:               ${ECHO} "no";                                             \
                   6387:       fi
                   6388: .      endif
                   6389: .    endfor
                   6390: .  endif
                   6391: .endif  # USE_BUILTIN.foo
                   6392: 
                   6393: CHECK_BUILTIN.foo?=     no
                   6394: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   6395: #
                   6396: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   6397: # "yes" or "no".
                   6398: #
                   6399: .endif  # CHECK_BUILTIN.foo
                   6400:       
                   6401: </pre>
                   6402: 
1.7     ! wiz      6403:             <p>The first section sets <code class=
        !          6404:             "varname">IS_BUILTIN.<em class=
        !          6405:             "replaceable"><code>pkg</code></em></code> depending on
        !          6406:             if <em class="replaceable"><code>pkg</code></em> really
        !          6407:             exists in the base system. This should not be a base
        !          6408:             system software with similar functionality to
        !          6409:             <em class="replaceable"><code>pkg</code></em>; it
        !          6410:             should only be &#8220;<span class=
        !          6411:             "quote">yes</span>&#8221; if the actual package is
        !          6412:             included as part of the base system. This variable is
        !          6413:             only used internally within the <code class=
        !          6414:             "filename">builtin.mk</code> file.</p>
        !          6415: 
        !          6416:             <p>The second section sets <code class=
        !          6417:             "varname">BUILTIN_PKG.<em class=
        !          6418:             "replaceable"><code>pkg</code></em></code> to the
        !          6419:             version of <em class=
        !          6420:             "replaceable"><code>pkg</code></em> in the base system
        !          6421:             if it exists (if <code class=
        !          6422:             "varname">IS_BUILTIN.<em class=
        !          6423:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6424:             &#8220;<span class="quote">yes</span>&#8221;). This
1.7     ! wiz      6425:             variable is only used internally within the
        !          6426:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    6427: 
1.7     ! wiz      6428:             <p>The third section sets <code class=
        !          6429:             "varname">USE_BUILTIN.<em class=
        !          6430:             "replaceable"><code>pkg</code></em></code> and is
        !          6431:             <span class="emphasis"><em>required</em></span> in all
        !          6432:             <code class="filename">builtin.mk</code> files. The
        !          6433:             code in this section must make the determination
        !          6434:             whether the built-in software is adequate to satisfy
        !          6435:             the dependencies listed in <code class=
        !          6436:             "varname">BUILDLINK_DEPENDS.<em class=
        !          6437:             "replaceable"><code>pkg</code></em></code>. This is
        !          6438:             typically done by comparing <code class=
        !          6439:             "varname">BUILTIN_PKG.<em class=
        !          6440:             "replaceable"><code>pkg</code></em></code> against each
        !          6441:             of the dependencies in <code class=
        !          6442:             "varname">BUILDLINK_DEPENDS.<em class=
        !          6443:             "replaceable"><code>pkg</code></em></code>.
        !          6444:             <code class="varname">USE_BUILTIN.<em class=
        !          6445:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    6446:             "emphasis"><em>must</em></span> be set to the correct
1.7     ! wiz      6447:             value by the end of the <code class=
        !          6448:             "filename">builtin.mk</code> file. Note that
        !          6449:             <code class="varname">USE_BUILTIN.<em class=
        !          6450:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    6451:             &#8220;<span class="quote">yes</span>&#8221; even if
1.7     ! wiz      6452:             <code class="varname">IS_BUILTIN.<em class=
        !          6453:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6454:             &#8220;<span class="quote">no</span>&#8221; because we
                   6455:             may make the determination that the built-in version of
                   6456:             the software is similar enough to be used as a
                   6457:             replacement.</p>
                   6458: 
1.7     ! wiz      6459:             <p>The last section is guarded by <code class=
        !          6460:             "varname">CHECK_BUILTIN.<em class=
        !          6461:             "replaceable"><code>pkg</code></em></code>, and
        !          6462:             includes code that uses the value of <code class=
        !          6463:             "varname">USE_BUILTIN.<em class=
        !          6464:             "replaceable"><code>pkg</code></em></code> set in the
        !          6465:             previous section. This typically includes, e.g., adding
1.1       grant    6466:             additional dependency restrictions and listing
1.7     ! wiz      6467:             additional files to symlink into <code class=
        !          6468:             "filename">${BUILDLINK_DIR}</code> (via <code class=
        !          6469:             "varname">BUILDLINK_FILES.<em class=
        !          6470:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    6471:           </div>
                   6472: 
                   6473:           <div class="sect2" lang="en" xml:lang="en">
                   6474:             <div class="titlepage">
                   6475:               <div>
                   6476:                 <div>
1.7     ! wiz      6477:                   <h3 class="title"><a name="id2588366" id=
        !          6478:                   "id2588366"></a>9.3.2.&nbsp;Global preferences
1.1       grant    6479:                   for native or pkgsrc software</h3>
                   6480:                 </div>
                   6481:               </div>
                   6482:             </div>
                   6483: 
                   6484:             <p>When building packages, it's possible to choose
                   6485:             whether to set a global preference for using either the
                   6486:             built-in (native) version or the pkgsrc version of
                   6487:             software to satisfy a dependency. This is controlled by
1.7     ! wiz      6488:             setting <code class="varname">PREFER_PKGSRC</code> and
        !          6489:             <code class="varname">PREFER_NATIVE</code>. These
        !          6490:             variables take values of either &#8220;<span class=
1.1       grant    6491:             "quote">yes</span>&#8221;, &#8220;<span class=
                   6492:             "quote">no</span>&#8221;, or a list of packages.
1.7     ! wiz      6493:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
        !          6494:             to use the pkgsrc versions of software, while
        !          6495:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
        !          6496:             to use the built-in versions. Preferences are
        !          6497:             determined by the most specific instance of the package
        !          6498:             in either <code class="varname">PREFER_PKGSRC</code> or
        !          6499:             <code class="varname">PREFER_NATIVE</code>. If a
        !          6500:             package is specified in neither or in both variables,
        !          6501:             then <code class="varname">PREFER_PKGSRC</code> has
        !          6502:             precedence over <code class=
        !          6503:             "varname">PREFER_NATIVE</code>. For example, to require
        !          6504:             using pkgsrc versions of software for all but the most
        !          6505:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    6506:             <pre class="programlisting">
                   6507:         PREFER_PKGSRC=  yes
                   6508:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   6509:       
                   6510: </pre>
                   6511: 
                   6512:             <p>A package <span class=
1.7     ! wiz      6513:             "emphasis"><em>must</em></span> have a <code class=
        !          6514:             "filename">builtin.mk</code> file to be listed in
        !          6515:             <code class="varname">PREFER_NATIVE</code>, otherwise
        !          6516:             it is simply ignored in that list.</p>
1.1       grant    6517:           </div>
                   6518:         </div>
                   6519:       </div>
                   6520: 
                   6521:       <div class="chapter" lang="en" xml:lang="en">
                   6522:         <div class="titlepage">
                   6523:           <div>
                   6524:             <div>
                   6525:               <h2 class="title"><a name="options" id=
                   6526:               "options"></a>Chapter&nbsp;10.&nbsp;Options
                   6527:               handling</h2>
                   6528:             </div>
                   6529:           </div>
                   6530:         </div>
                   6531: 
                   6532:         <div class="toc">
                   6533:           <p><b>Table of Contents</b></p>
                   6534: 
                   6535:           <dl>
1.7     ! wiz      6536:             <dt><span class="sect1"><a href="#id2588507">10.1.
1.1       grant    6537:             Global default options</a></span></dt>
                   6538: 
1.7     ! wiz      6539:             <dt><span class="sect1"><a href="#id2588522">10.2.
        !          6540:             Converting packages to use <code class=
        !          6541:             "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    6542:           </dl>
                   6543:         </div>
                   6544: 
                   6545:         <p>Many packages have the ability to be built to support
1.7     ! wiz      6546:         different sets of features. <code class=
        !          6547:         "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1       grant    6548:         that provides generic handling of those options that
                   6549:         determine different ways in which the packages can be
                   6550:         built. It's possible for the user to specify exactly which
                   6551:         sets of options will be built into a package or to allow a
                   6552:         set of global default options apply.</p>
                   6553: 
                   6554:         <div class="sect1" lang="en" xml:lang="en">
                   6555:           <div class="titlepage">
                   6556:             <div>
                   6557:               <div>
                   6558:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      6559:                 "id2588507" id="id2588507"></a>10.1.&nbsp;Global
1.1       grant    6560:                 default options</h2>
                   6561:               </div>
                   6562:             </div>
                   6563:           </div>
                   6564: 
1.7     ! wiz      6565:           <p>Global default options are listed in <code class=
        !          6566:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1       grant    6567:           the options that should be built into every package if
                   6568:           that option is supported. This variable should be set in
1.7     ! wiz      6569:           <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    6570:         </div>
                   6571: 
                   6572:         <div class="sect1" lang="en" xml:lang="en">
                   6573:           <div class="titlepage">
                   6574:             <div>
                   6575:               <div>
                   6576:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      6577:                 "id2588522" id=
        !          6578:                 "id2588522"></a>10.2.&nbsp;Converting packages to
        !          6579:                 use <code class=
        !          6580:                 "filename">bsd.options.mk</code></h2>
1.1       grant    6581:               </div>
                   6582:             </div>
                   6583:           </div>
                   6584: 
1.7     ! wiz      6585:           <p>The following example shows how <code class=
        !          6586:           "filename">bsd.options.mk</code> should be use in a
        !          6587:           package <code class="filename">Makefile</code>, or in a
        !          6588:           file, e.g. <code class="filename">options.mk</code>, that
        !          6589:           is included by the main package <code class=
        !          6590:           "filename">Makefile</code>.</p>
1.1       grant    6591:           <pre class="programlisting">
                   6592: # Global and legacy options
                   6593: .if defined(WIBBLE_USE_OPENLDAP) &amp;&amp; !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
                   6594: PKG_DEFAULT_OPTIONS+=   ldap
                   6595: .endif
                   6596: .if defined(USE_SASL2) &amp;&amp; !empty(USE_SASL2:M[yY][eE][sS])
                   6597: PKG_DEFAULT_OPTIONS+=   sasl
                   6598: .endif
                   6599: 
                   6600: PKG_OPTIONS_VAR=        PKG_OPTIONS.wibble
                   6601: PKG_SUPPORTED_OPTIONS=  ldap sasl
                   6602: #
                   6603: # Default options for "wibble" package.
                   6604: #
                   6605: .if !defined(PKG_OPTIONS.wibble)
                   6606: PKG_DEFAULT_OPTIONS+=   sasl
                   6607: endif
                   6608: .include "../../mk/bsd.options.mk"
                   6609: 
                   6610: # Package-specific option-handling
                   6611: 
                   6612: ###
                   6613: ### LDAP support
                   6614: ###
                   6615: .if !empty(PKG_OPTIONS:Mldap)
                   6616: .  include "../../databases/openldap/buildlink3.mk"
                   6617: CONFIGURE_ARGS+=      --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   6618: .endif
                   6619: 
                   6620: ###
                   6621: ### SASL authentication
                   6622: ###
                   6623: .if !empty(PKG_OPTIONS:Msasl)
                   6624: .  include "../../security/cyrus-sasl2/buildlink3.mk"
                   6625: CONFIGURE_ARGS+=        --enable-sasl=${BUILDLINK_PREFIX.sasl}
                   6626: .endif
                   6627:       
                   6628: </pre>
                   6629: 
                   6630:           <p>The first section only exists if you are converting a
                   6631:           package that had its own ad-hoc options handling to use
1.7     ! wiz      6632:           <code class="filename">bsd.options.mk</code>. It converts
1.1       grant    6633:           global or legacy options variables into an equivalent
1.7     ! wiz      6634:           <code class="varname">PKG_OPTIONS.<em class=
        !          6635:           "replaceable"><code>pkg</code></em></code> value. These
        !          6636:           sections will be removed over time as the old options are
        !          6637:           in turn deprecated and removed.</p>
1.1       grant    6638: 
                   6639:           <p>The second section contains the information about
                   6640:           which build options are supported by the package, and any
                   6641:           default options settings if needed.</p>
                   6642: 
                   6643:           <div class="orderedlist">
                   6644:             <ol type="1">
                   6645:               <li>
1.7     ! wiz      6646:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
        !          6647:                 a list of the name of the <a href=
1.1       grant    6648:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6649:                 <span class="citerefentry"><span class=
                   6650:                 "refentrytitle">make</span>(1)</span></a> variables
                   6651:                 that contain the options the user wishes to select.
                   6652:                 The recommended value is &#8220;<span class=
1.7     ! wiz      6653:                 "quote">PKG_OPTIONS.<em class=
        !          6654:                 "replaceable"><code>pkg</code></em></span>&#8221;
        !          6655:                 but any package-specific value may be used. This
1.1       grant    6656:                 variable should be set in a package Makefile.</p>
                   6657:               </li>
                   6658: 
                   6659:               <li>
1.7     ! wiz      6660:                 <p><code class=
        !          6661:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
        !          6662:                 build options supported by the package. This
        !          6663:                 variable should be set in a package Makefile.</p>
1.1       grant    6664:               </li>
                   6665: 
                   6666:               <li>
1.7     ! wiz      6667:                 <p><code class="varname">${PKG_OPTIONS_VAR}</code>
        !          6668:                 (the variables named in <code class=
        !          6669:                 "varname">PKG_OPTIONS_VAR</code>) are variables
        !          6670:                 that list the selected build options and override
        !          6671:                 any default options given in <code class=
        !          6672:                 "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1       grant    6673:                 options begin with a &#8220;<span class=
                   6674:                 "quote">-</span>&#8221;, then that option is always
                   6675:                 removed from the selected build options, e.g.</p>
                   6676:                 <pre class="programlisting">
                   6677:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   6678:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6679:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
                   6680:         # implies PKG_OPTIONS == "kerberos ldap"
                   6681:           
                   6682: </pre>
                   6683: 
                   6684:                 <p>or</p>
                   6685:                 <pre class="programlisting">
                   6686:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6687:         WIBBLE_OPTIONS=         kerberos -ldap ldap
                   6688:         # implies PKG_OPTIONS == "kerberos"
                   6689:           
                   6690: </pre>
                   6691: 
1.7     ! wiz      6692:                 <p>This variable should be set in <code class=
        !          6693:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    6694:               </li>
                   6695:             </ol>
                   6696:           </div>
                   6697: 
                   6698:           <p>After the inclusion of bsd.options.mk, the following
                   6699:           variables are set:</p>
                   6700: 
                   6701:           <div class="itemizedlist">
                   6702:             <ul type="disc">
                   6703:               <li>
1.7     ! wiz      6704:                 <p><code class="varname">PKG_OPTIONS</code>
        !          6705:                 contains the list of the selected build options,
        !          6706:                 properly filtered to remove unsupported and
        !          6707:                 duplicate options.</p>
1.1       grant    6708:               </li>
                   6709:             </ul>
                   6710:           </div>
                   6711: 
                   6712:           <p>The remaining sections contain the logic that is
                   6713:           specific to each option. There should be a check for
1.7     ! wiz      6714:           every option listed in <code class=
        !          6715:           "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
        !          6716:           be clear documentation on what turning on the option will
        !          6717:           do in the comments preceding each section. The correct
        !          6718:           way to check for an option is to check whether it is
        !          6719:           listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1       grant    6720:         </div>
                   6721:       </div>
                   6722: 
                   6723:       <div class="chapter" lang="en" xml:lang="en">
                   6724:         <div class="titlepage">
                   6725:           <div>
                   6726:             <div>
                   6727:               <h2 class="title"><a name="build" id=
                   6728:               "build"></a>Chapter&nbsp;11.&nbsp;The build
                   6729:               process</h2>
                   6730:             </div>
                   6731:           </div>
                   6732:         </div>
                   6733: 
                   6734:         <div class="toc">
                   6735:           <p><b>Table of Contents</b></p>
                   6736: 
                   6737:           <dl>
                   6738:             <dt><span class="sect1"><a href="#build.prefix">11.1.
                   6739:             Program location</a></span></dt>
                   6740: 
1.7     ! wiz      6741:             <dt><span class="sect1"><a href="#id2589198">11.2. Main
1.1       grant    6742:             targets</a></span></dt>
                   6743: 
                   6744:             <dt><span class="sect1"><a href=
                   6745:             "#build.helpful-targets">11.3. Other helpful
                   6746:             targets</a></span></dt>
                   6747:           </dl>
                   6748:         </div>
                   6749: 
                   6750:         <p>The basic steps for building a program are always the
                   6751:         same. First the program's source (<span class=
                   6752:         "emphasis"><em>distfile</em></span>) must be brought to the
                   6753:         local system and then extracted. After any patches to
                   6754:         compile properly on NetBSD are applied, the software can be
                   6755:         configured, then built (usually by compiling), and finally
                   6756:         the generated binaries, etc. can be put into place on the
                   6757:         system. These are exactly the steps performed by the NetBSD
                   6758:         package system, which is implemented as a series of targets
1.7     ! wiz      6759:         in a central Makefile, <code class=
        !          6760:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    6761: 
                   6762:         <div class="sect1" lang="en" xml:lang="en">
                   6763:           <div class="titlepage">
                   6764:             <div>
                   6765:               <div>
                   6766:                 <h2 class="title" style="clear: both"><a name=
                   6767:                 "build.prefix" id=
                   6768:                 "build.prefix"></a>11.1.&nbsp;Program location</h2>
                   6769:               </div>
                   6770:             </div>
                   6771:           </div>
                   6772: 
                   6773:           <p>Before outlining the process performed by the NetBSD
                   6774:           package system in the next section, here's a brief
                   6775:           discussion on where programs are installed, and which
                   6776:           variables influence this.</p>
                   6777: 
1.7     ! wiz      6778:           <p>The automatic variable <code class=
        !          6779:           "varname">PREFIX</code> indicates where all files of the
        !          6780:           final program shall be installed. It is usually set to
        !          6781:           <code class="varname">LOCALBASE</code> (<code class=
        !          6782:           "filename">/usr/pkg</code>), or <code class=
        !          6783:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    6784:           &#8220;<span class="quote">cross</span>&#8221; category.
1.7     ! wiz      6785:           The value of <code class="varname">PREFIX</code> needs to
        !          6786:           be put into the various places in the program's source
        !          6787:           where paths to these files are encoded. See <a href=
1.1       grant    6788:           "#components.patches" title=
                   6789:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   6790:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   6791:           title=
                   6792:           "12.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;12.3.1,
                   6793:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   6794:           details.</p>
                   6795: 
                   6796:           <p>When choosing which of these variables to use, follow
                   6797:           the following rules:</p>
                   6798: 
                   6799:           <div class="itemizedlist">
                   6800:             <ul type="disc">
                   6801:               <li>
1.7     ! wiz      6802:                 <p><code class="varname">PREFIX</code> always
        !          6803:                 points to the location where the current pkg will
        !          6804:                 be installed. When referring to a pkg's own
1.1       grant    6805:                 installation path, use &#8220;<span class=
                   6806:                 "quote">${PREFIX}</span>&#8221;.</p>
                   6807:               </li>
                   6808: 
                   6809:               <li>
1.7     ! wiz      6810:                 <p><code class="varname">LOCALBASE</code> is where
        !          6811:                 all non-X11 pkgs are installed. If you need to
1.1       grant    6812:                 construct a -I or -L argument to the compiler to
                   6813:                 find includes and libraries installed by another
                   6814:                 non-X11 pkg, use &#8220;<span class=
                   6815:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   6816:               </li>
                   6817: 
                   6818:               <li>
1.7     ! wiz      6819:                 <p><code class="varname">X11BASE</code> is where
        !          6820:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    6821:                 installed. When looking for <span class=
                   6822:                 "emphasis"><em>standard</em></span> X11 includes
                   6823:                 (not those installed by a pkg), use
                   6824:                 &#8220;<span class=
                   6825:                 "quote">${X11BASE}</span>&#8221;.</p>
                   6826:               </li>
                   6827: 
                   6828:               <li>
                   6829:                 <p>X11 based are special in that they may be
1.7     ! wiz      6830:                 installed in either <code class=
        !          6831:                 "varname">X11BASE</code> or <code class=
        !          6832:                 "varname">LOCALBASE</code>.</p>
1.1       grant    6833: 
                   6834:                 <p>Usually, X11 packages should be installed under
1.7     ! wiz      6835:                 <code class="varname">LOCALBASE</code> whenever
        !          6836:                 possible. Note that you will need to set
        !          6837:                 <code class="varname">USE_X11</code> in them to
        !          6838:                 request the presence of X11 and to get the right
        !          6839:                 compilation flags.</p>
1.1       grant    6840: 
                   6841:                 <p>Even though, there are some packages that cannot
1.7     ! wiz      6842:                 be installed under <code class=
        !          6843:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    6844:                 app-defaults files. These packages are special and
1.7     ! wiz      6845:                 they must be placed under <code class=
        !          6846:                 "varname">X11BASE</code>. To accomplish this, set
        !          6847:                 either <code class="varname">USE_X11BASE</code> or
        !          6848:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    6849:                 package.</p>
                   6850: 
1.7     ! wiz      6851:                 <p>Some notes: <code class="varname">USE_X11</code>
        !          6852:                 and <code class="varname">USE_X11BASE</code> are
        !          6853:                 mutually exclusive. If you need to find includes or
        !          6854:                 libraries installed by a pkg that has <code class=
        !          6855:                 "varname">USE_IMAKE</code> or <code class=
        !          6856:                 "varname">USE_X11BASE</code> in its pkg
        !          6857:                 <code class="filename">Makefile</code>, you need to
        !          6858:                 use <span class="emphasis"><em>both</em></span>
        !          6859:                 <code class="filename">${X11BASE}</code> and
        !          6860:                 <code class="filename">${LOCALBASE}</code>. To
        !          6861:                 force installation of all X11 packages in
        !          6862:                 <code class="varname">LOCALBASE</code>, the
        !          6863:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          6864:                 href=
1.1       grant    6865:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.7     ! wiz      6866:                 class="pkgname">pkgtools/xpkgwedge</a> is enabled
        !          6867:                 by default.</p>
1.1       grant    6868:               </li>
                   6869: 
                   6870:               <li>
1.7     ! wiz      6871:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    6872:                 used to refer to the installed location of an X11
1.7     ! wiz      6873:                 package. <code class="varname">X11PREFIX</code>
        !          6874:                 will be set to <code class="varname">X11BASE</code>
        !          6875:                 if xpkgwedge is not installed, and to <code class=
        !          6876:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    6877:                 installed.</p>
                   6878:               </li>
                   6879: 
                   6880:               <li>
                   6881:                 <p>If xpkgwedge is installed, it is possible to
1.7     ! wiz      6882:                 have some packages installed in <code class=
        !          6883:                 "varname">X11BASE</code> and some in <code class=
        !          6884:                 "varname">LOCALBASE</code>. To determine the prefix
        !          6885:                 of an installed package, the <code class=
        !          6886:                 "varname">EVAL_PREFIX</code> definition can be
        !          6887:                 used. It takes pairs in the format
        !          6888:                 &#8220;<span class=
1.1       grant    6889:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.7     ! wiz      6890:                 the make(1) variable <code class=
        !          6891:                 "varname">DIRNAME</code> will be set to the prefix
        !          6892:                 of the installed package &lt;package&gt;, or
1.1       grant    6893:                 &#8220;<span class=
                   6894:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   6895:                 is not installed.</p>
                   6896: 
                   6897:                 <p>This is best illustrated by example.</p>
                   6898: 
1.7     ! wiz      6899:                 <p>The following lines are taken from <code class=
        !          6900:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    6901:                 <pre class="programlisting">
1.7     ! wiz      6902: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    6903: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   6904:                         --with-gtk-prefix="${GTKDIR}"           \
                   6905:                         --enable-multibyte
                   6906: </pre>
                   6907: 
                   6908:                 <p>Specific defaults can be defined for the
1.7     ! wiz      6909:                 packages evaluated using <code class=
        !          6910:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    6911:                 of the form:</p>
                   6912:                 <pre class="programlisting">
                   6913: GTKDIR_DEFAULT= ${LOCALBASE}
                   6914: </pre>
                   6915: 
1.7     ! wiz      6916:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    6917:                 corresponds to the first definition in the
1.7     ! wiz      6918:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    6919:               </li>
                   6920: 
                   6921:               <li>
1.7     ! wiz      6922:                 <p>Within <code class="filename">${PREFIX}</code>,
1.1       grant    6923:                 packages should install files according to hier(7),
                   6924:                 with the exception that manual pages go into
1.7     ! wiz      6925:                 <code class="filename">${PREFIX}/man</code>, not
        !          6926:                 <code class=
        !          6927:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    6928:               </li>
                   6929:             </ul>
                   6930:           </div>
                   6931:         </div>
                   6932: 
                   6933:         <div class="sect1" lang="en" xml:lang="en">
                   6934:           <div class="titlepage">
                   6935:             <div>
                   6936:               <div>
                   6937:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      6938:                 "id2589198" id="id2589198"></a>11.2.&nbsp;Main
1.1       grant    6939:                 targets</h2>
                   6940:               </div>
                   6941:             </div>
                   6942:           </div>
                   6943: 
                   6944:           <p>The main targets used during the build process defined
1.7     ! wiz      6945:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    6946: 
                   6947:           <div class="variablelist">
                   6948:             <dl>
                   6949:               <dt><span class="term">fetch</span></dt>
                   6950: 
                   6951:               <dd>
                   6952:                 <p>This will check if the file(s) given in the
1.7     ! wiz      6953:                 variables <code class="varname">DISTFILES</code>
        !          6954:                 and <code class="varname">PATCHFILES</code> (as
        !          6955:                 defined in the package's Makefile) are present on
        !          6956:                 the local system in <code class=
        !          6957:                 "filename">/usr/pkgsrc/distfiles</code>. If they
        !          6958:                 are not present, an attempt will be made to fetch
        !          6959:                 them using commands of the form:</p>
1.1       grant    6960:                 <pre class="programlisting">
                   6961: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   6962: </pre>
                   6963: 
                   6964:                 <p>where ${site} varies through several
1.7     ! wiz      6965:                 possibilities in turn: first, <code class=
        !          6966:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
        !          6967:                 then the sites specified in either <code class=
        !          6968:                 "varname">SITES_file</code> if defined, else
        !          6969:                 <code class="varname">MASTER_SITES</code> or
        !          6970:                 <code class="varname">PATCH_SITES</code>, as
        !          6971:                 applies, then finally the value of <code class=
        !          6972:                 "varname">MASTER_SITE_BACKUP</code>. The order of
        !          6973:                 all except the first can be optionally sorted by
        !          6974:                 the user, via setting either <code class=
        !          6975:                 "varname">MASTER_SORT_AWK</code> or <code class=
        !          6976:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    6977:               </dd>
                   6978: 
                   6979:               <dt><span class="term">checksum</span></dt>
                   6980: 
                   6981:               <dd>
                   6982:                 <p>After the distfile(s) are fetched, their
                   6983:                 checksum is generated and compared with the
                   6984:                 checksums stored in the distinfo file. If the
                   6985:                 checksums don't match, the build is aborted. This
                   6986:                 is to ensure the same distfile is used for
                   6987:                 building, and that the distfile wasn't changed,
                   6988:                 e.g. by some malign force, deliberately changed
                   6989:                 distfiles on the master distribution site or
                   6990:                 network lossage.</p>
                   6991:               </dd>
                   6992: 
                   6993:               <dt><span class="term">extract</span></dt>
                   6994: 
                   6995:               <dd>
                   6996:                 <p>When the distfiles are present on the local
                   6997:                 system, they need to be extracted, as they are
                   6998:                 usually in the form of some compressed archive
1.7     ! wiz      6999:                 format, most commonly <code class=
        !          7000:                 "filename">.tar.gz</code>.</p>
1.1       grant    7001: 
                   7002:                 <p>If only some of the distfiles need to be
                   7003:                 uncompressed, the files to be uncompressed should
1.7     ! wiz      7004:                 be put into <code class=
        !          7005:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    7006: 
1.7     ! wiz      7007:                 <p>If the distfiles are not in <code class=
        !          7008:                 "filename">.tar.gz</code> format, they can be
        !          7009:                 extracted by setting either <code class=
        !          7010:                 "varname">EXTRACT_SUFX</code>, or <code class=
        !          7011:                 "varname">EXTRACT_CMD</code>, <code class=
        !          7012:                 "varname">EXTRACT_BEFORE_ARGS</code> and
        !          7013:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
        !          7014:                 the former case, pkgsrc knows how to extract a
        !          7015:                 number of suffixes (<code class=
        !          7016:                 "filename">.tar.gz</code>, <code class=
        !          7017:                 "filename">.tgz</code>, <code class=
        !          7018:                 "filename">.tar.gz2</code>, <code class=
        !          7019:                 "filename">.tbz</code>, <code class=
        !          7020:                 "filename">.tar.Z</code>, <code class=
        !          7021:                 "filename">.tar</code>, <code class=
        !          7022:                 "filename">.shar.gz</code>, <code class=
        !          7023:                 "filename">.shar.bz2</code>, <code class=
        !          7024:                 "filename">.shar.Z</code>, <code class=
        !          7025:                 "filename">.shar</code>, <code class=
        !          7026:                 "filename">.Z</code>, <code class=
        !          7027:                 "filename">.bz2</code> and <code class=
        !          7028:                 "filename">.gz</code>; see the definition of the
        !          7029:                 various <code class="varname">DECOMPRESS_CMD</code>
        !          7030:                 variables <code class="filename">bsd.pkg.mk</code>
        !          7031:                 for a complete list). Here's an example on how to
        !          7032:                 use the other variables for a program that comes
        !          7033:                 with a compressed shell archive whose name ends in
        !          7034:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    7035:                 <pre class="programlisting">
                   7036:      EXTRACT_SUFX=   .msg.gz
                   7037:      EXTRACT_CMD=            zcat
                   7038:      EXTRACT_BEFORE_ARGS=
                   7039:      EXTRACT_AFTER_ARGS=     |sh
                   7040: </pre>
                   7041:               </dd>
                   7042: 
                   7043:               <dt><span class="term">patch</span></dt>
                   7044: 
                   7045:               <dd>
                   7046:                 <p>After extraction, all the patches named by the
1.7     ! wiz      7047:                 <code class="varname">PATCHFILES</code>, those
        !          7048:                 present in the patches subdirectory of the package
        !          7049:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
        !          7050:                 <code class=
        !          7051:                 "filename">/usr/local/patches/graphics/png</code>)
        !          7052:                 are applied. Patchfiles ending in <code class=
        !          7053:                 "filename">.Z</code> or <code class=
        !          7054:                 "filename">.gz</code> are uncompressed before they
        !          7055:                 are applied, files ending in <code class=
        !          7056:                 "filename">.orig</code> or <code class=
        !          7057:                 "filename">.rej</code> are ignored. Any special
        !          7058:                 options to patch(1) can be handed in <code class=
        !          7059:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
        !          7060:                 "#components.patches" title=
1.1       grant    7061:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   7062:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   7063: 
                   7064:                 <p>By default patch(1) is given special args to
                   7065:                 make it fail if the patches apply with some lines
                   7066:                 of fuzz. Please fix (regen) the patches so that
                   7067:                 they apply cleanly. The rationale behind this is
                   7068:                 that patches that don't apply cleanly may end up
                   7069:                 being applied in the wrong place, and cause severe
                   7070:                 harm there.</p>
                   7071:               </dd>
                   7072: 
                   7073:               <dt><span class="term">configure</span></dt>
                   7074: 
                   7075:               <dd>
                   7076:                 <p>Most pieces of software need information on the
                   7077:                 header files, system calls, and library routines
                   7078:                 which are available in NetBSD. This is the process
                   7079:                 known as configuration, and is usually automated.
                   7080:                 In most cases, a script is supplied with the
                   7081:                 source, and its invocation results in generation of
                   7082:                 header files, Makefiles, etc.</p>
                   7083: 
                   7084:                 <p>If the program's distfile contains its own
                   7085:                 configure script, this can be invoked by setting
1.7     ! wiz      7086:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    7087:                 configure script is a GNU autoconf script,
1.7     ! wiz      7088:                 <code class="varname">GNU_CONFIGURE</code> should
        !          7089:                 be specified instead. In either case, any arguments
        !          7090:                 to the configure script can be specified in the
        !          7091:                 <code class="varname">CONFIGURE_ARGS</code>
        !          7092:                 variable, and the configure script's name can be
        !          7093:                 set in <code class=
        !          7094:                 "varname">CONFIGURE_SCRIPT</code> if it differs
        !          7095:                 from the default &#8220;<span class=
1.1       grant    7096:                 "quote">configure</span>&#8221;. Here's an example
                   7097:                 from the <a xmlns=
                   7098:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7099:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.7     ! wiz      7100:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    7101:                 <pre class="programlisting">
                   7102: HAS_CONFIGURE=          yes
                   7103: CONFIGURE_SCRIPT=       Configure
                   7104: CONFIGURE_ARGS+=        netbsd13
                   7105: </pre>
                   7106: 
                   7107:                 <p>If the program uses an Imakefile for
                   7108:                 configuration, the appropriate steps can be invoked
1.7     ! wiz      7109:                 by setting <code class="varname">USE_IMAKE</code>
        !          7110:                 to &#8220;<span class="quote">YES</span>&#8221;.
        !          7111:                 (If you only want the package installed in
        !          7112:                 <code class="varname">$X11PREFIX</code> but xmkmf
        !          7113:                 not being run, set <code class=
        !          7114:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    7115:               </dd>
                   7116: 
                   7117:               <dt><span class="term">build</span></dt>
                   7118: 
                   7119:               <dd>
                   7120:                 <p>Once configuration has taken place, the software
1.7     ! wiz      7121:                 will be built by invoking <code class=
        !          7122:                 "varname">$MAKE_PROGRAM</code> on <code class=
        !          7123:                 "varname">$MAKEFILE</code> with <code class=
        !          7124:                 "varname">$ALL_TARGET</code> as the target to
        !          7125:                 build. The default <code class=
        !          7126:                 "varname">MAKE_PROGRAM</code> is
        !          7127:                 &#8220;<span class="quote">gmake</span>&#8221; if
        !          7128:                 <code class="varname">USE_GNU_TOOLS</code> contains
        !          7129:                 &#8220;<span class="quote">make</span>&#8221;,
1.1       grant    7130:                 &#8220;<span class="quote">make</span>&#8221;
1.7     ! wiz      7131:                 otherwise. <code class="varname">MAKEFILE</code> is
        !          7132:                 set to &#8220;<span class=
1.1       grant    7133:                 "quote">Makefile</span>&#8221; by default, and
1.7     ! wiz      7134:                 <code class="varname">ALL_TARGET</code> defaults to
1.1       grant    7135:                 &#8220;<span class="quote">all</span>&#8221;. Any
                   7136:                 of these variables can be set in the package's
                   7137:                 Makefile to change the default build process.</p>
                   7138:               </dd>
                   7139: 
                   7140:               <dt><span class="term">install</span></dt>
                   7141: 
                   7142:               <dd>
                   7143:                 <p>Once the build stage has completed, the final
                   7144:                 step is to install the software in public
                   7145:                 directories, so users can access the programs and
1.7     ! wiz      7146:                 files. As in the build-target, <code class=
        !          7147:                 "varname">$MAKE_PROGRAM</code> is invoked on
        !          7148:                 <code class="varname">$MAKEFILE</code> here, but
        !          7149:                 with the <code class=
        !          7150:                 "varname">$INSTALL_TARGET</code> instead, the
        !          7151:                 latter defaulting to &#8220;<span class=
        !          7152:                 "quote">install</span>&#8221; (plus
        !          7153:                 &#8220;<span class=
        !          7154:                 "quote">install.man</span>&#8221;, if <code class=
        !          7155:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    7156:               </dd>
                   7157:             </dl>
                   7158:           </div>
                   7159: 
                   7160:           <p>If no target is specified, the default is
                   7161:           &#8220;<span class="quote">build</span>&#8221;. If a
                   7162:           subsequent stage is requested, all prior stages are made:
1.7     ! wiz      7163:           e.g. <span><strong class="command">make
        !          7164:           build</strong></span> will also perform the equivalent
        !          7165:           of:</p>
1.1       grant    7166:           <pre class="programlisting">
                   7167: make fetch
                   7168: make checksum
                   7169: make extract
                   7170: make patch
                   7171: make configure
                   7172: make build
                   7173: </pre>
                   7174:         </div>
                   7175: 
                   7176:         <div class="sect1" lang="en" xml:lang="en">
                   7177:           <div class="titlepage">
                   7178:             <div>
                   7179:               <div>
                   7180:                 <h2 class="title" style="clear: both"><a name=
                   7181:                 "build.helpful-targets" id=
                   7182:                 "build.helpful-targets"></a>11.3.&nbsp;Other
                   7183:                 helpful targets</h2>
                   7184:               </div>
                   7185:             </div>
                   7186:           </div>
                   7187: 
                   7188:           <div class="variablelist">
                   7189:             <dl>
                   7190:               <dt><span class="term">pre/post-*</span></dt>
                   7191: 
                   7192:               <dd>
                   7193:                 <p>For any of the main targets described in the
                   7194:                 previous section, two auxiliary targets exist with
                   7195:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   7196:                 &#8220;<span class="quote">post-</span>&#8221; used
                   7197:                 as a prefix for the main target's name. These
                   7198:                 targets are invoked before and after the main
                   7199:                 target is called, allowing extra configuration or
                   7200:                 installation steps be performed from a package's
                   7201:                 Makefile, for example, which a program's configure
                   7202:                 script or install target omitted.</p>
                   7203:               </dd>
                   7204: 
                   7205:               <dt><span class="term">do-*</span></dt>
                   7206: 
                   7207:               <dd>
                   7208:                 <p>Should one of the main targets do the wrong
                   7209:                 thing, and should there be no variable to fix this,
                   7210:                 you can redefine it with the do-* target. (Note
                   7211:                 that redefining the target itself instead of the
                   7212:                 do-* target is a bad idea, as the pre-* and post-*
                   7213:                 targets won't be called anymore, etc.) You will not
                   7214:                 usually need to do this.</p>
                   7215:               </dd>
                   7216: 
                   7217:               <dt><span class="term">reinstall</span></dt>
                   7218: 
                   7219:               <dd>
1.7     ! wiz      7220:                 <p>If you did a <span><strong class="command">make
        !          7221:                 install</strong></span> and you noticed some file
        !          7222:                 was not installed properly, you can repeat the
1.1       grant    7223:                 installation with this target, which will ignore
                   7224:                 the &#8220;<span class="quote">already
                   7225:                 installed</span>&#8221; flag.</p>
                   7226:               </dd>
                   7227: 
                   7228:               <dt><span class="term">deinstall</span></dt>
                   7229: 
                   7230:               <dd>
                   7231:                 <p>This target does a pkg_delete(1) in the current
                   7232:                 directory, effectively de-installing the package.
                   7233:                 The following variables can be used to tune the
                   7234:                 behaviour:</p>
                   7235: 
                   7236:                 <div class="variablelist">
                   7237:                   <dl>
1.7     ! wiz      7238:                     <dt><span class="term"><code class=
        !          7239:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    7240: 
                   7241:                     <dd>
                   7242:                       <p>Add a "-v" to the <a href=
                   7243:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7244:                       <span class="citerefentry"><span class=
                   7245:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7246:                       command.</p>
                   7247:                     </dd>
                   7248: 
1.7     ! wiz      7249:                     <dt><span class="term"><code class=
        !          7250:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    7251: 
                   7252:                     <dd>
                   7253:                       <p>Remove all packages that require (depend
                   7254:                       on) the given package. This can be used to
                   7255:                       remove any packages that may have been pulled
                   7256:                       in by a given package, e.g. if
1.7     ! wiz      7257:                       <span><strong class="command">make deinstall
        !          7258:                       DEINSTALLDEPENDS=1</strong></span> is done in
        !          7259:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    7260:                       this is likely to remove whole KDE. Works by
                   7261:                       adding &#8220;<span class=
                   7262:                       "quote">-R</span>&#8221; to the <a href=
                   7263:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7264:                       <span class="citerefentry"><span class=
                   7265:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7266:                       command line.</p>
                   7267:                     </dd>
                   7268:                   </dl>
                   7269:                 </div>
                   7270:               </dd>
                   7271: 
                   7272:               <dt><span class="term">update</span></dt>
                   7273: 
                   7274:               <dd>
                   7275:                 <p>This target causes the current package to be
                   7276:                 updated to the latest version. The package and all
                   7277:                 depending packages first get de-installed, then
                   7278:                 current versions of the corresponding packages get
                   7279:                 compiled and installed. This is similar to manually
                   7280:                 noting which packages are currently installed, then
1.7     ! wiz      7281:                 performing a series of <span><strong class=
        !          7282:                 "command">make deinstall</strong></span> and
        !          7283:                 <span><strong class="command">make
        !          7284:                 install</strong></span> (or whatever <code class=
        !          7285:                 "varname">UPDATE_TARGET</code> is set to) for these
        !          7286:                 packages.</p>
1.1       grant    7287: 
                   7288:                 <p>You can use the &#8220;<span class=
                   7289:                 "quote">update</span>&#8221; target to resume
1.7     ! wiz      7290:                 package updating in case a previous
        !          7291:                 <span><strong class="command">make
        !          7292:                 update</strong></span> was interrupted for some
        !          7293:                 reason. However, in this case, make sure you don't
        !          7294:                 call <span><strong class="command">make
        !          7295:                 clean</strong></span> or otherwise remove the list
        !          7296:                 of dependent packages in <code class=
        !          7297:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    7298:                 ability to automatically update the current package
                   7299:                 along with the dependent packages you have
                   7300:                 installed.</p>
                   7301: 
1.7     ! wiz      7302:                 <p>Resuming an interrupted <span><strong class=
        !          7303:                 "command">make update</strong></span> will only
        !          7304:                 work as long as the package tree remains unchanged.
        !          7305:                 If the source code for one of the packages to be
        !          7306:                 updated has been changed, resuming
        !          7307:                 <span><strong class="command">make
        !          7308:                 update</strong></span> will most certainly
        !          7309:                 fail!</p>
1.1       grant    7310: 
                   7311:                 <p>The following variables can be used either on
1.7     ! wiz      7312:                 the command line or in <code class=
        !          7313:                 "filename">/etc/mk.conf</code> to alter the
        !          7314:                 behaviour of <span><strong class="command">make
        !          7315:                 update</strong></span>:</p>
1.1       grant    7316: 
                   7317:                 <div class="variablelist">
                   7318:                   <dl>
1.7     ! wiz      7319:                     <dt><span class="term"><code class=
        !          7320:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    7321: 
                   7322:                     <dd>
                   7323:                       <p>Install target to recursively use for the
                   7324:                       updated package and the dependent packages.
1.7     ! wiz      7325:                       Defaults to <code class=
        !          7326:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    7327:                       &#8220;<span class=
                   7328:                       "quote">install</span>&#8221; otherwise for
1.7     ! wiz      7329:                       <span><strong class="command">make
        !          7330:                       update</strong></span>. e.g.
        !          7331:                       <span><strong class="command">make update
        !          7332:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    7333:                     </dd>
                   7334: 
1.7     ! wiz      7335:                     <dt><span class="term"><code class=
        !          7336:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    7337: 
                   7338:                     <dd>
                   7339:                       <p>Don't clean up after updating. Useful if
                   7340:                       you want to leave the work sources of the
                   7341:                       updated packages around for inspection or
                   7342:                       other purposes. Be sure you eventually clean
                   7343:                       up the source tree (see the
                   7344:                       &#8220;<span class=
                   7345:                       "quote">clean-update</span>&#8221; target
                   7346:                       below) or you may run into troubles with old
                   7347:                       source code still lying around on your next
1.7     ! wiz      7348:                       <span><strong class=
        !          7349:                       "command">make</strong></span> or
        !          7350:                       <span><strong class="command">make
        !          7351:                       update</strong></span>.</p>
1.1       grant    7352:                     </dd>
                   7353: 
1.7     ! wiz      7354:                     <dt><span class="term"><code class=
        !          7355:                     "varname">REINSTALL</code></span></dt>
1.1       grant    7356: 
                   7357:                     <dd>
                   7358:                       <p>Deinstall each package before installing
1.7     ! wiz      7359:                       (making <code class=
        !          7360:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    7361:                       necessary if the &#8220;<span class=
                   7362:                       "quote">clean-update</span>&#8221; target
                   7363:                       (see below) was called after interrupting a
1.7     ! wiz      7364:                       running <span><strong class="command">make
        !          7365:                       update</strong></span>.</p>
1.1       grant    7366:                     </dd>
                   7367: 
1.7     ! wiz      7368:                     <dt><span class="term"><code class=
        !          7369:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    7370: 
                   7371:                     <dd>
                   7372:                       <p>Allows you to disable recursion and
                   7373:                       hardcode the target for packages. The default
                   7374:                       is &#8220;<span class=
                   7375:                       "quote">update</span>&#8221; for the update
                   7376:                       target, facilitating a recursive update of
1.7     ! wiz      7377:                       prerequisite packages. Only set <code class=
        !          7378:                       "varname">DEPENDS_TARGET</code> if you want
        !          7379:                       to disable recursive updates. Use
        !          7380:                       <code class="varname">UPDATE_TARGET</code>
        !          7381:                       instead to just set a specific target for
        !          7382:                       each package to be installed during
        !          7383:                       <span><strong class="command">make
        !          7384:                       update</strong></span> (see above).</p>
1.1       grant    7385:                     </dd>
                   7386:                   </dl>
                   7387:                 </div>
                   7388:               </dd>
                   7389: 
                   7390:               <dt><span class="term">clean-update</span></dt>
                   7391: 
                   7392:               <dd>
                   7393:                 <p>Clean the source tree for all packages that
1.7     ! wiz      7394:                 would get updated if <span><strong class=
        !          7395:                 "command">make update</strong></span> was called
        !          7396:                 from the current directory. This target should not
        !          7397:                 be used if the current package (or any of its
        !          7398:                 depending packages) have already been de-installed
        !          7399:                 (e.g., after calling <span><strong class=
        !          7400:                 "command">make update</strong></span>) or you may
        !          7401:                 lose some packages you intended to update. As a
        !          7402:                 rule of thumb: only use this target <span class=
        !          7403:                 "emphasis"><em>before</em></span> the first time
        !          7404:                 you run <span><strong class="command">make
        !          7405:                 update</strong></span> and only if you have a dirty
        !          7406:                 package tree (e.g., if you used <code class=
        !          7407:                 "varname">NOCLEAN</code>).</p>
1.1       grant    7408: 
                   7409:                 <p>If you unsure about whether your tree is clean
1.7     ! wiz      7410:                 you can either perform a <span><strong class=
        !          7411:                 "command">make clean</strong></span> at the top of
        !          7412:                 the tree, or use the following sequence of commands
1.1       grant    7413:                 from the directory of the package you want to
                   7414:                 update (<span class=
                   7415:                 "emphasis"><em>before</em></span> running
1.7     ! wiz      7416:                 <span><strong class="command">make
        !          7417:                 update</strong></span> for the first time,
        !          7418:                 otherwise you lose all the packages you wanted to
        !          7419:                 update!):</p>
1.1       grant    7420:                 <pre class="screen">
1.7     ! wiz      7421: <code class="prompt">#</code> <strong class=
        !          7422: "userinput"><code>make clean-update</code></strong>
        !          7423: <code class="prompt">#</code> <strong class=
        !          7424: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
        !          7425: <code class="prompt">#</code> <strong class=
        !          7426: "userinput"><code>make update</code></strong>
1.1       grant    7427: </pre>
                   7428: 
                   7429:                 <p>The following variables can be used either on
1.7     ! wiz      7430:                 the command line or in <code class=
        !          7431:                 "filename">/etc/mk.conf</code> to alter the
        !          7432:                 behaviour of <span><strong class="command">make
        !          7433:                 clean-update</strong></span>:</p>
1.1       grant    7434: 
                   7435:                 <div class="variablelist">
                   7436:                   <dl>
1.7     ! wiz      7437:                     <dt><span class="term"><code class=
        !          7438:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    7439: 
                   7440:                     <dd>
1.7     ! wiz      7441:                       <p>After <span><strong class="command">make
        !          7442:                       clean</strong></span>, do not reconstruct the
        !          7443:                       list of directories to update for this
        !          7444:                       package. Only use this if
        !          7445:                       <span><strong class="command">make
        !          7446:                       update</strong></span> successfully installed
        !          7447:                       all packages you wanted to update. Normally,
        !          7448:                       this is done automatically on
        !          7449:                       <span><strong class="command">make
        !          7450:                       update</strong></span>, but may have been
        !          7451:                       suppressed by the <code class=
        !          7452:                       "varname">NOCLEAN</code> variable (see
1.1       grant    7453:                       above).</p>
                   7454:                     </dd>
                   7455:                   </dl>
                   7456:                 </div>
                   7457:               </dd>
                   7458: 
                   7459:               <dt><span class="term">info</span></dt>
                   7460: 
                   7461:               <dd>
                   7462:                 <p>This target invokes <a href=
                   7463:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   7464:                 <span class="citerefentry"><span class=
                   7465:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   7466:                 the current package. You can use this to check
                   7467:                 which version of a package is installed.</p>
                   7468:               </dd>
                   7469: 
                   7470:               <dt><span class="term">readme</span></dt>
                   7471: 
                   7472:               <dd>
1.7     ! wiz      7473:                 <p>This target generates a <code class=
        !          7474:                 "filename">README.html</code> file, which can be
1.1       grant    7475:                 viewed using a browser such as <a xmlns=
                   7476:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7477:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.7     ! wiz      7478:                 class="pkgname">www/mozilla</a> or <a xmlns=
        !          7479:                 "http://www.w3.org/TR/xhtml1/transitional" href=
        !          7480:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
        !          7481:                 class="pkgname">www/links</a>. The generated files
        !          7482:                 contain references to any packages which are in the
        !          7483:                 <code class="varname">PACKAGES</code> directory on
        !          7484:                 the local host. The generated files can be made to
        !          7485:                 refer to URLs based on <code class=
        !          7486:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
        !          7487:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
        !          7488:                 wanted to generate <code class=
        !          7489:                 "filename">README.html</code> files which pointed
        !          7490:                 to binary packages on the local machine, in the
        !          7491:                 directory <code class=
        !          7492:                 "filename">/usr/packages</code>, set <code class=
        !          7493:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
        !          7494:                 and <code class=
        !          7495:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
        !          7496:                 <code class="varname">${PACKAGES}</code> directory
        !          7497:                 and its subdirectories will be searched for all the
        !          7498:                 binary packages.</p>
1.1       grant    7499:               </dd>
                   7500: 
                   7501:               <dt><span class="term">readme-all</span></dt>
                   7502: 
                   7503:               <dd>
1.7     ! wiz      7504:                 <p>Use this target to create a file <code class=
        !          7505:                 "filename">README-all.html</code> which contains a
1.1       grant    7506:                 list of all packages currently available in the
                   7507:                 NetBSD Packages Collection, together with the
                   7508:                 category they belong to and a short description.
1.7     ! wiz      7509:                 This file is compiled from the <code class=
        !          7510:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    7511:                 sure to run this <span class=
1.7     ! wiz      7512:                 "emphasis"><em>after</em></span> a
        !          7513:                 <span><strong class="command">make
        !          7514:                 readme</strong></span>.</p>
1.1       grant    7515:               </dd>
                   7516: 
                   7517:               <dt><span class="term">cdrom-readme</span></dt>
                   7518: 
                   7519:               <dd>
                   7520:                 <p>This is very much the same as the
                   7521:                 &#8220;<span class="quote">readme</span>&#8221;
                   7522:                 target (see above), but is to be used when
                   7523:                 generating a pkgsrc tree to be written to a CD-ROM.
1.7     ! wiz      7524:                 This target also produces <code class=
        !          7525:                 "filename">README.html</code> files, and can be
        !          7526:                 made to refer to URLs based on <code class=
        !          7527:                 "varname">CDROM_PKG_URL_HOST</code> and
        !          7528:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    7529:               </dd>
                   7530: 
                   7531:               <dt><span class="term">show-distfiles</span></dt>
                   7532: 
                   7533:               <dd>
                   7534:                 <p>This target shows which distfiles and patchfiles
1.7     ! wiz      7535:                 are needed to build the package. (<code class=
        !          7536:                 "varname">DISTFILES</code> and <code class=
        !          7537:                 "varname">PATCHFILES</code>, but not <code class=
        !          7538:                 "filename">patches/*</code>)</p>
1.1       grant    7539:               </dd>
                   7540: 
                   7541:               <dt><span class="term">show-downlevel</span></dt>
                   7542: 
                   7543:               <dd>
                   7544:                 <p>This target shows nothing if the package is not
                   7545:                 installed. If a version of this package is
                   7546:                 installed, but is not the version provided in this
                   7547:                 version of pkgsrc, then a warning message is
                   7548:                 displayed. This target can be used to show which of
                   7549:                 your installed packages are downlevel, and so the
                   7550:                 old versions can be deleted, and the current ones
                   7551:                 added.</p>
                   7552:               </dd>
                   7553: 
                   7554:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   7555: 
                   7556:               <dd>
                   7557:                 <p>This target shows the directory in the pkgsrc
                   7558:                 hierarchy from which the package can be built and
                   7559:                 installed. This may not be the same directory as
                   7560:                 the one from which the package was installed. This
                   7561:                 target is intended to be used by people who may
                   7562:                 wish to upgrade many packages on a single host, and
                   7563:                 can be invoked from the top-level pkgsrc Makefile
                   7564:                 by using the &#8220;<span class=
                   7565:                 "quote">show-host-specific-pkgs</span>&#8221;
                   7566:                 target.</p>
                   7567:               </dd>
                   7568: 
                   7569:               <dt><span class=
                   7570:               "term">show-installed-depends</span></dt>
                   7571: 
                   7572:               <dd>
                   7573:                 <p>This target shows which installed packages match
1.7     ! wiz      7574:                 the current package's <code class=
        !          7575:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    7576:                 dependencies are causing build problems.</p>
                   7577:               </dd>
                   7578: 
                   7579:               <dt><span class="term">check-shlibs</span></dt>
                   7580: 
                   7581:               <dd>
                   7582:                 <p>After a package is installed, check all its
                   7583:                 binaries and (on ELF platforms) shared libraries to
                   7584:                 see if they find the shared libs they need. Run by
1.7     ! wiz      7585:                 default if <code class=
        !          7586:                 "varname">PKG_DEVELOPER</code> is set in
        !          7587:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    7588:               </dd>
                   7589: 
                   7590:               <dt><span class="term">print-PLIST</span></dt>
                   7591: 
                   7592:               <dd>
                   7593:                 <p>After a &#8220;<span class="quote">make
                   7594:                 install</span>&#8221; from a new or upgraded pkg,
                   7595:                 this prints out an attempt to generate a new
1.7     ! wiz      7596:                 <code class="filename">PLIST</code> from a
        !          7597:                 <span><strong class="command">find -newer
        !          7598:                 work/.extract_done</strong></span>. An attempt is
        !          7599:                 made to care for shared libs etc., but it is
1.1       grant    7600:                 <span class="emphasis"><em>strongly</em></span>
                   7601:                 recommended to review the result before putting it
1.7     ! wiz      7602:                 into <code class="filename">PLIST</code>. On
        !          7603:                 upgrades, it's useful to diff the output of this
        !          7604:                 command against an already existing <code class=
        !          7605:                 "filename">PLIST</code> file.</p>
1.1       grant    7606: 
                   7607:                 <p>If the package installs files via tar(1) or
                   7608:                 other methods that don't update file access times,
                   7609:                 be sure to add these files manually to your
1.7     ! wiz      7610:                 <code class="filename">PLIST</code>, as the
1.1       grant    7611:                 &#8220;<span class="quote">find
                   7612:                 -newer</span>&#8221; command used by this target
                   7613:                 won't catch them!</p>
                   7614: 
                   7615:                 <p>See <a href="#print-PLIST" title=
                   7616:                 "8.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;8.3,
1.7     ! wiz      7617:                 &#8220;Tweaking output of <span><strong class=
        !          7618:                 "command">make
        !          7619:                 print-PLIST</strong></span>&#8221;</a> for more
        !          7620:                 information on this target.</p>
1.1       grant    7621:               </dd>
                   7622: 
                   7623:               <dt><span class="term">bulk-package</span></dt>
                   7624: 
                   7625:               <dd>
                   7626:                 <p>Used to do bulk builds. If an appropriate binary
                   7627:                 package already exists, no action is taken. If not,
                   7628:                 this target will compile, install and package it
1.7     ! wiz      7629:                 (and it's depends, if <code class=
        !          7630:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    7631:                 <a href="#binary.configuration" title=
                   7632:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   7633:                 &#8220;Configuration&#8221;</a>. After creating the
                   7634:                 binary package, the sources, the just-installed
                   7635:                 package and it's required packages are removed,
                   7636:                 preserving free disk space.</p>
                   7637: 
                   7638:                 <p><span class="emphasis"><em>Beware that this
                   7639:                 target may deinstall all packages installed on a
                   7640:                 system!</em></span></p>
                   7641:               </dd>
                   7642: 
                   7643:               <dt><span class="term">bulk-install</span></dt>
                   7644: 
                   7645:               <dd>
                   7646:                 <p>Used during bulk-installs to install required
                   7647:                 packages. If an upto-date binary package is
                   7648:                 available, it will be installed via <a href=
                   7649:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7650:                 <span class="citerefentry"><span class=
                   7651:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.7     ! wiz      7652:                 not, <span><strong class="command">make
        !          7653:                 bulk-package</strong></span> will be executed, but
        !          7654:                 the installed binary not be removed.</p>
1.1       grant    7655: 
                   7656:                 <p>A binary package is considered
                   7657:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   7658:                 to be installed via <a href=
                   7659:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7660:                 <span class="citerefentry"><span class=
                   7661:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   7662:                 if:</p>
                   7663: 
                   7664:                 <div class="itemizedlist">
                   7665:                   <ul type="disc">
                   7666:                     <li>
1.7     ! wiz      7667:                       <p>None of the package's files (<code class=
        !          7668:                       "filename">Makefile</code>, ...) were
        !          7669:                       modified since it was built.</p>
1.1       grant    7670:                     </li>
                   7671: 
                   7672:                     <li>
                   7673:                       <p>None of the package's required (binary)
                   7674:                       packages were modified since it was
                   7675:                       built.</p>
                   7676:                     </li>
                   7677:                   </ul>
                   7678:                 </div>
                   7679: 
                   7680:                 <p><span class="emphasis"><em>Beware that this
                   7681:                 target may deinstall all packages installed on a
                   7682:                 system!</em></span></p>
                   7683:               </dd>
                   7684:             </dl>
                   7685:           </div>
                   7686:         </div>
                   7687:       </div>
                   7688: 
                   7689:       <div class="chapter" lang="en" xml:lang="en">
                   7690:         <div class="titlepage">
                   7691:           <div>
                   7692:             <div>
                   7693:               <h2 class="title"><a name="fixes" id=
                   7694:               "fixes"></a>Chapter&nbsp;12.&nbsp;Notes on fixes for
                   7695:               packages</h2>
                   7696:             </div>
                   7697:           </div>
                   7698:         </div>
                   7699: 
                   7700:         <div class="toc">
                   7701:           <p><b>Table of Contents</b></p>
                   7702: 
                   7703:           <dl>
1.7     ! wiz      7704:             <dt><span class="sect1"><a href="#id2590531">12.1.
1.1       grant    7705:             General operation</a></span></dt>
                   7706: 
                   7707:             <dd>
                   7708:               <dl>
                   7709:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7710:                 "#id2590534">12.1.1. How to pull in variables from
1.1       grant    7711:                 /etc/mk.conf</a></span></dt>
                   7712: 
                   7713:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7714:                 "#id2590685">12.1.2. Restricted
1.1       grant    7715:                 packages</a></span></dt>
                   7716: 
                   7717:                 <dt><span class="sect2"><a href=
                   7718:                 "#dependencies">12.1.3. Handling
                   7719:                 dependencies</a></span></dt>
                   7720: 
                   7721:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7722:                 "#id2591201">12.1.4. Handling conflicts with other
1.1       grant    7723:                 packages</a></span></dt>
                   7724: 
                   7725:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7726:                 "#id2591251">12.1.5. Packages that cannot or should
1.1       grant    7727:                 not be built</a></span></dt>
                   7728: 
                   7729:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7730:                 "#id2591413">12.1.6. Packages which should not be
1.1       grant    7731:                 deleted, once installed</a></span></dt>
                   7732: 
                   7733:                 <dt><span class="sect2"><a href=
                   7734:                 "#security-handling">12.1.7. Handling packages with
                   7735:                 security problems</a></span></dt>
                   7736: 
                   7737:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7738:                 "#id2591505">12.1.8. How to handle compiler
1.1       grant    7739:                 bugs</a></span></dt>
                   7740: 
                   7741:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7742:                 "#id2591527">12.1.9. How to handle incrementing
1.1       grant    7743:                 versions when fixing an existing
                   7744:                 package</a></span></dt>
                   7745: 
                   7746:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7747:                 "#id2591644">12.1.10. Portability of
1.1       grant    7748:                 packages</a></span></dt>
                   7749:               </dl>
                   7750:             </dd>
                   7751: 
1.7     ! wiz      7752:             <dt><span class="sect1"><a href="#id2591669">12.2.
1.1       grant    7753:             Possible downloading issues</a></span></dt>
                   7754: 
                   7755:             <dd>
                   7756:               <dl>
                   7757:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7758:                 "#id2591672">12.2.1. Packages whose distfiles
1.1       grant    7759:                 aren't available for plain
                   7760:                 downloading</a></span></dt>
                   7761: 
                   7762:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7763:                 "#id2591735">12.2.2. How to handle modified
1.1       grant    7764:                 distfiles with the 'old' name</a></span></dt>
                   7765:               </dl>
                   7766:             </dd>
                   7767: 
1.7     ! wiz      7768:             <dt><span class="sect1"><a href="#id2591747">12.3.
1.1       grant    7769:             Configuration gotchas</a></span></dt>
                   7770: 
                   7771:             <dd>
                   7772:               <dl>
                   7773:                 <dt><span class="sect2"><a href=
                   7774:                 "#fixes.libtool">12.3.1. Shared libraries -
                   7775:                 libtool</a></span></dt>
                   7776: 
                   7777:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7778:                 "#id2592086">12.3.2. Using libtool on GNU packages
1.1       grant    7779:                 that already support libtool</a></span></dt>
                   7780: 
                   7781:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7782:                 "#id2592238">12.3.3. GNU
1.1       grant    7783:                 Autoconf/Automake</a></span></dt>
                   7784:               </dl>
                   7785:             </dd>
                   7786: 
1.7     ! wiz      7787:             <dt><span class="sect1"><a href="#id2592283">12.4.
1.1       grant    7788:             Building considerations</a></span></dt>
                   7789: 
                   7790:             <dd>
                   7791:               <dl>
                   7792:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7793:                 "#id2592286">12.4.1. CPP defines</a></span></dt>
1.1       grant    7794:               </dl>
                   7795:             </dd>
                   7796: 
1.7     ! wiz      7797:             <dt><span class="sect1"><a href="#id2592316">12.5.
1.1       grant    7798:             Package specific actions</a></span></dt>
                   7799: 
                   7800:             <dd>
                   7801:               <dl>
                   7802:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7803:                 "#id2592320">12.5.1. Package configuration
1.1       grant    7804:                 files</a></span></dt>
                   7805: 
                   7806:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7807:                 "#id2592490">12.5.2. User
1.2       hubertf  7808:                 interaction</a></span></dt>
1.1       grant    7809: 
                   7810:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7811:                 "#id2592535">12.5.3. Handling
1.1       grant    7812:                 licenses</a></span></dt>
                   7813: 
                   7814:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7815:                 "#id2592686">12.5.4. Creating an account from a
1.1       grant    7816:                 package</a></span></dt>
                   7817: 
                   7818:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7819:                 "#id2592748">12.5.5. Installing score
1.1       grant    7820:                 files</a></span></dt>
                   7821: 
                   7822:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7823:                 "#id2592929">12.5.6. Packages providing login
1.1       grant    7824:                 shells</a></span></dt>
                   7825: 
                   7826:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7827:                 "#id2593054">12.5.7. Packages containing perl
1.1       grant    7828:                 scripts</a></span></dt>
                   7829: 
                   7830:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7831:                 "#id2593073">12.5.8. Packages with hardcoded paths
1.1       grant    7832:                 to other interpreters</a></span></dt>
                   7833: 
                   7834:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7835:                 "#id2593094">12.5.9. Packages installing perl
1.1       grant    7836:                 modules</a></span></dt>
                   7837: 
                   7838:                 <dt><span class="sect2"><a href=
                   7839:                 "#faq.info-files">12.5.10. Packages installing info
                   7840:                 files</a></span></dt>
                   7841: 
                   7842:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7843:                 "#id2593450">12.5.11. Packages installing GConf2
1.1       grant    7844:                 data files</a></span></dt>
                   7845: 
                   7846:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7847:                 "#id2593550">12.5.12. Packages installing
1.1       grant    7848:                 scrollkeeper data files</a></span></dt>
                   7849: 
                   7850:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7851:                 "#id2593602">12.5.13. Packages installing X11
1.1       grant    7852:                 fonts</a></span></dt>
                   7853: 
                   7854:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7855:                 "#id2593649">12.5.14. Packages installing GTK2
1.1       grant    7856:                 modules</a></span></dt>
                   7857: 
                   7858:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7859:                 "#id2593718">12.5.15. Packages installing SGML or
1.1       grant    7860:                 XML data</a></span></dt>
                   7861: 
                   7862:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7863:                 "#id2593770">12.5.16. Packages installing
1.1       grant    7864:                 extensions to the MIME database</a></span></dt>
                   7865: 
                   7866:                 <dt><span class="sect2"><a href=
1.7     ! wiz      7867:                 "#id2593841">12.5.17. Packages using
1.1       grant    7868:                 intltool</a></span></dt>
                   7869:               </dl>
                   7870:             </dd>
                   7871: 
1.7     ! wiz      7872:             <dt><span class="sect1"><a href="#id2593854">12.6.
1.1       grant    7873:             Feedback to the author</a></span></dt>
                   7874:           </dl>
                   7875:         </div>
                   7876: 
                   7877:         <div class="sect1" lang="en" xml:lang="en">
                   7878:           <div class="titlepage">
                   7879:             <div>
                   7880:               <div>
                   7881:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      7882:                 "id2590531" id="id2590531"></a>12.1.&nbsp;General
1.1       grant    7883:                 operation</h2>
                   7884:               </div>
                   7885:             </div>
                   7886:           </div>
                   7887: 
                   7888:           <div class="sect2" lang="en" xml:lang="en">
                   7889:             <div class="titlepage">
                   7890:               <div>
                   7891:                 <div>
1.7     ! wiz      7892:                   <h3 class="title"><a name="id2590534" id=
        !          7893:                   "id2590534"></a>12.1.1.&nbsp;How to pull in
1.1       grant    7894:                   variables from /etc/mk.conf</h3>
                   7895:                 </div>
                   7896:               </div>
                   7897:             </div>
                   7898: 
                   7899:             <p>The problem with package-defined variables that can
1.7     ! wiz      7900:             be overridden via <code class="varname">MAKECONF</code>
        !          7901:             or <code class="filename">/etc/mk.conf</code> is that
        !          7902:             <a href=
1.1       grant    7903:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7904:             <span class="citerefentry"><span class=
                   7905:             "refentrytitle">make</span>(1)</span></a> expands a
                   7906:             variable as it is used, but evaluates preprocessor like
                   7907:             statements (.if, .ifdef and .ifndef) as they are read.
1.7     ! wiz      7908:             So, to use any variable (which may be set in
        !          7909:             <code class="filename">/etc/mk.conf</code>) in one of
        !          7910:             the .if* statements, the file <code class=
        !          7911:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    7912:             that .if* statement.</p>
                   7913: 
                   7914:             <p>Rather than have a number of ad-hoc ways of
1.7     ! wiz      7915:             including <code class="filename">/etc/mk.conf</code>,
        !          7916:             should it exist, or <code class=
        !          7917:             "varname">MAKECONF</code>, should it exist, include the
        !          7918:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
        !          7919:             file in the package Makefile before any
        !          7920:             preprocessor-like .if, .ifdef, or .ifndef
        !          7921:             statements:</p>
1.1       grant    7922:             <pre class="programlisting">
                   7923: .include "../../mk/bsd.prefs.mk"
                   7924:     
                   7925:     .if defined(USE_MENUS)
                   7926:       ...
                   7927:     .endif
                   7928: </pre>
                   7929: 
1.7     ! wiz      7930:             <p>If you wish to set the <code class=
        !          7931:             "varname">CFLAGS</code> variable in <code class=
        !          7932:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    7933:             use:</p>
                   7934:             <pre class="programlisting">
                   7935: CFLAGS+=  -your -flags
                   7936: </pre>
                   7937: 
1.7     ! wiz      7938:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
        !          7939:             without the &#8220;<span class="quote">+</span>&#8221;)
        !          7940:             may lead to problems with packages that need to add
        !          7941:             their own flags. Also, you may want to take a look at
        !          7942:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    7943:             href=
                   7944:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.7     ! wiz      7945:             class="pkgname">devel/cpuflags</a> package if you're
        !          7946:             interested in optimization for the current CPU.</p>
1.1       grant    7947:           </div>
                   7948: 
                   7949:           <div class="sect2" lang="en" xml:lang="en">
                   7950:             <div class="titlepage">
                   7951:               <div>
                   7952:                 <div>
1.7     ! wiz      7953:                   <h3 class="title"><a name="id2590685" id=
        !          7954:                   "id2590685"></a>12.1.2.&nbsp;Restricted
1.1       grant    7955:                   packages</h3>
                   7956:                 </div>
                   7957:               </div>
                   7958:             </div>
                   7959: 
                   7960:             <p>Some licenses restrict how software may be
                   7961:             re-distributed. In order to satisfy these restrictions,
                   7962:             the package system defines five make variables that can
                   7963:             be set to note these restrictions:</p>
                   7964: 
                   7965:             <div class="itemizedlist">
                   7966:               <ul type="disc">
                   7967:                 <li>
1.7     ! wiz      7968:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    7969: 
                   7970:                   <p>This variable should be set whenever a
                   7971:                   restriction exists (regardless of its kind). Set
                   7972:                   this variable to a string containing the reason
                   7973:                   for the restriction.</p>
                   7974:                 </li>
                   7975: 
                   7976:                 <li>
1.7     ! wiz      7977:                   <p><code class=
        !          7978:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    7979: 
                   7980:                   <p>Binaries may not be placed on CD-ROM. Set this
1.7     ! wiz      7981:                   variable to <code class=
        !          7982:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    7983:                   package may not be included on a CD-ROM.</p>
                   7984:                 </li>
                   7985: 
                   7986:                 <li>
1.7     ! wiz      7987:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    7988: 
                   7989:                   <p>Binaries may not be placed on an FTP server.
1.7     ! wiz      7990:                   Set this variable to <code class=
        !          7991:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    7992:                   package may not not be made available on the
                   7993:                   Internet.</p>
                   7994:                 </li>
                   7995: 
                   7996:                 <li>
1.7     ! wiz      7997:                   <p><code class=
        !          7998:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    7999: 
                   8000:                   <p>Distfiles may not be placed on CD-ROM. Set
1.7     ! wiz      8001:                   this variable to <code class=
        !          8002:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8003:                   of the source code or other distfile(s) is not
                   8004:                   allowed on CD-ROMs.</p>
                   8005:                 </li>
                   8006: 
                   8007:                 <li>
1.7     ! wiz      8008:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    8009: 
                   8010:                   <p>Distfiles may not be placed on FTP. Set this
1.7     ! wiz      8011:                   variable to <code class=
        !          8012:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8013:                   of the source code or other distfile(s) via the
                   8014:                   Internet is not allowed.</p>
                   8015:                 </li>
                   8016:               </ul>
                   8017:             </div>
                   8018: 
1.7     ! wiz      8019:             <p>Please note that the use of <code class=
        !          8020:             "varname">NO_PACKAGE</code>, <code class=
        !          8021:             "varname">IGNORE</code>, <code class=
        !          8022:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    8023:             variables to denote restrictions is deprecated, because
                   8024:             they unconditionally prevent users from generating
                   8025:             binary packages!</p>
                   8026:           </div>
                   8027: 
                   8028:           <div class="sect2" lang="en" xml:lang="en">
                   8029:             <div class="titlepage">
                   8030:               <div>
                   8031:                 <div>
                   8032:                   <h3 class="title"><a name="dependencies" id=
                   8033:                   "dependencies"></a>12.1.3.&nbsp;Handling
                   8034:                   dependencies</h3>
                   8035:                 </div>
                   8036:               </div>
                   8037:             </div>
                   8038: 
                   8039:             <p>Your package may depend on some other package being
                   8040:             present - and there are various ways of expressing this
1.7     ! wiz      8041:             dependency. pkgsrc supports the <code class=
        !          8042:             "varname">BUILD_DEPENDS</code> and <code class=
        !          8043:             "varname">DEPENDS</code> definitions, as well as
        !          8044:             dependencies via <code class=
        !          8045:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    8046:             way to handle dependencies, and which uses the
                   8047:             variables named above. See <a href="#buildlink" title=
                   8048:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8049:             <i>Buildlink methodology</i></a> for more
                   8050:             information.</p>
                   8051: 
                   8052:             <p>The basic difference between the two variables is as
1.7     ! wiz      8053:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    8054:             definition registers that pre-requisite in the binary
                   8055:             package so it will be pulled in when the binary package
1.7     ! wiz      8056:             is later installed, whilst the <code class=
        !          8057:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    8058:             marking a dependency that is only needed for building
                   8059:             the package.</p>
                   8060: 
                   8061:             <p>This means that if you only need a package present
                   8062:             whilst you are building, it should be noted as a
1.7     ! wiz      8063:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    8064: 
1.7     ! wiz      8065:             <p>The format for a <code class=
        !          8066:             "varname">BUILD_DEPENDS</code> and a <code class=
        !          8067:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    8068:             <pre class="programlisting">
                   8069: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   8070: </pre>
                   8071: 
                   8072:             <p>Please note that the &#8220;<span class=
                   8073:             "quote">pre-req-package-name</span>&#8221; may include
                   8074:             any of the wildcard version numbers recognised by
                   8075:             <a href=
                   8076:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   8077:             <span class="citerefentry"><span class=
                   8078:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   8079: 
                   8080:             <div class="orderedlist">
                   8081:               <ol type="1">
                   8082:                 <li>
                   8083:                   <p>If your package needs another package's
                   8084:                   binaries or libraries to build or run, and if
1.7     ! wiz      8085:                   that package has a <code class=
        !          8086:                   "filename">buildlink3.mk</code> file available,
        !          8087:                   use it:</p>
1.1       grant    8088:                   <pre class="programlisting">
                   8089:     .include "../../graphics/jpeg/buildlink3.mk"
                   8090:     
                   8091: </pre>
                   8092:                 </li>
                   8093: 
                   8094:                 <li>
                   8095:                   <p>If your package needs to use another package
1.7     ! wiz      8096:                   to build itself and there is no <code class=
        !          8097:                   "filename">buildlink3.mk</code> file available,
        !          8098:                   use the <code class=
        !          8099:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    8100:                   <pre class="programlisting">
                   8101: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   8102: </pre>
                   8103:                 </li>
                   8104: 
                   8105:                 <li>
                   8106:                   <p>If your package needs a library with which to
1.7     ! wiz      8107:                   link and again there is no <code class=
        !          8108:                   "filename">buildlink3.mk</code> file available,
        !          8109:                   this is specified using the <code class=
        !          8110:                   "varname">DEPENDS</code> definition. An example
        !          8111:                   of this is the <a xmlns=
1.1       grant    8112:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8113:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.7     ! wiz      8114:                   class="pkgname">print/lyx</a> package, which uses
        !          8115:                   the xpm library, version 3.4j to build:</p>
1.1       grant    8116:                   <pre class="programlisting">
                   8117: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   8118: </pre>
                   8119: 
                   8120:                   <p>You can also use wildcards in package
                   8121:                   dependences:</p>
                   8122:                   <pre class="programlisting">
                   8123: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   8124: </pre>
                   8125: 
                   8126:                   <p>Note that such wildcard dependencies are
                   8127:                   retained when creating binary packages. The
                   8128:                   dependency is checked when installing the binary
                   8129:                   package and any package which matches the pattern
                   8130:                   will be used. Wildcard dependencies should be
                   8131:                   used with care.</p>
                   8132: 
                   8133:                   <p>The &#8220;<span class=
                   8134:                   "quote">-[0-9]*</span>&#8221; should be used
                   8135:                   instead of &#8220;<span class=
                   8136:                   "quote">-*</span>&#8221; to avoid potentially
                   8137:                   ambiguous matches such as &#8220;<span class=
                   8138:                   "quote">tk-postgresql</span>&#8221; matching a
                   8139:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.7     ! wiz      8140:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    8141: 
                   8142:                   <p>Wildcards can also be used to specify that a
                   8143:                   package will only build against a certain minimum
                   8144:                   version of a pre-requisite:</p>
                   8145:                   <pre class="programlisting">
                   8146: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   8147: </pre>
                   8148: 
                   8149:                   <p>This means that the package will build against
                   8150:                   version 3.5.4 of the tiff library or newer. Such
                   8151:                   a dependency may be warranted if, for example,
                   8152:                   the API of the library has changed with version
                   8153:                   3.5.4 and a package would not compile against an
                   8154:                   earlier version of tiff.</p>
                   8155: 
                   8156:                   <p>Please note that such dependencies should only
                   8157:                   be updated if a package requires a newer
                   8158:                   pre-requisite, but not to denote recommendations
                   8159:                   such as security updates or ABI changes that do
                   8160:                   not prevent a package from building correctly.
                   8161:                   Such recommendations can be expressed using
1.7     ! wiz      8162:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    8163:                   <pre class="programlisting">
                   8164: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   8165: </pre>
                   8166: 
1.7     ! wiz      8167:                   <p>In addition to the above <code class=
        !          8168:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    8169:                   while a package will build against
                   8170:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.7     ! wiz      8171:                   recommended. <code class=
        !          8172:                   "varname">RECOMMENDED</code> entries will be
        !          8173:                   turned into dependencies unless explicitly
        !          8174:                   ignored (in which case a warning will be
        !          8175:                   printed). Packages that are built with
1.1       grant    8176:                   recommendations ignored may not be uploaded to
                   8177:                   ftp.NetBSD.org by developers and should not be
                   8178:                   used across different systems that may have
                   8179:                   different versions of binary packages
                   8180:                   installed.</p>
                   8181: 
                   8182:                   <p>For security fixes, please update the package
                   8183:                   vulnerabilities file as well as setting
1.7     ! wiz      8184:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    8185:                   <a href="#security-handling" title=
                   8186:                   "12.1.7.&nbsp;Handling packages with security problems">
                   8187:                   Section 12.1.7, &#8220;Handling packages with
                   8188:                   security problems&#8221;</a> for more
                   8189:                   information.</p>
                   8190:                 </li>
                   8191: 
                   8192:                 <li>
                   8193:                   <p>If your package needs some executable to be
                   8194:                   able to run correctly and if there's agail no
1.7     ! wiz      8195:                   <code class="filename">buildlink3.mk</code> file,
        !          8196:                   this is specified using the <code class=
        !          8197:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    8198:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8199:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.7     ! wiz      8200:                   class="pkgname">print/lyx</a> package needs to be
        !          8201:                   able to execute the latex binary from the teTeX
        !          8202:                   package when it runs, and that is specified:</p>
1.1       grant    8203:                   <pre class="programlisting">
                   8204: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   8205: </pre>
                   8206: 
                   8207:                   <p>The comment about wildcard dependencies from
                   8208:                   previous paragraph applies here, too.</p>
                   8209:                 </li>
                   8210:               </ol>
                   8211:             </div>
                   8212: 
                   8213:             <p>If your package needs files from another package to
                   8214:             build, see the first part of the &#8220;<span class=
                   8215:             "quote">do-configure</span>&#8221; target <a xmlns=
                   8216:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8217:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.7     ! wiz      8218:             class="pkgname">print/ghostscript5</a> package (it
        !          8219:             relies on the jpeg sources being present in source form
        !          8220:             during the build):</p>
1.1       grant    8221:             <pre class="programlisting">
                   8222: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   8223:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   8224:     fi
                   8225: </pre>
                   8226: 
                   8227:             <p>If you build any other packages that way, please
                   8228:             make sure the working files are deleted too when this
                   8229:             package's working files are cleaned up. The easiest way
                   8230:             to do so is by adding a pre-clean target:</p>
                   8231:             <pre class="programlisting">
                   8232: pre-clean:
                   8233:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   8234: </pre>
                   8235: 
1.7     ! wiz      8236:             <p>Please also note the <code class=
        !          8237:             "varname">BUILD_USES_MSGFMT</code> and <code class=
        !          8238:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
        !          8239:             which are provided as convenience definitions. The
        !          8240:             former works out whether msgfmt(1) is part of the base
        !          8241:             system, and, if it isn't, installs the <a xmlns=
1.1       grant    8242:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8243:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.7     ! wiz      8244:             class="pkgname">devel/gettext</a> package. The latter
        !          8245:             adds a build dependency on either an installed version
        !          8246:             of an older gettext package, or if it isn't, installs
        !          8247:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          8248:             href=
        !          8249:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
        !          8250:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    8251:           </div>
                   8252: 
                   8253:           <div class="sect2" lang="en" xml:lang="en">
                   8254:             <div class="titlepage">
                   8255:               <div>
                   8256:                 <div>
1.7     ! wiz      8257:                   <h3 class="title"><a name="id2591201" id=
        !          8258:                   "id2591201"></a>12.1.4.&nbsp;Handling conflicts
1.1       grant    8259:                   with other packages</h3>
                   8260:                 </div>
                   8261:               </div>
                   8262:             </div>
                   8263: 
                   8264:             <p>Your package may conflict with other packages a user
                   8265:             might already have installed on his system, e.g. if
                   8266:             your package installs the same set of files like
                   8267:             another package in our pkgsrc tree.</p>
                   8268: 
1.7     ! wiz      8269:             <p>In this case you can set <code class=
        !          8270:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    8271:             packages (including version string) your package
                   8272:             conflicts with.</p>
                   8273: 
                   8274:             <p>For example <a xmlns=
                   8275:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8276:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.7     ! wiz      8277:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
        !          8278:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8279:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
        !          8280:             class="pkgname">x11/Xaw-Xpm</a> install provide the
        !          8281:             same shared library, thus you set in <code class=
        !          8282:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    8283:             <pre class="programlisting">
                   8284: CONFLICTS=      Xaw-Xpm-[0-9]*
                   8285: </pre>
                   8286: 
1.7     ! wiz      8287:             <p>and in <code class=
        !          8288:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    8289:             <pre class="programlisting">
                   8290: CONFLICTS=      Xaw3d-[0-9]*
                   8291: </pre>
                   8292: 
                   8293:             <p>Packages will automatically conflict with other
                   8294:             packages with the name prefix and a different version
                   8295:             string. &#8220;<span class=
                   8296:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   8297:             conflict with the older version &#8220;<span class=
                   8298:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   8299:           </div>
                   8300: 
                   8301:           <div class="sect2" lang="en" xml:lang="en">
                   8302:             <div class="titlepage">
                   8303:               <div>
                   8304:                 <div>
1.7     ! wiz      8305:                   <h3 class="title"><a name="id2591251" id=
        !          8306:                   "id2591251"></a>12.1.5.&nbsp;Packages that cannot
1.1       grant    8307:                   or should not be built</h3>
                   8308:                 </div>
                   8309:               </div>
                   8310:             </div>
                   8311: 
                   8312:             <p>There are several reasons why a package might be
                   8313:             instructed to not build under certain circumstances. If
                   8314:             the package builds and runs on most platforms, the
1.7     ! wiz      8315:             exceptions should be noted with <code class=
        !          8316:             "varname">NOT_FOR_PLATFORM</code>. If the package
        !          8317:             builds and runs on a small handful of platforms, set
        !          8318:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
        !          8319:             If the package should be skipped (for example, because
        !          8320:             it provides functionality already provided by the
        !          8321:             system), set <code class=
        !          8322:             "varname">PKG_SKIP_REASON</code> to a descriptive
        !          8323:             message. If the package should fail because some
        !          8324:             preconditions are not met, set <code class=
        !          8325:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    8326:             message.</p>
                   8327: 
1.7     ! wiz      8328:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    8329:             because it didn't provide enough information to
                   8330:             determine whether the build should fail.</p>
                   8331:           </div>
                   8332: 
                   8333:           <div class="sect2" lang="en" xml:lang="en">
                   8334:             <div class="titlepage">
                   8335:               <div>
                   8336:                 <div>
1.7     ! wiz      8337:                   <h3 class="title"><a name="id2591413" id=
        !          8338:                   "id2591413"></a>12.1.6.&nbsp;Packages which
1.1       grant    8339:                   should not be deleted, once installed</h3>
                   8340:                 </div>
                   8341:               </div>
                   8342:             </div>
                   8343: 
                   8344:             <p>To ensure that a package may not be deleted, once it
1.7     ! wiz      8345:             has been installed, the <code class=
        !          8346:             "varname">PKG_PRESERVE</code> definition should be set
        !          8347:             in the package Makefile. This will be carried into any
1.1       grant    8348:             binary package that is made from this pkgsrc entry. A
                   8349:             &#8220;<span class="quote">preserved</span>&#8221;
                   8350:             package will not be deleted using <a href=
                   8351:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8352:             <span class="citerefentry"><span class=
                   8353:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   8354:             the &#8220;<span class="quote">-f</span>&#8221; option
                   8355:             is used.</p>
                   8356:           </div>
                   8357: 
                   8358:           <div class="sect2" lang="en" xml:lang="en">
                   8359:             <div class="titlepage">
                   8360:               <div>
                   8361:                 <div>
                   8362:                   <h3 class="title"><a name="security-handling" id=
                   8363:                   "security-handling"></a>12.1.7.&nbsp;Handling
                   8364:                   packages with security problems</h3>
                   8365:                 </div>
                   8366:               </div>
                   8367:             </div>
                   8368: 
                   8369:             <p>When a vulnerability is found, this should be noted
1.7     ! wiz      8370:             in <code class=
        !          8371:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    8372:             and after the commit of that file, it should be copied
1.7     ! wiz      8373:             to both <code class=
        !          8374:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
        !          8375:             and <code class=
        !          8376:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
        !          8377:             on ftp.NetBSD.org using <code class=
        !          8378:             "filename">localsrc/security/advisories/Makefile</code>.
        !          8379:             In addition, if a <code class=
        !          8380:             "filename">buildlink3.mk</code> file exists for an
        !          8381:             affected package, bumping <code class=
        !          8382:             "varname">PKGREVISION</code> and creating a
        !          8383:             corresponding <code class=
        !          8384:             "varname">BUILDLINK_RECOMMENDED.<em class=
        !          8385:             "replaceable"><code>pkg</code></em></code> entry should
        !          8386:             be considered. See <a href="#buildlink" title=
1.1       grant    8387:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8388:             <i>Buildlink methodology</i></a> for more information
1.7     ! wiz      8389:             about writing <code class=
        !          8390:             "filename">buildlink3.mk</code> files and <code class=
        !          8391:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    8392: 
                   8393:             <p>Also, if the fix should be applied to the stable
                   8394:             pkgsrc branch, be sure to submit a pullup request!</p>
                   8395:           </div>
                   8396: 
                   8397:           <div class="sect2" lang="en" xml:lang="en">
                   8398:             <div class="titlepage">
                   8399:               <div>
                   8400:                 <div>
1.7     ! wiz      8401:                   <h3 class="title"><a name="id2591505" id=
        !          8402:                   "id2591505"></a>12.1.8.&nbsp;How to handle
1.1       grant    8403:                   compiler bugs</h3>
                   8404:                 </div>
                   8405:               </div>
                   8406:             </div>
                   8407: 
                   8408:             <p>Some source files trigger bugs in the compiler,
                   8409:             based on combinations of compiler version and
                   8410:             architecture and almost always relation to optimisation
                   8411:             being enabled. Common symptoms are gcc internal errors
                   8412:             or never finishing compiling a file.</p>
                   8413: 
                   8414:             <p>Typically a workaround involves testing the
1.7     ! wiz      8415:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    8416:             version, disabling optimisation for that
1.7     ! wiz      8417:             file/<code class="varname">MACHINE_ARCH</code>/compiler
        !          8418:             combination, and documenting it in <code class=
        !          8419:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    8420:             number of examples!</p>
                   8421:           </div>
                   8422: 
                   8423:           <div class="sect2" lang="en" xml:lang="en">
                   8424:             <div class="titlepage">
                   8425:               <div>
                   8426:                 <div>
1.7     ! wiz      8427:                   <h3 class="title"><a name="id2591527" id=
        !          8428:                   "id2591527"></a>12.1.9.&nbsp;How to handle
1.1       grant    8429:                   incrementing versions when fixing an existing
                   8430:                   package</h3>
                   8431:                 </div>
                   8432:               </div>
                   8433:             </div>
                   8434: 
                   8435:             <p>When making fixes to an existing package it can be
1.7     ! wiz      8436:             useful to change the version number in <code class=
        !          8437:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    8438:             future versions by the original author, a
                   8439:             &#8220;<span class="quote">nb1</span>&#8221;,
                   8440:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   8441:             suffix can be used on package versions by setting
1.7     ! wiz      8442:             <code class="varname">PKGREVISION=1</code> (2, ...).
        !          8443:             The &#8220;<span class="quote">nb</span>&#8221; is
        !          8444:             treated like a &#8220;<span class=
        !          8445:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    8446:             <pre class="programlisting">
                   8447:   DISTNAME= foo-17.42
                   8448:     PKGREVISION=  9
                   8449: </pre>
                   8450: 
1.7     ! wiz      8451:             <p>will result in a <code class=
        !          8452:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    8453:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   8454: 
                   8455:             <p>When a new release of the package is released, the
1.7     ! wiz      8456:             <code class="varname">PKGREVISION</code> should be
        !          8457:             removed. e.g. on a new minor release of the above
        !          8458:             package, things should be like:</p>
1.1       grant    8459:             <pre class="programlisting">
                   8460: DISTNAME=   foo-17.43
                   8461: </pre>
                   8462:           </div>
                   8463: 
                   8464:           <div class="sect2" lang="en" xml:lang="en">
                   8465:             <div class="titlepage">
                   8466:               <div>
                   8467:                 <div>
1.7     ! wiz      8468:                   <h3 class="title"><a name="id2591644" id=
        !          8469:                   "id2591644"></a>12.1.10.&nbsp;Portability of
1.1       grant    8470:                   packages</h3>
                   8471:                 </div>
                   8472:               </div>
                   8473:             </div>
                   8474: 
                   8475:             <p>One appealing feature of pkgsrc is that it runs on
                   8476:             many different platforms. As a result, it is important
                   8477:             to ensure, where possible, that packages in pkgsrc are
                   8478:             portable. There are some particular details you should
                   8479:             pay attention to while working on pkgsrc.</p>
                   8480: 
                   8481:             <div class="sect3" lang="en" xml:lang="en">
                   8482:               <div class="titlepage">
                   8483:                 <div>
                   8484:                   <div>
1.7     ! wiz      8485:                     <h4 class="title"><a name="id2591650" id=
        !          8486:                     "id2591650"></a>12.1.10.1.&nbsp;${INSTALL},
1.1       grant    8487:                     ${INSTALL_DATA_DIR}, ...</h4>
                   8488:                   </div>
                   8489:                 </div>
                   8490:               </div>
                   8491: 
1.7     ! wiz      8492:               <p>The BSD-compatible <span><strong class=
        !          8493:               "command">install</strong></span> supplied with some
1.1       grant    8494:               operating systems will not perform more than one
                   8495:               operation at a time. As such, you should call
                   8496:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   8497:               etc. like this:</p>
                   8498:               <pre class="programlisting">
                   8499: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   8500: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   8501: </pre>
                   8502:             </div>
                   8503:           </div>
                   8504:         </div>
                   8505: 
                   8506:         <div class="sect1" lang="en" xml:lang="en">
                   8507:           <div class="titlepage">
                   8508:             <div>
                   8509:               <div>
                   8510:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      8511:                 "id2591669" id="id2591669"></a>12.2.&nbsp;Possible
1.1       grant    8512:                 downloading issues</h2>
                   8513:               </div>
                   8514:             </div>
                   8515:           </div>
                   8516: 
                   8517:           <div class="sect2" lang="en" xml:lang="en">
                   8518:             <div class="titlepage">
                   8519:               <div>
                   8520:                 <div>
1.7     ! wiz      8521:                   <h3 class="title"><a name="id2591672" id=
        !          8522:                   "id2591672"></a>12.2.1.&nbsp;Packages whose
1.1       grant    8523:                   distfiles aren't available for plain
                   8524:                   downloading</h3>
                   8525:                 </div>
                   8526:               </div>
                   8527:             </div>
                   8528: 
                   8529:             <p>If you need to download from a dynamic URL you can
1.7     ! wiz      8530:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
        !          8531:             and a <span><strong class="command">make
        !          8532:             fetch</strong></span> will call <code class=
        !          8533:             "filename">files/getsite.sh</code> with the name of
        !          8534:             each file to download as an argument, expecting it to
        !          8535:             output the URL of the directory from which to download
        !          8536:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          8537:             href=
1.1       grant    8538:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.7     ! wiz      8539:             class="pkgname">graphics/ns-cult3d</a> is an example of
        !          8540:             this usage.</p>
1.1       grant    8541: 
                   8542:             <p>If the download can't be automated, because the user
                   8543:             must submit personal information to apply for a
                   8544:             password, or must pay for the source, or whatever, you
1.7     ! wiz      8545:             can set <code class="varname">_FETCH_MESSAGE</code> to
        !          8546:             a macro which displays a message explaining the
        !          8547:             situation. <code class="varname">_FETCH_MESSAGE</code>
        !          8548:             must be executable shell commands, not just a message.
        !          8549:             (Generally, it executes <code class=
        !          8550:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    8551:             following packages use this: <a xmlns=
                   8552:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8553:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.7     ! wiz      8554:             class="pkgname">audio/realplayer</a>, <a xmlns=
        !          8555:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8556:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
        !          8557:             class="pkgname">cad/simian</a>, <a xmlns=
        !          8558:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8559:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
        !          8560:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
        !          8561:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8562:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
        !          8563:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
        !          8564:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8565:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
        !          8566:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
        !          8567:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8568:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
        !          8569:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
        !          8570:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8571:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
        !          8572:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
        !          8573:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8574:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
        !          8575:             class="pkgname">www/openacs</a>. Try to be consistent
        !          8576:             with them.</p>
1.1       grant    8577:           </div>
                   8578: 
                   8579:           <div class="sect2" lang="en" xml:lang="en">
                   8580:             <div class="titlepage">
                   8581:               <div>
                   8582:                 <div>
1.7     ! wiz      8583:                   <h3 class="title"><a name="id2591735" id=
        !          8584:                   "id2591735"></a>12.2.2.&nbsp;How to handle
1.1       grant    8585:                   modified distfiles with the 'old' name</h3>
                   8586:                 </div>
                   8587:               </div>
                   8588:             </div>
                   8589: 
                   8590:             <p>Sometimes authors of a software package make some
                   8591:             modifications after the software was released, and they
                   8592:             put up a new distfile without changing the package's
                   8593:             version number. If a package is already in pkgsrc at
                   8594:             that time, the md5 checksum will no longer match. The
                   8595:             correct way to work around this is to update the
                   8596:             package's md5 checksum to match the package on the
                   8597:             master site (beware, any mirrors may not be up to date
                   8598:             yet!), and to remove the old distfile from
1.7     ! wiz      8599:             ftp.NetBSD.org's <code class=
        !          8600:             "filename">/pub/NetBSD/packages/distfiles</code>
1.1       grant    8601:             directory. Furthermore, a mail to the package's author
                   8602:             seems appropriate making sure the distfile was really
                   8603:             updated on purpose, and that no trojan horse or so
                   8604:             crept in.</p>
                   8605:           </div>
                   8606:         </div>
                   8607: 
                   8608:         <div class="sect1" lang="en" xml:lang="en">
                   8609:           <div class="titlepage">
                   8610:             <div>
                   8611:               <div>
                   8612:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      8613:                 "id2591747" id=
        !          8614:                 "id2591747"></a>12.3.&nbsp;Configuration
1.1       grant    8615:                 gotchas</h2>
                   8616:               </div>
                   8617:             </div>
                   8618:           </div>
                   8619: 
                   8620:           <div class="sect2" lang="en" xml:lang="en">
                   8621:             <div class="titlepage">
                   8622:               <div>
                   8623:                 <div>
                   8624:                   <h3 class="title"><a name="fixes.libtool" id=
                   8625:                   "fixes.libtool"></a>12.3.1.&nbsp;Shared libraries
                   8626:                   - libtool</h3>
                   8627:                 </div>
                   8628:               </div>
                   8629:             </div>
                   8630: 
                   8631:             <p>pkgsrc supports many different machines, with
                   8632:             different object formats like a.out and ELF, and
                   8633:             varying abilities to do shared library and dynamic
                   8634:             loading at all. To accompany this, varying commands and
                   8635:             options have to be passed to the compiler, linker, etc.
                   8636:             to get the Right Thing, which can be pretty annoying
                   8637:             especially if you don't have all the machines at your
                   8638:             hand to test things. The <a xmlns=
                   8639:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8640:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.7     ! wiz      8641:             class="pkgname">devel/libtool</a> pkg can help here, as
        !          8642:             it just &#8220;<span class="quote">knows</span>&#8221;
        !          8643:             how to build both static and dynamic libraries from a
        !          8644:             set of source files, thus being platform
        !          8645:             independent.</p>
1.1       grant    8646: 
                   8647:             <p>Here's how to use libtool in a pkg in seven simple
                   8648:             steps:</p>
                   8649: 
                   8650:             <div class="orderedlist">
                   8651:               <ol type="1">
                   8652:                 <li>
1.7     ! wiz      8653:                   <p>Add <code class=
        !          8654:                   "varname">USE_LIBTOOL=yes</code> to the package
        !          8655:                   Makefile.</p>
1.1       grant    8656:                 </li>
                   8657: 
                   8658:                 <li>
                   8659:                   <p>For library objects, use &#8220;<span class=
                   8660:                   "quote">${LIBTOOL} --mode=compile
                   8661:                   ${CC}</span>&#8221; in place of
                   8662:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   8663:                   You could even add it to the definition of
1.7     ! wiz      8664:                   <code class="varname">CC</code>, if only
        !          8665:                   libraries are being built in a given Makefile.
        !          8666:                   This one command will build both PIC and non-PIC
        !          8667:                   library objects, so you need not have separate
        !          8668:                   shared and non-shared library rules.</p>
1.1       grant    8669:                 </li>
                   8670: 
                   8671:                 <li>
                   8672:                   <p>For the linking of the library, remove any
                   8673:                   &#8220;<span class="quote">ar</span>&#8221;,
                   8674:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   8675:                   and &#8220;<span class="quote">ld
                   8676:                   -Bshareable</span>&#8221; commands, and instead
                   8677:                   use:</p>
                   8678:                   <pre class="programlisting">
                   8679: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   8680: </pre>
                   8681: 
                   8682:                   <p>Note that the library is changed to have a
1.7     ! wiz      8683:                   <code class="filename">.la</code> extension, and
        !          8684:                   the objects are changed to have a <code class=
        !          8685:                   "filename">.lo</code> extension. Change
        !          8686:                   <code class="varname">OBJS</code> as necessary.
        !          8687:                   This automatically creates all of the
        !          8688:                   <code class="filename">.a</code>, <code class=
        !          8689:                   "filename">.so.major.minor</code>, and ELF
        !          8690:                   symlinks (if necessary) in the build directory.
        !          8691:                   Be sure to include &#8220;<span class=
1.1       grant    8692:                   "quote">-version-info</span>&#8221;, especially
                   8693:                   when major and minor are zero, as libtool will
                   8694:                   otherwise strip off the shared library
                   8695:                   version.</p>
                   8696: 
                   8697:                   <p>From the libtool manual:</p>
                   8698:                   <pre class="programlisting">
                   8699:      So, libtool library versions are described by three integers:
                   8700: 
                   8701: CURRENT
                   8702:        The most recent interface number that this library implements.
                   8703: 
                   8704: REVISION
                   8705:        The implementation number of the CURRENT interface.
                   8706: 
                   8707: AGE
                   8708:        The difference between the newest and oldest interfaces that this
                   8709:        library implements.  In other words, the library implements all the
                   8710:        interface numbers in the range from number `CURRENT - AGE' to
                   8711:        `CURRENT'.
                   8712:        
                   8713:      If two libraries have identical CURRENT and AGE numbers, then the
                   8714: dynamic linker chooses the library with the greater REVISION number. 
                   8715: </pre>
                   8716: 
                   8717:                   <p>The &#8220;<span class=
                   8718:                   "quote">-release</span>&#8221; option will
                   8719:                   produce different results for a.out and ELF
                   8720:                   (excluding symlinks) in only one case. An ELF
                   8721:                   library of the form &#8220;<span class=
                   8722:                   "quote">libfoo-release.so.<span class=
                   8723:                   "emphasis"><em>x</em></span>.<span class=
                   8724:                   "emphasis"><em>y</em></span></span>&#8221; will
                   8725:                   have a symlink of &#8220;<span class=
                   8726:                   "quote">libfoo.so.<span class=
                   8727:                   "emphasis"><em>x</em></span>.<span class=
                   8728:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   8729:                   a.out platform. This is handled
                   8730:                   automatically.</p>
                   8731: 
                   8732:                   <p>The &#8220;<span class="quote">-rpath
                   8733:                   argument</span>&#8221; is the install directory
                   8734:                   of the library being built.</p>
                   8735: 
1.7     ! wiz      8736:                   <p>In the <code class="filename">PLIST</code>,
        !          8737:                   include all of the <code class=
        !          8738:                   "filename">.a</code>, <code class=
        !          8739:                   "filename">.la</code>, and <code class=
        !          8740:                   "filename">.so</code>, <code class=
        !          8741:                   "filename">.so.<em class=
        !          8742:                   "replaceable"><code>major</code></em></code> and
        !          8743:                   <code class="filename">.so.<em class=
        !          8744:                   "replaceable"><code>major</code></em>.<em class=
        !          8745:                   "replaceable"><code>minor</code></em></code>
        !          8746:                   files.</p>
1.1       grant    8747:                 </li>
                   8748: 
                   8749:                 <li>
1.7     ! wiz      8750:                   <p>When linking shared object (<code class=
        !          8751:                   "filename">.so</code>) files, i.e. files that are
1.1       grant    8752:                   loaded via dlopen(3), NOT shared libraries, use
                   8753:                   &#8220;<span class="quote">-module
                   8754:                   -avoid-version</span>&#8221; to prevent them
                   8755:                   getting version tacked on.</p>
                   8756: 
1.7     ! wiz      8757:                   <p>The <code class="filename">PLIST</code> file
        !          8758:                   gets the <code class="filename">foo.so</code>
        !          8759:                   entry.</p>
1.1       grant    8760:                 </li>
                   8761: 
                   8762:                 <li>
                   8763:                   <p>When linking programs that depend on these
                   8764:                   libraries <span class=
                   8765:                   "emphasis"><em>before</em></span> they are
                   8766:                   installed, preface the <a href=
                   8767:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   8768:                   <span class="citerefentry"><span class=
                   8769:                   "refentrytitle">cc</span>(1)</span></a> or
                   8770:                   <a href=
                   8771:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   8772:                   <span class="citerefentry"><span class=
                   8773:                   "refentrytitle">ld</span>(1)</span></a> line with
                   8774:                   &#8220;<span class="quote">${LIBTOOL}
                   8775:                   --mode=link</span>&#8221;, and it will find the
                   8776:                   correct libraries (static or shared), but please
                   8777:                   be aware that libtool will not allow you to
                   8778:                   specify a relative path in -L (such as
                   8779:                   &#8220;<span class=
                   8780:                   "quote">-L../somelib</span>&#8221;), because it
                   8781:                   expects you to change that argument to be the
1.7     ! wiz      8782:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    8783:                   <pre class="programlisting">
                   8784: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   8785: </pre>
                   8786: 
                   8787:                   <p>should be changed to:</p>
                   8788:                   <pre class="programlisting">
1.7     ! wiz      8789: ${LIBTOOL} --mode=link ${CC} -o <em class=
        !          8790: "replaceable"><code>someprog</code></em> <em class=
        !          8791: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    8792: </pre>
                   8793: 
                   8794:                   <p>and it will do the right thing with the
                   8795:                   libraries.</p>
                   8796:                 </li>
                   8797: 
                   8798:                 <li>
                   8799:                   <p>When installing libraries, preface the
                   8800:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   8801:                   <span class="citerefentry"><span class=
                   8802:                   "refentrytitle">install</span>(1)</span></a> or
                   8803:                   <a href=
                   8804:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   8805:                   <span class="citerefentry"><span class=
                   8806:                   "refentrytitle">cp</span>(1)</span></a> command
                   8807:                   with &#8220;<span class="quote">${LIBTOOL}
                   8808:                   --mode=install</span>&#8221;, and change the
1.7     ! wiz      8809:                   library name to <code class=
        !          8810:                   "filename">.la</code>. e.g.</p>
1.1       grant    8811:                   <pre class="programlisting">
                   8812: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   8813: </pre>
                   8814: 
1.7     ! wiz      8815:                   <p>This will install the static <code class=
        !          8816:                   "filename">.a</code>, shared library, any needed
1.1       grant    8817:                   symlinks, and run <a href=
                   8818:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   8819:                   <span class="citerefentry"><span class=
                   8820:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   8821:                 </li>
                   8822: 
                   8823:                 <li>
1.7     ! wiz      8824:                   <p>In your <code class="filename">PLIST</code>,
        !          8825:                   include all of the <code class=
        !          8826:                   "filename">.a</code>, <code class=
        !          8827:                   "filename">.la</code>, and <code class=
        !          8828:                   "filename">.so</code>, <code class=
        !          8829:                   "filename">.so.CURRENT</code> and <code class=
        !          8830:                   "filename">.so.CURRENT.REVISION</code> files
        !          8831:                   (this is a change from the previous
        !          8832:                   behaviour).</p>
1.1       grant    8833:                 </li>
                   8834:               </ol>
                   8835:             </div>
                   8836:           </div>
                   8837: 
                   8838:           <div class="sect2" lang="en" xml:lang="en">
                   8839:             <div class="titlepage">
                   8840:               <div>
                   8841:                 <div>
1.7     ! wiz      8842:                   <h3 class="title"><a name="id2592086" id=
        !          8843:                   "id2592086"></a>12.3.2.&nbsp;Using libtool on GNU
1.1       grant    8844:                   packages that already support libtool</h3>
                   8845:                 </div>
                   8846:               </div>
                   8847:             </div>
                   8848: 
1.7     ! wiz      8849:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
        !          8850:             the package Makefile. This will override the package's
        !          8851:             own libtool in most cases. For older libtool using
1.1       grant    8852:             packages, libtool is made by ltconfig script during the
                   8853:             do-configure step; you can check the libtool script
1.7     ! wiz      8854:             location by doing <span><strong class="command">make
        !          8855:             configure; find work*/ -name
        !          8856:             libtool</strong></span>.</p>
        !          8857: 
        !          8858:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
        !          8859:             specifies which libtool scripts, relative to
        !          8860:             <code class="varname">WRKSRC</code>, to override. By
        !          8861:             default, it is set to &#8220;<span class=
        !          8862:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
        !          8863:             this does not match the location of the package's
        !          8864:             libtool script(s), set it as appropriate.</p>
1.1       grant    8865: 
1.7     ! wiz      8866:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    8867:             static libraries built and installed, then use
1.7     ! wiz      8868:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    8869:             instead.</p>
                   8870: 
                   8871:             <p>If your package makes use of the platform
                   8872:             independent library for loading dynamic shared objects,
                   8873:             that comes with libtool (libltdl), you should include
1.7     ! wiz      8874:             the libtool buildlink3.mk (and set <code class=
        !          8875:             "varname">USE_BUILDLINK3=YES</code>).</p>
1.1       grant    8876: 
                   8877:             <p>Some packages use libtool incorrectly so that the
                   8878:             package may not work or build in some circumstances.
                   8879:             Some of the more common errors are:</p>
                   8880: 
                   8881:             <div class="itemizedlist">
                   8882:               <ul type="disc">
                   8883:                 <li>
                   8884:                   <p>The inclusion of a shared object (-module) as
                   8885:                   a dependent library in an executable or library.
                   8886:                   This in itself isn't a problem if one of two
                   8887:                   things has been done:</p>
                   8888: 
                   8889:                   <div class="orderedlist">
                   8890:                     <ol type="1">
                   8891:                       <li>
                   8892:                         <p>The shared object is named correctly,
1.7     ! wiz      8893:                         i.e. <code class=
        !          8894:                         "filename">libfoo.la</code>, not
        !          8895:                         <code class="filename">foo.la</code></p>
1.1       grant    8896:                       </li>
                   8897: 
                   8898:                       <li>
                   8899:                         <p>The -dlopen option is used when linking
                   8900:                         an executable.</p>
                   8901:                       </li>
                   8902:                     </ol>
                   8903:                   </div>
                   8904:                 </li>
                   8905: 
                   8906:                 <li>
                   8907:                   <p>The use of libltdl without the correct calls
                   8908:                   to initialisation routines. The function
                   8909:                   lt_dlinit() should be called and the macro
1.7     ! wiz      8910:                   <code class=
        !          8911:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    8912:                   included in executables.</p>
                   8913:                 </li>
                   8914:               </ul>
                   8915:             </div>
                   8916:           </div>
                   8917: 
                   8918:           <div class="sect2" lang="en" xml:lang="en">
                   8919:             <div class="titlepage">
                   8920:               <div>
                   8921:                 <div>
1.7     ! wiz      8922:                   <h3 class="title"><a name="id2592238" id=
        !          8923:                   "id2592238"></a>12.3.3.&nbsp;GNU
1.1       grant    8924:                   Autoconf/Automake</h3>
                   8925:                 </div>
                   8926:               </div>
                   8927:             </div>
                   8928: 
                   8929:             <p>If a package needs GNU autoconf or automake to be
                   8930:             executed to regenerate the configure script and
                   8931:             Makefile.in makefile templates, then they should be
                   8932:             executed in a pre-configure target. Two Makefile
1.7     ! wiz      8933:             fragments are provided in <code class=
        !          8934:             "filename">pkgsrc/mk/autoconf.mk</code> and
        !          8935:             <code class="filename">pkgsrc/mk/automake.mk</code> to
        !          8936:             help dealing with these tools. See comments in these
        !          8937:             files for details.</p>
1.1       grant    8938: 
                   8939:             <p>For packages that need only autoconf:</p>
                   8940:             <pre class="programlisting">
                   8941: AUTOCONF_REQD=    2.50    # if default version is not good enough
                   8942: ...
                   8943: 
                   8944: pre-configure:
                   8945:           cd ${WRKSRC}; ${AUTOCONF}
                   8946: 
                   8947: ...
                   8948: .include "../../mk/autoconf.mk"
                   8949: </pre>
                   8950: 
                   8951:             <p>and for packages that need automake and
                   8952:             autoconf:</p>
                   8953:             <pre class="programlisting">
                   8954: AUTOMAKE_REQD=  1.7.1   # if default version is not good enough
                   8955: ...
                   8956: 
                   8957: pre-configure:
                   8958:           cd ${WRKSRC};                                           \
                   8959:           ${ACLOCAL};                                             \
                   8960:           ${AUTOHEADER};                                          \
                   8961:           ${AUTOMAKE} -a --foreign -i;                            \
                   8962:           ${AUTOCONF}
                   8963: 
                   8964: ...
                   8965: .include "../mk/automake.mk"
                   8966: </pre>
                   8967: 
                   8968:             <p>Packages which use GNU Automake will almost
                   8969:             certainly require GNU Make, but that's automatically
1.7     ! wiz      8970:             provided for you in <code class=
        !          8971:             "filename">mk/automake.mk</code>.</p>
1.1       grant    8972: 
                   8973:             <p>There are times when the configure process makes
                   8974:             additional changes to the generated files, which then
                   8975:             causes the build process to try to re-execute the
                   8976:             automake sequence. This is prevented by touching
                   8977:             various files in the configure stage. If this causes
1.7     ! wiz      8978:             problems with your package you can set <code class=
        !          8979:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    8980:             Makefile.</p>
                   8981:           </div>
                   8982:         </div>
                   8983: 
                   8984:         <div class="sect1" lang="en" xml:lang="en">
                   8985:           <div class="titlepage">
                   8986:             <div>
                   8987:               <div>
                   8988:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      8989:                 "id2592283" id="id2592283"></a>12.4.&nbsp;Building
1.1       grant    8990:                 considerations</h2>
                   8991:               </div>
                   8992:             </div>
                   8993:           </div>
                   8994: 
                   8995:           <div class="sect2" lang="en" xml:lang="en">
                   8996:             <div class="titlepage">
                   8997:               <div>
                   8998:                 <div>
1.7     ! wiz      8999:                   <h3 class="title"><a name="id2592286" id=
        !          9000:                   "id2592286"></a>12.4.1.&nbsp;CPP defines</h3>
1.1       grant    9001:                 </div>
                   9002:               </div>
                   9003:             </div>
                   9004: 
                   9005:             <p>To port an application to NetBSD, it's usually
                   9006:             necessary for the compiler to be able to judge the
                   9007:             system on which it's compiling, and we use definitions
                   9008:             so that the C pre-processor can do this.</p>
                   9009: 
                   9010:             <p>To test whether you are working on a 4.4 BSD-derived
                   9011:             system, you should use the BSD definition, which is
1.7     ! wiz      9012:             defined in <code class=
        !          9013:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    9014:             systems.</p>
                   9015:             <pre class="programlisting">
                   9016: #include &lt;sys/param.h&gt;
                   9017: </pre>
                   9018: 
                   9019:             <p>and then you can surround the BSD-specific parts of
                   9020:             your package's C/C++ code using this conditional:</p>
                   9021:             <pre class="programlisting">
                   9022: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   9023:     ...
                   9024: #endif
                   9025: </pre>
                   9026: 
                   9027:             <p>Please use the &#8220;<span class=
                   9028:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   9029:             it should only apply to features of NetBSD that are not
                   9030:             present in other 4.4-lite derived BSDs.</p>
                   9031:           </div>
                   9032:         </div>
                   9033: 
                   9034:         <div class="sect1" lang="en" xml:lang="en">
                   9035:           <div class="titlepage">
                   9036:             <div>
                   9037:               <div>
                   9038:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      9039:                 "id2592316" id="id2592316"></a>12.5.&nbsp;Package
1.1       grant    9040:                 specific actions</h2>
                   9041:               </div>
                   9042:             </div>
                   9043:           </div>
                   9044: 
                   9045:           <div class="sect2" lang="en" xml:lang="en">
                   9046:             <div class="titlepage">
                   9047:               <div>
                   9048:                 <div>
1.7     ! wiz      9049:                   <h3 class="title"><a name="id2592320" id=
        !          9050:                   "id2592320"></a>12.5.1.&nbsp;Package
1.1       grant    9051:                   configuration files</h3>
                   9052:                 </div>
                   9053:               </div>
                   9054:             </div>
                   9055: 
                   9056:             <p>Packages should be taught to look for their
1.7     ! wiz      9057:             configuration files in <code class=
        !          9058:             "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1       grant    9059:             through to the configure and build processes.
1.7     ! wiz      9060:             <code class="varname">PKG_SYSCONFDIR</code> may be
1.1       grant    9061:             customized in various ways by setting other make
                   9062:             variables:</p>
                   9063: 
                   9064:             <div class="itemizedlist">
                   9065:               <ul type="disc">
                   9066:                 <li>
1.7     ! wiz      9067:                   <p><code class="varname">PKG_SYSCONFBASE</code>
        !          9068:                   is the main config directory under which all
        !          9069:                   package configuration files are to be found. This
        !          9070:                   defaults to <code class=
        !          9071:                   "filename">${PREFIX}/etc</code>, but may be
        !          9072:                   overridden in <code class=
        !          9073:                   "filename">/etc/mk.conf</code>.</p>
1.1       grant    9074:                 </li>
                   9075: 
                   9076:                 <li>
1.7     ! wiz      9077:                   <p><code class="varname">PKG_SYSCONFSUBDIR</code>
        !          9078:                   is the subdirectory of <code class=
        !          9079:                   "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    9080:                   configuration files for a particular package may
                   9081:                   be found, e.g. the Apache configuration files may
1.7     ! wiz      9082:                   all be found under the <code class=
        !          9083:                   "filename">httpd/</code> subdirectory of
        !          9084:                   <code class="varname">${PKG_SYSCONFBASE}</code>.
        !          9085:                   This should be set in the package Makefile.</p>
1.1       grant    9086:                 </li>
                   9087: 
                   9088:                 <li>
1.7     ! wiz      9089:                   <p>By default, <code class=
        !          9090:                   "varname">PKG_SYSCONFDIR</code> is set to
        !          9091:                   <code class=
        !          9092:                   "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
        !          9093:                   but this may be overridden by setting
        !          9094:                   <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
        !          9095:                   for a particular package, where <code class=
        !          9096:                   "varname">PKG_SYSCONFVAR</code> defaults to
        !          9097:                   <code class="varname">${PKGBASE}</code>. This is
        !          9098:                   not meant to be set by a package Makefile, but is
1.1       grant    9099:                   reserved for users who wish to override the
1.7     ! wiz      9100:                   <code class="varname">PKG_SYSCONFDIR</code>
        !          9101:                   setting for a particular package with a special
1.1       grant    9102:                   location.</p>
                   9103:                 </li>
                   9104:               </ul>
                   9105:             </div>
                   9106: 
                   9107:             <p>The only variables that users should customize are
1.7     ! wiz      9108:             <code class="varname">PKG_SYSCONFBASE</code> and
        !          9109:             <code class=
        !          9110:             "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
        !          9111:             Users will typically want to set <code class=
        !          9112:             "varname">PKG_SYSCONFBASE</code> to <code class=
        !          9113:             "filename">/etc</code>, or to accept the default
        !          9114:             location of <code class=
        !          9115:             "filename">${PREFIX}/etc</code>.</p>
1.1       grant    9116:           </div>
                   9117: 
                   9118:           <div class="sect2" lang="en" xml:lang="en">
                   9119:             <div class="titlepage">
                   9120:               <div>
                   9121:                 <div>
1.7     ! wiz      9122:                   <h3 class="title"><a name="id2592490" id=
        !          9123:                   "id2592490"></a>12.5.2.&nbsp;User
1.2       hubertf  9124:                   interaction</h3>
1.1       grant    9125:                 </div>
                   9126:               </div>
                   9127:             </div>
                   9128: 
                   9129:             <p>Occasionally, packages require interaction from the
                   9130:             user, and this can be in a number of ways:</p>
                   9131: 
                   9132:             <div class="itemizedlist">
                   9133:               <ul type="disc">
                   9134:                 <li>
                   9135:                   <p>help in fetching the distfiles</p>
                   9136:                 </li>
                   9137: 
                   9138:                 <li>
                   9139:                   <p>help to configure the package before it is
                   9140:                   built</p>
                   9141:                 </li>
                   9142: 
                   9143:                 <li>
                   9144:                   <p>help during the build process</p>
                   9145:                 </li>
                   9146: 
                   9147:                 <li>
                   9148:                   <p>help during the installation of a package</p>
                   9149:                 </li>
                   9150:               </ul>
                   9151:             </div>
                   9152: 
1.7     ! wiz      9153:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    9154:             definition is provided to notify the pkgsrc mechanism
                   9155:             of an interactive stage which will be needed, and this
1.7     ! wiz      9156:             should be set in the package's <code class=
        !          9157:             "filename">Makefile</code>. e.g.</p>
1.1       grant    9158:             <pre class="programlisting">
                   9159: INTERACTIVE_STAGE= build
                   9160: </pre>
                   9161: 
                   9162:             <p>Multiple interactive stages can be specified:</p>
                   9163:             <pre class="programlisting">
                   9164: INTERACTIVE_STAGE= configure install
                   9165: </pre>
                   9166:           </div>
                   9167: 
                   9168:           <div class="sect2" lang="en" xml:lang="en">
                   9169:             <div class="titlepage">
                   9170:               <div>
                   9171:                 <div>
1.7     ! wiz      9172:                   <h3 class="title"><a name="id2592535" id=
        !          9173:                   "id2592535"></a>12.5.3.&nbsp;Handling
1.1       grant    9174:                   licenses</h3>
                   9175:                 </div>
                   9176:               </div>
                   9177:             </div>
                   9178: 
                   9179:             <p>A package may underly a license which the user has
                   9180:             or has not agreed to accept. Usually, packages that
                   9181:             underly well-known Open Source licenses (e.g. the GNU
                   9182:             Public License, GPL) won't have any special license
                   9183:             tags added in pkgsrc which require special action by
                   9184:             the user of such packages, but there are quite a number
                   9185:             of other licenses out there that pkgsrc users may not
                   9186:             be able to follow, for whatever reasons. For these
                   9187:             cases, pkgsrc contains a mechanism to note that a
                   9188:             package underlies a certain license, and the user has
                   9189:             to accept the license before the package can be
                   9190:             installed.</p>
                   9191: 
                   9192:             <p>Placing a certain package under a certain license
1.7     ! wiz      9193:             works by setting the <code class=
        !          9194:             "varname">LICENSE</code> variable to a string
        !          9195:             identifying the license, e.g. in <a xmlns=
        !          9196:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9197:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.7     ! wiz      9198:             class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    9199:             <pre class="programlisting">
                   9200: LICENSE=        graphviz-license
                   9201: </pre>
                   9202: 
                   9203:             <p>When trying to build, the user will get a notice
                   9204:             that the package underlies a license which he hasn't
                   9205:             accepted (yet):</p>
                   9206:             <pre class="programlisting">
1.7     ! wiz      9207: <code class="prompt">%</code> <strong class=
        !          9208: "userinput"><code>make</code></strong>
1.1       grant    9209: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   9210: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   9211: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   9212: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   9213: *** Error code 1
                   9214: </pre>
                   9215: 
1.7     ! wiz      9216:             <p>The license can be viewed with <span><strong class=
        !          9217:             "command">make show-license</strong></span>, and if it
        !          9218:             is considered appropriate, the line printed above can
        !          9219:             be added to <code class="filename">/etc/mk.conf</code>
        !          9220:             to indicate acceptance of the particular license:</p>
1.1       grant    9221:             <pre class="programlisting">
                   9222: ACCEPTABLE_LICENSES+=graphviz-license
                   9223: </pre>
                   9224: 
                   9225:             <p>When adding a package with a new license, the
1.7     ! wiz      9226:             license text should be added to <code class=
        !          9227:             "filename">pkgsrc/licenses</code> for displaying. A
        !          9228:             list of known licenses can be seen in this directory as
        !          9229:             well as by looking at the list of (commented out)
        !          9230:             <code class="varname">ACCEPTABLE_LICENSES</code>
        !          9231:             variable settings in <code class=
        !          9232:             "filename">pkgsrc/mk/bsd.pkg.defaults.mk</code>.</p>
1.1       grant    9233: 
                   9234:             <p>Is there is a <span class=
                   9235:             "emphasis"><em>really</em></span> pressing need to
                   9236:             accept all licenses at once, like when trying to
                   9237:             download or mirror all distfiles or doing a bulk build
                   9238:             to test if all packages in pkgsrc build, this can be
1.7     ! wiz      9239:             done by setting <code class=
        !          9240:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    9241:           </div>
                   9242: 
                   9243:           <div class="sect2" lang="en" xml:lang="en">
                   9244:             <div class="titlepage">
                   9245:               <div>
                   9246:                 <div>
1.7     ! wiz      9247:                   <h3 class="title"><a name="id2592686" id=
        !          9248:                   "id2592686"></a>12.5.4.&nbsp;Creating an account
1.1       grant    9249:                   from a package</h3>
                   9250:                 </div>
                   9251:               </div>
                   9252:             </div>
                   9253: 
                   9254:             <p>There are two make variables used to control the
                   9255:             creation of package-specific groups and users at
1.7     ! wiz      9256:             pre-install time. The first is <code class=
        !          9257:             "varname">PKG_GROUPS</code>, which is a list of
1.1       grant    9258:             group[:groupid] elements, where the groupid is
1.7     ! wiz      9259:             optional. The second is <code class=
        !          9260:             "varname">PKG_USERS</code>, which is a list of elements
1.1       grant    9261:             of the form:</p>
                   9262:             <pre class="programlisting">
                   9263: user:group[:[userid][:[description][:[home][:shell]]]]
                   9264: </pre>
                   9265: 
                   9266:             <p>where only the user and group are required, the rest
                   9267:             being optional. A simple example is:</p>
                   9268:             <pre class="programlisting">
                   9269:   PKG_GROUPS=       foogroup
                   9270:     PKG_USERS=    foouser:foogroup
                   9271: </pre>
                   9272: 
                   9273:             <p>A more complex example is that creates two groups
                   9274:             and two users is:</p>
                   9275:             <pre class="programlisting">
                   9276:   PKG_GROUPS=       group1 group2:1005
                   9277:     PKG_USERS=    first:group1::First\\ User                      \
                   9278:                   second:group2::Second\\ User:/home/second:${SH}
                   9279: </pre>
                   9280: 
                   9281:             <p>By default, a new user will have home directory
1.7     ! wiz      9282:             <code class="filename">/nonexistent</code>, and login
        !          9283:             shell <code class="filename">/sbin/nologin</code>
        !          9284:             unless they are specified as part of the user
        !          9285:             element.</p>
1.1       grant    9286: 
1.7     ! wiz      9287:             <p>The package <code class="filename">Makefile</code>
        !          9288:             must also set <code class=
        !          9289:             "varname">USE_PKGINSTALL=YES</code>. This will cause
        !          9290:             the users and groups to be created at pre-install time,
        !          9291:             and the admin will be prompted to remove them at
        !          9292:             post-deinstall time. Automatic creation of the users
        !          9293:             and groups can be toggled on and off by setting the
        !          9294:             <code class="varname">PKG_CREATE_USERGROUP</code>
        !          9295:             variable prior to package installation.</p>
1.1       grant    9296:           </div>
                   9297: 
                   9298:           <div class="sect2" lang="en" xml:lang="en">
                   9299:             <div class="titlepage">
                   9300:               <div>
                   9301:                 <div>
1.7     ! wiz      9302:                   <h3 class="title"><a name="id2592748" id=
        !          9303:                   "id2592748"></a>12.5.5.&nbsp;Installing score
1.1       grant    9304:                   files</h3>
                   9305:                 </div>
                   9306:               </div>
                   9307:             </div>
                   9308: 
                   9309:             <p>Certain packages, most of them in the games
                   9310:             category, install a score file that allows all users on
                   9311:             the system to record their highscores. In order for
                   9312:             this to work, the binaries need to be installed setgid
                   9313:             and the score files owned by the appropriate group
                   9314:             and/or owner (traditionally the "games" user/group).
                   9315:             The following variables, documented in more detail in
1.7     ! wiz      9316:             <code class="filename">mk/bsd.pkg.defaults.mk</code>,
        !          9317:             control this behaviour: <code class=
        !          9318:             "varname">SETGIDGAME</code>, <code class=
        !          9319:             "varname">GAMEDATAMODE</code>, <code class=
        !          9320:             "varname">GAMEGRP</code>, <code class=
        !          9321:             "varname">GAMEMODE</code>, <code class=
        !          9322:             "varname">GAMEOWN</code>.</p>
1.1       grant    9323: 
                   9324:             <p>Note that per default, setgid installation of games
1.7     ! wiz      9325:             is disabled; setting <code class=
        !          9326:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    9327:             variables accordingly.</p>
                   9328: 
                   9329:             <p>A package should therefor never hard code file
1.7     ! wiz      9330:             ownership or access permissions but rely on
        !          9331:             <code class="varname">INSTALL_GAME</code> and
        !          9332:             <code class="varname">INSTALL_GAME_DATA</code> to set
        !          9333:             these correctly.</p>
1.1       grant    9334:           </div>
                   9335: 
                   9336:           <div class="sect2" lang="en" xml:lang="en">
                   9337:             <div class="titlepage">
                   9338:               <div>
                   9339:                 <div>
1.7     ! wiz      9340:                   <h3 class="title"><a name="id2592929" id=
        !          9341:                   "id2592929"></a>12.5.6.&nbsp;Packages providing
1.1       grant    9342:                   login shells</h3>
                   9343:                 </div>
                   9344:               </div>
                   9345:             </div>
                   9346: 
                   9347:             <p>If the purpose of the package is to provide a login
1.7     ! wiz      9348:             shell, the variable <code class=
        !          9349:             "varname">PKG_SHELL</code> should contain the full
        !          9350:             pathname of the shell executable installed by this
        !          9351:             package. The package <code class=
        !          9352:             "filename">Makefile</code> must also set <code class=
        !          9353:             "varname">USE_PKGINSTALL=YES</code> to use the
        !          9354:             automatically generated <code class=
        !          9355:             "filename">INSTALL</code>/<code class=
        !          9356:             "filename">DEINSTALL</code> scripts.</p>
1.1       grant    9357: 
                   9358:             <p>An example taken from shells/zsh:</p>
                   9359:             <pre class="programlisting">
                   9360:   USE_PKGINSTALL=   YES
                   9361:     PKG_SHELL=    ${PREFIX}/bin/zsh
                   9362: </pre>
                   9363: 
1.7     ! wiz      9364:             <p>The shell is registered into <code class=
        !          9365:             "filename">/etc/shells</code> file automatically in the
        !          9366:             post-install target by the generated <code class=
        !          9367:             "filename">INSTALL</code> script and removed in the
        !          9368:             deinstall target by the <code class=
        !          9369:             "filename">DEINSTALL</code> script.</p>
1.1       grant    9370:           </div>
                   9371: 
                   9372:           <div class="sect2" lang="en" xml:lang="en">
                   9373:             <div class="titlepage">
                   9374:               <div>
                   9375:                 <div>
1.7     ! wiz      9376:                   <h3 class="title"><a name="id2593054" id=
        !          9377:                   "id2593054"></a>12.5.7.&nbsp;Packages containing
1.1       grant    9378:                   perl scripts</h3>
                   9379:                 </div>
                   9380:               </div>
                   9381:             </div>
                   9382: 
                   9383:             <p>If your package contains interpreted perl scripts,
1.7     ! wiz      9384:             set <code class="varname">REPLACE_PERL</code> to ensure
        !          9385:             that the proper interpreter path is set. <code class=
        !          9386:             "varname">REPLACE_PERL</code> should contain a list of
        !          9387:             scripts, relative to <code class=
        !          9388:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    9389:           </div>
                   9390: 
                   9391:           <div class="sect2" lang="en" xml:lang="en">
                   9392:             <div class="titlepage">
                   9393:               <div>
                   9394:                 <div>
1.7     ! wiz      9395:                   <h3 class="title"><a name="id2593073" id=
        !          9396:                   "id2593073"></a>12.5.8.&nbsp;Packages with
1.1       grant    9397:                   hardcoded paths to other interpreters</h3>
                   9398:                 </div>
                   9399:               </div>
                   9400:             </div>
                   9401: 
                   9402:             <p>Your package may also contain scripts with hardcoded
                   9403:             paths to other interpreters besides (or as well as)
                   9404:             perl. To correct the full pathname to the script
                   9405:             interpreter, you need to set the following definitions
1.7     ! wiz      9406:             in your <code class="filename">Makefile</code> (we
        !          9407:             shall use <span><strong class=
        !          9408:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    9409:             <pre class="programlisting">
                   9410:   REPLACE_INTERPRETER+=     tcl
                   9411:     _REPLACE.tcl.old=     .*/bin/tclsh
                   9412:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   9413:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   9414:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   9415: </pre>
                   9416:           </div>
                   9417: 
                   9418:           <div class="sect2" lang="en" xml:lang="en">
                   9419:             <div class="titlepage">
                   9420:               <div>
                   9421:                 <div>
1.7     ! wiz      9422:                   <h3 class="title"><a name="id2593094" id=
        !          9423:                   "id2593094"></a>12.5.9.&nbsp;Packages installing
1.1       grant    9424:                   perl modules</h3>
                   9425:                 </div>
                   9426:               </div>
                   9427:             </div>
                   9428: 
                   9429:             <p>Makefiles of packages providing perl5 modules should
1.7     ! wiz      9430:             include the Makefile fragment <code class=
        !          9431:             "filename">../../lang/perl5/module.mk</code>. It
        !          9432:             provides a <span><strong class=
        !          9433:             "command">do-configure</strong></span> target for the
        !          9434:             standard perl configuration for such modules as well as
        !          9435:             various hooks to tune this configuration. See comments
        !          9436:             in this file for details.</p>
1.1       grant    9437: 
                   9438:             <p>Perl5 modules will install into different places
                   9439:             depending on the version of perl used during the build
                   9440:             process. To address this, pkgsrc will append lines to
1.7     ! wiz      9441:             the <code class="filename">PLIST</code> corresponding
        !          9442:             to the files listed in the installed <code class=
        !          9443:             "filename">.packlist</code> file generated by most
        !          9444:             perl5 modules. This is invoked by defining <code class=
        !          9445:             "varname">PERL5_PACKLIST</code> to a space-separated
        !          9446:             list of paths to packlist files, e.g.:</p>
1.1       grant    9447:             <pre class="programlisting">
                   9448: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   9449: </pre>
                   9450: 
1.7     ! wiz      9451:             <p>The variables <code class=
        !          9452:             "varname">PERL5_SITELIB</code>, <code class=
        !          9453:             "varname">PERL5_SITEARCH</code>, and <code class=
        !          9454:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    9455:             locations in which perl5 modules may be installed, and
                   9456:             may be used by perl5 packages that don't have a
                   9457:             packlist. These three variables are also substituted
1.7     ! wiz      9458:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    9459:           </div>
                   9460: 
                   9461:           <div class="sect2" lang="en" xml:lang="en">
                   9462:             <div class="titlepage">
                   9463:               <div>
                   9464:                 <div>
                   9465:                   <h3 class="title"><a name="faq.info-files" id=
                   9466:                   "faq.info-files"></a>12.5.10.&nbsp;Packages
                   9467:                   installing info files</h3>
                   9468:                 </div>
                   9469:               </div>
                   9470:             </div>
                   9471: 
                   9472:             <p>Some packages install info files or use the
                   9473:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   9474:             &#8220;<span class="quote">install-info</span>&#8221;
                   9475:             commands. Each of the info files:</p>
                   9476: 
                   9477:             <div class="itemizedlist">
                   9478:               <ul type="disc">
                   9479:                 <li>
                   9480:                   <p>is considered to be installed in the directory
1.7     ! wiz      9481:                   <code class=
        !          9482:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    9483:                 </li>
                   9484: 
                   9485:                 <li>
                   9486:                   <p>is registered in the Info directory file
1.7     ! wiz      9487:                   <code class=
        !          9488:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    9489:                 </li>
                   9490: 
                   9491:                 <li>
                   9492:                   <p>and must be listed as a filename in the
1.7     ! wiz      9493:                   <code class="varname">INFO_FILES</code> variable
        !          9494:                   in the package Makefile.</p>
1.1       grant    9495:                 </li>
                   9496:               </ul>
                   9497:             </div>
                   9498: 
1.7     ! wiz      9499:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    9500:             &#8220;<span class="quote">info</span>&#8221; and can
1.7     ! wiz      9501:             be overridden in the package Makefile. <code class=
        !          9502:             "filename">INSTALL</code> and <code class=
        !          9503:             "filename">DEINSTALL</code> scripts will be generated
        !          9504:             to handle registration of the info files in the Info
1.1       grant    9505:             directory file. The &#8220;<span class=
                   9506:             "quote">install-info</span>&#8221; command used for the
                   9507:             info files registration is either provided by the
                   9508:             system, or by a special purpose package automatically
                   9509:             added as dependency if needed.</p>
                   9510: 
                   9511:             <p>A package which needs the &#8220;<span class=
                   9512:             "quote">makeinfo</span>&#8221; command at build time
1.7     ! wiz      9513:             must define the variable <code class=
        !          9514:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    9515:             minimum version of the &#8220;<span class=
                   9516:             "quote">makeinfo</span>&#8221; command is needed it
1.7     ! wiz      9517:             should be noted with the <code class=
        !          9518:             "varname">TEXINFO_REQD</code> variable in the package
        !          9519:             <code class="filename">Makefile</code>. By default, a
1.1       grant    9520:             minimum version of 3.12 is required. If the system does
1.7     ! wiz      9521:             not provide a <span><strong class=
        !          9522:             "command">makeinfo</strong></span> command or if it
        !          9523:             does not match the required minimum, a build dependency
        !          9524:             on the <a xmlns=
        !          9525:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9526:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.7     ! wiz      9527:             class="pkgname">devel/gtexinfo</a> package will be
        !          9528:             added automatically.</p>
1.1       grant    9529: 
                   9530:             <p>The build and installation process of the software
                   9531:             provided by the package should not use the
1.7     ! wiz      9532:             <span><strong class=
        !          9533:             "command">install-info</strong></span> command as the
        !          9534:             registration of info files is the task of the package
        !          9535:             <code class="filename">INSTALL</code> script, and it
        !          9536:             must use the appropriate <span><strong class=
        !          9537:             "command">makeinfo</strong></span> command.</p>
1.1       grant    9538: 
                   9539:             <p>To achieve this goal the pkgsrc infrastructure
1.7     ! wiz      9540:             creates overriding scripts for the <span><strong class=
        !          9541:             "command">install-info</strong></span> and
        !          9542:             <span><strong class="command">makeinfo</strong></span>
        !          9543:             commands in a directory listed early in <code class=
        !          9544:             "varname">PATH</code>.</p>
1.1       grant    9545: 
1.7     ! wiz      9546:             <p>The script overriding <span><strong class=
        !          9547:             "command">install-info</strong></span> has no effect
        !          9548:             except the logging of a message. The script overriding
        !          9549:             <span><strong class="command">makeinfo</strong></span>
        !          9550:             logs a message and according to the value of
        !          9551:             <code class="varname">USE_MAKEINFO</code> and
        !          9552:             <code class="varname">TEXINFO_REQD</code> either run
        !          9553:             the appropriate <span><strong class=
        !          9554:             "command">makeinfo</strong></span> command or exit on
        !          9555:             error.</p>
1.1       grant    9556:           </div>
                   9557: 
                   9558:           <div class="sect2" lang="en" xml:lang="en">
                   9559:             <div class="titlepage">
                   9560:               <div>
                   9561:                 <div>
1.7     ! wiz      9562:                   <h3 class="title"><a name="id2593450" id=
        !          9563:                   "id2593450"></a>12.5.11.&nbsp;Packages installing
1.1       grant    9564:                   GConf2 data files</h3>
                   9565:                 </div>
                   9566:               </div>
                   9567:             </div>
                   9568: 
1.7     ! wiz      9569:             <p>If a package installs <code class=
        !          9570:             "filename">.schemas</code> or <code class=
        !          9571:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    9572:             need to take some extra steps to make sure they get
                   9573:             registered in the database:</p>
                   9574: 
                   9575:             <div class="orderedlist">
                   9576:               <ol type="1">
                   9577:                 <li>
1.7     ! wiz      9578:                   <p>Include <code class=
        !          9579:                   "filename">../../devel/GConf2/schemas.mk</code>
        !          9580:                   instead of its <code class=
        !          9581:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9582:                   care of rebuilding the GConf2 database at
                   9583:                   installation and deinstallation time, and tells
                   9584:                   the package where to install GConf2 data files
                   9585:                   using some standard configure arguments. It also
                   9586:                   disallows any access to the database directly
                   9587:                   from the package.</p>
                   9588:                 </li>
                   9589: 
                   9590:                 <li>
                   9591:                   <p>Ensure that the package installs its
1.7     ! wiz      9592:                   <code class="filename">.schemas</code> files
        !          9593:                   under <code class=
        !          9594:                   "filename">${PREFIX}/share/gconf/schemas</code>.
        !          9595:                   If they get installed under <code class=
        !          9596:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    9597:                   manually patch the package.</p>
                   9598:                 </li>
                   9599: 
                   9600:                 <li>
                   9601:                   <p>Check the PLIST and remove any entries under
                   9602:                   the etc/gconf directory, as they will be handled
                   9603:                   automatically. See <a href="#faq.conf" title=
                   9604:                   "6.13.&nbsp;Configuration files handling and placement">
                   9605:                   Section&nbsp;6.13, &#8220;Configuration files
                   9606:                   handling and placement&#8221;</a> for more
                   9607:                   information.</p>
                   9608:                 </li>
                   9609: 
                   9610:                 <li>
1.7     ! wiz      9611:                   <p>Define the <code class=
        !          9612:                   "varname">GCONF2_SCHEMAS</code> variable in your
        !          9613:                   <code class="filename">Makefile</code> with a
        !          9614:                   list of all <code class=
        !          9615:                   "filename">.schemas</code> files installed by the
        !          9616:                   package, if any. Names must not contain any
        !          9617:                   directories in them.</p>
1.1       grant    9618:                 </li>
                   9619: 
                   9620:                 <li>
1.7     ! wiz      9621:                   <p>Define the <code class=
        !          9622:                   "varname">GCONF2_ENTRIES</code> variable in your
        !          9623:                   <code class="filename">Makefile</code> with a
        !          9624:                   list of all <code class=
        !          9625:                   "filename">.entries</code> files installed by the
        !          9626:                   package, if any. Names must not contain any
        !          9627:                   directories in them.</p>
1.1       grant    9628:                 </li>
                   9629:               </ol>
                   9630:             </div>
                   9631:           </div>
                   9632: 
                   9633:           <div class="sect2" lang="en" xml:lang="en">
                   9634:             <div class="titlepage">
                   9635:               <div>
                   9636:                 <div>
1.7     ! wiz      9637:                   <h3 class="title"><a name="id2593550" id=
        !          9638:                   "id2593550"></a>12.5.12.&nbsp;Packages installing
1.1       grant    9639:                   scrollkeeper data files</h3>
                   9640:                 </div>
                   9641:               </div>
                   9642:             </div>
                   9643: 
1.7     ! wiz      9644:             <p>If a package installs <code class=
        !          9645:             "filename">.omf</code> files, used by scrollkeeper, you
        !          9646:             need to take some extra steps to make sure they get
        !          9647:             registered in the database:</p>
1.1       grant    9648: 
                   9649:             <div class="orderedlist">
                   9650:               <ol type="1">
                   9651:                 <li>
1.7     ! wiz      9652:                   <p>Include <code class=
        !          9653:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
        !          9654:                   instead of its <code class=
        !          9655:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9656:                   care of rebuilding the scrollkeeper database at
                   9657:                   installation and deinstallation time, and
                   9658:                   disallows any access to it directly from the
                   9659:                   package.</p>
                   9660:                 </li>
                   9661: 
                   9662:                 <li>
                   9663:                   <p>Check the PLIST and remove any entries under
1.7     ! wiz      9664:                   the <code class=
        !          9665:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    9666:                   as they will be handled automatically.</p>
                   9667:                 </li>
                   9668: 
                   9669:                 <li>
1.7     ! wiz      9670:                   <p>Remove the <code class=
        !          9671:                   "filename">share/omf</code> directory from the
        !          9672:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    9673:                 </li>
                   9674:               </ol>
                   9675:             </div>
                   9676:           </div>
                   9677: 
                   9678:           <div class="sect2" lang="en" xml:lang="en">
                   9679:             <div class="titlepage">
                   9680:               <div>
                   9681:                 <div>
1.7     ! wiz      9682:                   <h3 class="title"><a name="id2593602" id=
        !          9683:                   "id2593602"></a>12.5.13.&nbsp;Packages installing
1.1       grant    9684:                   X11 fonts</h3>
                   9685:                 </div>
                   9686:               </div>
                   9687:             </div>
                   9688: 
                   9689:             <p>If a package installs font files, you will need to
                   9690:             rebuild the fonts database in the directory where they
                   9691:             get installed at installation and deinstallation time.
1.7     ! wiz      9692:             This can be automatically done by using <code class=
        !          9693:             "filename">mk/fonts.mk</code>, which you need to
        !          9694:             include in your <code class=
        !          9695:             "filename">Makefile</code>.</p>
1.1       grant    9696: 
                   9697:             <p>When the file is included, you can list the
1.7     ! wiz      9698:             directories where fonts are installed in the
        !          9699:             <code class="varname">FONTS_<em class=
        !          9700:             "replaceable"><code>type</code></em>_DIRS</code>
        !          9701:             variables, where <em class=
        !          9702:             "replaceable"><code>type</code></em> can be one of
        !          9703:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    9704:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   9705:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.7     ! wiz      9706:             sure that the database file <code class=
        !          9707:             "filename">fonts.dir</code> is not listed in the
1.1       grant    9708:             PLIST.</p>
                   9709: 
                   9710:             <p>Note that you should not create new directories for
                   9711:             fonts; instead use the standard ones to avoid that the
                   9712:             user needs to manually configure his X server to find
                   9713:             them.</p>
                   9714:           </div>
                   9715: 
                   9716:           <div class="sect2" lang="en" xml:lang="en">
                   9717:             <div class="titlepage">
                   9718:               <div>
                   9719:                 <div>
1.7     ! wiz      9720:                   <h3 class="title"><a name="id2593649" id=
        !          9721:                   "id2593649"></a>12.5.14.&nbsp;Packages installing
1.1       grant    9722:                   GTK2 modules</h3>
                   9723:                 </div>
                   9724:               </div>
                   9725:             </div>
                   9726: 
                   9727:             <p>If a package installs gtk2 immodules or loaders, you
                   9728:             need to take some extra steps to get them registered in
                   9729:             the GTK2 database properly:</p>
                   9730: 
                   9731:             <div class="orderedlist">
                   9732:               <ol type="1">
                   9733:                 <li>
1.7     ! wiz      9734:                   <p>Include <code class=
        !          9735:                   "filename">../../x11/gtk2/modules.mk</code>
        !          9736:                   instead of its <code class=
        !          9737:                   "filename">buildlink3.mk</code> file. This takes
        !          9738:                   care of rebuilding the database at installation
        !          9739:                   and deinstallation time.</p>
1.1       grant    9740:                 </li>
                   9741: 
                   9742:                 <li>
1.7     ! wiz      9743:                   <p>Set <code class=
        !          9744:                   "varname">GTK2_IMMODULES=YES</code> if your
        !          9745:                   package installs GTK2 immodules.</p>
1.1       grant    9746:                 </li>
                   9747: 
                   9748:                 <li>
1.7     ! wiz      9749:                   <p>Set <code class=
        !          9750:                   "varname">GTK2_LOADERS=YES</code> if your package
        !          9751:                   installs GTK2 loaders.</p>
1.1       grant    9752:                 </li>
                   9753: 
                   9754:                 <li>
                   9755:                   <p>Patch the package to not touch any of the gtk2
                   9756:                   databases directly. These are:</p>
                   9757: 
                   9758:                   <div class="itemizedlist">
                   9759:                     <ul type="disc">
                   9760:                       <li>
1.7     ! wiz      9761:                         <p><code class=
        !          9762:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    9763:                       </li>
                   9764: 
                   9765:                       <li>
1.7     ! wiz      9766:                         <p><code class=
        !          9767:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    9768:                       </li>
                   9769:                     </ul>
                   9770:                   </div>
                   9771:                 </li>
                   9772: 
                   9773:                 <li>
                   9774:                   <p>Check the PLIST and remove any entries under
1.7     ! wiz      9775:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    9776:                   directory, as they will be handled
                   9777:                   automatically.</p>
                   9778:                 </li>
                   9779:               </ol>
                   9780:             </div>
                   9781:           </div>
                   9782: 
                   9783:           <div class="sect2" lang="en" xml:lang="en">
                   9784:             <div class="titlepage">
                   9785:               <div>
                   9786:                 <div>
1.7     ! wiz      9787:                   <h3 class="title"><a name="id2593718" id=
        !          9788:                   "id2593718"></a>12.5.15.&nbsp;Packages installing
1.1       grant    9789:                   SGML or XML data</h3>
                   9790:                 </div>
                   9791:               </div>
                   9792:             </div>
                   9793: 
                   9794:             <p>If a package installs SGML or XML data files that
                   9795:             need to be registered in system-wide catalogs (like
                   9796:             DTDs, sub-catalogs, etc.), you need to take some extra
                   9797:             steps:</p>
                   9798: 
                   9799:             <div class="orderedlist">
                   9800:               <ol type="1">
                   9801:                 <li>
1.7     ! wiz      9802:                   <p>Include <code class=
        !          9803:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
        !          9804:                   in your <code class="filename">Makefile</code>,
        !          9805:                   which takes care of registering those files in
1.1       grant    9806:                   system-wide catalogs at installation and
                   9807:                   deinstallation time.</p>
                   9808:                 </li>
                   9809: 
                   9810:                 <li>
1.7     ! wiz      9811:                   <p>Set <code class="varname">SGML_CATALOGS</code>
        !          9812:                   to the full path of any SGML catalogs installed
        !          9813:                   by the package.</p>
1.1       grant    9814:                 </li>
                   9815: 
                   9816:                 <li>
1.7     ! wiz      9817:                   <p>Set <code class="varname">XML_CATALOGS</code>
        !          9818:                   to the full path of any XML catalogs installed by
1.1       grant    9819:                   the package.</p>
                   9820:                 </li>
                   9821: 
                   9822:                 <li>
1.7     ! wiz      9823:                   <p>Set <code class="varname">SGML_ENTRIES</code>
        !          9824:                   to individual entries to be added to the SGML
1.1       grant    9825:                   catalog. These come in groups of three strings;
                   9826:                   see xmlcatmgr(1) for more information
                   9827:                   (specifically, arguments recognized by the 'add'
                   9828:                   action). Note that you will normally not use this
                   9829:                   variable.</p>
                   9830:                 </li>
                   9831: 
                   9832:                 <li>
1.7     ! wiz      9833:                   <p>Set <code class="varname">XML_ENTRIES</code>
        !          9834:                   to individual entries to be added to the XML
1.1       grant    9835:                   catalog. These come in groups of three strings;
                   9836:                   see xmlcatmgr(1) for more information
                   9837:                   (specifically, arguments recognized by the 'add'
                   9838:                   action). Note that you will normally not use this
                   9839:                   variable.</p>
                   9840:                 </li>
                   9841:               </ol>
                   9842:             </div>
                   9843:           </div>
                   9844: 
                   9845:           <div class="sect2" lang="en" xml:lang="en">
                   9846:             <div class="titlepage">
                   9847:               <div>
                   9848:                 <div>
1.7     ! wiz      9849:                   <h3 class="title"><a name="id2593770" id=
        !          9850:                   "id2593770"></a>12.5.16.&nbsp;Packages installing
1.1       grant    9851:                   extensions to the MIME database</h3>
                   9852:                 </div>
                   9853:               </div>
                   9854:             </div>
                   9855: 
                   9856:             <p>If a package provides extensions to the MIME
1.7     ! wiz      9857:             database by installing <code class=
        !          9858:             "filename">.xml</code> files inside <code class=
        !          9859:             "filename">${PREFIX}/share/mime/packages</code>, you
        !          9860:             need to take some extra steps to ensure that the
        !          9861:             database is kept consistent with respect to these new
        !          9862:             files:</p>
1.1       grant    9863: 
                   9864:             <div class="orderedlist">
                   9865:               <ol type="1">
                   9866:                 <li>
1.7     ! wiz      9867:                   <p>Include <code class=
        !          9868:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
        !          9869:                   (avoid using the <code class=
        !          9870:                   "filename">buildlink3.mk</code> file from this
        !          9871:                   same directory, which is reserved for inclusion
        !          9872:                   from other <code class=
        !          9873:                   "filename">buildlink3.mk</code> files). It takes
        !          9874:                   care of rebuilding the MIME database at
        !          9875:                   installation and deinstallation time, and
        !          9876:                   disallows any access to it directly from the
1.1       grant    9877:                   package.</p>
                   9878:                 </li>
                   9879: 
                   9880:                 <li>
                   9881:                   <p>Check the PLIST and remove any entries under
1.7     ! wiz      9882:                   the <code class="filename">share/mime</code>
1.1       grant    9883:                   directory, <span class=
                   9884:                   "emphasis"><em>except</em></span> for files saved
1.7     ! wiz      9885:                   under <code class=
        !          9886:                   "filename">share/mime/packages</code>. The former
1.1       grant    9887:                   are handled automatically by the
                   9888:                   update-mime-database program, but the later are
                   9889:                   package-dependent and must be removed by the
                   9890:                   package that installed them in the first
                   9891:                   place.</p>
                   9892:                 </li>
                   9893: 
                   9894:                 <li>
1.7     ! wiz      9895:                   <p>Remove any <code class=
        !          9896:                   "filename">share/mime/*</code> directories from
        !          9897:                   the PLIST. They will be handled by the
1.1       grant    9898:                   shared-mime-info package.</p>
                   9899:                 </li>
                   9900:               </ol>
                   9901:             </div>
                   9902:           </div>
                   9903: 
                   9904:           <div class="sect2" lang="en" xml:lang="en">
                   9905:             <div class="titlepage">
                   9906:               <div>
                   9907:                 <div>
1.7     ! wiz      9908:                   <h3 class="title"><a name="id2593841" id=
        !          9909:                   "id2593841"></a>12.5.17.&nbsp;Packages using
1.1       grant    9910:                   intltool</h3>
                   9911:                 </div>
                   9912:               </div>
                   9913:             </div>
                   9914: 
                   9915:             <p>If a package uses intltool during its build, include
1.7     ! wiz      9916:             the <code class=
        !          9917:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    9918:             file, which forces it to use the intltool package
                   9919:             provided by pkgsrc, instead of the one bundled with the
                   9920:             distribution file.</p>
                   9921: 
                   9922:             <p>This tracks intltool's build-time dependencies and
                   9923:             uses the latest available version; this way, the
                   9924:             package benefits of any bug fixes that may have
                   9925:             appeared since it was released.</p>
                   9926:           </div>
                   9927:         </div>
                   9928: 
                   9929:         <div class="sect1" lang="en" xml:lang="en">
                   9930:           <div class="titlepage">
                   9931:             <div>
                   9932:               <div>
                   9933:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      9934:                 "id2593854" id="id2593854"></a>12.6.&nbsp;Feedback
1.1       grant    9935:                 to the author</h2>
                   9936:               </div>
                   9937:             </div>
                   9938:           </div>
                   9939: 
                   9940:           <p>If you have found any bugs in the package you make
                   9941:           available, if you had to do special steps to make it run
                   9942:           under NetBSD or if you enhanced the software in various
                   9943:           other ways, be sure to report these changes back to the
                   9944:           original author of the program! With that kind of
                   9945:           support, the next release of the program can incorporate
                   9946:           these fixes, and people not using the NetBSD packages
                   9947:           system can win from your efforts.</p>
                   9948: 
                   9949:           <p>Support the idea of free software!</p>
                   9950:         </div>
                   9951:       </div>
                   9952: 
                   9953:       <div class="chapter" lang="en" xml:lang="en">
                   9954:         <div class="titlepage">
                   9955:           <div>
                   9956:             <div>
                   9957:               <h2 class="title"><a name="debug" id=
                   9958:               "debug"></a>Chapter&nbsp;13.&nbsp;Debugging</h2>
                   9959:             </div>
                   9960:           </div>
                   9961:         </div>
                   9962: 
                   9963:         <p>To check out all the gotchas when building a package,
                   9964:         here are the steps that I do in order to get a package
                   9965:         working. Please note this is basically the same as what was
                   9966:         explained in the previous sections, only with some
                   9967:         debugging aids.</p>
                   9968: 
                   9969:         <div class="itemizedlist">
                   9970:           <ul type="disc">
                   9971:             <li>
1.7     ! wiz      9972:               <p>Be sure to set <code class=
        !          9973:               "varname">PKG_DEVELOPER=1</code> in <code class=
        !          9974:               "filename">/etc/mk.conf</code></p>
1.1       grant    9975:             </li>
                   9976: 
                   9977:             <li>
                   9978:               <p>Install <a xmlns=
                   9979:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   9980:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.7     ! wiz      9981:               class="pkgname">pkgtools/url2pkg</a>, create a
        !          9982:               directory for a new package, change into it, then run
        !          9983:               <span><strong class=
        !          9984:               "command">url2pkg</strong></span>:</p>
1.1       grant    9985:               <pre class="screen">
1.7     ! wiz      9986: <code class="prompt">%</code> <strong class=
        !          9987: "userinput"><code>mkdir /usr/pkgsrc/<em class=
        !          9988: "replaceable"><code>category</code></em>/<em class=
        !          9989: "replaceable"><code>examplepkg</code></em></code></strong>
        !          9990: <code class="prompt">%</code> <strong class=
        !          9991: "userinput"><code>cd /usr/pkgsrc/<em class=
        !          9992: "replaceable"><code>category</code></em>/<em class=
        !          9993: "replaceable"><code>examplepkg</code></em></code></strong>
        !          9994: <code class="prompt">%</code> <strong class=
        !          9995: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    9996: </pre>
                   9997:             </li>
                   9998: 
                   9999:             <li>
1.7     ! wiz      10000:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    10001:               requested.</p>
                   10002:             </li>
                   10003: 
                   10004:             <li>
1.7     ! wiz      10005:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    10006:               file</p>
                   10007:             </li>
                   10008: 
                   10009:             <li>
1.7     ! wiz      10010:               <p>Run <span><strong class="command">make
        !          10011:               configure</strong></span></p>
1.1       grant    10012:             </li>
                   10013: 
                   10014:             <li>
                   10015:               <p>Add any dependencies glimpsed from documentation
1.7     ! wiz      10016:               and the configure step to the package's <code class=
        !          10017:               "filename">Makefile</code>.</p>
1.1       grant    10018:             </li>
                   10019: 
                   10020:             <li>
                   10021:               <p>Make the package compile, doing multiple rounds
                   10022:               of</p>
                   10023:               <pre class="screen">
1.7     ! wiz      10024: <code class="prompt">%</code> <strong class=
        !          10025: "userinput"><code>make</code></strong>
        !          10026: <code class="prompt">%</code> <strong class=
        !          10027: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
        !          10028: <code class="prompt">%</code> <strong class=
        !          10029: "userinput"><code>mkpatches</code></strong>
        !          10030: <code class="prompt">%</code> <strong class=
        !          10031: "userinput"><code>patchdiff</code></strong>
        !          10032: <code class="prompt">%</code> <strong class=
        !          10033: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
        !          10034: <code class="prompt">%</code> <strong class=
        !          10035: "userinput"><code>make mps</code></strong>
        !          10036: <code class="prompt">%</code> <strong class=
        !          10037: "userinput"><code>make clean</code></strong>
1.1       grant    10038: </pre>
                   10039: 
                   10040:               <p>Doing as non-root user will ensure that no files
                   10041:               are modified that shouldn't be, especially during the
1.7     ! wiz      10042:               build phase. <span><strong class=
        !          10043:               "command">mkpatches</strong></span>,
        !          10044:               <span><strong class=
        !          10045:               "command">patchdiff</strong></span> and
        !          10046:               <span><strong class="command">pkgvi</strong></span>
        !          10047:               are from the <a xmlns=
1.1       grant    10048:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10049:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.7     ! wiz      10050:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    10051:             </li>
                   10052: 
                   10053:             <li>
1.7     ! wiz      10054:               <p>Look at the <code class=
        !          10055:               "filename">Makefile</code>, fix if necessary; see
        !          10056:               <a href="#components.Makefile" title=
        !          10057:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
        !          10058:               &#8220;<code class=
        !          10059:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    10060:             </li>
                   10061: 
                   10062:             <li>
1.7     ! wiz      10063:               <p>Generate a <code class=
        !          10064:               "filename">PLIST</code>:</p>
1.1       grant    10065:               <pre class="screen">
1.7     ! wiz      10066: <code class="prompt">#</code> <strong class=
        !          10067: "userinput"><code>make install</code></strong>
        !          10068: <code class="prompt">#</code> <strong class=
        !          10069: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
        !          10070: <code class="prompt">#</code> <strong class=
        !          10071: "userinput"><code>make deinstall</code></strong>
        !          10072: <code class="prompt">#</code> <strong class=
        !          10073: "userinput"><code>make install</code></strong>
        !          10074: <code class="prompt">#</code> <strong class=
        !          10075: "userinput"><code>make deinstall</code></strong>
1.1       grant    10076: </pre>
                   10077: 
1.7     ! wiz      10078:               <p>You usually need to be <code class=
        !          10079:               "username">root</code> to do this. Look if there are
1.1       grant    10080:               any files left:</p>
                   10081:               <pre class="screen">
1.7     ! wiz      10082: <code class="prompt">#</code> <strong class=
        !          10083: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10084: </pre>
                   10085: 
                   10086:               <p>If this reveals any files that are missing in
1.7     ! wiz      10087:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    10088:             </li>
                   10089: 
                   10090:             <li>
1.7     ! wiz      10091:               <p>Now that the <code class="filename">PLIST</code>
        !          10092:               is OK, install the package again and make a binary
1.1       grant    10093:               package:</p>
                   10094:               <pre class="screen">
1.7     ! wiz      10095: <code class="prompt">#</code> <strong class=
        !          10096: "userinput"><code>make reinstall</code></strong>
        !          10097: <code class="prompt">#</code> <strong class=
        !          10098: "userinput"><code>make package</code></strong>
1.1       grant    10099: </pre>
                   10100:             </li>
                   10101: 
                   10102:             <li>
                   10103:               <p>Delete the installed package:</p>
                   10104:               <pre class="screen">
1.7     ! wiz      10105: <code class="prompt">#</code> <strong class=
        !          10106: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    10107: </pre>
                   10108:             </li>
                   10109: 
                   10110:             <li>
1.7     ! wiz      10111:               <p>Repeat the above <span><strong class=
        !          10112:               "command">make print-PLIST</strong></span> command,
        !          10113:               which shouldn't find anything now:</p>
1.1       grant    10114:               <pre class="screen">
1.7     ! wiz      10115: <code class="prompt">#</code> <strong class=
        !          10116: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10117: </pre>
                   10118:             </li>
                   10119: 
                   10120:             <li>
                   10121:               <p>Reinstall the binary package:</p>
                   10122:               <pre class="screen">
1.7     ! wiz      10123: <code class="prompt">#</code> <strong class=
        !          10124: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    10125: </pre>
                   10126:             </li>
                   10127: 
                   10128:             <li>
                   10129:               <p>Play with it. Make sure everything works.</p>
                   10130:             </li>
                   10131: 
                   10132:             <li>
1.7     ! wiz      10133:               <p>Run <span><strong class=
        !          10134:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    10135:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10136:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.7     ! wiz      10137:               class="pkgname">pkgtools/pkglint</a>, and fix the
        !          10138:               problems it reports:</p>
1.1       grant    10139:               <pre class="screen">
1.7     ! wiz      10140: <code class="prompt">#</code> <strong class=
        !          10141: "userinput"><code>pkglint</code></strong>
1.1       grant    10142: </pre>
                   10143:             </li>
                   10144: 
                   10145:             <li>
                   10146:               <p>Submit (or commit, if you have cvs access); see
                   10147:               <a href="#submit" title=
                   10148:               "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter&nbsp;14,
                   10149:               <i>Submitting and Committing</i></a>.</p>
                   10150:             </li>
                   10151:           </ul>
                   10152:         </div>
                   10153:       </div>
                   10154: 
                   10155:       <div class="chapter" lang="en" xml:lang="en">
                   10156:         <div class="titlepage">
                   10157:           <div>
                   10158:             <div>
                   10159:               <h2 class="title"><a name="submit" id=
                   10160:               "submit"></a>Chapter&nbsp;14.&nbsp;Submitting and
                   10161:               Committing</h2>
                   10162:             </div>
                   10163:           </div>
                   10164:         </div>
                   10165: 
                   10166:         <div class="toc">
                   10167:           <p><b>Table of Contents</b></p>
                   10168: 
                   10169:           <dl>
1.7     ! wiz      10170:             <dt><span class="sect1"><a href="#id2594385">14.1.
1.1       grant    10171:             Submitting your packages</a></span></dt>
                   10172: 
1.7     ! wiz      10173:             <dt><span class="sect1"><a href="#id2594432">14.2.
1.1       grant    10174:             Committing: Importing a package into
                   10175:             CVS</a></span></dt>
                   10176: 
1.7     ! wiz      10177:             <dt><span class="sect1"><a href="#id2594563">14.3.
1.2       hubertf  10178:             Updating a package to a newer version</a></span></dt>
1.1       grant    10179: 
1.7     ! wiz      10180:             <dt><span class="sect1"><a href="#id2594582">14.4.
1.2       hubertf  10181:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    10182:           </dl>
                   10183:         </div>
                   10184: 
                   10185:         <div class="sect1" lang="en" xml:lang="en">
                   10186:           <div class="titlepage">
                   10187:             <div>
                   10188:               <div>
                   10189:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      10190:                 "id2594385" id=
        !          10191:                 "id2594385"></a>14.1.&nbsp;Submitting your
1.1       grant    10192:                 packages</h2>
                   10193:               </div>
                   10194:             </div>
                   10195:           </div>
                   10196: 
                   10197:           <p>You have to separate between binary and
                   10198:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   10199:           packages here:</p>
                   10200: 
                   10201:           <div class="itemizedlist">
                   10202:             <ul type="disc">
                   10203:               <li>
                   10204:                 <p>precompiled binary packages</p>
                   10205: 
                   10206:                 <p>Our policy is that we accept binaries only from
                   10207:                 pkgsrc developers to guarantee that the packages
                   10208:                 don't contain any trojan horses etc. This is not to
                   10209:                 piss anyone off but rather to protect our users!
                   10210:                 You're still free to put up your home-made binary
                   10211:                 packages and tell the world where to get them.</p>
                   10212:               </li>
                   10213: 
                   10214:               <li>
                   10215:                 <p>packages</p>
                   10216: 
                   10217:                 <p>First, check that your package is complete,
                   10218:                 compiles and runs well; see <a href="#debug" title=
                   10219:                 "Chapter&nbsp;13.&nbsp;Debugging">Chapter&nbsp;13,
                   10220:                 <i>Debugging</i></a> and the rest of this document.
                   10221:                 Next, generate an uuencoded gzipped tar(1) archive,
                   10222:                 preferably with all files in a single directory.
1.7     ! wiz      10223:                 Finally, <span><strong class=
        !          10224:                 "command">send-pr</strong></span> with category
1.1       grant    10225:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   10226:                 synopsis which includes the package name and
                   10227:                 version number, a short description of your package
                   10228:                 (contents of the COMMENT variable or DESCR file are
                   10229:                 OK) and attach the archive to your PR.</p>
                   10230: 
                   10231:                 <p>If you want to submit several packages, please
                   10232:                 send a separate PR for each one, it's easier for us
                   10233:                 to track things that way.</p>
                   10234: 
                   10235:                 <p>Alternatively, you can also import new packages
                   10236:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   10237:                 work-in-progress</span>&#8221;); see the homepage
                   10238:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   10239:                 target=
                   10240:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   10241:                 details.</p>
                   10242:               </li>
                   10243:             </ul>
                   10244:           </div>
                   10245:         </div>
                   10246: 
                   10247:         <div class="sect1" lang="en" xml:lang="en">
                   10248:           <div class="titlepage">
                   10249:             <div>
                   10250:               <div>
                   10251:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      10252:                 "id2594432" id=
        !          10253:                 "id2594432"></a>14.2.&nbsp;Committing: Importing a
1.1       grant    10254:                 package into CVS</h2>
                   10255:               </div>
                   10256:             </div>
                   10257:           </div>
                   10258: 
                   10259:           <p>This section is only of interest for pkgsrc developers
                   10260:           with write access to the pkgsrc repository. Please
                   10261:           remember that cvs imports files relative to the current
                   10262:           working directory, and that the pathname that you give
1.7     ! wiz      10263:           the <span><strong class="command">cvs
        !          10264:           import</strong></span> command is so that it knows where
        !          10265:           to place the files in the repository. Newly created
        !          10266:           packages should be imported with a vendor tag of
        !          10267:           &#8220;<span class="quote">TNF</span>&#8221; and a
        !          10268:           release tag of &#8220;<span class=
        !          10269:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    10270:           <pre class="programlisting">
                   10271:   % cd .../pkgsrc/category/pkgname
                   10272:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   10273: </pre>
                   10274: 
                   10275:           <p>Remember to move the directory from which you imported
                   10276:           out of the way, or cvs will complain the next time you
                   10277:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   10278:           source tree. Also don't forget to add the new package to
1.7     ! wiz      10279:           the category's <code class=
        !          10280:           "filename">Makefile</code>.</p>
1.1       grant    10281: 
                   10282:           <p>The commit message of the initial import should
1.7     ! wiz      10283:           include part of the <code class="filename">DESCR</code>
        !          10284:           file, so people reading the mailing lists know what the
        !          10285:           package is/does.</p>
1.1       grant    10286: 
                   10287:           <p>Please note all package updates/additions in
1.7     ! wiz      10288:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
        !          10289:           very important to keep this file up to date and
        !          10290:           conforming to the existing format, because it will be
        !          10291:           used by scripts to automatically update pages on <a href=
1.1       grant    10292:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   10293:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   10294:           file and remove the entry for the package you updated, in
                   10295:           case it was mentioned there.</p>
                   10296: 
                   10297:           <p>For new packages, &#8220;<span class="quote">cvs
                   10298:           import</span>&#8221; is preferred to &#8220;<span class=
                   10299:           "quote">cvs add</span>&#8221; because the former gets
                   10300:           everything with a single command, and provides a
                   10301:           consistent tag.</p>
                   10302:         </div>
                   10303: 
                   10304:         <div class="sect1" lang="en" xml:lang="en">
                   10305:           <div class="titlepage">
                   10306:             <div>
                   10307:               <div>
                   10308:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      10309:                 "id2594563" id="id2594563"></a>14.3.&nbsp;Updating
1.2       hubertf  10310:                 a package to a newer version</h2>
1.1       grant    10311:               </div>
                   10312:             </div>
                   10313:           </div>
                   10314: 
                   10315:           <p>Please always put a concise, appropriate and relevant
                   10316:           summary of the changes between old and new versions into
                   10317:           the commit log when updating a package. There are various
                   10318:           reasons for this:</p>
                   10319: 
                   10320:           <div class="itemizedlist">
                   10321:             <ul type="disc">
                   10322:               <li>
                   10323:                 <p>A URL is volatile, and can change over time. It
                   10324:                 may go away completely or its information may be
                   10325:                 overwritten by newer information.</p>
                   10326:               </li>
                   10327: 
                   10328:               <li>
                   10329:                 <p>Having the change information between old and
                   10330:                 new versions in our CVS repository is very useful
                   10331:                 for people who use either cvs or anoncvs.</p>
                   10332:               </li>
                   10333: 
                   10334:               <li>
                   10335:                 <p>Having the change information between old and
                   10336:                 new versions in our CVS repository is very useful
                   10337:                 for people who read the pkgsrc-changes mailing
                   10338:                 list, so that they can make tactical decisions
                   10339:                 about when to upgrade the package.</p>
                   10340:               </li>
                   10341:             </ul>
                   10342:           </div>
                   10343: 
                   10344:           <p>Please also recognise that, just because a new version
                   10345:           of a package has been released, it should not
                   10346:           automatically be upgraded in the CVS repository. We
                   10347:           prefer to be conservative in the packages that are
                   10348:           included in pkgsrc - development or beta packages are not
                   10349:           really the best thing for most places in which pkgsrc is
                   10350:           used. Please use your judgement about what should go into
                   10351:           pkgsrc, and bear in mind that stability is to be
                   10352:           preferred above new and possibly untested features.</p>
                   10353:         </div>
                   10354: 
                   10355:         <div class="sect1" lang="en" xml:lang="en">
                   10356:           <div class="titlepage">
                   10357:             <div>
                   10358:               <div>
                   10359:                 <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      10360:                 "id2594582" id="id2594582"></a>14.4.&nbsp;Moving a
1.2       hubertf  10361:                 package in pkgsrc</h2>
1.1       grant    10362:               </div>
                   10363:             </div>
                   10364:           </div>
                   10365: 
                   10366:           <div class="orderedlist">
                   10367:             <ol type="1">
                   10368:               <li>
                   10369:                 <p>Make a copy of the directory somewhere else.</p>
                   10370:               </li>
                   10371: 
                   10372:               <li>
                   10373:                 <p>Remove all CVS dirs.</p>
                   10374: 
                   10375:                 <p>Alternatively to the first two steps you can
                   10376:                 also do:</p>
                   10377:                 <pre class="screen">
1.7     ! wiz      10378: <code class="prompt">%</code> <strong class=
        !          10379: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    10380: </pre>
                   10381: 
                   10382:                 <p>and use that for further work.</p>
                   10383:               </li>
                   10384: 
                   10385:               <li>
1.7     ! wiz      10386:                 <p>Fix <code class="varname">CATEGORIES</code> and
        !          10387:                 any <code class="varname">DEPENDS</code> paths that
        !          10388:                 just did &#8220;<span class=
1.1       grant    10389:                 "quote">../package</span>&#8221; instead of
                   10390:                 &#8220;<span class=
                   10391:                 "quote">../../category/package</span>&#8221;.</p>
                   10392:               </li>
                   10393: 
                   10394:               <li>
1.7     ! wiz      10395:                 <p><span><strong class="command">cvs
        !          10396:                 import</strong></span> the modified package in the
        !          10397:                 new place.</p>
1.1       grant    10398:               </li>
                   10399: 
                   10400:               <li>
                   10401:                 <p>Check if any package depends on it:</p>
                   10402:                 <pre class="screen">
1.7     ! wiz      10403: <code class="prompt">%</code> <strong class=
        !          10404: "userinput"><code>cd /usr/pkgsrc</code></strong>
        !          10405: <code class="prompt">%</code> <strong class=
        !          10406: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    10407: </pre>
                   10408:               </li>
                   10409: 
                   10410:               <li>
                   10411:                 <p>Fix paths in packages from step 5 to point to
                   10412:                 new location.</p>
                   10413:               </li>
                   10414: 
                   10415:               <li>
1.7     ! wiz      10416:                 <p><span><strong class="command">cvs rm
        !          10417:                 (-f)</strong></span> the package at the old
        !          10418:                 location.</p>
1.1       grant    10419:               </li>
                   10420: 
                   10421:               <li>
1.7     ! wiz      10422:                 <p>Remove from <code class=
        !          10423:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    10424:               </li>
                   10425: 
                   10426:               <li>
1.7     ! wiz      10427:                 <p>Add to <code class=
        !          10428:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    10429:               </li>
                   10430: 
                   10431:               <li>
                   10432:                 <p>Commit the changed and removed files:</p>
                   10433:                 <pre class="screen">
1.7     ! wiz      10434: <code class="prompt">%</code> <strong class=
        !          10435: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    10436: </pre>
                   10437: 
                   10438:                 <p>(and any packages from step 5, of course).</p>
                   10439:               </li>
                   10440:             </ol>
                   10441:           </div>
                   10442:         </div>
                   10443:       </div>
                   10444:     </div>
                   10445: 
                   10446:     <div class="appendix" lang="en" xml:lang="en">
                   10447:       <div class="titlepage">
                   10448:         <div>
                   10449:           <div>
                   10450:             <h2 class="title"><a name="examples" id=
                   10451:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   10452:             package: bison</h2>
                   10453:           </div>
                   10454:         </div>
                   10455:       </div>
                   10456: 
                   10457:       <div class="toc">
                   10458:         <p><b>Table of Contents</b></p>
                   10459: 
                   10460:         <dl>
1.7     ! wiz      10461:           <dt><span class="sect1"><a href="#id2594808">A.1.
1.1       grant    10462:           files</a></span></dt>
                   10463: 
                   10464:           <dd>
                   10465:             <dl>
1.7     ! wiz      10466:               <dt><span class="sect2"><a href="#id2594811">A.1.1.
1.1       grant    10467:               Makefile</a></span></dt>
                   10468: 
1.7     ! wiz      10469:               <dt><span class="sect2"><a href="#id2594887">A.1.2.
1.1       grant    10470:               DESCR</a></span></dt>
                   10471: 
1.7     ! wiz      10472:               <dt><span class="sect2"><a href="#id2594902">A.1.3.
1.1       grant    10473:               PLIST</a></span></dt>
                   10474: 
1.7     ! wiz      10475:               <dt><span class="sect2"><a href="#id2594909">A.1.4.
        !          10476:               Checking a package with <span><strong class=
        !          10477:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    10478:             </dl>
                   10479:           </dd>
                   10480: 
1.7     ! wiz      10481:           <dt><span class="sect1"><a href="#id2594950">A.2. Steps
1.1       grant    10482:           for building, installing, packaging</a></span></dt>
                   10483:         </dl>
                   10484:       </div>
                   10485: 
                   10486:       <p>We checked to find a piece of software that wasn't in the
                   10487:       packages collection, and picked GNU bison. Quite why someone
1.7     ! wiz      10488:       would want to have <span><strong class=
        !          10489:       "command">bison</strong></span> when Berkeley
        !          10490:       <span><strong class="command">yacc</strong></span> is already
        !          10491:       present in the tree is beyond us, but it's useful for the
        !          10492:       purposes of this exercise.</p>
1.1       grant    10493: 
                   10494:       <div class="sect1" lang="en" xml:lang="en">
                   10495:         <div class="titlepage">
                   10496:           <div>
                   10497:             <div>
                   10498:               <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      10499:               "id2594808" id="id2594808"></a>A.1.&nbsp;files</h2>
1.1       grant    10500:             </div>
                   10501:           </div>
                   10502:         </div>
                   10503: 
                   10504:         <div class="sect2" lang="en" xml:lang="en">
                   10505:           <div class="titlepage">
                   10506:             <div>
                   10507:               <div>
1.7     ! wiz      10508:                 <h3 class="title"><a name="id2594811" id=
        !          10509:                 "id2594811"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    10510:               </div>
                   10511:             </div>
                   10512:           </div>
                   10513:           <pre class="programlisting">
                   10514: # $NetBSD$
                   10515: #
                   10516: 
                   10517: DISTNAME=       bison-1.25
                   10518: CATEGORIES=     devel
                   10519: MASTER_SITES=   ${MASTER_SITE_GNU}
                   10520: 
                   10521: MAINTAINER=     thorpej@NetBSD.org
                   10522: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   10523: COMMENT=        GNU yacc clone
                   10524: 
                   10525: GNU_CONFIGURE=  yes
                   10526: INFO_FILES=     bison.info
                   10527: 
                   10528: .include "../../mk/bsd.pkg.mk"
                   10529: </pre>
                   10530:         </div>
                   10531: 
                   10532:         <div class="sect2" lang="en" xml:lang="en">
                   10533:           <div class="titlepage">
                   10534:             <div>
                   10535:               <div>
1.7     ! wiz      10536:                 <h3 class="title"><a name="id2594887" id=
        !          10537:                 "id2594887"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    10538:               </div>
                   10539:             </div>
                   10540:           </div>
                   10541:           <pre class="programlisting">
                   10542: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   10543: improvements.  Why you would want this when Berkeley <a href=
                   10544: "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
                   10545: of the NetBSD source tree is beyond me.
                   10546: </pre>
                   10547:         </div>
                   10548: 
                   10549:         <div class="sect2" lang="en" xml:lang="en">
                   10550:           <div class="titlepage">
                   10551:             <div>
                   10552:               <div>
1.7     ! wiz      10553:                 <h3 class="title"><a name="id2594902" id=
        !          10554:                 "id2594902"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    10555:               </div>
                   10556:             </div>
                   10557:           </div>
                   10558:           <pre class="programlisting">
                   10559: @comment $NetBSD$
                   10560: bin/bison
                   10561: man/man1/bison.1.gz
                   10562: info/bison.info
                   10563: info/bison.info-1
                   10564: info/bison.info-2
                   10565: info/bison.info-3
                   10566: info/bison.info-4
                   10567: info/bison.info-5
                   10568: share/bison.simple
                   10569: share/bison.hairy
                   10570: </pre>
                   10571:         </div>
                   10572: 
                   10573:         <div class="sect2" lang="en" xml:lang="en">
                   10574:           <div class="titlepage">
                   10575:             <div>
                   10576:               <div>
1.7     ! wiz      10577:                 <h3 class="title"><a name="id2594909" id=
        !          10578:                 "id2594909"></a>A.1.4.&nbsp;Checking a package with
        !          10579:                 <span><strong class=
        !          10580:                 "command">pkglint</strong></span></h3>
1.1       grant    10581:               </div>
                   10582:             </div>
                   10583:           </div>
                   10584: 
                   10585:           <p>The NetBSD package system comes with <a xmlns=
                   10586:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   10587:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.7     ! wiz      10588:           class="pkgname">pkgtools/pkglint</a> which helps to check
        !          10589:           the contents of these files. After installation it is
        !          10590:           quite easy to use, just change to the directory of the
        !          10591:           package you wish to examine and execute
        !          10592:           <span><strong class=
        !          10593:           "command">pkglint</strong></span>:</p>
1.1       grant    10594:           <pre class="screen">
1.7     ! wiz      10595: <code class="prompt">$</code> <strong class=
        !          10596: "userinput"><code>pkglint</code></strong>
1.1       grant    10597: OK: checking ./DESCR.
                   10598: OK: checking Makefile.
                   10599: OK: checking distinfo.
                   10600: OK: checking patches/patch-aa.
                   10601: looks fine.
                   10602: </pre>
                   10603: 
                   10604:           <p>Depending on the supplied command line arguments (see
                   10605:           pkglint(1)) more verbose checks will be performed. Use
1.7     ! wiz      10606:           e.g. <span><strong class="command">pkglint
        !          10607:           -v</strong></span> for a very verbose check.</p>
1.1       grant    10608:         </div>
                   10609:       </div>
                   10610: 
                   10611:       <div class="sect1" lang="en" xml:lang="en">
                   10612:         <div class="titlepage">
                   10613:           <div>
                   10614:             <div>
                   10615:               <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      10616:               "id2594950" id="id2594950"></a>A.2.&nbsp;Steps for
1.1       grant    10617:               building, installing, packaging</h2>
                   10618:             </div>
                   10619:           </div>
                   10620:         </div>
                   10621: 
                   10622:         <p>Create the directory where the package lives, plus any
                   10623:         auxiliary directories:</p>
                   10624:         <pre class="screen">
1.7     ! wiz      10625: <code class="prompt">#</code> <strong class=
        !          10626: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
        !          10627: <code class="prompt">#</code> <strong class=
        !          10628: "userinput"><code>mkdir bison</code></strong>
        !          10629: <code class="prompt">#</code> <strong class=
        !          10630: "userinput"><code>cd bison</code></strong>
        !          10631: <code class="prompt">#</code> <strong class=
        !          10632: "userinput"><code>mkdir patches</code></strong>
1.1       grant    10633: </pre>
                   10634: 
1.7     ! wiz      10635:         <p>Create <code class="filename">Makefile</code>,
        !          10636:         <code class="filename">DESCR</code> and <code class=
        !          10637:         "filename">PLIST</code> (see <a href="#components" title=
1.1       grant    10638:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   10639:         Chapter 7, <i>Package components - files, directories and
                   10640:         contents</i></a>) then continue with fetching the
                   10641:         distfile:</p>
                   10642:         <pre class="screen">
1.7     ! wiz      10643: <code class="prompt">#</code> <strong class=
        !          10644: "userinput"><code>make fetch</code></strong>
1.1       grant    10645: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   10646: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   10647: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10648: ftp: Error retrieving file: 500 Internal error
                   10649: 
                   10650: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   10651: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10652: ftp: Error retrieving file: 500 Internal error
                   10653: 
                   10654: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   10655: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10656: Successfully retrieved file.
                   10657: </pre>
                   10658: 
1.7     ! wiz      10659:         <p>Generate the checksum of the distfile into <code class=
        !          10660:         "filename">distinfo</code>:</p>
1.1       grant    10661:         <pre class="screen">
1.7     ! wiz      10662: <code class="prompt">#</code> <strong class=
        !          10663: "userinput"><code>make makesum</code></strong>
1.1       grant    10664: </pre>
                   10665: 
                   10666:         <p>Now compile:</p>
                   10667:         <pre class="screen">
1.7     ! wiz      10668: <code class="prompt">#</code> <strong class=
        !          10669: "userinput"><code>make</code></strong>
1.1       grant    10670: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10671: ===&gt;  Extracting for bison-1.25
                   10672: ===&gt;  Patching for bison-1.25
                   10673: ===&gt;   Ignoring empty patch directory
                   10674: ===&gt;  Configuring for bison-1.25
                   10675: creating cache ./config.cache
                   10676: checking for gcc... cc
                   10677: checking whether we are using GNU C... yes
                   10678: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   10679: checking how to run the C preprocessor... cc -E
                   10680: checking for minix/config.h... no
                   10681: checking for POSIXized ISC... no
                   10682: checking whether cross-compiling... no
                   10683: checking for ANSI C header files... yes
                   10684: checking for string.h... yes
                   10685: checking for stdlib.h... yes
                   10686: checking for memory.h... yes
                   10687: checking for working const... yes
                   10688: checking for working alloca.h... no
                   10689: checking for alloca... yes
                   10690: checking for strerror... yes
                   10691: updating cache ./config.cache
                   10692: creating ./config.status
                   10693: creating Makefile
                   10694: ===&gt;  Building for bison-1.25
                   10695: 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
                   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 allocate.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 closure.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 conflicts.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 derives.c
                   10700: 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 
                   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 getargs.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 gram.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 lalr.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 lex.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 main.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 nullable.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 output.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 print.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 reader.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 reduce.c
                   10711: 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
                   10712: 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
                   10713: 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
                   10714: 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
                   10715: 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
                   10716: 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
                   10717: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   10718: rm -f bison.s1
                   10719: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   10720: </pre>
                   10721: 
                   10722:         <p>Everything seems OK, so install the files:</p>
                   10723:         <pre class="screen">
1.7     ! wiz      10724: <code class="prompt">#</code> <strong class=
        !          10725: "userinput"><code>make install</code></strong>
1.1       grant    10726: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10727: ===&gt;  Installing for bison-1.25
                   10728: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   10729: rm -f /usr/pkg/bin/bison
                   10730: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   10731: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   10732: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   10733: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   10734: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   10735: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   10736: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   10737: ===&gt;  Registering installation for bison-1.25
                   10738: </pre>
                   10739: 
                   10740:         <p>You can now use bison, and also - if you decide so -
1.7     ! wiz      10741:         remove it with <span><strong class="command">pkg_delete
        !          10742:         bison</strong></span>. Should you decide that you want a
        !          10743:         binary package, do this now:</p>
1.1       grant    10744:         <pre class="screen">
1.7     ! wiz      10745: <code class="prompt">#</code> <strong class=
        !          10746: "userinput"><code>make package</code></strong>
1.1       grant    10747: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10748: ===&gt;  Building package for bison-1.25
                   10749: Creating package bison-1.25.tgz
                   10750: Registering depends:.
                   10751: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   10752: </pre>
                   10753: 
                   10754:         <p>Now that you don't need the source and object files any
                   10755:         more, clean up:</p>
                   10756:         <pre class="screen">
1.7     ! wiz      10757: <code class="prompt">#</code> <strong class=
        !          10758: "userinput"><code>make clean</code></strong>
1.1       grant    10759: ===&gt;  Cleaning for bison-1.25
                   10760: </pre>
                   10761:       </div>
                   10762:     </div>
                   10763: 
                   10764:     <div class="appendix" lang="en" xml:lang="en">
                   10765:       <div class="titlepage">
                   10766:         <div>
                   10767:           <div>
                   10768:             <h2 class="title"><a name="logs" id=
                   10769:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   10770:           </div>
                   10771:         </div>
                   10772:       </div>
                   10773: 
                   10774:       <div class="toc">
                   10775:         <p><b>Table of Contents</b></p>
                   10776: 
                   10777:         <dl>
                   10778:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   10779:           Building figlet</a></span></dt>
                   10780: 
                   10781:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   10782:           Packaging figlet</a></span></dt>
                   10783:         </dl>
                   10784:       </div>
                   10785: 
                   10786:       <div class="sect1" lang="en" xml:lang="en">
                   10787:         <div class="titlepage">
                   10788:           <div>
                   10789:             <div>
                   10790:               <h2 class="title" style="clear: both"><a name=
                   10791:               "logs.building" id=
                   10792:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   10793:             </div>
                   10794:           </div>
                   10795:         </div>
                   10796:         <pre class="screen">
1.7     ! wiz      10797: <code class="prompt">#</code> <strong class=
        !          10798: "userinput"><code>make</code></strong>
1.1       grant    10799: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10800: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   10801: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   10802: =&gt; [172219 bytes]
                   10803: Connected to ftp.plig.net.
                   10804: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   10805: 331 Guest login ok, send your complete e-mail address as password.
                   10806: 230-You are user #5 of 500 simultaneous users allowed.
                   10807: 230-
                   10808: 230-  ___ _             _ _                   
                   10809: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   10810: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   10811: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   10812: 230-         |_|   |_|     |___|         |___|
                   10813: 230-
                   10814: 230-** Welcome to ftp.plig.org **
                   10815: 230-
                   10816: 230-Please note that all transfers from this FTP site are logged. If you
                   10817: 230-do not like this, please disconnect now.
                   10818: 230-
                   10819: 230-This arhive is available via
                   10820: 230-
                   10821: 230-HTTP:  http://ftp.plig.org/
                   10822: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   10823: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   10824: 230-
                   10825: 230-Please email comments, bug reports and requests for packages to be
                   10826: 230-mirrored to ftp-admin@plig.org.   
                   10827: 230-
                   10828: 230-
                   10829: 230 Logged in anonymously.
                   10830: Remote system type is UNIX.
                   10831: Using binary mode to transfer files.
                   10832: 200 Type okay.
                   10833: 250 "/pub" is new cwd.
                   10834: 250-"/pub/figlet" is new cwd.
                   10835: 250-
                   10836: 250-Welcome to the figlet archive at ftp.figlet.org
                   10837: 250-    
                   10838: 250-    ftp://ftp.figlet.org/pub/figlet/
                   10839: 250-
                   10840: 250-The official FIGlet web page is:
                   10841: 250-    http://www.figlet.org/
                   10842: 250-
                   10843: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   10844: 250-contribute a font or something else, you can email us.
                   10845: 250 
                   10846: 250 "/pub/figlet/program" is new cwd.
                   10847: 250 "/pub/figlet/program/unix" is new cwd.
                   10848: local: figlet221.tar.gz remote: figlet221.tar.gz
                   10849: 502 Unimplemented command.
                   10850: 227 Entering Passive Mode (195,40,6,41,246,104)
                   10851: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   10852: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   10853: 226 Transfer completed.
                   10854: 172219 bytes received in 00:02 (75.99 KB/s)
                   10855: 221 Goodbye.
                   10856: =&gt; Checksum OK for figlet221.tar.gz.
                   10857: ===&gt; Extracting for figlet-2.2.1nb2
                   10858: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   10859: ===&gt; Patching for figlet-2.2.1nb2
                   10860: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   10861: ===&gt; Overriding tools for figlet-2.2.1nb2
                   10862: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   10863: ===&gt; Configuring for figlet-2.2.1nb2
                   10864: ===&gt; Building for figlet-2.2.1nb2
                   10865: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   10866: chmod a+x figlet
                   10867: gcc -O2 -o chkfont chkfont.c
                   10868: =&gt; Unwrapping files-to-be-installed.
1.7     ! wiz      10869: <code class="prompt">#</code>
        !          10870: <code class="prompt">#</code> <strong class=
        !          10871: "userinput"><code>make install</code></strong>
1.1       grant    10872: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10873: ===&gt; Installing for figlet-2.2.1nb2
                   10874: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   10875: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   10876: mkdir -p /usr/pkg/share/figlet
                   10877: cp figlet /usr/pkg/bin
                   10878: cp chkfont /usr/pkg/bin
                   10879: chmod 555 figlist showfigfonts
                   10880: cp figlist /usr/pkg/bin
                   10881: cp showfigfonts /usr/pkg/bin
                   10882: cp fonts/*.flf /usr/pkg/share/figlet
                   10883: cp fonts/*.flc /usr/pkg/share/figlet
                   10884: cp figlet.6 /usr/pkg/man/man6
                   10885: ===&gt; Registering installation for figlet-2.2.1nb2
1.7     ! wiz      10886: <code class="prompt">#</code>
1.1       grant    10887: </pre>
                   10888:       </div>
                   10889: 
                   10890:       <div class="sect1" lang="en" xml:lang="en">
                   10891:         <div class="titlepage">
                   10892:           <div>
                   10893:             <div>
                   10894:               <h2 class="title" style="clear: both"><a name=
                   10895:               "logs.package" id=
                   10896:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   10897:             </div>
                   10898:           </div>
                   10899:         </div>
                   10900:         <pre class="screen">
1.7     ! wiz      10901: <code class="prompt">#</code> <strong class=
        !          10902: "userinput"><code>make package</code></strong>
1.1       grant    10903: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10904: ===&gt; Packaging figlet-2.2.1nb2
                   10905: ===&gt; Building binary package for figlet-2.2.1nb2
                   10906: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   10907: Using SrcDir value of /usr/pkg
                   10908: Registering depends:.  
1.7     ! wiz      10909: <code class="prompt">#</code>
1.1       grant    10910: </pre>
                   10911:       </div>
                   10912:     </div>
                   10913: 
                   10914:     <div class="appendix" lang="en" xml:lang="en">
                   10915:       <div class="titlepage">
                   10916:         <div>
                   10917:           <div>
                   10918:             <h2 class="title"><a name="ftp-layout" id=
                   10919:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   10920:             FTP server's package archive</h2>
                   10921:           </div>
                   10922:         </div>
                   10923:       </div>
                   10924: 
                   10925:       <p>Layout for precompiled binary packages on
                   10926:       ftp.NetBSD.org:</p>
                   10927:       <pre class="programlisting">
                   10928: /pub/NetBSD/packages/
                   10929:                 distfiles/
                   10930: 
                   10931:                 # Unpacked pkgsrc trees
                   10932:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   10933:                 pkgsrc-2003Q4 -&gt; N/A
                   10934:                 pkgsrc-2004Q1/pkgsrc
                   10935: 
                   10936:                 # pkgsrc archives
                   10937:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   10938:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   10939:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   10940: 
                   10941:                 # Per pkgsrc-release/OS-release/arch package archives
                   10942:                 pkgsrc-2003Q4/
                   10943:                         NetBSD-1.6.2/
                   10944:                                 i386/
                   10945:                                         All/
                   10946:                                         archivers/
                   10947:                                                 foo -&gt; ../All/foo
                   10948:                                         ...
                   10949:                 pkgsrc-2004Q1/
                   10950:                         NetBSD-1.6.2/
                   10951:                                 i386/
                   10952:                                         All/
                   10953:                                         ...
                   10954:                         NetBSD-2.0/
                   10955:                                 i386/
                   10956:                                         All/
                   10957:                                         ...
                   10958:                         SunOS-5.9/
                   10959:                                 sparc/
                   10960:                                         All/
                   10961:                                         ...
                   10962:                                 x86/
                   10963:                                         All/
                   10964:                                         ...
                   10965: 
                   10966:                 # Per os-release package archive convenience links
                   10967:                 NetBSD-1.6.2 -&gt; 1.6.2
                   10968:                 1.6.2/
                   10969:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   10970:                         m68k/
                   10971:                                 All/
                   10972:                                 archivers/
                   10973:                                         foo -&gt; ../All/foo
                   10974:                                 ...
                   10975:                         amiga -&gt; m68k
                   10976:                         atari -&gt; m68k
                   10977:                         ...
                   10978: 
                   10979:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   10980:                 NetBSD-2.0/
                   10981:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   10982:                 SunOS-5.9/
                   10983:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   10984:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   10985:                         
                   10986: </pre>
                   10987: 
                   10988:       <p>To create:</p>
                   10989: 
                   10990:       <div class="orderedlist">
                   10991:         <ol type="1">
                   10992:           <li>
                   10993:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   10994:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   10995:             5.3, &#8220;Doing a bulk build of all
                   10996:             packages&#8221;</a></p>
                   10997:           </li>
                   10998: 
                   10999:           <li>
                   11000:             <p>Upload /usr/pkgsrc/packages to</p>
                   11001:             <pre class="programlisting">
                   11002:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
                   11003:         pkgsrc-2004Q3/\                         # pkgsrc-branch
                   11004:         `uname -s`-`uname -r`/                  # OS &amp; version
                   11005:         `uname -p`                              # architecture
                   11006:        
                   11007: </pre>
                   11008:           </li>
                   11009: 
                   11010:           <li>
1.7     ! wiz      11011:             <p>If necessary, create a symlink <span><strong class=
        !          11012:             "command">ln -s `uname -m` `uname -p`</strong></span>
        !          11013:             (amiga -&gt; m68k, ...)</p>
1.1       grant    11014:           </li>
                   11015:         </ol>
                   11016:       </div>
                   11017:     </div>
1.2       hubertf  11018: 
                   11019:     <div class="appendix" lang="en" xml:lang="en">
                   11020:       <div class="titlepage">
                   11021:         <div>
                   11022:           <div>
                   11023:             <h2 class="title"><a name="editing" id=
                   11024:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   11025:             for the pkgsrc guide</h2>
                   11026:           </div>
                   11027:         </div>
                   11028:       </div>
                   11029: 
                   11030:       <div class="toc">
                   11031:         <p><b>Table of Contents</b></p>
                   11032: 
                   11033:         <dl>
1.7     ! wiz      11034:           <dt><span class="sect1"><a href="#id2595665">D.1.
1.2       hubertf  11035:           Targets</a></span></dt>
                   11036: 
1.7     ! wiz      11037:           <dt><span class="sect1"><a href="#id2595940">D.2.
1.2       hubertf  11038:           Procedure</a></span></dt>
                   11039:         </dl>
                   11040:       </div>
                   11041: 
                   11042:       <p>This section contains information on editing the pkgsrc
                   11043:       guide itself.</p>
                   11044: 
                   11045:       <div class="sect1" lang="en" xml:lang="en">
                   11046:         <div class="titlepage">
                   11047:           <div>
                   11048:             <div>
                   11049:               <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      11050:               "id2595665" id="id2595665"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  11051:             </div>
                   11052:           </div>
                   11053:         </div>
                   11054: 
1.7     ! wiz      11055:         <p>The pkgsrc guide's source code is stored in <code class=
        !          11056:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  11057:         are created from it:</p>
                   11058: 
                   11059:         <div class="itemizedlist">
                   11060:           <ul type="disc">
                   11061:             <li>
1.7     ! wiz      11062:               <p><code class=
        !          11063:               "filename">pkgsrc/doc/pkgsrc.txt</code>, which
        !          11064:               replaces <code class=
        !          11065:               "filename">pkgsrc/Packages.txt</code></p>
1.2       hubertf  11066:             </li>
                   11067: 
                   11068:             <li>
1.7     ! wiz      11069:               <p><code class=
        !          11070:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  11071:             </li>
                   11072: 
                   11073:             <li>
1.7     ! wiz      11074:               <p><code class=
        !          11075:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  11076:               the documentation on the NetBSD website will be built
                   11077:               from pkgsrc and kept up to date on the web server
                   11078:               itself. This means you <span class=
                   11079:               "emphasis"><em>must</em></span> make sure that your
                   11080:               changes haven't broken the build!</p>
                   11081:             </li>
1.6       hubertf  11082: 
                   11083:             <li>
1.7     ! wiz      11084:               <p><code class=
        !          11085:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  11086:               PDF version of the pkgsrc guide.</p>
                   11087:             </li>
                   11088: 
                   11089:             <li>
1.7     ! wiz      11090:               <p><code class=
        !          11091:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  11092:               PostScript version of the pkgsrc guide.</p>
                   11093:             </li>
1.2       hubertf  11094:           </ul>
                   11095:         </div>
                   11096:       </div>
                   11097: 
                   11098:       <div class="sect1" lang="en" xml:lang="en">
                   11099:         <div class="titlepage">
                   11100:           <div>
                   11101:             <div>
                   11102:               <h2 class="title" style="clear: both"><a name=
1.7     ! wiz      11103:               "id2595940" id=
        !          11104:               "id2595940"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  11105:             </div>
                   11106:           </div>
                   11107:         </div>
                   11108: 
                   11109:         <p>The procedure to edit the pkgsrc guide is:</p>
                   11110: 
                   11111:         <div class="itemizedlist">
                   11112:           <ul type="disc">
                   11113:             <li>
1.6       hubertf  11114:               <p>Make sure you have the packages needed to
                   11115:               re-generate the pkgsrc guide (and other XML-based
                   11116:               NetBSD documentation) installed. These are
                   11117:               &#8220;<span class="quote">pkgsrc-doc</span>&#8221;
                   11118:               for creating the ASCII- and HTML-version, and
                   11119:               &#8220;<span class=
                   11120:               "quote">pkgsrc-doc-print</span>&#8221;for the
                   11121:               PostScript- and PDF version. You will need both
                   11122:               packages installed, to make sure documentation is
                   11123:               consistent across all formats. The packages can be
1.7     ! wiz      11124:               found in <code class=
        !          11125:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
        !          11126:               <code class=
        !          11127:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  11128:             </li>
                   11129: 
                   11130:             <li>
1.7     ! wiz      11131:               <p>Edit the XML file(s) in <code class=
        !          11132:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  11133:             </li>
                   11134: 
                   11135:             <li>
1.7     ! wiz      11136:               <p>Run <span><strong class="command">make extract
        !          11137:               &amp;&amp; make do-lint</strong></span> in
        !          11138:               <code class="filename">pkgsrc/doc/guide</code> to
        !          11139:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  11140:             </li>
                   11141: 
                   11142:             <li>
1.7     ! wiz      11143:               <p>Run <span><strong class=
        !          11144:               "command">make</strong></span> in <code class=
        !          11145:               "filename">pkgsrc/doc/guide</code> to build the HTML
        !          11146:               and ASCII version.</p>
1.2       hubertf  11147:             </li>
                   11148: 
                   11149:             <li>
1.7     ! wiz      11150:               <p>If all is well, run <span><strong class=
        !          11151:               "command">make install-doc</strong></span> to put the
        !          11152:               generated files into <code class=
        !          11153:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  11154:             </li>
                   11155: 
                   11156:             <li>
1.7     ! wiz      11157:               <p><span><strong class="command">cvs commit
        !          11158:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  11159:             </li>
                   11160: 
                   11161:             <li>
1.7     ! wiz      11162:               <p><span><strong class="command">cvs commit -m
        !          11163:               re-generate
        !          11164:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  11165:             </li>
1.4       hubertf  11166: 
                   11167:             <li>
                   11168:               <p>Until the webserver on www.NetBSD.org is really
                   11169:               updated automatically to pick up changes to the
1.7     ! wiz      11170:               pkgsrc guide automatically, also run
        !          11171:               <span><strong class="command">make install-htdoc
        !          11172:               HTDOCSDIR=../../../htdocs</strong></span> (or
        !          11173:               similar, adjust <code class=
        !          11174:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  11175:             </li>
                   11176: 
                   11177:             <li>
1.7     ! wiz      11178:               <p><span><strong class="command">cvs commit
        !          11179:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  11180:             </li>
1.2       hubertf  11181:           </ul>
                   11182:         </div>
                   11183:       </div>
                   11184:     </div>
1.1       grant    11185:   </div>
                   11186: </body>
                   11187: </html>

CVSweb <webmaster@jp.NetBSD.org>