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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.20      ben         4:   "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
1.1       grant       5:   <meta http-equiv="Content-Type" content=
                      6:   "text/html; charset=us-ascii" />
                      7: 
                      8:   <title>The pkgsrc guide</title>
                      9:   <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
                     10:   <meta name="generator" content=
1.23      wiz        11:   "DocBook XSL Stylesheets VX.X.X" />
1.1       grant      12:   <meta name="description" content=
                     13:   "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
                     14:   </head>
                     15: 
                     16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
                     17: alink="#0000FF">
                     18:   <div class="book" lang="en" xml:lang="en">
                     19:     <div class="titlepage">
                     20:       <div>
                     21:         <div>
1.27    ! rillig     22:           <h1 class="title"><a name="id2598171" id=
        !            23:           "id2598171"></a>The pkgsrc guide</h1>
1.1       grant      24:         </div>
                     25: 
                     26:         <div>
1.2       hubertf    27:           <h2 class="subtitle">Documentation on the NetBSD packages
1.1       grant      28:           system</h2>
                     29:         </div>
                     30: 
                     31:         <div>
                     32:           <div class="authorgroup">
                     33:             <div class="author">
                     34:               <h3 class="author"><span class=
                     35:               "firstname">Alistair</span> <span class=
                     36:               "surname">Crooks</span></h3>
                     37: 
                     38:               <div class="affiliation">
                     39:                 <div class="address">
1.14      xtraeme    40:                   <p><code class="email">&lt;<a href=
                     41:                   "mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</code></p>
1.1       grant      42:                 </div>
                     43:               </div>
                     44:             </div>
                     45: 
                     46:             <div class="author">
                     47:               <h3 class="author"><span class=
                     48:               "firstname">Hubert</span> <span class=
                     49:               "surname">Feyrer</span></h3>
                     50: 
                     51:               <div class="affiliation">
                     52:                 <div class="address">
1.14      xtraeme    53:                   <p><code class="email">&lt;<a href=
                     54:                   "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</code></p>
1.1       grant      55:                 </div>
                     56:               </div>
                     57:             </div>
1.2       hubertf    58: 
1.3       hubertf    59:             <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1       grant      60:           </div>
                     61:         </div>
                     62: 
                     63:         <div>
                     64:           <p class="copyright">Copyright &#169; 1994-2004 The
                     65:           NetBSD Foundation, Inc</p>
                     66:         </div>
                     67: 
1.23      wiz        68:         <div xmlns="http://www.w3.org/TR/xhtml1/transitional">
1.27    ! rillig     69:           <p xmlns="" class="pubdate">$NetBSD: pkgsrc.xml,v 1.6
        !            70:           2005/05/15 20:32:27 rillig 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.27    ! rillig     96:             <dt><span class="sect1"><a href="#id2568707">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.27    ! rillig    120:                 <dt><span class="sect1"><a href="#id2569429">2.1.
1.1       grant     121:                 As tar file</a></span></dt>
                    122: 
1.27    ! rillig    123:                 <dt><span class="sect1"><a href="#id2569445">2.2.
1.1       grant     124:                 Via SUP</a></span></dt>
                    125: 
1.27    ! rillig    126:                 <dt><span class="sect1"><a href="#id2569477">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.27    ! rillig    136:                 <dt><span class="sect1"><a href="#id2569587">3.1.
1.1       grant     137:                 Bootstrapping pkgsrc</a></span></dt>
                    138: 
1.27    ! rillig    139:                 <dt><span class="sect1"><a href="#id2569768">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.27    ! rillig    145:                     "#id2569774">3.2.1. Darwin (Mac OS
1.1       grant     146:                     X)</a></span></dt>
                    147: 
                    148:                     <dt><span class="sect2"><a href=
1.27    ! rillig    149:                     "#id2569937">3.2.2. FreeBSD</a></span></dt>
1.1       grant     150: 
                    151:                     <dt><span class="sect2"><a href=
1.27    ! rillig    152:                     "#id2570449">3.2.3. Interix</a></span></dt>
1.1       grant     153: 
                    154:                     <dt><span class="sect2"><a href=
1.27    ! rillig    155:                     "#id2570750">3.2.4. IRIX</a></span></dt>
1.1       grant     156: 
                    157:                     <dt><span class="sect2"><a href=
1.27    ! rillig    158:                     "#id2570848">3.2.5. Linux</a></span></dt>
1.1       grant     159: 
                    160:                     <dt><span class="sect2"><a href=
1.27    ! rillig    161:                     "#id2570916">3.2.6. OpenBSD</a></span></dt>
1.22      tv        162: 
                    163:                     <dt><span class="sect2"><a href=
1.27    ! rillig    164:                     "#id2571028">3.2.7. Solaris</a></span></dt>
1.1       grant     165:                   </dl>
                    166:                 </dd>
                    167:               </dl>
                    168:             </dd>
                    169: 
                    170:             <dt><span class="chapter"><a href="#using">4. Using
                    171:             pkgsrc</a></span></dt>
                    172: 
                    173:             <dd>
                    174:               <dl>
                    175:                 <dt><span class="sect1"><a href=
                    176:                 "#getting-started">4.1. Working with binary
                    177:                 packages</a></span></dt>
                    178: 
                    179:                 <dd>
                    180:                   <dl>
                    181:                     <dt><span class="sect2"><a href=
1.27    ! rillig    182:                     "#id2571164">4.1.1. Where to get binary
1.1       grant     183:                     packages</a></span></dt>
                    184: 
                    185:                     <dt><span class="sect2"><a href=
1.27    ! rillig    186:                     "#id2571218">4.1.2. How to use binary
1.1       grant     187:                     packages</a></span></dt>
                    188: 
                    189:                     <dt><span class="sect2"><a href=
1.27    ! rillig    190:                     "#id2571392">4.1.3. A word of
1.1       grant     191:                     warning</a></span></dt>
                    192:                   </dl>
                    193:                 </dd>
                    194: 
1.27    ! rillig    195:                 <dt><span class="sect1"><a href="#id2571949">4.2.
1.1       grant     196:                 Building packages from source</a></span></dt>
                    197: 
                    198:                 <dd>
                    199:                   <dl>
                    200:                     <dt><span class="sect2"><a href=
1.27    ! rillig    201:                     "#id2571960">4.2.1.
1.1       grant     202:                     Requirements</a></span></dt>
                    203: 
                    204:                     <dt><span class="sect2"><a href=
1.27    ! rillig    205:                     "#id2571980">4.2.2. Fetching
1.1       grant     206:                     distfiles</a></span></dt>
                    207: 
                    208:                     <dt><span class="sect2"><a href=
1.27    ! rillig    209:                     "#id2572094">4.2.3. How to build and
1.1       grant     210:                     install</a></span></dt>
                    211: 
                    212:                     <dt><span class="sect2"><a href=
1.27    ! rillig    213:                     "#id2623825">4.2.4. Selecting the
1.1       grant     214:                     compiler</a></span></dt>
                    215:                   </dl>
                    216:                 </dd>
                    217:               </dl>
                    218:             </dd>
                    219: 
                    220:             <dt><span class="chapter"><a href="#binary">5. Creating
                    221:             binary packages</a></span></dt>
                    222: 
                    223:             <dd>
                    224:               <dl>
1.27    ! rillig    225:                 <dt><span class="sect1"><a href="#id2623979">5.1.
1.1       grant     226:                 Building a single binary package</a></span></dt>
                    227: 
1.27    ! rillig    228:                 <dt><span class="sect1"><a href="#id2624057">5.2.
1.1       grant     229:                 Settings for creation of binary
                    230:                 packages</a></span></dt>
                    231: 
                    232:                 <dt><span class="sect1"><a href="#bulkbuild">5.3.
                    233:                 Doing a bulk build of all packages</a></span></dt>
                    234: 
                    235:                 <dd>
                    236:                   <dl>
                    237:                     <dt><span class="sect2"><a href=
                    238:                     "#binary.configuration">5.3.1.
                    239:                     Configuration</a></span></dt>
                    240: 
                    241:                     <dt><span class="sect2"><a href=
1.27    ! rillig    242:                     "#id2624204">5.3.2. Other environmental
1.1       grant     243:                     considerations</a></span></dt>
                    244: 
                    245:                     <dt><span class="sect2"><a href=
1.27    ! rillig    246:                     "#id2624245">5.3.3. Operation</a></span></dt>
1.1       grant     247: 
                    248:                     <dt><span class="sect2"><a href=
1.27    ! rillig    249:                     "#id2624382">5.3.4. What it
1.1       grant     250:                     does</a></span></dt>
                    251: 
                    252:                     <dt><span class="sect2"><a href=
1.27    ! rillig    253:                     "#id2624439">5.3.5. Disk space
1.1       grant     254:                     requirements</a></span></dt>
                    255: 
                    256:                     <dt><span class="sect2"><a href=
1.27    ! rillig    257:                     "#id2624466">5.3.6. Setting up a sandbox for
1.1       grant     258:                     chroot'ed builds</a></span></dt>
                    259: 
                    260:                     <dt><span class="sect2"><a href=
1.27    ! rillig    261:                     "#id2624926">5.3.7. Building a partial set of
1.1       grant     262:                     packages</a></span></dt>
1.13      hubertf   263: 
                    264:                     <dt><span class="sect2"><a href=
                    265:                     "#bulk-upload">5.3.8. Uploading results of a
                    266:                     bulk build</a></span></dt>
1.1       grant     267:                   </dl>
                    268:                 </dd>
                    269: 
1.27    ! rillig    270:                 <dt><span class="sect1"><a href="#id2625383">5.4.
1.1       grant     271:                 Creating a multiple CD-ROM packages
                    272:                 collection</a></span></dt>
                    273: 
                    274:                 <dd>
                    275:                   <dl>
                    276:                     <dt><span class="sect2"><a href=
1.27    ! rillig    277:                     "#id2625398">5.4.1. Example of
1.1       grant     278:                     cdpack</a></span></dt>
                    279:                   </dl>
                    280:                 </dd>
                    281:               </dl>
                    282:             </dd>
                    283: 
                    284:             <dt><span class="chapter"><a href="#faq">6. Frequently
                    285:             Asked Questions</a></span></dt>
                    286: 
                    287:             <dd>
                    288:               <dl>
1.27    ! rillig    289:                 <dt><span class="sect1"><a href="#id2625590">6.1.
1.18      xtraeme   290:                 Are there any mailing lists for pkg-related
1.1       grant     291:                 discussion?</a></span></dt>
                    292: 
1.27    ! rillig    293:                 <dt><span class="sect1"><a href="#id2625724">6.2.
1.1       grant     294:                 Where's the pkgviews documentation?</a></span></dt>
                    295: 
1.5       hubertf   296:                 <dt><span class="sect1"><a href=
                    297:                 "#faq-pkgtools">6.3. Utilities for package
                    298:                 management (pkgtools)</a></span></dt>
1.1       grant     299: 
1.27    ! rillig    300:                 <dt><span class="sect1"><a href="#id2625987">6.4.
1.1       grant     301:                 How to use pkgsrc as non-root</a></span></dt>
                    302: 
1.27    ! rillig    303:                 <dt><span class="sect1"><a href="#id2625998">6.5.
1.15      xtraeme   304:                 How to resume transfers when fetching
                    305:                 distfiles?</a></span></dt>
1.14      xtraeme   306: 
1.27    ! rillig    307:                 <dt><span class="sect1"><a href="#id2626049">6.6.
1.1       grant     308:                 How can I install/use XFree86 from
                    309:                 pkgsrc?</a></span></dt>
                    310: 
1.27    ! rillig    311:                 <dt><span class="sect1"><a href="#id2626076">6.7.
1.1       grant     312:                 How can I install/use X.org from
                    313:                 pkgsrc?</a></span></dt>
                    314: 
1.27    ! rillig    315:                 <dt><span class="sect1"><a href="#id2626104">6.8.
1.1       grant     316:                 How to fetch files from behind a
                    317:                 firewall</a></span></dt>
                    318: 
1.27    ! rillig    319:                 <dt><span class="sect1"><a href="#id2626118">6.9.
1.14      xtraeme   320:                 How do I tell <span><strong class="command">make
                    321:                 fetch</strong></span> to do passive
1.1       grant     322:                 FTP?</a></span></dt>
                    323: 
1.27    ! rillig    324:                 <dt><span class="sect1"><a href="#id2626169">6.10.
1.1       grant     325:                 How to fetch all distfiles at once</a></span></dt>
                    326: 
1.27    ! rillig    327:                 <dt><span class="sect1"><a href="#id2626453">6.11.
1.14      xtraeme   328:                 What does &#8220;<span class="quote">Don't know how
                    329:                 to make /usr/share/tmac/tmac.andoc</span>&#8221;
                    330:                 mean?</a></span></dt>
1.13      hubertf   331: 
1.27    ! rillig    332:                 <dt><span class="sect1"><a href="#id2626491">6.12.
1.14      xtraeme   333:                 What does &#8220;<span class="quote">Could not find
                    334:                 bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant     335: 
1.27    ! rillig    336:                 <dt><span class="sect1"><a href="#id2626549">6.13.
1.1       grant     337:                 Using 'sudo' with pkgsrc</a></span></dt>
                    338: 
1.14      xtraeme   339:                 <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant     340:                 Configuration files handling and
                    341:                 placement</a></span></dt>
                    342: 
                    343:                 <dt><span class="sect1"><a href=
1.14      xtraeme   344:                 "#audit-packages">6.15. Automated security
1.1       grant     345:                 checks</a></span></dt>
                    346:               </dl>
                    347:             </dd>
                    348:           </dl>
                    349:         </dd>
                    350: 
1.2       hubertf   351:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     352:         pkgsrc developer's guide</a></span></dt>
                    353: 
                    354:         <dd>
                    355:           <dl>
1.27    ! rillig    356:             <dt><span class="chapter"><a href="#components">7.
        !           357:             Package components - files, directories and
        !           358:             contents</a></span></dt>
        !           359: 
        !           360:             <dd>
        !           361:               <dl>
        !           362:                 <dt><span class="sect1"><a href=
        !           363:                 "#components.Makefile">7.1. <code class=
        !           364:                 "filename">Makefile</code></a></span></dt>
        !           365: 
        !           366:                 <dt><span class="sect1"><a href=
        !           367:                 "#components.distinfo">7.2. <code class=
        !           368:                 "filename">distinfo</code></a></span></dt>
        !           369: 
        !           370:                 <dt><span class="sect1"><a href=
        !           371:                 "#components.patches">7.3.
        !           372:                 patches/*</a></span></dt>
        !           373: 
        !           374:                 <dt><span class="sect1"><a href="#id2627632">7.4.
        !           375:                 Other mandatory files</a></span></dt>
        !           376: 
        !           377:                 <dt><span class="sect1"><a href=
        !           378:                 "#components.optional">7.5. Optional
        !           379:                 files</a></span></dt>
        !           380: 
        !           381:                 <dt><span class="sect1"><a href="#id2627757">7.6.
        !           382:                 <code class="filename">work*</code></a></span></dt>
        !           383: 
        !           384:                 <dt><span class="sect1"><a href="#id2627845">7.7.
        !           385:                 <code class=
        !           386:                 "filename">files/*</code></a></span></dt>
        !           387:               </dl>
        !           388:             </dd>
        !           389: 
        !           390:             <dt><span class="chapter"><a href="#makefile">8.
1.25      rillig    391:             Programming in <code class=
                    392:             "filename">Makefile</code>s</a></span></dt>
                    393: 
                    394:             <dd>
                    395:               <dl>
                    396:                 <dt><span class="sect1"><a href=
1.27    ! rillig    397:                 "#makefile.variables">8.1. <code class=
1.25      rillig    398:                 "filename">Makefile</code>
                    399:                 variables</a></span></dt>
                    400: 
1.27    ! rillig    401:                 <dd>
        !           402:                   <dl>
        !           403:                     <dt><span class="sect2"><a href=
        !           404:                     "#makefile.variables.names">8.1.1. Naming
        !           405:                     conventions</a></span></dt>
        !           406:                   </dl>
        !           407:                 </dd>
        !           408: 
1.25      rillig    409:                 <dt><span class="sect1"><a href=
1.27    ! rillig    410:                 "#makefile.code">8.2. Code snippets</a></span></dt>
1.25      rillig    411: 
                    412:                 <dd>
                    413:                   <dl>
                    414:                     <dt><span class="sect2"><a href=
1.27    ! rillig    415:                     "#id2628274">8.2.1. Adding things to a
1.25      rillig    416:                     list</a></span></dt>
                    417: 
                    418:                     <dt><span class="sect2"><a href=
1.27    ! rillig    419:                     "#id2628283">8.2.2. Converting an internal list
1.25      rillig    420:                     into an external list</a></span></dt>
                    421: 
                    422:                     <dt><span class="sect2"><a href=
1.27    ! rillig    423:                     "#id2628305">8.2.3. Passing variables to a
1.25      rillig    424:                     shell command</a></span></dt>
1.27    ! rillig    425: 
        !           426:                     <dt><span class="sect2"><a href=
        !           427:                     "#id2628426">8.2.4. Quoting
        !           428:                     guideline</a></span></dt>
        !           429: 
        !           430:                     <dt><span class="sect2"><a href=
        !           431:                     "#id2628677">8.2.5. Workaround for a bug in BSD
        !           432:                     Make</a></span></dt>
1.25      rillig    433:                   </dl>
                    434:                 </dd>
                    435:               </dl>
                    436:             </dd>
                    437: 
                    438:             <dt><span class="chapter"><a href="#plist">9. PLIST
1.1       grant     439:             issues</a></span></dt>
                    440: 
                    441:             <dd>
                    442:               <dl>
1.27    ! rillig    443:                 <dt><span class="sect1"><a href="#id2628738">9.1.
1.1       grant     444:                 RCS ID</a></span></dt>
                    445: 
1.27    ! rillig    446:                 <dt><span class="sect1"><a href="#id2628753">9.2.
1.14      xtraeme   447:                 Semi-automatic <code class="filename">PLIST</code>
                    448:                 generation</a></span></dt>
1.1       grant     449: 
1.25      rillig    450:                 <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14      xtraeme   451:                 Tweaking output of <span><strong class=
                    452:                 "command">make
                    453:                 print-PLIST</strong></span></a></span></dt>
1.1       grant     454: 
1.25      rillig    455:                 <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1       grant     456:                 Variable substitution in PLIST</a></span></dt>
                    457: 
1.27    ! rillig    458:                 <dt><span class="sect1"><a href="#id2629074">9.5.
1.1       grant     459:                 Manpage-compression</a></span></dt>
                    460: 
1.27    ! rillig    461:                 <dt><span class="sect1"><a href="#id2629115">9.6.
1.14      xtraeme   462:                 Changing PLIST source with <code class=
                    463:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     464: 
1.27    ! rillig    465:                 <dt><span class="sect1"><a href="#id2629140">9.7.
1.1       grant     466:                 Platform specific and differing
                    467:                 PLISTs</a></span></dt>
                    468: 
                    469:                 <dt><span class="sect1"><a href=
1.25      rillig    470:                 "#faq.common-dirs">9.8. Sharing directories between
1.1       grant     471:                 packages</a></span></dt>
                    472:               </dl>
                    473:             </dd>
                    474: 
1.25      rillig    475:             <dt><span class="chapter"><a href="#buildlink">10.
1.1       grant     476:             Buildlink methodology</a></span></dt>
                    477: 
                    478:             <dd>
                    479:               <dl>
1.27    ! rillig    480:                 <dt><span class="sect1"><a href="#id2629406">10.1.
1.1       grant     481:                 Converting packages to use
                    482:                 buildlink3</a></span></dt>
                    483: 
1.27    ! rillig    484:                 <dt><span class="sect1"><a href="#id2629724">10.2.
1.14      xtraeme   485:                 Writing <code class="filename">buildlink3.mk</code>
                    486:                 files</a></span></dt>
1.1       grant     487: 
                    488:                 <dd>
                    489:                   <dl>
                    490:                     <dt><span class="sect2"><a href=
1.27    ! rillig    491:                     "#id2629794">10.2.1. Anatomy of a buildlink3.mk
1.1       grant     492:                     file</a></span></dt>
                    493: 
                    494:                     <dt><span class="sect2"><a href=
1.27    ! rillig    495:                     "#id2630166">10.2.2. Updating <code class=
1.14      xtraeme   496:                     "varname">BUILDLINK_DEPENDS.<em class=
                    497:                     "replaceable"><code>pkg</code></em></code> in
                    498:                     <code class="filename">buildlink3.mk</code>
1.1       grant     499:                     files</a></span></dt>
                    500:                   </dl>
                    501:                 </dd>
                    502: 
1.27    ! rillig    503:                 <dt><span class="sect1"><a href="#id2630245">10.3.
1.14      xtraeme   504:                 Writing <code class="filename">builtin.mk</code>
                    505:                 files</a></span></dt>
1.1       grant     506: 
                    507:                 <dd>
                    508:                   <dl>
                    509:                     <dt><span class="sect2"><a href=
1.27    ! rillig    510:                     "#id2630394">10.3.1. Anatomy of a <code class=
1.14      xtraeme   511:                     "filename">builtin.mk</code>
1.1       grant     512:                     file</a></span></dt>
                    513: 
                    514:                     <dt><span class="sect2"><a href=
1.27    ! rillig    515:                     "#id2630621">10.3.2. Global preferences for
1.1       grant     516:                     native or pkgsrc software</a></span></dt>
                    517:                   </dl>
                    518:                 </dd>
                    519:               </dl>
                    520:             </dd>
                    521: 
1.25      rillig    522:             <dt><span class="chapter"><a href="#options">11.
1.1       grant     523:             Options handling</a></span></dt>
                    524: 
                    525:             <dd>
                    526:               <dl>
1.27    ! rillig    527:                 <dt><span class="sect1"><a href="#id2630762">11.1.
1.1       grant     528:                 Global default options</a></span></dt>
                    529: 
1.27    ! rillig    530:                 <dt><span class="sect1"><a href="#id2630777">11.2.
1.14      xtraeme   531:                 Converting packages to use <code class=
                    532:                 "filename">bsd.options.mk</code></a></span></dt>
1.1       grant     533:               </dl>
                    534:             </dd>
                    535: 
1.25      rillig    536:             <dt><span class="chapter"><a href="#build">12. The
1.1       grant     537:             build process</a></span></dt>
                    538: 
                    539:             <dd>
                    540:               <dl>
                    541:                 <dt><span class="sect1"><a href=
1.25      rillig    542:                 "#build.prefix">12.1. Program
1.1       grant     543:                 location</a></span></dt>
                    544: 
1.27    ! rillig    545:                 <dt><span class="sect1"><a href="#id2631337">12.2.
1.1       grant     546:                 Main targets</a></span></dt>
                    547: 
                    548:                 <dt><span class="sect1"><a href=
1.25      rillig    549:                 "#build.helpful-targets">12.3. Other helpful
1.1       grant     550:                 targets</a></span></dt>
                    551:               </dl>
                    552:             </dd>
                    553: 
1.25      rillig    554:             <dt><span class="chapter"><a href="#fixes">13. Notes on
1.1       grant     555:             fixes for packages</a></span></dt>
                    556: 
                    557:             <dd>
                    558:               <dl>
1.27    ! rillig    559:                 <dt><span class="sect1"><a href="#id2632834">13.1.
1.1       grant     560:                 General operation</a></span></dt>
                    561: 
                    562:                 <dd>
                    563:                   <dl>
                    564:                     <dt><span class="sect2"><a href=
1.27    ! rillig    565:                     "#id2632837">13.1.1. How to pull in variables
1.1       grant     566:                     from /etc/mk.conf</a></span></dt>
                    567: 
                    568:                     <dt><span class="sect2"><a href=
1.27    ! rillig    569:                     "#id2632920">13.1.2. Restricted
1.1       grant     570:                     packages</a></span></dt>
                    571: 
                    572:                     <dt><span class="sect2"><a href=
1.25      rillig    573:                     "#dependencies">13.1.3. Handling
1.1       grant     574:                     dependencies</a></span></dt>
                    575: 
                    576:                     <dt><span class="sect2"><a href=
1.27    ! rillig    577:                     "#id2633373">13.1.4. Handling conflicts with
1.1       grant     578:                     other packages</a></span></dt>
                    579: 
                    580:                     <dt><span class="sect2"><a href=
1.27    ! rillig    581:                     "#id2633492">13.1.5. Packages that cannot or
1.1       grant     582:                     should not be built</a></span></dt>
                    583: 
                    584:                     <dt><span class="sect2"><a href=
1.27    ! rillig    585:                     "#id2633517">13.1.6. Packages which should not
1.1       grant     586:                     be deleted, once installed</a></span></dt>
                    587: 
                    588:                     <dt><span class="sect2"><a href=
1.25      rillig    589:                     "#security-handling">13.1.7. Handling packages
1.1       grant     590:                     with security problems</a></span></dt>
                    591: 
                    592:                     <dt><span class="sect2"><a href=
1.27    ! rillig    593:                     "#id2633677">13.1.8. How to handle compiler
1.1       grant     594:                     bugs</a></span></dt>
                    595: 
                    596:                     <dt><span class="sect2"><a href=
1.27    ! rillig    597:                     "#id2633700">13.1.9. How to handle incrementing
1.1       grant     598:                     versions when fixing an existing
                    599:                     package</a></span></dt>
                    600: 
                    601:                     <dt><span class="sect2"><a href=
1.27    ! rillig    602:                     "#id2633817">13.1.10. Portability of
1.1       grant     603:                     packages</a></span></dt>
                    604:                   </dl>
                    605:                 </dd>
                    606: 
1.27    ! rillig    607:                 <dt><span class="sect1"><a href="#id2633842">13.2.
1.1       grant     608:                 Possible downloading issues</a></span></dt>
                    609: 
                    610:                 <dd>
                    611:                   <dl>
                    612:                     <dt><span class="sect2"><a href=
1.27    ! rillig    613:                     "#id2633845">13.2.1. Packages whose distfiles
1.1       grant     614:                     aren't available for plain
                    615:                     downloading</a></span></dt>
                    616: 
                    617:                     <dt><span class="sect2"><a href=
1.27    ! rillig    618:                     "#id2633908">13.2.2. How to handle modified
1.1       grant     619:                     distfiles with the 'old' name</a></span></dt>
                    620:                   </dl>
                    621:                 </dd>
                    622: 
1.27    ! rillig    623:                 <dt><span class="sect1"><a href="#id2633920">13.3.
1.1       grant     624:                 Configuration gotchas</a></span></dt>
                    625: 
                    626:                 <dd>
                    627:                   <dl>
                    628:                     <dt><span class="sect2"><a href=
1.25      rillig    629:                     "#fixes.libtool">13.3.1. Shared libraries -
1.1       grant     630:                     libtool</a></span></dt>
                    631: 
                    632:                     <dt><span class="sect2"><a href=
1.27    ! rillig    633:                     "#id2634285">13.3.2. Using libtool on GNU
1.1       grant     634:                     packages that already support
                    635:                     libtool</a></span></dt>
                    636: 
                    637:                     <dt><span class="sect2"><a href=
1.27    ! rillig    638:                     "#id2634503">13.3.3. GNU
1.1       grant     639:                     Autoconf/Automake</a></span></dt>
                    640:                   </dl>
                    641:                 </dd>
                    642: 
1.27    ! rillig    643:                 <dt><span class="sect1"><a href="#id2634616">13.4.
1.1       grant     644:                 Building considerations</a></span></dt>
                    645: 
                    646:                 <dd>
                    647:                   <dl>
                    648:                     <dt><span class="sect2"><a href=
1.27    ! rillig    649:                     "#id2634619">13.4.1. CPP
1.1       grant     650:                     defines</a></span></dt>
                    651:                   </dl>
                    652:                 </dd>
                    653: 
1.27    ! rillig    654:                 <dt><span class="sect1"><a href="#id2634649">13.5.
1.1       grant     655:                 Package specific actions</a></span></dt>
                    656: 
                    657:                 <dd>
                    658:                   <dl>
                    659:                     <dt><span class="sect2"><a href=
1.27    ! rillig    660:                     "#id2634652">13.5.1. Package configuration
1.1       grant     661:                     files</a></span></dt>
                    662: 
                    663:                     <dt><span class="sect2"><a href=
1.27    ! rillig    664:                     "#id2634755">13.5.2. User
1.2       hubertf   665:                     interaction</a></span></dt>
1.1       grant     666: 
                    667:                     <dt><span class="sect2"><a href=
1.27    ! rillig    668:                     "#id2634800">13.5.3. Handling
1.1       grant     669:                     licenses</a></span></dt>
                    670: 
                    671:                     <dt><span class="sect2"><a href=
1.27    ! rillig    672:                     "#id2634951">13.5.4. Creating an account from a
1.1       grant     673:                     package</a></span></dt>
                    674: 
                    675:                     <dt><span class="sect2"><a href=
1.27    ! rillig    676:                     "#id2635013">13.5.5. Installing score
1.1       grant     677:                     files</a></span></dt>
                    678: 
                    679:                     <dt><span class="sect2"><a href=
1.27    ! rillig    680:                     "#id2635057">13.5.6. Packages providing login
1.1       grant     681:                     shells</a></span></dt>
                    682: 
                    683:                     <dt><span class="sect2"><a href=
1.27    ! rillig    684:                     "#id2635114">13.5.7. Packages containing perl
1.1       grant     685:                     scripts</a></span></dt>
                    686: 
                    687:                     <dt><span class="sect2"><a href=
1.27    ! rillig    688:                     "#id2635132">13.5.8. Packages with hardcoded
1.1       grant     689:                     paths to other interpreters</a></span></dt>
                    690: 
                    691:                     <dt><span class="sect2"><a href=
1.27    ! rillig    692:                     "#id2635154">13.5.9. Packages installing perl
1.1       grant     693:                     modules</a></span></dt>
                    694: 
                    695:                     <dt><span class="sect2"><a href=
1.25      rillig    696:                     "#faq.info-files">13.5.10. Packages installing
1.1       grant     697:                     info files</a></span></dt>
                    698: 
                    699:                     <dt><span class="sect2"><a href=
1.27    ! rillig    700:                     "#id2635510">13.5.11. Packages installing
1.1       grant     701:                     GConf2 data files</a></span></dt>
                    702: 
                    703:                     <dt><span class="sect2"><a href=
1.27    ! rillig    704:                     "#id2635678">13.5.12. Packages installing
1.1       grant     705:                     scrollkeeper data files</a></span></dt>
                    706: 
                    707:                     <dt><span class="sect2"><a href=
1.27    ! rillig    708:                     "#id2635730">13.5.13. Packages installing X11
1.1       grant     709:                     fonts</a></span></dt>
                    710: 
                    711:                     <dt><span class="sect2"><a href=
1.27    ! rillig    712:                     "#id2635777">13.5.14. Packages installing GTK2
1.1       grant     713:                     modules</a></span></dt>
                    714: 
                    715:                     <dt><span class="sect2"><a href=
1.27    ! rillig    716:                     "#id2635846">13.5.15. Packages installing SGML
1.1       grant     717:                     or XML data</a></span></dt>
                    718: 
                    719:                     <dt><span class="sect2"><a href=
1.27    ! rillig    720:                     "#id2635898">13.5.16. Packages installing
1.1       grant     721:                     extensions to the MIME database</a></span></dt>
                    722: 
                    723:                     <dt><span class="sect2"><a href=
1.27    ! rillig    724:                     "#id2636037">13.5.17. Packages using
1.1       grant     725:                     intltool</a></span></dt>
1.18      xtraeme   726: 
                    727:                     <dt><span class="sect2"><a href=
1.27    ! rillig    728:                     "#id2636051">13.5.18. Packages installing
1.18      xtraeme   729:                     startup scripts</a></span></dt>
1.1       grant     730:                   </dl>
                    731:                 </dd>
                    732: 
1.27    ! rillig    733:                 <dt><span class="sect1"><a href="#id2636072">13.6.
1.1       grant     734:                 Feedback to the author</a></span></dt>
                    735:               </dl>
                    736:             </dd>
                    737: 
1.25      rillig    738:             <dt><span class="chapter"><a href="#debug">14.
1.1       grant     739:             Debugging</a></span></dt>
                    740: 
1.25      rillig    741:             <dt><span class="chapter"><a href="#submit">15.
1.1       grant     742:             Submitting and Committing</a></span></dt>
                    743: 
                    744:             <dd>
                    745:               <dl>
1.27    ! rillig    746:                 <dt><span class="sect1"><a href="#id2636739">15.1.
1.1       grant     747:                 Submitting your packages</a></span></dt>
                    748: 
1.27    ! rillig    749:                 <dt><span class="sect1"><a href="#id2636796">15.2.
1.1       grant     750:                 Committing: Importing a package into
                    751:                 CVS</a></span></dt>
                    752: 
1.27    ! rillig    753:                 <dt><span class="sect1"><a href="#id2636859">15.3.
1.2       hubertf   754:                 Updating a package to a newer
                    755:                 version</a></span></dt>
1.1       grant     756: 
1.27    ! rillig    757:                 <dt><span class="sect1"><a href="#id2636878">15.4.
1.2       hubertf   758:                 Moving a package in pkgsrc</a></span></dt>
1.1       grant     759:               </dl>
                    760:             </dd>
                    761:           </dl>
                    762:         </dd>
                    763: 
                    764:         <dt><span class="appendix"><a href="#examples">A. A simple
                    765:         example package: bison</a></span></dt>
                    766: 
                    767:         <dd>
                    768:           <dl>
1.27    ! rillig    769:             <dt><span class="sect1"><a href="#id2637036">A.1.
1.1       grant     770:             files</a></span></dt>
                    771: 
                    772:             <dd>
                    773:               <dl>
1.27    ! rillig    774:                 <dt><span class="sect2"><a href="#id2637040">A.1.1.
1.1       grant     775:                 Makefile</a></span></dt>
                    776: 
1.27    ! rillig    777:                 <dt><span class="sect2"><a href="#id2637047">A.1.2.
1.1       grant     778:                 DESCR</a></span></dt>
                    779: 
1.27    ! rillig    780:                 <dt><span class="sect2"><a href="#id2637062">A.1.3.
1.1       grant     781:                 PLIST</a></span></dt>
                    782: 
1.27    ! rillig    783:                 <dt><span class="sect2"><a href="#id2637069">A.1.4.
1.14      xtraeme   784:                 Checking a package with <span><strong class=
                    785:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant     786:               </dl>
                    787:             </dd>
                    788: 
1.27    ! rillig    789:             <dt><span class="sect1"><a href="#id2637110">A.2. Steps
1.1       grant     790:             for building, installing, packaging</a></span></dt>
                    791:           </dl>
                    792:         </dd>
                    793: 
                    794:         <dt><span class="appendix"><a href="#logs">B. Build
                    795:         logs</a></span></dt>
                    796: 
                    797:         <dd>
                    798:           <dl>
                    799:             <dt><span class="sect1"><a href="#logs.building">B.1.
                    800:             Building figlet</a></span></dt>
                    801: 
                    802:             <dt><span class="sect1"><a href="#logs.package">B.2.
                    803:             Packaging figlet</a></span></dt>
                    804:           </dl>
                    805:         </dd>
                    806: 
                    807:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
                    808:         of the FTP server's package archive</a></span></dt>
1.2       hubertf   809: 
                    810:         <dt><span class="appendix"><a href="#editing">D. Editing
                    811:         guidelines for the pkgsrc guide</a></span></dt>
                    812: 
                    813:         <dd>
                    814:           <dl>
1.27    ! rillig    815:             <dt><span class="sect1"><a href="#id2637893">D.1.
1.2       hubertf   816:             Targets</a></span></dt>
                    817: 
1.27    ! rillig    818:             <dt><span class="sect1"><a href="#id2637958">D.2.
1.2       hubertf   819:             Procedure</a></span></dt>
                    820:           </dl>
                    821:         </dd>
1.1       grant     822:       </dl>
                    823:     </div>
                    824: 
                    825:     <div class="chapter" lang="en" xml:lang="en">
                    826:       <div class="titlepage">
                    827:         <div>
                    828:           <div>
                    829:             <h2 class="title"><a name="introduction" id=
                    830:             "introduction"></a>Chapter&nbsp;1.&nbsp;Introduction</h2>
                    831:           </div>
                    832:         </div>
                    833:       </div>
                    834: 
                    835:       <div class="toc">
                    836:         <p><b>Table of Contents</b></p>
                    837: 
                    838:         <dl>
1.27    ! rillig    839:           <dt><span class="sect1"><a href="#id2568707">1.1.
1.1       grant     840:           Introduction</a></span></dt>
                    841: 
                    842:           <dt><span class="sect1"><a href="#overview">1.2.
                    843:           Overview</a></span></dt>
                    844: 
                    845:           <dt><span class="sect1"><a href="#terminology">1.3.
                    846:           Terminology</a></span></dt>
                    847: 
                    848:           <dt><span class="sect1"><a href="#typography">1.4.
                    849:           Typography</a></span></dt>
                    850:         </dl>
                    851:       </div>
                    852: 
                    853:       <div class="sect1" lang="en" xml:lang="en">
                    854:         <div class="titlepage">
                    855:           <div>
                    856:             <div>
                    857:               <h2 class="title" style="clear: both"><a name=
1.27    ! rillig    858:               "id2568707" id=
        !           859:               "id2568707"></a>1.1.&nbsp;Introduction</h2>
1.1       grant     860:             </div>
                    861:           </div>
                    862:         </div>
                    863: 
                    864:         <p>There is a lot of software freely available for Unix
                    865:         based systems, which usually runs on NetBSD and other
                    866:         Unix-flavoured systems, too, sometimes with some
                    867:         modifications. The NetBSD Packages Collection (pkgsrc)
                    868:         incorporates any such changes necessary to make that
                    869:         software run, and makes the installation (and
                    870:         de-installation) of the software package easy by means of a
                    871:         single command.</p>
                    872: 
                    873:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme   874:         the <span><strong class="command">pkg_*</strong></span>
                    875:         tools so that installation and de-installation, printing of
                    876:         an inventory of all installed packages and retrieval of
                    877:         one-line comments or more verbose descriptions are all
                    878:         simple.</p>
1.1       grant     879: 
                    880:         <p>pkgsrc currently contains several thousand packages,
                    881:         including:</p>
                    882: 
                    883:         <div class="itemizedlist">
                    884:           <ul type="disc">
                    885:             <li>
                    886:               <p><a xmlns=
                    887:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    888:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.20      ben       889:               class="pkgname">www/apache</a> - The Apache web
                    890:               server</p>
1.1       grant     891:             </li>
                    892: 
                    893:             <li>
                    894:               <p><a xmlns=
                    895:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    896:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20      ben       897:               class="pkgname">www/mozilla</a> - The Mozilla web
                    898:               browser</p>
1.1       grant     899:             </li>
                    900: 
                    901:             <li>
                    902:               <p><a xmlns=
                    903:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    904:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.20      ben       905:               class="pkgname">meta-pkgs/gnome</a> - The GNOME
                    906:               Desktop Environment</p>
1.1       grant     907:             </li>
                    908: 
                    909:             <li>
                    910:               <p><a xmlns=
                    911:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    912:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.20      ben       913:               class="pkgname">meta-pkgs/kde3</a> - The K Desktop
                    914:               Environment</p>
1.1       grant     915:             </li>
                    916:           </ul>
                    917:         </div>
                    918: 
                    919:         <p>...just to name a few.</p>
                    920: 
                    921:         <p>pkgsrc has built-in support for handling varying
                    922:         dependencies, such as pthreads and X11, and extended
                    923:         features such as IPv6 support on a range of platforms.</p>
                    924: 
                    925:         <p>pkgsrc was derived from FreeBSD's ports system, and
                    926:         initially developed for NetBSD only. Since then, pkgsrc has
                    927:         grown a lot, and now supports the following platforms:</p>
                    928: 
                    929:         <div class="itemizedlist">
                    930:           <ul type="disc">
                    931:             <li>
                    932:               <p><a href="http://developer.apple.com/darwin/"
                    933:               target="_top">Darwin</a> (<a href=
                    934:               "http://www.apple.com/macosx/" target="_top">Mac OS
                    935:               X</a>)</p>
                    936:             </li>
                    937: 
                    938:             <li>
1.3       hubertf   939:               <p><a href="http://www.DragonFlyBSD.org/" target=
                    940:               "_top">DragonFlyBSD</a></p>
                    941:             </li>
                    942: 
                    943:             <li>
1.1       grant     944:               <p><a href="http://www.FreeBSD.org/" target=
                    945:               "_top">FreeBSD</a></p>
                    946:             </li>
                    947: 
                    948:             <li>
1.3       hubertf   949:               <p>Microsoft Windows, via <a href=
                    950:               "http://www.microsoft.com/windows/sfu/" target=
                    951:               "_top">Interix</a></p>
1.1       grant     952:             </li>
                    953: 
                    954:             <li>
                    955:               <p><a href="http://www.sgi.com/software/irix6.5/"
                    956:               target="_top">IRIX</a></p>
                    957:             </li>
                    958: 
                    959:             <li>
                    960:               <p><a href="http://www.linux.org/" target=
                    961:               "_top">Linux</a></p>
                    962:             </li>
                    963: 
                    964:             <li>
                    965:               <p><a href="http://www.NetBSD.org/" target=
                    966:               "_top">NetBSD</a> (of course)</p>
                    967:             </li>
                    968: 
                    969:             <li>
1.17      sketch    970:               <p><a href="http://h30097.www3.hp.com/" target=
                    971:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                    972:             </li>
                    973: 
                    974:             <li>
1.1       grant     975:               <p><a href="http://www.openbsd.org/" target=
                    976:               "_top">OpenBSD</a></p>
                    977:             </li>
                    978: 
                    979:             <li>
                    980:               <p><a href="http://www.sun.com/solaris/" target=
                    981:               "_top">Solaris</a></p>
                    982:             </li>
                    983:           </ul>
                    984:         </div>
                    985:       </div>
                    986: 
                    987:       <div class="sect1" lang="en" xml:lang="en">
                    988:         <div class="titlepage">
                    989:           <div>
                    990:             <div>
                    991:               <h2 class="title" style="clear: both"><a name=
                    992:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
                    993:             </div>
                    994:           </div>
                    995:         </div>
                    996: 
                    997:         <p>This document is divided into two parts. The first,
                    998:         <a href="#users-guide" title=
1.2       hubertf   999:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
                   1000:         user's guide</a>, describes how one can use one of the
                   1001:         packages in the Package Collection, either by installing a
                   1002:         precompiled binary package, or by building one's own copy
                   1003:         using the NetBSD package system. The second part, <a href=
1.1       grant    1004:         "#developers-guide" title=
1.2       hubertf  1005:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                   1006:         pkgsrc developer's guide</a>, explains how to prepare a
                   1007:         package so it can be easily built by other NetBSD users
                   1008:         without knowing about the package's building details.</p>
1.1       grant    1009: 
                   1010:         <p>This document is available in various formats:</p>
                   1011: 
                   1012:         <div class="itemizedlist">
                   1013:           <ul type="disc">
                   1014:             <li>
                   1015:               <p><a href="index.html" target="_top">HTML</a></p>
                   1016:             </li>
                   1017: 
                   1018:             <li>
                   1019:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                   1020:             </li>
                   1021: 
                   1022:             <li>
                   1023:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                   1024:             </li>
                   1025: 
                   1026:             <li>
                   1027:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                   1028:             </li>
                   1029:           </ul>
                   1030:         </div>
                   1031:       </div>
                   1032: 
                   1033:       <div class="sect1" lang="en" xml:lang="en">
                   1034:         <div class="titlepage">
                   1035:           <div>
                   1036:             <div>
                   1037:               <h2 class="title" style="clear: both"><a name=
                   1038:               "terminology" id=
                   1039:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                   1040:             </div>
                   1041:           </div>
                   1042:         </div>
                   1043: 
                   1044:         <p>There has been a lot of talk about &#8220;<span class=
                   1045:         "quote">ports</span>&#8221;, &#8220;<span class=
                   1046:         "quote">packages</span>&#8221;, etc. so far. Here is a
                   1047:         description of all the terminology used within this
                   1048:         document.</p>
                   1049: 
                   1050:         <div class="variablelist">
                   1051:           <dl>
                   1052:             <dt><span class="term">Package</span></dt>
                   1053: 
                   1054:             <dd>
                   1055:               <p>A set of files and building instructions that
                   1056:               describe what's necessary to build a certain piece of
                   1057:               software using pkgsrc. Packages are traditionally
1.14      xtraeme  1058:               stored under <code class=
                   1059:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1060:             </dd>
                   1061: 
                   1062:             <dt><span class="term">The NetBSD package
                   1063:             system</span></dt>
                   1064: 
                   1065:             <dd>
                   1066:               <p>This is the former name of &#8220;<span class=
                   1067:               "quote">pkgsrc</span>&#8221;. It is part of the
1.27    ! rillig   1068:               NetBSD operating system and can be bootstrapped to
        !          1069:               run on non-NetBSD operating systems as well. It
        !          1070:               handles building (compiling), installing, and
        !          1071:               removing of packages.</p>
1.1       grant    1072:             </dd>
                   1073: 
                   1074:             <dt><span class="term">Distfile</span></dt>
                   1075: 
                   1076:             <dd>
                   1077:               <p>This term describes the file or files that are
                   1078:               provided by the author of the piece of software to
                   1079:               distribute his work. All the changes necessary to
                   1080:               build on NetBSD are reflected in the corresponding
                   1081:               package. Usually the distfile is in the form of a
                   1082:               compressed tar-archive, but other types are possible,
1.14      xtraeme  1083:               too. Distfiles are usually stored below <code class=
                   1084:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1085:             </dd>
                   1086: 
                   1087:             <dt><span class="term">Port</span></dt>
                   1088: 
                   1089:             <dd>
                   1090:               <p>This is the term used by FreeBSD and OpenBSD
                   1091:               people for what we call a package. In NetBSD
                   1092:               terminology, &#8220;<span class=
                   1093:               "quote">port</span>&#8221; refers to a different
                   1094:               architecture.</p>
                   1095:             </dd>
                   1096: 
                   1097:             <dt><span class="term">Precompiled/binary
                   1098:             package</span></dt>
                   1099: 
                   1100:             <dd>
                   1101:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1102:               distfile and stuffed together in a single
                   1103:               <code class="filename">.tgz</code> file so it can be
                   1104:               installed on machines of the same machine
                   1105:               architecture without the need to recompile. Packages
                   1106:               are usually generated in <code class=
                   1107:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1108:               an archive on <a href=
1.1       grant    1109:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1110:               "_top">ftp.NetBSD.org</a>.</p>
                   1111: 
                   1112:               <p>Sometimes, this is referred to by the term
                   1113:               &#8220;<span class="quote">package</span>&#8221; too,
                   1114:               especially in the context of precompiled
                   1115:               packages.</p>
                   1116:             </dd>
                   1117: 
                   1118:             <dt><span class="term">Program</span></dt>
                   1119: 
                   1120:             <dd>
                   1121:               <p>The piece of software to be installed which will
                   1122:               be constructed from all the files in the Distfile by
                   1123:               the actions defined in the corresponding package.</p>
                   1124:             </dd>
                   1125:           </dl>
                   1126:         </div>
                   1127:       </div>
                   1128: 
                   1129:       <div class="sect1" lang="en" xml:lang="en">
                   1130:         <div class="titlepage">
                   1131:           <div>
                   1132:             <div>
                   1133:               <h2 class="title" style="clear: both"><a name=
                   1134:               "typography" id=
                   1135:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1136:             </div>
                   1137:           </div>
                   1138:         </div>
                   1139: 
                   1140:         <p>When giving examples for commands, shell prompts are
                   1141:         used to show if the command should/can be issued as root,
                   1142:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1143:         privileges are sufficient. We use a <code class=
                   1144:         "prompt">#</code> for root's shell prompt, and a
1.27    ! rillig   1145:         <code class="prompt">%</code> for users' shell prompt,
1.14      xtraeme  1146:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1147:       </div>
                   1148:     </div>
                   1149: 
                   1150:     <div class="part" lang="en" xml:lang="en">
                   1151:       <div class="titlepage">
                   1152:         <div>
                   1153:           <div>
                   1154:             <h1 class="title"><a name="users-guide" id=
1.2       hubertf  1155:             "users-guide"></a>The pkgsrc user's guide</h1>
1.1       grant    1156:           </div>
                   1157:         </div>
                   1158:       </div>
                   1159: 
                   1160:       <div class="toc">
                   1161:         <p><b>Table of Contents</b></p>
                   1162: 
                   1163:         <dl>
                   1164:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1165:           get pkgsrc</a></span></dt>
                   1166: 
                   1167:           <dd>
                   1168:             <dl>
1.27    ! rillig   1169:               <dt><span class="sect1"><a href="#id2569429">2.1. As
1.1       grant    1170:               tar file</a></span></dt>
                   1171: 
1.27    ! rillig   1172:               <dt><span class="sect1"><a href="#id2569445">2.2. Via
1.1       grant    1173:               SUP</a></span></dt>
                   1174: 
1.27    ! rillig   1175:               <dt><span class="sect1"><a href="#id2569477">2.3. Via
1.1       grant    1176:               CVS</a></span></dt>
                   1177:             </dl>
                   1178:           </dd>
                   1179: 
                   1180:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1181:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1182: 
                   1183:           <dd>
                   1184:             <dl>
1.27    ! rillig   1185:               <dt><span class="sect1"><a href="#id2569587">3.1.
1.1       grant    1186:               Bootstrapping pkgsrc</a></span></dt>
                   1187: 
1.27    ! rillig   1188:               <dt><span class="sect1"><a href="#id2569768">3.2.
1.1       grant    1189:               Platform specific notes</a></span></dt>
                   1190: 
                   1191:               <dd>
                   1192:                 <dl>
                   1193:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1194:                   "#id2569774">3.2.1. Darwin (Mac OS
1.1       grant    1195:                   X)</a></span></dt>
                   1196: 
                   1197:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1198:                   "#id2569937">3.2.2. FreeBSD</a></span></dt>
1.22      tv       1199: 
                   1200:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1201:                   "#id2570449">3.2.3. Interix</a></span></dt>
1.1       grant    1202: 
                   1203:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1204:                   "#id2570750">3.2.4. IRIX</a></span></dt>
1.1       grant    1205: 
                   1206:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1207:                   "#id2570848">3.2.5. Linux</a></span></dt>
1.1       grant    1208: 
                   1209:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1210:                   "#id2570916">3.2.6. OpenBSD</a></span></dt>
1.1       grant    1211: 
                   1212:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1213:                   "#id2571028">3.2.7. Solaris</a></span></dt>
1.1       grant    1214:                 </dl>
                   1215:               </dd>
                   1216:             </dl>
                   1217:           </dd>
                   1218: 
                   1219:           <dt><span class="chapter"><a href="#using">4. Using
                   1220:           pkgsrc</a></span></dt>
                   1221: 
                   1222:           <dd>
                   1223:             <dl>
                   1224:               <dt><span class="sect1"><a href=
                   1225:               "#getting-started">4.1. Working with binary
                   1226:               packages</a></span></dt>
                   1227: 
                   1228:               <dd>
                   1229:                 <dl>
                   1230:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1231:                   "#id2571164">4.1.1. Where to get binary
1.1       grant    1232:                   packages</a></span></dt>
                   1233: 
                   1234:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1235:                   "#id2571218">4.1.2. How to use binary
1.1       grant    1236:                   packages</a></span></dt>
                   1237: 
                   1238:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1239:                   "#id2571392">4.1.3. A word of
1.1       grant    1240:                   warning</a></span></dt>
                   1241:                 </dl>
                   1242:               </dd>
                   1243: 
1.27    ! rillig   1244:               <dt><span class="sect1"><a href="#id2571949">4.2.
1.1       grant    1245:               Building packages from source</a></span></dt>
                   1246: 
                   1247:               <dd>
                   1248:                 <dl>
                   1249:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1250:                   "#id2571960">4.2.1. Requirements</a></span></dt>
1.1       grant    1251: 
                   1252:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1253:                   "#id2571980">4.2.2. Fetching
1.1       grant    1254:                   distfiles</a></span></dt>
                   1255: 
                   1256:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1257:                   "#id2572094">4.2.3. How to build and
1.1       grant    1258:                   install</a></span></dt>
                   1259: 
                   1260:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1261:                   "#id2623825">4.2.4. Selecting the
1.1       grant    1262:                   compiler</a></span></dt>
                   1263:                 </dl>
                   1264:               </dd>
                   1265:             </dl>
                   1266:           </dd>
                   1267: 
                   1268:           <dt><span class="chapter"><a href="#binary">5. Creating
                   1269:           binary packages</a></span></dt>
                   1270: 
                   1271:           <dd>
                   1272:             <dl>
1.27    ! rillig   1273:               <dt><span class="sect1"><a href="#id2623979">5.1.
1.1       grant    1274:               Building a single binary package</a></span></dt>
                   1275: 
1.27    ! rillig   1276:               <dt><span class="sect1"><a href="#id2624057">5.2.
1.1       grant    1277:               Settings for creation of binary
                   1278:               packages</a></span></dt>
                   1279: 
                   1280:               <dt><span class="sect1"><a href="#bulkbuild">5.3.
                   1281:               Doing a bulk build of all packages</a></span></dt>
                   1282: 
                   1283:               <dd>
                   1284:                 <dl>
                   1285:                   <dt><span class="sect2"><a href=
                   1286:                   "#binary.configuration">5.3.1.
                   1287:                   Configuration</a></span></dt>
                   1288: 
                   1289:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1290:                   "#id2624204">5.3.2. Other environmental
1.1       grant    1291:                   considerations</a></span></dt>
                   1292: 
                   1293:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1294:                   "#id2624245">5.3.3. Operation</a></span></dt>
1.1       grant    1295: 
                   1296:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1297:                   "#id2624382">5.3.4. What it does</a></span></dt>
1.1       grant    1298: 
                   1299:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1300:                   "#id2624439">5.3.5. Disk space
1.1       grant    1301:                   requirements</a></span></dt>
                   1302: 
                   1303:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1304:                   "#id2624466">5.3.6. Setting up a sandbox for
1.1       grant    1305:                   chroot'ed builds</a></span></dt>
                   1306: 
                   1307:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1308:                   "#id2624926">5.3.7. Building a partial set of
1.1       grant    1309:                   packages</a></span></dt>
1.13      hubertf  1310: 
                   1311:                   <dt><span class="sect2"><a href=
                   1312:                   "#bulk-upload">5.3.8. Uploading results of a bulk
                   1313:                   build</a></span></dt>
1.1       grant    1314:                 </dl>
                   1315:               </dd>
                   1316: 
1.27    ! rillig   1317:               <dt><span class="sect1"><a href="#id2625383">5.4.
1.1       grant    1318:               Creating a multiple CD-ROM packages
                   1319:               collection</a></span></dt>
                   1320: 
                   1321:               <dd>
                   1322:                 <dl>
                   1323:                   <dt><span class="sect2"><a href=
1.27    ! rillig   1324:                   "#id2625398">5.4.1. Example of
1.1       grant    1325:                   cdpack</a></span></dt>
                   1326:                 </dl>
                   1327:               </dd>
                   1328:             </dl>
                   1329:           </dd>
                   1330: 
                   1331:           <dt><span class="chapter"><a href="#faq">6. Frequently
                   1332:           Asked Questions</a></span></dt>
                   1333: 
                   1334:           <dd>
                   1335:             <dl>
1.27    ! rillig   1336:               <dt><span class="sect1"><a href="#id2625590">6.1. Are
1.18      xtraeme  1337:               there any mailing lists for pkg-related
1.1       grant    1338:               discussion?</a></span></dt>
                   1339: 
1.27    ! rillig   1340:               <dt><span class="sect1"><a href="#id2625724">6.2.
1.1       grant    1341:               Where's the pkgviews documentation?</a></span></dt>
                   1342: 
1.5       hubertf  1343:               <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    1344:               Utilities for package management
                   1345:               (pkgtools)</a></span></dt>
                   1346: 
1.27    ! rillig   1347:               <dt><span class="sect1"><a href="#id2625987">6.4. How
1.1       grant    1348:               to use pkgsrc as non-root</a></span></dt>
                   1349: 
1.27    ! rillig   1350:               <dt><span class="sect1"><a href="#id2625998">6.5. How
1.15      xtraeme  1351:               to resume transfers when fetching
                   1352:               distfiles?</a></span></dt>
1.14      xtraeme  1353: 
1.27    ! rillig   1354:               <dt><span class="sect1"><a href="#id2626049">6.6. How
1.1       grant    1355:               can I install/use XFree86 from
                   1356:               pkgsrc?</a></span></dt>
                   1357: 
1.27    ! rillig   1358:               <dt><span class="sect1"><a href="#id2626076">6.7. How
1.1       grant    1359:               can I install/use X.org from pkgsrc?</a></span></dt>
                   1360: 
1.27    ! rillig   1361:               <dt><span class="sect1"><a href="#id2626104">6.8. How
1.1       grant    1362:               to fetch files from behind a firewall</a></span></dt>
                   1363: 
1.27    ! rillig   1364:               <dt><span class="sect1"><a href="#id2626118">6.9. How
1.14      xtraeme  1365:               do I tell <span><strong class="command">make
                   1366:               fetch</strong></span> to do passive
1.1       grant    1367:               FTP?</a></span></dt>
                   1368: 
1.27    ! rillig   1369:               <dt><span class="sect1"><a href="#id2626169">6.10.
1.14      xtraeme  1370:               How to fetch all distfiles at once</a></span></dt>
1.1       grant    1371: 
1.27    ! rillig   1372:               <dt><span class="sect1"><a href="#id2626453">6.11.
1.14      xtraeme  1373:               What does &#8220;<span class="quote">Don't know how
                   1374:               to make /usr/share/tmac/tmac.andoc</span>&#8221;
                   1375:               mean?</a></span></dt>
1.13      hubertf  1376: 
1.27    ! rillig   1377:               <dt><span class="sect1"><a href="#id2626491">6.12.
1.14      xtraeme  1378:               What does &#8220;<span class="quote">Could not find
                   1379:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1380: 
1.27    ! rillig   1381:               <dt><span class="sect1"><a href="#id2626549">6.13.
1.1       grant    1382:               Using 'sudo' with pkgsrc</a></span></dt>
                   1383: 
1.14      xtraeme  1384:               <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    1385:               Configuration files handling and
                   1386:               placement</a></span></dt>
                   1387: 
                   1388:               <dt><span class="sect1"><a href=
1.14      xtraeme  1389:               "#audit-packages">6.15. Automated security
1.1       grant    1390:               checks</a></span></dt>
                   1391:             </dl>
                   1392:           </dd>
                   1393:         </dl>
                   1394:       </div>
                   1395: 
                   1396:       <div class="chapter" lang="en" xml:lang="en">
                   1397:         <div class="titlepage">
                   1398:           <div>
                   1399:             <div>
                   1400:               <h2 class="title"><a name="getting" id=
                   1401:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1402:               pkgsrc</h2>
                   1403:             </div>
                   1404:           </div>
                   1405:         </div>
                   1406: 
                   1407:         <div class="toc">
                   1408:           <p><b>Table of Contents</b></p>
                   1409: 
                   1410:           <dl>
1.27    ! rillig   1411:             <dt><span class="sect1"><a href="#id2569429">2.1. As
1.1       grant    1412:             tar file</a></span></dt>
                   1413: 
1.27    ! rillig   1414:             <dt><span class="sect1"><a href="#id2569445">2.2. Via
1.1       grant    1415:             SUP</a></span></dt>
                   1416: 
1.27    ! rillig   1417:             <dt><span class="sect1"><a href="#id2569477">2.3. Via
1.1       grant    1418:             CVS</a></span></dt>
                   1419:           </dl>
                   1420:         </div>
                   1421: 
                   1422:         <p>There are three ways to get pkgsrc. Either as a tar
                   1423:         file, via SUP, or via CVS. All three ways are described
                   1424:         here.</p>
                   1425: 
                   1426:         <div class="sect1" lang="en" xml:lang="en">
                   1427:           <div class="titlepage">
                   1428:             <div>
                   1429:               <div>
                   1430:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   1431:                 "id2569429" id="id2569429"></a>2.1.&nbsp;As tar
1.1       grant    1432:                 file</h2>
                   1433:               </div>
                   1434:             </div>
                   1435:           </div>
                   1436: 
                   1437:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1438:           file from <a href=
1.11      ben      1439:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.20      ben      1440:           target="_top">ftp.NetBSD.org</a> and unpack it into
                   1441:           <code class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1442:         </div>
                   1443: 
                   1444:         <div class="sect1" lang="en" xml:lang="en">
                   1445:           <div class="titlepage">
                   1446:             <div>
                   1447:               <div>
                   1448:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   1449:                 "id2569445" id="id2569445"></a>2.2.&nbsp;Via
1.1       grant    1450:                 SUP</h2>
                   1451:               </div>
                   1452:             </div>
                   1453:           </div>
                   1454: 
                   1455:           <p>As an alternative to the tar file, you can get pkgsrc
                   1456:           via the Software Update Protocol, SUP. To do so, make
                   1457:           sure your supfile has a line</p>
                   1458:           <pre class="programlisting">
                   1459: release=pkgsrc
                   1460: </pre>
                   1461: 
1.14      xtraeme  1462:           <p>in it, see the examples in <code class=
                   1463:           "filename">/usr/share/examples/supfiles</code>, and that
                   1464:           the <code class="filename">/usr/pkgsrc</code> directory
                   1465:           exists. Then, simply run <span><strong class=
                   1466:           "command">sup -v <em class=
                   1467:           "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1468:         </div>
                   1469: 
                   1470:         <div class="sect1" lang="en" xml:lang="en">
                   1471:           <div class="titlepage">
                   1472:             <div>
                   1473:               <div>
                   1474:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   1475:                 "id2569477" id="id2569477"></a>2.3.&nbsp;Via
1.1       grant    1476:                 CVS</h2>
                   1477:               </div>
                   1478:             </div>
                   1479:           </div>
                   1480: 
                   1481:           <p>To get pkgsrc via CVS, make sure you have
                   1482:           &#8220;<span class="quote">cvs</span>&#8221; installed.
1.27    ! rillig   1483:           To do an initial (full) checkout of pkgsrc, do the
        !          1484:           following steps:</p>
1.1       grant    1485:           <pre class="screen">
1.14      xtraeme  1486: <code class="prompt">%</code> <strong class=
                   1487: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1488: <code class="prompt">%</code> <strong class=
                   1489: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1490: <code class="prompt">%</code> <strong class=
                   1491: "userinput"><code>cd /usr</code></strong>
                   1492: <code class="prompt">%</code> <strong class=
                   1493: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1494: </pre>
                   1495: 
                   1496:           <p>This will create the <code class=
                   1497:           "filename">pkgsrc</code> directory in your <code class=
                   1498:           "filename">/usr</code>, and all the package source will
                   1499:           be stored under <code class=
                   1500:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1501:           initial checkout, make sure you have <code class=
                   1502:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1503:           <pre class="screen">
1.14      xtraeme  1504: <code class="prompt">%</code> <strong class=
                   1505: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1506: <code class="prompt">%</code> <strong class=
                   1507: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1508: </pre>
                   1509: 
                   1510:           <p>Please also note that it is possible to have multiple
                   1511:           copies of the pkgsrc hierarchy in use at any one time -
                   1512:           all work is done relatively within the pkgsrc tree.</p>
                   1513:         </div>
                   1514:       </div>
                   1515: 
                   1516:       <div class="chapter" lang="en" xml:lang="en">
                   1517:         <div class="titlepage">
                   1518:           <div>
                   1519:             <div>
                   1520:               <h2 class="title"><a name="platforms" id=
                   1521:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1522:               systems other than NetBSD</h2>
                   1523:             </div>
                   1524:           </div>
                   1525:         </div>
                   1526: 
                   1527:         <div class="toc">
                   1528:           <p><b>Table of Contents</b></p>
                   1529: 
                   1530:           <dl>
1.27    ! rillig   1531:             <dt><span class="sect1"><a href="#id2569587">3.1.
1.1       grant    1532:             Bootstrapping pkgsrc</a></span></dt>
                   1533: 
1.27    ! rillig   1534:             <dt><span class="sect1"><a href="#id2569768">3.2.
1.1       grant    1535:             Platform specific notes</a></span></dt>
                   1536: 
                   1537:             <dd>
                   1538:               <dl>
1.27    ! rillig   1539:                 <dt><span class="sect2"><a href="#id2569774">3.2.1.
1.1       grant    1540:                 Darwin (Mac OS X)</a></span></dt>
                   1541: 
1.27    ! rillig   1542:                 <dt><span class="sect2"><a href="#id2569937">3.2.2.
1.1       grant    1543:                 FreeBSD</a></span></dt>
                   1544: 
1.27    ! rillig   1545:                 <dt><span class="sect2"><a href="#id2570449">3.2.3.
1.1       grant    1546:                 Interix</a></span></dt>
                   1547: 
1.27    ! rillig   1548:                 <dt><span class="sect2"><a href="#id2570750">3.2.4.
1.1       grant    1549:                 IRIX</a></span></dt>
                   1550: 
1.27    ! rillig   1551:                 <dt><span class="sect2"><a href="#id2570848">3.2.5.
1.22      tv       1552:                 Linux</a></span></dt>
                   1553: 
1.27    ! rillig   1554:                 <dt><span class="sect2"><a href="#id2570916">3.2.6.
1.1       grant    1555:                 OpenBSD</a></span></dt>
                   1556: 
1.27    ! rillig   1557:                 <dt><span class="sect2"><a href="#id2571028">3.2.7.
1.1       grant    1558:                 Solaris</a></span></dt>
                   1559:               </dl>
                   1560:             </dd>
                   1561:           </dl>
                   1562:         </div>
                   1563: 
                   1564:         <div class="sect1" lang="en" xml:lang="en">
                   1565:           <div class="titlepage">
                   1566:             <div>
                   1567:               <div>
                   1568:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   1569:                 "id2569587" id=
        !          1570:                 "id2569587"></a>3.1.&nbsp;Bootstrapping pkgsrc</h2>
1.1       grant    1571:               </div>
                   1572:             </div>
                   1573:           </div>
                   1574: 
1.27    ! rillig   1575:           <p>For operating systems other than NetBSD, we provide a
1.1       grant    1576:           bootstrap kit to build the required tools to use pkgsrc
                   1577:           on your platform. Besides support for native NetBSD,
                   1578:           pkgsrc and the bootstrap kit have support for the
                   1579:           following operating systems:</p>
                   1580: 
                   1581:           <div class="itemizedlist">
                   1582:             <ul type="disc">
                   1583:               <li>
                   1584:                 <p>Darwin (Mac OS X)</p>
                   1585:               </li>
                   1586: 
                   1587:               <li>
1.16      grant    1588:                 <p>DragonFlyBSD</p>
                   1589:               </li>
                   1590: 
                   1591:               <li>
1.1       grant    1592:                 <p>FreeBSD</p>
                   1593:               </li>
                   1594: 
                   1595:               <li>
                   1596:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1597:               </li>
                   1598: 
                   1599:               <li>
                   1600:                 <p>IRIX</p>
                   1601:               </li>
                   1602: 
                   1603:               <li>
                   1604:                 <p>Linux</p>
                   1605:               </li>
                   1606: 
                   1607:               <li>
                   1608:                 <p>OpenBSD</p>
                   1609:               </li>
                   1610: 
                   1611:               <li>
                   1612:                 <p>Solaris</p>
                   1613:               </li>
1.16      grant    1614: 
                   1615:               <li>
                   1616:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1617:               </li>
1.1       grant    1618:             </ul>
                   1619:           </div>
                   1620: 
                   1621:           <p>Support for other platforms is under development.</p>
                   1622: 
                   1623:           <p>Installing the bootstrap kit should be as simple
                   1624:           as:</p>
                   1625:           <pre class="screen">
1.14      xtraeme  1626: <code class="prompt">#</code> <strong class=
                   1627: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1628: <code class="prompt">#</code> <strong class=
                   1629: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1630: <code class="prompt">#</code> <strong class=
                   1631: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1632: </pre>
                   1633: 
                   1634:           <p>See <a href="#getting" title=
                   1635:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter 2,
                   1636:           <i>Where to get pkgsrc</i></a> for other ways to get
1.14      xtraeme  1637:           pkgsrc before bootstrapping. The given
                   1638:           <span><strong class="command">bootstrap</strong></span>
                   1639:           command will use the defaults of <code class=
                   1640:           "filename">/usr/pkg</code> for the <span class=
                   1641:           "emphasis"><em>prefix</em></span> where programs will be
                   1642:           installed in, and <code class=
                   1643:           "filename">/var/db/pkg</code> for the package database
1.27    ! rillig   1644:           directory where pkgsrc will do its internal bookkeeping.
1.1       grant    1645:           However, these can also be set using command-line
1.27    ! rillig   1646:           arguments.</p>
1.1       grant    1647: 
                   1648:           <p>Binary packages for the pkgsrc tools and an initial
                   1649:           set of packages is available for supported platforms. An
                   1650:           up-to-date list of these can be found on <a href=
                   1651:           "http://www.pkgsrc.org/" target=
                   1652:           "_top">www.pkgsrc.org</a>.</p>
                   1653:         </div>
                   1654: 
                   1655:         <div class="sect1" lang="en" xml:lang="en">
                   1656:           <div class="titlepage">
                   1657:             <div>
                   1658:               <div>
                   1659:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   1660:                 "id2569768" id="id2569768"></a>3.2.&nbsp;Platform
1.1       grant    1661:                 specific notes</h2>
                   1662:               </div>
                   1663:             </div>
                   1664:           </div>
                   1665: 
                   1666:           <p>Here are some platform-specific notes you should be
                   1667:           aware of.</p>
                   1668: 
                   1669:           <div class="sect2" lang="en" xml:lang="en">
                   1670:             <div class="titlepage">
                   1671:               <div>
                   1672:                 <div>
1.27    ! rillig   1673:                   <h3 class="title"><a name="id2569774" id=
        !          1674:                   "id2569774"></a>3.2.1.&nbsp;Darwin (Mac OS
1.1       grant    1675:                   X)</h3>
                   1676:                 </div>
                   1677:               </div>
                   1678:             </div>
                   1679: 
                   1680:             <p>Darwin 5.x and 6.x are supported. There are two
                   1681:             methods of using pkgsrc on Mac OS X, by using a
                   1682:             <a href="#platform.osx-image" title=
                   1683:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1684:             <a href="#platform.osx-ufs" title=
                   1685:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1686:             partition</a>.</p>
                   1687: 
                   1688:             <p>Before you start, you will need to download and
                   1689:             install the Mac OS X Developer Tools from Apple's
                   1690:             Developer Connection. See <a href=
                   1691:             "http://developer.apple.com/macosx/" target=
                   1692:             "_top">http://developer.apple.com/macosx/</a> for
                   1693:             details. Also, make sure you install X11 for Mac OS X
                   1694:             and the X11 SDK from <a href=
                   1695:             "http://www.apple.com/macosx/x11/download/" target=
                   1696:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1697:             you intend to build packages that use the X11 Window
                   1698:             System.</p>
                   1699: 
                   1700:             <p>If you already have a UFS partition, or have a spare
                   1701:             partition that you can format as UFS, it is recommended
                   1702:             to use that instead of the disk image. It'll be
                   1703:             somewhat faster and will mount automatically at boot
                   1704:             time, where you must manually mount a disk image.</p>
                   1705: 
                   1706:             <div class="note" style=
                   1707:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1708:               <h3 class="title">Note</h3>
                   1709: 
                   1710:               <p>You cannot use a HFS+ file system for pkgsrc,
                   1711:               because pkgsrc currently requires the filesystem to
                   1712:               be case-sensitive, and HFS+ is not.</p>
                   1713:             </div>
                   1714: 
                   1715:             <div class="sect3" lang="en" xml:lang="en">
                   1716:               <div class="titlepage">
                   1717:                 <div>
                   1718:                   <div>
                   1719:                     <h4 class="title"><a name="platform.osx-image"
                   1720:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
                   1721:                     a disk image</h4>
                   1722:                   </div>
                   1723:                 </div>
                   1724:               </div>
                   1725: 
                   1726:               <p>Create the disk image:</p>
                   1727:               <pre class="screen">
1.14      xtraeme  1728: <code class="prompt">#</code> <strong class=
                   1729: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1730: <code class="prompt">#</code> <strong class=
                   1731: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   1732: <code class="prompt">#</code> <strong class=
                   1733: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   1734: <code class="prompt">#</code> <strong class=
                   1735: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    1736: </pre>
                   1737: 
                   1738:               <p>That's it!</p>
                   1739:             </div>
                   1740: 
                   1741:             <div class="sect3" lang="en" xml:lang="en">
                   1742:               <div class="titlepage">
                   1743:                 <div>
                   1744:                   <div>
                   1745:                     <h4 class="title"><a name="platform.osx-ufs"
                   1746:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
                   1747:                     UFS partition</h4>
                   1748:                   </div>
                   1749:                 </div>
                   1750:               </div>
                   1751: 
1.14      xtraeme  1752:               <p>By default, <code class="filename">/usr</code>
                   1753:               will be on your root file system, normally HFS+. It
                   1754:               is possible to use the default <span class=
                   1755:               "emphasis"><em>prefix</em></span> of <code class=
                   1756:               "filename">/usr/pkg</code> by symlinking <code class=
                   1757:               "filename">/usr/pkg</code> to a directory on a UFS
                   1758:               file system. Obviously, another symlink is required
                   1759:               if you want to place the package database directory
                   1760:               outside the <span class=
                   1761:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    1762:               <pre class="screen">
1.14      xtraeme  1763: <code class="prompt">#</code> <strong class=
1.22      tv       1764: "userinput"><code>./bootstrap --pkgdbdir /usr/pkg/pkgdb --pkgsrcdir /Volumes/ufs/pkgsrc</code></strong>
1.1       grant    1765: </pre>
                   1766: 
                   1767:               <p>If you created your partitions at the time of
                   1768:               installing Mac OS X and formatted the target
                   1769:               partition as UFS, it should automatically mount on
1.14      xtraeme  1770:               <code class="filename">/Volumes/&lt;volume
                   1771:               name&gt;</code> when the machine boots. If you are
1.1       grant    1772:               (re)formatting a partition as UFS, you need to ensure
                   1773:               that the partition map correctly reflects
                   1774:               &#8220;<span class="quote">Apple_UFS</span>&#8221;
                   1775:               and not &#8220;<span class=
                   1776:               "quote">Apple_HFS</span>&#8221;.</p>
                   1777: 
                   1778:               <p>The problem is that none of the disk tools will
                   1779:               let you touch a disk that is booted from. You can
                   1780:               unmount the partition, but even if you newfs it, the
                   1781:               partition type will be incorrect and the automounter
                   1782:               won't mount it. It can be mounted manually, but it
                   1783:               won't appear in Finder.</p>
                   1784: 
                   1785:               <p>You'll need to boot off of the OS X Installation
                   1786:               (User) CD. When the Installation program starts, go
                   1787:               up to the menu and select Disk Utility. Now, you will
                   1788:               be able to select the partition you want to be UFS,
                   1789:               and Format it Apple UFS. Quit the Disk Utility, quit
                   1790:               the installer which will reboot your machine. The new
                   1791:               UFS file system will appear in Finder.</p>
                   1792: 
                   1793:               <p>Be aware that the permissions on the new file
                   1794:               system will be writable by root only.</p>
                   1795: 
                   1796:               <p>This note is as of 10.2 (Jaguar) and applies to
                   1797:               earlier versions. Hopefully Apple will fix Disk
                   1798:               Utility in 10.3 (Panther).</p>
                   1799:             </div>
                   1800:           </div>
                   1801: 
                   1802:           <div class="sect2" lang="en" xml:lang="en">
                   1803:             <div class="titlepage">
                   1804:               <div>
                   1805:                 <div>
1.27    ! rillig   1806:                   <h3 class="title"><a name="id2569937" id=
        !          1807:                   "id2569937"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    1808:                 </div>
                   1809:               </div>
                   1810:             </div>
                   1811: 
                   1812:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   1813:             supported, other versions may work.</p>
                   1814: 
                   1815:             <p>Care should be taken so that the tools that this kit
                   1816:             installs do not conflict with the FreeBSD userland
                   1817:             tools. There are several steps:</p>
                   1818: 
                   1819:             <div class="orderedlist">
                   1820:               <ol type="1">
                   1821:                 <li>
                   1822:                   <p>FreeBSD stores its ports pkg database in
1.14      xtraeme  1823:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    1824:                   therefore recommended that you choose a different
1.14      xtraeme  1825:                   location (e.g. <code class=
                   1826:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    1827:                   --pkgdbdir option to the bootstrap script.</p>
                   1828:                 </li>
                   1829: 
                   1830:                 <li>
                   1831:                   <p>If you do not intend to use the FreeBSD ports
                   1832:                   tools, it's probably a good idea to move them out
                   1833:                   of the way to avoid confusion, e.g.</p>
                   1834:                   <pre class="screen">
1.14      xtraeme  1835: <code class="prompt">#</code> <strong class=
                   1836: "userinput"><code>cd /usr/sbin</code></strong>
                   1837: <code class="prompt">#</code> <strong class=
                   1838: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   1839: <code class="prompt">#</code> <strong class=
                   1840: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   1841: <code class="prompt">#</code> <strong class=
                   1842: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   1843: <code class="prompt">#</code> <strong class=
                   1844: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    1845: </pre>
                   1846:                 </li>
                   1847: 
                   1848:                 <li>
1.14      xtraeme  1849:                   <p>An example <code class=
                   1850:                   "filename">/etc/mk.conf</code> file will be
                   1851:                   placed in <code class=
                   1852:                   "filename">/etc/mk.conf.example</code> file when
                   1853:                   you use the bootstrap script.</p>
1.1       grant    1854:                 </li>
                   1855:               </ol>
                   1856:             </div>
                   1857:           </div>
                   1858: 
                   1859:           <div class="sect2" lang="en" xml:lang="en">
                   1860:             <div class="titlepage">
                   1861:               <div>
                   1862:                 <div>
1.27    ! rillig   1863:                   <h3 class="title"><a name="id2570449" id=
        !          1864:                   "id2570449"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    1865:                 </div>
                   1866:               </div>
                   1867:             </div>
                   1868: 
                   1869:             <p>Interix is a POSIX compatible subsystem for the
                   1870:             Windows NT kernel, providing a Unix-like environment
                   1871:             with a tighter kernel integration than available with
                   1872:             Cygwin. It is part of the Windows Services for Unix
                   1873:             package, available for free for any licensed copy of
1.22      tv       1874:             Windows 2000, XP (not including XP Home), or 2003. SFU
                   1875:             can be downloaded from <a href=
                   1876:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    1877:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   1878: 
                   1879:             <p>Services for Unix 3.5, current as of this writing,
                   1880:             has been tested. 3.0 or 3.1 may work, but are not
                   1881:             officially supported. (The main difference in 3.0/3.1
                   1882:             is lack of pthreads.)</p>
                   1883: 
                   1884:             <div class="sect3" lang="en" xml:lang="en">
                   1885:               <div class="titlepage">
                   1886:                 <div>
                   1887:                   <div>
                   1888:                     <h4 class="title"><a name=
                   1889:                     "platform.interix-sfu-install" id=
                   1890:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  1891:                     installing Interix/SFU</h4>
1.1       grant    1892:                   </div>
                   1893:                 </div>
                   1894:               </div>
                   1895: 
                   1896:               <p>At an absolute minimum, the following packages
                   1897:               must be installed from the Windows Services for Unix
                   1898:               3.5 distribution in order to use pkgsrc:</p>
                   1899: 
                   1900:               <div class="itemizedlist">
                   1901:                 <ul type="disc">
                   1902:                   <li>
                   1903:                     <p>Utilities -&gt; Base Utilities</p>
                   1904:                   </li>
                   1905: 
                   1906:                   <li>
                   1907:                     <p>Interix GNU Components -&gt; (all)</p>
                   1908:                   </li>
                   1909: 
                   1910:                   <li>
                   1911:                     <p>Remote Connectivity</p>
                   1912:                   </li>
                   1913: 
                   1914:                   <li>
                   1915:                     <p>Interix SDK</p>
                   1916:                   </li>
                   1917:                 </ul>
                   1918:               </div>
                   1919: 
                   1920:               <p>When using pkgsrc on Interix, DO NOT install the
                   1921:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   1922:               without shared module support, installed to
                   1923:               /usr/local, and will only cause confusion. Instead,
                   1924:               install Perl 5.8 from pkgsrc (or from a binary
                   1925:               package).</p>
                   1926: 
                   1927:               <p>The Remote Connectivity subcomponent "Windows
                   1928:               Remote Shell Service" does not need to be installed,
                   1929:               but Remote Connectivity itself should be installed in
                   1930:               order to have a working inetd.</p>
                   1931: 
                   1932:               <p>Finally, during installation you may be asked
                   1933:               whether to enable setuid behavior for Interix
                   1934:               programs, and whether to make pathnames default to
                   1935:               case-sensitive. Setuid should be enabled, and
                   1936:               case-sensitivity MUST be enabled. (Without
                   1937:               case-sensitivity, a large number of packages
                   1938:               including perl will not build.)</p>
                   1939:             </div>
                   1940: 
                   1941:             <div class="sect3" lang="en" xml:lang="en">
                   1942:               <div class="titlepage">
                   1943:                 <div>
                   1944:                   <div>
                   1945:                     <h4 class="title"><a name=
                   1946:                     "platform.interix-sfu-postinstall" id=
                   1947:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   1948:                     to do if Interix/SFU is already installed</h4>
                   1949:                   </div>
                   1950:                 </div>
                   1951:               </div>
                   1952: 
                   1953:               <p>If SFU is already installed and you wish to alter
                   1954:               these settings to work with pkgsrc, note the
                   1955:               following things.</p>
                   1956: 
                   1957:               <div class="itemizedlist">
                   1958:                 <ul type="disc">
                   1959:                   <li>
                   1960:                     <p>To uninstall UNIX Perl, use Add/Remove
                   1961:                     Programs, select Microsoft Windows Services for
                   1962:                     UNIX, then click Change. In the installer,
                   1963:                     choose Add or Remove, then uncheck
                   1964:                     Utilities-&gt;UNIX Perl.</p>
                   1965:                   </li>
                   1966: 
                   1967:                   <li>
                   1968:                     <p>To enable case-sensitivity for the
                   1969:                     filesystem, run REGEDIT.EXE, and change the
                   1970:                     following registry key:</p>
                   1971: 
                   1972:                     <p>
                   1973:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   1974:                     Manager\kernel</p>
                   1975: 
                   1976:                     <p>Set the DWORD value "obcaseinsensitive" to
                   1977:                     0; then reboot.</p>
                   1978:                   </li>
                   1979: 
                   1980:                   <li>
                   1981:                     <p>To enable setuid binaries (optional), run
                   1982:                     REGEDIT.EXE, and change the following registry
                   1983:                     key:</p>
                   1984: 
                   1985:                     <p>
                   1986:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   1987:                     for UNIX</p>
                   1988: 
                   1989:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   1990:                     to 1; then reboot.</p>
                   1991:                   </li>
                   1992:                 </ul>
                   1993:               </div>
                   1994:             </div>
                   1995: 
                   1996:             <div class="sect3" lang="en" xml:lang="en">
                   1997:               <div class="titlepage">
                   1998:                 <div>
                   1999:                   <div>
                   2000:                     <h4 class="title"><a name=
                   2001:                     "platform.interix-notes" id=
                   2002:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   2003:                     notes for using pkgsrc</h4>
                   2004:                   </div>
                   2005:                 </div>
                   2006:               </div>
                   2007: 
                   2008:               <p>The package imanager (either the pkgsrc "su" user,
                   2009:               or the user running "pkg_add") must be a member of
                   2010:               the local Administrators group. Such a user must also
                   2011:               be used to run the bootstrap. This is slightly
                   2012:               relaxed from the normal pkgsrc requirement of
                   2013:               "root".</p>
                   2014: 
                   2015:               <p>The package manager should use a umask of 002.
                   2016:               "make install" will automatically complain if this is
                   2017:               not the case. This ensures that directories written
                   2018:               in /var/db/pkg are Administrators-group
                   2019:               writeable.</p>
                   2020: 
                   2021:               <p>The popular Interix binary packages from
                   2022:               http://www.interopsystems.com/ use an older version
                   2023:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   2024:               used in conjunction with pkgsrc. If you choose to use
                   2025:               them at the same time as the pkgsrc packages, ensure
                   2026:               that you use the proper pkg_* tools for each type of
                   2027:               binary package.</p>
1.22      tv       2028: 
                   2029:               <p>The TERM setting used for DOS-type console windows
                   2030:               (including those invoked by the csh and ksh startup
                   2031:               shortcuts) is "interix". Most systems don't have a
                   2032:               termcap/terminfo entry for it, but the following
                   2033:               .termcap entry provides adequate emulation in most
                   2034:               cases:</p>
                   2035:               <pre class="programlisting">
                   2036: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
                   2037: </pre>
1.1       grant    2038:             </div>
                   2039:           </div>
                   2040: 
                   2041:           <div class="sect2" lang="en" xml:lang="en">
                   2042:             <div class="titlepage">
                   2043:               <div>
                   2044:                 <div>
1.27    ! rillig   2045:                   <h3 class="title"><a name="id2570750" id=
        !          2046:                   "id2570750"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    2047:                 </div>
                   2048:               </div>
                   2049:             </div>
                   2050: 
                   2051:             <p>You will need a working C compiler, either gcc or
                   2052:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  2053:             the <code class="varname">CC</code> environment
                   2054:             variable according to your preference. If you do not
                   2055:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2056:             download a gcc tardist file from <a href=
                   2057:             "http://freeware.sgi.com/" target=
                   2058:             "_top">http://freeware.sgi.com/</a>.</p>
                   2059: 
                   2060:             <p>Please note that you will need IRIX 6.5.17 or
                   2061:             higher, as this is the earliest version of IRIX
1.24      wiz      2062:             providing support for <a href=
                   2063:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_indextoname+3+NetBSD-current">
                   2064:             <span class="citerefentry"><span class=
                   2065:             "refentrytitle">if_indextoname</span>(3)</span></a>,
                   2066:             <a href=
                   2067:             "http://netbsd.gw.com/cgi-bin/man-cgi?if_nametoindex+3+NetBSD-current">
                   2068:             <span class="citerefentry"><span class=
                   2069:             "refentrytitle">if_nametoindex</span>(3)</span></a>,
                   2070:             etc.</p>
1.1       grant    2071: 
1.27    ! rillig   2072:             <p>At this point in time, pkgsrc only supports one ABI
        !          2073:             at a time. That is, you can not switch between the old
        !          2074:             32-bit ABI, the new 32-bit ABI and the 64-bit ABI. If
        !          2075:             you start out using "abi=n32", that's what all your
        !          2076:             packages will be built with.</p>
1.1       grant    2077: 
                   2078:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2079:             conflicting <code class="varname">CFLAGS</code> in your
                   2080:             environment or the <code class=
                   2081:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2082:             that you do not try to link n32 object files with lib64
1.14      xtraeme  2083:             or vice versa. Check your <code class=
                   2084:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2085: 
                   2086:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2087:             from a different host, please make sure to set
1.14      xtraeme  2088:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2089:             directory, as it appears that IRIX linker occasionally
                   2090:             runs into issues when trying to link over a network
                   2091:             mounted filesystem.</p>
                   2092: 
                   2093:             <p>The bootstrapping process should set all the right
                   2094:             options for programs such as imake(1), but you may want
                   2095:             to set some options depending on your local setup.
1.14      xtraeme  2096:             Please see <code class=
                   2097:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.27    ! rillig   2098:             course, your compiler's man pages for details.</p>
1.22      tv       2099: 
                   2100:             <p>If you are using SGI's MIPSPro compiler, please
                   2101:             set</p>
                   2102:             <pre class="programlisting">
                   2103: PKGSRC_COMPILER=mipspro
                   2104: </pre>
                   2105: 
                   2106:             <p>in <code class="filename">/etc/mk.conf</code>.
                   2107:             Otherwise, pkgsrc will assume you are using gcc and may
                   2108:             end up passing invalid flags to the compiler. Note that
                   2109:             bootstrap should create an appropriate <code class=
                   2110:             "filename">mk.conf.example</code> by default.</p>
                   2111: 
                   2112:             <p>If you have both the MIPSPro compiler chain
                   2113:             installed as well as gcc, but want to make sure that
                   2114:             MIPRPro is used, please set your <code class=
                   2115:             "varname">PATH</code> to <span class=
                   2116:             "emphasis"><em>not</em></span> include the location of
                   2117:             gcc (often <code class=
                   2118:             "filename">/usr/freeware/bin</code>), and (important)
                   2119:             pass the '--preserve-path' flag.</p>
1.1       grant    2120:           </div>
                   2121: 
                   2122:           <div class="sect2" lang="en" xml:lang="en">
                   2123:             <div class="titlepage">
                   2124:               <div>
                   2125:                 <div>
1.27    ! rillig   2126:                   <h3 class="title"><a name="id2570848" id=
        !          2127:                   "id2570848"></a>3.2.5.&nbsp;Linux</h3>
1.22      tv       2128:                 </div>
                   2129:               </div>
                   2130:             </div>
                   2131: 
                   2132:             <p>Some versions of Linux (for example Debian
                   2133:             GNU/Linux) need either libtermcap or libcurses
                   2134:             (libncurses). Installing the distributions
                   2135:             libncurses-dev package (or equivalent) should fix the
                   2136:             problem.</p>
                   2137: 
                   2138:             <p>pkgsrc supports both gcc (GNU Compiler Collection)
                   2139:             and icc (Intel C++ Compiler). gcc is the default. icc
                   2140:             8.0 and 8.1 on i386 have been tested.</p>
                   2141: 
                   2142:             <p>To bootstrap using icc, assuming the default icc
                   2143:             installation directory:</p>
                   2144:             <pre class="programlisting">
                   2145: env CC=/opt/intel_cc_80/bin/icc LDFLAGS=-static-libcxa \
                   2146:                 ac_cv___attribute__=yes ./bootstrap
                   2147: </pre>
                   2148: 
                   2149:             <div class="note" style=
                   2150:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2151:               <h3 class="title">Note</h3>
                   2152: 
                   2153:               <p>icc 8.1 needs the `-i-static' argument instead of
                   2154:               -static-libcxa.</p>
                   2155:             </div>
                   2156: 
                   2157:             <p>icc supports __attribute__, but the GNU configure
                   2158:             test uses a nested function, which icc does not
                   2159:             support. #undef'ing __attribute__ has the unfortunate
                   2160:             side-effect of breaking many of the Linux header files,
                   2161:             which cannot be compiled properly without
                   2162:             __attribute__. The test must be overridden so that
                   2163:             __attribute__ is assumed supported by the compiler.</p>
                   2164: 
                   2165:             <p>After bootstrapping, you should set <code class=
                   2166:             "varname">PKGSRC_COMPILER</code> in <code class=
                   2167:             "filename">/etc/mk.conf</code>:</p>
                   2168:             <pre class="programlisting">
                   2169: PKGSRC_COMPILER=icc
                   2170: </pre>
                   2171: 
                   2172:             <p>The default installation directory for icc is
                   2173:             <code class="filename">/opt/intel_cc_80</code>, which
                   2174:             is also the pkgsrc default. If you have installed it
                   2175:             into a different directory, set <code class=
                   2176:             "varname">ICCBASE</code> in <code class=
                   2177:             "filename">/etc/mk.conf</code>:</p>
                   2178:             <pre class="programlisting">
                   2179: ICCBASE=/opt/icc
                   2180: </pre>
                   2181: 
                   2182:             <p>pkgsrc uses the static linking method of the runtime
                   2183:             libraries provided by icc, so binaries can be run on
                   2184:             other systems which do not have the shared libraries
                   2185:             installed.</p>
                   2186: 
                   2187:             <p>Libtool, however, extracts a list of libraries from
1.24      wiz      2188:             the <a href=
                   2189:             "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   2190:             <span class="citerefentry"><span class=
                   2191:             "refentrytitle">ld</span>(1)</span></a> command run
                   2192:             when linking a C++ shared library and records it,
                   2193:             throwing away the -Bstatic and -Bdynamic options
                   2194:             interspersed between the libraries. This means that
                   2195:             libtool-linked C++ shared libraries will have a runtime
                   2196:             dependency on the icc libraries until this is fixed in
                   2197:             libtool.</p>
1.22      tv       2198:           </div>
                   2199: 
                   2200:           <div class="sect2" lang="en" xml:lang="en">
                   2201:             <div class="titlepage">
                   2202:               <div>
                   2203:                 <div>
1.27    ! rillig   2204:                   <h3 class="title"><a name="id2570916" id=
        !          2205:                   "id2570916"></a>3.2.6.&nbsp;OpenBSD</h3>
1.1       grant    2206:                 </div>
                   2207:               </div>
                   2208:             </div>
                   2209: 
                   2210:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2211: 
                   2212:             <p>Care should be taken so that the tools that this kit
                   2213:             installs do not conflict with the OpenBSD userland
                   2214:             tools. There are several steps:</p>
                   2215: 
                   2216:             <div class="orderedlist">
                   2217:               <ol type="1">
                   2218:                 <li>
                   2219:                   <p>OpenBSD stores its ports pkg database in
1.14      xtraeme  2220:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    2221:                   therefore recommended that you choose a different
1.14      xtraeme  2222:                   location (e.g. <code class=
                   2223:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2224:                   --pkgdbdir option to the bootstrap script.</p>
                   2225:                 </li>
                   2226: 
                   2227:                 <li>
                   2228:                   <p>If you do not intend to use the OpenBSD ports
                   2229:                   tools, it's probably a good idea to move them out
                   2230:                   of the way to avoid confusion, e.g.</p>
                   2231:                   <pre class="screen">
1.14      xtraeme  2232: <code class="prompt">#</code> <strong class=
                   2233: "userinput"><code>cd /usr/sbin</code></strong>
                   2234: <code class="prompt">#</code> <strong class=
                   2235: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2236: <code class="prompt">#</code> <strong class=
                   2237: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2238: <code class="prompt">#</code> <strong class=
                   2239: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2240: <code class="prompt">#</code> <strong class=
                   2241: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2242: </pre>
                   2243:                 </li>
                   2244: 
                   2245:                 <li>
1.14      xtraeme  2246:                   <p>An example <code class=
                   2247:                   "filename">/etc/mk.conf</code> file will be
                   2248:                   placed in <code class=
                   2249:                   "filename">/etc/mk.conf.example</code> file when
                   2250:                   you use the bootstrap script. OpenBSD's make
                   2251:                   program uses <code class=
                   2252:                   "filename">/etc/mk.conf</code> as well. You can
1.1       grant    2253:                   work around this by enclosing all the pkgsrc
                   2254:                   specific parts of the file with:</p>
                   2255:                   <pre class="programlisting">
                   2256: .ifdef BSD_PKG_MK
1.11      ben      2257: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1       grant    2258: .else
                   2259: # OpenBSD stuff
                   2260: .endif
                   2261: </pre>
                   2262:                 </li>
                   2263:               </ol>
                   2264:             </div>
                   2265:           </div>
                   2266: 
                   2267:           <div class="sect2" lang="en" xml:lang="en">
                   2268:             <div class="titlepage">
                   2269:               <div>
                   2270:                 <div>
1.27    ! rillig   2271:                   <h3 class="title"><a name="id2571028" id=
        !          2272:                   "id2571028"></a>3.2.7.&nbsp;Solaris</h3>
1.1       grant    2273:                 </div>
                   2274:               </div>
                   2275:             </div>
                   2276: 
                   2277:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2278:             sparc. You will need a working C compiler. Both gcc
                   2279:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2280: 
                   2281:             <p>The following packages are required on Solaris 8 for
                   2282:             the bootstrap process and to build packages.</p>
                   2283: 
                   2284:             <div class="itemizedlist">
                   2285:               <ul type="disc">
                   2286:                 <li>
                   2287:                   <p>SUNWsprot</p>
                   2288:                 </li>
                   2289: 
                   2290:                 <li>
                   2291:                   <p>SUNWarc</p>
                   2292:                 </li>
                   2293: 
                   2294:                 <li>
                   2295:                   <p>SUNWbtool</p>
                   2296:                 </li>
                   2297: 
                   2298:                 <li>
                   2299:                   <p>SUNWtoo</p>
                   2300:                 </li>
                   2301: 
                   2302:                 <li>
                   2303:                   <p>SUNWlibm</p>
                   2304:                 </li>
                   2305:               </ul>
                   2306:             </div>
                   2307: 
                   2308:             <p>Please note the use of GNU binutils on Solaris is
                   2309:             <span class="emphasis"><em>not</em></span>
                   2310:             supported.</p>
                   2311: 
                   2312:             <div class="sect3" lang="en" xml:lang="en">
                   2313:               <div class="titlepage">
                   2314:                 <div>
                   2315:                   <div>
1.27    ! rillig   2316:                     <h4 class="title"><a name="id2571059" id=
        !          2317:                     "id2571059"></a>3.2.7.1.&nbsp;If you are using
1.1       grant    2318:                     gcc</h4>
                   2319:                   </div>
                   2320:                 </div>
                   2321:               </div>
                   2322: 
                   2323:               <p>It makes life much simpler if you only use the
                   2324:               same gcc consistently for building all packages.</p>
                   2325: 
                   2326:               <p>It is recommended that an external gcc be used
                   2327:               only for bootstrapping, then either build gcc from
                   2328:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2329:               href=
                   2330:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.20      ben      2331:               class="pkgname">lang/gcc</a> or install a binary gcc
                   2332:               package, then remove gcc used during
                   2333:               bootstrapping.</p>
1.1       grant    2334: 
                   2335:               <p>Binary packages of gcc can be found through
                   2336:               <a href=
                   2337:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.20      ben      2338:               target=
                   2339:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2340:             </div>
                   2341: 
                   2342:             <div class="sect3" lang="en" xml:lang="en">
                   2343:               <div class="titlepage">
                   2344:                 <div>
                   2345:                   <div>
1.27    ! rillig   2346:                     <h4 class="title"><a name="id2571080" id=
        !          2347:                     "id2571080"></a>3.2.7.2.&nbsp;If you are using
1.1       grant    2348:                     Sun WorkShop</h4>
                   2349:                   </div>
                   2350:                 </div>
                   2351:               </div>
                   2352: 
                   2353:               <p>You will need at least the following packages
                   2354:               installed (from WorkShop 5.0)</p>
                   2355: 
                   2356:               <div class="itemizedlist">
                   2357:                 <ul type="disc">
                   2358:                   <li>
                   2359:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2360:                   </li>
                   2361: 
                   2362:                   <li>
                   2363:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2364:                   </li>
                   2365: 
                   2366:                   <li>
                   2367:                     <p>SPROild - Sun WorkShop Incremental
                   2368:                     Linker</p>
                   2369:                   </li>
                   2370: 
                   2371:                   <li>
                   2372:                     <p>SPROlang - Sun WorkShop Compilers common
                   2373:                     components</p>
                   2374:                   </li>
                   2375:                 </ul>
                   2376:               </div>
                   2377: 
1.14      xtraeme  2378:               <p>You should set <code class="varname">CC</code>,
                   2379:               <code class="varname">CXX</code> and optionally,
                   2380:               <code class="varname">CPP</code> in <code class=
                   2381:               "filename">/etc/mk.conf</code>, eg.</p>
1.1       grant    2382:               <pre class="programlisting">
1.27    ! rillig   2383: CC=     cc
1.1       grant    2384: CXX=    CC
                   2385: CPP=    /usr/ccs/lib/cpp
                   2386: </pre>
                   2387: 
                   2388:               <p>You may also want to build 64-bit binaries,
                   2389:               eg.</p>
                   2390:               <pre class="programlisting">
                   2391: CFLAGS= -xtarget=ultra -xarch=v9
                   2392: </pre>
                   2393: 
                   2394:               <p>Whichever compiler you use, please ensure the
                   2395:               compiler tools and your $prefix are in your
1.14      xtraeme  2396:               <code class="varname">PATH</code>. This includes
                   2397:               <code class="filename">/usr/ccs/{bin,lib}</code> and
                   2398:               eg. <code class=
                   2399:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2400:             </div>
                   2401:           </div>
                   2402:         </div>
                   2403:       </div>
                   2404: 
                   2405:       <div class="chapter" lang="en" xml:lang="en">
                   2406:         <div class="titlepage">
                   2407:           <div>
                   2408:             <div>
                   2409:               <h2 class="title"><a name="using" id=
                   2410:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2411:             </div>
                   2412:           </div>
                   2413:         </div>
                   2414: 
                   2415:         <div class="toc">
                   2416:           <p><b>Table of Contents</b></p>
                   2417: 
                   2418:           <dl>
                   2419:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2420:             Working with binary packages</a></span></dt>
                   2421: 
                   2422:             <dd>
                   2423:               <dl>
1.27    ! rillig   2424:                 <dt><span class="sect2"><a href="#id2571164">4.1.1.
1.1       grant    2425:                 Where to get binary packages</a></span></dt>
                   2426: 
1.27    ! rillig   2427:                 <dt><span class="sect2"><a href="#id2571218">4.1.2.
1.1       grant    2428:                 How to use binary packages</a></span></dt>
                   2429: 
1.27    ! rillig   2430:                 <dt><span class="sect2"><a href="#id2571392">4.1.3.
1.1       grant    2431:                 A word of warning</a></span></dt>
                   2432:               </dl>
                   2433:             </dd>
                   2434: 
1.27    ! rillig   2435:             <dt><span class="sect1"><a href="#id2571949">4.2.
1.1       grant    2436:             Building packages from source</a></span></dt>
                   2437: 
                   2438:             <dd>
                   2439:               <dl>
1.27    ! rillig   2440:                 <dt><span class="sect2"><a href="#id2571960">4.2.1.
1.1       grant    2441:                 Requirements</a></span></dt>
                   2442: 
1.27    ! rillig   2443:                 <dt><span class="sect2"><a href="#id2571980">4.2.2.
1.1       grant    2444:                 Fetching distfiles</a></span></dt>
                   2445: 
1.27    ! rillig   2446:                 <dt><span class="sect2"><a href="#id2572094">4.2.3.
1.1       grant    2447:                 How to build and install</a></span></dt>
                   2448: 
1.27    ! rillig   2449:                 <dt><span class="sect2"><a href="#id2623825">4.2.4.
1.1       grant    2450:                 Selecting the compiler</a></span></dt>
                   2451:               </dl>
                   2452:             </dd>
                   2453:           </dl>
                   2454:         </div>
                   2455: 
                   2456:         <div class="sect1" lang="en" xml:lang="en">
                   2457:           <div class="titlepage">
                   2458:             <div>
                   2459:               <div>
                   2460:                 <h2 class="title" style="clear: both"><a name=
                   2461:                 "getting-started" id=
                   2462:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2463:                 packages</h2>
                   2464:               </div>
                   2465:             </div>
                   2466:           </div>
                   2467: 
                   2468:           <p>This section describes how to find, retrieve and
                   2469:           install a precompiled binary package that someone else
                   2470:           already prepared for your type of machine.</p>
                   2471: 
                   2472:           <div class="sect2" lang="en" xml:lang="en">
                   2473:             <div class="titlepage">
                   2474:               <div>
                   2475:                 <div>
1.27    ! rillig   2476:                   <h3 class="title"><a name="id2571164" id=
        !          2477:                   "id2571164"></a>4.1.1.&nbsp;Where to get binary
1.1       grant    2478:                   packages</h3>
                   2479:                 </div>
                   2480:               </div>
                   2481:             </div>
                   2482: 
                   2483:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.14      xtraeme  2484:             and its mirrors in the directory <code class=
1.27    ! rillig   2485:             "filename">/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/</code>
        !          2486:             for anonymous FTP access. <code class=
        !          2487:             "varname">OSVERSION</code> is the NetBSD version
        !          2488:             (<span><strong class="command">uname
        !          2489:             -r</strong></span>), <code class="varname">ARCH</code>
        !          2490:             is the architecture (<span><strong class=
        !          2491:             "command">uname -p</strong></span>). In that directory,
        !          2492:             there is a subdirectory for each category plus a
        !          2493:             subdirectory <code class="filename">All</code> which
        !          2494:             includes the actual binaries in <code class=
        !          2495:             "filename">.tgz</code> files. The category
        !          2496:             subdirectories use symbolic links to those files (this
        !          2497:             is the same directory layout as in <code class=
1.14      xtraeme  2498:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2499: 
                   2500:             <p>This same directory layout applies for CDROM
                   2501:             distributions, only that the directory may be rooted
1.14      xtraeme  2502:             somewhere else, probably somewhere below <code class=
                   2503:             "filename">/cdrom</code>. Please consult your CDROMs
1.1       grant    2504:             documentation for the exact location.</p>
                   2505:           </div>
                   2506: 
                   2507:           <div class="sect2" lang="en" xml:lang="en">
                   2508:             <div class="titlepage">
                   2509:               <div>
                   2510:                 <div>
1.27    ! rillig   2511:                   <h3 class="title"><a name="id2571218" id=
        !          2512:                   "id2571218"></a>4.1.2.&nbsp;How to use binary
1.1       grant    2513:                   packages</h3>
                   2514:                 </div>
                   2515:               </div>
                   2516:             </div>
                   2517: 
                   2518:             <p>If you have the files on a CDROM or downloaded them
1.23      wiz      2519:             to your hard disk, you can install them with the
1.27    ! rillig   2520:             following command (be sure to <span><strong class=
1.14      xtraeme  2521:             "command">su</strong></span> to root first):</p>
1.1       grant    2522:             <pre class="screen">
1.14      xtraeme  2523: <code class="prompt">#</code> <strong class=
                   2524: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    2525: </pre>
                   2526: 
                   2527:             <p>If you have FTP access and you don't want to
                   2528:             download the packages via FTP prior to installation,
1.14      xtraeme  2529:             you can do this automatically by giving
                   2530:             <span><strong class="command">pkg_add</strong></span>
                   2531:             an FTP URL:</p>
1.1       grant    2532:             <pre class="screen">
1.14      xtraeme  2533: <code class="prompt">#</code> <strong class=
1.27    ! rillig   2534: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/All/package.tgz</code></strong>
1.1       grant    2535: </pre>
                   2536: 
1.27    ! rillig   2537:             <p>Note that any prerequisite packages needed to run
        !          2538:             the package in question will be installed, too,
1.1       grant    2539:             assuming they are present where you install from.</p>
                   2540: 
1.23      wiz      2541:             <p>To save some typing, you can set the <code class=
                   2542:             "varname">PKG_PATH</code> environment variable to a
                   2543:             semicolon separated list of paths (including remote
                   2544:             URLs); trailing slashes are not allowed.</p>
                   2545: 
                   2546:             <p>Additionally to the <code class=
                   2547:             "filename">All</code> directory there exists a
                   2548:             <code class="filename">vulnerable</code> directory to
                   2549:             which binary packages with known vulnerabilities are
                   2550:             moved, since removing them could cause missing
                   2551:             dependencies. To use these packages, add the
                   2552:             <code class="filename">vulnerable</code> directory to
                   2553:             your <code class="varname">PKG_PATH</code>. However,
                   2554:             you should run <a xmlns=
                   2555:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   2556:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   2557:             class="pkgname">security/audit-packages</a> regularly,
                   2558:             and especially after installing new packages, and
                   2559:             verify that the vulnerabilities are acceptable for your
                   2560:             configuration. An example <code class=
                   2561:             "varname">PKG_PATH</code> would be: <code class=
1.27    ! rillig   2562:             "filename">ftp://ftp.NetBSD.org/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/All;ftp://ftp.NetBSD.org/pub/NetBSD/packages/&lt;OSVERSION&gt;/&lt;ARCH&gt;/vulnerable</code>
1.23      wiz      2563:             Please note that semicolon (';') is a shell
                   2564:             meta-character, so you'll probably have to quote
                   2565:             it.</p>
                   2566: 
1.1       grant    2567:             <p>After you've installed packages, be sure to have
1.27    ! rillig   2568:             <code class="filename">/usr/pkg/bin</code> and
        !          2569:             <code class="filename">/usr/pkg/sbin</code> in your
1.14      xtraeme  2570:             <code class="varname">PATH</code> so you can actually
                   2571:             start the just installed program.</p>
1.1       grant    2572:           </div>
                   2573: 
                   2574:           <div class="sect2" lang="en" xml:lang="en">
                   2575:             <div class="titlepage">
                   2576:               <div>
                   2577:                 <div>
1.27    ! rillig   2578:                   <h3 class="title"><a name="id2571392" id=
        !          2579:                   "id2571392"></a>4.1.3.&nbsp;A word of
1.1       grant    2580:                   warning</h3>
                   2581:                 </div>
                   2582:               </div>
                   2583:             </div>
                   2584: 
                   2585:             <p>Please pay very careful attention to the warnings
                   2586:             expressed in the <a href=
                   2587:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2588:             <span class="citerefentry"><span class=
                   2589:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2590:             page about the inherent dangers of installing binary
                   2591:             packages which you did not create yourself, and the
                   2592:             security holes that can be introduced onto your system
                   2593:             by indiscriminate adding of such files.</p>
                   2594:           </div>
                   2595:         </div>
                   2596: 
                   2597:         <div class="sect1" lang="en" xml:lang="en">
                   2598:           <div class="titlepage">
                   2599:             <div>
                   2600:               <div>
                   2601:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   2602:                 "id2571949" id="id2571949"></a>4.2.&nbsp;Building
1.1       grant    2603:                 packages from source</h2>
                   2604:               </div>
                   2605:             </div>
                   2606:           </div>
                   2607: 
                   2608:           <p>This assumes that the package is already in pkgsrc. If
                   2609:           it is not, see <a href="#developers-guide" title=
1.2       hubertf  2610:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
1.27    ! rillig   2611:           &#8220;The pkgsrc developer's guide&#8221;</a> for
        !          2612:           instructions how to create your own packages.</p>
1.1       grant    2613: 
                   2614:           <div class="sect2" lang="en" xml:lang="en">
                   2615:             <div class="titlepage">
                   2616:               <div>
                   2617:                 <div>
1.27    ! rillig   2618:                   <h3 class="title"><a name="id2571960" id=
        !          2619:                   "id2571960"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2620:                 </div>
                   2621:               </div>
                   2622:             </div>
                   2623: 
                   2624:             <p>To build packages from source on a NetBSD system the
                   2625:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2626:             &#8220;<span class="quote">text</span>&#8221;
                   2627:             distribution sets must be installed. If you want to
                   2628:             build X11 related packages the &#8220;<span class=
                   2629:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2630:             "quote">xcomp</span>&#8221; distribution sets are
                   2631:             required, too.</p>
                   2632:           </div>
                   2633: 
                   2634:           <div class="sect2" lang="en" xml:lang="en">
                   2635:             <div class="titlepage">
                   2636:               <div>
                   2637:                 <div>
1.27    ! rillig   2638:                   <h3 class="title"><a name="id2571980" id=
        !          2639:                   "id2571980"></a>4.2.2.&nbsp;Fetching
1.1       grant    2640:                   distfiles</h3>
                   2641:                 </div>
                   2642:               </div>
                   2643:             </div>
                   2644: 
1.27    ! rillig   2645:             <p>The first step for building a package is downloading
        !          2646:             the distfiles (i.e. the unmodified source). If they
        !          2647:             have not yet been downloaded, pkgsrc will fetch them
1.1       grant    2648:             automatically.</p>
                   2649: 
                   2650:             <p>You can overwrite some of the major distribution
                   2651:             sites to fit to sites that are close to your own. Have
1.14      xtraeme  2652:             a look at <code class=
                   2653:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
1.27    ! rillig   2654:             some examples &#8212; in particular, look for the
1.14      xtraeme  2655:             <code class="varname">MASTER_SORT</code>, <code class=
                   2656:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   2657:             "varname">INET_COUNTRY</code> definitions. This may
                   2658:             save some of your bandwidth and time.</p>
1.1       grant    2659: 
                   2660:             <p>You can change these settings either in your shell's
                   2661:             environment, or, if you want to keep the settings, by
1.14      xtraeme  2662:             editing the <code class="filename">/etc/mk.conf</code>
1.1       grant    2663:             file, and adding the definitions there.</p>
                   2664: 
                   2665:             <p>If you don't have a permanent Internet connection
                   2666:             and you want to know which files to download,
1.14      xtraeme  2667:             <span><strong class="command">make
                   2668:             fetch-list</strong></span> will tell you what you'll
                   2669:             need. Put these distfiles into <code class=
                   2670:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    2671:           </div>
                   2672: 
                   2673:           <div class="sect2" lang="en" xml:lang="en">
                   2674:             <div class="titlepage">
                   2675:               <div>
                   2676:                 <div>
1.27    ! rillig   2677:                   <h3 class="title"><a name="id2572094" id=
        !          2678:                   "id2572094"></a>4.2.3.&nbsp;How to build and
1.1       grant    2679:                   install</h3>
                   2680:                 </div>
                   2681:               </div>
                   2682:             </div>
                   2683: 
                   2684:             <p>Assuming that the distfile has been fetched (see
                   2685:             previous section), become root and change into the
1.14      xtraeme  2686:             relevant directory and running <span><strong class=
                   2687:             "command">make</strong></span>. For example, type</p>
1.1       grant    2688:             <pre class="screen">
1.14      xtraeme  2689: <code class="prompt">%</code> <strong class=
                   2690: "userinput"><code>cd misc/figlet</code></strong>
                   2691: <code class="prompt">%</code> <strong class=
                   2692: "userinput"><code>make</code></strong>
1.1       grant    2693: </pre>
                   2694: 
                   2695:             <p>at the shell prompt to build the various components
                   2696:             of the package, and</p>
                   2697:             <pre class="screen">
1.14      xtraeme  2698: <code class="prompt">#</code> <strong class=
                   2699: "userinput"><code>make install</code></strong>
1.1       grant    2700: </pre>
                   2701: 
                   2702:             <p>to install the various components into the correct
                   2703:             places on your system. Installing the package on your
                   2704:             system requires you to be root. However, pkgsrc has a
                   2705:             <span class="emphasis"><em>just-in-time-su</em></span>
                   2706:             feature, which allows you to only become root for the
                   2707:             actual installation step</p>
                   2708: 
                   2709:             <p>Taking the figlet utility as an example, we can
                   2710:             install it on our system by building as shown in
                   2711:             <a href="#logs" title=
                   2712:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
                   2713:             logs</i></a>.</p>
                   2714: 
                   2715:             <p>The program is installed under the default root of
1.14      xtraeme  2716:             the packages tree - <code class=
                   2717:             "filename">/usr/pkg</code>. Should this not conform to
                   2718:             your tastes, set the <code class=
                   2719:             "varname">LOCALBASE</code> variable in your
1.1       grant    2720:             environment, and it will use that value as the root of
1.14      xtraeme  2721:             your packages tree. So, to use <code class=
                   2722:             "filename">/usr/local</code>, set <code class=
                   2723:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    2724:             environment. Please note that you should use a
                   2725:             directory which is dedicated to packages and not shared
1.14      xtraeme  2726:             with other programs (ie, do not try and use
                   2727:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   2728:             should not try to add any of your own files or
                   2729:             directories (such as <code class=
                   2730:             "filename">src/</code>, <code class=
                   2731:             "filename">obj/</code>, or <code class=
                   2732:             "filename">pkgsrc/</code>) below the <code class=
                   2733:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    2734:             possible conflicts between programs and other files
                   2735:             installed by the package system and whatever else may
                   2736:             have been installed there.</p>
                   2737: 
1.14      xtraeme  2738:             <p>Some packages look in <code class=
                   2739:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    2740:             configuration options at build time. Have a look at
1.14      xtraeme  2741:             <code class=
                   2742:             "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
                   2743:             overview of what will be set there by default.
                   2744:             Environment variables such as <code class=
                   2745:             "varname">LOCALBASE</code> can be set in <code class=
                   2746:             "filename">/etc/mk.conf</code> to save having to
                   2747:             remember to set them each time you want to use
                   2748:             pkgsrc.</p>
1.1       grant    2749: 
                   2750:             <p>Occasionally, people want to &#8220;<span class=
                   2751:             "quote">look under the covers</span>&#8221; to see what
                   2752:             is going on when a package is building or being
                   2753:             installed. This may be for debugging purposes, or out
                   2754:             of simple curiosity. A number of utility values have
                   2755:             been added to help with this.</p>
                   2756: 
                   2757:             <div class="orderedlist">
                   2758:               <ol type="1">
                   2759:                 <li>
                   2760:                   <p>If you invoke the <a href=
                   2761:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2762:                   <span class="citerefentry"><span class=
                   2763:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  2764:                   with <code class=
                   2765:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   2766:                   amount of information will be displayed. For
                   2767:                   example,</p>
1.1       grant    2768:                   <pre class="screen">
1.14      xtraeme  2769: <strong class=
                   2770: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    2771: </pre>
                   2772: 
                   2773:                   <p>will show all the commands that are invoked,
                   2774:                   up to and including the &#8220;<span class=
                   2775:                   "quote">patch</span>&#8221; stage.</p>
                   2776:                 </li>
                   2777: 
                   2778:                 <li>
                   2779:                   <p>If you want to know the value of a certain
1.22      tv       2780:                   <a href=
                   2781:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2782:                   <span class="citerefentry"><span class=
                   2783:                   "refentrytitle">make</span>(1)</span></a>
                   2784:                   definition, then the <code class=
1.14      xtraeme  2785:                   "varname">VARNAME</code> definition should be
                   2786:                   used, in conjunction with the show-var target.
                   2787:                   e.g. to show the expansion of the <a href=
1.1       grant    2788:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2789:                   <span class="citerefentry"><span class=
                   2790:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  2791:                   variable <code class=
1.22      tv       2792:                   "varname">LOCALBASE</code>:</p>
1.1       grant    2793:                   <pre class="screen">
1.14      xtraeme  2794: <code class="prompt">%</code> <strong class=
                   2795: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    2796: /usr/pkg
1.14      xtraeme  2797: <code class="prompt">%</code>
1.1       grant    2798:           
                   2799: </pre>
                   2800:                 </li>
                   2801:               </ol>
                   2802:             </div>
                   2803: 
                   2804:             <p>If you want to install a binary package that you've
                   2805:             either created yourself (see next section), that you
                   2806:             put into pkgsrc/packages manually or that is located on
1.8       wiz      2807:             a remote FTP server, you can use the "bin-install"
1.1       grant    2808:             target. This target will install a binary package - if
                   2809:             available - via <a href=
                   2810:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2811:             <span class="citerefentry"><span class=
                   2812:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  2813:             <span><strong class="command">make
                   2814:             package</strong></span>. The list of remote FTP sites
                   2815:             searched is kept in the variable <code class=
                   2816:             "varname">BINPKG_SITES</code>, which defaults to
                   2817:             ftp.NetBSD.org. Any flags that should be added to
                   2818:             <a href=
1.1       grant    2819:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2820:             <span class="citerefentry"><span class=
                   2821:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  2822:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
                   2823:             See <code class=
                   2824:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   2825:             details.</p>
1.1       grant    2826: 
                   2827:             <p>A final word of warning: If you setup a system that
1.14      xtraeme  2828:             has a non-standard setting for <code class=
                   2829:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    2830:             any packages are installed, as you can not use several
                   2831:             directories for the same purpose. Doing so will result
                   2832:             in pkgsrc not being able to properly detect your
                   2833:             installed packages, and fail miserably. Note also that
                   2834:             precompiled binary packages are usually built with the
1.14      xtraeme  2835:             default <code class="varname">LOCALBASE</code> of
                   2836:             <code class="filename">/usr/pkg</code>, and that you
                   2837:             should <span class="emphasis"><em>not</em></span>
                   2838:             install any if you use a non-standard <code class=
                   2839:             "varname">LOCALBASE</code>.</p>
1.1       grant    2840:           </div>
                   2841: 
                   2842:           <div class="sect2" lang="en" xml:lang="en">
                   2843:             <div class="titlepage">
                   2844:               <div>
                   2845:                 <div>
1.27    ! rillig   2846:                   <h3 class="title"><a name="id2623825" id=
        !          2847:                   "id2623825"></a>4.2.4.&nbsp;Selecting the
1.1       grant    2848:                   compiler</h3>
                   2849:                 </div>
                   2850:               </div>
                   2851:             </div>
                   2852: 
                   2853:             <p>By default, pkgsrc will use GCC to build packages.
                   2854:             This may be overridden by setting the following
                   2855:             variables in /etc/mk.conf:</p>
                   2856: 
                   2857:             <div class="variablelist">
                   2858:               <dl>
1.14      xtraeme  2859:                 <dt><span class="term"><code class=
                   2860:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    2861: 
                   2862:                 <dd>
                   2863:                   <p>This is a list of values specifying the chain
                   2864:                   of compilers to invoke when building packages.
                   2865:                   Valid values are:</p>
                   2866: 
                   2867:                   <div class="itemizedlist">
                   2868:                     <ul type="disc">
                   2869:                       <li>
1.14      xtraeme  2870:                         <p><code class="varname">distcc</code>:
1.1       grant    2871:                         distributed C/C++ (chainable)</p>
                   2872:                       </li>
                   2873: 
                   2874:                       <li>
1.14      xtraeme  2875:                         <p><code class="varname">ccache</code>:
1.1       grant    2876:                         compiler cache (chainable)</p>
                   2877:                       </li>
                   2878: 
                   2879:                       <li>
1.14      xtraeme  2880:                         <p><code class="varname">gcc</code>: GNU
                   2881:                         C/C++ Compiler</p>
1.1       grant    2882:                       </li>
                   2883: 
                   2884:                       <li>
1.14      xtraeme  2885:                         <p><code class="varname">mipspro</code>:
1.1       grant    2886:                         Silicon Graphics, Inc. MIPSpro
                   2887:                         (n32/n64)</p>
                   2888:                       </li>
                   2889: 
                   2890:                       <li>
1.14      xtraeme  2891:                         <p><code class="varname">mipspro</code>:
1.1       grant    2892:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   2893:                       </li>
                   2894: 
                   2895:                       <li>
1.14      xtraeme  2896:                         <p><code class="varname">sunpro</code>:
1.1       grant    2897:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   2898:                         Studio</p>
                   2899:                       </li>
                   2900:                     </ul>
                   2901:                   </div>
                   2902: 
                   2903:                   <p>The default is &#8220;<span class=
1.14      xtraeme  2904:                   "quote"><code class=
                   2905:                   "varname">gcc</code></span>&#8221;. You can use
                   2906:                   <code class="varname">ccache</code> and/or
                   2907:                   <code class="varname">distcc</code> with an
                   2908:                   appropriate <code class=
                   2909:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   2910:                   &#8220;<span class="quote"><code class=
                   2911:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    2912:                   variable should always be terminated with a value
                   2913:                   for a real compiler.</p>
                   2914:                 </dd>
                   2915: 
1.14      xtraeme  2916:                 <dt><span class="term"><code class=
                   2917:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    2918: 
                   2919:                 <dd>
                   2920:                   <p>This specifies the minimum version of GCC to
                   2921:                   use when building packages. If the system GCC
                   2922:                   doesn't satisfy this requirement, then pkgsrc
                   2923:                   will build and install one of the GCC packages to
                   2924:                   use instead.</p>
                   2925:                 </dd>
                   2926:               </dl>
                   2927:             </div>
                   2928:           </div>
                   2929:         </div>
                   2930:       </div>
                   2931: 
                   2932:       <div class="chapter" lang="en" xml:lang="en">
                   2933:         <div class="titlepage">
                   2934:           <div>
                   2935:             <div>
                   2936:               <h2 class="title"><a name="binary" id=
                   2937:               "binary"></a>Chapter&nbsp;5.&nbsp;Creating binary
                   2938:               packages</h2>
                   2939:             </div>
                   2940:           </div>
                   2941:         </div>
                   2942: 
                   2943:         <div class="toc">
                   2944:           <p><b>Table of Contents</b></p>
                   2945: 
                   2946:           <dl>
1.27    ! rillig   2947:             <dt><span class="sect1"><a href="#id2623979">5.1.
1.1       grant    2948:             Building a single binary package</a></span></dt>
                   2949: 
1.27    ! rillig   2950:             <dt><span class="sect1"><a href="#id2624057">5.2.
1.1       grant    2951:             Settings for creation of binary
                   2952:             packages</a></span></dt>
                   2953: 
                   2954:             <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
                   2955:             a bulk build of all packages</a></span></dt>
                   2956: 
                   2957:             <dd>
                   2958:               <dl>
                   2959:                 <dt><span class="sect2"><a href=
                   2960:                 "#binary.configuration">5.3.1.
                   2961:                 Configuration</a></span></dt>
                   2962: 
1.27    ! rillig   2963:                 <dt><span class="sect2"><a href="#id2624204">5.3.2.
1.1       grant    2964:                 Other environmental considerations</a></span></dt>
                   2965: 
1.27    ! rillig   2966:                 <dt><span class="sect2"><a href="#id2624245">5.3.3.
1.1       grant    2967:                 Operation</a></span></dt>
                   2968: 
1.27    ! rillig   2969:                 <dt><span class="sect2"><a href="#id2624382">5.3.4.
1.1       grant    2970:                 What it does</a></span></dt>
                   2971: 
1.27    ! rillig   2972:                 <dt><span class="sect2"><a href="#id2624439">5.3.5.
1.1       grant    2973:                 Disk space requirements</a></span></dt>
                   2974: 
1.27    ! rillig   2975:                 <dt><span class="sect2"><a href="#id2624466">5.3.6.
1.1       grant    2976:                 Setting up a sandbox for chroot'ed
                   2977:                 builds</a></span></dt>
                   2978: 
1.27    ! rillig   2979:                 <dt><span class="sect2"><a href="#id2624926">5.3.7.
1.1       grant    2980:                 Building a partial set of packages</a></span></dt>
1.13      hubertf  2981: 
                   2982:                 <dt><span class="sect2"><a href=
                   2983:                 "#bulk-upload">5.3.8. Uploading results of a bulk
                   2984:                 build</a></span></dt>
1.1       grant    2985:               </dl>
                   2986:             </dd>
                   2987: 
1.27    ! rillig   2988:             <dt><span class="sect1"><a href="#id2625383">5.4.
1.1       grant    2989:             Creating a multiple CD-ROM packages
                   2990:             collection</a></span></dt>
                   2991: 
                   2992:             <dd>
                   2993:               <dl>
1.27    ! rillig   2994:                 <dt><span class="sect2"><a href="#id2625398">5.4.1.
1.1       grant    2995:                 Example of cdpack</a></span></dt>
                   2996:               </dl>
                   2997:             </dd>
                   2998:           </dl>
                   2999:         </div>
                   3000: 
                   3001:         <div class="sect1" lang="en" xml:lang="en">
                   3002:           <div class="titlepage">
                   3003:             <div>
                   3004:               <div>
                   3005:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   3006:                 "id2623979" id="id2623979"></a>5.1.&nbsp;Building a
1.1       grant    3007:                 single binary package</h2>
                   3008:               </div>
                   3009:             </div>
                   3010:           </div>
                   3011: 
                   3012:           <p>Once you have built and installed a package, you can
                   3013:           create a <span class="emphasis"><em>binary
                   3014:           package</em></span> which can be installed on another
                   3015:           system with <a href=
                   3016:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3017:           <span class="citerefentry"><span class=
                   3018:           "refentrytitle">pkg_add</span>(1)</span></a> This saves
                   3019:           having to build the same package on a group of hosts and
                   3020:           wasting CPU time. It also provides a simple means for
                   3021:           others to install your package, should you distribute
                   3022:           it.</p>
                   3023: 
                   3024:           <p>To create a binary package, change into the
1.14      xtraeme  3025:           appropriate directory in pkgsrc, and run
                   3026:           <span><strong class="command">make
                   3027:           package</strong></span>:</p>
1.1       grant    3028:           <pre class="screen">
1.14      xtraeme  3029: <code class="prompt">#</code> <strong class=
                   3030: "userinput"><code>cd misc/figlet</code></strong>
                   3031: <code class="prompt">#</code> <strong class=
                   3032: "userinput"><code>make package</code></strong>
1.1       grant    3033: </pre>
                   3034: 
                   3035:           <p>This will build and install your package (if not
                   3036:           already done), and then build a binary package from what
1.14      xtraeme  3037:           was installed. You can then use the <span><strong class=
                   3038:           "command">pkg_*</strong></span> tools to manipulate it.
                   3039:           Binary packages are created by default in <code class=
                   3040:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    3041:           gzipped tar file. See <a href="#logs.package" title=
                   3042:           "B.2.&nbsp;Packaging figlet">Section B.2,
                   3043:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   3044:           the above <a xmlns=
                   3045:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3046:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.20      ben      3047:           class="pkgname">misc/figlet</a> example.</p>
1.1       grant    3048: 
                   3049:           <p>See <a href="#submit" title=
1.25      rillig   3050:           "Chapter&nbsp;15.&nbsp;Submitting and Committing">Chapter
                   3051:           15, <i>Submitting and Committing</i></a> for information
1.1       grant    3052:           on how to submit such a binary package.</p>
                   3053:         </div>
                   3054: 
                   3055:         <div class="sect1" lang="en" xml:lang="en">
                   3056:           <div class="titlepage">
                   3057:             <div>
                   3058:               <div>
                   3059:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   3060:                 "id2624057" id="id2624057"></a>5.2.&nbsp;Settings
1.1       grant    3061:                 for creation of binary packages</h2>
                   3062:               </div>
                   3063:             </div>
                   3064:           </div>
                   3065: 
                   3066:           <p>See <a href="#build.helpful-targets" title=
1.25      rillig   3067:           "12.3.&nbsp;Other helpful targets">Section&nbsp;12.3,
1.1       grant    3068:           &#8220;Other helpful targets&#8221;</a>.</p>
                   3069:         </div>
                   3070: 
                   3071:         <div class="sect1" lang="en" xml:lang="en">
                   3072:           <div class="titlepage">
                   3073:             <div>
                   3074:               <div>
                   3075:                 <h2 class="title" style="clear: both"><a name=
                   3076:                 "bulkbuild" id="bulkbuild"></a>5.3.&nbsp;Doing a
                   3077:                 bulk build of all packages</h2>
                   3078:               </div>
                   3079:             </div>
                   3080:           </div>
                   3081: 
                   3082:           <p>If you want to get a full set of precompiled binary
                   3083:           packages, this section describes how to get them. Beware
                   3084:           that the bulk build will remove all currently installed
1.23      wiz      3085:           packages from your system! Having an FTP server
                   3086:           configured either on the machine doing the bulk builds or
                   3087:           on a nearby NFS server can help to make the packages
                   3088:           available to everyone. See <a href=
1.1       grant    3089:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   3090:           <span class="citerefentry"><span class=
                   3091:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   3092:           information. If you use a remote NFS server's storage, be
                   3093:           sure to not actually compile on NFS storage, as this
                   3094:           slows things down a lot.</p>
                   3095: 
                   3096:           <div class="sect2" lang="en" xml:lang="en">
                   3097:             <div class="titlepage">
                   3098:               <div>
                   3099:                 <div>
                   3100:                   <h3 class="title"><a name="binary.configuration"
                   3101:                   id=
                   3102:                   "binary.configuration"></a>5.3.1.&nbsp;Configuration</h3>
                   3103:                 </div>
                   3104:               </div>
                   3105:             </div>
                   3106: 
                   3107:             <div class="sect3" lang="en" xml:lang="en">
                   3108:               <div class="titlepage">
                   3109:                 <div>
                   3110:                   <div>
                   3111:                     <h4 class="title"><a name="binary.mk.conf" id=
                   3112:                     "binary.mk.conf"></a>5.3.1.1.&nbsp;/etc/mk.conf</h4>
                   3113:                   </div>
                   3114:                 </div>
                   3115:               </div>
                   3116: 
1.23      wiz      3117:               <p>You may want to set variables in <code class=
1.14      xtraeme  3118:               "filename">/etc/mk.conf</code>. Look at <code class=
                   3119:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    3120:               details of the default settings. You will want to
1.14      xtraeme  3121:               ensure that <code class=
                   3122:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   3123:               policy. As used in this example, <code class=
                   3124:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    3125:               "emphasis"><em>all</em></span> licenses.</p>
                   3126:               <pre class="programlisting">
                   3127: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   3128: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   3129: BSDSRCDIR=      /usr/src
                   3130: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   3131: OBJHOSTNAME?=   yes               # use work.`hostname`
                   3132: FAILOVER_FETCH= yes               # insist on the correct checksum
                   3133: PKG_DEVELOPER?= yes
                   3134: _ACCEPTABLE=    yes
                   3135: </pre>
                   3136:             </div>
                   3137: 
                   3138:             <div class="sect3" lang="en" xml:lang="en">
                   3139:               <div class="titlepage">
                   3140:                 <div>
                   3141:                   <div>
1.27    ! rillig   3142:                     <h4 class="title"><a name="id2624122" id=
        !          3143:                     "id2624122"></a>5.3.1.2.&nbsp;<code class=
1.14      xtraeme  3144:                     "filename">build.conf</code></h4>
1.1       grant    3145:                   </div>
                   3146:                 </div>
                   3147:               </div>
                   3148: 
1.14      xtraeme  3149:               <p>In <code class="filename">pkgsrc/mk/bulk</code>,
                   3150:               copy <code class="filename">build.conf-example</code>
                   3151:               to <code class="filename">build.conf</code> and edit
                   3152:               it, following the comments in that file. This is the
1.1       grant    3153:               config file that determines where log files are
                   3154:               generated after the build, where to mail the build
1.23      wiz      3155:               report to, where your pkgsrc tree is located and the
                   3156:               user to which user to <a href=
1.1       grant    3157:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   3158:               <span class="citerefentry"><span class=
1.23      wiz      3159:               "refentrytitle">su</span>(8)</span></a> to do a
1.14      xtraeme  3160:               <span><strong class="command">cvs
                   3161:               update</strong></span>.</p>
1.1       grant    3162:             </div>
                   3163: 
                   3164:             <div class="sect3" lang="en" xml:lang="en">
                   3165:               <div class="titlepage">
                   3166:                 <div>
                   3167:                   <div>
1.27    ! rillig   3168:                     <h4 class="title"><a name="id2624158" id=
        !          3169:                     "id2624158"></a>5.3.1.3.&nbsp;<code class=
1.14      xtraeme  3170:                     "filename">pre-build.local</code></h4>
1.1       grant    3171:                   </div>
                   3172:                 </div>
                   3173:               </div>
                   3174: 
                   3175:               <p>It is possible to configure the bulk build to
                   3176:               perform certain site specific tasks at the end of the
1.14      xtraeme  3177:               pre-build stage. If the file <code class=
                   3178:               "filename">pre-build.local</code> exists in
1.23      wiz      3179:               <code class="filename">/usr/pkgsrc/mk/bulk</code>, it
1.24      wiz      3180:               will be executed (as a <a href=
                   3181:               "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
                   3182:               <span class="citerefentry"><span class=
                   3183:               "refentrytitle">sh</span>(1)</span></a> script) at
                   3184:               the end of the usual pre-build stage. An example use
                   3185:               of <code class="filename">pre-build.local</code> is
                   3186:               to have the line:</p>
1.1       grant    3187:               <pre class="screen">
1.14      xtraeme  3188: <code class="prompt">#</code> <strong class=
                   3189: "userinput"><code>echo "I do not have enough disk space to build this pig." \
1.23      wiz      3190:     &gt; pkgsrc/misc/openoffice/$BROKENF</code></strong>
1.1       grant    3191: </pre>
                   3192: 
                   3193:               <p>to prevent the system from trying to build a
                   3194:               particular package which requires nearly 3 GB of disk
                   3195:               space.</p>
                   3196:             </div>
                   3197:           </div>
                   3198: 
                   3199:           <div class="sect2" lang="en" xml:lang="en">
                   3200:             <div class="titlepage">
                   3201:               <div>
                   3202:                 <div>
1.27    ! rillig   3203:                   <h3 class="title"><a name="id2624204" id=
        !          3204:                   "id2624204"></a>5.3.2.&nbsp;Other environmental
1.1       grant    3205:                   considerations</h3>
                   3206:                 </div>
                   3207:               </div>
                   3208:             </div>
                   3209: 
1.14      xtraeme  3210:             <p>As <code class="filename">/usr/pkg</code> will be
1.1       grant    3211:             completely deleted at the start of bulk builds, make
                   3212:             sure your login shell is placed somewhere else. Either
1.14      xtraeme  3213:             drop it into <code class=
                   3214:             "filename">/usr/local/bin</code> (and adjust your login
                   3215:             shell in the passwd file), or (re-)install it via
                   3216:             <a href=
1.1       grant    3217:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3218:             <span class="citerefentry"><span class=
                   3219:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.14      xtraeme  3220:             <code class="filename">/etc/rc.local</code>, so you can
1.1       grant    3221:             login after a reboot (remember that your current
                   3222:             process won't die if the package is removed, you just
                   3223:             can't start any new instances of the shell any more).
                   3224:             Also, if you use NetBSD earlier than 1.5, or you still
                   3225:             want to use the pkgsrc version of ssh for some reason,
                   3226:             be sure to install ssh before starting it from
1.14      xtraeme  3227:             <code class="filename">rc.local</code>:</p>
1.1       grant    3228:             <pre class="programlisting">
                   3229: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   3230: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   3231:     /usr/pkg/etc/rc.d/sshd
                   3232: fi
                   3233: </pre>
                   3234: 
                   3235:             <p>Not doing so will result in you being not able to
                   3236:             log in via ssh after the bulk build is finished or if
                   3237:             the machine gets rebooted or crashes. You have been
                   3238:             warned! :)</p>
                   3239:           </div>
                   3240: 
                   3241:           <div class="sect2" lang="en" xml:lang="en">
                   3242:             <div class="titlepage">
                   3243:               <div>
                   3244:                 <div>
1.27    ! rillig   3245:                   <h3 class="title"><a name="id2624245" id=
        !          3246:                   "id2624245"></a>5.3.3.&nbsp;Operation</h3>
1.1       grant    3247:                 </div>
                   3248:               </div>
                   3249:             </div>
                   3250: 
                   3251:             <p>Make sure you don't need any of the packages still
                   3252:             installed.</p>
                   3253: 
                   3254:             <div class="warning" style=
                   3255:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3256:               <h3 class="title">Warning</h3>
                   3257: 
                   3258:               <p>During the bulk build, <span class=
                   3259:               "emphasis"><em>all packages will be
                   3260:               removed!</em></span></p>
                   3261:             </div>
                   3262: 
                   3263:             <p>Be sure to remove all other things that might
                   3264:             interfere with builds, like some libs installed in
1.14      xtraeme  3265:             <code class="filename">/usr/local</code>, etc. then
                   3266:             become root and type:</p>
1.1       grant    3267:             <pre class="screen">
1.14      xtraeme  3268: <code class="prompt">#</code> <strong class=
                   3269: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   3270: <code class="prompt">#</code> <strong class=
                   3271: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    3272: </pre>
                   3273: 
                   3274:             <p>If for some reason your last build didn't complete
                   3275:             (power failure, system panic, ...), you can continue it
                   3276:             by running:</p>
                   3277:             <pre class="screen">
1.14      xtraeme  3278: <code class="prompt">#</code> <strong class=
                   3279: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    3280: </pre>
                   3281: 
                   3282:             <p>At the end of the bulk build, you will get a summary
                   3283:             via mail, and find build logs in the directory
1.14      xtraeme  3284:             specified by <code class="varname">FTP</code> in the
                   3285:             <code class="filename">build.conf</code> file.</p>
1.1       grant    3286:           </div>
                   3287: 
                   3288:           <div class="sect2" lang="en" xml:lang="en">
                   3289:             <div class="titlepage">
                   3290:               <div>
                   3291:                 <div>
1.27    ! rillig   3292:                   <h3 class="title"><a name="id2624382" id=
        !          3293:                   "id2624382"></a>5.3.4.&nbsp;What it does</h3>
1.1       grant    3294:                 </div>
                   3295:               </div>
                   3296:             </div>
                   3297: 
                   3298:             <p>The bulk builds consist of three steps:</p>
                   3299: 
                   3300:             <div class="variablelist">
                   3301:               <dl>
                   3302:                 <dt><span class="term">1. pre-build</span></dt>
                   3303: 
                   3304:                 <dd>
                   3305:                   <p>The script updates your pkgsrc tree via
                   3306:                   (anon)cvs, then cleans out any broken distfiles,
                   3307:                   and removes all packages installed.</p>
                   3308:                 </dd>
                   3309: 
                   3310:                 <dt><span class="term">2. the bulk
                   3311:                 build</span></dt>
                   3312: 
                   3313:                 <dd>
                   3314:                   <p>This is basically &#8220;<span class=
                   3315:                   "quote">make bulk-package</span>&#8221; with an
                   3316:                   optimised order in which packages will be built.
                   3317:                   Packages that don't require other packages will
                   3318:                   be built first, and packages with many
                   3319:                   dependencies will be built later.</p>
                   3320:                 </dd>
                   3321: 
                   3322:                 <dt><span class="term">3. post-build</span></dt>
                   3323: 
                   3324:                 <dd>
                   3325:                   <p>Generates a report that's placed in the
1.14      xtraeme  3326:                   directory specified in the <code class=
                   3327:                   "filename">build.conf</code> file named
                   3328:                   <code class="filename">broken.html</code>, a
                   3329:                   short version of that report will also be mailed
                   3330:                   to the build's admin.</p>
1.1       grant    3331:                 </dd>
                   3332:               </dl>
                   3333:             </div>
                   3334: 
                   3335:             <p>During the build, a list of broken packages will be
1.14      xtraeme  3336:             compiled in <code class=
                   3337:             "filename">/usr/pkgsrc/.broken</code> (or <code class=
                   3338:             "filename">.../.broken.${MACHINE}</code> if
                   3339:             <code class="varname">OBJMACHINE</code> is set),
                   3340:             individual build logs of broken builds can be found in
                   3341:             the package's directory. These files are used by the
                   3342:             bulk-targets to mark broken builds to not waste time
                   3343:             trying to rebuild them, and they can be used to debug
                   3344:             these broken package builds later.</p>
1.1       grant    3345:           </div>
                   3346: 
                   3347:           <div class="sect2" lang="en" xml:lang="en">
                   3348:             <div class="titlepage">
                   3349:               <div>
                   3350:                 <div>
1.27    ! rillig   3351:                   <h3 class="title"><a name="id2624439" id=
        !          3352:                   "id2624439"></a>5.3.5.&nbsp;Disk space
1.1       grant    3353:                   requirements</h3>
                   3354:                 </div>
                   3355:               </div>
                   3356:             </div>
                   3357: 
                   3358:             <p>Currently, roughly the following requirements are
                   3359:             valid for NetBSD 2.0/i386:</p>
                   3360: 
                   3361:             <div class="itemizedlist">
                   3362:               <ul type="disc">
                   3363:                 <li>
                   3364:                   <p>10 GB - distfiles (NFS ok)</p>
                   3365:                 </li>
                   3366: 
                   3367:                 <li>
                   3368:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   3369:                 </li>
                   3370: 
                   3371:                 <li>
                   3372:                   <p>5 GB - temp space for compiling (local disk
                   3373:                   recommended)</p>
                   3374:                 </li>
                   3375:               </ul>
                   3376:             </div>
                   3377: 
                   3378:             <p>Note that all pkgs will be de-installed as soon as
                   3379:             they are turned into a binary package, and that sources
                   3380:             are removed, so there is no excessively huge demand to
                   3381:             disk space. Afterwards, if the package is needed again,
                   3382:             it will be installed via <a href=
                   3383:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3384:             <span class="citerefentry"><span class=
                   3385:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   3386:             building again, so there are no cycles wasted by
                   3387:             recompiling.</p>
                   3388:           </div>
                   3389: 
                   3390:           <div class="sect2" lang="en" xml:lang="en">
                   3391:             <div class="titlepage">
                   3392:               <div>
                   3393:                 <div>
1.27    ! rillig   3394:                   <h3 class="title"><a name="id2624466" id=
        !          3395:                   "id2624466"></a>5.3.6.&nbsp;Setting up a sandbox
1.1       grant    3396:                   for chroot'ed builds</h3>
                   3397:                 </div>
                   3398:               </div>
                   3399:             </div>
                   3400: 
1.12      agc      3401:             <p>If you don't want all the packages nuked from a
                   3402:             machine (rendering it useless for anything but pkg
1.23      wiz      3403:             compiling), there is the possibility of doing the
                   3404:             package bulk build inside a chroot environment.</p>
1.12      agc      3405: 
                   3406:             <p>The first step is to set up a chroot sandbox, e.g.
1.14      xtraeme  3407:             <code class="filename">/usr/sandbox</code>. This can be
1.12      agc      3408:             done by using null mounts, or manually.</p>
                   3409: 
1.14      xtraeme  3410:             <p>There is a shell script called <code class=
                   3411:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   3412:             set up the sandbox environment using null mounts. It
                   3413:             will also create a script called <code class=
                   3414:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      3415:             environment, which will allow the null mounts to be
1.14      xtraeme  3416:             activated using the <span><strong class=
                   3417:             "command">sandbox mount</strong></span> command and
                   3418:             deactivated using the <span><strong class=
                   3419:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      3420: 
                   3421:             <p>To set up a sandbox environment by hand, after
                   3422:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  3423:             doing a <span><strong class="command">make distribution
                   3424:             DESTDIR=/usr/sandbox</strong></span> in <code class=
                   3425:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      3426:             items are present and properly configured:</p>
1.1       grant    3427: 
                   3428:             <div class="procedure">
                   3429:               <ol type="1">
                   3430:                 <li>
                   3431:                   <p>Kernel</p>
                   3432:                   <pre class="screen">
1.14      xtraeme  3433: <code class="prompt">#</code> <strong class=
                   3434: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    3435: </pre>
                   3436:                 </li>
                   3437: 
                   3438:                 <li>
1.14      xtraeme  3439:                   <p><code class="filename">/dev/*</code></p>
1.1       grant    3440:                   <pre class="screen">
1.14      xtraeme  3441: <code class="prompt">#</code> <strong class=
                   3442: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    3443: </pre>
                   3444:                 </li>
                   3445: 
                   3446:                 <li>
1.14      xtraeme  3447:                   <p><code class="filename">/etc/resolv.conf</code>
1.1       grant    3448:                   (for <a xmlns=
                   3449:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3450:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20      ben      3451:                   class="pkgname">security/smtpd</a> and mail):</p>
1.1       grant    3452:                   <pre class="screen">
1.14      xtraeme  3453: <code class="prompt">#</code> <strong class=
                   3454: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    3455: </pre>
                   3456:                 </li>
                   3457: 
                   3458:                 <li>
                   3459:                   <p>Working(!) mail config (hostname,
                   3460:                   sendmail.cf):</p>
                   3461:                   <pre class="screen">
1.14      xtraeme  3462: <code class="prompt">#</code> <strong class=
                   3463: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    3464: </pre>
                   3465:                 </li>
                   3466: 
                   3467:                 <li>
1.14      xtraeme  3468:                   <p><code class="filename">/etc/localtime</code>
                   3469:                   (for <a xmlns=
1.1       grant    3470:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3471:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.20      ben      3472:                   class="pkgname">security/smtpd</a>):</p>
1.1       grant    3473:                   <pre class="screen">
1.14      xtraeme  3474: <code class="prompt">#</code> <strong class=
                   3475: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    3476: </pre>
                   3477:                 </li>
                   3478: 
                   3479:                 <li>
1.14      xtraeme  3480:                   <p><code class="filename">/usr/src</code> (system
1.1       grant    3481:                   sources, for <a xmlns=
                   3482:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3483:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.20      ben      3484:                   class="pkgname">sysutils/aperture</a>, <a xmlns=
                   3485:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3486:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
                   3487:                   class="pkgname">net/ppp-mppe</a>):</p>
1.1       grant    3488:                   <pre class="screen">
1.14      xtraeme  3489: <code class="prompt">#</code> <strong class=
                   3490: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   3491: <code class="prompt">#</code> <strong class=
1.23      wiz      3492: "userinput"><code>ln -s cvs/src-2.0 src</code></strong>
1.1       grant    3493: </pre>
                   3494:                 </li>
                   3495: 
                   3496:                 <li>
1.14      xtraeme  3497:                   <p>Create <code class=
                   3498:                   "filename">/var/db/pkg</code> (not part of
                   3499:                   default install):</p>
1.1       grant    3500:                   <pre class="screen">
1.14      xtraeme  3501: <code class="prompt">#</code> <strong class=
                   3502: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    3503: </pre>
                   3504:                 </li>
                   3505: 
                   3506:                 <li>
1.14      xtraeme  3507:                   <p>Create <code class="filename">/usr/pkg</code>
                   3508:                   (not part of default install):</p>
1.1       grant    3509:                   <pre class="screen">
1.14      xtraeme  3510: <code class="prompt">#</code> <strong class=
                   3511: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    3512: </pre>
                   3513:                 </li>
                   3514: 
                   3515:                 <li>
1.14      xtraeme  3516:                   <p>Checkout pkgsrc via cvs into <code class=
                   3517:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    3518:                   <pre class="screen">
1.14      xtraeme  3519: <code class="prompt">#</code> <strong class=
                   3520: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   3521: <code class="prompt">#</code> <strong class=
                   3522: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    3523: </pre>
                   3524: 
                   3525:                   <p>Do not mount/link this to the copy of your
                   3526:                   pkgsrc tree you do development in, as this will
                   3527:                   likely cause problems!</p>
                   3528:                 </li>
                   3529: 
                   3530:                 <li>
1.14      xtraeme  3531:                   <p>Make <code class=
                   3532:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
                   3533:                   and <code class="filename">.../distfiles</code>
                   3534:                   point somewhere appropriate. NFS- and/or
                   3535:                   nullfs-mounts may come in handy!</p>
1.1       grant    3536:                 </li>
                   3537: 
                   3538:                 <li>
1.14      xtraeme  3539:                   <p>Edit <code class=
                   3540:                   "filename">/etc/mk.conf</code>, see <a href=
                   3541:                   "#binary.mk.conf" title=
1.1       grant    3542:                   "5.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;5.3.1.1,
                   3543:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   3544:                 </li>
                   3545: 
                   3546:                 <li>
1.14      xtraeme  3547:                   <p>Adjust <code class=
                   3548:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    3549:                   needs.</p>
                   3550:                 </li>
                   3551: 
                   3552:                 <li>
1.14      xtraeme  3553:                   <p>If you have set <code class=
                   3554:                   "varname">CVS_USER</code> in <code class=
                   3555:                   "filename">build.conf</code>, make sure that
                   3556:                   account exists and can do a <span><strong class=
                   3557:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    3558:                   properly!</p>
                   3559:                 </li>
                   3560:               </ol>
                   3561:             </div>
                   3562: 
                   3563:             <p>When the chroot sandbox is setup, you can start the
                   3564:             build with the following steps:</p>
                   3565:             <pre class="screen">
1.14      xtraeme  3566: <code class="prompt">#</code> <strong class=
                   3567: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   3568: <code class="prompt">#</code> <strong class=
                   3569: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    3570: </pre>
                   3571: 
                   3572:             <p>This will just jump inside the sandbox and start
                   3573:             building. At the end of the build, mail will be sent
                   3574:             with the results of the build. Created binary pkgs will
1.14      xtraeme  3575:             be in <code class=
                   3576:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    3577:             (wherever that points/mounts to/from).</p>
                   3578:           </div>
                   3579: 
                   3580:           <div class="sect2" lang="en" xml:lang="en">
                   3581:             <div class="titlepage">
                   3582:               <div>
                   3583:                 <div>
1.27    ! rillig   3584:                   <h3 class="title"><a name="id2624926" id=
        !          3585:                   "id2624926"></a>5.3.7.&nbsp;Building a partial
1.1       grant    3586:                   set of packages</h3>
                   3587:                 </div>
                   3588:               </div>
                   3589:             </div>
                   3590: 
                   3591:             <p>In addition to building a complete set of all
1.14      xtraeme  3592:             packages in pkgsrc, the <code class=
                   3593:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   3594:             used to build a subset of the packages contained in
                   3595:             pkgsrc. By setting defining <code class=
                   3596:             "varname">SPECIFIC_PKGS</code> in <code class=
                   3597:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    3598: 
                   3599:             <div class="itemizedlist">
                   3600:               <ul type="disc">
                   3601:                 <li>
                   3602:                   <p>SITE_SPECIFIC_PKGS</p>
                   3603:                 </li>
                   3604: 
                   3605:                 <li>
                   3606:                   <p>HOST_SPECIFIC_PKGS</p>
                   3607:                 </li>
                   3608: 
                   3609:                 <li>
                   3610:                   <p>GROUP_SPECIFIC_PKGS</p>
                   3611:                 </li>
                   3612: 
                   3613:                 <li>
                   3614:                   <p>USER_SPECIFIC_PKGS</p>
                   3615:                 </li>
                   3616:               </ul>
                   3617:             </div>
                   3618: 
                   3619:             <p>will define the set of packages which should be
                   3620:             built. The bulk build code will also include any
                   3621:             packages which are needed as dependencies for the
                   3622:             explicitly listed packages.</p>
                   3623: 
                   3624:             <p>One use of this is to do a bulk build with
1.14      xtraeme  3625:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    3626:             sandbox periodically to have a complete set of the
                   3627:             binary packages needed for your site available without
                   3628:             the overhead of building extra packages that are not
                   3629:             needed.</p>
                   3630:           </div>
1.13      hubertf  3631: 
                   3632:           <div class="sect2" lang="en" xml:lang="en">
                   3633:             <div class="titlepage">
                   3634:               <div>
                   3635:                 <div>
                   3636:                   <h3 class="title"><a name="bulk-upload" id=
                   3637:                   "bulk-upload"></a>5.3.8.&nbsp;Uploading results
                   3638:                   of a bulk build</h3>
                   3639:                 </div>
                   3640:               </div>
                   3641:             </div>
                   3642: 
                   3643:             <p>This section describes how pkgsrc developers can
                   3644:             upload binary pkgs built by bulk builds to
                   3645:             ftp.NetBSD.org.</p>
                   3646: 
1.17      sketch   3647:             <p>If you would like to automatically create checksum
                   3648:             files for the binary packages you intend to upload,
                   3649:             remember to set <code class="varname">MKSUMS=yes</code>
                   3650:             in your <code class=
                   3651:             "filename">mk/bulk/build.conf</code>.</p>
                   3652: 
                   3653:             <p>If you would like to PGP sign the checksum files
                   3654:             (highly recommended!), remember to set <code class=
                   3655:             "varname">SIGN_AS=username@NetBSD.org</code> in your
                   3656:             <code class="filename">mk/bulk/build.conf</code>. This
1.23      wiz      3657:             will prompt you for your GPG password to sign the files
1.17      sketch   3658:             before uploading everything.</p>
                   3659: 
                   3660:             <p>Then, make sure that you have <code class=
1.14      xtraeme  3661:             "varname">RSYNC_DST</code> set properly in your
                   3662:             <code class="filename">mk/bulk/build.conf</code> file,
                   3663:             i.e. adjust it to something like one of the
                   3664:             following:</p>
1.13      hubertf  3665:             <pre class="screen">
                   3666: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3667: </pre>
                   3668: 
1.23      wiz      3669:             <p>Please use appropviate values for "pkgsrc-200xQy",
1.13      hubertf  3670:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  3671:             ftp.NetBSD.org is different from <code class=
                   3672:             "varname">CVS_USER</code>, write your login directly
                   3673:             into the variable, e.g. my local account is "feyrer",
                   3674:             but for my login "hubertf", I use:</p>
1.13      hubertf  3675:             <pre class="screen">
                   3676: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3677: </pre>
                   3678: 
1.14      xtraeme  3679:             <p>A separate <code class="filename">upload</code>
1.13      hubertf  3680:             directory is used here to allow "closing" the directory
                   3681:             during upload. To do so, run the following command on
                   3682:             ftp.NetBSD.org next:</p>
                   3683:             <pre class="screen">
1.14      xtraeme  3684: nbftp% <strong class=
                   3685: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  3686: </pre>
                   3687: 
1.14      xtraeme  3688:             <p>Please note that <code class=
                   3689:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  3690:             appropriate for packages for the NetBSD operating
                   3691:             system. Binary packages for other operating systems
1.14      xtraeme  3692:             should go into <code class=
                   3693:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  3694: 
                   3695:             <p>Before uploading the binary pkgs, ssh authentication
1.23      wiz      3696:             needs to be set up. This example shows how to setup
1.13      hubertf  3697:             temporary keys for the root account <span class=
                   3698:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   3699:             that no keys should be present there usually):</p>
                   3700:             <pre class="screen">
1.14      xtraeme  3701: <code class="prompt">#</code> <strong class=
                   3702: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   3703: chroot-<code class="prompt">#</code> <strong class=
                   3704: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   3705: chroot-<code class="prompt">#</code> <strong class=
                   3706: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   3707: chroot-<code class="prompt">#</code> <strong class=
                   3708: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  3709: </pre>
                   3710: 
1.14      xtraeme  3711:             <p>Now take the output of <code class=
                   3712:             "filename">id-dsa.pub</code> and append it to your
                   3713:             <code class="filename">~/.ssh/authorized_keys</code>
1.17      sketch   3714:             file on ftp.NetBSD.org. You can remove the key after
1.14      xtraeme  3715:             the upload is done!</p>
1.13      hubertf  3716: 
                   3717:             <p>Next, test if your ssh connection really works:</p>
                   3718:             <pre class="screen">
1.14      xtraeme  3719: chroot-<code class="prompt">#</code> <strong class=
                   3720: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  3721: </pre>
                   3722: 
                   3723:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   3724: 
                   3725:             <p>Now after all this works, you can exit the sandbox
                   3726:             and start the upload:</p>
                   3727:             <pre class="screen">
1.14      xtraeme  3728: chroot-<code class="prompt">#</code> <strong class=
                   3729: "userinput"><code>exit</code></strong>        
                   3730: <code class="prompt">#</code> <strong class=
                   3731: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   3732: <code class="prompt">#</code> <strong class=
                   3733: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  3734: </pre>
                   3735: 
                   3736:             <p>The upload process may take quite some time. Use
1.24      wiz      3737:             <a href=
                   3738:             "http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-current">
                   3739:             <span class="citerefentry"><span class=
                   3740:             "refentrytitle">ls</span>(1)</span></a> or <a href=
                   3741:             "http://netbsd.gw.com/cgi-bin/man-cgi?du+1+NetBSD-current">
                   3742:             <span class="citerefentry"><span class=
                   3743:             "refentrytitle">du</span>(1)</span></a> on the FTP
                   3744:             server to monitor progress of the upload. The upload
                   3745:             script will take care of not uploading restricted
                   3746:             packages and putting vulnerable packages into the
                   3747:             <code class="filename">vulnerable</code>
                   3748:             subdirectory.</p>
1.13      hubertf  3749: 
                   3750:             <p>After the upload has ended, first thing is to revoke
                   3751:             ssh access:</p>
                   3752:             <pre class="screen">
1.14      xtraeme  3753: nbftp% <strong class=
                   3754: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  3755: Gdd:x! 
                   3756: </pre>
                   3757: 
                   3758:             <p>Use whatever is needed to remove the key you've
                   3759:             entered before! Last, move the uploaded packages out of
1.14      xtraeme  3760:             the <code class="filename">upload</code> directory to
                   3761:             have them accessible to everyone:</p>
1.13      hubertf  3762:             <pre class="screen">
1.14      xtraeme  3763: nbftp% <strong class=
                   3764: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   3765: nbftp% <strong class=
                   3766: "userinput"><code>mv upload/* .</code></strong>
                   3767: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   3768: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  3769: </pre>
                   3770:           </div>
1.1       grant    3771:         </div>
                   3772: 
                   3773:         <div class="sect1" lang="en" xml:lang="en">
                   3774:           <div class="titlepage">
                   3775:             <div>
                   3776:               <div>
                   3777:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   3778:                 "id2625383" id="id2625383"></a>5.4.&nbsp;Creating a
1.1       grant    3779:                 multiple CD-ROM packages collection</h2>
                   3780:               </div>
                   3781:             </div>
                   3782:           </div>
                   3783: 
                   3784:           <p>After your pkgsrc bulk-build has completed, you may
                   3785:           wish to create a CD-ROM set of the resulting binary
                   3786:           packages to assist in installing packages on other
                   3787:           machines. The <a xmlns=
                   3788:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3789:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.20      ben      3790:           class="pkgname">pkgtools/cdpack</a> package provides a
                   3791:           simple tool for creating the ISO 9660 images.
                   3792:           <span><strong class="command">cdpack</strong></span>
                   3793:           arranges the packages on the CD-ROMs in a way that keeps
                   3794:           all the dependencies for given package on the same CD as
                   3795:           that package.</p>
1.1       grant    3796: 
                   3797:           <div class="sect2" lang="en" xml:lang="en">
                   3798:             <div class="titlepage">
                   3799:               <div>
                   3800:                 <div>
1.27    ! rillig   3801:                   <h3 class="title"><a name="id2625398" id=
        !          3802:                   "id2625398"></a>5.4.1.&nbsp;Example of
1.1       grant    3803:                   cdpack</h3>
                   3804:                 </div>
                   3805:               </div>
                   3806:             </div>
                   3807: 
                   3808:             <p>Complete documentation for cdpack is found in the
                   3809:             cdpack(1) manpage. The following short example assumes
1.14      xtraeme  3810:             that the binary packages are left in <code class=
                   3811:             "filename">/usr/pkgsrc/packages/All</code> and that
                   3812:             sufficient disk space exists in <code class=
                   3813:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    3814:             <pre class="screen">
1.14      xtraeme  3815: <code class="prompt">#</code> <strong class=
                   3816: "userinput"><code>mkdir /u2/images</code></strong>
                   3817: <code class="prompt">#</code> <strong class=
                   3818: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   3819: <code class="prompt">#</code> <strong class=
                   3820: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3821: </pre>
                   3822: 
                   3823:             <p>If you wish to include a common set of files
1.14      xtraeme  3824:             (<code class="filename">COPYRIGHT</code>, <code class=
                   3825:             "filename">README</code>, etc.) on each CD in the
1.1       grant    3826:             collection, then you need to create a directory which
                   3827:             contains these files. e.g.</p>
                   3828:             <pre class="screen">
1.14      xtraeme  3829: <code class="prompt">#</code> <strong class=
                   3830: "userinput"><code>mkdir /tmp/common</code></strong>
                   3831: <code class="prompt">#</code> <strong class=
                   3832: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   3833: <code class="prompt">#</code> <strong class=
                   3834: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   3835: <code class="prompt">#</code> <strong class=
                   3836: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   3837: <code class="prompt">#</code> <strong class=
                   3838: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   3839: <code class="prompt">#</code> <strong class=
                   3840: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   3841: <code class="prompt">#</code> <strong class=
                   3842: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    3843: </pre>
                   3844: 
                   3845:             <p>Now create the images:</p>
                   3846:             <pre class="screen">
1.14      xtraeme  3847: <code class="prompt">#</code> <strong class=
                   3848: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3849: </pre>
                   3850: 
1.14      xtraeme  3851:             <p>Each image will contain <code class=
                   3852:             "filename">README</code>, <code class=
                   3853:             "filename">COPYING</code>, and <code class=
                   3854:             "filename">bin/myscript</code> in their root
1.1       grant    3855:             directories.</p>
                   3856:           </div>
                   3857:         </div>
                   3858:       </div>
                   3859: 
                   3860:       <div class="chapter" lang="en" xml:lang="en">
                   3861:         <div class="titlepage">
                   3862:           <div>
                   3863:             <div>
                   3864:               <h2 class="title"><a name="faq" id=
                   3865:               "faq"></a>Chapter&nbsp;6.&nbsp;Frequently Asked
                   3866:               Questions</h2>
                   3867:             </div>
                   3868:           </div>
                   3869:         </div>
                   3870: 
                   3871:         <div class="toc">
                   3872:           <p><b>Table of Contents</b></p>
                   3873: 
                   3874:           <dl>
1.27    ! rillig   3875:             <dt><span class="sect1"><a href="#id2625590">6.1. Are
1.18      xtraeme  3876:             there any mailing lists for pkg-related
1.1       grant    3877:             discussion?</a></span></dt>
                   3878: 
1.27    ! rillig   3879:             <dt><span class="sect1"><a href="#id2625724">6.2.
1.1       grant    3880:             Where's the pkgviews documentation?</a></span></dt>
                   3881: 
1.5       hubertf  3882:             <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    3883:             Utilities for package management
                   3884:             (pkgtools)</a></span></dt>
                   3885: 
1.27    ! rillig   3886:             <dt><span class="sect1"><a href="#id2625987">6.4. How
1.1       grant    3887:             to use pkgsrc as non-root</a></span></dt>
                   3888: 
1.27    ! rillig   3889:             <dt><span class="sect1"><a href="#id2625998">6.5. How
1.15      xtraeme  3890:             to resume transfers when fetching
                   3891:             distfiles?</a></span></dt>
1.14      xtraeme  3892: 
1.27    ! rillig   3893:             <dt><span class="sect1"><a href="#id2626049">6.6. How
1.1       grant    3894:             can I install/use XFree86 from pkgsrc?</a></span></dt>
                   3895: 
1.27    ! rillig   3896:             <dt><span class="sect1"><a href="#id2626076">6.7. How
1.1       grant    3897:             can I install/use X.org from pkgsrc?</a></span></dt>
                   3898: 
1.27    ! rillig   3899:             <dt><span class="sect1"><a href="#id2626104">6.8. How
1.1       grant    3900:             to fetch files from behind a firewall</a></span></dt>
                   3901: 
1.27    ! rillig   3902:             <dt><span class="sect1"><a href="#id2626118">6.9. How
1.14      xtraeme  3903:             do I tell <span><strong class="command">make
                   3904:             fetch</strong></span> to do passive
                   3905:             FTP?</a></span></dt>
1.1       grant    3906: 
1.27    ! rillig   3907:             <dt><span class="sect1"><a href="#id2626169">6.10. How
1.1       grant    3908:             to fetch all distfiles at once</a></span></dt>
                   3909: 
1.27    ! rillig   3910:             <dt><span class="sect1"><a href="#id2626453">6.11. What
1.14      xtraeme  3911:             does &#8220;<span class="quote">Don't know how to make
                   3912:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    3913:             mean?</a></span></dt>
                   3914: 
1.27    ! rillig   3915:             <dt><span class="sect1"><a href="#id2626491">6.12. What
1.14      xtraeme  3916:             does &#8220;<span class="quote">Could not find
                   3917:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    3918: 
1.27    ! rillig   3919:             <dt><span class="sect1"><a href="#id2626549">6.13.
1.1       grant    3920:             Using 'sudo' with pkgsrc</a></span></dt>
                   3921: 
1.14      xtraeme  3922:             <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    3923:             Configuration files handling and
                   3924:             placement</a></span></dt>
                   3925: 
1.14      xtraeme  3926:             <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1       grant    3927:             Automated security checks</a></span></dt>
                   3928:           </dl>
                   3929:         </div>
                   3930: 
                   3931:         <p>This section contains hints, tips &amp; tricks on
                   3932:         special things in pkgsrc that we didn't find a better place
                   3933:         for in the previous chapters, and it contains items for
                   3934:         both pkgsrc users and developers.</p>
                   3935: 
                   3936:         <div class="sect1" lang="en" xml:lang="en">
                   3937:           <div class="titlepage">
                   3938:             <div>
                   3939:               <div>
                   3940:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   3941:                 "id2625590" id="id2625590"></a>6.1.&nbsp;Are there
1.18      xtraeme  3942:                 any mailing lists for pkg-related discussion?</h2>
1.1       grant    3943:               </div>
                   3944:             </div>
                   3945:           </div>
                   3946: 
1.18      xtraeme  3947:           <p>The following mailing lists may be of interest to
                   3948:           pkgsrc users:</p>
                   3949: 
                   3950:           <div class="itemizedlist">
                   3951:             <ul type="disc">
                   3952:               <li>
                   3953:                 <p><a href=
                   3954:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.20      ben      3955:                 target="_top">pkgsrc-bugs</a> -- a list where
                   3956:                 problem reports related to pkgsrc are sent and
                   3957:                 discussed</p>
1.18      xtraeme  3958:               </li>
                   3959: 
                   3960:               <li>
                   3961:                 <p><a href=
                   3962:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.20      ben      3963:                 target="_top">pkgsrc-bulk</a> -- a list where the
                   3964:                 results of pkgsrc bulk builds are sent and
                   3965:                 discussed</p>
1.18      xtraeme  3966:               </li>
                   3967: 
                   3968:               <li>
                   3969:                 <p><a href=
                   3970:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.20      ben      3971:                 target="_top">pkgsrc-changes</a> -- a list where
                   3972:                 all commit messages to pkgsrc are sent</p>
1.18      xtraeme  3973:               </li>
                   3974: 
                   3975:               <li>
                   3976:                 <p><a href=
                   3977:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.20      ben      3978:                 target="_top">tech-pkg</a> -- a general discussion
                   3979:                 list for all things related to pkgsrc</p>
1.18      xtraeme  3980:               </li>
                   3981:             </ul>
                   3982:           </div>
                   3983: 
                   3984:           <p>To subscribe, do:</p>
1.1       grant    3985:           <pre class="programlisting">
1.18      xtraeme  3986: <code class="prompt">%</code> echo subscribe <em class=
                   3987: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    3988: </pre>
                   3989: 
1.18      xtraeme  3990:           <p>Archives for all these mailing lists are available
                   3991:           from <a href="http://mail-index.NetBSD.org/" target=
                   3992:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    3993:         </div>
                   3994: 
                   3995:         <div class="sect1" lang="en" xml:lang="en">
                   3996:           <div class="titlepage">
                   3997:             <div>
                   3998:               <div>
                   3999:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   4000:                 "id2625724" id="id2625724"></a>6.2.&nbsp;Where's
1.1       grant    4001:                 the pkgviews documentation?</h2>
                   4002:               </div>
                   4003:             </div>
                   4004:           </div>
                   4005: 
                   4006:           <p>Pkgviews is tightly integrated with buildlink. You can
1.14      xtraeme  4007:           find a pkgviews User's guide in <code class=
                   4008:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    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.5       hubertf  4016:                 "faq-pkgtools" id=
                   4017:                 "faq-pkgtools"></a>6.3.&nbsp;Utilities for package
                   4018:                 management (pkgtools)</h2>
1.1       grant    4019:               </div>
                   4020:             </div>
                   4021:           </div>
                   4022: 
1.14      xtraeme  4023:           <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1       grant    4024:           directory pkgtools contains a number of useful utilities
                   4025:           for both users and developers of pkgsrc. This section
                   4026:           attempts only to make the reader aware of the utilities
                   4027:           and when they might be useful, and not to duplicate the
                   4028:           documentation that comes with each package.</p>
                   4029: 
                   4030:           <p>Utilities used by pkgsrc (automatically installed when
                   4031:           needed):</p>
                   4032: 
                   4033:           <div class="itemizedlist">
                   4034:             <ul type="disc">
                   4035:               <li>
                   4036:                 <p><a xmlns=
                   4037:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4038:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.20      ben      4039:                 class="pkgname">pkgtools/x11-links</a>: symlinks
                   4040:                 for use by buildlink</p>
1.1       grant    4041:               </li>
                   4042:             </ul>
                   4043:           </div>
                   4044: 
                   4045:           <p>OS tool augmentation (automatically installed when
                   4046:           needed):</p>
                   4047: 
                   4048:           <div class="itemizedlist">
                   4049:             <ul type="disc">
                   4050:               <li>
                   4051:                 <p><a xmlns=
                   4052:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4053:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20      ben      4054:                 class="pkgname">pkgtools/digest</a>: calculates
1.27    ! rillig   4055:                 various kinds of checksums (including SHA1)</p>
1.1       grant    4056:               </li>
                   4057: 
                   4058:               <li>
                   4059:                 <p><a xmlns=
                   4060:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4061:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.27    ! rillig   4062:                 class="pkgname">pkgtools/libnbcompat</a>:
        !          4063:                 compatibility library for pkgsrc tools</p>
1.1       grant    4064:               </li>
                   4065: 
                   4066:               <li>
                   4067:                 <p><a xmlns=
                   4068:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4069:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.20      ben      4070:                 class="pkgname">pkgtools/mtree</a>: installed on
                   4071:                 non-BSD systems due to lack of native mtree</p>
1.1       grant    4072:               </li>
                   4073: 
                   4074:               <li>
                   4075:                 <p><a xmlns=
                   4076:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4077:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4078:                 class="pkgname">pkgtools/pkg_install</a>:
                   4079:                 up-to-date replacement for /usr/sbin/pkg_install,
                   4080:                 or for use on operating systems where pkg_install
                   4081:                 is not present</p>
1.1       grant    4082:               </li>
                   4083:             </ul>
                   4084:           </div>
                   4085: 
                   4086:           <p>Utilities used by pkgsrc (not automatically
                   4087:           installed):</p>
                   4088: 
                   4089:           <div class="itemizedlist">
                   4090:             <ul type="disc">
                   4091:               <li>
                   4092:                 <p><a xmlns=
                   4093:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4094:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.20      ben      4095:                 class="pkgname">pkgtools/pkg_tarup</a>: create a
                   4096:                 binary package from an already-installed package.
1.27    ! rillig   4097:                 used by <span><strong class="command">make
        !          4098:                 replace</strong></span> to save the old package</p>
1.1       grant    4099:               </li>
                   4100: 
                   4101:               <li>
                   4102:                 <p><a xmlns=
                   4103:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  4104:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.20      ben      4105:                 class="pkgname">pkgtools/dfdisk</a>: adds extra
                   4106:                 functionality to pkgsrc, allowing it to fetch
                   4107:                 distfiles from multiple locations. It currently
                   4108:                 supports the following methods: multiple CD-ROMs
                   4109:                 and network FTP/HTTP connections.</p>
1.5       hubertf  4110:               </li>
                   4111: 
                   4112:               <li>
                   4113:                 <p><a xmlns=
                   4114:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    4115:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20      ben      4116:                 class="pkgname">pkgtools/xpkgwedge</a>: put X11
                   4117:                 packages someplace else (enabled by default)</p>
1.1       grant    4118:               </li>
1.5       hubertf  4119: 
                   4120:               <li>
                   4121:                 <p><a xmlns=
                   4122:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4123:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20      ben      4124:                 class="pkgname">devel/cpuflags</a>: will determine
                   4125:                 the best compiler flags to optimise code for your
                   4126:                 current CPU and compiler.</p>
1.5       hubertf  4127:               </li>
1.1       grant    4128:             </ul>
                   4129:           </div>
                   4130: 
                   4131:           <p>Utilities for keeping track of installed packages,
                   4132:           being up to date, etc:</p>
                   4133: 
                   4134:           <div class="itemizedlist">
                   4135:             <ul type="disc">
                   4136:               <li>
                   4137:                 <p><a xmlns=
                   4138:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4139:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.27    ! rillig   4140:                 class="pkgname">pkgtools/pkg_chk</a>: reports on
        !          4141:                 packages whose installed versions do not match the
        !          4142:                 latest pkgsrc entries</p>
1.1       grant    4143:               </li>
                   4144: 
                   4145:               <li>
                   4146:                 <p><a xmlns=
                   4147:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4148:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.20      ben      4149:                 class="pkgname">pkgtools/pkgdep</a>: makes
                   4150:                 dependency graphs of packages, to aid in choosing a
                   4151:                 strategy for updating</p>
1.1       grant    4152:               </li>
                   4153: 
                   4154:               <li>
                   4155:                 <p><a xmlns=
                   4156:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4157:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.27    ! rillig   4158:                 class="pkgname">pkgtools/pkgdepgraph</a>: makes
        !          4159:                 graphs from the output of <a xmlns=
        !          4160:                 "http://www.w3.org/TR/xhtml1/transitional" href=
        !          4161:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
        !          4162:                 class="pkgname">pkgtools/pkgdep</a> (uses
        !          4163:                 graphviz)</p>
1.1       grant    4164:               </li>
                   4165: 
                   4166:               <li>
                   4167:                 <p><a xmlns=
                   4168:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4169:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.27    ! rillig   4170:                 class="pkgname">pkgtools/pkglint</a>: the
        !          4171:                 pkglint(1) program checks a pkgsrc entry for
        !          4172:                 errors, lintpkgsrc(1) does various checks on the
        !          4173:                 complete pkgsrc system.</p>
1.1       grant    4174:               </li>
                   4175: 
                   4176:               <li>
                   4177:                 <p><a xmlns=
                   4178:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4179:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.20      ben      4180:                 class="pkgname">pkgtools/pkgsurvey</a>: report what
                   4181:                 packages you have installed</p>
1.1       grant    4182:               </li>
                   4183:             </ul>
                   4184:           </div>
                   4185: 
                   4186:           <p>Utilities for people maintaining or creating
                   4187:           individual packages:</p>
                   4188: 
                   4189:           <div class="itemizedlist">
                   4190:             <ul type="disc">
                   4191:               <li>
                   4192:                 <p><a xmlns=
                   4193:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4194:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      4195:                 class="pkgname">pkgtools/pkgdiff</a>: automate
                   4196:                 making and maintaining patches for a package
                   4197:                 (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1       grant    4198:               </li>
                   4199: 
                   4200:               <li>
                   4201:                 <p><a xmlns=
                   4202:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4203:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.20      ben      4204:                 class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
                   4205:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4206:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
                   4207:                 class="pkgname">pkgtools/url2pkg</a>: aids in
                   4208:                 converting to pkgsrc</p>
1.1       grant    4209:               </li>
                   4210: 
                   4211:               <li>
                   4212:                 <p><a xmlns=
                   4213:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4214:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.20      ben      4215:                 class="pkgname">pkgtools/gensolpkg</a>: convert
                   4216:                 pkgsrc to a Solaris package</p>
1.1       grant    4217:               </li>
                   4218:             </ul>
                   4219:           </div>
                   4220: 
                   4221:           <p>Utilities for people maintaining pkgsrc (or more
                   4222:           obscure pkg utilities)</p>
                   4223: 
                   4224:           <div class="itemizedlist">
                   4225:             <ul type="disc">
                   4226:               <li>
                   4227:                 <p><a xmlns=
                   4228:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4229:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.20      ben      4230:                 class="pkgname">pkgtools/pkgconflict</a>: find
                   4231:                 packages that conflict but aren't marked as
                   4232:                 such</p>
1.1       grant    4233:               </li>
                   4234: 
                   4235:               <li>
                   4236:                 <p><a xmlns=
                   4237:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4238:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.20      ben      4239:                 class="pkgname">pkgtools/pkg_comp</a>: build
                   4240:                 packages in a chrooted area</p>
1.1       grant    4241:               </li>
                   4242: 
                   4243:               <li>
                   4244:                 <p><a xmlns=
                   4245:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4246:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.20      ben      4247:                 class="pkgname">pkgtools/libkver</a>: spoof kernel
                   4248:                 version for chrooted cross builds</p>
1.1       grant    4249:               </li>
                   4250:             </ul>
                   4251:           </div>
                   4252:         </div>
                   4253: 
                   4254:         <div class="sect1" lang="en" xml:lang="en">
                   4255:           <div class="titlepage">
                   4256:             <div>
                   4257:               <div>
                   4258:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   4259:                 "id2625987" id="id2625987"></a>6.4.&nbsp;How to use
1.1       grant    4260:                 pkgsrc as non-root</h2>
                   4261:               </div>
                   4262:             </div>
                   4263:           </div>
                   4264: 
                   4265:           <p>If you want to use pkgsrc as non-root user, you can
                   4266:           set some variables to make pkgsrc work under these
                   4267:           conditions. Please see <a href=
                   4268:           "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.20      ben      4269:           target="_top">this message</a> for more details.</p>
1.14      xtraeme  4270:         </div>
                   4271: 
                   4272:         <div class="sect1" lang="en" xml:lang="en">
                   4273:           <div class="titlepage">
                   4274:             <div>
                   4275:               <div>
                   4276:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   4277:                 "id2625998" id="id2625998"></a>6.5.&nbsp;How to
1.15      xtraeme  4278:                 resume transfers when fetching distfiles?</h2>
1.14      xtraeme  4279:               </div>
                   4280:             </div>
                   4281:           </div>
                   4282: 
1.15      xtraeme  4283:           <p>By default resuming transfers in pkgsrc is disabled,
                   4284:           but you can enable this feature by adding the option
                   4285:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
                   4286:           into <code class="filename">/etc/mk.conf</code>. If,
                   4287:           during a fetch step, an incomplete distfile is found,
                   4288:           pkgsrc will try to resume it.</p>
                   4289: 
                   4290:           <p>You can also use a different program than the default
1.24      wiz      4291:           <a href=
                   4292:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   4293:           <span class="citerefentry"><span class=
                   4294:           "refentrytitle">ftp</span>(1)</span></a> by changing the
                   4295:           <code class="varname">FETCH_CMD</code> variable. Don't
                   4296:           forget to set <code class=
                   4297:           "varname">FETCH_RESUME_ARGS</code> and <code class=
                   4298:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
                   4299:           default values.</p>
1.14      xtraeme  4300: 
                   4301:           <p>For example, if you want to use <code class=
                   4302:           "filename">wget</code> to resume downloads, you'll have
                   4303:           to use something like:</p>
                   4304:           <pre class="programlisting">
                   4305:         FETCH_CMD=wget
                   4306:         FETCH_BEFORE_ARGS=--passive-ftp
                   4307:         FETCH_RESUME_ARGS=-c
                   4308:         FETCH_OUTPUT_ARGS=-O
                   4309:     
                   4310: </pre>
1.1       grant    4311:         </div>
                   4312: 
                   4313:         <div class="sect1" lang="en" xml:lang="en">
                   4314:           <div class="titlepage">
                   4315:             <div>
                   4316:               <div>
                   4317:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   4318:                 "id2626049" id="id2626049"></a>6.6.&nbsp;How can I
1.1       grant    4319:                 install/use XFree86 from pkgsrc?</h2>
                   4320:               </div>
                   4321:             </div>
                   4322:           </div>
                   4323: 
                   4324:           <p>If you want to use XFree86 from pkgsrc instead of your
1.14      xtraeme  4325:           system's own X11 (<code class=
                   4326:           "filename">/usr/X11R6</code>, <code class=
                   4327:           "filename">/usr/openwin</code>, ...), you will have to
                   4328:           add the following line into <code class=
1.15      xtraeme  4329:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4330:           <pre class="programlisting">
                   4331:       X11_TYPE=XFree86
                   4332:     
                   4333: </pre>
                   4334:         </div>
                   4335: 
                   4336:         <div class="sect1" lang="en" xml:lang="en">
                   4337:           <div class="titlepage">
                   4338:             <div>
                   4339:               <div>
                   4340:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   4341:                 "id2626076" id="id2626076"></a>6.7.&nbsp;How can I
1.1       grant    4342:                 install/use X.org from pkgsrc?</h2>
                   4343:               </div>
                   4344:             </div>
                   4345:           </div>
                   4346: 
                   4347:           <p>If you want to use X.org from pkgsrc instead of your
1.14      xtraeme  4348:           system's own X11 (<code class=
                   4349:           "filename">/usr/X11R6</code>, <code class=
                   4350:           "filename">/usr/openwin</code>, ...) you will have to add
                   4351:           the following line into <code class=
1.15      xtraeme  4352:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4353:           <pre class="programlisting">
                   4354:       X11_TYPE=xorg
                   4355:     
                   4356: </pre>
                   4357:         </div>
                   4358: 
                   4359:         <div class="sect1" lang="en" xml:lang="en">
                   4360:           <div class="titlepage">
                   4361:             <div>
                   4362:               <div>
                   4363:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   4364:                 "id2626104" id="id2626104"></a>6.8.&nbsp;How to
1.1       grant    4365:                 fetch files from behind a firewall</h2>
                   4366:               </div>
                   4367:             </div>
                   4368:           </div>
                   4369: 
                   4370:           <p>If you are sitting behind a firewall which does not
                   4371:           allow direct connections to Internet hosts (i.e.
                   4372:           non-NAT), you may specify the relevant proxy hosts. This
                   4373:           is done using an environment variable in the form of a
                   4374:           URL e.g. in Amdahl, the machine &#8220;<span class=
                   4375:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   4376:           firewalls, and it uses port 80 as the proxy port number.
                   4377:           So the proxy environment variables are:</p>
                   4378:           <pre class="programlisting">
                   4379:   ftp_proxy=ftp://orpheus.amdahl.com:80/
                   4380: http_proxy=http://orpheus.amdahl.com:80/
                   4381: </pre>
                   4382:         </div>
                   4383: 
                   4384:         <div class="sect1" lang="en" xml:lang="en">
                   4385:           <div class="titlepage">
                   4386:             <div>
                   4387:               <div>
                   4388:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   4389:                 "id2626118" id="id2626118"></a>6.9.&nbsp;How do I
1.14      xtraeme  4390:                 tell <span><strong class="command">make
                   4391:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    4392:               </div>
                   4393:             </div>
                   4394:           </div>
                   4395: 
                   4396:           <p>This depends on which utility is used to retrieve
1.14      xtraeme  4397:           distfiles. From <code class="filename">bsd.pkg.mk</code>,
                   4398:           <code class="varname">FETCH_CMD</code> is assigned the
                   4399:           first available command from the following list:</p>
1.1       grant    4400:           <pre class="programlisting">
                   4401: ${LOCALBASE}/bin/ftp
                   4402: /usr/bin/ftp
                   4403: </pre>
                   4404: 
                   4405:           <p>On a default NetBSD installation, this will be
1.14      xtraeme  4406:           <code class="filename">/usr/bin/ftp</code>, which
1.1       grant    4407:           automatically tries passive connections first, and falls
                   4408:           back to active connections if the server refuses to do
                   4409:           passive. For the other tools, add the following to your
1.14      xtraeme  4410:           <code class="filename">/etc/mk.conf</code> file:
                   4411:           <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    4412: 
1.14      xtraeme  4413:           <p>Having that option present will prevent <code class=
                   4414:           "filename">/usr/bin/ftp</code> from falling back to
                   4415:           active transfers.</p>
1.1       grant    4416:         </div>
                   4417: 
                   4418:         <div class="sect1" lang="en" xml:lang="en">
                   4419:           <div class="titlepage">
                   4420:             <div>
                   4421:               <div>
                   4422:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   4423:                 "id2626169" id="id2626169"></a>6.10.&nbsp;How to
1.1       grant    4424:                 fetch all distfiles at once</h2>
                   4425:               </div>
                   4426:             </div>
                   4427:           </div>
                   4428: 
                   4429:           <p>You would like to download all the distfiles in a
                   4430:           single batch from work or university, where you can't run
1.14      xtraeme  4431:           a <span><strong class="command">make
                   4432:           fetch</strong></span>. There is an archive of distfiles
                   4433:           on <a href=
1.1       grant    4434:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   4435:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   4436:           entire directory may not be appropriate.</p>
                   4437: 
1.14      xtraeme  4438:           <p>The answer here is to do a <span><strong class=
                   4439:           "command">make fetch-list</strong></span> in <code class=
                   4440:           "filename">/usr/pkgsrc</code> or one of it's
1.1       grant    4441:           subdirectories, carry the resulting list to your machine
1.23      wiz      4442:           at work/school and use it there. If you don't have a
1.24      wiz      4443:           NetBSD-compatible <a href=
                   4444:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   4445:           <span class="citerefentry"><span class=
                   4446:           "refentrytitle">ftp</span>(1)</span></a> (like lukemftp)
                   4447:           at work, don't forget to set <code class=
                   4448:           "varname">FETCH_CMD</code> to something that fetches a
                   4449:           URL:</p>
1.1       grant    4450: 
                   4451:           <p>At home:</p>
                   4452:           <pre class="screen">
1.14      xtraeme  4453: <code class="prompt">%</code> <strong class=
                   4454: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4455: <code class="prompt">%</code> <strong class=
                   4456: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   4457: <code class="prompt">%</code> <strong class=
                   4458: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    4459: </pre>
                   4460: 
                   4461:           <p>At work:</p>
                   4462:           <pre class="screen">
1.14      xtraeme  4463: <code class="prompt">%</code> <strong class=
                   4464: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    4465: </pre>
                   4466: 
1.14      xtraeme  4467:           <p>then tar up <code class=
                   4468:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    4469: 
                   4470:           <p>If you have a machine running NetBSD, and you want to
                   4471:           get <span class="emphasis"><em>all</em></span> distfiles
                   4472:           (even ones that aren't for your machine architecture),
                   4473:           you can do so by using the above-mentioned
1.14      xtraeme  4474:           <span><strong class="command">make
                   4475:           fetch-list</strong></span> approach, or fetch the
                   4476:           distfiles directly by running:</p>
1.1       grant    4477:           <pre class="screen">
1.14      xtraeme  4478: <code class="prompt">%</code> <strong class=
                   4479: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    4480: </pre>
                   4481: 
1.14      xtraeme  4482:           <p>If you even decide to ignore <code class=
                   4483:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   4484:           can get everything by running:</p>
1.1       grant    4485:           <pre class="screen">
1.14      xtraeme  4486: <code class="prompt">%</code> <strong class=
                   4487: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    4488: </pre>
                   4489:         </div>
                   4490: 
                   4491:         <div class="sect1" lang="en" xml:lang="en">
                   4492:           <div class="titlepage">
                   4493:             <div>
                   4494:               <div>
                   4495:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   4496:                 "id2626453" id="id2626453"></a>6.11.&nbsp;What does
1.1       grant    4497:                 &#8220;<span class="quote">Don't know how to make
                   4498:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   4499:               </div>
                   4500:             </div>
                   4501:           </div>
                   4502: 
                   4503:           <p>When compiling the <a xmlns=
                   4504:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4505:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4506:           class="pkgname">pkgtools/pkg_install</a> package, you get
                   4507:           the error from make that it doesn't know how to make
                   4508:           <code class="filename">/usr/share/tmac/tmac.andoc</code>?
                   4509:           This indicates that you don't have installed the
1.23      wiz      4510:           &#8220;<span class="quote">text</span>&#8221; set (nroff,
                   4511:           ...) from the NetBSD base distribution on your machine.
                   4512:           It is recommended to do that to format manpages.</p>
1.1       grant    4513: 
                   4514:           <p>In the case of the <a xmlns=
                   4515:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4516:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.20      ben      4517:           class="pkgname">pkgtools/pkg_install</a> package, you can
                   4518:           get away with setting <code class=
                   4519:           "varname">NOMAN=YES</code> either in the environment or
                   4520:           in <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    4521:         </div>
                   4522: 
                   4523:         <div class="sect1" lang="en" xml:lang="en">
                   4524:           <div class="titlepage">
                   4525:             <div>
                   4526:               <div>
                   4527:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   4528:                 "id2626491" id="id2626491"></a>6.12.&nbsp;What does
1.1       grant    4529:                 &#8220;<span class="quote">Could not find
                   4530:                 bsd.own.mk</span>&#8221; mean?</h2>
                   4531:               </div>
                   4532:             </div>
                   4533:           </div>
                   4534: 
1.14      xtraeme  4535:           <p>You didn't install the compiler set, <code class=
                   4536:           "filename">comp.tgz</code>, when you installed your
                   4537:           NetBSD machine. Please get it and install it, by
                   4538:           extracting it in <code class="filename">/</code>:</p>
1.1       grant    4539:           <pre class="screen">
1.14      xtraeme  4540: <code class="prompt">#</code> <strong class=
                   4541: "userinput"><code>cd /</code></strong>
                   4542: <code class="prompt">#</code> <strong class=
                   4543: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    4544: </pre>
                   4545: 
1.14      xtraeme  4546:           <p><code class="filename">comp.tgz</code> is part of
                   4547:           every NetBSD release. Get the one that corresponds to
                   4548:           your release (determine via <span><strong class=
                   4549:           "command">uname -r</strong></span>).</p>
1.1       grant    4550:         </div>
                   4551: 
                   4552:         <div class="sect1" lang="en" xml:lang="en">
                   4553:           <div class="titlepage">
                   4554:             <div>
                   4555:               <div>
                   4556:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   4557:                 "id2626549" id="id2626549"></a>6.13.&nbsp;Using
1.1       grant    4558:                 'sudo' with pkgsrc</h2>
                   4559:               </div>
                   4560:             </div>
                   4561:           </div>
                   4562: 
                   4563:           <p>When installing packages as non-root user and using
1.24      wiz      4564:           the just-in-time <a href=
                   4565:           "http://netbsd.gw.com/cgi-bin/man-cgi?su+1+NetBSD-current">
                   4566:           <span class="citerefentry"><span class=
                   4567:           "refentrytitle">su</span>(1)</span></a> feature of
                   4568:           pkgsrc, it can become annoying to type in the root
                   4569:           password for each required package installed. To avoid
                   4570:           this, the sudo package can be used, which does password
                   4571:           caching over a limited time. To use it, install sudo
                   4572:           (either as binary package or from <a xmlns=
                   4573:           "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    4574:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.20      ben      4575:           class="pkgname">security/sudo</a>) and then put the
                   4576:           following into your <code class=
                   4577:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4578:           <pre class="programlisting">
1.23      wiz      4579:         .if exists(${LOCALBASE}/bin/sudo)
                   4580:         SU_CMD=${LOCALBASE}/bin/sudo /bin/sh -c
1.1       grant    4581:         .endif
                   4582:     
                   4583: </pre>
                   4584:         </div>
                   4585: 
                   4586:         <div class="sect1" lang="en" xml:lang="en">
                   4587:           <div class="titlepage">
                   4588:             <div>
                   4589:               <div>
                   4590:                 <h2 class="title" style="clear: both"><a name=
                   4591:                 "faq.conf" id=
1.14      xtraeme  4592:                 "faq.conf"></a>6.14.&nbsp;Configuration files
1.1       grant    4593:                 handling and placement</h2>
                   4594:               </div>
                   4595:             </div>
                   4596:           </div>
                   4597: 
1.14      xtraeme  4598:           <p>The global variable <code class=
                   4599:           "varname">PKG_SYSCONFBASE</code> (and some others) can be
                   4600:           set by the system administrator in <code class=
                   4601:           "filename">/etc/mk.conf</code> to define the place where
1.1       grant    4602:           configuration files get installed. Therefore, packages
                   4603:           must be adapted to support this feature. Keep in mind
                   4604:           that you should only install files that are strictly
                   4605:           necessary in the configuration directory, files that can
1.14      xtraeme  4606:           go to <code class="filename">$PREFIX/share</code> should
                   4607:           go there.</p>
1.1       grant    4608: 
                   4609:           <p>We will take a look at available variables first
1.14      xtraeme  4610:           (<code class="filename">bsd.pkg.mk</code> contains more
                   4611:           information). <code class="varname">PKG_SYSCONFDIR</code>
                   4612:           is where the configuration files for a package may be
                   4613:           found (that is, the full path, e.g. <code class=
                   4614:           "filename">/etc</code> or <code class=
                   4615:           "filename">/usr/pkg/etc</code>). This value may be
1.1       grant    4616:           customized in various ways:</p>
                   4617: 
                   4618:           <div class="orderedlist">
                   4619:             <ol type="1">
                   4620:               <li>
1.14      xtraeme  4621:                 <p><code class="varname">PKG_SYSCONFBASE</code> is
                   4622:                 the main config directory under which all package
1.1       grant    4623:                 configuration files are to be found. Users will
1.14      xtraeme  4624:                 typically want to set it to <code class=
                   4625:                 "filename">/etc</code>, or accept the default
                   4626:                 location of <code class=
                   4627:                 "filename">$PREFIX/etc</code>.</p>
1.1       grant    4628:               </li>
                   4629: 
                   4630:               <li>
1.14      xtraeme  4631:                 <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   4632:                 is the subdirectory of <code class=
                   4633:                 "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    4634:                 configuration files for a particular package may be
1.14      xtraeme  4635:                 found. Defaults to <code class=
                   4636:                 "varname">${SYSCONFBASE}</code>.</p>
1.1       grant    4637:               </li>
                   4638: 
                   4639:               <li>
1.14      xtraeme  4640:                 <p><code class="varname">PKG_SYSCONFVAR</code> is
                   4641:                 the special suffix used to distinguish any
                   4642:                 overriding values for a particular package (see
                   4643:                 next item). It defaults to <code class=
                   4644:                 "varname">${PKGBASE}</code>, but for a collection
                   4645:                 of related packages that should all have the same
                   4646:                 <code class="varname">PKG_SYSCONFDIR</code> value,
                   4647:                 it can be set in each of the package Makefiles to a
                   4648:                 common value.</p>
1.1       grant    4649:               </li>
                   4650: 
                   4651:               <li>
1.14      xtraeme  4652:                 <p><code class=
                   4653:                 "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   4654:                 overrides the value of <code class=
                   4655:                 "varname">${PKG_SYSCONFDIR}</code> for packages
                   4656:                 with the same value for <code class=
                   4657:                 "varname">PKG_SYSCONFVAR</code>.</p>
1.1       grant    4658: 
                   4659:                 <p>As an example, all the various KDE packages may
1.14      xtraeme  4660:                 want to set <code class=
                   4661:                 "varname">PKG_SYSCONFVAR</code> to
                   4662:                 &#8220;<span class="quote">kde</span>&#8221; so
                   4663:                 admins can set <code class=
                   4664:                 "varname">PKG_SYSCONFDIR.kde</code> in <code class=
                   4665:                 "filename">/etc/mk.conf</code> to define where to
1.1       grant    4666:                 install KDE config files.</p>
                   4667:               </li>
                   4668:             </ol>
                   4669:           </div>
                   4670: 
                   4671:           <p>Programs' configuration directory should be defined
                   4672:           during the configure stage. Packages that use GNU
                   4673:           autoconf can usually do this by using the
                   4674:           &#8220;<span class="quote">--sysconfdir</span>&#8221;
                   4675:           parameter, but this brings some problems as we will see
                   4676:           now. When you change this pathname in packages, you
                   4677:           should not allow them to install files in that directory
                   4678:           directly. Instead they need to install those files under
1.14      xtraeme  4679:           <code class="filename">share/examples/${PKGNAME}</code>
                   4680:           so <code class="filename">PLIST</code> can register
                   4681:           them.</p>
1.1       grant    4682: 
                   4683:           <p>Once you have the required configuration files in
1.14      xtraeme  4684:           place (under the <code class=
                   4685:           "filename">share/examples</code> directory) the variable
                   4686:           <code class="varname">CONF_FILES</code> should be set to
                   4687:           copy them into <code class=
                   4688:           "varname">PKG_SYSCONFDIR</code>. The contents of this
                   4689:           variable is formed by pairs of filenames; the first
1.1       grant    4690:           element of the pair specifies the file inside the
1.14      xtraeme  4691:           examples directory (registered by <code class=
                   4692:           "filename">PLIST</code>) and the second element specifies
1.1       grant    4693:           the target file. This is done this way to allow binary
                   4694:           packages to place files in the right directory using
1.14      xtraeme  4695:           <code class="filename">INSTALL</code>/<code class=
                   4696:           "filename">DEINSTALL</code> scripts which are created
                   4697:           automatically. The package <code class=
                   4698:           "filename">Makefile</code> must also set <code class=
                   4699:           "varname">USE_PKGINSTALL=YES</code> to use these
1.1       grant    4700:           automatically generated scripts. The automatic copying of
                   4701:           config files can be toggled by setting the environment
1.14      xtraeme  4702:           variable <code class="varname">PKG_CONFIG</code> prior to
1.1       grant    4703:           package installation.</p>
                   4704: 
                   4705:           <p>Here is an example, taken from mail/mutt/Makefile:</p>
                   4706:           <pre class="programlisting">
                   4707:   EGDIR=            ${PREFIX}/share/doc/mutt/samples
                   4708: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   4709: </pre>
                   4710: 
                   4711:           <p>As you can see, this package installs configuration
1.14      xtraeme  4712:           files inside <code class="varname">EGDIR</code>, which
                   4713:           are registered by <code class="filename">PLIST</code>.
                   4714:           After that, the variable <code class=
                   4715:           "varname">CONF_FILES</code> lists the installed file
                   4716:           first and then the target file. Users will also get an
                   4717:           automatic message when files are installed using this
                   4718:           method.</p>
1.1       grant    4719:         </div>
                   4720: 
                   4721:         <div class="sect1" lang="en" xml:lang="en">
                   4722:           <div class="titlepage">
                   4723:             <div>
                   4724:               <div>
                   4725:                 <h2 class="title" style="clear: both"><a name=
                   4726:                 "audit-packages" id=
1.14      xtraeme  4727:                 "audit-packages"></a>6.15.&nbsp;Automated security
1.1       grant    4728:                 checks</h2>
                   4729:               </div>
                   4730:             </div>
                   4731:           </div>
                   4732: 
                   4733:           <p>Please be aware that there can often be bugs in
                   4734:           third-party software, and some of these bugs can leave a
                   4735:           machine vulnerable to exploitation by attackers. In an
                   4736:           effort to lessen the exposure, the NetBSD packages team
                   4737:           maintains a database of known-exploits to packages which
                   4738:           have at one time been included in pkgsrc. The database
                   4739:           can be downloaded automatically, and a security audit of
                   4740:           all packages installed on a system can take place. To do
                   4741:           this, install the <a xmlns=
                   4742:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4743:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.20      ben      4744:           class="pkgname">security/audit-packages</a> package. It
                   4745:           has two components:</p>
1.1       grant    4746: 
                   4747:           <div class="orderedlist">
                   4748:             <ol type="1">
                   4749:               <li>
                   4750:                 <p>&#8220;<span class=
                   4751:                 "quote">download-vulnerability-list</span>&#8221;,
                   4752:                 an easy way to download a list of the security
                   4753:                 vulnerabilities information. This list is kept up
                   4754:                 to date by the NetBSD security officer and the
                   4755:                 NetBSD packages team, and is distributed from the
                   4756:                 NetBSD ftp server:</p>
                   4757: 
                   4758:                 <p><a href=
                   4759:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.20      ben      4760:                 target=
                   4761:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    4762:               </li>
                   4763: 
                   4764:               <li>
                   4765:                 <p>&#8220;<span class=
                   4766:                 "quote">audit-packages</span>&#8221;, an easy way
                   4767:                 to audit the current machine, checking each
                   4768:                 vulnerability which is known. If a vulnerable
                   4769:                 package is installed, it will be shown by output to
                   4770:                 stdout, including a description of the type of
                   4771:                 vulnerability, and a URL containing more
                   4772:                 information.</p>
                   4773:               </li>
                   4774:             </ol>
                   4775:           </div>
                   4776: 
1.23      wiz      4777:           <p>Use of the <a xmlns=
                   4778:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4779:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
                   4780:           class="pkgname">security/audit-packages</a> package is
                   4781:           strongly recommended! After &#8220;<span class=
                   4782:           "quote">audit-packages</span>&#8221; is installed, please
                   4783:           read the package's message, which you can get by running
                   4784:           <strong class="userinput"><code>pkg_info -D
                   4785:           audit-package</code></strong>.</p>
1.1       grant    4786:         </div>
                   4787:       </div>
                   4788:     </div>
                   4789: 
                   4790:     <div class="part" lang="en" xml:lang="en">
                   4791:       <div class="titlepage">
                   4792:         <div>
                   4793:           <div>
                   4794:             <h1 class="title"><a name="developers-guide" id=
1.2       hubertf  4795:             "developers-guide"></a>The pkgsrc developer's
                   4796:             guide</h1>
1.1       grant    4797:           </div>
                   4798:         </div>
                   4799:       </div>
                   4800: 
                   4801:       <div class="toc">
                   4802:         <p><b>Table of Contents</b></p>
                   4803: 
                   4804:         <dl>
1.27    ! rillig   4805:           <dt><span class="chapter"><a href="#components">7.
        !          4806:           Package components - files, directories and
        !          4807:           contents</a></span></dt>
        !          4808: 
        !          4809:           <dd>
        !          4810:             <dl>
        !          4811:               <dt><span class="sect1"><a href=
        !          4812:               "#components.Makefile">7.1. <code class=
        !          4813:               "filename">Makefile</code></a></span></dt>
        !          4814: 
        !          4815:               <dt><span class="sect1"><a href=
        !          4816:               "#components.distinfo">7.2. <code class=
        !          4817:               "filename">distinfo</code></a></span></dt>
        !          4818: 
        !          4819:               <dt><span class="sect1"><a href=
        !          4820:               "#components.patches">7.3. patches/*</a></span></dt>
        !          4821: 
        !          4822:               <dt><span class="sect1"><a href="#id2627632">7.4.
        !          4823:               Other mandatory files</a></span></dt>
        !          4824: 
        !          4825:               <dt><span class="sect1"><a href=
        !          4826:               "#components.optional">7.5. Optional
        !          4827:               files</a></span></dt>
        !          4828: 
        !          4829:               <dt><span class="sect1"><a href="#id2627757">7.6.
        !          4830:               <code class="filename">work*</code></a></span></dt>
        !          4831: 
        !          4832:               <dt><span class="sect1"><a href="#id2627845">7.7.
        !          4833:               <code class="filename">files/*</code></a></span></dt>
        !          4834:             </dl>
        !          4835:           </dd>
        !          4836: 
        !          4837:           <dt><span class="chapter"><a href="#makefile">8.
1.25      rillig   4838:           Programming in <code class=
                   4839:           "filename">Makefile</code>s</a></span></dt>
                   4840: 
                   4841:           <dd>
                   4842:             <dl>
                   4843:               <dt><span class="sect1"><a href=
1.27    ! rillig   4844:               "#makefile.variables">8.1. <code class=
1.25      rillig   4845:               "filename">Makefile</code> variables</a></span></dt>
                   4846: 
1.27    ! rillig   4847:               <dd>
        !          4848:                 <dl>
        !          4849:                   <dt><span class="sect2"><a href=
        !          4850:                   "#makefile.variables.names">8.1.1. Naming
        !          4851:                   conventions</a></span></dt>
        !          4852:                 </dl>
        !          4853:               </dd>
        !          4854: 
        !          4855:               <dt><span class="sect1"><a href="#makefile.code">8.2.
1.25      rillig   4856:               Code snippets</a></span></dt>
                   4857: 
                   4858:               <dd>
                   4859:                 <dl>
                   4860:                   <dt><span class="sect2"><a href=
1.27    ! rillig   4861:                   "#id2628274">8.2.1. Adding things to a
1.25      rillig   4862:                   list</a></span></dt>
                   4863: 
                   4864:                   <dt><span class="sect2"><a href=
1.27    ! rillig   4865:                   "#id2628283">8.2.2. Converting an internal list
1.25      rillig   4866:                   into an external list</a></span></dt>
                   4867: 
                   4868:                   <dt><span class="sect2"><a href=
1.27    ! rillig   4869:                   "#id2628305">8.2.3. Passing variables to a shell
1.25      rillig   4870:                   command</a></span></dt>
1.27    ! rillig   4871: 
        !          4872:                   <dt><span class="sect2"><a href=
        !          4873:                   "#id2628426">8.2.4. Quoting
        !          4874:                   guideline</a></span></dt>
        !          4875: 
        !          4876:                   <dt><span class="sect2"><a href=
        !          4877:                   "#id2628677">8.2.5. Workaround for a bug in BSD
        !          4878:                   Make</a></span></dt>
1.25      rillig   4879:                 </dl>
                   4880:               </dd>
                   4881:             </dl>
                   4882:           </dd>
                   4883: 
                   4884:           <dt><span class="chapter"><a href="#plist">9. PLIST
1.1       grant    4885:           issues</a></span></dt>
                   4886: 
                   4887:           <dd>
                   4888:             <dl>
1.27    ! rillig   4889:               <dt><span class="sect1"><a href="#id2628738">9.1. RCS
1.1       grant    4890:               ID</a></span></dt>
                   4891: 
1.27    ! rillig   4892:               <dt><span class="sect1"><a href="#id2628753">9.2.
1.14      xtraeme  4893:               Semi-automatic <code class="filename">PLIST</code>
                   4894:               generation</a></span></dt>
1.1       grant    4895: 
1.25      rillig   4896:               <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14      xtraeme  4897:               Tweaking output of <span><strong class="command">make
                   4898:               print-PLIST</strong></span></a></span></dt>
1.1       grant    4899: 
1.25      rillig   4900:               <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1       grant    4901:               Variable substitution in PLIST</a></span></dt>
                   4902: 
1.27    ! rillig   4903:               <dt><span class="sect1"><a href="#id2629074">9.5.
1.1       grant    4904:               Manpage-compression</a></span></dt>
                   4905: 
1.27    ! rillig   4906:               <dt><span class="sect1"><a href="#id2629115">9.6.
1.14      xtraeme  4907:               Changing PLIST source with <code class=
                   4908:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    4909: 
1.27    ! rillig   4910:               <dt><span class="sect1"><a href="#id2629140">9.7.
1.1       grant    4911:               Platform specific and differing
                   4912:               PLISTs</a></span></dt>
                   4913: 
                   4914:               <dt><span class="sect1"><a href=
1.25      rillig   4915:               "#faq.common-dirs">9.8. Sharing directories between
1.1       grant    4916:               packages</a></span></dt>
                   4917:             </dl>
                   4918:           </dd>
                   4919: 
1.25      rillig   4920:           <dt><span class="chapter"><a href="#buildlink">10.
1.1       grant    4921:           Buildlink methodology</a></span></dt>
                   4922: 
                   4923:           <dd>
                   4924:             <dl>
1.27    ! rillig   4925:               <dt><span class="sect1"><a href="#id2629406">10.1.
1.1       grant    4926:               Converting packages to use buildlink3</a></span></dt>
                   4927: 
1.27    ! rillig   4928:               <dt><span class="sect1"><a href="#id2629724">10.2.
1.14      xtraeme  4929:               Writing <code class="filename">buildlink3.mk</code>
                   4930:               files</a></span></dt>
1.1       grant    4931: 
                   4932:               <dd>
                   4933:                 <dl>
                   4934:                   <dt><span class="sect2"><a href=
1.27    ! rillig   4935:                   "#id2629794">10.2.1. Anatomy of a buildlink3.mk
1.1       grant    4936:                   file</a></span></dt>
                   4937: 
                   4938:                   <dt><span class="sect2"><a href=
1.27    ! rillig   4939:                   "#id2630166">10.2.2. Updating <code class=
1.14      xtraeme  4940:                   "varname">BUILDLINK_DEPENDS.<em class=
                   4941:                   "replaceable"><code>pkg</code></em></code> in
                   4942:                   <code class="filename">buildlink3.mk</code>
1.1       grant    4943:                   files</a></span></dt>
                   4944:                 </dl>
                   4945:               </dd>
                   4946: 
1.27    ! rillig   4947:               <dt><span class="sect1"><a href="#id2630245">10.3.
1.14      xtraeme  4948:               Writing <code class="filename">builtin.mk</code>
                   4949:               files</a></span></dt>
1.1       grant    4950: 
                   4951:               <dd>
                   4952:                 <dl>
                   4953:                   <dt><span class="sect2"><a href=
1.27    ! rillig   4954:                   "#id2630394">10.3.1. Anatomy of a <code class=
1.14      xtraeme  4955:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    4956: 
                   4957:                   <dt><span class="sect2"><a href=
1.27    ! rillig   4958:                   "#id2630621">10.3.2. Global preferences for
1.25      rillig   4959:                   native or pkgsrc software</a></span></dt>
1.1       grant    4960:                 </dl>
                   4961:               </dd>
                   4962:             </dl>
                   4963:           </dd>
                   4964: 
1.25      rillig   4965:           <dt><span class="chapter"><a href="#options">11. Options
1.1       grant    4966:           handling</a></span></dt>
                   4967: 
                   4968:           <dd>
                   4969:             <dl>
1.27    ! rillig   4970:               <dt><span class="sect1"><a href="#id2630762">11.1.
1.1       grant    4971:               Global default options</a></span></dt>
                   4972: 
1.27    ! rillig   4973:               <dt><span class="sect1"><a href="#id2630777">11.2.
1.14      xtraeme  4974:               Converting packages to use <code class=
                   4975:               "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    4976:             </dl>
                   4977:           </dd>
                   4978: 
1.25      rillig   4979:           <dt><span class="chapter"><a href="#build">12. The build
1.1       grant    4980:           process</a></span></dt>
                   4981: 
                   4982:           <dd>
                   4983:             <dl>
1.25      rillig   4984:               <dt><span class="sect1"><a href="#build.prefix">12.1.
1.1       grant    4985:               Program location</a></span></dt>
                   4986: 
1.27    ! rillig   4987:               <dt><span class="sect1"><a href="#id2631337">12.2.
1.1       grant    4988:               Main targets</a></span></dt>
                   4989: 
                   4990:               <dt><span class="sect1"><a href=
1.25      rillig   4991:               "#build.helpful-targets">12.3. Other helpful
1.1       grant    4992:               targets</a></span></dt>
                   4993:             </dl>
                   4994:           </dd>
                   4995: 
1.25      rillig   4996:           <dt><span class="chapter"><a href="#fixes">13. Notes on
1.1       grant    4997:           fixes for packages</a></span></dt>
                   4998: 
                   4999:           <dd>
                   5000:             <dl>
1.27    ! rillig   5001:               <dt><span class="sect1"><a href="#id2632834">13.1.
1.1       grant    5002:               General operation</a></span></dt>
                   5003: 
                   5004:               <dd>
                   5005:                 <dl>
                   5006:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5007:                   "#id2632837">13.1.1. How to pull in variables
1.1       grant    5008:                   from /etc/mk.conf</a></span></dt>
                   5009: 
                   5010:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5011:                   "#id2632920">13.1.2. Restricted
1.1       grant    5012:                   packages</a></span></dt>
                   5013: 
                   5014:                   <dt><span class="sect2"><a href=
1.25      rillig   5015:                   "#dependencies">13.1.3. Handling
1.1       grant    5016:                   dependencies</a></span></dt>
                   5017: 
                   5018:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5019:                   "#id2633373">13.1.4. Handling conflicts with
1.1       grant    5020:                   other packages</a></span></dt>
                   5021: 
                   5022:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5023:                   "#id2633492">13.1.5. Packages that cannot or
1.1       grant    5024:                   should not be built</a></span></dt>
                   5025: 
                   5026:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5027:                   "#id2633517">13.1.6. Packages which should not be
1.1       grant    5028:                   deleted, once installed</a></span></dt>
                   5029: 
                   5030:                   <dt><span class="sect2"><a href=
1.25      rillig   5031:                   "#security-handling">13.1.7. Handling packages
1.1       grant    5032:                   with security problems</a></span></dt>
                   5033: 
                   5034:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5035:                   "#id2633677">13.1.8. How to handle compiler
1.1       grant    5036:                   bugs</a></span></dt>
                   5037: 
                   5038:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5039:                   "#id2633700">13.1.9. How to handle incrementing
1.1       grant    5040:                   versions when fixing an existing
                   5041:                   package</a></span></dt>
                   5042: 
                   5043:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5044:                   "#id2633817">13.1.10. Portability of
1.1       grant    5045:                   packages</a></span></dt>
                   5046:                 </dl>
                   5047:               </dd>
                   5048: 
1.27    ! rillig   5049:               <dt><span class="sect1"><a href="#id2633842">13.2.
1.1       grant    5050:               Possible downloading issues</a></span></dt>
                   5051: 
                   5052:               <dd>
                   5053:                 <dl>
                   5054:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5055:                   "#id2633845">13.2.1. Packages whose distfiles
1.1       grant    5056:                   aren't available for plain
                   5057:                   downloading</a></span></dt>
                   5058: 
                   5059:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5060:                   "#id2633908">13.2.2. How to handle modified
1.1       grant    5061:                   distfiles with the 'old' name</a></span></dt>
                   5062:                 </dl>
                   5063:               </dd>
                   5064: 
1.27    ! rillig   5065:               <dt><span class="sect1"><a href="#id2633920">13.3.
1.1       grant    5066:               Configuration gotchas</a></span></dt>
                   5067: 
                   5068:               <dd>
                   5069:                 <dl>
                   5070:                   <dt><span class="sect2"><a href=
1.25      rillig   5071:                   "#fixes.libtool">13.3.1. Shared libraries -
1.1       grant    5072:                   libtool</a></span></dt>
                   5073: 
                   5074:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5075:                   "#id2634285">13.3.2. Using libtool on GNU
1.1       grant    5076:                   packages that already support
                   5077:                   libtool</a></span></dt>
                   5078: 
                   5079:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5080:                   "#id2634503">13.3.3. GNU
1.1       grant    5081:                   Autoconf/Automake</a></span></dt>
                   5082:                 </dl>
                   5083:               </dd>
                   5084: 
1.27    ! rillig   5085:               <dt><span class="sect1"><a href="#id2634616">13.4.
1.1       grant    5086:               Building considerations</a></span></dt>
                   5087: 
                   5088:               <dd>
                   5089:                 <dl>
                   5090:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5091:                   "#id2634619">13.4.1. CPP defines</a></span></dt>
1.1       grant    5092:                 </dl>
                   5093:               </dd>
                   5094: 
1.27    ! rillig   5095:               <dt><span class="sect1"><a href="#id2634649">13.5.
1.1       grant    5096:               Package specific actions</a></span></dt>
                   5097: 
                   5098:               <dd>
                   5099:                 <dl>
                   5100:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5101:                   "#id2634652">13.5.1. Package configuration
1.1       grant    5102:                   files</a></span></dt>
                   5103: 
                   5104:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5105:                   "#id2634755">13.5.2. User
1.2       hubertf  5106:                   interaction</a></span></dt>
1.1       grant    5107: 
                   5108:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5109:                   "#id2634800">13.5.3. Handling
1.1       grant    5110:                   licenses</a></span></dt>
                   5111: 
                   5112:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5113:                   "#id2634951">13.5.4. Creating an account from a
1.1       grant    5114:                   package</a></span></dt>
                   5115: 
                   5116:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5117:                   "#id2635013">13.5.5. Installing score
1.1       grant    5118:                   files</a></span></dt>
                   5119: 
                   5120:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5121:                   "#id2635057">13.5.6. Packages providing login
1.1       grant    5122:                   shells</a></span></dt>
                   5123: 
                   5124:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5125:                   "#id2635114">13.5.7. Packages containing perl
1.1       grant    5126:                   scripts</a></span></dt>
                   5127: 
                   5128:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5129:                   "#id2635132">13.5.8. Packages with hardcoded
1.1       grant    5130:                   paths to other interpreters</a></span></dt>
                   5131: 
                   5132:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5133:                   "#id2635154">13.5.9. Packages installing perl
1.1       grant    5134:                   modules</a></span></dt>
                   5135: 
                   5136:                   <dt><span class="sect2"><a href=
1.25      rillig   5137:                   "#faq.info-files">13.5.10. Packages installing
1.1       grant    5138:                   info files</a></span></dt>
                   5139: 
                   5140:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5141:                   "#id2635510">13.5.11. Packages installing GConf2
1.1       grant    5142:                   data files</a></span></dt>
                   5143: 
                   5144:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5145:                   "#id2635678">13.5.12. Packages installing
1.1       grant    5146:                   scrollkeeper data files</a></span></dt>
                   5147: 
                   5148:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5149:                   "#id2635730">13.5.13. Packages installing X11
1.1       grant    5150:                   fonts</a></span></dt>
                   5151: 
                   5152:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5153:                   "#id2635777">13.5.14. Packages installing GTK2
1.1       grant    5154:                   modules</a></span></dt>
                   5155: 
                   5156:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5157:                   "#id2635846">13.5.15. Packages installing SGML or
1.1       grant    5158:                   XML data</a></span></dt>
                   5159: 
                   5160:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5161:                   "#id2635898">13.5.16. Packages installing
1.1       grant    5162:                   extensions to the MIME database</a></span></dt>
                   5163: 
                   5164:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5165:                   "#id2636037">13.5.17. Packages using
1.1       grant    5166:                   intltool</a></span></dt>
1.18      xtraeme  5167: 
                   5168:                   <dt><span class="sect2"><a href=
1.27    ! rillig   5169:                   "#id2636051">13.5.18. Packages installing startup
1.18      xtraeme  5170:                   scripts</a></span></dt>
1.1       grant    5171:                 </dl>
                   5172:               </dd>
                   5173: 
1.27    ! rillig   5174:               <dt><span class="sect1"><a href="#id2636072">13.6.
1.1       grant    5175:               Feedback to the author</a></span></dt>
                   5176:             </dl>
                   5177:           </dd>
                   5178: 
1.25      rillig   5179:           <dt><span class="chapter"><a href="#debug">14.
1.1       grant    5180:           Debugging</a></span></dt>
                   5181: 
1.25      rillig   5182:           <dt><span class="chapter"><a href="#submit">15.
1.1       grant    5183:           Submitting and Committing</a></span></dt>
                   5184: 
                   5185:           <dd>
                   5186:             <dl>
1.27    ! rillig   5187:               <dt><span class="sect1"><a href="#id2636739">15.1.
1.1       grant    5188:               Submitting your packages</a></span></dt>
                   5189: 
1.27    ! rillig   5190:               <dt><span class="sect1"><a href="#id2636796">15.2.
1.1       grant    5191:               Committing: Importing a package into
                   5192:               CVS</a></span></dt>
                   5193: 
1.27    ! rillig   5194:               <dt><span class="sect1"><a href="#id2636859">15.3.
1.2       hubertf  5195:               Updating a package to a newer version</a></span></dt>
1.1       grant    5196: 
1.27    ! rillig   5197:               <dt><span class="sect1"><a href="#id2636878">15.4.
1.2       hubertf  5198:               Moving a package in pkgsrc</a></span></dt>
1.1       grant    5199:             </dl>
                   5200:           </dd>
                   5201:         </dl>
                   5202:       </div>
                   5203: 
                   5204:       <div class="chapter" lang="en" xml:lang="en">
                   5205:         <div class="titlepage">
                   5206:           <div>
                   5207:             <div>
1.27    ! rillig   5208:               <h2 class="title"><a name="components" id=
        !          5209:               "components"></a>Chapter&nbsp;7.&nbsp;Package
        !          5210:               components - files, directories and contents</h2>
1.25      rillig   5211:             </div>
                   5212:           </div>
                   5213:         </div>
                   5214: 
                   5215:         <div class="toc">
                   5216:           <p><b>Table of Contents</b></p>
                   5217: 
                   5218:           <dl>
                   5219:             <dt><span class="sect1"><a href=
1.27    ! rillig   5220:             "#components.Makefile">7.1. <code class=
        !          5221:             "filename">Makefile</code></a></span></dt>
        !          5222: 
        !          5223:             <dt><span class="sect1"><a href=
        !          5224:             "#components.distinfo">7.2. <code class=
        !          5225:             "filename">distinfo</code></a></span></dt>
        !          5226: 
        !          5227:             <dt><span class="sect1"><a href=
        !          5228:             "#components.patches">7.3. patches/*</a></span></dt>
1.25      rillig   5229: 
1.27    ! rillig   5230:             <dt><span class="sect1"><a href="#id2627632">7.4. Other
        !          5231:             mandatory files</a></span></dt>
1.25      rillig   5232: 
1.27    ! rillig   5233:             <dt><span class="sect1"><a href=
        !          5234:             "#components.optional">7.5. Optional
        !          5235:             files</a></span></dt>
1.25      rillig   5236: 
1.27    ! rillig   5237:             <dt><span class="sect1"><a href="#id2627757">7.6.
        !          5238:             <code class="filename">work*</code></a></span></dt>
1.25      rillig   5239: 
1.27    ! rillig   5240:             <dt><span class="sect1"><a href="#id2627845">7.7.
        !          5241:             <code class="filename">files/*</code></a></span></dt>
1.25      rillig   5242:           </dl>
                   5243:         </div>
                   5244: 
1.27    ! rillig   5245:         <p>Whenever you're preparing a package, there are a number
        !          5246:         of files involved which are described in the following
        !          5247:         sections.</p>
1.25      rillig   5248: 
                   5249:         <div class="sect1" lang="en" xml:lang="en">
                   5250:           <div class="titlepage">
                   5251:             <div>
                   5252:               <div>
                   5253:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   5254:                 "components.Makefile" id=
        !          5255:                 "components.Makefile"></a>7.1.&nbsp;<code class=
        !          5256:                 "filename">Makefile</code></h2>
1.25      rillig   5257:               </div>
                   5258:             </div>
                   5259:           </div>
                   5260: 
1.27    ! rillig   5261:           <p>Building, installation and creation of a binary
        !          5262:           package are all controlled by the package's <code class=
        !          5263:           "filename">Makefile</code>. The <code class=
        !          5264:           "filename">Makefile</code> describes various things about
        !          5265:           a package, for example from where to get it, how to
        !          5266:           configure, build, and install it.</p>
        !          5267: 
        !          5268:           <p>A package <code class="filename">Makefile</code>
        !          5269:           contains several sections that describe the package.</p>
1.25      rillig   5270: 
1.27    ! rillig   5271:           <p>In the first section there are the following
        !          5272:           variables, which should appear exactly in the order given
        !          5273:           here.</p>
1.25      rillig   5274: 
                   5275:           <div class="itemizedlist">
                   5276:             <ul type="disc">
                   5277:               <li>
1.27    ! rillig   5278:                 <p><code class="varname">DISTNAME</code> is the
        !          5279:                 basename of the distribution file to be downloaded
        !          5280:                 from the package's website.</p>
        !          5281:               </li>
        !          5282: 
        !          5283:               <li>
        !          5284:                 <p><code class="varname">PKGNAME</code> is the name
        !          5285:                 of the package, as used by pkgsrc. You only need to
        !          5286:                 provide it if it differs from DISTNAME. Usually it
        !          5287:                 is the directory name together with the version
        !          5288:                 number. It must match the regular expression
        !          5289:                 <code class=
        !          5290:                 "varname">^[A-Za-z0-9][A-Za-z0-9-_.+]*$</code>,
        !          5291:                 that is, it starts with a letter or digit, and
        !          5292:                 contains only letters, digits, dashes, underscores,
        !          5293:                 dots and plus signs.</p>
1.25      rillig   5294:               </li>
                   5295: 
                   5296:               <li>
1.27    ! rillig   5297:                 <p><code class="varname">CATEGORIES</code> is a
        !          5298:                 list of categories which the package fits in. You
        !          5299:                 can choose any of the top-level directories of
        !          5300:                 pkgsrc for it.</p>
1.25      rillig   5301:               </li>
                   5302: 
                   5303:               <li>
1.27    ! rillig   5304:                 <p><code class="varname">MASTER_SITES</code> is a
        !          5305:                 list of URLs where the distribution files can be
        !          5306:                 downloaded. Each URL must end with a slash.</p>
1.25      rillig   5307:               </li>
                   5308:             </ul>
                   5309:           </div>
                   5310: 
1.27    ! rillig   5311:           <p>The second section contains the following
        !          5312:           variables.</p>
1.25      rillig   5313: 
1.27    ! rillig   5314:           <div class="itemizedlist">
        !          5315:             <ul type="disc">
        !          5316:               <li>
        !          5317:                 <p><code class="varname">MAINTAINER</code> is the
        !          5318:                 mail address of the package's maintainer, which is
        !          5319:                 the person you can contact when the package does
        !          5320:                 not work.</p>
        !          5321:               </li>
1.25      rillig   5322: 
1.27    ! rillig   5323:               <li>
        !          5324:                 <p><code class="varname">HOMEPAGE</code> is a URL
        !          5325:                 where users can find more information about the
1.23      wiz      5326:                 package.</p>
                   5327:               </li>
1.1       grant    5328: 
1.23      wiz      5329:               <li>
                   5330:                 <p><code class="varname">COMMENT</code> is a
                   5331:                 one-line comment about the purpose of the
                   5332:                 package.</p>
                   5333:               </li>
                   5334:             </ul>
                   5335:           </div>
1.1       grant    5336: 
1.14      xtraeme  5337:           <p>The <code class="varname">MASTER_SITES</code> may be
                   5338:           set to one of the predefined sites:</p>
1.1       grant    5339:           <pre class="programlisting">
                   5340:         ${MASTER_SITE_APACHE}
1.27    ! rillig   5341:         ${MASTER_SITE_BACKUP}
        !          5342:         ${MASTER_SITE_CYGWIN}
1.1       grant    5343:         ${MASTER_SITE_DEBIAN}
1.27    ! rillig   5344:         ${MASTER_SITE_FREEBSD}
        !          5345:         ${MASTER_SITE_FREEBSD_LOCAL}
1.1       grant    5346:         ${MASTER_SITE_GNOME}
                   5347:         ${MASTER_SITE_GNU}
                   5348:         ${MASTER_SITE_GNUSTEP}
1.9       dillo    5349:         ${MASTER_SITE_IFARCHIVE}
1.1       grant    5350:         ${MASTER_SITE_MOZILLA}
1.27    ! rillig   5351:         ${MASTER_SITE_OPENOFFICE}
1.1       grant    5352:         ${MASTER_SITE_PERL_CPAN}
1.27    ! rillig   5353:         ${MASTER_SITE_R_CRAN}
1.1       grant    5354:         ${MASTER_SITE_SOURCEFORGE}
                   5355:         ${MASTER_SITE_SUNSITE}
                   5356:         ${MASTER_SITE_SUSE}
                   5357:         ${MASTER_SITE_TEX_CTAN}
                   5358:         ${MASTER_SITE_XCONTRIB}
1.27    ! rillig   5359:         ${MASTER_SITE_XEMACS}
        !          5360:     
1.1       grant    5361: </pre>
                   5362: 
                   5363:           <p>If one of these predefined sites is chosen, you may
                   5364:           require the ability to specify a subdirectory of that
                   5365:           site. Since these macros may expand to more than one
                   5366:           actual site, you <span class=
                   5367:           "emphasis"><em>must</em></span> use the following
                   5368:           construct to specify a subdirectory:</p>
                   5369:           <pre class="programlisting">
                   5370:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   5371:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   5372: </pre>
                   5373: 
                   5374:           <p>Note the trailing slash after the subdirectory
                   5375:           name.</p>
                   5376: 
                   5377:           <div class="note" style=
                   5378:           "margin-left: 0.5in; margin-right: 0.5in;">
                   5379:             <h3 class="title">Note</h3>
                   5380: 
1.14      xtraeme  5381:             <p><code class="varname">MASTER_SITE_SUBDIR</code> has
                   5382:             been deprecated and <span class="emphasis"><em>should
                   5383:             no longer be used</em></span>.</p>
1.1       grant    5384:           </div>
                   5385: 
1.14      xtraeme  5386:           <p>If the package has multiple <code class=
                   5387:           "varname">DISTFILES</code> or multiple <code class=
                   5388:           "varname">PATCHFILES</code> from different sites, set
                   5389:           <code class="varname">SITES_foo</code> to a list of URI's
1.1       grant    5390:           where file &#8220;<span class="quote">foo</span>&#8221;
                   5391:           may be found. &#8220;<span class=
                   5392:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   5393:           <pre class="programlisting">
                   5394: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   5395: DISTFILES+=     foo-file.tar.gz
                   5396: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   5397:         http://www.somewhereelse.com/mirror/somehow/
                   5398: </pre>
                   5399: 
1.14      xtraeme  5400:           <p>Note that the normal default setting of <code class=
                   5401:           "varname">DISTFILES</code> must be made explicit if you
1.1       grant    5402:           want to add to it (rather than replace it), as you
                   5403:           usually would.</p>
                   5404: 
                   5405:           <p>Currently the following values are available for
1.14      xtraeme  5406:           <code class="varname">CATEGORIES</code>. If more than one
                   5407:           is used, they need to be separated by spaces:</p>
1.1       grant    5408:           <pre class="programlisting">
                   5409: archivers     cross         geography     meta-pkgs     security
                   5410: audio         databases     graphics      misc          shells
                   5411: benchmarks    devel         ham           multimedia    sysutils
                   5412: biology       editors       inputmethod   net           textproc
                   5413: cad           emulators     lang          news          time
                   5414: chat          finance       mail          parallel      wm
                   5415: comms         fonts         math          pkgtools      www
                   5416: converters    games         mbone         print         x11
                   5417: </pre>
                   5418: 
                   5419:           <p>Please pay attention to the following gotchas:</p>
                   5420: 
                   5421:           <div class="itemizedlist">
                   5422:             <ul type="disc">
                   5423:               <li>
1.14      xtraeme  5424:                 <p>Add <code class="varname">MANCOMPRESSED</code>
                   5425:                 if manpages are installed in compressed form by the
                   5426:                 package; see comment in <code class=
                   5427:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    5428:               </li>
                   5429: 
                   5430:               <li>
1.14      xtraeme  5431:                 <p>Replace <code class="filename">/usr/local</code>
1.1       grant    5432:                 with &#8220;<span class=
                   5433:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   5434:                 patches, below).</p>
                   5435:               </li>
                   5436: 
                   5437:               <li>
                   5438:                 <p>If the package installs any info files, see
                   5439:                 <a href="#faq.info-files" title=
1.25      rillig   5440:                 "13.5.10.&nbsp;Packages installing info files">Section
                   5441:                 13.5.10, &#8220;Packages installing info
1.1       grant    5442:                 files&#8221;</a>.</p>
                   5443:               </li>
                   5444: 
                   5445:               <li>
1.14      xtraeme  5446:                 <p>Set <code class="varname">MAINTAINER</code> to
                   5447:                 be yourself. If you really can't maintain the
                   5448:                 package for future updates, set it to <code class=
1.1       grant    5449:                 "email">&lt;<a href=
1.14      xtraeme  5450:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.1       grant    5451:               </li>
                   5452: 
                   5453:               <li>
                   5454:                 <p>If a home page for the software in question
1.14      xtraeme  5455:                 exists, add the variable <code class=
                   5456:                 "varname">HOMEPAGE</code> right after <code class=
                   5457:                 "varname">MAINTAINER</code>. The value of this
1.1       grant    5458:                 variable should be the URL for the home page.</p>
                   5459:               </li>
                   5460: 
                   5461:               <li>
1.14      xtraeme  5462:                 <p>Be sure to set the <code class=
                   5463:                 "varname">COMMENT</code> variable to a short
1.1       grant    5464:                 description of the package, not containing the
                   5465:                 pkg's name.</p>
                   5466:               </li>
                   5467:             </ul>
                   5468:           </div>
                   5469:         </div>
                   5470: 
                   5471:         <div class="sect1" lang="en" xml:lang="en">
                   5472:           <div class="titlepage">
                   5473:             <div>
                   5474:               <div>
                   5475:                 <h2 class="title" style="clear: both"><a name=
                   5476:                 "components.distinfo" id=
1.27    ! rillig   5477:                 "components.distinfo"></a>7.2.&nbsp;<code class=
1.14      xtraeme  5478:                 "filename">distinfo</code></h2>
1.1       grant    5479:               </div>
                   5480:             </div>
                   5481:           </div>
                   5482: 
                   5483:           <p>Most important, the mandatory message digest, or
                   5484:           checksum, of all the distfiles needed for the package to
                   5485:           compile, confirming they match the original file
                   5486:           distributed by the author. This ensures that the distfile
                   5487:           retrieved from the Internet has not been corrupted during
                   5488:           transfer or altered by a malign force to introduce a
1.14      xtraeme  5489:           security hole. It is generated using the
                   5490:           <span><strong class="command">make
                   5491:           makesum</strong></span> command. The digest algorithm
                   5492:           used was, at one stage, md5, but that was felt lacking
                   5493:           compared to sha1, and so sha1 is now the default
1.1       grant    5494:           algorithm. The distfile size is also generated and stored
                   5495:           in new distinfo files. The <a xmlns=
                   5496:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5497:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.20      ben      5498:           class="pkgname">pkgtools/digest</a> utility calculates
                   5499:           all of the digests in the distinfo file, and it provides
                   5500:           various different algorithms. At the current time, the
                   5501:           algorithms provided are: <span class=
                   5502:           "emphasis"><em>md5</em></span>, <span class=
                   5503:           "emphasis"><em>rmd160</em></span>, <span class=
                   5504:           "emphasis"><em>sha1</em></span>, <span class=
                   5505:           "emphasis"><em>sha256</em></span>, <span class=
                   5506:           "emphasis"><em>sha384</em></span> and <span class=
                   5507:           "emphasis"><em>sha512</em></span>.</p>
1.1       grant    5508: 
                   5509:           <p>Some packages have different sets of distfiles on a
                   5510:           per architecture basis, for example <a xmlns=
                   5511:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5512:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.20      ben      5513:           class="pkgname">www/navigator</a>). These are kept in the
                   5514:           same distinfo file and care should be taken when
                   5515:           upgrading such a package to ensure distfile information
                   5516:           is not lost.</p>
1.1       grant    5517: 
                   5518:           <p>The message digest/checksum for all the official
1.14      xtraeme  5519:           patches found in the <code class=
                   5520:           "filename">patches/</code> directory (see <a href=
                   5521:           "#components.patches" title=
1.27    ! rillig   5522:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
1.1       grant    5523:           &#8220;patches/*&#8221;</a>) for the package is also
1.14      xtraeme  5524:           stored in the <code class="filename">distinfo</code>
                   5525:           file. This is a message digest/checksum of all lines in
                   5526:           the patch file except the NetBSD RCS Id. This file is
                   5527:           generated by invoking <span><strong class="command">make
                   5528:           makepatchsum</strong></span> (or <span><strong class=
                   5529:           "command">make mps</strong></span> if you're in a
                   5530:           hurry).</p>
1.1       grant    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=
                   5538:                 "components.patches" id=
1.27    ! rillig   5539:                 "components.patches"></a>7.3.&nbsp;patches/*</h2>
1.1       grant    5540:               </div>
                   5541:             </div>
                   5542:           </div>
                   5543: 
                   5544:           <p>This directory contains files that are used by the
                   5545:           <a href=
                   5546:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   5547:           <span class="citerefentry"><span class=
                   5548:           "refentrytitle">patch</span>(1)</span></a> command to
                   5549:           modify the sources as distributed in the distribution
                   5550:           file into a form that will compile and run perfectly on
                   5551:           NetBSD. The files are applied successively in alphabetic
                   5552:           order (as returned by a shell &#8220;<span class=
                   5553:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.14      xtraeme  5554:           <code class="filename">patch-aa</code> is applied before
                   5555:           <code class="filename">patch-ab</code>, etc.</p>
1.1       grant    5556: 
1.14      xtraeme  5557:           <p>The <code class="filename">patch-*</code> files should
                   5558:           be in <span><strong class="command">diff
                   5559:           -bu</strong></span> format, and apply without a fuzz to
                   5560:           avoid problems. (To force patches to apply with fuzz you
                   5561:           can set <code class=
                   5562:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    5563:           not put changes for more than one file into a single
                   5564:           patch-file, as this will make future modifications more
                   5565:           difficult.</p>
                   5566: 
                   5567:           <p>Similar, a file should be patched at most once, not
                   5568:           several times by several different patches. If a file
                   5569:           needs several patches, they should be combined into one
                   5570:           file.</p>
                   5571: 
                   5572:           <p>One important thing to mention is to pay attention
                   5573:           that no RCS IDs get stored in the patch files, as these
                   5574:           will cause problems when later checked into the NetBSD
1.14      xtraeme  5575:           CVS tree. Use the <span><strong class=
                   5576:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    5577:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5578:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      5579:           class="pkgname">pkgtools/pkgdiff</a> package to avoid
                   5580:           these problems.</p>
1.1       grant    5581: 
                   5582:           <p>For even more automation, we recommend using
1.14      xtraeme  5583:           <span><strong class="command">mkpatches</strong></span>
                   5584:           from the same package to make a whole set of patches. You
                   5585:           just have to backup files before you edit them to
                   5586:           <code class="filename">filename.orig</code>, e.g. with
                   5587:           <span><strong class="command">cp -p filename
                   5588:           filename.orig</strong></span> or, easier, by using
                   5589:           <span><strong class="command">pkgvi</strong></span> again
                   5590:           from the same package. If you upgrade a package this way,
                   5591:           you can easily compare the new set of patches with the
                   5592:           previously existing one with <span><strong class=
                   5593:           "command">patchdiff</strong></span>.</p>
1.1       grant    5594: 
                   5595:           <p>When you have finished a package, remember to generate
                   5596:           the checksums for the patch files by using the
1.14      xtraeme  5597:           <span><strong class="command">make
                   5598:           makepatchsum</strong></span> command, see <a href=
                   5599:           "#components.distinfo" title=
1.27    ! rillig   5600:           "7.2.&nbsp;distinfo">Section&nbsp;7.2,
1.14      xtraeme  5601:           &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    5602: 
                   5603:           <p>Patch files that are distributed by the author or
1.14      xtraeme  5604:           other maintainers can be listed in <code class=
                   5605:           "varname">$PATCHFILES</code>.</p>
1.1       grant    5606: 
                   5607:           <p>If it is desired to store any patches that should not
                   5608:           be committed into pkgsrc, they can be kept outside the
1.14      xtraeme  5609:           pkgsrc tree in the <code class=
                   5610:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    5611:           tree there is expected to have the same
                   5612:           &#8220;<span class="quote">category/package</span>&#8221;
                   5613:           structure as pkgsrc, and patches are expected to be
1.14      xtraeme  5614:           stored inside these dirs (also known as <code class=
                   5615:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
                   5616:           you want to keep a private patch for <code class=
                   5617:           "filename">pkgsrc/graphics/png</code>, keep it in
                   5618:           <code class=
                   5619:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   5620:           files in the named directory are expected to be patch
1.1       grant    5621:           files, and <span class="emphasis"><em>they are applied
                   5622:           after pkgsrc patches are applied</em></span>.</p>
1.27    ! rillig   5623:         </div>
        !          5624: 
        !          5625:         <div class="sect1" lang="en" xml:lang="en">
        !          5626:           <div class="titlepage">
        !          5627:             <div>
        !          5628:               <div>
        !          5629:                 <h2 class="title" style="clear: both"><a name=
        !          5630:                 "id2627632" id="id2627632"></a>7.4.&nbsp;Other
        !          5631:                 mandatory files</h2>
        !          5632:               </div>
        !          5633:             </div>
        !          5634:           </div>
        !          5635: 
        !          5636:           <div class="variablelist">
        !          5637:             <dl>
        !          5638:               <dt><span class="term"><code class=
        !          5639:               "filename">DESCR</code></span></dt>
        !          5640: 
        !          5641:               <dd>
        !          5642:                 <p>A multi-line description of the piece of
        !          5643:                 software. This should include any credits where
        !          5644:                 they are due. Please bear in mind that others do
        !          5645:                 not share your sense of humour (or spelling
        !          5646:                 idiosyncrasies), and that others will read
        !          5647:                 everything that you write here.</p>
        !          5648:               </dd>
        !          5649: 
        !          5650:               <dt><span class="term"><code class=
        !          5651:               "filename">PLIST</code></span></dt>
        !          5652: 
        !          5653:               <dd>
        !          5654:                 <p>This file governs the files that are installed
        !          5655:                 on your system: all the binaries, manual pages,
        !          5656:                 etc. There are other directives which may be
        !          5657:                 entered in this file, to control the creation and
        !          5658:                 deletion of directories, and the location of
        !          5659:                 inserted files. See <a href="#plist" title=
        !          5660:                 "Chapter&nbsp;9.&nbsp;PLIST issues">Chapter&nbsp;9,
        !          5661:                 <i>PLIST issues</i></a> for more information.</p>
        !          5662:               </dd>
        !          5663:             </dl>
        !          5664:           </div>
        !          5665:         </div>
        !          5666: 
        !          5667:         <div class="sect1" lang="en" xml:lang="en">
        !          5668:           <div class="titlepage">
        !          5669:             <div>
        !          5670:               <div>
        !          5671:                 <h2 class="title" style="clear: both"><a name=
        !          5672:                 "components.optional" id=
        !          5673:                 "components.optional"></a>7.5.&nbsp;Optional
        !          5674:                 files</h2>
        !          5675:               </div>
        !          5676:             </div>
        !          5677:           </div>
        !          5678: 
        !          5679:           <div class="variablelist">
        !          5680:             <dl>
        !          5681:               <dt><span class="term"><code class=
        !          5682:               "filename">INSTALL</code></span></dt>
        !          5683: 
        !          5684:               <dd>
        !          5685:                 <p>This shell script is invoked twice by <a href=
        !          5686:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
        !          5687:                 <span class="citerefentry"><span class=
        !          5688:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
        !          5689:                 time after package extraction and before files are
        !          5690:                 moved in place, the second time after the files to
        !          5691:                 install are moved in place. This can be used to do
        !          5692:                 any custom procedures not possible with @exec
        !          5693:                 commands in <code class="filename">PLIST</code>.
        !          5694:                 See <a href=
        !          5695:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
        !          5696:                 <span class="citerefentry"><span class=
        !          5697:                 "refentrytitle">pkg_add</span>(1)</span></a> and
        !          5698:                 <a href=
        !          5699:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
        !          5700:                 <span class="citerefentry"><span class=
        !          5701:                 "refentrytitle">pkg_create</span>(1)</span></a> for
        !          5702:                 more information.</p>
        !          5703:               </dd>
        !          5704: 
        !          5705:               <dt><span class="term"><code class=
        !          5706:               "filename">DEINSTALL</code></span></dt>
        !          5707: 
        !          5708:               <dd>
        !          5709:                 <p>This script is executed before and after any
        !          5710:                 files are removed. It is this script's
        !          5711:                 responsibility to clean up any additional messy
        !          5712:                 details around the package's installation, since
        !          5713:                 all pkg_delete knows is how to delete the files
        !          5714:                 created in the original distribution. See <a href=
        !          5715:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
        !          5716:                 <span class="citerefentry"><span class=
        !          5717:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
        !          5718:                 <a href=
        !          5719:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
        !          5720:                 <span class="citerefentry"><span class=
        !          5721:                 "refentrytitle">pkg_create</span>(1)</span></a> for
        !          5722:                 more information.</p>
        !          5723:               </dd>
        !          5724: 
        !          5725:               <dt><span class="term"><code class=
        !          5726:               "filename">MESSAGE</code></span></dt>
        !          5727: 
        !          5728:               <dd>
        !          5729:                 <p>Display this file after installation of the
        !          5730:                 package. Useful for things like legal notices on
        !          5731:                 almost-free software and hints for updating config
        !          5732:                 files after installing modules for apache, PHP etc.
        !          5733:                 Please note that you can modify variables in it
        !          5734:                 easily by using <code class=
        !          5735:                 "varname">MESSAGE_SUBST</code> in the package's
        !          5736:                 <code class="filename">Makefile</code>:</p>
        !          5737:                 <pre class="programlisting">
        !          5738: MESSAGE_SUBST+=  SOMEVAR="somevalue"
        !          5739: </pre>
        !          5740: 
        !          5741:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
        !          5742:                 "quote">somevalue</span>&#8221; in <code class=
        !          5743:                 "filename">MESSAGE</code>.</p>
        !          5744:               </dd>
        !          5745:             </dl>
        !          5746:           </div>
        !          5747:         </div>
        !          5748: 
        !          5749:         <div class="sect1" lang="en" xml:lang="en">
        !          5750:           <div class="titlepage">
        !          5751:             <div>
        !          5752:               <div>
        !          5753:                 <h2 class="title" style="clear: both"><a name=
        !          5754:                 "id2627757" id=
        !          5755:                 "id2627757"></a>7.6.&nbsp;<code class=
        !          5756:                 "filename">work*</code></h2>
        !          5757:               </div>
        !          5758:             </div>
        !          5759:           </div>
        !          5760: 
        !          5761:           <p>When you type <span><strong class=
        !          5762:           "command">make</strong></span> the distribution files are
        !          5763:           unpacked into this directory. It can be removed by
        !          5764:           running <span><strong class="command">make
        !          5765:           clean</strong></span>. Besides the sources, this
        !          5766:           directory is also used to keep various timestamp
        !          5767:           files.</p>
        !          5768: 
        !          5769:           <p>If a package doesn't create a subdirectory for itself
        !          5770:           (like GNU software does, for instance), but extracts
        !          5771:           itself in the current directory, you should set
        !          5772:           <code class="varname">WRKSRC</code> accordingly, e.g.
        !          5773:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
        !          5774:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
        !          5775:           class="pkgname">editors/sam</a> again, but the quick
        !          5776:           answer is:</p>
        !          5777:           <pre class="programlisting">
        !          5778: WRKSRC=             ${WRKDIR}
        !          5779: </pre>
        !          5780: 
        !          5781:           <p>Please note that the old <code class=
        !          5782:           "varname">NO_WRKSUBDIR</code> has been deprecated and
        !          5783:           should not be used. Also, if your package doesn't create
        !          5784:           a subdir with the name of <code class=
        !          5785:           "varname">DISTNAME</code> but some different name, set
        !          5786:           <code class="varname">WRKSRC</code> to point to the
        !          5787:           proper name in <code class="filename">${WRKDIR}</code>.
        !          5788:           See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          5789:           href=
        !          5790:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
        !          5791:           class="pkgname">lang/tcl</a> and <a xmlns=
        !          5792:           "http://www.w3.org/TR/xhtml1/transitional" href=
        !          5793:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
        !          5794:           class="pkgname">x11/tk</a> for examples, and here is
        !          5795:           another one:</p>
        !          5796:           <pre class="programlisting">
        !          5797: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
        !          5798: </pre>
        !          5799: 
        !          5800:           <p>The name of the working directory created by pkgsrc is
        !          5801:           <code class="filename">work</code> by default. If the
        !          5802:           same pkgsrc tree should be used on several different
        !          5803:           platforms, the variable <code class=
        !          5804:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
        !          5805:           attach the platform to the directory name, e.g.
        !          5806:           <code class="filename">work.i386</code> or <code class=
        !          5807:           "filename">work.sparc</code>.</p>
        !          5808:         </div>
        !          5809: 
        !          5810:         <div class="sect1" lang="en" xml:lang="en">
        !          5811:           <div class="titlepage">
        !          5812:             <div>
        !          5813:               <div>
        !          5814:                 <h2 class="title" style="clear: both"><a name=
        !          5815:                 "id2627845" id=
        !          5816:                 "id2627845"></a>7.7.&nbsp;<code class=
        !          5817:                 "filename">files/*</code></h2>
        !          5818:               </div>
        !          5819:             </div>
        !          5820:           </div>
        !          5821: 
        !          5822:           <p>If you have any files that you wish to be placed in
        !          5823:           the package prior to configuration or building, you could
        !          5824:           place these files here and use a &#8220;<span class=
        !          5825:           "quote">${CP}</span>&#8221; command in the
        !          5826:           &#8220;<span class="quote">pre-configure</span>&#8221;
        !          5827:           target to achieve this. Alternatively, you could simply
        !          5828:           diff the file against <code class=
        !          5829:           "filename">/dev/null</code> and use the patch mechanism
        !          5830:           to manage the creation of this file.</p>
        !          5831:         </div>
        !          5832:       </div>
        !          5833: 
        !          5834:       <div class="chapter" lang="en" xml:lang="en">
        !          5835:         <div class="titlepage">
        !          5836:           <div>
        !          5837:             <div>
        !          5838:               <h2 class="title"><a name="makefile" id=
        !          5839:               "makefile"></a>Chapter&nbsp;8.&nbsp;Programming in
        !          5840:               <code class="filename">Makefile</code>s</h2>
        !          5841:             </div>
        !          5842:           </div>
        !          5843:         </div>
        !          5844: 
        !          5845:         <div class="toc">
        !          5846:           <p><b>Table of Contents</b></p>
        !          5847: 
        !          5848:           <dl>
        !          5849:             <dt><span class="sect1"><a href=
        !          5850:             "#makefile.variables">8.1. <code class=
        !          5851:             "filename">Makefile</code> variables</a></span></dt>
        !          5852: 
        !          5853:             <dd>
        !          5854:               <dl>
        !          5855:                 <dt><span class="sect2"><a href=
        !          5856:                 "#makefile.variables.names">8.1.1. Naming
        !          5857:                 conventions</a></span></dt>
        !          5858:               </dl>
        !          5859:             </dd>
        !          5860: 
        !          5861:             <dt><span class="sect1"><a href="#makefile.code">8.2.
        !          5862:             Code snippets</a></span></dt>
        !          5863: 
        !          5864:             <dd>
        !          5865:               <dl>
        !          5866:                 <dt><span class="sect2"><a href="#id2628274">8.2.1.
        !          5867:                 Adding things to a list</a></span></dt>
        !          5868: 
        !          5869:                 <dt><span class="sect2"><a href="#id2628283">8.2.2.
        !          5870:                 Converting an internal list into an external
        !          5871:                 list</a></span></dt>
        !          5872: 
        !          5873:                 <dt><span class="sect2"><a href="#id2628305">8.2.3.
        !          5874:                 Passing variables to a shell
        !          5875:                 command</a></span></dt>
        !          5876: 
        !          5877:                 <dt><span class="sect2"><a href="#id2628426">8.2.4.
        !          5878:                 Quoting guideline</a></span></dt>
        !          5879: 
        !          5880:                 <dt><span class="sect2"><a href="#id2628677">8.2.5.
        !          5881:                 Workaround for a bug in BSD Make</a></span></dt>
        !          5882:               </dl>
        !          5883:             </dd>
        !          5884:           </dl>
        !          5885:         </div>
        !          5886: 
        !          5887:         <p>Pkgsrc consists of many <code class=
        !          5888:         "filename">Makefile</code> fragments, each of which forms a
        !          5889:         well-defined part of the pkgsrc system. Using the <a href=
        !          5890:         "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
        !          5891:         <span class="citerefentry"><span class=
        !          5892:         "refentrytitle">make</span>(1)</span></a> system as a
        !          5893:         programming language for a big system like pkgsrc requires
        !          5894:         some discipline to keep the code correct and
        !          5895:         understandable.</p>
        !          5896: 
        !          5897:         <p>The basic ingredients for <code class=
        !          5898:         "filename">Makefile</code> programming are variables (which
        !          5899:         are actually macros) and shell commands. Among these shell
        !          5900:         commands may even be more complex ones like <a href=
        !          5901:         "http://netbsd.gw.com/cgi-bin/man-cgi?awk+1+NetBSD-current">
        !          5902:         <span class="citerefentry"><span class=
        !          5903:         "refentrytitle">awk</span>(1)</span></a> programs. To make
        !          5904:         sure that every shell command runs as intended it is
        !          5905:         necessary to quote all variables correctly when they are
        !          5906:         used.</p>
        !          5907: 
        !          5908:         <p>This chapter describes some patterns, that appear quite
        !          5909:         often in <code class="filename">Makefile</code>s, including
        !          5910:         the pitfalls that come along with them.</p>
        !          5911: 
        !          5912:         <div class="sect1" lang="en" xml:lang="en">
        !          5913:           <div class="titlepage">
        !          5914:             <div>
        !          5915:               <div>
        !          5916:                 <h2 class="title" style="clear: both"><a name=
        !          5917:                 "makefile.variables" id=
        !          5918:                 "makefile.variables"></a>8.1.&nbsp;<code class=
        !          5919:                 "filename">Makefile</code> variables</h2>
        !          5920:               </div>
        !          5921:             </div>
        !          5922:           </div>
        !          5923: 
        !          5924:           <p><code class="filename">Makefile</code> variables
        !          5925:           contain strings that can be processed using the five
        !          5926:           operators ``='', ``+='', ``?='', ``:='', and ``!='',
        !          5927:           which are described in the <a href=
        !          5928:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
        !          5929:           <span class="citerefentry"><span class=
        !          5930:           "refentrytitle">make</span>(1)</span></a> man page.</p>
        !          5931: 
        !          5932:           <p>When a variable's value is parsed from a <code class=
        !          5933:           "filename">Makefile</code>, the hash character ``#'' and
        !          5934:           the backslash character ``\'' are handled specially. If a
        !          5935:           backslash is followed by a newline, any whitespace
        !          5936:           immediately in front of the backslash, the backslash, the
        !          5937:           newline, and any whitespace immediately behind the
        !          5938:           newline are replaced with a single space. A backspace
        !          5939:           character and an immediately following hash character are
        !          5940:           replaced with a single hash character. Otherwise the
        !          5941:           backslash is passed as is. In a variable assignment, any
        !          5942:           hash character that is not preceded by a backslash starts
        !          5943:           a comment that continues upto the end of the logical
        !          5944:           line.</p>
        !          5945: 
        !          5946:           <p><span class="emphasis"><em>Note:</em></span> Because
        !          5947:           of this parsing algorithm the only way to create a
        !          5948:           variable consisting of a single backslash is using the
        !          5949:           ``!='' operator, for example: <code class=
        !          5950:           "varname">BACKSLASH!=echo "\\"</code>.</p>
        !          5951: 
        !          5952:           <p>So far for defining variables. The other thing you can
        !          5953:           do with variables is evaluating them. A variable is
        !          5954:           evaluated when it is part of the right side of the ``:=''
        !          5955:           or the ``!='' operator, or directly before executing a
        !          5956:           shell command which the variable is part of. In all other
        !          5957:           cases <a href=
        !          5958:           "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
        !          5959:           <span class="citerefentry"><span class=
        !          5960:           "refentrytitle">make</span>(1)</span></a> performs lazy
        !          5961:           evaluation, that is, variables are not evaluated until
        !          5962:           there's no other way. The ``modifiers'' mentioned in the
        !          5963:           man page also evaluate the variable.</p>
        !          5964: 
        !          5965:           <p>Some of the modifiers split the string into words and
        !          5966:           then operate on the words, others operate on the string
        !          5967:           as a whole. When a string is splitted into words, it is
        !          5968:           splitted as you would expect it from <a href=
        !          5969:           "http://netbsd.gw.com/cgi-bin/man-cgi?sh+1+NetBSD-current">
        !          5970:           <span class="citerefentry"><span class=
        !          5971:           "refentrytitle">sh</span>(1)</span></a>.</p>
        !          5972: 
        !          5973:           <p>No rule without exception&#8212;the
        !          5974:           <span><strong class="command">.for</strong></span> loop
        !          5975:           does not follow the shell quoting rules but splits at
        !          5976:           sequences of whitespace.</p>
        !          5977: 
        !          5978:           <p>There are several types of variables that should be
        !          5979:           handled differently. Strings and two types of lists.</p>
        !          5980: 
        !          5981:           <div class="itemizedlist">
        !          5982:             <ul type="disc">
        !          5983:               <li>
        !          5984:                 <p><span class="emphasis"><em>Strings</em></span>
        !          5985:                 can contain arbitrary characters. Nevertheless you
        !          5986:                 should restrict yourself to only using printable
        !          5987:                 characters. Examples are <code class=
        !          5988:                 "varname">PREFIX</code> and <code class=
        !          5989:                 "varname">COMMENT</code>.</p>
        !          5990:               </li>
        !          5991: 
        !          5992:               <li>
        !          5993:                 <p><span class="emphasis"><em>Internal
        !          5994:                 lists</em></span> are lists that are never exported
        !          5995:                 to any shell command. Their elements are separated
        !          5996:                 by whitespace. Therefore the elements themselves
        !          5997:                 cannot have embedded whitespace. Any other
        !          5998:                 characters are allowed. Internal lists can be used
        !          5999:                 in <span><strong class=
        !          6000:                 "command">.for</strong></span> loops. Examples are
        !          6001:                 <code class="varname">DEPENDS</code> and
        !          6002:                 <code class="varname">BUILD_DEPENDS</code>.</p>
        !          6003:               </li>
        !          6004: 
        !          6005:               <li>
        !          6006:                 <p><span class="emphasis"><em>External
        !          6007:                 lists</em></span> are lists that may be exported to
        !          6008:                 a shell command. Their elements can contain any
        !          6009:                 characters, including whitespace. That's why they
        !          6010:                 cannot be used in <span><strong class=
        !          6011:                 "command">.for</strong></span> loops. Examples are
        !          6012:                 <code class="varname">DISTFILES</code> and
        !          6013:                 <code class="varname">MASTER_SITES</code>.</p>
        !          6014:               </li>
        !          6015:             </ul>
        !          6016:           </div>
        !          6017: 
        !          6018:           <div class="sect2" lang="en" xml:lang="en">
        !          6019:             <div class="titlepage">
        !          6020:               <div>
        !          6021:                 <div>
        !          6022:                   <h3 class="title"><a name=
        !          6023:                   "makefile.variables.names" id=
        !          6024:                   "makefile.variables.names"></a>8.1.1.&nbsp;Naming
        !          6025:                   conventions</h3>
        !          6026:                 </div>
        !          6027:               </div>
        !          6028:             </div>
        !          6029: 
        !          6030:             <div class="itemizedlist">
        !          6031:               <ul type="disc">
        !          6032:                 <li>
        !          6033:                   <p>All variable names starting with an underscore
        !          6034:                   are reserved for use by the pkgsrc
        !          6035:                   infrastructure. They shall not be used by package
        !          6036:                   <code class="filename">Makefile</code>s.</p>
        !          6037:                 </li>
        !          6038: 
        !          6039:                 <li>
        !          6040:                   <p>In <span><strong class=
        !          6041:                   "command">.for</strong></span> loops you should
        !          6042:                   use lowercase variable names for the iteration
        !          6043:                   variables.</p>
        !          6044:                 </li>
        !          6045: 
        !          6046:                 <li>
        !          6047:                   <p>All list variables should have a ``plural''
        !          6048:                   name, e.g. <code class=
        !          6049:                   "varname">PKG_OPTIONS</code> or <code class=
        !          6050:                   "varname">DISTFILES</code>.</p>
        !          6051:                 </li>
        !          6052:               </ul>
        !          6053:             </div>
        !          6054:           </div>
        !          6055:         </div>
        !          6056: 
        !          6057:         <div class="sect1" lang="en" xml:lang="en">
        !          6058:           <div class="titlepage">
        !          6059:             <div>
        !          6060:               <div>
        !          6061:                 <h2 class="title" style="clear: both"><a name=
        !          6062:                 "makefile.code" id=
        !          6063:                 "makefile.code"></a>8.2.&nbsp;Code snippets</h2>
        !          6064:               </div>
        !          6065:             </div>
        !          6066:           </div>
        !          6067: 
        !          6068:           <p>This section presents you with some code snippets you
        !          6069:           should use in your own code. If you don't find anything
        !          6070:           appropriate here, you should test your code and add it
        !          6071:           here.</p>
        !          6072: 
        !          6073:           <div class="sect2" lang="en" xml:lang="en">
        !          6074:             <div class="titlepage">
        !          6075:               <div>
        !          6076:                 <div>
        !          6077:                   <h3 class="title"><a name="id2628274" id=
        !          6078:                   "id2628274"></a>8.2.1.&nbsp;Adding things to a
        !          6079:                   list</h3>
        !          6080:                 </div>
        !          6081:               </div>
        !          6082:             </div>
        !          6083:             <pre class="programlisting">
        !          6084: STRING=                 foo * bar `date`
        !          6085: INT_LIST=               # empty
        !          6086: ANOTHER_INT_LIST=       apache-[0-9]*:../../www/apache
        !          6087: EXT_LIST=               # empty
        !          6088: ANOTHER_EXT_LIST=       a=b c=d
        !          6089: 
        !          6090: INT_LIST+=              ${STRING}               # 1
        !          6091: INT_LIST+=              ${ANOTHER_INT_LIST}     # 2
        !          6092: EXT_LIST+=              ${STRING:Q}             # 3
        !          6093: EXT_LIST+=              ${ANOTHER_EXT_LIST}     # 4
        !          6094:       
        !          6095: </pre>
        !          6096: 
        !          6097:             <p>When you add a string to an external list (example
        !          6098:             3), it must be quoted. In all other cases, you must not
        !          6099:             add a quoting level. You must not merge internal and
        !          6100:             external lists, unless you are sure that all entries
        !          6101:             are correctly interpreted in both lists.</p>
        !          6102:           </div>
        !          6103: 
        !          6104:           <div class="sect2" lang="en" xml:lang="en">
        !          6105:             <div class="titlepage">
        !          6106:               <div>
        !          6107:                 <div>
        !          6108:                   <h3 class="title"><a name="id2628283" id=
        !          6109:                   "id2628283"></a>8.2.2.&nbsp;Converting an
        !          6110:                   internal list into an external list</h3>
        !          6111:                 </div>
        !          6112:               </div>
        !          6113:             </div>
        !          6114:             <pre class="programlisting">
        !          6115: EXT_LIST=       # empty
        !          6116: .for i in ${INT_LIST}
        !          6117: EXT_LIST+=      ${i:Q}""
        !          6118: .endfor
        !          6119:       
        !          6120: </pre>
        !          6121: 
        !          6122:             <p>This code converts the internal list <code class=
        !          6123:             "varname">INT_LIST</code> into the external list
        !          6124:             <code class="varname">EXT_LIST</code>. As the elements
        !          6125:             of an internal list are unquoted they must be quoted
        !          6126:             here. The reason for appending <code class=
        !          6127:             "varname">""</code> is explained below.</p>
        !          6128:           </div>
1.1       grant    6129: 
1.27    ! rillig   6130:           <div class="sect2" lang="en" xml:lang="en">
        !          6131:             <div class="titlepage">
1.1       grant    6132:               <div>
1.27    ! rillig   6133:                 <div>
        !          6134:                   <h3 class="title"><a name="id2628305" id=
        !          6135:                   "id2628305"></a>8.2.3.&nbsp;Passing variables to
        !          6136:                   a shell command</h3>
        !          6137:                 </div>
1.1       grant    6138:               </div>
                   6139:             </div>
1.27    ! rillig   6140:             <pre class="programlisting">
        !          6141: STRING=         foo bar &lt;    &gt; * `date` $$HOME ' "
        !          6142: EXT_LIST=       string=${STRING:Q} x=second\ item
        !          6143: 
        !          6144: all:
        !          6145:         echo ${STRING}                  # 1
        !          6146:         echo "${STRING}"                # 2
        !          6147:         echo "${STRING:Q}"              # 3
        !          6148:         echo ${STRING:Q}                # 4
        !          6149:         echo x${STRING:Q} | sed 1s,.,,  # 5
        !          6150:         env ${EXT_LIST} /bin/sh -c 'echo "$$string"; echo "$$x"'
        !          6151:       
        !          6152: </pre>
        !          6153: 
        !          6154:             <p>Example 1 leads to a syntax error in the shell, as
        !          6155:             the characters are just copied.</p>
        !          6156: 
        !          6157:             <p>Example 2 leads to a syntax error too, and if you
        !          6158:             leave out the last " character from <code class=
        !          6159:             "varname">${STRING}</code>, <a href=
        !          6160:             "http://netbsd.gw.com/cgi-bin/man-cgi?date+1+NetBSD-current">
        !          6161:             <span class="citerefentry"><span class=
        !          6162:             "refentrytitle">date</span>(1)</span></a> will be
        !          6163:             executed. The <code class="varname">$HOME</code> shell
        !          6164:             variable would be evaluated, too.</p>
        !          6165: 
        !          6166:             <p>Example 3 outputs each space character preceded by a
        !          6167:             backslash (or not), depending on the implementation of
        !          6168:             the <a href=
        !          6169:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
        !          6170:             <span class="citerefentry"><span class=
        !          6171:             "refentrytitle">echo</span>(1)</span></a> command.</p>
1.1       grant    6172: 
1.27    ! rillig   6173:             <p>Example 4 handles correctly every string that does
        !          6174:             not start with a dash. In that case, the result depends
        !          6175:             on the implementation of the <a href=
        !          6176:             "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
        !          6177:             <span class="citerefentry"><span class=
        !          6178:             "refentrytitle">echo</span>(1)</span></a> command. As
        !          6179:             long as you can guarantee that your input does not
        !          6180:             start with a dash this form is appropriate.</p>
1.1       grant    6181: 
1.27    ! rillig   6182:             <p>Example 5 handles even the case of a leading dash
        !          6183:             correctly.</p>
1.1       grant    6184: 
1.27    ! rillig   6185:             <p>The <code class="varname">EXT_LIST</code> does not
        !          6186:             need to be quoted because the quoting has already be
        !          6187:             done when adding elements to the list.</p>
1.1       grant    6188: 
1.27    ! rillig   6189:             <p>As internal lists shall not be passed to the shell,
        !          6190:             there is no example for it.</p>
1.1       grant    6191:           </div>
                   6192: 
1.27    ! rillig   6193:           <div class="sect2" lang="en" xml:lang="en">
        !          6194:             <div class="titlepage">
1.1       grant    6195:               <div>
1.27    ! rillig   6196:                 <div>
        !          6197:                   <h3 class="title"><a name="id2628426" id=
        !          6198:                   "id2628426"></a>8.2.4.&nbsp;Quoting
        !          6199:                   guideline</h3>
        !          6200:                 </div>
1.1       grant    6201:               </div>
                   6202:             </div>
                   6203: 
1.27    ! rillig   6204:             <p>There are many possible sources of wrongly quoted
        !          6205:             variables. This section lists some of the commonly
        !          6206:             known ones.</p>
1.1       grant    6207: 
1.27    ! rillig   6208:             <div class="itemizedlist">
        !          6209:               <ul type="disc">
        !          6210:                 <li>
        !          6211:                   <p>Whenever you use the value of a list, think
        !          6212:                   about what happens to leading or trailing
        !          6213:                   whitespace. If the list is a well-formed shell
        !          6214:                   expression you can apply the <code class=
        !          6215:                   "varname">:M*</code> modifier to strip leading
        !          6216:                   and trailing whitespace from each word. The
        !          6217:                   <code class="varname">:M</code> operator first
        !          6218:                   splits its argument according to the rules of the
        !          6219:                   shell, and then creates a new list consisting of
        !          6220:                   all words that match the shell glob expression
        !          6221:                   <code class="varname">*</code>, that is: all. One
        !          6222:                   class of situations where this is needed is when
        !          6223:                   adding a variable like <code class=
        !          6224:                   "varname">CPPFLAGS</code> to <code class=
        !          6225:                   "varname">CONFIGURE_ARGS</code>. If the configure
        !          6226:                   script invokes other configure scripts it strips
        !          6227:                   the leading and trailing whitespace from the
        !          6228:                   variable and then passes it to the other
        !          6229:                   configure scripts. But these configure scripts
        !          6230:                   expect the (child) <code class=
        !          6231:                   "varname">CPPFLAGS</code> variable to be the same
        !          6232:                   as the parent <code class=
        !          6233:                   "varname">CPPFLAGS</code>. That's why we better
        !          6234:                   pass the <code class="varname">CPPFLAGS</code>
        !          6235:                   value properly trimmed. And here is how we do
        !          6236:                   it:</p>
        !          6237:                   <pre class="programlisting">
        !          6238: CPPFLAGS=               # empty
        !          6239: CPPFLAGS+=              -Wundef -DPREFIX=\"${PREFIX:Q}\"
        !          6240: CPPFLAGS+=              ${MY_CPPFLAGS}
1.1       grant    6241: 
1.27    ! rillig   6242: CONFIGURE_ARGS+=        CPPFLAGS=${CPPFLAGS:M*:Q}
1.1       grant    6243: 
1.27    ! rillig   6244: all:
        !          6245:         echo x${CPPFLAGS:Q}x            # leading and trailing whitespace
        !          6246:         echo x${CONFIGURE_ARGS}x        # properly trimmed
        !          6247:         
        !          6248: </pre>
        !          6249:                 </li>
1.1       grant    6250: 
1.27    ! rillig   6251:                 <li>
        !          6252:                   <p>The example above contains one bug: The
        !          6253:                   <code class="varname">${PREFIX}</code> is a
        !          6254:                   properly quoted shell expression, but there is
        !          6255:                   the C compiler after it, which also expects a
        !          6256:                   properly quoted string (this time in C syntax).
        !          6257:                   The version above is therefore only correct if
        !          6258:                   <code class="varname">${PREFIX}</code> does not
        !          6259:                   have embedded backslashes or double quotes. If
        !          6260:                   you want to allow these, you have to add another
        !          6261:                   layer of quoting to each variable that is used as
        !          6262:                   a C string literal. You cannot use the
        !          6263:                   <code class="varname">:Q</code> operator for it,
        !          6264:                   as this operator only works for the shell.</p>
        !          6265:                 </li>
1.1       grant    6266: 
1.27    ! rillig   6267:                 <li>
        !          6268:                   <p>Whenever a variable can be empty the
        !          6269:                   <code class="varname">:Q</code> operator can have
        !          6270:                   surprising results. Here are two completely
        !          6271:                   different cases which can be solved with the same
        !          6272:                   trick.</p>
        !          6273:                   <pre class="programlisting">
        !          6274: EMPTY=                  # empty
        !          6275: empty_test:
        !          6276:         for i in a ${EMPTY:Q} c; do \
        !          6277:                 echo "$$i"; \
        !          6278:         done
        !          6279: 
        !          6280: for_test:
        !          6281: .for i in a:\ a:\test.txt
        !          6282:         echo ${i:Q}
        !          6283:         echo "foo"
        !          6284: .endfor
        !          6285:         
1.1       grant    6286: </pre>
                   6287: 
1.27    ! rillig   6288:                   <p>The first example will only print two of the
        !          6289:                   three lines we might have expected. This is
        !          6290:                   because <code class="varname">${EMPTY:Q}</code>
        !          6291:                   expands to the empty string, which the shell
        !          6292:                   cannot see. The workaround is to write
        !          6293:                   <code class="varname">${EMPTY:Q}""</code>. This
        !          6294:                   pattern can be often found as <code class=
        !          6295:                   "varname">${TEST} -z ${VAR:Q}</code> or as
        !          6296:                   <code class="varname">${TEST} -f
        !          6297:                   ${FNAME:Q}</code> (both of these are wrong).</p>
        !          6298: 
        !          6299:                   <p>The second example will only print three lines
        !          6300:                   instead of four. The first line looks like
        !          6301:                   <code class="varname">a:\ echo foo</code>. This
        !          6302:                   is because the backslash of the value
        !          6303:                   <code class="varname">a:\</code> is interpreted
        !          6304:                   as a line-continuation by <a href=
        !          6305:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
        !          6306:                   <span class="citerefentry"><span class=
        !          6307:                   "refentrytitle">make</span>(1)</span></a>, which
        !          6308:                   makes the second line the arguments of the
        !          6309:                   <a href=
        !          6310:                   "http://netbsd.gw.com/cgi-bin/man-cgi?echo+1+NetBSD-current">
        !          6311:                   <span class="citerefentry"><span class=
        !          6312:                   "refentrytitle">echo</span>(1)</span></a> command
        !          6313:                   from the first line. To avoid this, write
        !          6314:                   <code class="varname">${i:Q}""</code>.</p>
        !          6315:                 </li>
        !          6316:               </ul>
        !          6317:             </div>
1.1       grant    6318:           </div>
                   6319: 
1.27    ! rillig   6320:           <div class="sect2" lang="en" xml:lang="en">
        !          6321:             <div class="titlepage">
1.1       grant    6322:               <div>
1.27    ! rillig   6323:                 <div>
        !          6324:                   <h3 class="title"><a name="id2628677" id=
        !          6325:                   "id2628677"></a>8.2.5.&nbsp;Workaround for a bug
        !          6326:                   in BSD Make</h3>
        !          6327:                 </div>
1.1       grant    6328:               </div>
                   6329:             </div>
                   6330: 
1.27    ! rillig   6331:             <p>The pkgsrc bmake program does not handle the
        !          6332:             following assignment correctly. In case <code class=
        !          6333:             "varname">_othervar_</code> contains a ``-'' character,
        !          6334:             one of the closing braces is included in <code class=
        !          6335:             "varname">${VAR}</code> after this code executes.</p>
        !          6336:             <pre class="programlisting">
        !          6337:         VAR:= ${VAR:N${_othervar_:C/-//}}
        !          6338:       
1.1       grant    6339: </pre>
                   6340: 
1.27    ! rillig   6341:             <p>For a more complex code snippet and a workaround,
        !          6342:             see the package <a xmlns=
        !          6343:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          6344:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/regress/make-quoting/README.html"
        !          6345:             class="pkgname">regress/make-quoting</a>, testcase
        !          6346:             <code class="varname">bug1</code>.</p>
1.1       grant    6347:           </div>
                   6348:         </div>
                   6349:       </div>
                   6350: 
                   6351:       <div class="chapter" lang="en" xml:lang="en">
                   6352:         <div class="titlepage">
                   6353:           <div>
                   6354:             <div>
                   6355:               <h2 class="title"><a name="plist" id=
1.25      rillig   6356:               "plist"></a>Chapter&nbsp;9.&nbsp;PLIST issues</h2>
1.1       grant    6357:             </div>
                   6358:           </div>
                   6359:         </div>
                   6360: 
                   6361:         <div class="toc">
                   6362:           <p><b>Table of Contents</b></p>
                   6363: 
                   6364:           <dl>
1.27    ! rillig   6365:             <dt><span class="sect1"><a href="#id2628738">9.1. RCS
1.1       grant    6366:             ID</a></span></dt>
                   6367: 
1.27    ! rillig   6368:             <dt><span class="sect1"><a href="#id2628753">9.2.
1.14      xtraeme  6369:             Semi-automatic <code class="filename">PLIST</code>
                   6370:             generation</a></span></dt>
1.1       grant    6371: 
1.25      rillig   6372:             <dt><span class="sect1"><a href="#print-PLIST">9.3.
1.14      xtraeme  6373:             Tweaking output of <span><strong class="command">make
                   6374:             print-PLIST</strong></span></a></span></dt>
1.1       grant    6375: 
1.25      rillig   6376:             <dt><span class="sect1"><a href="#plist.misc">9.4.
1.1       grant    6377:             Variable substitution in PLIST</a></span></dt>
                   6378: 
1.27    ! rillig   6379:             <dt><span class="sect1"><a href="#id2629074">9.5.
1.1       grant    6380:             Manpage-compression</a></span></dt>
                   6381: 
1.27    ! rillig   6382:             <dt><span class="sect1"><a href="#id2629115">9.6.
1.14      xtraeme  6383:             Changing PLIST source with <code class=
                   6384:             "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    6385: 
1.27    ! rillig   6386:             <dt><span class="sect1"><a href="#id2629140">9.7.
1.1       grant    6387:             Platform specific and differing PLISTs</a></span></dt>
                   6388: 
1.25      rillig   6389:             <dt><span class="sect1"><a href="#faq.common-dirs">9.8.
1.1       grant    6390:             Sharing directories between packages</a></span></dt>
                   6391:           </dl>
                   6392:         </div>
                   6393: 
1.14      xtraeme  6394:         <p>The <code class="filename">PLIST</code> file contains a
1.1       grant    6395:         package's &#8220;<span class="quote">packing
                   6396:         list</span>&#8221;, i.e. a list of files that belong to the
1.14      xtraeme  6397:         package (relative to the <code class=
                   6398:         "filename">${PREFIX}</code> directory it's been installed
                   6399:         in) plus some additional statements - see the <a href=
1.1       grant    6400:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   6401:         <span class="citerefentry"><span class=
                   6402:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   6403:         a full list. This chapter addresses some issues that need
1.14      xtraeme  6404:         attention when dealing with the <code class=
                   6405:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    6406: 
                   6407:         <div class="sect1" lang="en" xml:lang="en">
                   6408:           <div class="titlepage">
                   6409:             <div>
                   6410:               <div>
                   6411:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   6412:                 "id2628738" id="id2628738"></a>9.1.&nbsp;RCS
1.1       grant    6413:                 ID</h2>
                   6414:               </div>
                   6415:             </div>
                   6416:           </div>
                   6417: 
                   6418:           <p>Be sure to add a RCS ID line as the first thing in any
1.14      xtraeme  6419:           <code class="filename">PLIST</code> file you write:</p>
1.1       grant    6420:           <pre class="programlisting">
1.17      sketch   6421: @comment $NetBSD$
1.1       grant    6422: </pre>
                   6423:         </div>
                   6424: 
                   6425:         <div class="sect1" lang="en" xml:lang="en">
                   6426:           <div class="titlepage">
                   6427:             <div>
                   6428:               <div>
                   6429:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   6430:                 "id2628753" id=
        !          6431:                 "id2628753"></a>9.2.&nbsp;Semi-automatic
1.14      xtraeme  6432:                 <code class="filename">PLIST</code> generation</h2>
1.1       grant    6433:               </div>
                   6434:             </div>
                   6435:           </div>
                   6436: 
1.14      xtraeme  6437:           <p>You can use the <span><strong class="command">make
                   6438:           print-PLIST</strong></span> command to output a PLIST
                   6439:           that matches any new files since the package was
                   6440:           extracted. See <a href="#build.helpful-targets" title=
1.25      rillig   6441:           "12.3.&nbsp;Other helpful targets">Section&nbsp;12.3,
1.1       grant    6442:           &#8220;Other helpful targets&#8221;</a> for more
                   6443:           information on this target.</p>
                   6444:         </div>
                   6445: 
                   6446:         <div class="sect1" lang="en" xml:lang="en">
                   6447:           <div class="titlepage">
                   6448:             <div>
                   6449:               <div>
                   6450:                 <h2 class="title" style="clear: both"><a name=
                   6451:                 "print-PLIST" id=
1.25      rillig   6452:                 "print-PLIST"></a>9.3.&nbsp;Tweaking output of
1.14      xtraeme  6453:                 <span><strong class="command">make
                   6454:                 print-PLIST</strong></span></h2>
1.1       grant    6455:               </div>
                   6456:             </div>
                   6457:           </div>
                   6458: 
                   6459:           <p>If you have used any of the *-dirs packages, as
                   6460:           explained in <a href="#faq.common-dirs" title=
1.25      rillig   6461:           "9.8.&nbsp;Sharing directories between packages">Section&nbsp;9.8,
1.1       grant    6462:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  6463:           you may have noticed that <span><strong class=
                   6464:           "command">make print-PLIST</strong></span> outputs a set
                   6465:           of <code class="varname">@comment</code>s instead of real
                   6466:           <code class="varname">@dirrm</code> lines. You can also
                   6467:           do this for specific directories and files, so that the
                   6468:           results of that command are very close to reality. This
                   6469:           helps <span class="emphasis"><em>a lot</em></span> during
                   6470:           the update of packages.</p>
                   6471: 
                   6472:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   6473:           variable takes a set of AWK patterns and actions that are
                   6474:           used to filter the output of print-PLIST. You can
                   6475:           <span class="emphasis"><em>append</em></span> any chunk
                   6476:           of AWK scripting you like to it, but be careful with
1.1       grant    6477:           quoting.</p>
                   6478: 
1.14      xtraeme  6479:           <p>For example, to get all files inside the <code class=
                   6480:           "filename">libdata/foo</code> directory removed from the
1.1       grant    6481:           resulting PLIST:</p>
                   6482:           <pre class="programlisting">
                   6483:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   6484:     
                   6485: </pre>
                   6486: 
1.14      xtraeme  6487:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    6488:           lines referring to a specific (shared) directory
1.14      xtraeme  6489:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    6490:           <pre class="programlisting">
                   6491:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   6492:     
                   6493: </pre>
                   6494:         </div>
                   6495: 
                   6496:         <div class="sect1" lang="en" xml:lang="en">
                   6497:           <div class="titlepage">
                   6498:             <div>
                   6499:               <div>
                   6500:                 <h2 class="title" style="clear: both"><a name=
1.25      rillig   6501:                 "plist.misc" id="plist.misc"></a>9.4.&nbsp;Variable
1.1       grant    6502:                 substitution in PLIST</h2>
                   6503:               </div>
                   6504:             </div>
                   6505:           </div>
                   6506: 
                   6507:           <p>A number of variables are substituted automatically in
                   6508:           PLISTs when a package is installed on a system. This
                   6509:           includes the following variables:</p>
                   6510: 
                   6511:           <div class="variablelist">
                   6512:             <dl>
1.14      xtraeme  6513:               <dt><span class="term"><code class=
                   6514:               "varname">${MACHINE_ARCH}</code>, <code class=
                   6515:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    6516: 
                   6517:               <dd>
                   6518:                 <p>Some packages like emacs and perl embed
                   6519:                 information about which architecture they were
                   6520:                 built on into the pathnames where they install
                   6521:                 their file. To handle this case, PLIST will be
                   6522:                 preprocessed before actually used, and the symbol
1.14      xtraeme  6523:                 &#8220;<span class="quote"><code class=
                   6524:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   6525:                 be replaced by what <span><strong class=
                   6526:                 "command">uname -p</strong></span> gives. The same
                   6527:                 is done if the string <code class=
                   6528:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   6529:                 PLIST somewhere - use this on packages that have
                   6530:                 GNU autoconf created configure scripts.</p>
1.1       grant    6531: 
                   6532:                 <div class="note" style=
                   6533:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   6534:                   <h3 class="title">Legacy note</h3>
                   6535: 
                   6536:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  6537:                   "quote"><code class=
                   6538:                   "varname">$ARCH</code></span>&#8221; that was
                   6539:                   replaced by the output of <span><strong class=
                   6540:                   "command">uname -m</strong></span>, but that's no
1.1       grant    6541:                   longer supported and has been removed.</p>
                   6542:                 </div>
                   6543:               </dd>
                   6544: 
1.14      xtraeme  6545:               <dt><span class="term"><code class=
                   6546:               "varname">${OPSYS}</code>, <code class=
                   6547:               "varname">${LOWER_OPSYS}</code>, <code class=
                   6548:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    6549: 
                   6550:               <dd>
                   6551:                 <p>Some packages want to embed the OS name and
                   6552:                 version into some paths. To do this, use these
1.14      xtraeme  6553:                 variables in the <code class=
                   6554:                 "filename">PLIST</code>:</p>
1.1       grant    6555: 
                   6556:                 <div class="itemizedlist">
                   6557:                   <ul type="disc">
                   6558:                     <li>
1.14      xtraeme  6559:                       <p><code class="varname">${OPSYS}</code> -
                   6560:                       output of &#8220;<span class=
                   6561:                       "quote"><span><strong class="command">uname
                   6562:                       -s</strong></span></span>&#8221;</p>
1.1       grant    6563:                     </li>
                   6564: 
                   6565:                     <li>
1.14      xtraeme  6566:                       <p><code class=
                   6567:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   6568:                       common name (eg. &#8220;<span class=
                   6569:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    6570:                     </li>
                   6571: 
                   6572:                     <li>
1.14      xtraeme  6573:                       <p><code class="varname">${OS_VERSION}</code>
                   6574:                       - &#8220;<span class=
                   6575:                       "quote"><span><strong class="command">uname
                   6576:                       -r</strong></span></span>&#8221;</p>
1.1       grant    6577:                     </li>
                   6578:                   </ul>
                   6579:                 </div>
                   6580:               </dd>
                   6581: 
1.14      xtraeme  6582:               <dt><span class="term"><code class=
                   6583:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    6584: 
                   6585:               <dd>
                   6586:                 <p>Packages that install locale files should list
                   6587:                 them in the PLIST as &#8220;<span class=
                   6588:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   6589:                 instead of &#8220;<span class=
                   6590:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   6591:                 This properly handles the fact that different
                   6592:                 operating systems expect locale files to be either
1.14      xtraeme  6593:                 in <code class="filename">share</code> or
                   6594:                 <code class="filename">lib</code> by default.</p>
1.1       grant    6595:               </dd>
                   6596:             </dl>
                   6597:           </div>
                   6598: 
                   6599:           <p>For a complete list of values which are replaced by
1.14      xtraeme  6600:           default, please look in <code class=
                   6601:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    6602:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   6603: 
                   6604:           <p>If you want to change other variables not listed
                   6605:           above, you can add variables and their expansions to this
1.14      xtraeme  6606:           variable in the following way, similar to <code class=
                   6607:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    6608:           "#components.optional" title=
1.27    ! rillig   6609:           "7.5.&nbsp;Optional files">Section&nbsp;7.5,
1.1       grant    6610:           &#8220;Optional files&#8221;</a>):</p>
                   6611:           <pre class="programlisting">
                   6612: PLIST_SUBST+=    SOMEVAR="somevalue"
                   6613: </pre>
                   6614: 
                   6615:           <p>This replaces all occurrences of &#8220;<span class=
                   6616:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   6617:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   6618:         </div>
                   6619: 
                   6620:         <div class="sect1" lang="en" xml:lang="en">
                   6621:           <div class="titlepage">
                   6622:             <div>
                   6623:               <div>
                   6624:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   6625:                 "id2629074" id=
        !          6626:                 "id2629074"></a>9.5.&nbsp;Manpage-compression</h2>
1.1       grant    6627:               </div>
                   6628:             </div>
                   6629:           </div>
                   6630: 
                   6631:           <p>Manpages should be installed in compressed form if
1.14      xtraeme  6632:           <code class="varname">MANZ</code> is set (in <code class=
                   6633:           "filename">bsd.own.mk</code>), and uncompressed
                   6634:           otherwise. To handle this in the <code class=
                   6635:           "filename">PLIST</code> file, the suffix
                   6636:           &#8220;<span class="quote">.gz</span>&#8221; is
                   6637:           appended/removed automatically for manpages according to
                   6638:           <code class="varname">MANZ</code> and <code class=
                   6639:           "varname">MANCOMPRESSED</code> being set or not, see
                   6640:           above for details. This modification of the <code class=
                   6641:           "filename">PLIST</code> file is done on a copy of it, not
                   6642:           <code class="filename">PLIST</code> itself.</p>
1.1       grant    6643:         </div>
                   6644: 
                   6645:         <div class="sect1" lang="en" xml:lang="en">
                   6646:           <div class="titlepage">
                   6647:             <div>
                   6648:               <div>
                   6649:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   6650:                 "id2629115" id="id2629115"></a>9.6.&nbsp;Changing
1.14      xtraeme  6651:                 PLIST source with <code class=
                   6652:                 "varname">PLIST_SRC</code></h2>
1.1       grant    6653:               </div>
                   6654:             </div>
                   6655:           </div>
                   6656: 
1.14      xtraeme  6657:           <p>To use one or more files as source for the
                   6658:           <code class="filename">PLIST</code> used in generating
                   6659:           the binary package, set the variable <code class=
                   6660:           "varname">PLIST_SRC</code> to the names of that file(s).
1.24      wiz      6661:           The files are later concatenated using <a href=
                   6662:           "http://netbsd.gw.com/cgi-bin/man-cgi?cat+1+NetBSD-current">
                   6663:           <span class="citerefentry"><span class=
                   6664:           "refentrytitle">cat</span>(1)</span></a>, and order of
                   6665:           things is important.</p>
1.1       grant    6666:         </div>
                   6667: 
                   6668:         <div class="sect1" lang="en" xml:lang="en">
                   6669:           <div class="titlepage">
                   6670:             <div>
                   6671:               <div>
                   6672:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   6673:                 "id2629140" id="id2629140"></a>9.7.&nbsp;Platform
1.1       grant    6674:                 specific and differing PLISTs</h2>
                   6675:               </div>
                   6676:             </div>
                   6677:           </div>
                   6678: 
                   6679:           <p>Some packages decide to install a different set of
                   6680:           files based on the operating system being used. These
                   6681:           differences can be automatically handled by using the
                   6682:           following files:</p>
                   6683: 
                   6684:           <div class="itemizedlist">
                   6685:             <ul type="disc">
                   6686:               <li>
1.14      xtraeme  6687:                 <p><code class="filename">PLIST.common</code></p>
1.1       grant    6688:               </li>
                   6689: 
                   6690:               <li>
1.14      xtraeme  6691:                 <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1       grant    6692:               </li>
                   6693: 
                   6694:               <li>
1.14      xtraeme  6695:                 <p><code class=
1.21      ben      6696:                 "filename">PLIST.${MACHINE_ARCH}</code></p>
                   6697:               </li>
                   6698: 
                   6699:               <li>
                   6700:                 <p><code class=
                   6701:                 "filename">PLIST.${OPSYS}-${MACHINE_ARCH}</code></p>
                   6702:               </li>
                   6703: 
                   6704:               <li>
                   6705:                 <p><code class=
1.14      xtraeme  6706:                 "filename">PLIST.common_end</code></p>
1.1       grant    6707:               </li>
                   6708:             </ul>
                   6709:           </div>
                   6710:         </div>
                   6711: 
                   6712:         <div class="sect1" lang="en" xml:lang="en">
                   6713:           <div class="titlepage">
                   6714:             <div>
                   6715:               <div>
                   6716:                 <h2 class="title" style="clear: both"><a name=
                   6717:                 "faq.common-dirs" id=
1.25      rillig   6718:                 "faq.common-dirs"></a>9.8.&nbsp;Sharing directories
1.1       grant    6719:                 between packages</h2>
                   6720:               </div>
                   6721:             </div>
                   6722:           </div>
                   6723: 
                   6724:           <p>A &#8220;<span class="quote">shared
                   6725:           directory</span>&#8221; is a directory where multiple
                   6726:           (and unrelated) packages install files. These directories
                   6727:           are problematic because you have to add special tricks in
                   6728:           the PLIST to conditionally remove them, or have some
                   6729:           centralized package handle them.</p>
                   6730: 
                   6731:           <p>Within pkgsrc, you'll find both approaches. If a
                   6732:           directory is shared by a few unrelated packages, it's
                   6733:           often not worth to add an extra package to remove it.
                   6734:           Therefore, one simply does:</p>
                   6735:           <pre class="programlisting">
                   6736:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   6737:     
                   6738: </pre>
                   6739: 
                   6740:           <p>in the PLISTs of all affected packages, instead of the
                   6741:           regular "@dirrm" line.</p>
                   6742: 
                   6743:           <p>However, if the directory is shared across many
                   6744:           packages, two different solutions are available:</p>
                   6745: 
                   6746:           <div class="orderedlist">
                   6747:             <ol type="1">
                   6748:               <li>
                   6749:                 <p>If the packages have a common dependency, the
                   6750:                 directory can be removed in that. For example, see
                   6751:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   6752:                 href=
                   6753:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.20      ben      6754:                 class="pkgname">textproc/scrollkeeper</a>, which
                   6755:                 removes the shared directory <code class=
                   6756:                 "filename">share/omf</code>.</p>
1.1       grant    6757:               </li>
                   6758: 
                   6759:               <li>
                   6760:                 <p>If the packages using the directory are not
                   6761:                 related at all (they have no common dependencies),
                   6762:                 a *-dirs package is used.</p>
                   6763:               </li>
                   6764:             </ol>
                   6765:           </div>
                   6766: 
                   6767:           <p>From now on, we'll discuss the second solution. To get
                   6768:           an idea of the *-dirs packages available, issue:</p>
                   6769:           <pre class="programlisting">
1.14      xtraeme  6770:       <code class="prompt">%</code> cd .../pkgsrc
                   6771:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    6772:     
                   6773: </pre>
                   6774: 
                   6775:           <p>Their use from other packages is very simple. The
1.14      xtraeme  6776:           <code class="varname">USE_DIRS</code> variable takes a
                   6777:           list of package names (without the &#8220;<span class=
1.1       grant    6778:           "quote">-dirs</span>&#8221; part) together with the
                   6779:           required version number (always pick the latest one when
                   6780:           writting new packages).</p>
                   6781: 
                   6782:           <p>For example, if a package installs files under
1.14      xtraeme  6783:           <code class="filename">share/applications</code>, it
                   6784:           should have the following line in it:</p>
1.1       grant    6785:           <pre class="programlisting">
                   6786:       USE_DIRS+= xdg-1.1
                   6787:     
                   6788: </pre>
                   6789: 
1.14      xtraeme  6790:           <p>After regenerating the PLIST using
                   6791:           <span><strong class="command">make
                   6792:           print-PLIST</strong></span>, you should get the right
                   6793:           (commented out) lines.</p>
1.1       grant    6794: 
1.14      xtraeme  6795:           <p>Note that, even if your package is using <code class=
                   6796:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    6797:           *-x11-dirs packages. Just specify the name without that
1.14      xtraeme  6798:           part and pkgsrc (in particular, <code class=
                   6799:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    6800:         </div>
                   6801:       </div>
                   6802: 
                   6803:       <div class="chapter" lang="en" xml:lang="en">
                   6804:         <div class="titlepage">
                   6805:           <div>
                   6806:             <div>
                   6807:               <h2 class="title"><a name="buildlink" id=
1.25      rillig   6808:               "buildlink"></a>Chapter&nbsp;10.&nbsp;Buildlink
1.1       grant    6809:               methodology</h2>
                   6810:             </div>
                   6811:           </div>
                   6812:         </div>
                   6813: 
                   6814:         <div class="toc">
                   6815:           <p><b>Table of Contents</b></p>
                   6816: 
                   6817:           <dl>
1.27    ! rillig   6818:             <dt><span class="sect1"><a href="#id2629406">10.1.
1.1       grant    6819:             Converting packages to use buildlink3</a></span></dt>
                   6820: 
1.27    ! rillig   6821:             <dt><span class="sect1"><a href="#id2629724">10.2.
1.14      xtraeme  6822:             Writing <code class="filename">buildlink3.mk</code>
                   6823:             files</a></span></dt>
1.1       grant    6824: 
                   6825:             <dd>
                   6826:               <dl>
1.25      rillig   6827:                 <dt><span class="sect2"><a href=
1.27    ! rillig   6828:                 "#id2629794">10.2.1. Anatomy of a buildlink3.mk
1.25      rillig   6829:                 file</a></span></dt>
1.1       grant    6830: 
1.25      rillig   6831:                 <dt><span class="sect2"><a href=
1.27    ! rillig   6832:                 "#id2630166">10.2.2. Updating <code class=
1.14      xtraeme  6833:                 "varname">BUILDLINK_DEPENDS.<em class=
                   6834:                 "replaceable"><code>pkg</code></em></code> in
                   6835:                 <code class="filename">buildlink3.mk</code>
1.1       grant    6836:                 files</a></span></dt>
                   6837:               </dl>
                   6838:             </dd>
                   6839: 
1.27    ! rillig   6840:             <dt><span class="sect1"><a href="#id2630245">10.3.
1.14      xtraeme  6841:             Writing <code class="filename">builtin.mk</code>
                   6842:             files</a></span></dt>
1.1       grant    6843: 
                   6844:             <dd>
                   6845:               <dl>
1.25      rillig   6846:                 <dt><span class="sect2"><a href=
1.27    ! rillig   6847:                 "#id2630394">10.3.1. Anatomy of a <code class=
1.14      xtraeme  6848:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    6849: 
1.25      rillig   6850:                 <dt><span class="sect2"><a href=
1.27    ! rillig   6851:                 "#id2630621">10.3.2. Global preferences for native
1.25      rillig   6852:                 or pkgsrc software</a></span></dt>
1.1       grant    6853:               </dl>
                   6854:             </dd>
                   6855:           </dl>
                   6856:         </div>
                   6857: 
                   6858:         <p>Buildlink is a framework in pkgsrc that controls what
                   6859:         headers and libraries are seen by a package's configure and
                   6860:         build processes. This is implemented in a two step
                   6861:         process:</p>
                   6862: 
                   6863:         <div class="orderedlist">
                   6864:           <ol type="1">
                   6865:             <li>
                   6866:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  6867:               into <code class="varname">BUILDLINK_DIR</code>,
                   6868:               which by default is a subdirectory of <code class=
                   6869:               "varname">WRKDIR</code>.</p>
1.1       grant    6870:             </li>
                   6871: 
                   6872:             <li>
                   6873:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  6874:               the normal compiler tools that translate <code class=
                   6875:               "option">-I${LOCALBASE}/include</code> and
                   6876:               <code class="option">-L${LOCALBASE}/lib</code> into
                   6877:               references to <code class=
                   6878:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   6879:               also make native compiler on some operating systems
                   6880:               look like GCC, so that packages that expect GCC won't
                   6881:               require modifications to build with those native
                   6882:               compilers.</p>
1.1       grant    6883:             </li>
                   6884:           </ol>
                   6885:         </div>
                   6886: 
                   6887:         <p>This normalizes the environment in which a package is
                   6888:         built so that the package may be built consistently despite
                   6889:         what other software may be installed. Please note that the
1.14      xtraeme  6890:         normal system header and library paths, e.g. <code class=
                   6891:         "filename">/usr/include</code>, <code class=
                   6892:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    6893:         buildlink3 is designed to insulate the package build from
                   6894:         non-system-supplied software.</p>
                   6895: 
                   6896:         <div class="sect1" lang="en" xml:lang="en">
                   6897:           <div class="titlepage">
                   6898:             <div>
                   6899:               <div>
                   6900:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   6901:                 "id2629406" id=
        !          6902:                 "id2629406"></a>10.1.&nbsp;Converting packages to
1.25      rillig   6903:                 use buildlink3</h2>
1.1       grant    6904:               </div>
                   6905:             </div>
                   6906:           </div>
                   6907: 
                   6908:           <p>The process of converting packages to use the
                   6909:           buildlink3 framework (&#8220;<span class=
                   6910:           "quote">bl3ifying</span>&#8221;) is fairly
                   6911:           straightforward. The things to keep in mind are:</p>
                   6912: 
                   6913:           <div class="orderedlist">
                   6914:             <ol type="1">
                   6915:               <li>
                   6916:                 <p>Ensure that the build always calls the wrapper
                   6917:                 scripts instead of the actual toolchain. Some
                   6918:                 packages are tricky, and the only way to know for
1.14      xtraeme  6919:                 sure is the check <code class=
                   6920:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    6921:                 wrappers are being invoked.</p>
                   6922:               </li>
                   6923: 
                   6924:               <li>
1.14      xtraeme  6925:                 <p>Don't override <code class=
                   6926:                 "varname">PREFIX</code> from within the package
                   6927:                 Makefile, e.g. Java VMs, standalone shells, etc.,
                   6928:                 because the code to symlink files into <code class=
                   6929:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    6930:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  6931:                 <em class=
                   6932:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    6933:               </li>
                   6934: 
                   6935:               <li>
                   6936:                 <p>Remember that <span class=
1.14      xtraeme  6937:                 "emphasis"><em>only</em></span> the <code class=
                   6938:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    6939:                 in a package's Makefile are added as dependencies
                   6940:                 for that package.</p>
                   6941:               </li>
                   6942:             </ol>
                   6943:           </div>
                   6944: 
                   6945:           <p>If a dependency on a particular package is required
                   6946:           for its libraries and headers, then we replace:</p>
                   6947:           <pre class="programlisting">
1.27    ! rillig   6948: DEPENDS+=   foo&gt;=1.1.0:../../category/foo
1.1       grant    6949: </pre>
                   6950: 
                   6951:           <p>with</p>
                   6952:           <pre class="programlisting">
                   6953: .include "../../category/foo/buildlink3.mk"
                   6954: </pre>
                   6955: 
1.14      xtraeme  6956:           <p>There are several <code class=
                   6957:           "filename">buildlink3.mk</code> files in <code class=
                   6958:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    6959:           issues:</p>
                   6960: 
                   6961:           <div class="itemizedlist">
                   6962:             <ul type="disc">
                   6963:               <li>
1.14      xtraeme  6964:                 <p><code class="filename">bdb.buildlink3.mk</code>
1.1       grant    6965:                 chooses either the native or a pkgsrc Berkeley DB
1.14      xtraeme  6966:                 implementation based on the values of <code class=
                   6967:                 "varname">BDB_ACCEPTED</code> and <code class=
                   6968:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    6969:               </li>
                   6970: 
                   6971:               <li>
1.14      xtraeme  6972:                 <p><code class=
                   6973:                 "filename">curses.buildlink3.mk</code> If the
                   6974:                 system comes with neither Curses nor NCurses, this
                   6975:                 will take care to install the <a xmlns=
                   6976:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    6977:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.20      ben      6978:                 class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    6979:               </li>
                   6980: 
                   6981:               <li>
1.14      xtraeme  6982:                 <p><code class="filename">krb5.buildlink3.mk</code>
                   6983:                 uses the value of <code class=
                   6984:                 "varname">KRB5_ACCEPTED</code> to choose between
1.1       grant    6985:                 adding a dependency on Heimdal or MIT-krb5 for
                   6986:                 packages that require a Kerberos 5
                   6987:                 implementation.</p>
                   6988:               </li>
                   6989: 
                   6990:               <li>
1.14      xtraeme  6991:                 <p><code class=
                   6992:                 "filename">motif.buildlink3.mk</code> checks for a
                   6993:                 system-provided Motif installation or adds a
                   6994:                 dependency on <a xmlns=
1.1       grant    6995:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6996:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.20      ben      6997:                 class="pkgname">x11/lesstif</a> or <a xmlns=
                   6998:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6999:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
                   7000:                 class="pkgname">x11/openmotif</a>;</p>
1.1       grant    7001:               </li>
                   7002: 
                   7003:               <li>
1.14      xtraeme  7004:                 <p><code class=
                   7005:                 "filename">ossaudio.buildlink3.mk</code> defines
                   7006:                 several variables that may be used by packages that
                   7007:                 use the Open Sound System (OSS) API;</p>
1.1       grant    7008:               </li>
                   7009: 
                   7010:               <li>
1.14      xtraeme  7011:                 <p><code class=
                   7012:                 "filename">pgsql.buildlink3.mk</code> will accept
                   7013:                 either Postgres 7.3 or 7.4, whichever is found
                   7014:                 installed. See the file for more information.</p>
1.1       grant    7015:               </li>
                   7016: 
                   7017:               <li>
1.14      xtraeme  7018:                 <p><code class=
                   7019:                 "filename">pthread.buildlink3.mk</code> uses the
                   7020:                 value of <code class="varname">PTHREAD_OPTS</code>
                   7021:                 and checks for native pthreads or adds a dependency
                   7022:                 on <a xmlns=
1.1       grant    7023:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7024:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.20      ben      7025:                 class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    7026:               </li>
                   7027: 
                   7028:               <li>
1.14      xtraeme  7029:                 <p><code class="filename">xaw.buildlink3.mk</code>
                   7030:                 uses the value of <code class=
                   7031:                 "varname">XAW_TYPE</code> to choose a particular
                   7032:                 Athena widgets library.</p>
1.1       grant    7033:               </li>
                   7034:             </ul>
                   7035:           </div>
                   7036: 
1.14      xtraeme  7037:           <p>The comments in those <code class=
                   7038:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    7039:           complete description of how to use them properly.</p>
                   7040:         </div>
                   7041: 
                   7042:         <div class="sect1" lang="en" xml:lang="en">
                   7043:           <div class="titlepage">
                   7044:             <div>
                   7045:               <div>
                   7046:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   7047:                 "id2629724" id="id2629724"></a>10.2.&nbsp;Writing
1.14      xtraeme  7048:                 <code class="filename">buildlink3.mk</code>
                   7049:                 files</h2>
1.1       grant    7050:               </div>
                   7051:             </div>
                   7052:           </div>
                   7053: 
1.14      xtraeme  7054:           <p>A package's <code class=
                   7055:           "filename">buildlink3.mk</code> file is included by
                   7056:           Makefiles to indicate the need to compile and link
                   7057:           against header files and libraries provided by the
                   7058:           package. A <code class="filename">buildlink3.mk</code>
                   7059:           file should always provide enough information to add the
                   7060:           correct type of dependency relationship and include any
                   7061:           other <code class="filename">buildlink3.mk</code> files
                   7062:           that it needs to find headers and libraries that it needs
                   7063:           in turn.</p>
1.1       grant    7064: 
1.14      xtraeme  7065:           <p>To generate an initial <code class=
                   7066:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    7067:           Rene Hexel's <a xmlns=
                   7068:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   7069:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.20      ben      7070:           class="pkgname">pkgtools/createbuildlink</a> package is
                   7071:           highly recommended. For most packages, the following
                   7072:           command will generate a good starting point for
                   7073:           <code class="filename">buildlink3.mk</code> files:</p>
1.1       grant    7074:           <pre class="screen">
1.14      xtraeme  7075: <code class="prompt">%</code> <strong class=
                   7076: "userinput"><code>cd pkgsrc/<em class=
                   7077: "replaceable"><code>category</code></em>/<em class=
                   7078: "replaceable"><code>pkgdir</code></em>
                   7079: <code class=
                   7080: "prompt">%</code> createbuildlink -3 &gt;buildlink3.mk</code></strong>
1.1       grant    7081: </pre>
                   7082: 
                   7083:           <div class="sect2" lang="en" xml:lang="en">
                   7084:             <div class="titlepage">
                   7085:               <div>
                   7086:                 <div>
1.27    ! rillig   7087:                   <h3 class="title"><a name="id2629794" id=
        !          7088:                   "id2629794"></a>10.2.1. Anatomy of a
1.25      rillig   7089:                   buildlink3.mk file</h3>
1.1       grant    7090:                 </div>
                   7091:               </div>
                   7092:             </div>
                   7093: 
1.14      xtraeme  7094:             <p>The following real-life example <code class=
                   7095:             "filename">buildlink3.mk</code> is taken from
                   7096:             <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    7097:             <pre class="programlisting">
1.17      sketch   7098: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    7099: 
                   7100: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   7101: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   7102: 
                   7103: .if !empty(BUILDLINK_DEPTH:M+)
                   7104: BUILDLINK_DEPENDS+=     tiff
                   7105: .endif
                   7106: 
                   7107: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   7108: BUILDLINK_PACKAGES+=    tiff
                   7109: 
                   7110: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   7111: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   7112: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   7113: .endif  # TIFF_BUILDLINK3_MK
                   7114: 
                   7115: .include "../../devel/zlib/buildlink3.mk"
                   7116: .include "../../graphics/jpeg/buildlink3.mk"
                   7117: 
                   7118: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   7119: </pre>
                   7120: 
1.14      xtraeme  7121:             <p>The header and footer manipulate <code class=
                   7122:             "varname">BUILDLINK_DEPTH</code>, which is common
                   7123:             across all <code class="filename">buildlink3.mk</code>
                   7124:             files and is used to track at what depth we are
                   7125:             including <code class="filename">buildlink3.mk</code>
                   7126:             files.</p>
1.1       grant    7127: 
                   7128:             <p>The first section controls if the dependency on
1.14      xtraeme  7129:             <em class="replaceable"><code>pkg</code></em> is added.
                   7130:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    7131:             global list of packages for which dependencies are
                   7132:             added by buildlink3.</p>
                   7133: 
                   7134:             <p>The second section advises pkgsrc that the
1.14      xtraeme  7135:             <code class="filename">buildlink3.mk</code> file for
                   7136:             <em class="replaceable"><code>pkg</code></em> has been
                   7137:             included at some point. <code class=
                   7138:             "varname">BUILDLINK_PACKAGES</code> is the global list
                   7139:             of packages for which <code class=
                   7140:             "filename">buildlink3.mk</code> files have been
                   7141:             included. It must <span class=
                   7142:             "emphasis"><em>always</em></span> be appended to within
                   7143:             a <code class="filename">buildlink3.mk</code> file.</p>
1.1       grant    7144: 
                   7145:             <p>The third section is protected from multiple
1.14      xtraeme  7146:             inclusion and controls how the dependency on <em class=
                   7147:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    7148:             important variables are set in the section:</p>
                   7149: 
                   7150:             <div class="itemizedlist">
                   7151:               <ul type="disc">
                   7152:                 <li>
1.14      xtraeme  7153:                   <p><code class=
                   7154:                   "varname">BUILDLINK_DEPENDS.<em class=
                   7155:                   "replaceable"><code>pkg</code></em></code> is the
                   7156:                   actual dependency recorded in the installed
                   7157:                   package; this should always be set using
                   7158:                   <span><strong class="command">+=</strong></span>
                   7159:                   to ensure that we're appending to any
                   7160:                   pre-existing list of values. This variable should
                   7161:                   be set to the first version of the package that
                   7162:                   had the last change in the major number of a
                   7163:                   shared library or that had a major API
                   7164:                   change.</p>
1.1       grant    7165:                 </li>
                   7166: 
                   7167:                 <li>
1.14      xtraeme  7168:                   <p><code class=
                   7169:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   7170:                   "replaceable"><code>pkg</code></em></code> is the
                   7171:                   location of the <em class=
                   7172:                   "replaceable"><code>pkg</code></em> pkgsrc
1.1       grant    7173:                   directory;</p>
                   7174:                 </li>
                   7175: 
                   7176:                 <li>
1.14      xtraeme  7177:                   <p><code class=
                   7178:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   7179:                   "replaceable"><code>pkg</code></em></code> (not
                   7180:                   shown above) controls whether we use <code class=
                   7181:                   "varname">BUILD_DEPENDS</code> or <code class=
                   7182:                   "varname">DEPENDS</code> to add the dependency on
                   7183:                   <em class="replaceable"><code>pkg</code></em>.
                   7184:                   The build dependency is selected by setting
                   7185:                   <code class=
                   7186:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   7187:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    7188:                   &#8220;<span class="quote">build</span>&#8221;.
                   7189:                   By default, the full dependency is used.</p>
                   7190:                 </li>
                   7191: 
                   7192:                 <li>
1.14      xtraeme  7193:                   <p><code class=
                   7194:                   "varname">BUILDLINK_INCDIRS.<em class=
                   7195:                   "replaceable"><code>pkg</code></em></code> and
                   7196:                   <code class=
                   7197:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
                   7198:                   <code>pkg</code></em></code> (not shown above)
                   7199:                   are lists of subdirectories of <code class=
                   7200:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7201:                   "replaceable"><code>pkg</code></em>}</code> to
                   7202:                   add to the header and library search paths. These
1.1       grant    7203:                   default to &#8220;<span class=
                   7204:                   "quote">include</span>&#8221; and
                   7205:                   &#8220;<span class="quote">lib</span>&#8221;
                   7206:                   respectively.</p>
                   7207:                 </li>
                   7208: 
                   7209:                 <li>
1.14      xtraeme  7210:                   <p><code class=
                   7211:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   7212:                   "replaceable"><code>pkg</code></em></code> (not
                   7213:                   shown above) is the list of preprocessor flags to
                   7214:                   add to <code class="varname">CPPFLAGS</code>,
                   7215:                   which are passed on to the configure and build
                   7216:                   phases. The &#8220;<span class=
                   7217:                   "quote">-I</span>&#8221; option should be avoided
                   7218:                   and instead be handled using <code class=
                   7219:                   "varname">BUILDLINK_INCDIRS.<em class=
                   7220:                   "replaceable"><code>pkg</code></em></code> as
                   7221:                   above.</p>
1.1       grant    7222:                 </li>
                   7223:               </ul>
                   7224:             </div>
                   7225: 
                   7226:             <p>The following variables are all optionally defined
                   7227:             within this second section (protected against multiple
                   7228:             inclusion) and control which package files are
1.14      xtraeme  7229:             symlinked into <code class=
                   7230:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    7231:             are transformed during the symlinking:</p>
                   7232: 
                   7233:             <div class="itemizedlist">
                   7234:               <ul type="disc">
                   7235:                 <li>
1.14      xtraeme  7236:                   <p><code class=
                   7237:                   "varname">BUILDLINK_FILES.<em class=
                   7238:                   "replaceable"><code>pkg</code></em></code> (not
                   7239:                   shown above) is a shell glob pattern relative to
                   7240:                   <code class=
                   7241:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7242:                   "replaceable"><code>pkg</code></em>}</code> to be
                   7243:                   symlinked into <code class=
                   7244:                   "filename">${BUILDLINK_DIR}</code>, e.g.
                   7245:                   <code class="filename">include/*.h</code>.</p>
1.1       grant    7246:                 </li>
                   7247: 
                   7248:                 <li>
1.14      xtraeme  7249:                   <p><code class=
                   7250:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   7251:                   "replaceable"><code>pkg</code></em></code> (not
                   7252:                   shown above) is a shell pipeline that outputs to
                   7253:                   stdout a list of files relative to <code class=
                   7254:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7255:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    7256:                   resulting files are to be symlinked into
1.14      xtraeme  7257:                   <code class="filename">${BUILDLINK_DIR}</code>.
                   7258:                   By default, this takes the <code class=
                   7259:                   "filename">+CONTENTS</code> of a <em class=
                   7260:                   "replaceable"><code>pkg</code></em> and filters
                   7261:                   it through <code class=
                   7262:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   7263:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    7264:                 </li>
                   7265: 
                   7266:                 <li>
1.14      xtraeme  7267:                   <p><code class=
                   7268:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   7269:                   "replaceable"><code>pkg</code></em></code> (not
                   7270:                   shown above) is a filter command that filters
                   7271:                   <code class="filename">+CONTENTS</code> input
                   7272:                   into a list of files relative to <code class=
                   7273:                   "filename">${BUILDLINK_PREFIX.<em class=
                   7274:                   "replaceable"><code>pkg</code></em>}</code> on
                   7275:                   stdout. By default for overwrite packages,
                   7276:                   <code class=
                   7277:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   7278:                   "replaceable"><code>pkg</code></em></code>
                   7279:                   outputs the contents of the <code class=
                   7280:                   "filename">include</code> and <code class=
                   7281:                   "filename">lib</code> directories in the package
                   7282:                   <code class="filename">+CONTENTS</code>, and for
                   7283:                   pkgviews packages, it outputs any libtool
                   7284:                   archives in <code class="filename">lib</code>
1.1       grant    7285:                   directories.</p>
                   7286:                 </li>
                   7287: 
                   7288:                 <li>
1.14      xtraeme  7289:                   <p><code class=
                   7290:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   7291:                   "replaceable"><code>pkg</code></em></code> (not
                   7292:                   shown above) is a list of sed arguments used to
1.1       grant    7293:                   transform the name of the source filename into a
1.14      xtraeme  7294:                   destination filename, e.g. <span><strong class=
1.1       grant    7295:                   "command">-e
1.14      xtraeme  7296:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    7297:                 </li>
                   7298:               </ul>
                   7299:             </div>
                   7300: 
1.14      xtraeme  7301:             <p>The last section includes any <code class=
                   7302:             "filename">buildlink3.mk</code> needed for <em class=
                   7303:             "replaceable"><code>pkg</code></em>'s library
                   7304:             dependencies. Including these <code class=
                   7305:             "filename">buildlink3.mk</code> files means that the
                   7306:             headers and libraries for these dependencies are also
                   7307:             symlinked into <code class=
                   7308:             "filename">${BUILDLINK_DIR}</code> whenever the
                   7309:             <em class="replaceable"><code>pkg</code></em>
                   7310:             <code class="filename">buildlink3.mk</code> file is
                   7311:             included.</p>
1.1       grant    7312:           </div>
                   7313: 
                   7314:           <div class="sect2" lang="en" xml:lang="en">
                   7315:             <div class="titlepage">
                   7316:               <div>
                   7317:                 <div>
1.27    ! rillig   7318:                   <h3 class="title"><a name="id2630166" id=
        !          7319:                   "id2630166"></a>10.2.2. Updating <code class=
1.14      xtraeme  7320:                   "varname">BUILDLINK_DEPENDS.<em class=
                   7321:                   "replaceable"><code>pkg</code></em></code> in
                   7322:                   <code class="filename">buildlink3.mk</code>
                   7323:                   files</h3>
1.1       grant    7324:                 </div>
                   7325:               </div>
                   7326:             </div>
                   7327: 
                   7328:             <p>There are two situations that require increasing the
1.14      xtraeme  7329:             dependency listed in <code class=
                   7330:             "varname">BUILDLINK_DEPENDS.<em class=
                   7331:             "replaceable"><code>pkg</code></em></code> after a
                   7332:             package update:</p>
1.1       grant    7333: 
                   7334:             <div class="orderedlist">
                   7335:               <ol type="1">
                   7336:                 <li>
                   7337:                   <p>if the sonames (major number of the library
                   7338:                   version) of any installed shared libraries
                   7339:                   change;</p>
                   7340:                 </li>
                   7341: 
                   7342:                 <li>
                   7343:                   <p>if the API or interface to the header files
                   7344:                   change.</p>
                   7345:                 </li>
                   7346:               </ol>
                   7347:             </div>
                   7348: 
1.14      xtraeme  7349:             <p>In these cases, <code class=
                   7350:             "varname">BUILDLINK_DEPENDS.<em class=
                   7351:             "replaceable"><code>pkg</code></em></code> should be
                   7352:             adjusted to require at least the new package version.
                   7353:             In some cases, the packages that depend on this new
                   7354:             version may need their <code class=
                   7355:             "varname">PKGREVISION</code>s increased and, if they
                   7356:             have <code class="filename">buildlink3.mk</code> files,
                   7357:             their <code class=
                   7358:             "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
                   7359:             pkg</code></em></code> adjusted, too. This is needed so
                   7360:             that binary packages made using it will require the
                   7361:             correct package dependency and not settle for an older
                   7362:             one which will not contain the necessary shared
                   7363:             libraries.</p>
1.1       grant    7364: 
                   7365:             <p>Please take careful consideration before adjusting
1.14      xtraeme  7366:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   7367:             "replaceable"><code>pkg</code></em></code> as we don't
                   7368:             want to cause unneeded package deletions and rebuilds.
                   7369:             In many cases, new versions of packages work just fine
                   7370:             with older dependencies. See <a href="#dependencies"
1.25      rillig   7371:             title="13.1.3.&nbsp;Handling dependencies">Section
                   7372:             13.1.3, &#8220;Handling dependencies&#8221;</a> and
1.14      xtraeme  7373:             <a href="#buildlink" title=
1.25      rillig   7374:             "Chapter&nbsp;10.&nbsp;Buildlink methodology">Chapter
                   7375:             10, <i>Buildlink methodology</i></a> for more
                   7376:             information about dependencies on other packages,
                   7377:             including the <code class=
                   7378:             "varname">BUILDLINK_RECOMMENDED</code> and <code class=
                   7379:             "varname">RECOMMENDED</code> definitions.</p>
1.1       grant    7380:           </div>
                   7381:         </div>
                   7382: 
                   7383:         <div class="sect1" lang="en" xml:lang="en">
                   7384:           <div class="titlepage">
                   7385:             <div>
                   7386:               <div>
                   7387:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   7388:                 "id2630245" id="id2630245"></a>10.3.&nbsp;Writing
1.14      xtraeme  7389:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    7390:               </div>
                   7391:             </div>
                   7392:           </div>
                   7393: 
                   7394:           <p>Some packages in pkgsrc install headers and libraries
                   7395:           that coincide with headers and libraries present in the
1.14      xtraeme  7396:           base system. Aside from a <code class=
                   7397:           "filename">buildlink3.mk</code> file, these packages
                   7398:           should also include a <code class=
                   7399:           "filename">builtin.mk</code> file that includes the
                   7400:           necessary checks to decide whether using the built-in
                   7401:           software or the pkgsrc software is appropriate.</p>
1.1       grant    7402: 
                   7403:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  7404:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    7405: 
                   7406:           <div class="orderedlist">
                   7407:             <ol type="1">
                   7408:               <li>
1.14      xtraeme  7409:                 <p>It should set <code class=
                   7410:                 "varname">USE_BUILTIN.<em class=
                   7411:                 "replaceable"><code>pkg</code></em></code> to
                   7412:                 either &#8220;<span class="quote">yes</span>&#8221;
                   7413:                 or &#8220;<span class="quote">no</span>&#8221;
                   7414:                 after it is included.</p>
1.1       grant    7415:               </li>
                   7416: 
                   7417:               <li>
                   7418:                 <p>It should <span class=
                   7419:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  7420:                 <code class="varname">USE_BUILTIN.<em class=
                   7421:                 "replaceable"><code>pkg</code></em></code> which is
                   7422:                 already set before the <code class=
                   7423:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    7424:               </li>
                   7425: 
                   7426:               <li>
                   7427:                 <p>It should be written to allow multiple
                   7428:                 inclusion. This is <span class=
                   7429:                 "emphasis"><em>very</em></span> important and takes
1.14      xtraeme  7430:                 careful attention to <code class=
                   7431:                 "filename">Makefile</code> coding.</p>
1.1       grant    7432:               </li>
                   7433:             </ol>
                   7434:           </div>
                   7435: 
                   7436:           <div class="sect2" lang="en" xml:lang="en">
                   7437:             <div class="titlepage">
                   7438:               <div>
                   7439:                 <div>
1.27    ! rillig   7440:                   <h3 class="title"><a name="id2630394" id=
        !          7441:                   "id2630394"></a>10.3.1.&nbsp;Anatomy of a
1.14      xtraeme  7442:                   <code class="filename">builtin.mk</code>
                   7443:                   file</h3>
1.1       grant    7444:                 </div>
                   7445:               </div>
                   7446:             </div>
                   7447: 
                   7448:             <p>The following is the recommended template for
                   7449:             builtin.mk files:</p>
                   7450:             <pre class="programlisting">
                   7451: .if !defined(IS_BUILTIN.foo)
                   7452: #
                   7453: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   7454: # genuinely exists in the system or not.
                   7455: #
                   7456: IS_BUILTIN.foo?=        no
                   7457: 
                   7458: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   7459: # version can be determined.
                   7460: #
                   7461: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   7462: BUILTIN_PKG.foo?=       foo-1.0
                   7463: .  endif
                   7464: .endif  # IS_BUILTIN.foo
                   7465: 
                   7466: .if !defined(USE_BUILTIN.foo)
                   7467: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   7468: .  if defined(BUILTIN_PKG.foo)
                   7469: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   7470: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   7471: USE_BUILTIN.foo!=                                                       \
                   7472:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   7473:               ${ECHO} "yes";                                            \
                   7474:       else                                                              \
                   7475:               ${ECHO} "no";                                             \
                   7476:       fi
                   7477: .      endif
                   7478: .    endfor
                   7479: .  endif
                   7480: .endif  # USE_BUILTIN.foo
                   7481: 
                   7482: CHECK_BUILTIN.foo?=     no
                   7483: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   7484: #
                   7485: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   7486: # "yes" or "no".
                   7487: #
                   7488: .endif  # CHECK_BUILTIN.foo
                   7489:       
                   7490: </pre>
                   7491: 
1.14      xtraeme  7492:             <p>The first section sets <code class=
                   7493:             "varname">IS_BUILTIN.<em class=
                   7494:             "replaceable"><code>pkg</code></em></code> depending on
                   7495:             if <em class="replaceable"><code>pkg</code></em> really
                   7496:             exists in the base system. This should not be a base
                   7497:             system software with similar functionality to
                   7498:             <em class="replaceable"><code>pkg</code></em>; it
                   7499:             should only be &#8220;<span class=
                   7500:             "quote">yes</span>&#8221; if the actual package is
                   7501:             included as part of the base system. This variable is
                   7502:             only used internally within the <code class=
                   7503:             "filename">builtin.mk</code> file.</p>
                   7504: 
                   7505:             <p>The second section sets <code class=
                   7506:             "varname">BUILTIN_PKG.<em class=
                   7507:             "replaceable"><code>pkg</code></em></code> to the
                   7508:             version of <em class=
                   7509:             "replaceable"><code>pkg</code></em> in the base system
                   7510:             if it exists (if <code class=
                   7511:             "varname">IS_BUILTIN.<em class=
                   7512:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    7513:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  7514:             variable is only used internally within the
                   7515:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    7516: 
1.14      xtraeme  7517:             <p>The third section sets <code class=
                   7518:             "varname">USE_BUILTIN.<em class=
                   7519:             "replaceable"><code>pkg</code></em></code> and is
                   7520:             <span class="emphasis"><em>required</em></span> in all
                   7521:             <code class="filename">builtin.mk</code> files. The
                   7522:             code in this section must make the determination
                   7523:             whether the built-in software is adequate to satisfy
                   7524:             the dependencies listed in <code class=
                   7525:             "varname">BUILDLINK_DEPENDS.<em class=
                   7526:             "replaceable"><code>pkg</code></em></code>. This is
                   7527:             typically done by comparing <code class=
                   7528:             "varname">BUILTIN_PKG.<em class=
                   7529:             "replaceable"><code>pkg</code></em></code> against each
                   7530:             of the dependencies in <code class=
                   7531:             "varname">BUILDLINK_DEPENDS.<em class=
                   7532:             "replaceable"><code>pkg</code></em></code>.
                   7533:             <code class="varname">USE_BUILTIN.<em class=
                   7534:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    7535:             "emphasis"><em>must</em></span> be set to the correct
1.14      xtraeme  7536:             value by the end of the <code class=
                   7537:             "filename">builtin.mk</code> file. Note that
                   7538:             <code class="varname">USE_BUILTIN.<em class=
                   7539:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    7540:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  7541:             <code class="varname">IS_BUILTIN.<em class=
                   7542:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    7543:             &#8220;<span class="quote">no</span>&#8221; because we
                   7544:             may make the determination that the built-in version of
                   7545:             the software is similar enough to be used as a
                   7546:             replacement.</p>
                   7547: 
1.14      xtraeme  7548:             <p>The last section is guarded by <code class=
                   7549:             "varname">CHECK_BUILTIN.<em class=
                   7550:             "replaceable"><code>pkg</code></em></code>, and
                   7551:             includes code that uses the value of <code class=
                   7552:             "varname">USE_BUILTIN.<em class=
                   7553:             "replaceable"><code>pkg</code></em></code> set in the
                   7554:             previous section. This typically includes, e.g., adding
1.1       grant    7555:             additional dependency restrictions and listing
1.14      xtraeme  7556:             additional files to symlink into <code class=
                   7557:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   7558:             "varname">BUILDLINK_FILES.<em class=
                   7559:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    7560:           </div>
                   7561: 
                   7562:           <div class="sect2" lang="en" xml:lang="en">
                   7563:             <div class="titlepage">
                   7564:               <div>
                   7565:                 <div>
1.27    ! rillig   7566:                   <h3 class="title"><a name="id2630621" id=
        !          7567:                   "id2630621"></a>10.3.2.&nbsp;Global preferences
1.1       grant    7568:                   for native or pkgsrc software</h3>
                   7569:                 </div>
                   7570:               </div>
                   7571:             </div>
                   7572: 
                   7573:             <p>When building packages, it's possible to choose
                   7574:             whether to set a global preference for using either the
                   7575:             built-in (native) version or the pkgsrc version of
                   7576:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  7577:             setting <code class="varname">PREFER_PKGSRC</code> and
                   7578:             <code class="varname">PREFER_NATIVE</code>. These
                   7579:             variables take values of either &#8220;<span class=
1.1       grant    7580:             "quote">yes</span>&#8221;, &#8220;<span class=
                   7581:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  7582:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   7583:             to use the pkgsrc versions of software, while
                   7584:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   7585:             to use the built-in versions. Preferences are
                   7586:             determined by the most specific instance of the package
                   7587:             in either <code class="varname">PREFER_PKGSRC</code> or
                   7588:             <code class="varname">PREFER_NATIVE</code>. If a
                   7589:             package is specified in neither or in both variables,
                   7590:             then <code class="varname">PREFER_PKGSRC</code> has
                   7591:             precedence over <code class=
                   7592:             "varname">PREFER_NATIVE</code>. For example, to require
                   7593:             using pkgsrc versions of software for all but the most
                   7594:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    7595:             <pre class="programlisting">
                   7596:         PREFER_PKGSRC=  yes
                   7597:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   7598:       
                   7599: </pre>
                   7600: 
                   7601:             <p>A package <span class=
1.14      xtraeme  7602:             "emphasis"><em>must</em></span> have a <code class=
                   7603:             "filename">builtin.mk</code> file to be listed in
                   7604:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   7605:             it is simply ignored in that list.</p>
1.1       grant    7606:           </div>
                   7607:         </div>
                   7608:       </div>
                   7609: 
                   7610:       <div class="chapter" lang="en" xml:lang="en">
                   7611:         <div class="titlepage">
                   7612:           <div>
                   7613:             <div>
                   7614:               <h2 class="title"><a name="options" id=
1.25      rillig   7615:               "options"></a>Chapter&nbsp;11.&nbsp;Options
1.1       grant    7616:               handling</h2>
                   7617:             </div>
                   7618:           </div>
                   7619:         </div>
                   7620: 
                   7621:         <div class="toc">
                   7622:           <p><b>Table of Contents</b></p>
                   7623: 
                   7624:           <dl>
1.27    ! rillig   7625:             <dt><span class="sect1"><a href="#id2630762">11.1.
1.1       grant    7626:             Global default options</a></span></dt>
                   7627: 
1.27    ! rillig   7628:             <dt><span class="sect1"><a href="#id2630777">11.2.
1.14      xtraeme  7629:             Converting packages to use <code class=
                   7630:             "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    7631:           </dl>
                   7632:         </div>
                   7633: 
                   7634:         <p>Many packages have the ability to be built to support
1.14      xtraeme  7635:         different sets of features. <code class=
                   7636:         "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1       grant    7637:         that provides generic handling of those options that
                   7638:         determine different ways in which the packages can be
                   7639:         built. It's possible for the user to specify exactly which
                   7640:         sets of options will be built into a package or to allow a
                   7641:         set of global default options apply.</p>
                   7642: 
                   7643:         <div class="sect1" lang="en" xml:lang="en">
                   7644:           <div class="titlepage">
                   7645:             <div>
                   7646:               <div>
                   7647:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   7648:                 "id2630762" id="id2630762"></a>11.1.&nbsp;Global
1.1       grant    7649:                 default options</h2>
                   7650:               </div>
                   7651:             </div>
                   7652:           </div>
                   7653: 
1.14      xtraeme  7654:           <p>Global default options are listed in <code class=
                   7655:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1       grant    7656:           the options that should be built into every package if
                   7657:           that option is supported. This variable should be set in
1.14      xtraeme  7658:           <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    7659:         </div>
                   7660: 
                   7661:         <div class="sect1" lang="en" xml:lang="en">
                   7662:           <div class="titlepage">
                   7663:             <div>
                   7664:               <div>
                   7665:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   7666:                 "id2630777" id=
        !          7667:                 "id2630777"></a>11.2.&nbsp;Converting packages to
1.14      xtraeme  7668:                 use <code class=
                   7669:                 "filename">bsd.options.mk</code></h2>
1.1       grant    7670:               </div>
                   7671:             </div>
                   7672:           </div>
                   7673: 
1.14      xtraeme  7674:           <p>The following example shows how <code class=
1.27    ! rillig   7675:           "filename">bsd.options.mk</code> should be used by the
        !          7676:           hypothetical ``wibble'' package, either in the package
        !          7677:           <code class="filename">Makefile</code>, or in a file,
        !          7678:           e.g. <code class="filename">options.mk</code>, that is
        !          7679:           included by the main package <code class=
1.14      xtraeme  7680:           "filename">Makefile</code>.</p>
1.1       grant    7681:           <pre class="programlisting">
                   7682: # Global and legacy options
                   7683: PKG_OPTIONS_VAR=        PKG_OPTIONS.wibble
                   7684: PKG_SUPPORTED_OPTIONS=  ldap sasl
1.27    ! rillig   7685: PKG_SUGGESTED_OPTIONS=  sasl
        !          7686: PKG_OPTION_LEGACY_VARS= WIBBLE_USE_OPENLDAP:ldap USE_SASL2:sasl
        !          7687: 
1.1       grant    7688: .include "../../mk/bsd.options.mk"
                   7689: 
                   7690: # Package-specific option-handling
                   7691: 
                   7692: ###
                   7693: ### LDAP support
                   7694: ###
                   7695: .if !empty(PKG_OPTIONS:Mldap)
                   7696: .  include "../../databases/openldap/buildlink3.mk"
                   7697: CONFIGURE_ARGS+=      --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   7698: .endif
                   7699: 
                   7700: ###
                   7701: ### SASL authentication
                   7702: ###
                   7703: .if !empty(PKG_OPTIONS:Msasl)
                   7704: .  include "../../security/cyrus-sasl2/buildlink3.mk"
                   7705: CONFIGURE_ARGS+=        --enable-sasl=${BUILDLINK_PREFIX.sasl}
                   7706: .endif
                   7707:       
                   7708: </pre>
                   7709: 
                   7710:           <p>The first section only exists if you are converting a
                   7711:           package that had its own ad-hoc options handling to use
1.14      xtraeme  7712:           <code class="filename">bsd.options.mk</code>. It converts
1.1       grant    7713:           global or legacy options variables into an equivalent
1.14      xtraeme  7714:           <code class="varname">PKG_OPTIONS.<em class=
                   7715:           "replaceable"><code>pkg</code></em></code> value. These
                   7716:           sections will be removed over time as the old options are
                   7717:           in turn deprecated and removed.</p>
1.1       grant    7718: 
                   7719:           <p>The second section contains the information about
                   7720:           which build options are supported by the package, and any
                   7721:           default options settings if needed.</p>
                   7722: 
                   7723:           <div class="orderedlist">
                   7724:             <ol type="1">
                   7725:               <li>
1.14      xtraeme  7726:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27    ! rillig   7727:                 the name of the <a href=
1.1       grant    7728:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7729:                 <span class="citerefentry"><span class=
1.27    ! rillig   7730:                 "refentrytitle">make</span>(1)</span></a> variable
        !          7731:                 that contains the options the user wishes to
        !          7732:                 select. The recommended value is
        !          7733:                 &#8220;<span class="quote">PKG_OPTIONS.<em class=
1.14      xtraeme  7734:                 "replaceable"><code>pkg</code></em></span>&#8221;
                   7735:                 but any package-specific value may be used. This
1.1       grant    7736:                 variable should be set in a package Makefile.</p>
                   7737:               </li>
                   7738: 
                   7739:               <li>
1.14      xtraeme  7740:                 <p><code class=
                   7741:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
                   7742:                 build options supported by the package. This
                   7743:                 variable should be set in a package Makefile.</p>
1.1       grant    7744:               </li>
                   7745: 
                   7746:               <li>
1.27    ! rillig   7747:                 <p><code class=
        !          7748:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
        !          7749:                 build options which are enabled by default.</p>
        !          7750:               </li>
        !          7751: 
        !          7752:               <li>
1.14      xtraeme  7753:                 <p><code class="varname">${PKG_OPTIONS_VAR}</code>
1.27    ! rillig   7754:                 (the variable named in <code class=
        !          7755:                 "varname">PKG_OPTIONS_VAR</code>) lists the
        !          7756:                 selected build options and overrides any default
        !          7757:                 options given in <code class=
1.14      xtraeme  7758:                 "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1       grant    7759:                 options begin with a &#8220;<span class=
                   7760:                 "quote">-</span>&#8221;, then that option is always
                   7761:                 removed from the selected build options, e.g.</p>
                   7762:                 <pre class="programlisting">
                   7763:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   7764:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   7765:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
                   7766:         # implies PKG_OPTIONS == "kerberos ldap"
                   7767:           
                   7768: </pre>
                   7769: 
                   7770:                 <p>or</p>
                   7771:                 <pre class="programlisting">
                   7772:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   7773:         WIBBLE_OPTIONS=         kerberos -ldap ldap
                   7774:         # implies PKG_OPTIONS == "kerberos"
                   7775:           
                   7776: </pre>
                   7777: 
1.14      xtraeme  7778:                 <p>This variable should be set in <code class=
                   7779:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    7780:               </li>
                   7781:             </ol>
                   7782:           </div>
                   7783: 
                   7784:           <p>After the inclusion of bsd.options.mk, the following
                   7785:           variables are set:</p>
                   7786: 
                   7787:           <div class="itemizedlist">
                   7788:             <ul type="disc">
                   7789:               <li>
1.14      xtraeme  7790:                 <p><code class="varname">PKG_OPTIONS</code>
                   7791:                 contains the list of the selected build options,
                   7792:                 properly filtered to remove unsupported and
                   7793:                 duplicate options.</p>
1.1       grant    7794:               </li>
                   7795:             </ul>
                   7796:           </div>
                   7797: 
                   7798:           <p>The remaining sections contain the logic that is
                   7799:           specific to each option. There should be a check for
1.14      xtraeme  7800:           every option listed in <code class=
                   7801:           "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
                   7802:           be clear documentation on what turning on the option will
                   7803:           do in the comments preceding each section. The correct
                   7804:           way to check for an option is to check whether it is
                   7805:           listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1       grant    7806:         </div>
                   7807:       </div>
                   7808: 
                   7809:       <div class="chapter" lang="en" xml:lang="en">
                   7810:         <div class="titlepage">
                   7811:           <div>
                   7812:             <div>
                   7813:               <h2 class="title"><a name="build" id=
1.25      rillig   7814:               "build"></a>Chapter&nbsp;12.&nbsp;The build
1.1       grant    7815:               process</h2>
                   7816:             </div>
                   7817:           </div>
                   7818:         </div>
                   7819: 
                   7820:         <div class="toc">
                   7821:           <p><b>Table of Contents</b></p>
                   7822: 
                   7823:           <dl>
1.25      rillig   7824:             <dt><span class="sect1"><a href="#build.prefix">12.1.
1.1       grant    7825:             Program location</a></span></dt>
                   7826: 
1.27    ! rillig   7827:             <dt><span class="sect1"><a href="#id2631337">12.2. Main
1.1       grant    7828:             targets</a></span></dt>
                   7829: 
                   7830:             <dt><span class="sect1"><a href=
1.25      rillig   7831:             "#build.helpful-targets">12.3. Other helpful
1.1       grant    7832:             targets</a></span></dt>
                   7833:           </dl>
                   7834:         </div>
                   7835: 
                   7836:         <p>The basic steps for building a program are always the
                   7837:         same. First the program's source (<span class=
                   7838:         "emphasis"><em>distfile</em></span>) must be brought to the
                   7839:         local system and then extracted. After any patches to
                   7840:         compile properly on NetBSD are applied, the software can be
                   7841:         configured, then built (usually by compiling), and finally
                   7842:         the generated binaries, etc. can be put into place on the
                   7843:         system. These are exactly the steps performed by the NetBSD
                   7844:         package system, which is implemented as a series of targets
1.14      xtraeme  7845:         in a central Makefile, <code class=
                   7846:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    7847: 
                   7848:         <div class="sect1" lang="en" xml:lang="en">
                   7849:           <div class="titlepage">
                   7850:             <div>
                   7851:               <div>
                   7852:                 <h2 class="title" style="clear: both"><a name=
                   7853:                 "build.prefix" id=
1.25      rillig   7854:                 "build.prefix"></a>12.1.&nbsp;Program location</h2>
1.1       grant    7855:               </div>
                   7856:             </div>
                   7857:           </div>
                   7858: 
                   7859:           <p>Before outlining the process performed by the NetBSD
                   7860:           package system in the next section, here's a brief
                   7861:           discussion on where programs are installed, and which
                   7862:           variables influence this.</p>
                   7863: 
1.14      xtraeme  7864:           <p>The automatic variable <code class=
                   7865:           "varname">PREFIX</code> indicates where all files of the
                   7866:           final program shall be installed. It is usually set to
                   7867:           <code class="varname">LOCALBASE</code> (<code class=
                   7868:           "filename">/usr/pkg</code>), or <code class=
                   7869:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    7870:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  7871:           The value of <code class="varname">PREFIX</code> needs to
                   7872:           be put into the various places in the program's source
                   7873:           where paths to these files are encoded. See <a href=
1.1       grant    7874:           "#components.patches" title=
1.27    ! rillig   7875:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
1.1       grant    7876:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   7877:           title=
1.25      rillig   7878:           "13.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;13.3.1,
1.1       grant    7879:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   7880:           details.</p>
                   7881: 
                   7882:           <p>When choosing which of these variables to use, follow
                   7883:           the following rules:</p>
                   7884: 
                   7885:           <div class="itemizedlist">
                   7886:             <ul type="disc">
                   7887:               <li>
1.14      xtraeme  7888:                 <p><code class="varname">PREFIX</code> always
                   7889:                 points to the location where the current pkg will
                   7890:                 be installed. When referring to a pkg's own
1.1       grant    7891:                 installation path, use &#8220;<span class=
                   7892:                 "quote">${PREFIX}</span>&#8221;.</p>
                   7893:               </li>
                   7894: 
                   7895:               <li>
1.14      xtraeme  7896:                 <p><code class="varname">LOCALBASE</code> is where
                   7897:                 all non-X11 pkgs are installed. If you need to
1.1       grant    7898:                 construct a -I or -L argument to the compiler to
                   7899:                 find includes and libraries installed by another
                   7900:                 non-X11 pkg, use &#8220;<span class=
                   7901:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   7902:               </li>
                   7903: 
                   7904:               <li>
1.14      xtraeme  7905:                 <p><code class="varname">X11BASE</code> is where
                   7906:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    7907:                 installed. When looking for <span class=
                   7908:                 "emphasis"><em>standard</em></span> X11 includes
                   7909:                 (not those installed by a pkg), use
                   7910:                 &#8220;<span class=
                   7911:                 "quote">${X11BASE}</span>&#8221;.</p>
                   7912:               </li>
                   7913: 
                   7914:               <li>
                   7915:                 <p>X11 based are special in that they may be
1.14      xtraeme  7916:                 installed in either <code class=
                   7917:                 "varname">X11BASE</code> or <code class=
                   7918:                 "varname">LOCALBASE</code>.</p>
1.1       grant    7919: 
                   7920:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  7921:                 <code class="varname">LOCALBASE</code> whenever
                   7922:                 possible. Note that you will need to set
                   7923:                 <code class="varname">USE_X11</code> in them to
                   7924:                 request the presence of X11 and to get the right
                   7925:                 compilation flags.</p>
1.1       grant    7926: 
                   7927:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  7928:                 be installed under <code class=
                   7929:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    7930:                 app-defaults files. These packages are special and
1.14      xtraeme  7931:                 they must be placed under <code class=
                   7932:                 "varname">X11BASE</code>. To accomplish this, set
                   7933:                 either <code class="varname">USE_X11BASE</code> or
                   7934:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    7935:                 package.</p>
                   7936: 
1.14      xtraeme  7937:                 <p>Some notes: <code class="varname">USE_X11</code>
                   7938:                 and <code class="varname">USE_X11BASE</code> are
                   7939:                 mutually exclusive. If you need to find includes or
                   7940:                 libraries installed by a pkg that has <code class=
                   7941:                 "varname">USE_IMAKE</code> or <code class=
                   7942:                 "varname">USE_X11BASE</code> in its pkg
                   7943:                 <code class="filename">Makefile</code>, you need to
                   7944:                 use <span class="emphasis"><em>both</em></span>
                   7945:                 <code class="filename">${X11BASE}</code> and
                   7946:                 <code class="filename">${LOCALBASE}</code>. To
                   7947:                 force installation of all X11 packages in
                   7948:                 <code class="varname">LOCALBASE</code>, the
                   7949:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7950:                 href=
1.1       grant    7951:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20      ben      7952:                 class="pkgname">pkgtools/xpkgwedge</a> is enabled
                   7953:                 by default.</p>
1.1       grant    7954:               </li>
                   7955: 
                   7956:               <li>
1.14      xtraeme  7957:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    7958:                 used to refer to the installed location of an X11
1.14      xtraeme  7959:                 package. <code class="varname">X11PREFIX</code>
                   7960:                 will be set to <code class="varname">X11BASE</code>
                   7961:                 if xpkgwedge is not installed, and to <code class=
                   7962:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    7963:                 installed.</p>
                   7964:               </li>
                   7965: 
                   7966:               <li>
                   7967:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  7968:                 have some packages installed in <code class=
                   7969:                 "varname">X11BASE</code> and some in <code class=
                   7970:                 "varname">LOCALBASE</code>. To determine the prefix
                   7971:                 of an installed package, the <code class=
                   7972:                 "varname">EVAL_PREFIX</code> definition can be
                   7973:                 used. It takes pairs in the format
                   7974:                 &#8220;<span class=
1.1       grant    7975:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      7976:                 the <a href=
                   7977:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7978:                 <span class="citerefentry"><span class=
                   7979:                 "refentrytitle">make</span>(1)</span></a> variable
                   7980:                 <code class="varname">DIRNAME</code> will be set to
                   7981:                 the prefix of the installed package
                   7982:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    7983:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   7984:                 is not installed.</p>
                   7985: 
                   7986:                 <p>This is best illustrated by example.</p>
                   7987: 
1.14      xtraeme  7988:                 <p>The following lines are taken from <code class=
                   7989:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    7990:                 <pre class="programlisting">
1.14      xtraeme  7991: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    7992: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   7993:                         --with-gtk-prefix="${GTKDIR}"           \
                   7994:                         --enable-multibyte
                   7995: </pre>
                   7996: 
                   7997:                 <p>Specific defaults can be defined for the
1.14      xtraeme  7998:                 packages evaluated using <code class=
                   7999:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    8000:                 of the form:</p>
                   8001:                 <pre class="programlisting">
                   8002: GTKDIR_DEFAULT= ${LOCALBASE}
                   8003: </pre>
                   8004: 
1.14      xtraeme  8005:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    8006:                 corresponds to the first definition in the
1.14      xtraeme  8007:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    8008:               </li>
                   8009: 
                   8010:               <li>
1.14      xtraeme  8011:                 <p>Within <code class="filename">${PREFIX}</code>,
1.24      wiz      8012:                 packages should install files according to <a href=
                   8013:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   8014:                 <span class="citerefentry"><span class=
                   8015:                 "refentrytitle">hier</span>(7)</span></a>, with the
                   8016:                 exception that manual pages go into <code class=
                   8017:                 "filename">${PREFIX}/man</code>, not <code class=
1.14      xtraeme  8018:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    8019:               </li>
                   8020:             </ul>
                   8021:           </div>
                   8022:         </div>
                   8023: 
                   8024:         <div class="sect1" lang="en" xml:lang="en">
                   8025:           <div class="titlepage">
                   8026:             <div>
                   8027:               <div>
                   8028:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   8029:                 "id2631337" id="id2631337"></a>12.2.&nbsp;Main
1.1       grant    8030:                 targets</h2>
                   8031:               </div>
                   8032:             </div>
                   8033:           </div>
                   8034: 
                   8035:           <p>The main targets used during the build process defined
1.14      xtraeme  8036:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    8037: 
                   8038:           <div class="variablelist">
                   8039:             <dl>
                   8040:               <dt><span class="term">fetch</span></dt>
                   8041: 
                   8042:               <dd>
                   8043:                 <p>This will check if the file(s) given in the
1.14      xtraeme  8044:                 variables <code class="varname">DISTFILES</code>
                   8045:                 and <code class="varname">PATCHFILES</code> (as
                   8046:                 defined in the package's Makefile) are present on
                   8047:                 the local system in <code class=
                   8048:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   8049:                 are not present, an attempt will be made to fetch
                   8050:                 them using commands of the form:</p>
1.1       grant    8051:                 <pre class="programlisting">
                   8052: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   8053: </pre>
                   8054: 
                   8055:                 <p>where ${site} varies through several
1.14      xtraeme  8056:                 possibilities in turn: first, <code class=
                   8057:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   8058:                 then the sites specified in either <code class=
                   8059:                 "varname">SITES_file</code> if defined, else
                   8060:                 <code class="varname">MASTER_SITES</code> or
                   8061:                 <code class="varname">PATCH_SITES</code>, as
                   8062:                 applies, then finally the value of <code class=
                   8063:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   8064:                 all except the first can be optionally sorted by
                   8065:                 the user, via setting either <code class=
                   8066:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   8067:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    8068:               </dd>
                   8069: 
                   8070:               <dt><span class="term">checksum</span></dt>
                   8071: 
                   8072:               <dd>
                   8073:                 <p>After the distfile(s) are fetched, their
                   8074:                 checksum is generated and compared with the
                   8075:                 checksums stored in the distinfo file. If the
                   8076:                 checksums don't match, the build is aborted. This
                   8077:                 is to ensure the same distfile is used for
                   8078:                 building, and that the distfile wasn't changed,
                   8079:                 e.g. by some malign force, deliberately changed
                   8080:                 distfiles on the master distribution site or
                   8081:                 network lossage.</p>
                   8082:               </dd>
                   8083: 
                   8084:               <dt><span class="term">extract</span></dt>
                   8085: 
                   8086:               <dd>
                   8087:                 <p>When the distfiles are present on the local
                   8088:                 system, they need to be extracted, as they are
                   8089:                 usually in the form of some compressed archive
1.14      xtraeme  8090:                 format, most commonly <code class=
                   8091:                 "filename">.tar.gz</code>.</p>
1.1       grant    8092: 
                   8093:                 <p>If only some of the distfiles need to be
                   8094:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  8095:                 be put into <code class=
                   8096:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    8097: 
1.14      xtraeme  8098:                 <p>If the distfiles are not in <code class=
                   8099:                 "filename">.tar.gz</code> format, they can be
                   8100:                 extracted by setting either <code class=
                   8101:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   8102:                 "varname">EXTRACT_CMD</code>, <code class=
                   8103:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   8104:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   8105:                 the former case, pkgsrc knows how to extract a
                   8106:                 number of suffixes (<code class=
                   8107:                 "filename">.tar.gz</code>, <code class=
                   8108:                 "filename">.tgz</code>, <code class=
                   8109:                 "filename">.tar.gz2</code>, <code class=
                   8110:                 "filename">.tbz</code>, <code class=
                   8111:                 "filename">.tar.Z</code>, <code class=
                   8112:                 "filename">.tar</code>, <code class=
                   8113:                 "filename">.shar.gz</code>, <code class=
                   8114:                 "filename">.shar.bz2</code>, <code class=
                   8115:                 "filename">.shar.Z</code>, <code class=
                   8116:                 "filename">.shar</code>, <code class=
                   8117:                 "filename">.Z</code>, <code class=
                   8118:                 "filename">.bz2</code> and <code class=
                   8119:                 "filename">.gz</code>; see the definition of the
                   8120:                 various <code class="varname">DECOMPRESS_CMD</code>
                   8121:                 variables <code class="filename">bsd.pkg.mk</code>
                   8122:                 for a complete list). Here's an example on how to
                   8123:                 use the other variables for a program that comes
                   8124:                 with a compressed shell archive whose name ends in
                   8125:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    8126:                 <pre class="programlisting">
                   8127:      EXTRACT_SUFX=   .msg.gz
                   8128:      EXTRACT_CMD=            zcat
                   8129:      EXTRACT_BEFORE_ARGS=
                   8130:      EXTRACT_AFTER_ARGS=     |sh
                   8131: </pre>
                   8132:               </dd>
                   8133: 
                   8134:               <dt><span class="term">patch</span></dt>
                   8135: 
                   8136:               <dd>
                   8137:                 <p>After extraction, all the patches named by the
1.14      xtraeme  8138:                 <code class="varname">PATCHFILES</code>, those
                   8139:                 present in the patches subdirectory of the package
                   8140:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
                   8141:                 <code class=
                   8142:                 "filename">/usr/local/patches/graphics/png</code>)
                   8143:                 are applied. Patchfiles ending in <code class=
                   8144:                 "filename">.Z</code> or <code class=
                   8145:                 "filename">.gz</code> are uncompressed before they
                   8146:                 are applied, files ending in <code class=
                   8147:                 "filename">.orig</code> or <code class=
                   8148:                 "filename">.rej</code> are ignored. Any special
1.24      wiz      8149:                 options to <a href=
                   8150:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   8151:                 <span class="citerefentry"><span class=
                   8152:                 "refentrytitle">patch</span>(1)</span></a> can be
                   8153:                 handed in <code class=
1.14      xtraeme  8154:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   8155:                 "#components.patches" title=
1.27    ! rillig   8156:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
1.1       grant    8157:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   8158: 
1.24      wiz      8159:                 <p>By default <a href=
                   8160:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   8161:                 <span class="citerefentry"><span class=
                   8162:                 "refentrytitle">patch</span>(1)</span></a> is given
                   8163:                 special args to make it fail if the patches apply
                   8164:                 with some lines of fuzz. Please fix (regen) the
                   8165:                 patches so that they apply cleanly. The rationale
                   8166:                 behind this is that patches that don't apply
                   8167:                 cleanly may end up being applied in the wrong
                   8168:                 place, and cause severe harm there.</p>
1.1       grant    8169:               </dd>
                   8170: 
                   8171:               <dt><span class="term">configure</span></dt>
                   8172: 
                   8173:               <dd>
                   8174:                 <p>Most pieces of software need information on the
                   8175:                 header files, system calls, and library routines
                   8176:                 which are available in NetBSD. This is the process
                   8177:                 known as configuration, and is usually automated.
                   8178:                 In most cases, a script is supplied with the
                   8179:                 source, and its invocation results in generation of
                   8180:                 header files, Makefiles, etc.</p>
                   8181: 
                   8182:                 <p>If the program's distfile contains its own
                   8183:                 configure script, this can be invoked by setting
1.14      xtraeme  8184:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    8185:                 configure script is a GNU autoconf script,
1.14      xtraeme  8186:                 <code class="varname">GNU_CONFIGURE</code> should
                   8187:                 be specified instead. In either case, any arguments
                   8188:                 to the configure script can be specified in the
                   8189:                 <code class="varname">CONFIGURE_ARGS</code>
                   8190:                 variable, and the configure script's name can be
                   8191:                 set in <code class=
                   8192:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   8193:                 from the default &#8220;<span class=
1.1       grant    8194:                 "quote">configure</span>&#8221;. Here's an example
                   8195:                 from the <a xmlns=
                   8196:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8197:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20      ben      8198:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    8199:                 <pre class="programlisting">
                   8200: HAS_CONFIGURE=          yes
                   8201: CONFIGURE_SCRIPT=       Configure
                   8202: CONFIGURE_ARGS+=        netbsd13
                   8203: </pre>
                   8204: 
                   8205:                 <p>If the program uses an Imakefile for
                   8206:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  8207:                 by setting <code class="varname">USE_IMAKE</code>
                   8208:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   8209:                 (If you only want the package installed in
                   8210:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   8211:                 not being run, set <code class=
                   8212:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    8213:               </dd>
                   8214: 
                   8215:               <dt><span class="term">build</span></dt>
                   8216: 
                   8217:               <dd>
                   8218:                 <p>Once configuration has taken place, the software
1.14      xtraeme  8219:                 will be built by invoking <code class=
                   8220:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   8221:                 "varname">$MAKEFILE</code> with <code class=
                   8222:                 "varname">$BUILD_TARGET</code> as the target to
                   8223:                 build. The default <code class=
                   8224:                 "varname">MAKE_PROGRAM</code> is
                   8225:                 &#8220;<span class="quote">gmake</span>&#8221; if
                   8226:                 <code class="varname">USE_GNU_TOOLS</code> contains
1.7       wiz      8227:                 &#8220;<span class="quote">make</span>&#8221;,
1.1       grant    8228:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  8229:                 otherwise. <code class="varname">MAKEFILE</code> is
                   8230:                 set to &#8220;<span class=
1.1       grant    8231:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  8232:                 <code class="varname">BUILD_TARGET</code> defaults
                   8233:                 to &#8220;<span class="quote">all</span>&#8221;.
                   8234:                 Any of these variables can be set in the package's
1.1       grant    8235:                 Makefile to change the default build process.</p>
                   8236:               </dd>
                   8237: 
                   8238:               <dt><span class="term">install</span></dt>
                   8239: 
                   8240:               <dd>
                   8241:                 <p>Once the build stage has completed, the final
                   8242:                 step is to install the software in public
                   8243:                 directories, so users can access the programs and
1.14      xtraeme  8244:                 files. As in the build-target, <code class=
                   8245:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   8246:                 <code class="varname">$MAKEFILE</code> here, but
                   8247:                 with the <code class=
                   8248:                 "varname">$INSTALL_TARGET</code> instead, the
                   8249:                 latter defaulting to &#8220;<span class=
                   8250:                 "quote">install</span>&#8221; (plus
                   8251:                 &#8220;<span class=
                   8252:                 "quote">install.man</span>&#8221;, if <code class=
                   8253:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    8254:               </dd>
                   8255:             </dl>
                   8256:           </div>
                   8257: 
                   8258:           <p>If no target is specified, the default is
                   8259:           &#8220;<span class="quote">build</span>&#8221;. If a
                   8260:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  8261:           e.g. <span><strong class="command">make
                   8262:           build</strong></span> will also perform the equivalent
                   8263:           of:</p>
1.1       grant    8264:           <pre class="programlisting">
                   8265: make fetch
                   8266: make checksum
                   8267: make extract
                   8268: make patch
                   8269: make configure
                   8270: make build
                   8271: </pre>
                   8272:         </div>
                   8273: 
                   8274:         <div class="sect1" lang="en" xml:lang="en">
                   8275:           <div class="titlepage">
                   8276:             <div>
                   8277:               <div>
                   8278:                 <h2 class="title" style="clear: both"><a name=
                   8279:                 "build.helpful-targets" id=
1.25      rillig   8280:                 "build.helpful-targets"></a>12.3.&nbsp;Other
1.1       grant    8281:                 helpful targets</h2>
                   8282:               </div>
                   8283:             </div>
                   8284:           </div>
                   8285: 
                   8286:           <div class="variablelist">
                   8287:             <dl>
                   8288:               <dt><span class="term">pre/post-*</span></dt>
                   8289: 
                   8290:               <dd>
                   8291:                 <p>For any of the main targets described in the
                   8292:                 previous section, two auxiliary targets exist with
                   8293:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   8294:                 &#8220;<span class="quote">post-</span>&#8221; used
                   8295:                 as a prefix for the main target's name. These
                   8296:                 targets are invoked before and after the main
                   8297:                 target is called, allowing extra configuration or
                   8298:                 installation steps be performed from a package's
                   8299:                 Makefile, for example, which a program's configure
                   8300:                 script or install target omitted.</p>
                   8301:               </dd>
                   8302: 
                   8303:               <dt><span class="term">do-*</span></dt>
                   8304: 
                   8305:               <dd>
                   8306:                 <p>Should one of the main targets do the wrong
                   8307:                 thing, and should there be no variable to fix this,
                   8308:                 you can redefine it with the do-* target. (Note
                   8309:                 that redefining the target itself instead of the
                   8310:                 do-* target is a bad idea, as the pre-* and post-*
                   8311:                 targets won't be called anymore, etc.) You will not
                   8312:                 usually need to do this.</p>
                   8313:               </dd>
                   8314: 
                   8315:               <dt><span class="term">reinstall</span></dt>
                   8316: 
                   8317:               <dd>
1.14      xtraeme  8318:                 <p>If you did a <span><strong class="command">make
                   8319:                 install</strong></span> and you noticed some file
                   8320:                 was not installed properly, you can repeat the
1.1       grant    8321:                 installation with this target, which will ignore
                   8322:                 the &#8220;<span class="quote">already
                   8323:                 installed</span>&#8221; flag.</p>
                   8324:               </dd>
                   8325: 
                   8326:               <dt><span class="term">deinstall</span></dt>
                   8327: 
                   8328:               <dd>
1.24      wiz      8329:                 <p>This target does a <a href=
                   8330:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8331:                 <span class="citerefentry"><span class=
                   8332:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   8333:                 the current directory, effectively de-installing
                   8334:                 the package. The following variables can be used to
                   8335:                 tune the behaviour:</p>
1.1       grant    8336: 
                   8337:                 <div class="variablelist">
                   8338:                   <dl>
1.14      xtraeme  8339:                     <dt><span class="term"><code class=
                   8340:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    8341: 
                   8342:                     <dd>
                   8343:                       <p>Add a "-v" to the <a href=
                   8344:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8345:                       <span class="citerefentry"><span class=
                   8346:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   8347:                       command.</p>
                   8348:                     </dd>
                   8349: 
1.14      xtraeme  8350:                     <dt><span class="term"><code class=
                   8351:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    8352: 
                   8353:                     <dd>
                   8354:                       <p>Remove all packages that require (depend
                   8355:                       on) the given package. This can be used to
                   8356:                       remove any packages that may have been pulled
                   8357:                       in by a given package, e.g. if
1.14      xtraeme  8358:                       <span><strong class="command">make deinstall
                   8359:                       DEINSTALLDEPENDS=1</strong></span> is done in
                   8360:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    8361:                       this is likely to remove whole KDE. Works by
                   8362:                       adding &#8220;<span class=
                   8363:                       "quote">-R</span>&#8221; to the <a href=
                   8364:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8365:                       <span class="citerefentry"><span class=
                   8366:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   8367:                       command line.</p>
                   8368:                     </dd>
                   8369:                   </dl>
                   8370:                 </div>
                   8371:               </dd>
                   8372: 
                   8373:               <dt><span class="term">update</span></dt>
                   8374: 
                   8375:               <dd>
                   8376:                 <p>This target causes the current package to be
                   8377:                 updated to the latest version. The package and all
                   8378:                 depending packages first get de-installed, then
                   8379:                 current versions of the corresponding packages get
                   8380:                 compiled and installed. This is similar to manually
                   8381:                 noting which packages are currently installed, then
1.14      xtraeme  8382:                 performing a series of <span><strong class=
                   8383:                 "command">make deinstall</strong></span> and
                   8384:                 <span><strong class="command">make
                   8385:                 install</strong></span> (or whatever <code class=
                   8386:                 "varname">UPDATE_TARGET</code> is set to) for these
                   8387:                 packages.</p>
1.1       grant    8388: 
                   8389:                 <p>You can use the &#8220;<span class=
                   8390:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  8391:                 package updating in case a previous
                   8392:                 <span><strong class="command">make
                   8393:                 update</strong></span> was interrupted for some
                   8394:                 reason. However, in this case, make sure you don't
                   8395:                 call <span><strong class="command">make
                   8396:                 clean</strong></span> or otherwise remove the list
                   8397:                 of dependent packages in <code class=
                   8398:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    8399:                 ability to automatically update the current package
                   8400:                 along with the dependent packages you have
                   8401:                 installed.</p>
                   8402: 
1.14      xtraeme  8403:                 <p>Resuming an interrupted <span><strong class=
                   8404:                 "command">make update</strong></span> will only
                   8405:                 work as long as the package tree remains unchanged.
                   8406:                 If the source code for one of the packages to be
                   8407:                 updated has been changed, resuming
                   8408:                 <span><strong class="command">make
                   8409:                 update</strong></span> will most certainly
                   8410:                 fail!</p>
1.1       grant    8411: 
                   8412:                 <p>The following variables can be used either on
1.14      xtraeme  8413:                 the command line or in <code class=
                   8414:                 "filename">/etc/mk.conf</code> to alter the
                   8415:                 behaviour of <span><strong class="command">make
                   8416:                 update</strong></span>:</p>
1.1       grant    8417: 
                   8418:                 <div class="variablelist">
                   8419:                   <dl>
1.14      xtraeme  8420:                     <dt><span class="term"><code class=
                   8421:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    8422: 
                   8423:                     <dd>
                   8424:                       <p>Install target to recursively use for the
                   8425:                       updated package and the dependent packages.
1.14      xtraeme  8426:                       Defaults to <code class=
                   8427:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    8428:                       &#8220;<span class=
                   8429:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  8430:                       <span><strong class="command">make
                   8431:                       update</strong></span>. e.g.
                   8432:                       <span><strong class="command">make update
                   8433:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    8434:                     </dd>
                   8435: 
1.14      xtraeme  8436:                     <dt><span class="term"><code class=
                   8437:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    8438: 
                   8439:                     <dd>
                   8440:                       <p>Don't clean up after updating. Useful if
                   8441:                       you want to leave the work sources of the
                   8442:                       updated packages around for inspection or
                   8443:                       other purposes. Be sure you eventually clean
                   8444:                       up the source tree (see the
                   8445:                       &#8220;<span class=
                   8446:                       "quote">clean-update</span>&#8221; target
                   8447:                       below) or you may run into troubles with old
                   8448:                       source code still lying around on your next
1.14      xtraeme  8449:                       <span><strong class=
                   8450:                       "command">make</strong></span> or
                   8451:                       <span><strong class="command">make
                   8452:                       update</strong></span>.</p>
1.1       grant    8453:                     </dd>
                   8454: 
1.14      xtraeme  8455:                     <dt><span class="term"><code class=
                   8456:                     "varname">REINSTALL</code></span></dt>
1.1       grant    8457: 
                   8458:                     <dd>
                   8459:                       <p>Deinstall each package before installing
1.14      xtraeme  8460:                       (making <code class=
                   8461:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    8462:                       necessary if the &#8220;<span class=
                   8463:                       "quote">clean-update</span>&#8221; target
                   8464:                       (see below) was called after interrupting a
1.14      xtraeme  8465:                       running <span><strong class="command">make
                   8466:                       update</strong></span>.</p>
1.1       grant    8467:                     </dd>
                   8468: 
1.14      xtraeme  8469:                     <dt><span class="term"><code class=
                   8470:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    8471: 
                   8472:                     <dd>
                   8473:                       <p>Allows you to disable recursion and
                   8474:                       hardcode the target for packages. The default
                   8475:                       is &#8220;<span class=
                   8476:                       "quote">update</span>&#8221; for the update
                   8477:                       target, facilitating a recursive update of
1.14      xtraeme  8478:                       prerequisite packages. Only set <code class=
                   8479:                       "varname">DEPENDS_TARGET</code> if you want
                   8480:                       to disable recursive updates. Use
                   8481:                       <code class="varname">UPDATE_TARGET</code>
                   8482:                       instead to just set a specific target for
                   8483:                       each package to be installed during
                   8484:                       <span><strong class="command">make
                   8485:                       update</strong></span> (see above).</p>
1.1       grant    8486:                     </dd>
                   8487:                   </dl>
                   8488:                 </div>
                   8489:               </dd>
                   8490: 
                   8491:               <dt><span class="term">clean-update</span></dt>
                   8492: 
                   8493:               <dd>
                   8494:                 <p>Clean the source tree for all packages that
1.14      xtraeme  8495:                 would get updated if <span><strong class=
                   8496:                 "command">make update</strong></span> was called
                   8497:                 from the current directory. This target should not
                   8498:                 be used if the current package (or any of its
                   8499:                 depending packages) have already been de-installed
                   8500:                 (e.g., after calling <span><strong class=
                   8501:                 "command">make update</strong></span>) or you may
                   8502:                 lose some packages you intended to update. As a
                   8503:                 rule of thumb: only use this target <span class=
                   8504:                 "emphasis"><em>before</em></span> the first time
                   8505:                 you run <span><strong class="command">make
                   8506:                 update</strong></span> and only if you have a dirty
                   8507:                 package tree (e.g., if you used <code class=
                   8508:                 "varname">NOCLEAN</code>).</p>
1.1       grant    8509: 
                   8510:                 <p>If you unsure about whether your tree is clean
1.14      xtraeme  8511:                 you can either perform a <span><strong class=
                   8512:                 "command">make clean</strong></span> at the top of
                   8513:                 the tree, or use the following sequence of commands
1.1       grant    8514:                 from the directory of the package you want to
                   8515:                 update (<span class=
                   8516:                 "emphasis"><em>before</em></span> running
1.14      xtraeme  8517:                 <span><strong class="command">make
                   8518:                 update</strong></span> for the first time,
                   8519:                 otherwise you lose all the packages you wanted to
                   8520:                 update!):</p>
1.1       grant    8521:                 <pre class="screen">
1.14      xtraeme  8522: <code class="prompt">#</code> <strong class=
                   8523: "userinput"><code>make clean-update</code></strong>
                   8524: <code class="prompt">#</code> <strong class=
                   8525: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   8526: <code class="prompt">#</code> <strong class=
                   8527: "userinput"><code>make update</code></strong>
1.1       grant    8528: </pre>
                   8529: 
                   8530:                 <p>The following variables can be used either on
1.14      xtraeme  8531:                 the command line or in <code class=
                   8532:                 "filename">/etc/mk.conf</code> to alter the
                   8533:                 behaviour of <span><strong class="command">make
                   8534:                 clean-update</strong></span>:</p>
1.1       grant    8535: 
                   8536:                 <div class="variablelist">
                   8537:                   <dl>
1.14      xtraeme  8538:                     <dt><span class="term"><code class=
                   8539:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    8540: 
                   8541:                     <dd>
1.14      xtraeme  8542:                       <p>After <span><strong class="command">make
                   8543:                       clean</strong></span>, do not reconstruct the
                   8544:                       list of directories to update for this
                   8545:                       package. Only use this if
                   8546:                       <span><strong class="command">make
                   8547:                       update</strong></span> successfully installed
                   8548:                       all packages you wanted to update. Normally,
                   8549:                       this is done automatically on
                   8550:                       <span><strong class="command">make
                   8551:                       update</strong></span>, but may have been
                   8552:                       suppressed by the <code class=
                   8553:                       "varname">NOCLEAN</code> variable (see
1.1       grant    8554:                       above).</p>
                   8555:                     </dd>
                   8556:                   </dl>
                   8557:                 </div>
                   8558:               </dd>
                   8559: 
                   8560:               <dt><span class="term">info</span></dt>
                   8561: 
                   8562:               <dd>
                   8563:                 <p>This target invokes <a href=
                   8564:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   8565:                 <span class="citerefentry"><span class=
                   8566:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   8567:                 the current package. You can use this to check
                   8568:                 which version of a package is installed.</p>
                   8569:               </dd>
                   8570: 
                   8571:               <dt><span class="term">readme</span></dt>
                   8572: 
                   8573:               <dd>
1.14      xtraeme  8574:                 <p>This target generates a <code class=
                   8575:                 "filename">README.html</code> file, which can be
1.1       grant    8576:                 viewed using a browser such as <a xmlns=
                   8577:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8578:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20      ben      8579:                 class="pkgname">www/mozilla</a> or <a xmlns=
                   8580:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8581:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
                   8582:                 class="pkgname">www/links</a>. The generated files
                   8583:                 contain references to any packages which are in the
                   8584:                 <code class="varname">PACKAGES</code> directory on
                   8585:                 the local host. The generated files can be made to
                   8586:                 refer to URLs based on <code class=
                   8587:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   8588:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
                   8589:                 wanted to generate <code class=
                   8590:                 "filename">README.html</code> files which pointed
                   8591:                 to binary packages on the local machine, in the
                   8592:                 directory <code class=
                   8593:                 "filename">/usr/packages</code>, set <code class=
                   8594:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   8595:                 and <code class=
                   8596:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   8597:                 <code class="varname">${PACKAGES}</code> directory
                   8598:                 and its subdirectories will be searched for all the
                   8599:                 binary packages.</p>
1.1       grant    8600:               </dd>
                   8601: 
                   8602:               <dt><span class="term">readme-all</span></dt>
                   8603: 
                   8604:               <dd>
1.14      xtraeme  8605:                 <p>Use this target to create a file <code class=
                   8606:                 "filename">README-all.html</code> which contains a
1.1       grant    8607:                 list of all packages currently available in the
                   8608:                 NetBSD Packages Collection, together with the
                   8609:                 category they belong to and a short description.
1.14      xtraeme  8610:                 This file is compiled from the <code class=
                   8611:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    8612:                 sure to run this <span class=
1.14      xtraeme  8613:                 "emphasis"><em>after</em></span> a
                   8614:                 <span><strong class="command">make
                   8615:                 readme</strong></span>.</p>
1.1       grant    8616:               </dd>
                   8617: 
                   8618:               <dt><span class="term">cdrom-readme</span></dt>
                   8619: 
                   8620:               <dd>
                   8621:                 <p>This is very much the same as the
                   8622:                 &#8220;<span class="quote">readme</span>&#8221;
                   8623:                 target (see above), but is to be used when
                   8624:                 generating a pkgsrc tree to be written to a CD-ROM.
1.14      xtraeme  8625:                 This target also produces <code class=
                   8626:                 "filename">README.html</code> files, and can be
                   8627:                 made to refer to URLs based on <code class=
                   8628:                 "varname">CDROM_PKG_URL_HOST</code> and
                   8629:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    8630:               </dd>
                   8631: 
                   8632:               <dt><span class="term">show-distfiles</span></dt>
                   8633: 
                   8634:               <dd>
                   8635:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  8636:                 are needed to build the package. (<code class=
                   8637:                 "varname">DISTFILES</code> and <code class=
                   8638:                 "varname">PATCHFILES</code>, but not <code class=
                   8639:                 "filename">patches/*</code>)</p>
1.1       grant    8640:               </dd>
                   8641: 
                   8642:               <dt><span class="term">show-downlevel</span></dt>
                   8643: 
                   8644:               <dd>
                   8645:                 <p>This target shows nothing if the package is not
                   8646:                 installed. If a version of this package is
                   8647:                 installed, but is not the version provided in this
                   8648:                 version of pkgsrc, then a warning message is
                   8649:                 displayed. This target can be used to show which of
                   8650:                 your installed packages are downlevel, and so the
                   8651:                 old versions can be deleted, and the current ones
                   8652:                 added.</p>
                   8653:               </dd>
                   8654: 
                   8655:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   8656: 
                   8657:               <dd>
                   8658:                 <p>This target shows the directory in the pkgsrc
                   8659:                 hierarchy from which the package can be built and
                   8660:                 installed. This may not be the same directory as
                   8661:                 the one from which the package was installed. This
                   8662:                 target is intended to be used by people who may
                   8663:                 wish to upgrade many packages on a single host, and
                   8664:                 can be invoked from the top-level pkgsrc Makefile
                   8665:                 by using the &#8220;<span class=
                   8666:                 "quote">show-host-specific-pkgs</span>&#8221;
                   8667:                 target.</p>
                   8668:               </dd>
                   8669: 
                   8670:               <dt><span class=
                   8671:               "term">show-installed-depends</span></dt>
                   8672: 
                   8673:               <dd>
                   8674:                 <p>This target shows which installed packages match
1.14      xtraeme  8675:                 the current package's <code class=
                   8676:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    8677:                 dependencies are causing build problems.</p>
                   8678:               </dd>
                   8679: 
                   8680:               <dt><span class="term">check-shlibs</span></dt>
                   8681: 
                   8682:               <dd>
                   8683:                 <p>After a package is installed, check all its
                   8684:                 binaries and (on ELF platforms) shared libraries to
                   8685:                 see if they find the shared libs they need. Run by
1.14      xtraeme  8686:                 default if <code class=
                   8687:                 "varname">PKG_DEVELOPER</code> is set in
                   8688:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    8689:               </dd>
                   8690: 
                   8691:               <dt><span class="term">print-PLIST</span></dt>
                   8692: 
                   8693:               <dd>
                   8694:                 <p>After a &#8220;<span class="quote">make
                   8695:                 install</span>&#8221; from a new or upgraded pkg,
                   8696:                 this prints out an attempt to generate a new
1.14      xtraeme  8697:                 <code class="filename">PLIST</code> from a
                   8698:                 <span><strong class="command">find -newer
                   8699:                 work/.extract_done</strong></span>. An attempt is
                   8700:                 made to care for shared libs etc., but it is
1.1       grant    8701:                 <span class="emphasis"><em>strongly</em></span>
                   8702:                 recommended to review the result before putting it
1.14      xtraeme  8703:                 into <code class="filename">PLIST</code>. On
                   8704:                 upgrades, it's useful to diff the output of this
                   8705:                 command against an already existing <code class=
                   8706:                 "filename">PLIST</code> file.</p>
1.1       grant    8707: 
1.24      wiz      8708:                 <p>If the package installs files via <a href=
                   8709:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   8710:                 <span class="citerefentry"><span class=
                   8711:                 "refentrytitle">tar</span>(1)</span></a> or other
                   8712:                 methods that don't update file access times, be
                   8713:                 sure to add these files manually to your
1.14      xtraeme  8714:                 <code class="filename">PLIST</code>, as the
1.1       grant    8715:                 &#8220;<span class="quote">find
                   8716:                 -newer</span>&#8221; command used by this target
                   8717:                 won't catch them!</p>
                   8718: 
                   8719:                 <p>See <a href="#print-PLIST" title=
1.25      rillig   8720:                 "9.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;9.3,
1.14      xtraeme  8721:                 &#8220;Tweaking output of <span><strong class=
                   8722:                 "command">make
                   8723:                 print-PLIST</strong></span>&#8221;</a> for more
                   8724:                 information on this target.</p>
1.1       grant    8725:               </dd>
                   8726: 
                   8727:               <dt><span class="term">bulk-package</span></dt>
                   8728: 
                   8729:               <dd>
                   8730:                 <p>Used to do bulk builds. If an appropriate binary
                   8731:                 package already exists, no action is taken. If not,
                   8732:                 this target will compile, install and package it
1.14      xtraeme  8733:                 (and it's depends, if <code class=
                   8734:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    8735:                 <a href="#binary.configuration" title=
                   8736:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   8737:                 &#8220;Configuration&#8221;</a>. After creating the
                   8738:                 binary package, the sources, the just-installed
                   8739:                 package and it's required packages are removed,
                   8740:                 preserving free disk space.</p>
                   8741: 
                   8742:                 <p><span class="emphasis"><em>Beware that this
                   8743:                 target may deinstall all packages installed on a
                   8744:                 system!</em></span></p>
                   8745:               </dd>
                   8746: 
                   8747:               <dt><span class="term">bulk-install</span></dt>
                   8748: 
                   8749:               <dd>
                   8750:                 <p>Used during bulk-installs to install required
                   8751:                 packages. If an upto-date binary package is
                   8752:                 available, it will be installed via <a href=
                   8753:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   8754:                 <span class="citerefentry"><span class=
                   8755:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  8756:                 not, <span><strong class="command">make
                   8757:                 bulk-package</strong></span> will be executed, but
                   8758:                 the installed binary not be removed.</p>
1.1       grant    8759: 
                   8760:                 <p>A binary package is considered
                   8761:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   8762:                 to be installed via <a href=
                   8763:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   8764:                 <span class="citerefentry"><span class=
                   8765:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   8766:                 if:</p>
                   8767: 
                   8768:                 <div class="itemizedlist">
                   8769:                   <ul type="disc">
                   8770:                     <li>
1.14      xtraeme  8771:                       <p>None of the package's files (<code class=
                   8772:                       "filename">Makefile</code>, ...) were
                   8773:                       modified since it was built.</p>
1.1       grant    8774:                     </li>
                   8775: 
                   8776:                     <li>
                   8777:                       <p>None of the package's required (binary)
                   8778:                       packages were modified since it was
                   8779:                       built.</p>
                   8780:                     </li>
                   8781:                   </ul>
                   8782:                 </div>
                   8783: 
                   8784:                 <p><span class="emphasis"><em>Beware that this
                   8785:                 target may deinstall all packages installed on a
                   8786:                 system!</em></span></p>
                   8787:               </dd>
                   8788:             </dl>
                   8789:           </div>
                   8790:         </div>
                   8791:       </div>
                   8792: 
                   8793:       <div class="chapter" lang="en" xml:lang="en">
                   8794:         <div class="titlepage">
                   8795:           <div>
                   8796:             <div>
                   8797:               <h2 class="title"><a name="fixes" id=
1.25      rillig   8798:               "fixes"></a>Chapter&nbsp;13.&nbsp;Notes on fixes for
1.1       grant    8799:               packages</h2>
                   8800:             </div>
                   8801:           </div>
                   8802:         </div>
                   8803: 
                   8804:         <div class="toc">
                   8805:           <p><b>Table of Contents</b></p>
                   8806: 
                   8807:           <dl>
1.27    ! rillig   8808:             <dt><span class="sect1"><a href="#id2632834">13.1.
1.1       grant    8809:             General operation</a></span></dt>
                   8810: 
                   8811:             <dd>
                   8812:               <dl>
                   8813:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8814:                 "#id2632837">13.1.1. How to pull in variables from
1.1       grant    8815:                 /etc/mk.conf</a></span></dt>
                   8816: 
                   8817:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8818:                 "#id2632920">13.1.2. Restricted
1.1       grant    8819:                 packages</a></span></dt>
                   8820: 
                   8821:                 <dt><span class="sect2"><a href=
1.25      rillig   8822:                 "#dependencies">13.1.3. Handling
1.1       grant    8823:                 dependencies</a></span></dt>
                   8824: 
                   8825:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8826:                 "#id2633373">13.1.4. Handling conflicts with other
1.1       grant    8827:                 packages</a></span></dt>
                   8828: 
                   8829:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8830:                 "#id2633492">13.1.5. Packages that cannot or should
1.1       grant    8831:                 not be built</a></span></dt>
                   8832: 
                   8833:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8834:                 "#id2633517">13.1.6. Packages which should not be
1.1       grant    8835:                 deleted, once installed</a></span></dt>
                   8836: 
                   8837:                 <dt><span class="sect2"><a href=
1.25      rillig   8838:                 "#security-handling">13.1.7. Handling packages with
1.1       grant    8839:                 security problems</a></span></dt>
                   8840: 
                   8841:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8842:                 "#id2633677">13.1.8. How to handle compiler
1.1       grant    8843:                 bugs</a></span></dt>
                   8844: 
                   8845:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8846:                 "#id2633700">13.1.9. How to handle incrementing
1.1       grant    8847:                 versions when fixing an existing
                   8848:                 package</a></span></dt>
                   8849: 
                   8850:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8851:                 "#id2633817">13.1.10. Portability of
1.1       grant    8852:                 packages</a></span></dt>
                   8853:               </dl>
                   8854:             </dd>
                   8855: 
1.27    ! rillig   8856:             <dt><span class="sect1"><a href="#id2633842">13.2.
1.1       grant    8857:             Possible downloading issues</a></span></dt>
                   8858: 
                   8859:             <dd>
                   8860:               <dl>
                   8861:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8862:                 "#id2633845">13.2.1. Packages whose distfiles
1.1       grant    8863:                 aren't available for plain
                   8864:                 downloading</a></span></dt>
                   8865: 
                   8866:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8867:                 "#id2633908">13.2.2. How to handle modified
1.1       grant    8868:                 distfiles with the 'old' name</a></span></dt>
                   8869:               </dl>
                   8870:             </dd>
                   8871: 
1.27    ! rillig   8872:             <dt><span class="sect1"><a href="#id2633920">13.3.
1.1       grant    8873:             Configuration gotchas</a></span></dt>
                   8874: 
                   8875:             <dd>
                   8876:               <dl>
                   8877:                 <dt><span class="sect2"><a href=
1.25      rillig   8878:                 "#fixes.libtool">13.3.1. Shared libraries -
1.1       grant    8879:                 libtool</a></span></dt>
                   8880: 
                   8881:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8882:                 "#id2634285">13.3.2. Using libtool on GNU packages
1.1       grant    8883:                 that already support libtool</a></span></dt>
                   8884: 
                   8885:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8886:                 "#id2634503">13.3.3. GNU
1.1       grant    8887:                 Autoconf/Automake</a></span></dt>
                   8888:               </dl>
                   8889:             </dd>
                   8890: 
1.27    ! rillig   8891:             <dt><span class="sect1"><a href="#id2634616">13.4.
1.1       grant    8892:             Building considerations</a></span></dt>
                   8893: 
                   8894:             <dd>
                   8895:               <dl>
                   8896:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8897:                 "#id2634619">13.4.1. CPP defines</a></span></dt>
1.1       grant    8898:               </dl>
                   8899:             </dd>
                   8900: 
1.27    ! rillig   8901:             <dt><span class="sect1"><a href="#id2634649">13.5.
1.1       grant    8902:             Package specific actions</a></span></dt>
                   8903: 
                   8904:             <dd>
                   8905:               <dl>
                   8906:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8907:                 "#id2634652">13.5.1. Package configuration
1.1       grant    8908:                 files</a></span></dt>
                   8909: 
                   8910:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8911:                 "#id2634755">13.5.2. User
1.2       hubertf  8912:                 interaction</a></span></dt>
1.1       grant    8913: 
                   8914:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8915:                 "#id2634800">13.5.3. Handling
1.1       grant    8916:                 licenses</a></span></dt>
                   8917: 
                   8918:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8919:                 "#id2634951">13.5.4. Creating an account from a
1.1       grant    8920:                 package</a></span></dt>
                   8921: 
                   8922:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8923:                 "#id2635013">13.5.5. Installing score
1.1       grant    8924:                 files</a></span></dt>
                   8925: 
                   8926:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8927:                 "#id2635057">13.5.6. Packages providing login
1.1       grant    8928:                 shells</a></span></dt>
                   8929: 
                   8930:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8931:                 "#id2635114">13.5.7. Packages containing perl
1.1       grant    8932:                 scripts</a></span></dt>
                   8933: 
                   8934:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8935:                 "#id2635132">13.5.8. Packages with hardcoded paths
1.1       grant    8936:                 to other interpreters</a></span></dt>
                   8937: 
                   8938:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8939:                 "#id2635154">13.5.9. Packages installing perl
1.1       grant    8940:                 modules</a></span></dt>
                   8941: 
                   8942:                 <dt><span class="sect2"><a href=
1.25      rillig   8943:                 "#faq.info-files">13.5.10. Packages installing info
1.1       grant    8944:                 files</a></span></dt>
                   8945: 
                   8946:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8947:                 "#id2635510">13.5.11. Packages installing GConf2
1.1       grant    8948:                 data files</a></span></dt>
                   8949: 
                   8950:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8951:                 "#id2635678">13.5.12. Packages installing
1.1       grant    8952:                 scrollkeeper data files</a></span></dt>
                   8953: 
                   8954:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8955:                 "#id2635730">13.5.13. Packages installing X11
1.1       grant    8956:                 fonts</a></span></dt>
                   8957: 
                   8958:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8959:                 "#id2635777">13.5.14. Packages installing GTK2
1.1       grant    8960:                 modules</a></span></dt>
                   8961: 
                   8962:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8963:                 "#id2635846">13.5.15. Packages installing SGML or
1.1       grant    8964:                 XML data</a></span></dt>
                   8965: 
                   8966:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8967:                 "#id2635898">13.5.16. Packages installing
1.1       grant    8968:                 extensions to the MIME database</a></span></dt>
                   8969: 
                   8970:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8971:                 "#id2636037">13.5.17. Packages using
1.1       grant    8972:                 intltool</a></span></dt>
1.18      xtraeme  8973: 
                   8974:                 <dt><span class="sect2"><a href=
1.27    ! rillig   8975:                 "#id2636051">13.5.18. Packages installing startup
1.18      xtraeme  8976:                 scripts</a></span></dt>
1.1       grant    8977:               </dl>
                   8978:             </dd>
                   8979: 
1.27    ! rillig   8980:             <dt><span class="sect1"><a href="#id2636072">13.6.
1.1       grant    8981:             Feedback to the author</a></span></dt>
                   8982:           </dl>
                   8983:         </div>
                   8984: 
                   8985:         <div class="sect1" lang="en" xml:lang="en">
                   8986:           <div class="titlepage">
                   8987:             <div>
                   8988:               <div>
                   8989:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   8990:                 "id2632834" id="id2632834"></a>13.1.&nbsp;General
1.1       grant    8991:                 operation</h2>
                   8992:               </div>
                   8993:             </div>
                   8994:           </div>
                   8995: 
                   8996:           <div class="sect2" lang="en" xml:lang="en">
                   8997:             <div class="titlepage">
                   8998:               <div>
                   8999:                 <div>
1.27    ! rillig   9000:                   <h3 class="title"><a name="id2632837" id=
        !          9001:                   "id2632837"></a>13.1.1.&nbsp;How to pull in
1.1       grant    9002:                   variables from /etc/mk.conf</h3>
                   9003:                 </div>
                   9004:               </div>
                   9005:             </div>
                   9006: 
                   9007:             <p>The problem with package-defined variables that can
1.14      xtraeme  9008:             be overridden via <code class="varname">MAKECONF</code>
                   9009:             or <code class="filename">/etc/mk.conf</code> is that
                   9010:             <a href=
1.1       grant    9011:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   9012:             <span class="citerefentry"><span class=
                   9013:             "refentrytitle">make</span>(1)</span></a> expands a
                   9014:             variable as it is used, but evaluates preprocessor like
                   9015:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  9016:             So, to use any variable (which may be set in
                   9017:             <code class="filename">/etc/mk.conf</code>) in one of
                   9018:             the .if* statements, the file <code class=
                   9019:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    9020:             that .if* statement.</p>
                   9021: 
                   9022:             <p>Rather than have a number of ad-hoc ways of
1.14      xtraeme  9023:             including <code class="filename">/etc/mk.conf</code>,
                   9024:             should it exist, or <code class=
                   9025:             "varname">MAKECONF</code>, should it exist, include the
                   9026:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
                   9027:             file in the package Makefile before any
                   9028:             preprocessor-like .if, .ifdef, or .ifndef
                   9029:             statements:</p>
1.1       grant    9030:             <pre class="programlisting">
                   9031: .include "../../mk/bsd.prefs.mk"
                   9032:     
                   9033:     .if defined(USE_MENUS)
                   9034:       ...
                   9035:     .endif
                   9036: </pre>
                   9037: 
1.14      xtraeme  9038:             <p>If you wish to set the <code class=
                   9039:             "varname">CFLAGS</code> variable in <code class=
                   9040:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    9041:             use:</p>
                   9042:             <pre class="programlisting">
                   9043: CFLAGS+=  -your -flags
                   9044: </pre>
                   9045: 
1.14      xtraeme  9046:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   9047:             without the &#8220;<span class="quote">+</span>&#8221;)
                   9048:             may lead to problems with packages that need to add
                   9049:             their own flags. Also, you may want to take a look at
                   9050:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    9051:             href=
                   9052:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20      ben      9053:             class="pkgname">devel/cpuflags</a> package if you're
                   9054:             interested in optimization for the current CPU.</p>
1.1       grant    9055:           </div>
                   9056: 
                   9057:           <div class="sect2" lang="en" xml:lang="en">
                   9058:             <div class="titlepage">
                   9059:               <div>
                   9060:                 <div>
1.27    ! rillig   9061:                   <h3 class="title"><a name="id2632920" id=
        !          9062:                   "id2632920"></a>13.1.2.&nbsp;Restricted
1.1       grant    9063:                   packages</h3>
                   9064:                 </div>
                   9065:               </div>
                   9066:             </div>
                   9067: 
                   9068:             <p>Some licenses restrict how software may be
                   9069:             re-distributed. In order to satisfy these restrictions,
                   9070:             the package system defines five make variables that can
                   9071:             be set to note these restrictions:</p>
                   9072: 
                   9073:             <div class="itemizedlist">
                   9074:               <ul type="disc">
                   9075:                 <li>
1.14      xtraeme  9076:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    9077: 
                   9078:                   <p>This variable should be set whenever a
                   9079:                   restriction exists (regardless of its kind). Set
                   9080:                   this variable to a string containing the reason
                   9081:                   for the restriction.</p>
                   9082:                 </li>
                   9083: 
                   9084:                 <li>
1.14      xtraeme  9085:                   <p><code class=
                   9086:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    9087: 
                   9088:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  9089:                   variable to <code class=
                   9090:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    9091:                   package may not be included on a CD-ROM.</p>
                   9092:                 </li>
                   9093: 
                   9094:                 <li>
1.14      xtraeme  9095:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    9096: 
                   9097:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  9098:                   Set this variable to <code class=
                   9099:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    9100:                   package may not not be made available on the
                   9101:                   Internet.</p>
                   9102:                 </li>
                   9103: 
                   9104:                 <li>
1.14      xtraeme  9105:                   <p><code class=
                   9106:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    9107: 
                   9108:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  9109:                   this variable to <code class=
                   9110:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    9111:                   of the source code or other distfile(s) is not
                   9112:                   allowed on CD-ROMs.</p>
                   9113:                 </li>
                   9114: 
                   9115:                 <li>
1.14      xtraeme  9116:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    9117: 
                   9118:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  9119:                   variable to <code class=
                   9120:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    9121:                   of the source code or other distfile(s) via the
                   9122:                   Internet is not allowed.</p>
                   9123:                 </li>
                   9124:               </ul>
                   9125:             </div>
                   9126: 
1.14      xtraeme  9127:             <p>Please note that the use of <code class=
                   9128:             "varname">NO_PACKAGE</code>, <code class=
                   9129:             "varname">IGNORE</code>, <code class=
                   9130:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    9131:             variables to denote restrictions is deprecated, because
                   9132:             they unconditionally prevent users from generating
                   9133:             binary packages!</p>
                   9134:           </div>
                   9135: 
                   9136:           <div class="sect2" lang="en" xml:lang="en">
                   9137:             <div class="titlepage">
                   9138:               <div>
                   9139:                 <div>
                   9140:                   <h3 class="title"><a name="dependencies" id=
1.25      rillig   9141:                   "dependencies"></a>13.1.3.&nbsp;Handling
1.1       grant    9142:                   dependencies</h3>
                   9143:                 </div>
                   9144:               </div>
                   9145:             </div>
                   9146: 
                   9147:             <p>Your package may depend on some other package being
                   9148:             present - and there are various ways of expressing this
1.14      xtraeme  9149:             dependency. pkgsrc supports the <code class=
                   9150:             "varname">BUILD_DEPENDS</code> and <code class=
                   9151:             "varname">DEPENDS</code> definitions, as well as
                   9152:             dependencies via <code class=
                   9153:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    9154:             way to handle dependencies, and which uses the
                   9155:             variables named above. See <a href="#buildlink" title=
1.25      rillig   9156:             "Chapter&nbsp;10.&nbsp;Buildlink methodology">Chapter&nbsp;10,
1.1       grant    9157:             <i>Buildlink methodology</i></a> for more
                   9158:             information.</p>
                   9159: 
                   9160:             <p>The basic difference between the two variables is as
1.14      xtraeme  9161:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    9162:             definition registers that pre-requisite in the binary
                   9163:             package so it will be pulled in when the binary package
1.14      xtraeme  9164:             is later installed, whilst the <code class=
                   9165:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    9166:             marking a dependency that is only needed for building
                   9167:             the package.</p>
                   9168: 
                   9169:             <p>This means that if you only need a package present
                   9170:             whilst you are building, it should be noted as a
1.14      xtraeme  9171:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    9172: 
1.14      xtraeme  9173:             <p>The format for a <code class=
                   9174:             "varname">BUILD_DEPENDS</code> and a <code class=
                   9175:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    9176:             <pre class="programlisting">
                   9177: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   9178: </pre>
                   9179: 
                   9180:             <p>Please note that the &#8220;<span class=
                   9181:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  9182:             any of the wildcard version numbers recognized by
1.1       grant    9183:             <a href=
                   9184:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   9185:             <span class="citerefentry"><span class=
                   9186:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   9187: 
                   9188:             <div class="orderedlist">
                   9189:               <ol type="1">
                   9190:                 <li>
                   9191:                   <p>If your package needs another package's
                   9192:                   binaries or libraries to build or run, and if
1.14      xtraeme  9193:                   that package has a <code class=
                   9194:                   "filename">buildlink3.mk</code> file available,
                   9195:                   use it:</p>
1.1       grant    9196:                   <pre class="programlisting">
                   9197:     .include "../../graphics/jpeg/buildlink3.mk"
                   9198:     
                   9199: </pre>
                   9200:                 </li>
                   9201: 
                   9202:                 <li>
                   9203:                   <p>If your package needs to use another package
1.14      xtraeme  9204:                   to build itself and there is no <code class=
                   9205:                   "filename">buildlink3.mk</code> file available,
                   9206:                   use the <code class=
                   9207:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    9208:                   <pre class="programlisting">
                   9209: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   9210: </pre>
                   9211:                 </li>
                   9212: 
                   9213:                 <li>
                   9214:                   <p>If your package needs a library with which to
1.14      xtraeme  9215:                   link and again there is no <code class=
                   9216:                   "filename">buildlink3.mk</code> file available,
                   9217:                   this is specified using the <code class=
                   9218:                   "varname">DEPENDS</code> definition. An example
                   9219:                   of this is the <a xmlns=
1.1       grant    9220:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9221:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      9222:                   class="pkgname">print/lyx</a> package, which uses
                   9223:                   the xpm library, version 3.4j to build:</p>
1.1       grant    9224:                   <pre class="programlisting">
                   9225: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   9226: </pre>
                   9227: 
                   9228:                   <p>You can also use wildcards in package
                   9229:                   dependences:</p>
                   9230:                   <pre class="programlisting">
                   9231: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   9232: </pre>
                   9233: 
                   9234:                   <p>Note that such wildcard dependencies are
                   9235:                   retained when creating binary packages. The
                   9236:                   dependency is checked when installing the binary
                   9237:                   package and any package which matches the pattern
                   9238:                   will be used. Wildcard dependencies should be
                   9239:                   used with care.</p>
                   9240: 
                   9241:                   <p>The &#8220;<span class=
                   9242:                   "quote">-[0-9]*</span>&#8221; should be used
                   9243:                   instead of &#8220;<span class=
                   9244:                   "quote">-*</span>&#8221; to avoid potentially
                   9245:                   ambiguous matches such as &#8220;<span class=
                   9246:                   "quote">tk-postgresql</span>&#8221; matching a
                   9247:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  9248:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    9249: 
                   9250:                   <p>Wildcards can also be used to specify that a
                   9251:                   package will only build against a certain minimum
                   9252:                   version of a pre-requisite:</p>
                   9253:                   <pre class="programlisting">
                   9254: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   9255: </pre>
                   9256: 
                   9257:                   <p>This means that the package will build against
                   9258:                   version 3.5.4 of the tiff library or newer. Such
                   9259:                   a dependency may be warranted if, for example,
                   9260:                   the API of the library has changed with version
                   9261:                   3.5.4 and a package would not compile against an
                   9262:                   earlier version of tiff.</p>
                   9263: 
                   9264:                   <p>Please note that such dependencies should only
                   9265:                   be updated if a package requires a newer
                   9266:                   pre-requisite, but not to denote recommendations
                   9267:                   such as security updates or ABI changes that do
                   9268:                   not prevent a package from building correctly.
                   9269:                   Such recommendations can be expressed using
1.14      xtraeme  9270:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    9271:                   <pre class="programlisting">
                   9272: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   9273: </pre>
                   9274: 
1.14      xtraeme  9275:                   <p>In addition to the above <code class=
                   9276:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    9277:                   while a package will build against
                   9278:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  9279:                   recommended. <code class=
                   9280:                   "varname">RECOMMENDED</code> entries will be
                   9281:                   turned into dependencies unless explicitly
                   9282:                   ignored (in which case a warning will be
                   9283:                   printed). Packages that are built with
1.1       grant    9284:                   recommendations ignored may not be uploaded to
                   9285:                   ftp.NetBSD.org by developers and should not be
                   9286:                   used across different systems that may have
                   9287:                   different versions of binary packages
                   9288:                   installed.</p>
                   9289: 
                   9290:                   <p>For security fixes, please update the package
                   9291:                   vulnerabilities file as well as setting
1.14      xtraeme  9292:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    9293:                   <a href="#security-handling" title=
1.25      rillig   9294:                   "13.1.7.&nbsp;Handling packages with security problems">
                   9295:                   Section 13.1.7, &#8220;Handling packages with
1.1       grant    9296:                   security problems&#8221;</a> for more
                   9297:                   information.</p>
                   9298:                 </li>
                   9299: 
                   9300:                 <li>
                   9301:                   <p>If your package needs some executable to be
1.17      sketch   9302:                   able to run correctly and if there's no
1.14      xtraeme  9303:                   <code class="filename">buildlink3.mk</code> file,
                   9304:                   this is specified using the <code class=
                   9305:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    9306:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9307:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      9308:                   class="pkgname">print/lyx</a> package needs to be
                   9309:                   able to execute the latex binary from the teTeX
                   9310:                   package when it runs, and that is specified:</p>
1.1       grant    9311:                   <pre class="programlisting">
                   9312: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   9313: </pre>
                   9314: 
                   9315:                   <p>The comment about wildcard dependencies from
                   9316:                   previous paragraph applies here, too.</p>
                   9317:                 </li>
                   9318:               </ol>
                   9319:             </div>
                   9320: 
                   9321:             <p>If your package needs files from another package to
                   9322:             build, see the first part of the &#8220;<span class=
                   9323:             "quote">do-configure</span>&#8221; target <a xmlns=
                   9324:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9325:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20      ben      9326:             class="pkgname">print/ghostscript5</a> package (it
                   9327:             relies on the jpeg sources being present in source form
                   9328:             during the build):</p>
1.1       grant    9329:             <pre class="programlisting">
                   9330: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   9331:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   9332:     fi
                   9333: </pre>
                   9334: 
                   9335:             <p>If you build any other packages that way, please
                   9336:             make sure the working files are deleted too when this
                   9337:             package's working files are cleaned up. The easiest way
                   9338:             to do so is by adding a pre-clean target:</p>
                   9339:             <pre class="programlisting">
                   9340: pre-clean:
                   9341:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   9342: </pre>
                   9343: 
1.14      xtraeme  9344:             <p>Please also note the <code class=
                   9345:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   9346:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   9347:             which are provided as convenience definitions. The
1.24      wiz      9348:             former works out whether <a href=
                   9349:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   9350:             <span class="citerefentry"><span class=
                   9351:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   9352:             the base system, and, if it isn't, installs the
                   9353:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9354:             href=
1.1       grant    9355:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20      ben      9356:             class="pkgname">devel/gettext</a> package. The latter
                   9357:             adds a build dependency on either an installed version
                   9358:             of an older gettext package, or if it isn't, installs
                   9359:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9360:             href=
                   9361:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
                   9362:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    9363:           </div>
                   9364: 
                   9365:           <div class="sect2" lang="en" xml:lang="en">
                   9366:             <div class="titlepage">
                   9367:               <div>
                   9368:                 <div>
1.27    ! rillig   9369:                   <h3 class="title"><a name="id2633373" id=
        !          9370:                   "id2633373"></a>13.1.4.&nbsp;Handling conflicts
1.1       grant    9371:                   with other packages</h3>
                   9372:                 </div>
                   9373:               </div>
                   9374:             </div>
                   9375: 
                   9376:             <p>Your package may conflict with other packages a user
                   9377:             might already have installed on his system, e.g. if
                   9378:             your package installs the same set of files like
                   9379:             another package in our pkgsrc tree.</p>
                   9380: 
1.14      xtraeme  9381:             <p>In this case you can set <code class=
                   9382:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    9383:             packages (including version string) your package
                   9384:             conflicts with.</p>
                   9385: 
                   9386:             <p>For example <a xmlns=
                   9387:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9388:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20      ben      9389:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
                   9390:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9391:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
                   9392:             class="pkgname">x11/Xaw-Xpm</a> install provide the
                   9393:             same shared library, thus you set in <code class=
                   9394:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    9395:             <pre class="programlisting">
                   9396: CONFLICTS=      Xaw-Xpm-[0-9]*
                   9397: </pre>
                   9398: 
1.14      xtraeme  9399:             <p>and in <code class=
                   9400:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    9401:             <pre class="programlisting">
                   9402: CONFLICTS=      Xaw3d-[0-9]*
                   9403: </pre>
                   9404: 
                   9405:             <p>Packages will automatically conflict with other
                   9406:             packages with the name prefix and a different version
                   9407:             string. &#8220;<span class=
                   9408:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   9409:             conflict with the older version &#8220;<span class=
                   9410:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   9411:           </div>
                   9412: 
                   9413:           <div class="sect2" lang="en" xml:lang="en">
                   9414:             <div class="titlepage">
                   9415:               <div>
                   9416:                 <div>
1.27    ! rillig   9417:                   <h3 class="title"><a name="id2633492" id=
        !          9418:                   "id2633492"></a>13.1.5.&nbsp;Packages that cannot
1.1       grant    9419:                   or should not be built</h3>
                   9420:                 </div>
                   9421:               </div>
                   9422:             </div>
                   9423: 
                   9424:             <p>There are several reasons why a package might be
                   9425:             instructed to not build under certain circumstances. If
                   9426:             the package builds and runs on most platforms, the
1.14      xtraeme  9427:             exceptions should be noted with <code class=
                   9428:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   9429:             builds and runs on a small handful of platforms, set
                   9430:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
                   9431:             If the package should be skipped (for example, because
                   9432:             it provides functionality already provided by the
                   9433:             system), set <code class=
                   9434:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   9435:             message. If the package should fail because some
                   9436:             preconditions are not met, set <code class=
                   9437:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    9438:             message.</p>
                   9439: 
1.14      xtraeme  9440:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    9441:             because it didn't provide enough information to
                   9442:             determine whether the build should fail.</p>
                   9443:           </div>
                   9444: 
                   9445:           <div class="sect2" lang="en" xml:lang="en">
                   9446:             <div class="titlepage">
                   9447:               <div>
                   9448:                 <div>
1.27    ! rillig   9449:                   <h3 class="title"><a name="id2633517" id=
        !          9450:                   "id2633517"></a>13.1.6.&nbsp;Packages which
1.1       grant    9451:                   should not be deleted, once installed</h3>
                   9452:                 </div>
                   9453:               </div>
                   9454:             </div>
                   9455: 
                   9456:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  9457:             has been installed, the <code class=
                   9458:             "varname">PKG_PRESERVE</code> definition should be set
                   9459:             in the package Makefile. This will be carried into any
1.1       grant    9460:             binary package that is made from this pkgsrc entry. A
                   9461:             &#8220;<span class="quote">preserved</span>&#8221;
                   9462:             package will not be deleted using <a href=
                   9463:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   9464:             <span class="citerefentry"><span class=
                   9465:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   9466:             the &#8220;<span class="quote">-f</span>&#8221; option
                   9467:             is used.</p>
                   9468:           </div>
                   9469: 
                   9470:           <div class="sect2" lang="en" xml:lang="en">
                   9471:             <div class="titlepage">
                   9472:               <div>
                   9473:                 <div>
                   9474:                   <h3 class="title"><a name="security-handling" id=
1.25      rillig   9475:                   "security-handling"></a>13.1.7.&nbsp;Handling
1.1       grant    9476:                   packages with security problems</h3>
                   9477:                 </div>
                   9478:               </div>
                   9479:             </div>
                   9480: 
                   9481:             <p>When a vulnerability is found, this should be noted
1.14      xtraeme  9482:             in <code class=
                   9483:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    9484:             and after the commit of that file, it should be copied
1.14      xtraeme  9485:             to both <code class=
                   9486:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
                   9487:             and <code class=
                   9488:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
                   9489:             on ftp.NetBSD.org using <code class=
                   9490:             "filename">localsrc/security/advisories/Makefile</code>.
                   9491:             In addition, if a <code class=
                   9492:             "filename">buildlink3.mk</code> file exists for an
                   9493:             affected package, bumping <code class=
                   9494:             "varname">PKGREVISION</code> and creating a
                   9495:             corresponding <code class=
                   9496:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   9497:             "replaceable"><code>pkg</code></em></code> entry should
                   9498:             be considered. See <a href="#buildlink" title=
1.25      rillig   9499:             "Chapter&nbsp;10.&nbsp;Buildlink methodology">Chapter&nbsp;10,
1.1       grant    9500:             <i>Buildlink methodology</i></a> for more information
1.14      xtraeme  9501:             about writing <code class=
                   9502:             "filename">buildlink3.mk</code> files and <code class=
                   9503:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    9504: 
                   9505:             <p>Also, if the fix should be applied to the stable
                   9506:             pkgsrc branch, be sure to submit a pullup request!</p>
                   9507:           </div>
                   9508: 
                   9509:           <div class="sect2" lang="en" xml:lang="en">
                   9510:             <div class="titlepage">
                   9511:               <div>
                   9512:                 <div>
1.27    ! rillig   9513:                   <h3 class="title"><a name="id2633677" id=
        !          9514:                   "id2633677"></a>13.1.8.&nbsp;How to handle
1.1       grant    9515:                   compiler bugs</h3>
                   9516:                 </div>
                   9517:               </div>
                   9518:             </div>
                   9519: 
                   9520:             <p>Some source files trigger bugs in the compiler,
                   9521:             based on combinations of compiler version and
                   9522:             architecture and almost always relation to optimisation
                   9523:             being enabled. Common symptoms are gcc internal errors
                   9524:             or never finishing compiling a file.</p>
                   9525: 
                   9526:             <p>Typically a workaround involves testing the
1.14      xtraeme  9527:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    9528:             version, disabling optimisation for that
1.14      xtraeme  9529:             file/<code class="varname">MACHINE_ARCH</code>/compiler
                   9530:             combination, and documenting it in <code class=
                   9531:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    9532:             number of examples!</p>
                   9533:           </div>
                   9534: 
                   9535:           <div class="sect2" lang="en" xml:lang="en">
                   9536:             <div class="titlepage">
                   9537:               <div>
                   9538:                 <div>
1.27    ! rillig   9539:                   <h3 class="title"><a name="id2633700" id=
        !          9540:                   "id2633700"></a>13.1.9.&nbsp;How to handle
1.1       grant    9541:                   incrementing versions when fixing an existing
                   9542:                   package</h3>
                   9543:                 </div>
                   9544:               </div>
                   9545:             </div>
                   9546: 
                   9547:             <p>When making fixes to an existing package it can be
1.14      xtraeme  9548:             useful to change the version number in <code class=
                   9549:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    9550:             future versions by the original author, a
                   9551:             &#8220;<span class="quote">nb1</span>&#8221;,
                   9552:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   9553:             suffix can be used on package versions by setting
1.14      xtraeme  9554:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   9555:             The &#8220;<span class="quote">nb</span>&#8221; is
                   9556:             treated like a &#8220;<span class=
                   9557:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    9558:             <pre class="programlisting">
                   9559:   DISTNAME= foo-17.42
                   9560:     PKGREVISION=  9
                   9561: </pre>
                   9562: 
1.14      xtraeme  9563:             <p>will result in a <code class=
                   9564:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    9565:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   9566: 
                   9567:             <p>When a new release of the package is released, the
1.14      xtraeme  9568:             <code class="varname">PKGREVISION</code> should be
                   9569:             removed. e.g. on a new minor release of the above
                   9570:             package, things should be like:</p>
1.1       grant    9571:             <pre class="programlisting">
                   9572: DISTNAME=   foo-17.43
                   9573: </pre>
                   9574:           </div>
                   9575: 
                   9576:           <div class="sect2" lang="en" xml:lang="en">
                   9577:             <div class="titlepage">
                   9578:               <div>
                   9579:                 <div>
1.27    ! rillig   9580:                   <h3 class="title"><a name="id2633817" id=
        !          9581:                   "id2633817"></a>13.1.10.&nbsp;Portability of
1.1       grant    9582:                   packages</h3>
                   9583:                 </div>
                   9584:               </div>
                   9585:             </div>
                   9586: 
                   9587:             <p>One appealing feature of pkgsrc is that it runs on
                   9588:             many different platforms. As a result, it is important
                   9589:             to ensure, where possible, that packages in pkgsrc are
                   9590:             portable. There are some particular details you should
                   9591:             pay attention to while working on pkgsrc.</p>
                   9592: 
                   9593:             <div class="sect3" lang="en" xml:lang="en">
                   9594:               <div class="titlepage">
                   9595:                 <div>
                   9596:                   <div>
1.27    ! rillig   9597:                     <h4 class="title"><a name="id2633822" id=
        !          9598:                     "id2633822"></a>13.1.10.1.&nbsp;${INSTALL},
1.1       grant    9599:                     ${INSTALL_DATA_DIR}, ...</h4>
                   9600:                   </div>
                   9601:                 </div>
                   9602:               </div>
                   9603: 
1.14      xtraeme  9604:               <p>The BSD-compatible <span><strong class=
                   9605:               "command">install</strong></span> supplied with some
1.1       grant    9606:               operating systems will not perform more than one
                   9607:               operation at a time. As such, you should call
                   9608:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   9609:               etc. like this:</p>
                   9610:               <pre class="programlisting">
                   9611: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   9612: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   9613: </pre>
                   9614:             </div>
                   9615:           </div>
                   9616:         </div>
                   9617: 
                   9618:         <div class="sect1" lang="en" xml:lang="en">
                   9619:           <div class="titlepage">
                   9620:             <div>
                   9621:               <div>
                   9622:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   9623:                 "id2633842" id="id2633842"></a>13.2.&nbsp;Possible
1.1       grant    9624:                 downloading issues</h2>
                   9625:               </div>
                   9626:             </div>
                   9627:           </div>
                   9628: 
                   9629:           <div class="sect2" lang="en" xml:lang="en">
                   9630:             <div class="titlepage">
                   9631:               <div>
                   9632:                 <div>
1.27    ! rillig   9633:                   <h3 class="title"><a name="id2633845" id=
        !          9634:                   "id2633845"></a>13.2.1.&nbsp;Packages whose
1.1       grant    9635:                   distfiles aren't available for plain
                   9636:                   downloading</h3>
                   9637:                 </div>
                   9638:               </div>
                   9639:             </div>
                   9640: 
                   9641:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  9642:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   9643:             and a <span><strong class="command">make
                   9644:             fetch</strong></span> will call <code class=
                   9645:             "filename">files/getsite.sh</code> with the name of
                   9646:             each file to download as an argument, expecting it to
                   9647:             output the URL of the directory from which to download
                   9648:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9649:             href=
1.1       grant    9650:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20      ben      9651:             class="pkgname">graphics/ns-cult3d</a> is an example of
                   9652:             this usage.</p>
1.1       grant    9653: 
                   9654:             <p>If the download can't be automated, because the user
                   9655:             must submit personal information to apply for a
                   9656:             password, or must pay for the source, or whatever, you
1.14      xtraeme  9657:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   9658:             a macro which displays a message explaining the
                   9659:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   9660:             must be executable shell commands, not just a message.
                   9661:             (Generally, it executes <code class=
                   9662:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    9663:             following packages use this: <a xmlns=
                   9664:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9665:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20      ben      9666:             class="pkgname">audio/realplayer</a>, <a xmlns=
                   9667:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9668:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
                   9669:             class="pkgname">cad/simian</a>, <a xmlns=
                   9670:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9671:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
                   9672:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
                   9673:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9674:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
                   9675:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
                   9676:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9677:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
                   9678:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
                   9679:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9680:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
                   9681:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
                   9682:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9683:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
                   9684:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
                   9685:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9686:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
                   9687:             class="pkgname">www/openacs</a>. Try to be consistent
                   9688:             with them.</p>
1.1       grant    9689:           </div>
                   9690: 
                   9691:           <div class="sect2" lang="en" xml:lang="en">
                   9692:             <div class="titlepage">
                   9693:               <div>
                   9694:                 <div>
1.27    ! rillig   9695:                   <h3 class="title"><a name="id2633908" id=
        !          9696:                   "id2633908"></a>13.2.2.&nbsp;How to handle
1.1       grant    9697:                   modified distfiles with the 'old' name</h3>
                   9698:                 </div>
                   9699:               </div>
                   9700:             </div>
                   9701: 
                   9702:             <p>Sometimes authors of a software package make some
                   9703:             modifications after the software was released, and they
                   9704:             put up a new distfile without changing the package's
                   9705:             version number. If a package is already in pkgsrc at
                   9706:             that time, the md5 checksum will no longer match. The
                   9707:             correct way to work around this is to update the
                   9708:             package's md5 checksum to match the package on the
                   9709:             master site (beware, any mirrors may not be up to date
                   9710:             yet!), and to remove the old distfile from
1.14      xtraeme  9711:             ftp.NetBSD.org's <code class=
                   9712:             "filename">/pub/NetBSD/packages/distfiles</code>
1.1       grant    9713:             directory. Furthermore, a mail to the package's author
                   9714:             seems appropriate making sure the distfile was really
                   9715:             updated on purpose, and that no trojan horse or so
                   9716:             crept in.</p>
                   9717:           </div>
                   9718:         </div>
                   9719: 
                   9720:         <div class="sect1" lang="en" xml:lang="en">
                   9721:           <div class="titlepage">
                   9722:             <div>
                   9723:               <div>
                   9724:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   9725:                 "id2633920" id=
        !          9726:                 "id2633920"></a>13.3.&nbsp;Configuration
1.1       grant    9727:                 gotchas</h2>
                   9728:               </div>
                   9729:             </div>
                   9730:           </div>
                   9731: 
                   9732:           <div class="sect2" lang="en" xml:lang="en">
                   9733:             <div class="titlepage">
                   9734:               <div>
                   9735:                 <div>
                   9736:                   <h3 class="title"><a name="fixes.libtool" id=
1.25      rillig   9737:                   "fixes.libtool"></a>13.3.1.&nbsp;Shared libraries
1.1       grant    9738:                   - libtool</h3>
                   9739:                 </div>
                   9740:               </div>
                   9741:             </div>
                   9742: 
                   9743:             <p>pkgsrc supports many different machines, with
                   9744:             different object formats like a.out and ELF, and
                   9745:             varying abilities to do shared library and dynamic
                   9746:             loading at all. To accompany this, varying commands and
                   9747:             options have to be passed to the compiler, linker, etc.
                   9748:             to get the Right Thing, which can be pretty annoying
                   9749:             especially if you don't have all the machines at your
                   9750:             hand to test things. The <a xmlns=
                   9751:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9752:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20      ben      9753:             class="pkgname">devel/libtool</a> pkg can help here, as
                   9754:             it just &#8220;<span class="quote">knows</span>&#8221;
                   9755:             how to build both static and dynamic libraries from a
                   9756:             set of source files, thus being platform
                   9757:             independent.</p>
1.1       grant    9758: 
                   9759:             <p>Here's how to use libtool in a pkg in seven simple
                   9760:             steps:</p>
                   9761: 
                   9762:             <div class="orderedlist">
                   9763:               <ol type="1">
                   9764:                 <li>
1.14      xtraeme  9765:                   <p>Add <code class=
                   9766:                   "varname">USE_LIBTOOL=yes</code> to the package
                   9767:                   Makefile.</p>
1.1       grant    9768:                 </li>
                   9769: 
                   9770:                 <li>
                   9771:                   <p>For library objects, use &#8220;<span class=
                   9772:                   "quote">${LIBTOOL} --mode=compile
                   9773:                   ${CC}</span>&#8221; in place of
                   9774:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   9775:                   You could even add it to the definition of
1.14      xtraeme  9776:                   <code class="varname">CC</code>, if only
                   9777:                   libraries are being built in a given Makefile.
                   9778:                   This one command will build both PIC and non-PIC
                   9779:                   library objects, so you need not have separate
                   9780:                   shared and non-shared library rules.</p>
1.1       grant    9781:                 </li>
                   9782: 
                   9783:                 <li>
                   9784:                   <p>For the linking of the library, remove any
                   9785:                   &#8220;<span class="quote">ar</span>&#8221;,
                   9786:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   9787:                   and &#8220;<span class="quote">ld
                   9788:                   -Bshareable</span>&#8221; commands, and instead
                   9789:                   use:</p>
                   9790:                   <pre class="programlisting">
                   9791: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   9792: </pre>
                   9793: 
                   9794:                   <p>Note that the library is changed to have a
1.14      xtraeme  9795:                   <code class="filename">.la</code> extension, and
                   9796:                   the objects are changed to have a <code class=
                   9797:                   "filename">.lo</code> extension. Change
                   9798:                   <code class="varname">OBJS</code> as necessary.
                   9799:                   This automatically creates all of the
                   9800:                   <code class="filename">.a</code>, <code class=
                   9801:                   "filename">.so.major.minor</code>, and ELF
                   9802:                   symlinks (if necessary) in the build directory.
                   9803:                   Be sure to include &#8220;<span class=
1.1       grant    9804:                   "quote">-version-info</span>&#8221;, especially
                   9805:                   when major and minor are zero, as libtool will
                   9806:                   otherwise strip off the shared library
                   9807:                   version.</p>
                   9808: 
                   9809:                   <p>From the libtool manual:</p>
                   9810:                   <pre class="programlisting">
                   9811:      So, libtool library versions are described by three integers:
                   9812: 
                   9813: CURRENT
                   9814:        The most recent interface number that this library implements.
                   9815: 
                   9816: REVISION
                   9817:        The implementation number of the CURRENT interface.
                   9818: 
                   9819: AGE
                   9820:        The difference between the newest and oldest interfaces that this
                   9821:        library implements.  In other words, the library implements all the
                   9822:        interface numbers in the range from number `CURRENT - AGE' to
                   9823:        `CURRENT'.
                   9824:        
                   9825:      If two libraries have identical CURRENT and AGE numbers, then the
                   9826: dynamic linker chooses the library with the greater REVISION number. 
                   9827: </pre>
                   9828: 
                   9829:                   <p>The &#8220;<span class=
                   9830:                   "quote">-release</span>&#8221; option will
                   9831:                   produce different results for a.out and ELF
                   9832:                   (excluding symlinks) in only one case. An ELF
                   9833:                   library of the form &#8220;<span class=
                   9834:                   "quote">libfoo-release.so.<span class=
                   9835:                   "emphasis"><em>x</em></span>.<span class=
                   9836:                   "emphasis"><em>y</em></span></span>&#8221; will
                   9837:                   have a symlink of &#8220;<span class=
                   9838:                   "quote">libfoo.so.<span class=
                   9839:                   "emphasis"><em>x</em></span>.<span class=
                   9840:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   9841:                   a.out platform. This is handled
                   9842:                   automatically.</p>
                   9843: 
                   9844:                   <p>The &#8220;<span class="quote">-rpath
                   9845:                   argument</span>&#8221; is the install directory
                   9846:                   of the library being built.</p>
                   9847: 
1.14      xtraeme  9848:                   <p>In the <code class="filename">PLIST</code>,
1.19      hubertf  9849:                   include only the <code class=
                   9850:                   "filename">.la</code> file, the other files will
                   9851:                   be added automatically.</p>
1.1       grant    9852:                 </li>
                   9853: 
                   9854:                 <li>
1.14      xtraeme  9855:                   <p>When linking shared object (<code class=
                   9856:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      9857:                   loaded via <a href=
                   9858:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   9859:                   <span class="citerefentry"><span class=
                   9860:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   9861:                   shared libraries, use &#8220;<span class=
                   9862:                   "quote">-module -avoid-version</span>&#8221; to
                   9863:                   prevent them getting version tacked on.</p>
1.1       grant    9864: 
1.14      xtraeme  9865:                   <p>The <code class="filename">PLIST</code> file
                   9866:                   gets the <code class="filename">foo.so</code>
                   9867:                   entry.</p>
1.1       grant    9868:                 </li>
                   9869: 
                   9870:                 <li>
                   9871:                   <p>When linking programs that depend on these
                   9872:                   libraries <span class=
                   9873:                   "emphasis"><em>before</em></span> they are
                   9874:                   installed, preface the <a href=
                   9875:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   9876:                   <span class="citerefentry"><span class=
                   9877:                   "refentrytitle">cc</span>(1)</span></a> or
                   9878:                   <a href=
                   9879:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   9880:                   <span class="citerefentry"><span class=
                   9881:                   "refentrytitle">ld</span>(1)</span></a> line with
                   9882:                   &#8220;<span class="quote">${LIBTOOL}
                   9883:                   --mode=link</span>&#8221;, and it will find the
                   9884:                   correct libraries (static or shared), but please
                   9885:                   be aware that libtool will not allow you to
                   9886:                   specify a relative path in -L (such as
                   9887:                   &#8220;<span class=
                   9888:                   "quote">-L../somelib</span>&#8221;), because it
                   9889:                   expects you to change that argument to be the
1.14      xtraeme  9890:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    9891:                   <pre class="programlisting">
                   9892: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   9893: </pre>
                   9894: 
                   9895:                   <p>should be changed to:</p>
                   9896:                   <pre class="programlisting">
1.14      xtraeme  9897: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   9898: "replaceable"><code>someprog</code></em> <em class=
                   9899: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    9900: </pre>
                   9901: 
                   9902:                   <p>and it will do the right thing with the
                   9903:                   libraries.</p>
                   9904:                 </li>
                   9905: 
                   9906:                 <li>
                   9907:                   <p>When installing libraries, preface the
                   9908:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   9909:                   <span class="citerefentry"><span class=
                   9910:                   "refentrytitle">install</span>(1)</span></a> or
                   9911:                   <a href=
                   9912:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   9913:                   <span class="citerefentry"><span class=
                   9914:                   "refentrytitle">cp</span>(1)</span></a> command
                   9915:                   with &#8220;<span class="quote">${LIBTOOL}
                   9916:                   --mode=install</span>&#8221;, and change the
1.14      xtraeme  9917:                   library name to <code class=
                   9918:                   "filename">.la</code>. e.g.</p>
1.1       grant    9919:                   <pre class="programlisting">
                   9920: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   9921: </pre>
                   9922: 
1.14      xtraeme  9923:                   <p>This will install the static <code class=
                   9924:                   "filename">.a</code>, shared library, any needed
1.1       grant    9925:                   symlinks, and run <a href=
                   9926:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   9927:                   <span class="citerefentry"><span class=
                   9928:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   9929:                 </li>
                   9930: 
                   9931:                 <li>
1.14      xtraeme  9932:                   <p>In your <code class="filename">PLIST</code>,
1.23      wiz      9933:                   include only the <code class=
                   9934:                   "filename">.la</code> file (this is a change from
                   9935:                   previous behaviour).</p>
1.1       grant    9936:                 </li>
                   9937:               </ol>
                   9938:             </div>
                   9939:           </div>
                   9940: 
                   9941:           <div class="sect2" lang="en" xml:lang="en">
                   9942:             <div class="titlepage">
                   9943:               <div>
                   9944:                 <div>
1.27    ! rillig   9945:                   <h3 class="title"><a name="id2634285" id=
        !          9946:                   "id2634285"></a>13.3.2.&nbsp;Using libtool on GNU
1.1       grant    9947:                   packages that already support libtool</h3>
                   9948:                 </div>
                   9949:               </div>
                   9950:             </div>
                   9951: 
1.14      xtraeme  9952:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   9953:             the package Makefile. This will override the package's
                   9954:             own libtool in most cases. For older libtool using
1.1       grant    9955:             packages, libtool is made by ltconfig script during the
                   9956:             do-configure step; you can check the libtool script
1.14      xtraeme  9957:             location by doing <span><strong class="command">make
                   9958:             configure; find work*/ -name
                   9959:             libtool</strong></span>.</p>
                   9960: 
                   9961:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   9962:             specifies which libtool scripts, relative to
                   9963:             <code class="varname">WRKSRC</code>, to override. By
                   9964:             default, it is set to &#8220;<span class=
                   9965:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   9966:             this does not match the location of the package's
                   9967:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  9968: 
1.14      xtraeme  9969:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    9970:             static libraries built and installed, then use
1.14      xtraeme  9971:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    9972:             instead.</p>
                   9973: 
                   9974:             <p>If your package makes use of the platform
                   9975:             independent library for loading dynamic shared objects,
                   9976:             that comes with libtool (libltdl), you should include
1.22      tv       9977:             devel/libltdl/buildlink3.mk.</p>
1.1       grant    9978: 
                   9979:             <p>Some packages use libtool incorrectly so that the
                   9980:             package may not work or build in some circumstances.
                   9981:             Some of the more common errors are:</p>
                   9982: 
                   9983:             <div class="itemizedlist">
                   9984:               <ul type="disc">
                   9985:                 <li>
                   9986:                   <p>The inclusion of a shared object (-module) as
                   9987:                   a dependent library in an executable or library.
                   9988:                   This in itself isn't a problem if one of two
                   9989:                   things has been done:</p>
                   9990: 
                   9991:                   <div class="orderedlist">
                   9992:                     <ol type="1">
                   9993:                       <li>
                   9994:                         <p>The shared object is named correctly,
1.14      xtraeme  9995:                         i.e. <code class=
                   9996:                         "filename">libfoo.la</code>, not
                   9997:                         <code class="filename">foo.la</code></p>
1.1       grant    9998:                       </li>
                   9999: 
                   10000:                       <li>
                   10001:                         <p>The -dlopen option is used when linking
                   10002:                         an executable.</p>
                   10003:                       </li>
                   10004:                     </ol>
                   10005:                   </div>
                   10006:                 </li>
                   10007: 
                   10008:                 <li>
                   10009:                   <p>The use of libltdl without the correct calls
                   10010:                   to initialisation routines. The function
                   10011:                   lt_dlinit() should be called and the macro
1.14      xtraeme  10012:                   <code class=
                   10013:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    10014:                   included in executables.</p>
                   10015:                 </li>
                   10016:               </ul>
                   10017:             </div>
                   10018:           </div>
                   10019: 
                   10020:           <div class="sect2" lang="en" xml:lang="en">
                   10021:             <div class="titlepage">
                   10022:               <div>
                   10023:                 <div>
1.27    ! rillig   10024:                   <h3 class="title"><a name="id2634503" id=
        !          10025:                   "id2634503"></a>13.3.3.&nbsp;GNU
1.1       grant    10026:                   Autoconf/Automake</h3>
                   10027:                 </div>
                   10028:               </div>
                   10029:             </div>
                   10030: 
                   10031:             <p>If a package needs GNU autoconf or automake to be
                   10032:             executed to regenerate the configure script and
                   10033:             Makefile.in makefile templates, then they should be
                   10034:             executed in a pre-configure target. Two Makefile
1.14      xtraeme  10035:             fragments are provided in <code class=
                   10036:             "filename">pkgsrc/mk/autoconf.mk</code> and
                   10037:             <code class="filename">pkgsrc/mk/automake.mk</code> to
                   10038:             help dealing with these tools. See comments in these
                   10039:             files for details.</p>
1.1       grant    10040: 
                   10041:             <p>For packages that need only autoconf:</p>
                   10042:             <pre class="programlisting">
                   10043: AUTOCONF_REQD=    2.50    # if default version is not good enough
                   10044: ...
                   10045: 
                   10046: pre-configure:
                   10047:           cd ${WRKSRC}; ${AUTOCONF}
                   10048: 
                   10049: ...
                   10050: .include "../../mk/autoconf.mk"
                   10051: </pre>
                   10052: 
                   10053:             <p>and for packages that need automake and
                   10054:             autoconf:</p>
                   10055:             <pre class="programlisting">
                   10056: AUTOMAKE_REQD=  1.7.1   # if default version is not good enough
                   10057: ...
                   10058: 
                   10059: pre-configure:
                   10060:           cd ${WRKSRC};                                           \
                   10061:           ${ACLOCAL};                                             \
                   10062:           ${AUTOHEADER};                                          \
                   10063:           ${AUTOMAKE} -a --foreign -i;                            \
                   10064:           ${AUTOCONF}
                   10065: 
                   10066: ...
                   10067: .include "../mk/automake.mk"
                   10068: </pre>
                   10069: 
                   10070:             <p>Packages which use GNU Automake will almost
                   10071:             certainly require GNU Make, but that's automatically
1.14      xtraeme  10072:             provided for you in <code class=
                   10073:             "filename">mk/automake.mk</code>.</p>
1.1       grant    10074: 
                   10075:             <p>There are times when the configure process makes
                   10076:             additional changes to the generated files, which then
                   10077:             causes the build process to try to re-execute the
                   10078:             automake sequence. This is prevented by touching
                   10079:             various files in the configure stage. If this causes
1.14      xtraeme  10080:             problems with your package you can set <code class=
                   10081:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    10082:             Makefile.</p>
                   10083:           </div>
                   10084:         </div>
                   10085: 
                   10086:         <div class="sect1" lang="en" xml:lang="en">
                   10087:           <div class="titlepage">
                   10088:             <div>
                   10089:               <div>
                   10090:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   10091:                 "id2634616" id="id2634616"></a>13.4.&nbsp;Building
1.1       grant    10092:                 considerations</h2>
                   10093:               </div>
                   10094:             </div>
                   10095:           </div>
                   10096: 
                   10097:           <div class="sect2" lang="en" xml:lang="en">
                   10098:             <div class="titlepage">
                   10099:               <div>
                   10100:                 <div>
1.27    ! rillig   10101:                   <h3 class="title"><a name="id2634619" id=
        !          10102:                   "id2634619"></a>13.4.1.&nbsp;CPP defines</h3>
1.1       grant    10103:                 </div>
                   10104:               </div>
                   10105:             </div>
                   10106: 
                   10107:             <p>To port an application to NetBSD, it's usually
                   10108:             necessary for the compiler to be able to judge the
                   10109:             system on which it's compiling, and we use definitions
                   10110:             so that the C pre-processor can do this.</p>
                   10111: 
                   10112:             <p>To test whether you are working on a 4.4 BSD-derived
                   10113:             system, you should use the BSD definition, which is
1.14      xtraeme  10114:             defined in <code class=
                   10115:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    10116:             systems.</p>
                   10117:             <pre class="programlisting">
                   10118: #include &lt;sys/param.h&gt;
                   10119: </pre>
                   10120: 
                   10121:             <p>and then you can surround the BSD-specific parts of
                   10122:             your package's C/C++ code using this conditional:</p>
                   10123:             <pre class="programlisting">
                   10124: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   10125:     ...
                   10126: #endif
                   10127: </pre>
                   10128: 
                   10129:             <p>Please use the &#8220;<span class=
                   10130:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   10131:             it should only apply to features of NetBSD that are not
                   10132:             present in other 4.4-lite derived BSDs.</p>
                   10133:           </div>
                   10134:         </div>
                   10135: 
                   10136:         <div class="sect1" lang="en" xml:lang="en">
                   10137:           <div class="titlepage">
                   10138:             <div>
                   10139:               <div>
                   10140:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   10141:                 "id2634649" id="id2634649"></a>13.5.&nbsp;Package
1.1       grant    10142:                 specific actions</h2>
                   10143:               </div>
                   10144:             </div>
                   10145:           </div>
                   10146: 
                   10147:           <div class="sect2" lang="en" xml:lang="en">
                   10148:             <div class="titlepage">
                   10149:               <div>
                   10150:                 <div>
1.27    ! rillig   10151:                   <h3 class="title"><a name="id2634652" id=
        !          10152:                   "id2634652"></a>13.5.1.&nbsp;Package
1.1       grant    10153:                   configuration files</h3>
                   10154:                 </div>
                   10155:               </div>
                   10156:             </div>
                   10157: 
                   10158:             <p>Packages should be taught to look for their
1.14      xtraeme  10159:             configuration files in <code class=
                   10160:             "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1       grant    10161:             through to the configure and build processes.
1.14      xtraeme  10162:             <code class="varname">PKG_SYSCONFDIR</code> may be
1.1       grant    10163:             customized in various ways by setting other make
                   10164:             variables:</p>
                   10165: 
                   10166:             <div class="itemizedlist">
                   10167:               <ul type="disc">
                   10168:                 <li>
1.14      xtraeme  10169:                   <p><code class="varname">PKG_SYSCONFBASE</code>
                   10170:                   is the main config directory under which all
                   10171:                   package configuration files are to be found. This
                   10172:                   defaults to <code class=
                   10173:                   "filename">${PREFIX}/etc</code>, but may be
                   10174:                   overridden in <code class=
                   10175:                   "filename">/etc/mk.conf</code>.</p>
1.1       grant    10176:                 </li>
                   10177: 
                   10178:                 <li>
1.14      xtraeme  10179:                   <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   10180:                   is the subdirectory of <code class=
                   10181:                   "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    10182:                   configuration files for a particular package may
                   10183:                   be found, e.g. the Apache configuration files may
1.14      xtraeme  10184:                   all be found under the <code class=
                   10185:                   "filename">httpd/</code> subdirectory of
                   10186:                   <code class="varname">${PKG_SYSCONFBASE}</code>.
                   10187:                   This should be set in the package Makefile.</p>
1.1       grant    10188:                 </li>
                   10189: 
                   10190:                 <li>
1.14      xtraeme  10191:                   <p>By default, <code class=
                   10192:                   "varname">PKG_SYSCONFDIR</code> is set to
                   10193:                   <code class=
                   10194:                   "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
                   10195:                   but this may be overridden by setting
                   10196:                   <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   10197:                   for a particular package, where <code class=
                   10198:                   "varname">PKG_SYSCONFVAR</code> defaults to
                   10199:                   <code class="varname">${PKGBASE}</code>. This is
                   10200:                   not meant to be set by a package Makefile, but is
1.1       grant    10201:                   reserved for users who wish to override the
1.14      xtraeme  10202:                   <code class="varname">PKG_SYSCONFDIR</code>
                   10203:                   setting for a particular package with a special
1.1       grant    10204:                   location.</p>
                   10205:                 </li>
                   10206:               </ul>
                   10207:             </div>
                   10208: 
                   10209:             <p>The only variables that users should customize are
1.14      xtraeme  10210:             <code class="varname">PKG_SYSCONFBASE</code> and
                   10211:             <code class=
                   10212:             "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
                   10213:             Users will typically want to set <code class=
                   10214:             "varname">PKG_SYSCONFBASE</code> to <code class=
                   10215:             "filename">/etc</code>, or to accept the default
                   10216:             location of <code class=
                   10217:             "filename">${PREFIX}/etc</code>.</p>
1.1       grant    10218:           </div>
                   10219: 
                   10220:           <div class="sect2" lang="en" xml:lang="en">
                   10221:             <div class="titlepage">
                   10222:               <div>
                   10223:                 <div>
1.27    ! rillig   10224:                   <h3 class="title"><a name="id2634755" id=
        !          10225:                   "id2634755"></a>13.5.2.&nbsp;User
1.2       hubertf  10226:                   interaction</h3>
1.1       grant    10227:                 </div>
                   10228:               </div>
                   10229:             </div>
                   10230: 
                   10231:             <p>Occasionally, packages require interaction from the
                   10232:             user, and this can be in a number of ways:</p>
                   10233: 
                   10234:             <div class="itemizedlist">
                   10235:               <ul type="disc">
                   10236:                 <li>
                   10237:                   <p>help in fetching the distfiles</p>
                   10238:                 </li>
                   10239: 
                   10240:                 <li>
                   10241:                   <p>help to configure the package before it is
                   10242:                   built</p>
                   10243:                 </li>
                   10244: 
                   10245:                 <li>
                   10246:                   <p>help during the build process</p>
                   10247:                 </li>
                   10248: 
                   10249:                 <li>
                   10250:                   <p>help during the installation of a package</p>
                   10251:                 </li>
                   10252:               </ul>
                   10253:             </div>
                   10254: 
1.14      xtraeme  10255:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    10256:             definition is provided to notify the pkgsrc mechanism
                   10257:             of an interactive stage which will be needed, and this
1.14      xtraeme  10258:             should be set in the package's <code class=
                   10259:             "filename">Makefile</code>. e.g.</p>
1.1       grant    10260:             <pre class="programlisting">
                   10261: INTERACTIVE_STAGE= build
                   10262: </pre>
                   10263: 
                   10264:             <p>Multiple interactive stages can be specified:</p>
                   10265:             <pre class="programlisting">
                   10266: INTERACTIVE_STAGE= configure install
                   10267: </pre>
                   10268:           </div>
                   10269: 
                   10270:           <div class="sect2" lang="en" xml:lang="en">
                   10271:             <div class="titlepage">
                   10272:               <div>
                   10273:                 <div>
1.27    ! rillig   10274:                   <h3 class="title"><a name="id2634800" id=
        !          10275:                   "id2634800"></a>13.5.3.&nbsp;Handling
1.1       grant    10276:                   licenses</h3>
                   10277:                 </div>
                   10278:               </div>
                   10279:             </div>
                   10280: 
                   10281:             <p>A package may underly a license which the user has
                   10282:             or has not agreed to accept. Usually, packages that
                   10283:             underly well-known Open Source licenses (e.g. the GNU
                   10284:             Public License, GPL) won't have any special license
                   10285:             tags added in pkgsrc which require special action by
                   10286:             the user of such packages, but there are quite a number
                   10287:             of other licenses out there that pkgsrc users may not
                   10288:             be able to follow, for whatever reasons. For these
                   10289:             cases, pkgsrc contains a mechanism to note that a
                   10290:             package underlies a certain license, and the user has
                   10291:             to accept the license before the package can be
                   10292:             installed.</p>
                   10293: 
                   10294:             <p>Placing a certain package under a certain license
1.14      xtraeme  10295:             works by setting the <code class=
                   10296:             "varname">LICENSE</code> variable to a string
                   10297:             identifying the license, e.g. in <a xmlns=
                   10298:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10299:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20      ben      10300:             class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    10301:             <pre class="programlisting">
                   10302: LICENSE=        graphviz-license
                   10303: </pre>
                   10304: 
                   10305:             <p>When trying to build, the user will get a notice
                   10306:             that the package underlies a license which he hasn't
                   10307:             accepted (yet):</p>
                   10308:             <pre class="programlisting">
1.14      xtraeme  10309: <code class="prompt">%</code> <strong class=
                   10310: "userinput"><code>make</code></strong>
1.1       grant    10311: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   10312: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   10313: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   10314: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   10315: *** Error code 1
                   10316: </pre>
                   10317: 
1.14      xtraeme  10318:             <p>The license can be viewed with <span><strong class=
                   10319:             "command">make show-license</strong></span>, and if it
                   10320:             is considered appropriate, the line printed above can
                   10321:             be added to <code class="filename">/etc/mk.conf</code>
                   10322:             to indicate acceptance of the particular license:</p>
1.1       grant    10323:             <pre class="programlisting">
                   10324: ACCEPTABLE_LICENSES+=graphviz-license
                   10325: </pre>
                   10326: 
                   10327:             <p>When adding a package with a new license, the
1.14      xtraeme  10328:             license text should be added to <code class=
                   10329:             "filename">pkgsrc/licenses</code> for displaying. A
                   10330:             list of known licenses can be seen in this directory as
                   10331:             well as by looking at the list of (commented out)
                   10332:             <code class="varname">ACCEPTABLE_LICENSES</code>
                   10333:             variable settings in <code class=
                   10334:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    10335: 
1.17      sketch   10336:             <p>If there is a <span class=
1.1       grant    10337:             "emphasis"><em>really</em></span> pressing need to
                   10338:             accept all licenses at once, like when trying to
                   10339:             download or mirror all distfiles or doing a bulk build
                   10340:             to test if all packages in pkgsrc build, this can be
1.14      xtraeme  10341:             done by setting <code class=
                   10342:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    10343:           </div>
                   10344: 
                   10345:           <div class="sect2" lang="en" xml:lang="en">
                   10346:             <div class="titlepage">
                   10347:               <div>
                   10348:                 <div>
1.27    ! rillig   10349:                   <h3 class="title"><a name="id2634951" id=
        !          10350:                   "id2634951"></a>13.5.4.&nbsp;Creating an account
1.1       grant    10351:                   from a package</h3>
                   10352:                 </div>
                   10353:               </div>
                   10354:             </div>
                   10355: 
                   10356:             <p>There are two make variables used to control the
                   10357:             creation of package-specific groups and users at
1.14      xtraeme  10358:             pre-install time. The first is <code class=
                   10359:             "varname">PKG_GROUPS</code>, which is a list of
1.1       grant    10360:             group[:groupid] elements, where the groupid is
1.14      xtraeme  10361:             optional. The second is <code class=
                   10362:             "varname">PKG_USERS</code>, which is a list of elements
1.1       grant    10363:             of the form:</p>
                   10364:             <pre class="programlisting">
                   10365: user:group[:[userid][:[description][:[home][:shell]]]]
                   10366: </pre>
                   10367: 
                   10368:             <p>where only the user and group are required, the rest
                   10369:             being optional. A simple example is:</p>
                   10370:             <pre class="programlisting">
                   10371:   PKG_GROUPS=       foogroup
                   10372:     PKG_USERS=    foouser:foogroup
                   10373: </pre>
                   10374: 
                   10375:             <p>A more complex example is that creates two groups
                   10376:             and two users is:</p>
                   10377:             <pre class="programlisting">
                   10378:   PKG_GROUPS=       group1 group2:1005
                   10379:     PKG_USERS=    first:group1::First\\ User                      \
                   10380:                   second:group2::Second\\ User:/home/second:${SH}
                   10381: </pre>
                   10382: 
                   10383:             <p>By default, a new user will have home directory
1.14      xtraeme  10384:             <code class="filename">/nonexistent</code>, and login
                   10385:             shell <code class="filename">/sbin/nologin</code>
                   10386:             unless they are specified as part of the user
                   10387:             element.</p>
1.1       grant    10388: 
1.14      xtraeme  10389:             <p>The package <code class="filename">Makefile</code>
                   10390:             must also set <code class=
                   10391:             "varname">USE_PKGINSTALL=YES</code>. This will cause
                   10392:             the users and groups to be created at pre-install time,
                   10393:             and the admin will be prompted to remove them at
                   10394:             post-deinstall time. Automatic creation of the users
                   10395:             and groups can be toggled on and off by setting the
                   10396:             <code class="varname">PKG_CREATE_USERGROUP</code>
                   10397:             variable prior to package installation.</p>
1.1       grant    10398:           </div>
                   10399: 
                   10400:           <div class="sect2" lang="en" xml:lang="en">
                   10401:             <div class="titlepage">
                   10402:               <div>
                   10403:                 <div>
1.27    ! rillig   10404:                   <h3 class="title"><a name="id2635013" id=
        !          10405:                   "id2635013"></a>13.5.5.&nbsp;Installing score
1.1       grant    10406:                   files</h3>
                   10407:                 </div>
                   10408:               </div>
                   10409:             </div>
                   10410: 
                   10411:             <p>Certain packages, most of them in the games
                   10412:             category, install a score file that allows all users on
                   10413:             the system to record their highscores. In order for
                   10414:             this to work, the binaries need to be installed setgid
                   10415:             and the score files owned by the appropriate group
                   10416:             and/or owner (traditionally the "games" user/group).
                   10417:             The following variables, documented in more detail in
1.14      xtraeme  10418:             <code class="filename">mk/defaults/mk.conf</code>,
                   10419:             control this behaviour: <code class=
                   10420:             "varname">SETGIDGAME</code>, <code class=
                   10421:             "varname">GAMEDATAMODE</code>, <code class=
                   10422:             "varname">GAMEGRP</code>, <code class=
                   10423:             "varname">GAMEMODE</code>, <code class=
                   10424:             "varname">GAMEOWN</code>.</p>
1.1       grant    10425: 
                   10426:             <p>Note that per default, setgid installation of games
1.14      xtraeme  10427:             is disabled; setting <code class=
                   10428:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    10429:             variables accordingly.</p>
                   10430: 
                   10431:             <p>A package should therefor never hard code file
1.14      xtraeme  10432:             ownership or access permissions but rely on
                   10433:             <code class="varname">INSTALL_GAME</code> and
                   10434:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   10435:             these correctly.</p>
1.1       grant    10436:           </div>
                   10437: 
                   10438:           <div class="sect2" lang="en" xml:lang="en">
                   10439:             <div class="titlepage">
                   10440:               <div>
                   10441:                 <div>
1.27    ! rillig   10442:                   <h3 class="title"><a name="id2635057" id=
        !          10443:                   "id2635057"></a>13.5.6.&nbsp;Packages providing
1.1       grant    10444:                   login shells</h3>
                   10445:                 </div>
                   10446:               </div>
                   10447:             </div>
                   10448: 
                   10449:             <p>If the purpose of the package is to provide a login
1.14      xtraeme  10450:             shell, the variable <code class=
                   10451:             "varname">PKG_SHELL</code> should contain the full
                   10452:             pathname of the shell executable installed by this
                   10453:             package. The package <code class=
                   10454:             "filename">Makefile</code> must also set <code class=
                   10455:             "varname">USE_PKGINSTALL=YES</code> to use the
                   10456:             automatically generated <code class=
                   10457:             "filename">INSTALL</code>/<code class=
                   10458:             "filename">DEINSTALL</code> scripts.</p>
1.1       grant    10459: 
                   10460:             <p>An example taken from shells/zsh:</p>
                   10461:             <pre class="programlisting">
                   10462:   USE_PKGINSTALL=   YES
                   10463:     PKG_SHELL=    ${PREFIX}/bin/zsh
                   10464: </pre>
                   10465: 
1.14      xtraeme  10466:             <p>The shell is registered into <code class=
                   10467:             "filename">/etc/shells</code> file automatically in the
                   10468:             post-install target by the generated <code class=
                   10469:             "filename">INSTALL</code> script and removed in the
                   10470:             deinstall target by the <code class=
                   10471:             "filename">DEINSTALL</code> script.</p>
1.1       grant    10472:           </div>
                   10473: 
                   10474:           <div class="sect2" lang="en" xml:lang="en">
                   10475:             <div class="titlepage">
                   10476:               <div>
                   10477:                 <div>
1.27    ! rillig   10478:                   <h3 class="title"><a name="id2635114" id=
        !          10479:                   "id2635114"></a>13.5.7.&nbsp;Packages containing
1.1       grant    10480:                   perl scripts</h3>
                   10481:                 </div>
                   10482:               </div>
                   10483:             </div>
                   10484: 
                   10485:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  10486:             set <code class="varname">REPLACE_PERL</code> to ensure
                   10487:             that the proper interpreter path is set. <code class=
                   10488:             "varname">REPLACE_PERL</code> should contain a list of
                   10489:             scripts, relative to <code class=
                   10490:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    10491:           </div>
                   10492: 
                   10493:           <div class="sect2" lang="en" xml:lang="en">
                   10494:             <div class="titlepage">
                   10495:               <div>
                   10496:                 <div>
1.27    ! rillig   10497:                   <h3 class="title"><a name="id2635132" id=
        !          10498:                   "id2635132"></a>13.5.8.&nbsp;Packages with
1.1       grant    10499:                   hardcoded paths to other interpreters</h3>
                   10500:                 </div>
                   10501:               </div>
                   10502:             </div>
                   10503: 
                   10504:             <p>Your package may also contain scripts with hardcoded
                   10505:             paths to other interpreters besides (or as well as)
                   10506:             perl. To correct the full pathname to the script
                   10507:             interpreter, you need to set the following definitions
1.14      xtraeme  10508:             in your <code class="filename">Makefile</code> (we
                   10509:             shall use <span><strong class=
                   10510:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    10511:             <pre class="programlisting">
                   10512:   REPLACE_INTERPRETER+=     tcl
                   10513:     _REPLACE.tcl.old=     .*/bin/tclsh
                   10514:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   10515:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   10516:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   10517: </pre>
                   10518:           </div>
                   10519: 
                   10520:           <div class="sect2" lang="en" xml:lang="en">
                   10521:             <div class="titlepage">
                   10522:               <div>
                   10523:                 <div>
1.27    ! rillig   10524:                   <h3 class="title"><a name="id2635154" id=
        !          10525:                   "id2635154"></a>13.5.9.&nbsp;Packages installing
1.1       grant    10526:                   perl modules</h3>
                   10527:                 </div>
                   10528:               </div>
                   10529:             </div>
                   10530: 
                   10531:             <p>Makefiles of packages providing perl5 modules should
1.14      xtraeme  10532:             include the Makefile fragment <code class=
                   10533:             "filename">../../lang/perl5/module.mk</code>. It
                   10534:             provides a <span><strong class=
                   10535:             "command">do-configure</strong></span> target for the
                   10536:             standard perl configuration for such modules as well as
                   10537:             various hooks to tune this configuration. See comments
                   10538:             in this file for details.</p>
1.1       grant    10539: 
                   10540:             <p>Perl5 modules will install into different places
                   10541:             depending on the version of perl used during the build
                   10542:             process. To address this, pkgsrc will append lines to
1.14      xtraeme  10543:             the <code class="filename">PLIST</code> corresponding
                   10544:             to the files listed in the installed <code class=
                   10545:             "filename">.packlist</code> file generated by most
                   10546:             perl5 modules. This is invoked by defining <code class=
                   10547:             "varname">PERL5_PACKLIST</code> to a space-separated
                   10548:             list of paths to packlist files, e.g.:</p>
1.1       grant    10549:             <pre class="programlisting">
                   10550: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   10551: </pre>
                   10552: 
1.14      xtraeme  10553:             <p>The variables <code class=
                   10554:             "varname">PERL5_SITELIB</code>, <code class=
                   10555:             "varname">PERL5_SITEARCH</code>, and <code class=
                   10556:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    10557:             locations in which perl5 modules may be installed, and
                   10558:             may be used by perl5 packages that don't have a
                   10559:             packlist. These three variables are also substituted
1.14      xtraeme  10560:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    10561:           </div>
                   10562: 
                   10563:           <div class="sect2" lang="en" xml:lang="en">
                   10564:             <div class="titlepage">
                   10565:               <div>
                   10566:                 <div>
                   10567:                   <h3 class="title"><a name="faq.info-files" id=
1.25      rillig   10568:                   "faq.info-files"></a>13.5.10.&nbsp;Packages
1.1       grant    10569:                   installing info files</h3>
                   10570:                 </div>
                   10571:               </div>
                   10572:             </div>
                   10573: 
                   10574:             <p>Some packages install info files or use the
                   10575:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   10576:             &#8220;<span class="quote">install-info</span>&#8221;
                   10577:             commands. Each of the info files:</p>
                   10578: 
                   10579:             <div class="itemizedlist">
                   10580:               <ul type="disc">
                   10581:                 <li>
                   10582:                   <p>is considered to be installed in the directory
1.14      xtraeme  10583:                   <code class=
                   10584:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    10585:                 </li>
                   10586: 
                   10587:                 <li>
                   10588:                   <p>is registered in the Info directory file
1.14      xtraeme  10589:                   <code class=
                   10590:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    10591:                 </li>
                   10592: 
                   10593:                 <li>
                   10594:                   <p>and must be listed as a filename in the
1.14      xtraeme  10595:                   <code class="varname">INFO_FILES</code> variable
                   10596:                   in the package Makefile.</p>
1.1       grant    10597:                 </li>
                   10598:               </ul>
                   10599:             </div>
                   10600: 
1.14      xtraeme  10601:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    10602:             &#8220;<span class="quote">info</span>&#8221; and can
1.14      xtraeme  10603:             be overridden in the package Makefile. <code class=
                   10604:             "filename">INSTALL</code> and <code class=
                   10605:             "filename">DEINSTALL</code> scripts will be generated
                   10606:             to handle registration of the info files in the Info
1.1       grant    10607:             directory file. The &#8220;<span class=
                   10608:             "quote">install-info</span>&#8221; command used for the
                   10609:             info files registration is either provided by the
                   10610:             system, or by a special purpose package automatically
                   10611:             added as dependency if needed.</p>
                   10612: 
                   10613:             <p>A package which needs the &#8220;<span class=
                   10614:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  10615:             must define the variable <code class=
                   10616:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    10617:             minimum version of the &#8220;<span class=
                   10618:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  10619:             should be noted with the <code class=
                   10620:             "varname">TEXINFO_REQD</code> variable in the package
                   10621:             <code class="filename">Makefile</code>. By default, a
1.1       grant    10622:             minimum version of 3.12 is required. If the system does
1.14      xtraeme  10623:             not provide a <span><strong class=
                   10624:             "command">makeinfo</strong></span> command or if it
                   10625:             does not match the required minimum, a build dependency
                   10626:             on the <a xmlns=
                   10627:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10628:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20      ben      10629:             class="pkgname">devel/gtexinfo</a> package will be
                   10630:             added automatically.</p>
1.1       grant    10631: 
                   10632:             <p>The build and installation process of the software
                   10633:             provided by the package should not use the
1.14      xtraeme  10634:             <span><strong class=
                   10635:             "command">install-info</strong></span> command as the
                   10636:             registration of info files is the task of the package
                   10637:             <code class="filename">INSTALL</code> script, and it
                   10638:             must use the appropriate <span><strong class=
                   10639:             "command">makeinfo</strong></span> command.</p>
1.1       grant    10640: 
                   10641:             <p>To achieve this goal the pkgsrc infrastructure
1.14      xtraeme  10642:             creates overriding scripts for the <span><strong class=
                   10643:             "command">install-info</strong></span> and
                   10644:             <span><strong class="command">makeinfo</strong></span>
                   10645:             commands in a directory listed early in <code class=
                   10646:             "varname">PATH</code>.</p>
1.1       grant    10647: 
1.14      xtraeme  10648:             <p>The script overriding <span><strong class=
                   10649:             "command">install-info</strong></span> has no effect
                   10650:             except the logging of a message. The script overriding
                   10651:             <span><strong class="command">makeinfo</strong></span>
                   10652:             logs a message and according to the value of
                   10653:             <code class="varname">USE_MAKEINFO</code> and
                   10654:             <code class="varname">TEXINFO_REQD</code> either run
                   10655:             the appropriate <span><strong class=
                   10656:             "command">makeinfo</strong></span> command or exit on
                   10657:             error.</p>
1.1       grant    10658:           </div>
                   10659: 
                   10660:           <div class="sect2" lang="en" xml:lang="en">
                   10661:             <div class="titlepage">
                   10662:               <div>
                   10663:                 <div>
1.27    ! rillig   10664:                   <h3 class="title"><a name="id2635510" id=
        !          10665:                   "id2635510"></a>13.5.11.&nbsp;Packages installing
1.1       grant    10666:                   GConf2 data files</h3>
                   10667:                 </div>
                   10668:               </div>
                   10669:             </div>
                   10670: 
1.14      xtraeme  10671:             <p>If a package installs <code class=
                   10672:             "filename">.schemas</code> or <code class=
                   10673:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    10674:             need to take some extra steps to make sure they get
                   10675:             registered in the database:</p>
                   10676: 
                   10677:             <div class="orderedlist">
                   10678:               <ol type="1">
                   10679:                 <li>
1.14      xtraeme  10680:                   <p>Include <code class=
                   10681:                   "filename">../../devel/GConf2/schemas.mk</code>
                   10682:                   instead of its <code class=
                   10683:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    10684:                   care of rebuilding the GConf2 database at
                   10685:                   installation and deinstallation time, and tells
                   10686:                   the package where to install GConf2 data files
                   10687:                   using some standard configure arguments. It also
                   10688:                   disallows any access to the database directly
                   10689:                   from the package.</p>
                   10690:                 </li>
                   10691: 
                   10692:                 <li>
                   10693:                   <p>Ensure that the package installs its
1.14      xtraeme  10694:                   <code class="filename">.schemas</code> files
                   10695:                   under <code class=
                   10696:                   "filename">${PREFIX}/share/gconf/schemas</code>.
                   10697:                   If they get installed under <code class=
                   10698:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    10699:                   manually patch the package.</p>
                   10700:                 </li>
                   10701: 
                   10702:                 <li>
                   10703:                   <p>Check the PLIST and remove any entries under
                   10704:                   the etc/gconf directory, as they will be handled
                   10705:                   automatically. See <a href="#faq.conf" title=
1.14      xtraeme  10706:                   "6.14.&nbsp;Configuration files handling and placement">
                   10707:                   Section&nbsp;6.14, &#8220;Configuration files
1.1       grant    10708:                   handling and placement&#8221;</a> for more
                   10709:                   information.</p>
                   10710:                 </li>
                   10711: 
                   10712:                 <li>
1.14      xtraeme  10713:                   <p>Define the <code class=
                   10714:                   "varname">GCONF2_SCHEMAS</code> variable in your
                   10715:                   <code class="filename">Makefile</code> with a
                   10716:                   list of all <code class=
                   10717:                   "filename">.schemas</code> files installed by the
                   10718:                   package, if any. Names must not contain any
                   10719:                   directories in them.</p>
1.1       grant    10720:                 </li>
                   10721: 
                   10722:                 <li>
1.14      xtraeme  10723:                   <p>Define the <code class=
                   10724:                   "varname">GCONF2_ENTRIES</code> variable in your
                   10725:                   <code class="filename">Makefile</code> with a
                   10726:                   list of all <code class=
                   10727:                   "filename">.entries</code> files installed by the
                   10728:                   package, if any. Names must not contain any
                   10729:                   directories in them.</p>
1.1       grant    10730:                 </li>
                   10731:               </ol>
                   10732:             </div>
                   10733:           </div>
                   10734: 
                   10735:           <div class="sect2" lang="en" xml:lang="en">
                   10736:             <div class="titlepage">
                   10737:               <div>
                   10738:                 <div>
1.27    ! rillig   10739:                   <h3 class="title"><a name="id2635678" id=
        !          10740:                   "id2635678"></a>13.5.12.&nbsp;Packages installing
1.1       grant    10741:                   scrollkeeper data files</h3>
                   10742:                 </div>
                   10743:               </div>
                   10744:             </div>
                   10745: 
1.14      xtraeme  10746:             <p>If a package installs <code class=
                   10747:             "filename">.omf</code> files, used by scrollkeeper, you
                   10748:             need to take some extra steps to make sure they get
                   10749:             registered in the database:</p>
1.1       grant    10750: 
                   10751:             <div class="orderedlist">
                   10752:               <ol type="1">
                   10753:                 <li>
1.14      xtraeme  10754:                   <p>Include <code class=
                   10755:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
                   10756:                   instead of its <code class=
                   10757:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    10758:                   care of rebuilding the scrollkeeper database at
                   10759:                   installation and deinstallation time, and
                   10760:                   disallows any access to it directly from the
                   10761:                   package.</p>
                   10762:                 </li>
                   10763: 
                   10764:                 <li>
                   10765:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10766:                   the <code class=
                   10767:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    10768:                   as they will be handled automatically.</p>
                   10769:                 </li>
                   10770: 
                   10771:                 <li>
1.14      xtraeme  10772:                   <p>Remove the <code class=
                   10773:                   "filename">share/omf</code> directory from the
                   10774:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    10775:                 </li>
                   10776:               </ol>
                   10777:             </div>
                   10778:           </div>
                   10779: 
                   10780:           <div class="sect2" lang="en" xml:lang="en">
                   10781:             <div class="titlepage">
                   10782:               <div>
                   10783:                 <div>
1.27    ! rillig   10784:                   <h3 class="title"><a name="id2635730" id=
        !          10785:                   "id2635730"></a>13.5.13.&nbsp;Packages installing
1.1       grant    10786:                   X11 fonts</h3>
                   10787:                 </div>
                   10788:               </div>
                   10789:             </div>
                   10790: 
                   10791:             <p>If a package installs font files, you will need to
                   10792:             rebuild the fonts database in the directory where they
                   10793:             get installed at installation and deinstallation time.
1.14      xtraeme  10794:             This can be automatically done by using <code class=
                   10795:             "filename">mk/fonts.mk</code>, which you need to
                   10796:             include in your <code class=
                   10797:             "filename">Makefile</code>.</p>
1.1       grant    10798: 
                   10799:             <p>When the file is included, you can list the
1.14      xtraeme  10800:             directories where fonts are installed in the
                   10801:             <code class="varname">FONTS_<em class=
                   10802:             "replaceable"><code>type</code></em>_DIRS</code>
                   10803:             variables, where <em class=
                   10804:             "replaceable"><code>type</code></em> can be one of
                   10805:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    10806:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   10807:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.14      xtraeme  10808:             sure that the database file <code class=
                   10809:             "filename">fonts.dir</code> is not listed in the
1.1       grant    10810:             PLIST.</p>
                   10811: 
                   10812:             <p>Note that you should not create new directories for
                   10813:             fonts; instead use the standard ones to avoid that the
                   10814:             user needs to manually configure his X server to find
                   10815:             them.</p>
                   10816:           </div>
                   10817: 
                   10818:           <div class="sect2" lang="en" xml:lang="en">
                   10819:             <div class="titlepage">
                   10820:               <div>
                   10821:                 <div>
1.27    ! rillig   10822:                   <h3 class="title"><a name="id2635777" id=
        !          10823:                   "id2635777"></a>13.5.14.&nbsp;Packages installing
1.1       grant    10824:                   GTK2 modules</h3>
                   10825:                 </div>
                   10826:               </div>
                   10827:             </div>
                   10828: 
                   10829:             <p>If a package installs gtk2 immodules or loaders, you
                   10830:             need to take some extra steps to get them registered in
                   10831:             the GTK2 database properly:</p>
                   10832: 
                   10833:             <div class="orderedlist">
                   10834:               <ol type="1">
                   10835:                 <li>
1.14      xtraeme  10836:                   <p>Include <code class=
                   10837:                   "filename">../../x11/gtk2/modules.mk</code>
                   10838:                   instead of its <code class=
                   10839:                   "filename">buildlink3.mk</code> file. This takes
                   10840:                   care of rebuilding the database at installation
                   10841:                   and deinstallation time.</p>
1.1       grant    10842:                 </li>
                   10843: 
                   10844:                 <li>
1.14      xtraeme  10845:                   <p>Set <code class=
                   10846:                   "varname">GTK2_IMMODULES=YES</code> if your
                   10847:                   package installs GTK2 immodules.</p>
1.1       grant    10848:                 </li>
                   10849: 
                   10850:                 <li>
1.14      xtraeme  10851:                   <p>Set <code class=
                   10852:                   "varname">GTK2_LOADERS=YES</code> if your package
                   10853:                   installs GTK2 loaders.</p>
1.1       grant    10854:                 </li>
                   10855: 
                   10856:                 <li>
                   10857:                   <p>Patch the package to not touch any of the gtk2
                   10858:                   databases directly. These are:</p>
                   10859: 
                   10860:                   <div class="itemizedlist">
                   10861:                     <ul type="disc">
                   10862:                       <li>
1.14      xtraeme  10863:                         <p><code class=
                   10864:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    10865:                       </li>
                   10866: 
                   10867:                       <li>
1.14      xtraeme  10868:                         <p><code class=
                   10869:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    10870:                       </li>
                   10871:                     </ul>
                   10872:                   </div>
                   10873:                 </li>
                   10874: 
                   10875:                 <li>
                   10876:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10877:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    10878:                   directory, as they will be handled
                   10879:                   automatically.</p>
                   10880:                 </li>
                   10881:               </ol>
                   10882:             </div>
                   10883:           </div>
                   10884: 
                   10885:           <div class="sect2" lang="en" xml:lang="en">
                   10886:             <div class="titlepage">
                   10887:               <div>
                   10888:                 <div>
1.27    ! rillig   10889:                   <h3 class="title"><a name="id2635846" id=
        !          10890:                   "id2635846"></a>13.5.15.&nbsp;Packages installing
1.1       grant    10891:                   SGML or XML data</h3>
                   10892:                 </div>
                   10893:               </div>
                   10894:             </div>
                   10895: 
                   10896:             <p>If a package installs SGML or XML data files that
                   10897:             need to be registered in system-wide catalogs (like
                   10898:             DTDs, sub-catalogs, etc.), you need to take some extra
                   10899:             steps:</p>
                   10900: 
                   10901:             <div class="orderedlist">
                   10902:               <ol type="1">
                   10903:                 <li>
1.14      xtraeme  10904:                   <p>Include <code class=
                   10905:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
                   10906:                   in your <code class="filename">Makefile</code>,
                   10907:                   which takes care of registering those files in
1.1       grant    10908:                   system-wide catalogs at installation and
                   10909:                   deinstallation time.</p>
                   10910:                 </li>
                   10911: 
                   10912:                 <li>
1.14      xtraeme  10913:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   10914:                   to the full path of any SGML catalogs installed
                   10915:                   by the package.</p>
1.1       grant    10916:                 </li>
                   10917: 
                   10918:                 <li>
1.14      xtraeme  10919:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   10920:                   to the full path of any XML catalogs installed by
1.1       grant    10921:                   the package.</p>
                   10922:                 </li>
                   10923: 
                   10924:                 <li>
1.14      xtraeme  10925:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   10926:                   to individual entries to be added to the SGML
1.1       grant    10927:                   catalog. These come in groups of three strings;
                   10928:                   see xmlcatmgr(1) for more information
                   10929:                   (specifically, arguments recognized by the 'add'
                   10930:                   action). Note that you will normally not use this
                   10931:                   variable.</p>
                   10932:                 </li>
                   10933: 
                   10934:                 <li>
1.14      xtraeme  10935:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   10936:                   to individual entries to be added to the XML
1.1       grant    10937:                   catalog. These come in groups of three strings;
                   10938:                   see xmlcatmgr(1) for more information
                   10939:                   (specifically, arguments recognized by the 'add'
                   10940:                   action). Note that you will normally not use this
                   10941:                   variable.</p>
                   10942:                 </li>
                   10943:               </ol>
                   10944:             </div>
                   10945:           </div>
                   10946: 
                   10947:           <div class="sect2" lang="en" xml:lang="en">
                   10948:             <div class="titlepage">
                   10949:               <div>
                   10950:                 <div>
1.27    ! rillig   10951:                   <h3 class="title"><a name="id2635898" id=
        !          10952:                   "id2635898"></a>13.5.16.&nbsp;Packages installing
1.1       grant    10953:                   extensions to the MIME database</h3>
                   10954:                 </div>
                   10955:               </div>
                   10956:             </div>
                   10957: 
                   10958:             <p>If a package provides extensions to the MIME
1.14      xtraeme  10959:             database by installing <code class=
                   10960:             "filename">.xml</code> files inside <code class=
                   10961:             "filename">${PREFIX}/share/mime/packages</code>, you
                   10962:             need to take some extra steps to ensure that the
                   10963:             database is kept consistent with respect to these new
                   10964:             files:</p>
1.1       grant    10965: 
                   10966:             <div class="orderedlist">
                   10967:               <ol type="1">
                   10968:                 <li>
1.14      xtraeme  10969:                   <p>Include <code class=
                   10970:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
                   10971:                   (avoid using the <code class=
                   10972:                   "filename">buildlink3.mk</code> file from this
                   10973:                   same directory, which is reserved for inclusion
                   10974:                   from other <code class=
                   10975:                   "filename">buildlink3.mk</code> files). It takes
                   10976:                   care of rebuilding the MIME database at
                   10977:                   installation and deinstallation time, and
                   10978:                   disallows any access to it directly from the
1.1       grant    10979:                   package.</p>
                   10980:                 </li>
                   10981: 
                   10982:                 <li>
                   10983:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10984:                   the <code class="filename">share/mime</code>
1.1       grant    10985:                   directory, <span class=
                   10986:                   "emphasis"><em>except</em></span> for files saved
1.14      xtraeme  10987:                   under <code class=
                   10988:                   "filename">share/mime/packages</code>. The former
1.1       grant    10989:                   are handled automatically by the
                   10990:                   update-mime-database program, but the later are
                   10991:                   package-dependent and must be removed by the
                   10992:                   package that installed them in the first
                   10993:                   place.</p>
                   10994:                 </li>
                   10995: 
                   10996:                 <li>
1.14      xtraeme  10997:                   <p>Remove any <code class=
                   10998:                   "filename">share/mime/*</code> directories from
                   10999:                   the PLIST. They will be handled by the
1.1       grant    11000:                   shared-mime-info package.</p>
                   11001:                 </li>
                   11002:               </ol>
                   11003:             </div>
                   11004:           </div>
                   11005: 
                   11006:           <div class="sect2" lang="en" xml:lang="en">
                   11007:             <div class="titlepage">
                   11008:               <div>
                   11009:                 <div>
1.27    ! rillig   11010:                   <h3 class="title"><a name="id2636037" id=
        !          11011:                   "id2636037"></a>13.5.17.&nbsp;Packages using
1.1       grant    11012:                   intltool</h3>
                   11013:                 </div>
                   11014:               </div>
                   11015:             </div>
                   11016: 
                   11017:             <p>If a package uses intltool during its build, include
1.14      xtraeme  11018:             the <code class=
                   11019:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    11020:             file, which forces it to use the intltool package
                   11021:             provided by pkgsrc, instead of the one bundled with the
                   11022:             distribution file.</p>
                   11023: 
                   11024:             <p>This tracks intltool's build-time dependencies and
                   11025:             uses the latest available version; this way, the
                   11026:             package benefits of any bug fixes that may have
                   11027:             appeared since it was released.</p>
                   11028:           </div>
1.18      xtraeme  11029: 
                   11030:           <div class="sect2" lang="en" xml:lang="en">
                   11031:             <div class="titlepage">
                   11032:               <div>
                   11033:                 <div>
1.27    ! rillig   11034:                   <h3 class="title"><a name="id2636051" id=
        !          11035:                   "id2636051"></a>13.5.18.&nbsp;Packages installing
1.18      xtraeme  11036:                   startup scripts</h3>
                   11037:                 </div>
                   11038:               </div>
                   11039:             </div>
                   11040: 
                   11041:             <p>If a package contains a rc.d script, it won't be
                   11042:             copied into the startup directory by default, but you
                   11043:             can enable it, by adding the option <code class=
                   11044:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
                   11045:             "filename">/etc/mk.conf</code>. This option will copy
                   11046:             the scripts into <code class=
                   11047:             "filename">/etc/rc.d</code> when a package is
                   11048:             installed, and it will automatically remove the scripts
                   11049:             when the package is deinstalled.</p>
                   11050:           </div>
1.1       grant    11051:         </div>
                   11052: 
                   11053:         <div class="sect1" lang="en" xml:lang="en">
                   11054:           <div class="titlepage">
                   11055:             <div>
                   11056:               <div>
                   11057:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   11058:                 "id2636072" id="id2636072"></a>13.6.&nbsp;Feedback
1.1       grant    11059:                 to the author</h2>
                   11060:               </div>
                   11061:             </div>
                   11062:           </div>
                   11063: 
                   11064:           <p>If you have found any bugs in the package you make
                   11065:           available, if you had to do special steps to make it run
                   11066:           under NetBSD or if you enhanced the software in various
                   11067:           other ways, be sure to report these changes back to the
                   11068:           original author of the program! With that kind of
                   11069:           support, the next release of the program can incorporate
                   11070:           these fixes, and people not using the NetBSD packages
                   11071:           system can win from your efforts.</p>
                   11072: 
                   11073:           <p>Support the idea of free software!</p>
                   11074:         </div>
                   11075:       </div>
                   11076: 
                   11077:       <div class="chapter" lang="en" xml:lang="en">
                   11078:         <div class="titlepage">
                   11079:           <div>
                   11080:             <div>
                   11081:               <h2 class="title"><a name="debug" id=
1.25      rillig   11082:               "debug"></a>Chapter&nbsp;14.&nbsp;Debugging</h2>
1.1       grant    11083:             </div>
                   11084:           </div>
                   11085:         </div>
                   11086: 
                   11087:         <p>To check out all the gotchas when building a package,
                   11088:         here are the steps that I do in order to get a package
                   11089:         working. Please note this is basically the same as what was
                   11090:         explained in the previous sections, only with some
                   11091:         debugging aids.</p>
                   11092: 
                   11093:         <div class="itemizedlist">
                   11094:           <ul type="disc">
                   11095:             <li>
1.14      xtraeme  11096:               <p>Be sure to set <code class=
                   11097:               "varname">PKG_DEVELOPER=1</code> in <code class=
                   11098:               "filename">/etc/mk.conf</code></p>
1.1       grant    11099:             </li>
                   11100: 
                   11101:             <li>
                   11102:               <p>Install <a xmlns=
                   11103:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   11104:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20      ben      11105:               class="pkgname">pkgtools/url2pkg</a>, create a
                   11106:               directory for a new package, change into it, then run
                   11107:               <span><strong class=
                   11108:               "command">url2pkg</strong></span>:</p>
1.1       grant    11109:               <pre class="screen">
1.14      xtraeme  11110: <code class="prompt">%</code> <strong class=
                   11111: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   11112: "replaceable"><code>category</code></em>/<em class=
                   11113: "replaceable"><code>examplepkg</code></em></code></strong>
                   11114: <code class="prompt">%</code> <strong class=
                   11115: "userinput"><code>cd /usr/pkgsrc/<em class=
                   11116: "replaceable"><code>category</code></em>/<em class=
                   11117: "replaceable"><code>examplepkg</code></em></code></strong>
                   11118: <code class="prompt">%</code> <strong class=
                   11119: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    11120: </pre>
                   11121:             </li>
                   11122: 
                   11123:             <li>
1.14      xtraeme  11124:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    11125:               requested.</p>
                   11126:             </li>
                   11127: 
                   11128:             <li>
1.14      xtraeme  11129:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    11130:               file</p>
                   11131:             </li>
                   11132: 
                   11133:             <li>
1.14      xtraeme  11134:               <p>Run <span><strong class="command">make
                   11135:               configure</strong></span></p>
1.1       grant    11136:             </li>
                   11137: 
                   11138:             <li>
                   11139:               <p>Add any dependencies glimpsed from documentation
1.14      xtraeme  11140:               and the configure step to the package's <code class=
                   11141:               "filename">Makefile</code>.</p>
1.1       grant    11142:             </li>
                   11143: 
                   11144:             <li>
                   11145:               <p>Make the package compile, doing multiple rounds
                   11146:               of</p>
                   11147:               <pre class="screen">
1.14      xtraeme  11148: <code class="prompt">%</code> <strong class=
                   11149: "userinput"><code>make</code></strong>
                   11150: <code class="prompt">%</code> <strong class=
                   11151: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   11152: <code class="prompt">%</code> <strong class=
                   11153: "userinput"><code>mkpatches</code></strong>
                   11154: <code class="prompt">%</code> <strong class=
                   11155: "userinput"><code>patchdiff</code></strong>
                   11156: <code class="prompt">%</code> <strong class=
                   11157: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   11158: <code class="prompt">%</code> <strong class=
                   11159: "userinput"><code>make mps</code></strong>
                   11160: <code class="prompt">%</code> <strong class=
                   11161: "userinput"><code>make clean</code></strong>
1.1       grant    11162: </pre>
                   11163: 
                   11164:               <p>Doing as non-root user will ensure that no files
                   11165:               are modified that shouldn't be, especially during the
1.14      xtraeme  11166:               build phase. <span><strong class=
                   11167:               "command">mkpatches</strong></span>,
                   11168:               <span><strong class=
                   11169:               "command">patchdiff</strong></span> and
                   11170:               <span><strong class="command">pkgvi</strong></span>
                   11171:               are from the <a xmlns=
1.1       grant    11172:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   11173:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      11174:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    11175:             </li>
                   11176: 
                   11177:             <li>
1.14      xtraeme  11178:               <p>Look at the <code class=
                   11179:               "filename">Makefile</code>, fix if necessary; see
                   11180:               <a href="#components.Makefile" title=
1.27    ! rillig   11181:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
1.14      xtraeme  11182:               &#8220;<code class=
                   11183:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    11184:             </li>
                   11185: 
                   11186:             <li>
1.14      xtraeme  11187:               <p>Generate a <code class=
                   11188:               "filename">PLIST</code>:</p>
1.1       grant    11189:               <pre class="screen">
1.14      xtraeme  11190: <code class="prompt">#</code> <strong class=
                   11191: "userinput"><code>make install</code></strong>
                   11192: <code class="prompt">#</code> <strong class=
                   11193: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   11194: <code class="prompt">#</code> <strong class=
                   11195: "userinput"><code>make deinstall</code></strong>
                   11196: <code class="prompt">#</code> <strong class=
                   11197: "userinput"><code>make install</code></strong>
                   11198: <code class="prompt">#</code> <strong class=
                   11199: "userinput"><code>make deinstall</code></strong>
1.1       grant    11200: </pre>
                   11201: 
1.14      xtraeme  11202:               <p>You usually need to be <code class=
                   11203:               "username">root</code> to do this. Look if there are
1.1       grant    11204:               any files left:</p>
                   11205:               <pre class="screen">
1.14      xtraeme  11206: <code class="prompt">#</code> <strong class=
                   11207: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    11208: </pre>
                   11209: 
                   11210:               <p>If this reveals any files that are missing in
1.14      xtraeme  11211:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    11212:             </li>
                   11213: 
                   11214:             <li>
1.14      xtraeme  11215:               <p>Now that the <code class="filename">PLIST</code>
                   11216:               is OK, install the package again and make a binary
1.1       grant    11217:               package:</p>
                   11218:               <pre class="screen">
1.14      xtraeme  11219: <code class="prompt">#</code> <strong class=
                   11220: "userinput"><code>make reinstall</code></strong>
                   11221: <code class="prompt">#</code> <strong class=
                   11222: "userinput"><code>make package</code></strong>
1.1       grant    11223: </pre>
                   11224:             </li>
                   11225: 
                   11226:             <li>
                   11227:               <p>Delete the installed package:</p>
                   11228:               <pre class="screen">
1.14      xtraeme  11229: <code class="prompt">#</code> <strong class=
                   11230: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    11231: </pre>
                   11232:             </li>
                   11233: 
                   11234:             <li>
1.14      xtraeme  11235:               <p>Repeat the above <span><strong class=
                   11236:               "command">make print-PLIST</strong></span> command,
                   11237:               which shouldn't find anything now:</p>
1.1       grant    11238:               <pre class="screen">
1.14      xtraeme  11239: <code class="prompt">#</code> <strong class=
                   11240: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    11241: </pre>
                   11242:             </li>
                   11243: 
                   11244:             <li>
                   11245:               <p>Reinstall the binary package:</p>
                   11246:               <pre class="screen">
1.14      xtraeme  11247: <code class="prompt">#</code> <strong class=
                   11248: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    11249: </pre>
                   11250:             </li>
                   11251: 
                   11252:             <li>
                   11253:               <p>Play with it. Make sure everything works.</p>
                   11254:             </li>
                   11255: 
                   11256:             <li>
1.14      xtraeme  11257:               <p>Run <span><strong class=
                   11258:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    11259:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   11260:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      11261:               class="pkgname">pkgtools/pkglint</a>, and fix the
                   11262:               problems it reports:</p>
1.1       grant    11263:               <pre class="screen">
1.14      xtraeme  11264: <code class="prompt">#</code> <strong class=
                   11265: "userinput"><code>pkglint</code></strong>
1.1       grant    11266: </pre>
                   11267:             </li>
                   11268: 
                   11269:             <li>
                   11270:               <p>Submit (or commit, if you have cvs access); see
                   11271:               <a href="#submit" title=
1.25      rillig   11272:               "Chapter&nbsp;15.&nbsp;Submitting and Committing">Chapter&nbsp;15,
1.1       grant    11273:               <i>Submitting and Committing</i></a>.</p>
                   11274:             </li>
                   11275:           </ul>
                   11276:         </div>
                   11277:       </div>
                   11278: 
                   11279:       <div class="chapter" lang="en" xml:lang="en">
                   11280:         <div class="titlepage">
                   11281:           <div>
                   11282:             <div>
                   11283:               <h2 class="title"><a name="submit" id=
1.25      rillig   11284:               "submit"></a>Chapter&nbsp;15.&nbsp;Submitting and
1.1       grant    11285:               Committing</h2>
                   11286:             </div>
                   11287:           </div>
                   11288:         </div>
                   11289: 
                   11290:         <div class="toc">
                   11291:           <p><b>Table of Contents</b></p>
                   11292: 
                   11293:           <dl>
1.27    ! rillig   11294:             <dt><span class="sect1"><a href="#id2636739">15.1.
1.1       grant    11295:             Submitting your packages</a></span></dt>
                   11296: 
1.27    ! rillig   11297:             <dt><span class="sect1"><a href="#id2636796">15.2.
1.1       grant    11298:             Committing: Importing a package into
                   11299:             CVS</a></span></dt>
                   11300: 
1.27    ! rillig   11301:             <dt><span class="sect1"><a href="#id2636859">15.3.
1.2       hubertf  11302:             Updating a package to a newer version</a></span></dt>
1.1       grant    11303: 
1.27    ! rillig   11304:             <dt><span class="sect1"><a href="#id2636878">15.4.
1.2       hubertf  11305:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    11306:           </dl>
                   11307:         </div>
                   11308: 
                   11309:         <div class="sect1" lang="en" xml:lang="en">
                   11310:           <div class="titlepage">
                   11311:             <div>
                   11312:               <div>
                   11313:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   11314:                 "id2636739" id=
        !          11315:                 "id2636739"></a>15.1.&nbsp;Submitting your
1.1       grant    11316:                 packages</h2>
                   11317:               </div>
                   11318:             </div>
                   11319:           </div>
                   11320: 
                   11321:           <p>You have to separate between binary and
                   11322:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   11323:           packages here:</p>
                   11324: 
                   11325:           <div class="itemizedlist">
                   11326:             <ul type="disc">
                   11327:               <li>
                   11328:                 <p>precompiled binary packages</p>
                   11329: 
                   11330:                 <p>Our policy is that we accept binaries only from
                   11331:                 pkgsrc developers to guarantee that the packages
                   11332:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  11333:                 annoy anyone but rather to protect our users!
1.1       grant    11334:                 You're still free to put up your home-made binary
1.13      hubertf  11335:                 packages and tell the world where to get them.
                   11336:                 NetBSD developers doing bulk builds and wanting to
                   11337:                 upload them please see <a href="#bulk-upload"
                   11338:                 title="5.3.8.&nbsp;Uploading results of a bulk build">
                   11339:                 Section&nbsp;5.3.8, &#8220;Uploading results of a
                   11340:                 bulk build&#8221;</a>.</p>
1.1       grant    11341:               </li>
                   11342: 
                   11343:               <li>
                   11344:                 <p>packages</p>
                   11345: 
                   11346:                 <p>First, check that your package is complete,
                   11347:                 compiles and runs well; see <a href="#debug" title=
1.25      rillig   11348:                 "Chapter&nbsp;14.&nbsp;Debugging">Chapter&nbsp;14,
1.1       grant    11349:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      11350:                 Next, generate an uuencoded gzipped <a href=
                   11351:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   11352:                 <span class="citerefentry"><span class=
                   11353:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    11354:                 preferably with all files in a single directory.
1.14      xtraeme  11355:                 Finally, <span><strong class=
                   11356:                 "command">send-pr</strong></span> with category
1.1       grant    11357:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   11358:                 synopsis which includes the package name and
                   11359:                 version number, a short description of your package
                   11360:                 (contents of the COMMENT variable or DESCR file are
                   11361:                 OK) and attach the archive to your PR.</p>
                   11362: 
                   11363:                 <p>If you want to submit several packages, please
                   11364:                 send a separate PR for each one, it's easier for us
                   11365:                 to track things that way.</p>
                   11366: 
                   11367:                 <p>Alternatively, you can also import new packages
                   11368:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   11369:                 work-in-progress</span>&#8221;); see the homepage
                   11370:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   11371:                 target=
                   11372:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   11373:                 details.</p>
                   11374:               </li>
                   11375:             </ul>
                   11376:           </div>
                   11377:         </div>
                   11378: 
                   11379:         <div class="sect1" lang="en" xml:lang="en">
                   11380:           <div class="titlepage">
                   11381:             <div>
                   11382:               <div>
                   11383:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   11384:                 "id2636796" id=
        !          11385:                 "id2636796"></a>15.2.&nbsp;Committing: Importing a
1.1       grant    11386:                 package into CVS</h2>
                   11387:               </div>
                   11388:             </div>
                   11389:           </div>
                   11390: 
                   11391:           <p>This section is only of interest for pkgsrc developers
                   11392:           with write access to the pkgsrc repository. Please
                   11393:           remember that cvs imports files relative to the current
                   11394:           working directory, and that the pathname that you give
1.14      xtraeme  11395:           the <span><strong class="command">cvs
                   11396:           import</strong></span> command is so that it knows where
                   11397:           to place the files in the repository. Newly created
                   11398:           packages should be imported with a vendor tag of
                   11399:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   11400:           release tag of &#8220;<span class=
                   11401:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    11402:           <pre class="programlisting">
                   11403:   % cd .../pkgsrc/category/pkgname
                   11404:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   11405: </pre>
                   11406: 
                   11407:           <p>Remember to move the directory from which you imported
                   11408:           out of the way, or cvs will complain the next time you
                   11409:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   11410:           source tree. Also don't forget to add the new package to
1.14      xtraeme  11411:           the category's <code class=
                   11412:           "filename">Makefile</code>.</p>
1.1       grant    11413: 
                   11414:           <p>The commit message of the initial import should
1.14      xtraeme  11415:           include part of the <code class="filename">DESCR</code>
                   11416:           file, so people reading the mailing lists know what the
                   11417:           package is/does.</p>
1.1       grant    11418: 
                   11419:           <p>Please note all package updates/additions in
1.14      xtraeme  11420:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
                   11421:           very important to keep this file up to date and
                   11422:           conforming to the existing format, because it will be
                   11423:           used by scripts to automatically update pages on <a href=
1.1       grant    11424:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   11425:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   11426:           file and remove the entry for the package you updated, in
                   11427:           case it was mentioned there.</p>
                   11428: 
                   11429:           <p>For new packages, &#8220;<span class="quote">cvs
                   11430:           import</span>&#8221; is preferred to &#8220;<span class=
                   11431:           "quote">cvs add</span>&#8221; because the former gets
                   11432:           everything with a single command, and provides a
                   11433:           consistent tag.</p>
                   11434:         </div>
                   11435: 
                   11436:         <div class="sect1" lang="en" xml:lang="en">
                   11437:           <div class="titlepage">
                   11438:             <div>
                   11439:               <div>
                   11440:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   11441:                 "id2636859" id="id2636859"></a>15.3.&nbsp;Updating
1.2       hubertf  11442:                 a package to a newer version</h2>
1.1       grant    11443:               </div>
                   11444:             </div>
                   11445:           </div>
                   11446: 
                   11447:           <p>Please always put a concise, appropriate and relevant
                   11448:           summary of the changes between old and new versions into
                   11449:           the commit log when updating a package. There are various
                   11450:           reasons for this:</p>
                   11451: 
                   11452:           <div class="itemizedlist">
                   11453:             <ul type="disc">
                   11454:               <li>
                   11455:                 <p>A URL is volatile, and can change over time. It
                   11456:                 may go away completely or its information may be
                   11457:                 overwritten by newer information.</p>
                   11458:               </li>
                   11459: 
                   11460:               <li>
                   11461:                 <p>Having the change information between old and
                   11462:                 new versions in our CVS repository is very useful
                   11463:                 for people who use either cvs or anoncvs.</p>
                   11464:               </li>
                   11465: 
                   11466:               <li>
                   11467:                 <p>Having the change information between old and
                   11468:                 new versions in our CVS repository is very useful
                   11469:                 for people who read the pkgsrc-changes mailing
                   11470:                 list, so that they can make tactical decisions
                   11471:                 about when to upgrade the package.</p>
                   11472:               </li>
                   11473:             </ul>
                   11474:           </div>
                   11475: 
1.18      xtraeme  11476:           <p>Please also recognize that, just because a new version
1.1       grant    11477:           of a package has been released, it should not
                   11478:           automatically be upgraded in the CVS repository. We
                   11479:           prefer to be conservative in the packages that are
                   11480:           included in pkgsrc - development or beta packages are not
                   11481:           really the best thing for most places in which pkgsrc is
                   11482:           used. Please use your judgement about what should go into
                   11483:           pkgsrc, and bear in mind that stability is to be
                   11484:           preferred above new and possibly untested features.</p>
                   11485:         </div>
                   11486: 
                   11487:         <div class="sect1" lang="en" xml:lang="en">
                   11488:           <div class="titlepage">
                   11489:             <div>
                   11490:               <div>
                   11491:                 <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   11492:                 "id2636878" id="id2636878"></a>15.4.&nbsp;Moving a
1.2       hubertf  11493:                 package in pkgsrc</h2>
1.1       grant    11494:               </div>
                   11495:             </div>
                   11496:           </div>
                   11497: 
                   11498:           <div class="orderedlist">
                   11499:             <ol type="1">
                   11500:               <li>
                   11501:                 <p>Make a copy of the directory somewhere else.</p>
                   11502:               </li>
                   11503: 
                   11504:               <li>
                   11505:                 <p>Remove all CVS dirs.</p>
                   11506: 
                   11507:                 <p>Alternatively to the first two steps you can
                   11508:                 also do:</p>
                   11509:                 <pre class="screen">
1.14      xtraeme  11510: <code class="prompt">%</code> <strong class=
                   11511: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    11512: </pre>
                   11513: 
                   11514:                 <p>and use that for further work.</p>
                   11515:               </li>
                   11516: 
                   11517:               <li>
1.14      xtraeme  11518:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   11519:                 any <code class="varname">DEPENDS</code> paths that
                   11520:                 just did &#8220;<span class=
1.1       grant    11521:                 "quote">../package</span>&#8221; instead of
                   11522:                 &#8220;<span class=
                   11523:                 "quote">../../category/package</span>&#8221;.</p>
                   11524:               </li>
                   11525: 
                   11526:               <li>
1.14      xtraeme  11527:                 <p><span><strong class="command">cvs
                   11528:                 import</strong></span> the modified package in the
                   11529:                 new place.</p>
1.1       grant    11530:               </li>
                   11531: 
                   11532:               <li>
                   11533:                 <p>Check if any package depends on it:</p>
                   11534:                 <pre class="screen">
1.14      xtraeme  11535: <code class="prompt">%</code> <strong class=
                   11536: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   11537: <code class="prompt">%</code> <strong class=
                   11538: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    11539: </pre>
                   11540:               </li>
                   11541: 
                   11542:               <li>
                   11543:                 <p>Fix paths in packages from step 5 to point to
                   11544:                 new location.</p>
                   11545:               </li>
                   11546: 
                   11547:               <li>
1.14      xtraeme  11548:                 <p><span><strong class="command">cvs rm
                   11549:                 (-f)</strong></span> the package at the old
                   11550:                 location.</p>
1.1       grant    11551:               </li>
                   11552: 
                   11553:               <li>
1.14      xtraeme  11554:                 <p>Remove from <code class=
                   11555:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    11556:               </li>
                   11557: 
                   11558:               <li>
1.14      xtraeme  11559:                 <p>Add to <code class=
                   11560:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    11561:               </li>
                   11562: 
                   11563:               <li>
                   11564:                 <p>Commit the changed and removed files:</p>
                   11565:                 <pre class="screen">
1.14      xtraeme  11566: <code class="prompt">%</code> <strong class=
                   11567: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    11568: </pre>
                   11569: 
                   11570:                 <p>(and any packages from step 5, of course).</p>
                   11571:               </li>
                   11572:             </ol>
                   11573:           </div>
                   11574:         </div>
                   11575:       </div>
                   11576:     </div>
                   11577: 
                   11578:     <div class="appendix" lang="en" xml:lang="en">
                   11579:       <div class="titlepage">
                   11580:         <div>
                   11581:           <div>
                   11582:             <h2 class="title"><a name="examples" id=
                   11583:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   11584:             package: bison</h2>
                   11585:           </div>
                   11586:         </div>
                   11587:       </div>
                   11588: 
                   11589:       <div class="toc">
                   11590:         <p><b>Table of Contents</b></p>
                   11591: 
                   11592:         <dl>
1.27    ! rillig   11593:           <dt><span class="sect1"><a href="#id2637036">A.1.
1.1       grant    11594:           files</a></span></dt>
                   11595: 
                   11596:           <dd>
                   11597:             <dl>
1.27    ! rillig   11598:               <dt><span class="sect2"><a href="#id2637040">A.1.1.
1.1       grant    11599:               Makefile</a></span></dt>
                   11600: 
1.27    ! rillig   11601:               <dt><span class="sect2"><a href="#id2637047">A.1.2.
1.1       grant    11602:               DESCR</a></span></dt>
                   11603: 
1.27    ! rillig   11604:               <dt><span class="sect2"><a href="#id2637062">A.1.3.
1.1       grant    11605:               PLIST</a></span></dt>
                   11606: 
1.27    ! rillig   11607:               <dt><span class="sect2"><a href="#id2637069">A.1.4.
1.14      xtraeme  11608:               Checking a package with <span><strong class=
                   11609:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    11610:             </dl>
                   11611:           </dd>
                   11612: 
1.27    ! rillig   11613:           <dt><span class="sect1"><a href="#id2637110">A.2. Steps
1.1       grant    11614:           for building, installing, packaging</a></span></dt>
                   11615:         </dl>
                   11616:       </div>
                   11617: 
                   11618:       <p>We checked to find a piece of software that wasn't in the
                   11619:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  11620:       would want to have <span><strong class=
                   11621:       "command">bison</strong></span> when Berkeley
                   11622:       <span><strong class="command">yacc</strong></span> is already
                   11623:       present in the tree is beyond us, but it's useful for the
                   11624:       purposes of this exercise.</p>
1.1       grant    11625: 
                   11626:       <div class="sect1" lang="en" xml:lang="en">
                   11627:         <div class="titlepage">
                   11628:           <div>
                   11629:             <div>
                   11630:               <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   11631:               "id2637036" id="id2637036"></a>A.1.&nbsp;files</h2>
1.1       grant    11632:             </div>
                   11633:           </div>
                   11634:         </div>
                   11635: 
                   11636:         <div class="sect2" lang="en" xml:lang="en">
                   11637:           <div class="titlepage">
                   11638:             <div>
                   11639:               <div>
1.27    ! rillig   11640:                 <h3 class="title"><a name="id2637040" id=
        !          11641:                 "id2637040"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    11642:               </div>
                   11643:             </div>
                   11644:           </div>
                   11645:           <pre class="programlisting">
1.17      sketch   11646: # $NetBSD$
1.1       grant    11647: #
                   11648: 
                   11649: DISTNAME=       bison-1.25
                   11650: CATEGORIES=     devel
                   11651: MASTER_SITES=   ${MASTER_SITE_GNU}
                   11652: 
                   11653: MAINTAINER=     thorpej@NetBSD.org
                   11654: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   11655: COMMENT=        GNU yacc clone
                   11656: 
                   11657: GNU_CONFIGURE=  yes
                   11658: INFO_FILES=     bison.info
                   11659: 
                   11660: .include "../../mk/bsd.pkg.mk"
                   11661: </pre>
                   11662:         </div>
                   11663: 
                   11664:         <div class="sect2" lang="en" xml:lang="en">
                   11665:           <div class="titlepage">
                   11666:             <div>
                   11667:               <div>
1.27    ! rillig   11668:                 <h3 class="title"><a name="id2637047" id=
        !          11669:                 "id2637047"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    11670:               </div>
                   11671:             </div>
                   11672:           </div>
                   11673:           <pre class="programlisting">
                   11674: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   11675: improvements.  Why you would want this when Berkeley <a href=
                   11676: "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
                   11677: of the NetBSD source tree is beyond me.
                   11678: </pre>
                   11679:         </div>
                   11680: 
                   11681:         <div class="sect2" lang="en" xml:lang="en">
                   11682:           <div class="titlepage">
                   11683:             <div>
                   11684:               <div>
1.27    ! rillig   11685:                 <h3 class="title"><a name="id2637062" id=
        !          11686:                 "id2637062"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    11687:               </div>
                   11688:             </div>
                   11689:           </div>
                   11690:           <pre class="programlisting">
1.17      sketch   11691: @comment $NetBSD$
1.1       grant    11692: bin/bison
                   11693: man/man1/bison.1.gz
                   11694: share/bison.simple
                   11695: share/bison.hairy
                   11696: </pre>
                   11697:         </div>
                   11698: 
                   11699:         <div class="sect2" lang="en" xml:lang="en">
                   11700:           <div class="titlepage">
                   11701:             <div>
                   11702:               <div>
1.27    ! rillig   11703:                 <h3 class="title"><a name="id2637069" id=
        !          11704:                 "id2637069"></a>A.1.4.&nbsp;Checking a package with
1.14      xtraeme  11705:                 <span><strong class=
                   11706:                 "command">pkglint</strong></span></h3>
1.1       grant    11707:               </div>
                   11708:             </div>
                   11709:           </div>
                   11710: 
                   11711:           <p>The NetBSD package system comes with <a xmlns=
                   11712:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   11713:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      11714:           class="pkgname">pkgtools/pkglint</a> which helps to check
                   11715:           the contents of these files. After installation it is
                   11716:           quite easy to use, just change to the directory of the
                   11717:           package you wish to examine and execute
                   11718:           <span><strong class=
                   11719:           "command">pkglint</strong></span>:</p>
1.1       grant    11720:           <pre class="screen">
1.14      xtraeme  11721: <code class="prompt">$</code> <strong class=
                   11722: "userinput"><code>pkglint</code></strong>
1.1       grant    11723: looks fine.
                   11724: </pre>
                   11725: 
                   11726:           <p>Depending on the supplied command line arguments (see
                   11727:           pkglint(1)) more verbose checks will be performed. Use
1.14      xtraeme  11728:           e.g. <span><strong class="command">pkglint
                   11729:           -v</strong></span> for a very verbose check.</p>
1.1       grant    11730:         </div>
                   11731:       </div>
                   11732: 
                   11733:       <div class="sect1" lang="en" xml:lang="en">
                   11734:         <div class="titlepage">
                   11735:           <div>
                   11736:             <div>
                   11737:               <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   11738:               "id2637110" id="id2637110"></a>A.2.&nbsp;Steps for
1.1       grant    11739:               building, installing, packaging</h2>
                   11740:             </div>
                   11741:           </div>
                   11742:         </div>
                   11743: 
                   11744:         <p>Create the directory where the package lives, plus any
                   11745:         auxiliary directories:</p>
                   11746:         <pre class="screen">
1.14      xtraeme  11747: <code class="prompt">#</code> <strong class=
                   11748: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   11749: <code class="prompt">#</code> <strong class=
                   11750: "userinput"><code>mkdir bison</code></strong>
                   11751: <code class="prompt">#</code> <strong class=
                   11752: "userinput"><code>cd bison</code></strong>
                   11753: <code class="prompt">#</code> <strong class=
                   11754: "userinput"><code>mkdir patches</code></strong>
1.1       grant    11755: </pre>
                   11756: 
1.14      xtraeme  11757:         <p>Create <code class="filename">Makefile</code>,
                   11758:         <code class="filename">DESCR</code> and <code class=
                   11759:         "filename">PLIST</code> (see <a href="#components" title=
1.27    ! rillig   11760:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
        !          11761:         Chapter 7, <i>Package components - files, directories and
1.1       grant    11762:         contents</i></a>) then continue with fetching the
                   11763:         distfile:</p>
                   11764:         <pre class="screen">
1.14      xtraeme  11765: <code class="prompt">#</code> <strong class=
                   11766: "userinput"><code>make fetch</code></strong>
1.1       grant    11767: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   11768: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   11769: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11770: ftp: Error retrieving file: 500 Internal error
                   11771: 
                   11772: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   11773: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11774: ftp: Error retrieving file: 500 Internal error
                   11775: 
                   11776: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   11777: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11778: Successfully retrieved file.
                   11779: </pre>
                   11780: 
1.14      xtraeme  11781:         <p>Generate the checksum of the distfile into <code class=
                   11782:         "filename">distinfo</code>:</p>
1.1       grant    11783:         <pre class="screen">
1.14      xtraeme  11784: <code class="prompt">#</code> <strong class=
                   11785: "userinput"><code>make makesum</code></strong>
1.1       grant    11786: </pre>
                   11787: 
                   11788:         <p>Now compile:</p>
                   11789:         <pre class="screen">
1.14      xtraeme  11790: <code class="prompt">#</code> <strong class=
                   11791: "userinput"><code>make</code></strong>
1.1       grant    11792: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11793: ===&gt;  Extracting for bison-1.25
                   11794: ===&gt;  Patching for bison-1.25
                   11795: ===&gt;   Ignoring empty patch directory
                   11796: ===&gt;  Configuring for bison-1.25
                   11797: creating cache ./config.cache
                   11798: checking for gcc... cc
                   11799: checking whether we are using GNU C... yes
                   11800: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   11801: checking how to run the C preprocessor... cc -E
                   11802: checking for minix/config.h... no
                   11803: checking for POSIXized ISC... no
                   11804: checking whether cross-compiling... no
                   11805: checking for ANSI C header files... yes
                   11806: checking for string.h... yes
                   11807: checking for stdlib.h... yes
                   11808: checking for memory.h... yes
                   11809: checking for working const... yes
                   11810: checking for working alloca.h... no
                   11811: checking for alloca... yes
                   11812: checking for strerror... yes
                   11813: updating cache ./config.cache
                   11814: creating ./config.status
                   11815: creating Makefile
                   11816: ===&gt;  Building for bison-1.25
                   11817: 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
                   11818: 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
                   11819: 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
                   11820: 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
                   11821: 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
                   11822: 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 
                   11823: 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
                   11824: 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
                   11825: 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
                   11826: 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
                   11827: 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
                   11828: 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
                   11829: 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
                   11830: 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
                   11831: 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
                   11832: 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
                   11833: 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
                   11834: 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
                   11835: 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
                   11836: 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
                   11837: 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
                   11838: 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
                   11839: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   11840: rm -f bison.s1
                   11841: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   11842: </pre>
                   11843: 
                   11844:         <p>Everything seems OK, so install the files:</p>
                   11845:         <pre class="screen">
1.14      xtraeme  11846: <code class="prompt">#</code> <strong class=
                   11847: "userinput"><code>make install</code></strong>
1.1       grant    11848: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11849: ===&gt;  Installing for bison-1.25
                   11850: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   11851: rm -f /usr/pkg/bin/bison
                   11852: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   11853: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   11854: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   11855: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   11856: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   11857: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   11858: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   11859: ===&gt;  Registering installation for bison-1.25
                   11860: </pre>
                   11861: 
                   11862:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  11863:         remove it with <span><strong class="command">pkg_delete
                   11864:         bison</strong></span>. Should you decide that you want a
                   11865:         binary package, do this now:</p>
1.1       grant    11866:         <pre class="screen">
1.14      xtraeme  11867: <code class="prompt">#</code> <strong class=
                   11868: "userinput"><code>make package</code></strong>
1.1       grant    11869: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11870: ===&gt;  Building package for bison-1.25
                   11871: Creating package bison-1.25.tgz
                   11872: Registering depends:.
                   11873: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   11874: </pre>
                   11875: 
                   11876:         <p>Now that you don't need the source and object files any
                   11877:         more, clean up:</p>
                   11878:         <pre class="screen">
1.14      xtraeme  11879: <code class="prompt">#</code> <strong class=
                   11880: "userinput"><code>make clean</code></strong>
1.1       grant    11881: ===&gt;  Cleaning for bison-1.25
                   11882: </pre>
                   11883:       </div>
                   11884:     </div>
                   11885: 
                   11886:     <div class="appendix" lang="en" xml:lang="en">
                   11887:       <div class="titlepage">
                   11888:         <div>
                   11889:           <div>
                   11890:             <h2 class="title"><a name="logs" id=
                   11891:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   11892:           </div>
                   11893:         </div>
                   11894:       </div>
                   11895: 
                   11896:       <div class="toc">
                   11897:         <p><b>Table of Contents</b></p>
                   11898: 
                   11899:         <dl>
                   11900:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   11901:           Building figlet</a></span></dt>
                   11902: 
                   11903:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   11904:           Packaging figlet</a></span></dt>
                   11905:         </dl>
                   11906:       </div>
                   11907: 
                   11908:       <div class="sect1" lang="en" xml:lang="en">
                   11909:         <div class="titlepage">
                   11910:           <div>
                   11911:             <div>
                   11912:               <h2 class="title" style="clear: both"><a name=
                   11913:               "logs.building" id=
                   11914:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   11915:             </div>
                   11916:           </div>
                   11917:         </div>
                   11918:         <pre class="screen">
1.14      xtraeme  11919: <code class="prompt">#</code> <strong class=
                   11920: "userinput"><code>make</code></strong>
1.1       grant    11921: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11922: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   11923: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   11924: =&gt; [172219 bytes]
                   11925: Connected to ftp.plig.net.
                   11926: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   11927: 331 Guest login ok, send your complete e-mail address as password.
                   11928: 230-You are user #5 of 500 simultaneous users allowed.
                   11929: 230-
                   11930: 230-  ___ _             _ _                   
                   11931: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   11932: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   11933: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   11934: 230-         |_|   |_|     |___|         |___|
                   11935: 230-
                   11936: 230-** Welcome to ftp.plig.org **
                   11937: 230-
                   11938: 230-Please note that all transfers from this FTP site are logged. If you
                   11939: 230-do not like this, please disconnect now.
                   11940: 230-
                   11941: 230-This arhive is available via
                   11942: 230-
                   11943: 230-HTTP:  http://ftp.plig.org/
                   11944: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   11945: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   11946: 230-
                   11947: 230-Please email comments, bug reports and requests for packages to be
                   11948: 230-mirrored to ftp-admin@plig.org.   
                   11949: 230-
                   11950: 230-
                   11951: 230 Logged in anonymously.
                   11952: Remote system type is UNIX.
                   11953: Using binary mode to transfer files.
                   11954: 200 Type okay.
                   11955: 250 "/pub" is new cwd.
                   11956: 250-"/pub/figlet" is new cwd.
                   11957: 250-
                   11958: 250-Welcome to the figlet archive at ftp.figlet.org
                   11959: 250-    
                   11960: 250-    ftp://ftp.figlet.org/pub/figlet/
                   11961: 250-
                   11962: 250-The official FIGlet web page is:
                   11963: 250-    http://www.figlet.org/
                   11964: 250-
                   11965: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   11966: 250-contribute a font or something else, you can email us.
                   11967: 250 
                   11968: 250 "/pub/figlet/program" is new cwd.
                   11969: 250 "/pub/figlet/program/unix" is new cwd.
                   11970: local: figlet221.tar.gz remote: figlet221.tar.gz
                   11971: 502 Unimplemented command.
                   11972: 227 Entering Passive Mode (195,40,6,41,246,104)
                   11973: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   11974: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   11975: 226 Transfer completed.
                   11976: 172219 bytes received in 00:02 (75.99 KB/s)
                   11977: 221 Goodbye.
                   11978: =&gt; Checksum OK for figlet221.tar.gz.
                   11979: ===&gt; Extracting for figlet-2.2.1nb2
                   11980: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   11981: ===&gt; Patching for figlet-2.2.1nb2
                   11982: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   11983: ===&gt; Overriding tools for figlet-2.2.1nb2
                   11984: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   11985: ===&gt; Configuring for figlet-2.2.1nb2
                   11986: ===&gt; Building for figlet-2.2.1nb2
                   11987: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   11988: chmod a+x figlet
                   11989: gcc -O2 -o chkfont chkfont.c
                   11990: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  11991: <code class="prompt">#</code>
                   11992: <code class="prompt">#</code> <strong class=
                   11993: "userinput"><code>make install</code></strong>
1.1       grant    11994: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11995: ===&gt; Installing for figlet-2.2.1nb2
                   11996: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   11997: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   11998: mkdir -p /usr/pkg/share/figlet
                   11999: cp figlet /usr/pkg/bin
                   12000: cp chkfont /usr/pkg/bin
                   12001: chmod 555 figlist showfigfonts
                   12002: cp figlist /usr/pkg/bin
                   12003: cp showfigfonts /usr/pkg/bin
                   12004: cp fonts/*.flf /usr/pkg/share/figlet
                   12005: cp fonts/*.flc /usr/pkg/share/figlet
                   12006: cp figlet.6 /usr/pkg/man/man6
                   12007: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  12008: <code class="prompt">#</code>
1.1       grant    12009: </pre>
                   12010:       </div>
                   12011: 
                   12012:       <div class="sect1" lang="en" xml:lang="en">
                   12013:         <div class="titlepage">
                   12014:           <div>
                   12015:             <div>
                   12016:               <h2 class="title" style="clear: both"><a name=
                   12017:               "logs.package" id=
                   12018:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   12019:             </div>
                   12020:           </div>
                   12021:         </div>
                   12022:         <pre class="screen">
1.14      xtraeme  12023: <code class="prompt">#</code> <strong class=
                   12024: "userinput"><code>make package</code></strong>
1.1       grant    12025: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   12026: ===&gt; Packaging figlet-2.2.1nb2
                   12027: ===&gt; Building binary package for figlet-2.2.1nb2
                   12028: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   12029: Using SrcDir value of /usr/pkg
                   12030: Registering depends:.  
1.14      xtraeme  12031: <code class="prompt">#</code>
1.1       grant    12032: </pre>
                   12033:       </div>
                   12034:     </div>
                   12035: 
                   12036:     <div class="appendix" lang="en" xml:lang="en">
                   12037:       <div class="titlepage">
                   12038:         <div>
                   12039:           <div>
                   12040:             <h2 class="title"><a name="ftp-layout" id=
                   12041:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   12042:             FTP server's package archive</h2>
                   12043:           </div>
                   12044:         </div>
                   12045:       </div>
                   12046: 
                   12047:       <p>Layout for precompiled binary packages on
                   12048:       ftp.NetBSD.org:</p>
                   12049:       <pre class="programlisting">
                   12050: /pub/NetBSD/packages/
                   12051:                 distfiles/
                   12052: 
                   12053:                 # Unpacked pkgsrc trees
                   12054:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   12055:                 pkgsrc-2003Q4 -&gt; N/A
                   12056:                 pkgsrc-2004Q1/pkgsrc
                   12057: 
                   12058:                 # pkgsrc archives
                   12059:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   12060:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   12061:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   12062: 
                   12063:                 # Per pkgsrc-release/OS-release/arch package archives
                   12064:                 pkgsrc-2003Q4/
                   12065:                         NetBSD-1.6.2/
                   12066:                                 i386/
                   12067:                                         All/
                   12068:                                         archivers/
                   12069:                                                 foo -&gt; ../All/foo
                   12070:                                         ...
                   12071:                 pkgsrc-2004Q1/
                   12072:                         NetBSD-1.6.2/
                   12073:                                 i386/
                   12074:                                         All/
                   12075:                                         ...
                   12076:                         NetBSD-2.0/
                   12077:                                 i386/
                   12078:                                         All/
                   12079:                                         ...
                   12080:                         SunOS-5.9/
                   12081:                                 sparc/
                   12082:                                         All/
                   12083:                                         ...
                   12084:                                 x86/
                   12085:                                         All/
                   12086:                                         ...
                   12087: 
                   12088:                 # Per os-release package archive convenience links
                   12089:                 NetBSD-1.6.2 -&gt; 1.6.2
                   12090:                 1.6.2/
                   12091:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   12092:                         m68k/
                   12093:                                 All/
                   12094:                                 archivers/
                   12095:                                         foo -&gt; ../All/foo
                   12096:                                 ...
                   12097:                         amiga -&gt; m68k
                   12098:                         atari -&gt; m68k
                   12099:                         ...
                   12100: 
                   12101:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   12102:                 NetBSD-2.0/
                   12103:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   12104:                 SunOS-5.9/
                   12105:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   12106:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   12107:                         
                   12108: </pre>
                   12109: 
                   12110:       <p>To create:</p>
                   12111: 
                   12112:       <div class="orderedlist">
                   12113:         <ol type="1">
                   12114:           <li>
                   12115:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   12116:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   12117:             5.3, &#8220;Doing a bulk build of all
                   12118:             packages&#8221;</a></p>
                   12119:           </li>
                   12120: 
                   12121:           <li>
                   12122:             <p>Upload /usr/pkgsrc/packages to</p>
                   12123:             <pre class="programlisting">
                   12124:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  12125:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    12126:         `uname -s`-`uname -r`/                  # OS &amp; version
                   12127:         `uname -p`                              # architecture
                   12128:        
                   12129: </pre>
                   12130:           </li>
                   12131: 
                   12132:           <li>
1.14      xtraeme  12133:             <p>If necessary, create a symlink <span><strong class=
                   12134:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   12135:             (amiga -&gt; m68k, ...)</p>
1.1       grant    12136:           </li>
                   12137:         </ol>
                   12138:       </div>
                   12139:     </div>
1.2       hubertf  12140: 
                   12141:     <div class="appendix" lang="en" xml:lang="en">
                   12142:       <div class="titlepage">
                   12143:         <div>
                   12144:           <div>
                   12145:             <h2 class="title"><a name="editing" id=
                   12146:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   12147:             for the pkgsrc guide</h2>
                   12148:           </div>
                   12149:         </div>
                   12150:       </div>
                   12151: 
                   12152:       <div class="toc">
                   12153:         <p><b>Table of Contents</b></p>
                   12154: 
                   12155:         <dl>
1.27    ! rillig   12156:           <dt><span class="sect1"><a href="#id2637893">D.1.
1.2       hubertf  12157:           Targets</a></span></dt>
                   12158: 
1.27    ! rillig   12159:           <dt><span class="sect1"><a href="#id2637958">D.2.
1.2       hubertf  12160:           Procedure</a></span></dt>
                   12161:         </dl>
                   12162:       </div>
                   12163: 
                   12164:       <p>This section contains information on editing the pkgsrc
                   12165:       guide itself.</p>
                   12166: 
                   12167:       <div class="sect1" lang="en" xml:lang="en">
                   12168:         <div class="titlepage">
                   12169:           <div>
                   12170:             <div>
                   12171:               <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   12172:               "id2637893" id="id2637893"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  12173:             </div>
                   12174:           </div>
                   12175:         </div>
                   12176: 
1.14      xtraeme  12177:         <p>The pkgsrc guide's source code is stored in <code class=
                   12178:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  12179:         are created from it:</p>
                   12180: 
                   12181:         <div class="itemizedlist">
                   12182:           <ul type="disc">
                   12183:             <li>
1.14      xtraeme  12184:               <p><code class=
1.23      wiz      12185:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  12186:             </li>
                   12187: 
                   12188:             <li>
1.14      xtraeme  12189:               <p><code class=
                   12190:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  12191:             </li>
                   12192: 
                   12193:             <li>
1.14      xtraeme  12194:               <p><code class=
                   12195:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  12196:               the documentation on the NetBSD website will be built
                   12197:               from pkgsrc and kept up to date on the web server
                   12198:               itself. This means you <span class=
                   12199:               "emphasis"><em>must</em></span> make sure that your
                   12200:               changes haven't broken the build!</p>
                   12201:             </li>
1.6       hubertf  12202: 
                   12203:             <li>
1.14      xtraeme  12204:               <p><code class=
                   12205:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  12206:               PDF version of the pkgsrc guide.</p>
                   12207:             </li>
                   12208: 
                   12209:             <li>
1.14      xtraeme  12210:               <p><code class=
                   12211:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  12212:               PostScript version of the pkgsrc guide.</p>
                   12213:             </li>
1.2       hubertf  12214:           </ul>
                   12215:         </div>
                   12216:       </div>
                   12217: 
                   12218:       <div class="sect1" lang="en" xml:lang="en">
                   12219:         <div class="titlepage">
                   12220:           <div>
                   12221:             <div>
                   12222:               <h2 class="title" style="clear: both"><a name=
1.27    ! rillig   12223:               "id2637958" id=
        !          12224:               "id2637958"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  12225:             </div>
                   12226:           </div>
                   12227:         </div>
                   12228: 
                   12229:         <p>The procedure to edit the pkgsrc guide is:</p>
                   12230: 
                   12231:         <div class="itemizedlist">
                   12232:           <ul type="disc">
                   12233:             <li>
1.6       hubertf  12234:               <p>Make sure you have the packages needed to
                   12235:               re-generate the pkgsrc guide (and other XML-based
                   12236:               NetBSD documentation) installed. These are
1.11      ben      12237:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  12238:               for creating the ASCII- and HTML-version, and
                   12239:               &#8220;<span class=
1.11      ben      12240:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  12241:               PostScript- and PDF version. You will need both
                   12242:               packages installed, to make sure documentation is
                   12243:               consistent across all formats. The packages can be
1.14      xtraeme  12244:               found in <code class=
                   12245:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
                   12246:               <code class=
                   12247:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  12248:             </li>
                   12249: 
                   12250:             <li>
1.14      xtraeme  12251:               <p>Edit the XML file(s) in <code class=
                   12252:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  12253:             </li>
                   12254: 
                   12255:             <li>
1.14      xtraeme  12256:               <p>Run <span><strong class="command">make extract
                   12257:               &amp;&amp; make do-lint</strong></span> in
                   12258:               <code class="filename">pkgsrc/doc/guide</code> to
                   12259:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  12260:             </li>
                   12261: 
                   12262:             <li>
1.14      xtraeme  12263:               <p>Run <span><strong class=
                   12264:               "command">make</strong></span> in <code class=
                   12265:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   12266:               and ASCII version.</p>
1.2       hubertf  12267:             </li>
                   12268: 
                   12269:             <li>
1.14      xtraeme  12270:               <p>If all is well, run <span><strong class=
                   12271:               "command">make install-doc</strong></span> to put the
                   12272:               generated files into <code class=
                   12273:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  12274:             </li>
                   12275: 
                   12276:             <li>
1.14      xtraeme  12277:               <p><span><strong class="command">cvs commit
                   12278:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  12279:             </li>
                   12280: 
                   12281:             <li>
1.14      xtraeme  12282:               <p><span><strong class="command">cvs commit -m
                   12283:               re-generate
                   12284:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  12285:             </li>
1.4       hubertf  12286: 
                   12287:             <li>
                   12288:               <p>Until the webserver on www.NetBSD.org is really
                   12289:               updated automatically to pick up changes to the
1.14      xtraeme  12290:               pkgsrc guide automatically, also run
1.18      xtraeme  12291:               <span><strong class="command">make install-htdocs
1.14      xtraeme  12292:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   12293:               similar, adjust <code class=
                   12294:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  12295:             </li>
                   12296: 
                   12297:             <li>
1.14      xtraeme  12298:               <p><span><strong class="command">cvs commit
                   12299:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  12300:             </li>
1.2       hubertf  12301:           </ul>
                   12302:         </div>
                   12303:       </div>
                   12304:     </div>
1.1       grant    12305:   </div>
                   12306: </body>
                   12307: </html>

CVSweb <webmaster@jp.NetBSD.org>