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

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.28    ! rillig    545:                 <dt><span class="sect1"><a href="#id2631338">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.28    ! rillig    559:                 <dt><span class="sect1"><a href="#id2632835">13.1.
1.1       grant     560:                 General operation</a></span></dt>
                    561: 
                    562:                 <dd>
                    563:                   <dl>
                    564:                     <dt><span class="sect2"><a href=
1.28    ! rillig    565:                     "#id2632838">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.28    ! rillig    569:                     "#id2632921">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.28    ! rillig    577:                     "#id2633374">13.1.4. Handling conflicts with
1.1       grant     578:                     other packages</a></span></dt>
                    579: 
                    580:                     <dt><span class="sect2"><a href=
1.28    ! rillig    581:                     "#id2633493">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.28    ! rillig    585:                     "#id2633518">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.28    ! rillig    593:                     "#id2633678">13.1.8. How to handle compiler
1.1       grant     594:                     bugs</a></span></dt>
                    595: 
                    596:                     <dt><span class="sect2"><a href=
1.28    ! rillig    597:                     "#id2633701">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.28    ! rillig    602:                     "#id2633818">13.1.10. Portability of
1.1       grant     603:                     packages</a></span></dt>
                    604:                   </dl>
                    605:                 </dd>
                    606: 
1.28    ! rillig    607:                 <dt><span class="sect1"><a href="#id2633843">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.28    ! rillig    613:                     "#id2633846">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.28    ! rillig    618:                     "#id2633909">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.28    ! rillig    623:                 <dt><span class="sect1"><a href="#id2633921">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.28    ! rillig    633:                     "#id2634286">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.28    ! rillig    638:                     "#id2634504">13.3.3. GNU
1.1       grant     639:                     Autoconf/Automake</a></span></dt>
                    640:                   </dl>
                    641:                 </dd>
                    642: 
1.28    ! rillig    643:                 <dt><span class="sect1"><a href="#id2634617">13.4.
1.1       grant     644:                 Building considerations</a></span></dt>
                    645: 
                    646:                 <dd>
                    647:                   <dl>
                    648:                     <dt><span class="sect2"><a href=
1.28    ! rillig    649:                     "#id2634620">13.4.1. CPP
1.1       grant     650:                     defines</a></span></dt>
                    651:                   </dl>
                    652:                 </dd>
                    653: 
1.28    ! rillig    654:                 <dt><span class="sect1"><a href="#id2634650">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.28    ! rillig    660:                     "#id2634653">13.5.1. Package configuration
1.1       grant     661:                     files</a></span></dt>
                    662: 
                    663:                     <dt><span class="sect2"><a href=
1.28    ! rillig    664:                     "#id2634756">13.5.2. User
1.2       hubertf   665:                     interaction</a></span></dt>
1.1       grant     666: 
                    667:                     <dt><span class="sect2"><a href=
1.28    ! rillig    668:                     "#id2634801">13.5.3. Handling
1.1       grant     669:                     licenses</a></span></dt>
                    670: 
                    671:                     <dt><span class="sect2"><a href=
1.28    ! rillig    672:                     "#id2634884">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.28    ! rillig    676:                     "#id2635014">13.5.5. Installing score
1.1       grant     677:                     files</a></span></dt>
                    678: 
                    679:                     <dt><span class="sect2"><a href=
1.28    ! rillig    680:                     "#id2635058">13.5.6. Packages providing login
1.1       grant     681:                     shells</a></span></dt>
                    682: 
                    683:                     <dt><span class="sect2"><a href=
1.28    ! rillig    684:                     "#id2635115">13.5.7. Packages containing perl
1.1       grant     685:                     scripts</a></span></dt>
                    686: 
                    687:                     <dt><span class="sect2"><a href=
1.28    ! rillig    688:                     "#id2635133">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.28    ! rillig    692:                     "#id2635155">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.28    ! rillig    700:                     "#id2635511">13.5.11. Packages installing
1.1       grant     701:                     GConf2 data files</a></span></dt>
                    702: 
                    703:                     <dt><span class="sect2"><a href=
1.28    ! rillig    704:                     "#id2635680">13.5.12. Packages installing
1.1       grant     705:                     scrollkeeper data files</a></span></dt>
                    706: 
                    707:                     <dt><span class="sect2"><a href=
1.28    ! rillig    708:                     "#id2635731">13.5.13. Packages installing X11
1.1       grant     709:                     fonts</a></span></dt>
                    710: 
                    711:                     <dt><span class="sect2"><a href=
1.28    ! rillig    712:                     "#id2635778">13.5.14. Packages installing GTK2
1.1       grant     713:                     modules</a></span></dt>
                    714: 
                    715:                     <dt><span class="sect2"><a href=
1.28    ! rillig    716:                     "#id2635847">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.28    ! rillig    720:                     "#id2635899">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.28    ! rillig    724:                     "#id2636038">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.28    ! rillig    728:                     "#id2636052">13.5.18. Packages installing
1.18      xtraeme   729:                     startup scripts</a></span></dt>
1.1       grant     730:                   </dl>
                    731:                 </dd>
                    732: 
1.28    ! rillig    733:                 <dt><span class="sect1"><a href="#id2636073">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.28    ! rillig    746:                 <dt><span class="sect1"><a href="#id2636740">15.1.
1.1       grant     747:                 Submitting your packages</a></span></dt>
                    748: 
1.28    ! rillig    749:                 <dt><span class="sect1"><a href="#id2636797">15.2.
1.1       grant     750:                 Committing: Importing a package into
                    751:                 CVS</a></span></dt>
                    752: 
1.28    ! rillig    753:                 <dt><span class="sect1"><a href="#id2636860">15.3.
1.2       hubertf   754:                 Updating a package to a newer
                    755:                 version</a></span></dt>
1.1       grant     756: 
1.28    ! rillig    757:                 <dt><span class="sect1"><a href="#id2636880">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.28    ! rillig    769:             <dt><span class="sect1"><a href="#id2637037">A.1.
1.1       grant     770:             files</a></span></dt>
                    771: 
                    772:             <dd>
                    773:               <dl>
1.28    ! rillig    774:                 <dt><span class="sect2"><a href="#id2637041">A.1.1.
1.1       grant     775:                 Makefile</a></span></dt>
                    776: 
1.28    ! rillig    777:                 <dt><span class="sect2"><a href="#id2637048">A.1.2.
1.1       grant     778:                 DESCR</a></span></dt>
                    779: 
1.28    ! rillig    780:                 <dt><span class="sect2"><a href="#id2637063">A.1.3.
1.1       grant     781:                 PLIST</a></span></dt>
                    782: 
1.28    ! rillig    783:                 <dt><span class="sect2"><a href="#id2637070">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.28    ! rillig    789:             <dt><span class="sect1"><a href="#id2637111">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.28    ! rillig    815:             <dt><span class="sect1"><a href="#id2637894">D.1.
1.2       hubertf   816:             Targets</a></span></dt>
                    817: 
1.28    ! rillig    818:             <dt><span class="sect1"><a href="#id2637959">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.28    ! rillig   4987:               <dt><span class="sect1"><a href="#id2631338">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.28    ! rillig   5001:               <dt><span class="sect1"><a href="#id2632835">13.1.
1.1       grant    5002:               General operation</a></span></dt>
                   5003: 
                   5004:               <dd>
                   5005:                 <dl>
                   5006:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5007:                   "#id2632838">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.28    ! rillig   5011:                   "#id2632921">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.28    ! rillig   5019:                   "#id2633374">13.1.4. Handling conflicts with
1.1       grant    5020:                   other packages</a></span></dt>
                   5021: 
                   5022:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5023:                   "#id2633493">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.28    ! rillig   5027:                   "#id2633518">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.28    ! rillig   5035:                   "#id2633678">13.1.8. How to handle compiler
1.1       grant    5036:                   bugs</a></span></dt>
                   5037: 
                   5038:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5039:                   "#id2633701">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.28    ! rillig   5044:                   "#id2633818">13.1.10. Portability of
1.1       grant    5045:                   packages</a></span></dt>
                   5046:                 </dl>
                   5047:               </dd>
                   5048: 
1.28    ! rillig   5049:               <dt><span class="sect1"><a href="#id2633843">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.28    ! rillig   5055:                   "#id2633846">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.28    ! rillig   5060:                   "#id2633909">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.28    ! rillig   5065:               <dt><span class="sect1"><a href="#id2633921">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.28    ! rillig   5075:                   "#id2634286">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.28    ! rillig   5080:                   "#id2634504">13.3.3. GNU
1.1       grant    5081:                   Autoconf/Automake</a></span></dt>
                   5082:                 </dl>
                   5083:               </dd>
                   5084: 
1.28    ! rillig   5085:               <dt><span class="sect1"><a href="#id2634617">13.4.
1.1       grant    5086:               Building considerations</a></span></dt>
                   5087: 
                   5088:               <dd>
                   5089:                 <dl>
                   5090:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5091:                   "#id2634620">13.4.1. CPP defines</a></span></dt>
1.1       grant    5092:                 </dl>
                   5093:               </dd>
                   5094: 
1.28    ! rillig   5095:               <dt><span class="sect1"><a href="#id2634650">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.28    ! rillig   5101:                   "#id2634653">13.5.1. Package configuration
1.1       grant    5102:                   files</a></span></dt>
                   5103: 
                   5104:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5105:                   "#id2634756">13.5.2. User
1.2       hubertf  5106:                   interaction</a></span></dt>
1.1       grant    5107: 
                   5108:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5109:                   "#id2634801">13.5.3. Handling
1.1       grant    5110:                   licenses</a></span></dt>
                   5111: 
                   5112:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5113:                   "#id2634884">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.28    ! rillig   5117:                   "#id2635014">13.5.5. Installing score
1.1       grant    5118:                   files</a></span></dt>
                   5119: 
                   5120:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5121:                   "#id2635058">13.5.6. Packages providing login
1.1       grant    5122:                   shells</a></span></dt>
                   5123: 
                   5124:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5125:                   "#id2635115">13.5.7. Packages containing perl
1.1       grant    5126:                   scripts</a></span></dt>
                   5127: 
                   5128:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5129:                   "#id2635133">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.28    ! rillig   5133:                   "#id2635155">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.28    ! rillig   5141:                   "#id2635511">13.5.11. Packages installing GConf2
1.1       grant    5142:                   data files</a></span></dt>
                   5143: 
                   5144:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5145:                   "#id2635680">13.5.12. Packages installing
1.1       grant    5146:                   scrollkeeper data files</a></span></dt>
                   5147: 
                   5148:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5149:                   "#id2635731">13.5.13. Packages installing X11
1.1       grant    5150:                   fonts</a></span></dt>
                   5151: 
                   5152:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5153:                   "#id2635778">13.5.14. Packages installing GTK2
1.1       grant    5154:                   modules</a></span></dt>
                   5155: 
                   5156:                   <dt><span class="sect2"><a href=
1.28    ! rillig   5157:                   "#id2635847">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.28    ! rillig   5161:                   "#id2635899">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.28    ! rillig   5165:                   "#id2636038">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.28    ! rillig   5169:                   "#id2636052">13.5.18. Packages installing startup
1.18      xtraeme  5170:                   scripts</a></span></dt>
1.1       grant    5171:                 </dl>
                   5172:               </dd>
                   5173: 
1.28    ! rillig   5174:               <dt><span class="sect1"><a href="#id2636073">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.28    ! rillig   5187:               <dt><span class="sect1"><a href="#id2636740">15.1.
1.1       grant    5188:               Submitting your packages</a></span></dt>
                   5189: 
1.28    ! rillig   5190:               <dt><span class="sect1"><a href="#id2636797">15.2.
1.1       grant    5191:               Committing: Importing a package into
                   5192:               CVS</a></span></dt>
                   5193: 
1.28    ! rillig   5194:               <dt><span class="sect1"><a href="#id2636860">15.3.
1.2       hubertf  5195:               Updating a package to a newer version</a></span></dt>
1.1       grant    5196: 
1.28    ! rillig   5197:               <dt><span class="sect1"><a href="#id2636880">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: 
1.28    ! rillig   7710:           <p>The first section contains the information about which
        !          7711:           build options are supported by the package, and any
1.1       grant    7712:           default options settings if needed.</p>
                   7713: 
                   7714:           <div class="orderedlist">
                   7715:             <ol type="1">
                   7716:               <li>
1.14      xtraeme  7717:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
1.27      rillig   7718:                 the name of the <a href=
1.1       grant    7719:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7720:                 <span class="citerefentry"><span class=
1.27      rillig   7721:                 "refentrytitle">make</span>(1)</span></a> variable
                   7722:                 that contains the options the user wishes to
                   7723:                 select. The recommended value is
                   7724:                 &#8220;<span class="quote">PKG_OPTIONS.<em class=
1.14      xtraeme  7725:                 "replaceable"><code>pkg</code></em></span>&#8221;
                   7726:                 but any package-specific value may be used. This
1.1       grant    7727:                 variable should be set in a package Makefile.</p>
                   7728:               </li>
                   7729: 
                   7730:               <li>
1.14      xtraeme  7731:                 <p><code class=
                   7732:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
                   7733:                 build options supported by the package. This
                   7734:                 variable should be set in a package Makefile.</p>
1.1       grant    7735:               </li>
                   7736: 
                   7737:               <li>
1.27      rillig   7738:                 <p><code class=
                   7739:                 "varname">PKG_SUGGESTED_OPTIONS</code> is a list of
                   7740:                 build options which are enabled by default.</p>
                   7741:               </li>
                   7742: 
                   7743:               <li>
1.14      xtraeme  7744:                 <p><code class="varname">${PKG_OPTIONS_VAR}</code>
1.27      rillig   7745:                 (the variable named in <code class=
                   7746:                 "varname">PKG_OPTIONS_VAR</code>) lists the
                   7747:                 selected build options and overrides any default
                   7748:                 options given in <code class=
1.14      xtraeme  7749:                 "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1       grant    7750:                 options begin with a &#8220;<span class=
                   7751:                 "quote">-</span>&#8221;, then that option is always
                   7752:                 removed from the selected build options, e.g.</p>
                   7753:                 <pre class="programlisting">
                   7754:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   7755:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   7756:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
1.28    ! rillig   7757:         # leads to PKG_OPTIONS = kerberos ldap
1.1       grant    7758:           
                   7759: </pre>
                   7760: 
                   7761:                 <p>or</p>
                   7762:                 <pre class="programlisting">
                   7763:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   7764:         WIBBLE_OPTIONS=         kerberos -ldap ldap
1.28    ! rillig   7765:         # leads to PKG_OPTIONS = kerberos
1.1       grant    7766:           
                   7767: </pre>
                   7768: 
1.14      xtraeme  7769:                 <p>This variable should be set in <code class=
                   7770:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    7771:               </li>
                   7772: 
                   7773:               <li>
1.28    ! rillig   7774:                 <p>The <code class=
        !          7775:                 "varname">PKG_OPTIONS_LEGACY_VARS</code> is only
        !          7776:                 needed if you are converting a package that had its
        !          7777:                 own ad-hoc options handling to use <code class=
        !          7778:                 "filename">bsd.options.mk</code>. It converts
        !          7779:                 global or legacy options variables into an
        !          7780:                 equivalent <code class=
        !          7781:                 "varname">PKG_OPTIONS.<em class=
        !          7782:                 "replaceable"><code>pkg</code></em></code>
        !          7783:                 value.</p>
1.1       grant    7784:               </li>
1.28    ! rillig   7785:             </ol>
1.1       grant    7786:           </div>
                   7787: 
1.28    ! rillig   7788:           <p>After the inclusion of bsd.options.mk, the variable
        !          7789:           <code class="varname">PKG_OPTIONS</code> contains the
        !          7790:           list of the selected build options, properly filtered to
        !          7791:           remove unsupported and duplicate options.</p>
        !          7792: 
1.1       grant    7793:           <p>The remaining sections contain the logic that is
                   7794:           specific to each option. There should be a check for
1.14      xtraeme  7795:           every option listed in <code class=
                   7796:           "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
                   7797:           be clear documentation on what turning on the option will
                   7798:           do in the comments preceding each section. The correct
                   7799:           way to check for an option is to check whether it is
                   7800:           listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1       grant    7801:         </div>
                   7802:       </div>
                   7803: 
                   7804:       <div class="chapter" lang="en" xml:lang="en">
                   7805:         <div class="titlepage">
                   7806:           <div>
                   7807:             <div>
                   7808:               <h2 class="title"><a name="build" id=
1.25      rillig   7809:               "build"></a>Chapter&nbsp;12.&nbsp;The build
1.1       grant    7810:               process</h2>
                   7811:             </div>
                   7812:           </div>
                   7813:         </div>
                   7814: 
                   7815:         <div class="toc">
                   7816:           <p><b>Table of Contents</b></p>
                   7817: 
                   7818:           <dl>
1.25      rillig   7819:             <dt><span class="sect1"><a href="#build.prefix">12.1.
1.1       grant    7820:             Program location</a></span></dt>
                   7821: 
1.28    ! rillig   7822:             <dt><span class="sect1"><a href="#id2631338">12.2. Main
1.1       grant    7823:             targets</a></span></dt>
                   7824: 
                   7825:             <dt><span class="sect1"><a href=
1.25      rillig   7826:             "#build.helpful-targets">12.3. Other helpful
1.1       grant    7827:             targets</a></span></dt>
                   7828:           </dl>
                   7829:         </div>
                   7830: 
                   7831:         <p>The basic steps for building a program are always the
                   7832:         same. First the program's source (<span class=
                   7833:         "emphasis"><em>distfile</em></span>) must be brought to the
                   7834:         local system and then extracted. After any patches to
                   7835:         compile properly on NetBSD are applied, the software can be
                   7836:         configured, then built (usually by compiling), and finally
                   7837:         the generated binaries, etc. can be put into place on the
                   7838:         system. These are exactly the steps performed by the NetBSD
                   7839:         package system, which is implemented as a series of targets
1.14      xtraeme  7840:         in a central Makefile, <code class=
                   7841:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    7842: 
                   7843:         <div class="sect1" lang="en" xml:lang="en">
                   7844:           <div class="titlepage">
                   7845:             <div>
                   7846:               <div>
                   7847:                 <h2 class="title" style="clear: both"><a name=
                   7848:                 "build.prefix" id=
1.25      rillig   7849:                 "build.prefix"></a>12.1.&nbsp;Program location</h2>
1.1       grant    7850:               </div>
                   7851:             </div>
                   7852:           </div>
                   7853: 
                   7854:           <p>Before outlining the process performed by the NetBSD
                   7855:           package system in the next section, here's a brief
                   7856:           discussion on where programs are installed, and which
                   7857:           variables influence this.</p>
                   7858: 
1.14      xtraeme  7859:           <p>The automatic variable <code class=
                   7860:           "varname">PREFIX</code> indicates where all files of the
                   7861:           final program shall be installed. It is usually set to
                   7862:           <code class="varname">LOCALBASE</code> (<code class=
                   7863:           "filename">/usr/pkg</code>), or <code class=
                   7864:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    7865:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  7866:           The value of <code class="varname">PREFIX</code> needs to
                   7867:           be put into the various places in the program's source
                   7868:           where paths to these files are encoded. See <a href=
1.1       grant    7869:           "#components.patches" title=
1.27      rillig   7870:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
1.1       grant    7871:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   7872:           title=
1.25      rillig   7873:           "13.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;13.3.1,
1.1       grant    7874:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   7875:           details.</p>
                   7876: 
                   7877:           <p>When choosing which of these variables to use, follow
                   7878:           the following rules:</p>
                   7879: 
                   7880:           <div class="itemizedlist">
                   7881:             <ul type="disc">
                   7882:               <li>
1.14      xtraeme  7883:                 <p><code class="varname">PREFIX</code> always
                   7884:                 points to the location where the current pkg will
                   7885:                 be installed. When referring to a pkg's own
1.1       grant    7886:                 installation path, use &#8220;<span class=
                   7887:                 "quote">${PREFIX}</span>&#8221;.</p>
                   7888:               </li>
                   7889: 
                   7890:               <li>
1.14      xtraeme  7891:                 <p><code class="varname">LOCALBASE</code> is where
                   7892:                 all non-X11 pkgs are installed. If you need to
1.1       grant    7893:                 construct a -I or -L argument to the compiler to
                   7894:                 find includes and libraries installed by another
                   7895:                 non-X11 pkg, use &#8220;<span class=
                   7896:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   7897:               </li>
                   7898: 
                   7899:               <li>
1.14      xtraeme  7900:                 <p><code class="varname">X11BASE</code> is where
                   7901:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    7902:                 installed. When looking for <span class=
                   7903:                 "emphasis"><em>standard</em></span> X11 includes
                   7904:                 (not those installed by a pkg), use
                   7905:                 &#8220;<span class=
                   7906:                 "quote">${X11BASE}</span>&#8221;.</p>
                   7907:               </li>
                   7908: 
                   7909:               <li>
                   7910:                 <p>X11 based are special in that they may be
1.14      xtraeme  7911:                 installed in either <code class=
                   7912:                 "varname">X11BASE</code> or <code class=
                   7913:                 "varname">LOCALBASE</code>.</p>
1.1       grant    7914: 
                   7915:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  7916:                 <code class="varname">LOCALBASE</code> whenever
                   7917:                 possible. Note that you will need to set
                   7918:                 <code class="varname">USE_X11</code> in them to
                   7919:                 request the presence of X11 and to get the right
                   7920:                 compilation flags.</p>
1.1       grant    7921: 
                   7922:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  7923:                 be installed under <code class=
                   7924:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    7925:                 app-defaults files. These packages are special and
1.14      xtraeme  7926:                 they must be placed under <code class=
                   7927:                 "varname">X11BASE</code>. To accomplish this, set
                   7928:                 either <code class="varname">USE_X11BASE</code> or
                   7929:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    7930:                 package.</p>
                   7931: 
1.14      xtraeme  7932:                 <p>Some notes: <code class="varname">USE_X11</code>
                   7933:                 and <code class="varname">USE_X11BASE</code> are
                   7934:                 mutually exclusive. If you need to find includes or
                   7935:                 libraries installed by a pkg that has <code class=
                   7936:                 "varname">USE_IMAKE</code> or <code class=
                   7937:                 "varname">USE_X11BASE</code> in its pkg
                   7938:                 <code class="filename">Makefile</code>, you need to
                   7939:                 use <span class="emphasis"><em>both</em></span>
                   7940:                 <code class="filename">${X11BASE}</code> and
                   7941:                 <code class="filename">${LOCALBASE}</code>. To
                   7942:                 force installation of all X11 packages in
                   7943:                 <code class="varname">LOCALBASE</code>, the
                   7944:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7945:                 href=
1.1       grant    7946:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.20      ben      7947:                 class="pkgname">pkgtools/xpkgwedge</a> is enabled
                   7948:                 by default.</p>
1.1       grant    7949:               </li>
                   7950: 
                   7951:               <li>
1.14      xtraeme  7952:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    7953:                 used to refer to the installed location of an X11
1.14      xtraeme  7954:                 package. <code class="varname">X11PREFIX</code>
                   7955:                 will be set to <code class="varname">X11BASE</code>
                   7956:                 if xpkgwedge is not installed, and to <code class=
                   7957:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    7958:                 installed.</p>
                   7959:               </li>
                   7960: 
                   7961:               <li>
                   7962:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  7963:                 have some packages installed in <code class=
                   7964:                 "varname">X11BASE</code> and some in <code class=
                   7965:                 "varname">LOCALBASE</code>. To determine the prefix
                   7966:                 of an installed package, the <code class=
                   7967:                 "varname">EVAL_PREFIX</code> definition can be
                   7968:                 used. It takes pairs in the format
                   7969:                 &#8220;<span class=
1.1       grant    7970:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.24      wiz      7971:                 the <a href=
                   7972:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7973:                 <span class="citerefentry"><span class=
                   7974:                 "refentrytitle">make</span>(1)</span></a> variable
                   7975:                 <code class="varname">DIRNAME</code> will be set to
                   7976:                 the prefix of the installed package
                   7977:                 &lt;package&gt;, or &#8220;<span class=
1.1       grant    7978:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   7979:                 is not installed.</p>
                   7980: 
                   7981:                 <p>This is best illustrated by example.</p>
                   7982: 
1.14      xtraeme  7983:                 <p>The following lines are taken from <code class=
                   7984:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    7985:                 <pre class="programlisting">
1.14      xtraeme  7986: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    7987: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   7988:                         --with-gtk-prefix="${GTKDIR}"           \
                   7989:                         --enable-multibyte
                   7990: </pre>
                   7991: 
                   7992:                 <p>Specific defaults can be defined for the
1.14      xtraeme  7993:                 packages evaluated using <code class=
                   7994:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    7995:                 of the form:</p>
                   7996:                 <pre class="programlisting">
                   7997: GTKDIR_DEFAULT= ${LOCALBASE}
                   7998: </pre>
                   7999: 
1.14      xtraeme  8000:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    8001:                 corresponds to the first definition in the
1.14      xtraeme  8002:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    8003:               </li>
                   8004: 
                   8005:               <li>
1.14      xtraeme  8006:                 <p>Within <code class="filename">${PREFIX}</code>,
1.24      wiz      8007:                 packages should install files according to <a href=
                   8008:                 "http://netbsd.gw.com/cgi-bin/man-cgi?hier+7+NetBSD-current">
                   8009:                 <span class="citerefentry"><span class=
                   8010:                 "refentrytitle">hier</span>(7)</span></a>, with the
                   8011:                 exception that manual pages go into <code class=
                   8012:                 "filename">${PREFIX}/man</code>, not <code class=
1.14      xtraeme  8013:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    8014:               </li>
                   8015:             </ul>
                   8016:           </div>
                   8017:         </div>
                   8018: 
                   8019:         <div class="sect1" lang="en" xml:lang="en">
                   8020:           <div class="titlepage">
                   8021:             <div>
                   8022:               <div>
                   8023:                 <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   8024:                 "id2631338" id="id2631338"></a>12.2.&nbsp;Main
1.1       grant    8025:                 targets</h2>
                   8026:               </div>
                   8027:             </div>
                   8028:           </div>
                   8029: 
                   8030:           <p>The main targets used during the build process defined
1.14      xtraeme  8031:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    8032: 
                   8033:           <div class="variablelist">
                   8034:             <dl>
                   8035:               <dt><span class="term">fetch</span></dt>
                   8036: 
                   8037:               <dd>
                   8038:                 <p>This will check if the file(s) given in the
1.14      xtraeme  8039:                 variables <code class="varname">DISTFILES</code>
                   8040:                 and <code class="varname">PATCHFILES</code> (as
                   8041:                 defined in the package's Makefile) are present on
                   8042:                 the local system in <code class=
                   8043:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   8044:                 are not present, an attempt will be made to fetch
                   8045:                 them using commands of the form:</p>
1.1       grant    8046:                 <pre class="programlisting">
                   8047: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   8048: </pre>
                   8049: 
                   8050:                 <p>where ${site} varies through several
1.14      xtraeme  8051:                 possibilities in turn: first, <code class=
                   8052:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   8053:                 then the sites specified in either <code class=
                   8054:                 "varname">SITES_file</code> if defined, else
                   8055:                 <code class="varname">MASTER_SITES</code> or
                   8056:                 <code class="varname">PATCH_SITES</code>, as
                   8057:                 applies, then finally the value of <code class=
                   8058:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   8059:                 all except the first can be optionally sorted by
                   8060:                 the user, via setting either <code class=
                   8061:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   8062:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    8063:               </dd>
                   8064: 
                   8065:               <dt><span class="term">checksum</span></dt>
                   8066: 
                   8067:               <dd>
                   8068:                 <p>After the distfile(s) are fetched, their
                   8069:                 checksum is generated and compared with the
                   8070:                 checksums stored in the distinfo file. If the
                   8071:                 checksums don't match, the build is aborted. This
                   8072:                 is to ensure the same distfile is used for
                   8073:                 building, and that the distfile wasn't changed,
                   8074:                 e.g. by some malign force, deliberately changed
                   8075:                 distfiles on the master distribution site or
                   8076:                 network lossage.</p>
                   8077:               </dd>
                   8078: 
                   8079:               <dt><span class="term">extract</span></dt>
                   8080: 
                   8081:               <dd>
                   8082:                 <p>When the distfiles are present on the local
                   8083:                 system, they need to be extracted, as they are
                   8084:                 usually in the form of some compressed archive
1.14      xtraeme  8085:                 format, most commonly <code class=
                   8086:                 "filename">.tar.gz</code>.</p>
1.1       grant    8087: 
                   8088:                 <p>If only some of the distfiles need to be
                   8089:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  8090:                 be put into <code class=
                   8091:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    8092: 
1.14      xtraeme  8093:                 <p>If the distfiles are not in <code class=
                   8094:                 "filename">.tar.gz</code> format, they can be
                   8095:                 extracted by setting either <code class=
                   8096:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   8097:                 "varname">EXTRACT_CMD</code>, <code class=
                   8098:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   8099:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   8100:                 the former case, pkgsrc knows how to extract a
                   8101:                 number of suffixes (<code class=
                   8102:                 "filename">.tar.gz</code>, <code class=
                   8103:                 "filename">.tgz</code>, <code class=
                   8104:                 "filename">.tar.gz2</code>, <code class=
                   8105:                 "filename">.tbz</code>, <code class=
                   8106:                 "filename">.tar.Z</code>, <code class=
                   8107:                 "filename">.tar</code>, <code class=
                   8108:                 "filename">.shar.gz</code>, <code class=
                   8109:                 "filename">.shar.bz2</code>, <code class=
                   8110:                 "filename">.shar.Z</code>, <code class=
                   8111:                 "filename">.shar</code>, <code class=
                   8112:                 "filename">.Z</code>, <code class=
                   8113:                 "filename">.bz2</code> and <code class=
                   8114:                 "filename">.gz</code>; see the definition of the
                   8115:                 various <code class="varname">DECOMPRESS_CMD</code>
                   8116:                 variables <code class="filename">bsd.pkg.mk</code>
                   8117:                 for a complete list). Here's an example on how to
                   8118:                 use the other variables for a program that comes
                   8119:                 with a compressed shell archive whose name ends in
                   8120:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    8121:                 <pre class="programlisting">
                   8122:      EXTRACT_SUFX=   .msg.gz
                   8123:      EXTRACT_CMD=            zcat
                   8124:      EXTRACT_BEFORE_ARGS=
                   8125:      EXTRACT_AFTER_ARGS=     |sh
                   8126: </pre>
                   8127:               </dd>
                   8128: 
                   8129:               <dt><span class="term">patch</span></dt>
                   8130: 
                   8131:               <dd>
                   8132:                 <p>After extraction, all the patches named by the
1.14      xtraeme  8133:                 <code class="varname">PATCHFILES</code>, those
                   8134:                 present in the patches subdirectory of the package
                   8135:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
                   8136:                 <code class=
                   8137:                 "filename">/usr/local/patches/graphics/png</code>)
                   8138:                 are applied. Patchfiles ending in <code class=
                   8139:                 "filename">.Z</code> or <code class=
                   8140:                 "filename">.gz</code> are uncompressed before they
                   8141:                 are applied, files ending in <code class=
                   8142:                 "filename">.orig</code> or <code class=
                   8143:                 "filename">.rej</code> are ignored. Any special
1.24      wiz      8144:                 options to <a href=
                   8145:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   8146:                 <span class="citerefentry"><span class=
                   8147:                 "refentrytitle">patch</span>(1)</span></a> can be
                   8148:                 handed in <code class=
1.14      xtraeme  8149:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   8150:                 "#components.patches" title=
1.27      rillig   8151:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
1.1       grant    8152:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   8153: 
1.24      wiz      8154:                 <p>By default <a href=
                   8155:                 "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   8156:                 <span class="citerefentry"><span class=
                   8157:                 "refentrytitle">patch</span>(1)</span></a> is given
                   8158:                 special args to make it fail if the patches apply
                   8159:                 with some lines of fuzz. Please fix (regen) the
                   8160:                 patches so that they apply cleanly. The rationale
                   8161:                 behind this is that patches that don't apply
                   8162:                 cleanly may end up being applied in the wrong
                   8163:                 place, and cause severe harm there.</p>
1.1       grant    8164:               </dd>
                   8165: 
                   8166:               <dt><span class="term">configure</span></dt>
                   8167: 
                   8168:               <dd>
                   8169:                 <p>Most pieces of software need information on the
                   8170:                 header files, system calls, and library routines
                   8171:                 which are available in NetBSD. This is the process
                   8172:                 known as configuration, and is usually automated.
                   8173:                 In most cases, a script is supplied with the
                   8174:                 source, and its invocation results in generation of
                   8175:                 header files, Makefiles, etc.</p>
                   8176: 
                   8177:                 <p>If the program's distfile contains its own
                   8178:                 configure script, this can be invoked by setting
1.14      xtraeme  8179:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    8180:                 configure script is a GNU autoconf script,
1.14      xtraeme  8181:                 <code class="varname">GNU_CONFIGURE</code> should
                   8182:                 be specified instead. In either case, any arguments
                   8183:                 to the configure script can be specified in the
                   8184:                 <code class="varname">CONFIGURE_ARGS</code>
                   8185:                 variable, and the configure script's name can be
                   8186:                 set in <code class=
                   8187:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   8188:                 from the default &#8220;<span class=
1.1       grant    8189:                 "quote">configure</span>&#8221;. Here's an example
                   8190:                 from the <a xmlns=
                   8191:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8192:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.20      ben      8193:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    8194:                 <pre class="programlisting">
                   8195: HAS_CONFIGURE=          yes
                   8196: CONFIGURE_SCRIPT=       Configure
                   8197: CONFIGURE_ARGS+=        netbsd13
                   8198: </pre>
                   8199: 
                   8200:                 <p>If the program uses an Imakefile for
                   8201:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  8202:                 by setting <code class="varname">USE_IMAKE</code>
                   8203:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   8204:                 (If you only want the package installed in
                   8205:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   8206:                 not being run, set <code class=
                   8207:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    8208:               </dd>
                   8209: 
                   8210:               <dt><span class="term">build</span></dt>
                   8211: 
                   8212:               <dd>
                   8213:                 <p>Once configuration has taken place, the software
1.14      xtraeme  8214:                 will be built by invoking <code class=
                   8215:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   8216:                 "varname">$MAKEFILE</code> with <code class=
                   8217:                 "varname">$BUILD_TARGET</code> as the target to
                   8218:                 build. The default <code class=
                   8219:                 "varname">MAKE_PROGRAM</code> is
                   8220:                 &#8220;<span class="quote">gmake</span>&#8221; if
                   8221:                 <code class="varname">USE_GNU_TOOLS</code> contains
1.7       wiz      8222:                 &#8220;<span class="quote">make</span>&#8221;,
1.1       grant    8223:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  8224:                 otherwise. <code class="varname">MAKEFILE</code> is
                   8225:                 set to &#8220;<span class=
1.1       grant    8226:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  8227:                 <code class="varname">BUILD_TARGET</code> defaults
                   8228:                 to &#8220;<span class="quote">all</span>&#8221;.
                   8229:                 Any of these variables can be set in the package's
1.1       grant    8230:                 Makefile to change the default build process.</p>
                   8231:               </dd>
                   8232: 
                   8233:               <dt><span class="term">install</span></dt>
                   8234: 
                   8235:               <dd>
                   8236:                 <p>Once the build stage has completed, the final
                   8237:                 step is to install the software in public
                   8238:                 directories, so users can access the programs and
1.14      xtraeme  8239:                 files. As in the build-target, <code class=
                   8240:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   8241:                 <code class="varname">$MAKEFILE</code> here, but
                   8242:                 with the <code class=
                   8243:                 "varname">$INSTALL_TARGET</code> instead, the
                   8244:                 latter defaulting to &#8220;<span class=
                   8245:                 "quote">install</span>&#8221; (plus
                   8246:                 &#8220;<span class=
                   8247:                 "quote">install.man</span>&#8221;, if <code class=
                   8248:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    8249:               </dd>
                   8250:             </dl>
                   8251:           </div>
                   8252: 
                   8253:           <p>If no target is specified, the default is
                   8254:           &#8220;<span class="quote">build</span>&#8221;. If a
                   8255:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  8256:           e.g. <span><strong class="command">make
                   8257:           build</strong></span> will also perform the equivalent
                   8258:           of:</p>
1.1       grant    8259:           <pre class="programlisting">
                   8260: make fetch
                   8261: make checksum
                   8262: make extract
                   8263: make patch
                   8264: make configure
                   8265: make build
                   8266: </pre>
                   8267:         </div>
                   8268: 
                   8269:         <div class="sect1" lang="en" xml:lang="en">
                   8270:           <div class="titlepage">
                   8271:             <div>
                   8272:               <div>
                   8273:                 <h2 class="title" style="clear: both"><a name=
                   8274:                 "build.helpful-targets" id=
1.25      rillig   8275:                 "build.helpful-targets"></a>12.3.&nbsp;Other
1.1       grant    8276:                 helpful targets</h2>
                   8277:               </div>
                   8278:             </div>
                   8279:           </div>
                   8280: 
                   8281:           <div class="variablelist">
                   8282:             <dl>
                   8283:               <dt><span class="term">pre/post-*</span></dt>
                   8284: 
                   8285:               <dd>
                   8286:                 <p>For any of the main targets described in the
                   8287:                 previous section, two auxiliary targets exist with
                   8288:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   8289:                 &#8220;<span class="quote">post-</span>&#8221; used
                   8290:                 as a prefix for the main target's name. These
                   8291:                 targets are invoked before and after the main
                   8292:                 target is called, allowing extra configuration or
                   8293:                 installation steps be performed from a package's
                   8294:                 Makefile, for example, which a program's configure
                   8295:                 script or install target omitted.</p>
                   8296:               </dd>
                   8297: 
                   8298:               <dt><span class="term">do-*</span></dt>
                   8299: 
                   8300:               <dd>
                   8301:                 <p>Should one of the main targets do the wrong
                   8302:                 thing, and should there be no variable to fix this,
                   8303:                 you can redefine it with the do-* target. (Note
                   8304:                 that redefining the target itself instead of the
                   8305:                 do-* target is a bad idea, as the pre-* and post-*
                   8306:                 targets won't be called anymore, etc.) You will not
                   8307:                 usually need to do this.</p>
                   8308:               </dd>
                   8309: 
                   8310:               <dt><span class="term">reinstall</span></dt>
                   8311: 
                   8312:               <dd>
1.14      xtraeme  8313:                 <p>If you did a <span><strong class="command">make
                   8314:                 install</strong></span> and you noticed some file
                   8315:                 was not installed properly, you can repeat the
1.1       grant    8316:                 installation with this target, which will ignore
                   8317:                 the &#8220;<span class="quote">already
                   8318:                 installed</span>&#8221; flag.</p>
                   8319:               </dd>
                   8320: 
                   8321:               <dt><span class="term">deinstall</span></dt>
                   8322: 
                   8323:               <dd>
1.24      wiz      8324:                 <p>This target does a <a href=
                   8325:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8326:                 <span class="citerefentry"><span class=
                   8327:                 "refentrytitle">pkg_delete</span>(1)</span></a> in
                   8328:                 the current directory, effectively de-installing
                   8329:                 the package. The following variables can be used to
                   8330:                 tune the behaviour:</p>
1.1       grant    8331: 
                   8332:                 <div class="variablelist">
                   8333:                   <dl>
1.14      xtraeme  8334:                     <dt><span class="term"><code class=
                   8335:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    8336: 
                   8337:                     <dd>
                   8338:                       <p>Add a "-v" to the <a href=
                   8339:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8340:                       <span class="citerefentry"><span class=
                   8341:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   8342:                       command.</p>
                   8343:                     </dd>
                   8344: 
1.14      xtraeme  8345:                     <dt><span class="term"><code class=
                   8346:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    8347: 
                   8348:                     <dd>
                   8349:                       <p>Remove all packages that require (depend
                   8350:                       on) the given package. This can be used to
                   8351:                       remove any packages that may have been pulled
                   8352:                       in by a given package, e.g. if
1.14      xtraeme  8353:                       <span><strong class="command">make deinstall
                   8354:                       DEINSTALLDEPENDS=1</strong></span> is done in
                   8355:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    8356:                       this is likely to remove whole KDE. Works by
                   8357:                       adding &#8220;<span class=
                   8358:                       "quote">-R</span>&#8221; to the <a href=
                   8359:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8360:                       <span class="citerefentry"><span class=
                   8361:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   8362:                       command line.</p>
                   8363:                     </dd>
                   8364:                   </dl>
                   8365:                 </div>
                   8366:               </dd>
                   8367: 
                   8368:               <dt><span class="term">update</span></dt>
                   8369: 
                   8370:               <dd>
                   8371:                 <p>This target causes the current package to be
                   8372:                 updated to the latest version. The package and all
                   8373:                 depending packages first get de-installed, then
                   8374:                 current versions of the corresponding packages get
                   8375:                 compiled and installed. This is similar to manually
                   8376:                 noting which packages are currently installed, then
1.14      xtraeme  8377:                 performing a series of <span><strong class=
                   8378:                 "command">make deinstall</strong></span> and
                   8379:                 <span><strong class="command">make
                   8380:                 install</strong></span> (or whatever <code class=
                   8381:                 "varname">UPDATE_TARGET</code> is set to) for these
                   8382:                 packages.</p>
1.1       grant    8383: 
                   8384:                 <p>You can use the &#8220;<span class=
                   8385:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  8386:                 package updating in case a previous
                   8387:                 <span><strong class="command">make
                   8388:                 update</strong></span> was interrupted for some
                   8389:                 reason. However, in this case, make sure you don't
                   8390:                 call <span><strong class="command">make
                   8391:                 clean</strong></span> or otherwise remove the list
                   8392:                 of dependent packages in <code class=
                   8393:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    8394:                 ability to automatically update the current package
                   8395:                 along with the dependent packages you have
                   8396:                 installed.</p>
                   8397: 
1.14      xtraeme  8398:                 <p>Resuming an interrupted <span><strong class=
                   8399:                 "command">make update</strong></span> will only
                   8400:                 work as long as the package tree remains unchanged.
                   8401:                 If the source code for one of the packages to be
                   8402:                 updated has been changed, resuming
                   8403:                 <span><strong class="command">make
                   8404:                 update</strong></span> will most certainly
                   8405:                 fail!</p>
1.1       grant    8406: 
                   8407:                 <p>The following variables can be used either on
1.14      xtraeme  8408:                 the command line or in <code class=
                   8409:                 "filename">/etc/mk.conf</code> to alter the
                   8410:                 behaviour of <span><strong class="command">make
                   8411:                 update</strong></span>:</p>
1.1       grant    8412: 
                   8413:                 <div class="variablelist">
                   8414:                   <dl>
1.14      xtraeme  8415:                     <dt><span class="term"><code class=
                   8416:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    8417: 
                   8418:                     <dd>
                   8419:                       <p>Install target to recursively use for the
                   8420:                       updated package and the dependent packages.
1.14      xtraeme  8421:                       Defaults to <code class=
                   8422:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    8423:                       &#8220;<span class=
                   8424:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  8425:                       <span><strong class="command">make
                   8426:                       update</strong></span>. e.g.
                   8427:                       <span><strong class="command">make update
                   8428:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    8429:                     </dd>
                   8430: 
1.14      xtraeme  8431:                     <dt><span class="term"><code class=
                   8432:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    8433: 
                   8434:                     <dd>
                   8435:                       <p>Don't clean up after updating. Useful if
                   8436:                       you want to leave the work sources of the
                   8437:                       updated packages around for inspection or
                   8438:                       other purposes. Be sure you eventually clean
                   8439:                       up the source tree (see the
                   8440:                       &#8220;<span class=
                   8441:                       "quote">clean-update</span>&#8221; target
                   8442:                       below) or you may run into troubles with old
                   8443:                       source code still lying around on your next
1.14      xtraeme  8444:                       <span><strong class=
                   8445:                       "command">make</strong></span> or
                   8446:                       <span><strong class="command">make
                   8447:                       update</strong></span>.</p>
1.1       grant    8448:                     </dd>
                   8449: 
1.14      xtraeme  8450:                     <dt><span class="term"><code class=
                   8451:                     "varname">REINSTALL</code></span></dt>
1.1       grant    8452: 
                   8453:                     <dd>
                   8454:                       <p>Deinstall each package before installing
1.14      xtraeme  8455:                       (making <code class=
                   8456:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    8457:                       necessary if the &#8220;<span class=
                   8458:                       "quote">clean-update</span>&#8221; target
                   8459:                       (see below) was called after interrupting a
1.14      xtraeme  8460:                       running <span><strong class="command">make
                   8461:                       update</strong></span>.</p>
1.1       grant    8462:                     </dd>
                   8463: 
1.14      xtraeme  8464:                     <dt><span class="term"><code class=
                   8465:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    8466: 
                   8467:                     <dd>
                   8468:                       <p>Allows you to disable recursion and
                   8469:                       hardcode the target for packages. The default
                   8470:                       is &#8220;<span class=
                   8471:                       "quote">update</span>&#8221; for the update
                   8472:                       target, facilitating a recursive update of
1.14      xtraeme  8473:                       prerequisite packages. Only set <code class=
                   8474:                       "varname">DEPENDS_TARGET</code> if you want
                   8475:                       to disable recursive updates. Use
                   8476:                       <code class="varname">UPDATE_TARGET</code>
                   8477:                       instead to just set a specific target for
                   8478:                       each package to be installed during
                   8479:                       <span><strong class="command">make
                   8480:                       update</strong></span> (see above).</p>
1.1       grant    8481:                     </dd>
                   8482:                   </dl>
                   8483:                 </div>
                   8484:               </dd>
                   8485: 
                   8486:               <dt><span class="term">clean-update</span></dt>
                   8487: 
                   8488:               <dd>
                   8489:                 <p>Clean the source tree for all packages that
1.14      xtraeme  8490:                 would get updated if <span><strong class=
                   8491:                 "command">make update</strong></span> was called
                   8492:                 from the current directory. This target should not
                   8493:                 be used if the current package (or any of its
                   8494:                 depending packages) have already been de-installed
                   8495:                 (e.g., after calling <span><strong class=
                   8496:                 "command">make update</strong></span>) or you may
                   8497:                 lose some packages you intended to update. As a
                   8498:                 rule of thumb: only use this target <span class=
                   8499:                 "emphasis"><em>before</em></span> the first time
                   8500:                 you run <span><strong class="command">make
                   8501:                 update</strong></span> and only if you have a dirty
                   8502:                 package tree (e.g., if you used <code class=
                   8503:                 "varname">NOCLEAN</code>).</p>
1.1       grant    8504: 
                   8505:                 <p>If you unsure about whether your tree is clean
1.14      xtraeme  8506:                 you can either perform a <span><strong class=
                   8507:                 "command">make clean</strong></span> at the top of
                   8508:                 the tree, or use the following sequence of commands
1.1       grant    8509:                 from the directory of the package you want to
                   8510:                 update (<span class=
                   8511:                 "emphasis"><em>before</em></span> running
1.14      xtraeme  8512:                 <span><strong class="command">make
                   8513:                 update</strong></span> for the first time,
                   8514:                 otherwise you lose all the packages you wanted to
                   8515:                 update!):</p>
1.1       grant    8516:                 <pre class="screen">
1.14      xtraeme  8517: <code class="prompt">#</code> <strong class=
                   8518: "userinput"><code>make clean-update</code></strong>
                   8519: <code class="prompt">#</code> <strong class=
                   8520: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   8521: <code class="prompt">#</code> <strong class=
                   8522: "userinput"><code>make update</code></strong>
1.1       grant    8523: </pre>
                   8524: 
                   8525:                 <p>The following variables can be used either on
1.14      xtraeme  8526:                 the command line or in <code class=
                   8527:                 "filename">/etc/mk.conf</code> to alter the
                   8528:                 behaviour of <span><strong class="command">make
                   8529:                 clean-update</strong></span>:</p>
1.1       grant    8530: 
                   8531:                 <div class="variablelist">
                   8532:                   <dl>
1.14      xtraeme  8533:                     <dt><span class="term"><code class=
                   8534:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    8535: 
                   8536:                     <dd>
1.14      xtraeme  8537:                       <p>After <span><strong class="command">make
                   8538:                       clean</strong></span>, do not reconstruct the
                   8539:                       list of directories to update for this
                   8540:                       package. Only use this if
                   8541:                       <span><strong class="command">make
                   8542:                       update</strong></span> successfully installed
                   8543:                       all packages you wanted to update. Normally,
                   8544:                       this is done automatically on
                   8545:                       <span><strong class="command">make
                   8546:                       update</strong></span>, but may have been
                   8547:                       suppressed by the <code class=
                   8548:                       "varname">NOCLEAN</code> variable (see
1.1       grant    8549:                       above).</p>
                   8550:                     </dd>
                   8551:                   </dl>
                   8552:                 </div>
                   8553:               </dd>
                   8554: 
                   8555:               <dt><span class="term">info</span></dt>
                   8556: 
                   8557:               <dd>
                   8558:                 <p>This target invokes <a href=
                   8559:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   8560:                 <span class="citerefentry"><span class=
                   8561:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   8562:                 the current package. You can use this to check
                   8563:                 which version of a package is installed.</p>
                   8564:               </dd>
                   8565: 
                   8566:               <dt><span class="term">readme</span></dt>
                   8567: 
                   8568:               <dd>
1.14      xtraeme  8569:                 <p>This target generates a <code class=
                   8570:                 "filename">README.html</code> file, which can be
1.1       grant    8571:                 viewed using a browser such as <a xmlns=
                   8572:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8573:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.20      ben      8574:                 class="pkgname">www/mozilla</a> or <a xmlns=
                   8575:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   8576:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
                   8577:                 class="pkgname">www/links</a>. The generated files
                   8578:                 contain references to any packages which are in the
                   8579:                 <code class="varname">PACKAGES</code> directory on
                   8580:                 the local host. The generated files can be made to
                   8581:                 refer to URLs based on <code class=
                   8582:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   8583:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
                   8584:                 wanted to generate <code class=
                   8585:                 "filename">README.html</code> files which pointed
                   8586:                 to binary packages on the local machine, in the
                   8587:                 directory <code class=
                   8588:                 "filename">/usr/packages</code>, set <code class=
                   8589:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   8590:                 and <code class=
                   8591:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   8592:                 <code class="varname">${PACKAGES}</code> directory
                   8593:                 and its subdirectories will be searched for all the
                   8594:                 binary packages.</p>
1.1       grant    8595:               </dd>
                   8596: 
                   8597:               <dt><span class="term">readme-all</span></dt>
                   8598: 
                   8599:               <dd>
1.14      xtraeme  8600:                 <p>Use this target to create a file <code class=
                   8601:                 "filename">README-all.html</code> which contains a
1.1       grant    8602:                 list of all packages currently available in the
                   8603:                 NetBSD Packages Collection, together with the
                   8604:                 category they belong to and a short description.
1.14      xtraeme  8605:                 This file is compiled from the <code class=
                   8606:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    8607:                 sure to run this <span class=
1.14      xtraeme  8608:                 "emphasis"><em>after</em></span> a
                   8609:                 <span><strong class="command">make
                   8610:                 readme</strong></span>.</p>
1.1       grant    8611:               </dd>
                   8612: 
                   8613:               <dt><span class="term">cdrom-readme</span></dt>
                   8614: 
                   8615:               <dd>
                   8616:                 <p>This is very much the same as the
                   8617:                 &#8220;<span class="quote">readme</span>&#8221;
                   8618:                 target (see above), but is to be used when
                   8619:                 generating a pkgsrc tree to be written to a CD-ROM.
1.14      xtraeme  8620:                 This target also produces <code class=
                   8621:                 "filename">README.html</code> files, and can be
                   8622:                 made to refer to URLs based on <code class=
                   8623:                 "varname">CDROM_PKG_URL_HOST</code> and
                   8624:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    8625:               </dd>
                   8626: 
                   8627:               <dt><span class="term">show-distfiles</span></dt>
                   8628: 
                   8629:               <dd>
                   8630:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  8631:                 are needed to build the package. (<code class=
                   8632:                 "varname">DISTFILES</code> and <code class=
                   8633:                 "varname">PATCHFILES</code>, but not <code class=
                   8634:                 "filename">patches/*</code>)</p>
1.1       grant    8635:               </dd>
                   8636: 
                   8637:               <dt><span class="term">show-downlevel</span></dt>
                   8638: 
                   8639:               <dd>
                   8640:                 <p>This target shows nothing if the package is not
                   8641:                 installed. If a version of this package is
                   8642:                 installed, but is not the version provided in this
                   8643:                 version of pkgsrc, then a warning message is
                   8644:                 displayed. This target can be used to show which of
                   8645:                 your installed packages are downlevel, and so the
                   8646:                 old versions can be deleted, and the current ones
                   8647:                 added.</p>
                   8648:               </dd>
                   8649: 
                   8650:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   8651: 
                   8652:               <dd>
                   8653:                 <p>This target shows the directory in the pkgsrc
                   8654:                 hierarchy from which the package can be built and
                   8655:                 installed. This may not be the same directory as
                   8656:                 the one from which the package was installed. This
                   8657:                 target is intended to be used by people who may
                   8658:                 wish to upgrade many packages on a single host, and
                   8659:                 can be invoked from the top-level pkgsrc Makefile
                   8660:                 by using the &#8220;<span class=
                   8661:                 "quote">show-host-specific-pkgs</span>&#8221;
                   8662:                 target.</p>
                   8663:               </dd>
                   8664: 
                   8665:               <dt><span class=
                   8666:               "term">show-installed-depends</span></dt>
                   8667: 
                   8668:               <dd>
                   8669:                 <p>This target shows which installed packages match
1.14      xtraeme  8670:                 the current package's <code class=
                   8671:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    8672:                 dependencies are causing build problems.</p>
                   8673:               </dd>
                   8674: 
                   8675:               <dt><span class="term">check-shlibs</span></dt>
                   8676: 
                   8677:               <dd>
                   8678:                 <p>After a package is installed, check all its
                   8679:                 binaries and (on ELF platforms) shared libraries to
                   8680:                 see if they find the shared libs they need. Run by
1.14      xtraeme  8681:                 default if <code class=
                   8682:                 "varname">PKG_DEVELOPER</code> is set in
                   8683:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    8684:               </dd>
                   8685: 
                   8686:               <dt><span class="term">print-PLIST</span></dt>
                   8687: 
                   8688:               <dd>
                   8689:                 <p>After a &#8220;<span class="quote">make
                   8690:                 install</span>&#8221; from a new or upgraded pkg,
                   8691:                 this prints out an attempt to generate a new
1.14      xtraeme  8692:                 <code class="filename">PLIST</code> from a
                   8693:                 <span><strong class="command">find -newer
                   8694:                 work/.extract_done</strong></span>. An attempt is
                   8695:                 made to care for shared libs etc., but it is
1.1       grant    8696:                 <span class="emphasis"><em>strongly</em></span>
                   8697:                 recommended to review the result before putting it
1.14      xtraeme  8698:                 into <code class="filename">PLIST</code>. On
                   8699:                 upgrades, it's useful to diff the output of this
                   8700:                 command against an already existing <code class=
                   8701:                 "filename">PLIST</code> file.</p>
1.1       grant    8702: 
1.24      wiz      8703:                 <p>If the package installs files via <a href=
                   8704:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   8705:                 <span class="citerefentry"><span class=
                   8706:                 "refentrytitle">tar</span>(1)</span></a> or other
                   8707:                 methods that don't update file access times, be
                   8708:                 sure to add these files manually to your
1.14      xtraeme  8709:                 <code class="filename">PLIST</code>, as the
1.1       grant    8710:                 &#8220;<span class="quote">find
                   8711:                 -newer</span>&#8221; command used by this target
                   8712:                 won't catch them!</p>
                   8713: 
                   8714:                 <p>See <a href="#print-PLIST" title=
1.25      rillig   8715:                 "9.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;9.3,
1.14      xtraeme  8716:                 &#8220;Tweaking output of <span><strong class=
                   8717:                 "command">make
                   8718:                 print-PLIST</strong></span>&#8221;</a> for more
                   8719:                 information on this target.</p>
1.1       grant    8720:               </dd>
                   8721: 
                   8722:               <dt><span class="term">bulk-package</span></dt>
                   8723: 
                   8724:               <dd>
                   8725:                 <p>Used to do bulk builds. If an appropriate binary
                   8726:                 package already exists, no action is taken. If not,
                   8727:                 this target will compile, install and package it
1.14      xtraeme  8728:                 (and it's depends, if <code class=
                   8729:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    8730:                 <a href="#binary.configuration" title=
                   8731:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   8732:                 &#8220;Configuration&#8221;</a>. After creating the
                   8733:                 binary package, the sources, the just-installed
                   8734:                 package and it's required packages are removed,
                   8735:                 preserving free disk space.</p>
                   8736: 
                   8737:                 <p><span class="emphasis"><em>Beware that this
                   8738:                 target may deinstall all packages installed on a
                   8739:                 system!</em></span></p>
                   8740:               </dd>
                   8741: 
                   8742:               <dt><span class="term">bulk-install</span></dt>
                   8743: 
                   8744:               <dd>
                   8745:                 <p>Used during bulk-installs to install required
                   8746:                 packages. If an upto-date binary package is
                   8747:                 available, it will be installed via <a href=
                   8748:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   8749:                 <span class="citerefentry"><span class=
                   8750:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  8751:                 not, <span><strong class="command">make
                   8752:                 bulk-package</strong></span> will be executed, but
                   8753:                 the installed binary not be removed.</p>
1.1       grant    8754: 
                   8755:                 <p>A binary package is considered
                   8756:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   8757:                 to be installed via <a href=
                   8758:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   8759:                 <span class="citerefentry"><span class=
                   8760:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   8761:                 if:</p>
                   8762: 
                   8763:                 <div class="itemizedlist">
                   8764:                   <ul type="disc">
                   8765:                     <li>
1.14      xtraeme  8766:                       <p>None of the package's files (<code class=
                   8767:                       "filename">Makefile</code>, ...) were
                   8768:                       modified since it was built.</p>
1.1       grant    8769:                     </li>
                   8770: 
                   8771:                     <li>
                   8772:                       <p>None of the package's required (binary)
                   8773:                       packages were modified since it was
                   8774:                       built.</p>
                   8775:                     </li>
                   8776:                   </ul>
                   8777:                 </div>
                   8778: 
                   8779:                 <p><span class="emphasis"><em>Beware that this
                   8780:                 target may deinstall all packages installed on a
                   8781:                 system!</em></span></p>
                   8782:               </dd>
                   8783:             </dl>
                   8784:           </div>
                   8785:         </div>
                   8786:       </div>
                   8787: 
                   8788:       <div class="chapter" lang="en" xml:lang="en">
                   8789:         <div class="titlepage">
                   8790:           <div>
                   8791:             <div>
                   8792:               <h2 class="title"><a name="fixes" id=
1.25      rillig   8793:               "fixes"></a>Chapter&nbsp;13.&nbsp;Notes on fixes for
1.1       grant    8794:               packages</h2>
                   8795:             </div>
                   8796:           </div>
                   8797:         </div>
                   8798: 
                   8799:         <div class="toc">
                   8800:           <p><b>Table of Contents</b></p>
                   8801: 
                   8802:           <dl>
1.28    ! rillig   8803:             <dt><span class="sect1"><a href="#id2632835">13.1.
1.1       grant    8804:             General operation</a></span></dt>
                   8805: 
                   8806:             <dd>
                   8807:               <dl>
                   8808:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8809:                 "#id2632838">13.1.1. How to pull in variables from
1.1       grant    8810:                 /etc/mk.conf</a></span></dt>
                   8811: 
                   8812:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8813:                 "#id2632921">13.1.2. Restricted
1.1       grant    8814:                 packages</a></span></dt>
                   8815: 
                   8816:                 <dt><span class="sect2"><a href=
1.25      rillig   8817:                 "#dependencies">13.1.3. Handling
1.1       grant    8818:                 dependencies</a></span></dt>
                   8819: 
                   8820:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8821:                 "#id2633374">13.1.4. Handling conflicts with other
1.1       grant    8822:                 packages</a></span></dt>
                   8823: 
                   8824:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8825:                 "#id2633493">13.1.5. Packages that cannot or should
1.1       grant    8826:                 not be built</a></span></dt>
                   8827: 
                   8828:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8829:                 "#id2633518">13.1.6. Packages which should not be
1.1       grant    8830:                 deleted, once installed</a></span></dt>
                   8831: 
                   8832:                 <dt><span class="sect2"><a href=
1.25      rillig   8833:                 "#security-handling">13.1.7. Handling packages with
1.1       grant    8834:                 security problems</a></span></dt>
                   8835: 
                   8836:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8837:                 "#id2633678">13.1.8. How to handle compiler
1.1       grant    8838:                 bugs</a></span></dt>
                   8839: 
                   8840:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8841:                 "#id2633701">13.1.9. How to handle incrementing
1.1       grant    8842:                 versions when fixing an existing
                   8843:                 package</a></span></dt>
                   8844: 
                   8845:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8846:                 "#id2633818">13.1.10. Portability of
1.1       grant    8847:                 packages</a></span></dt>
                   8848:               </dl>
                   8849:             </dd>
                   8850: 
1.28    ! rillig   8851:             <dt><span class="sect1"><a href="#id2633843">13.2.
1.1       grant    8852:             Possible downloading issues</a></span></dt>
                   8853: 
                   8854:             <dd>
                   8855:               <dl>
                   8856:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8857:                 "#id2633846">13.2.1. Packages whose distfiles
1.1       grant    8858:                 aren't available for plain
                   8859:                 downloading</a></span></dt>
                   8860: 
                   8861:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8862:                 "#id2633909">13.2.2. How to handle modified
1.1       grant    8863:                 distfiles with the 'old' name</a></span></dt>
                   8864:               </dl>
                   8865:             </dd>
                   8866: 
1.28    ! rillig   8867:             <dt><span class="sect1"><a href="#id2633921">13.3.
1.1       grant    8868:             Configuration gotchas</a></span></dt>
                   8869: 
                   8870:             <dd>
                   8871:               <dl>
                   8872:                 <dt><span class="sect2"><a href=
1.25      rillig   8873:                 "#fixes.libtool">13.3.1. Shared libraries -
1.1       grant    8874:                 libtool</a></span></dt>
                   8875: 
                   8876:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8877:                 "#id2634286">13.3.2. Using libtool on GNU packages
1.1       grant    8878:                 that already support libtool</a></span></dt>
                   8879: 
                   8880:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8881:                 "#id2634504">13.3.3. GNU
1.1       grant    8882:                 Autoconf/Automake</a></span></dt>
                   8883:               </dl>
                   8884:             </dd>
                   8885: 
1.28    ! rillig   8886:             <dt><span class="sect1"><a href="#id2634617">13.4.
1.1       grant    8887:             Building considerations</a></span></dt>
                   8888: 
                   8889:             <dd>
                   8890:               <dl>
                   8891:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8892:                 "#id2634620">13.4.1. CPP defines</a></span></dt>
1.1       grant    8893:               </dl>
                   8894:             </dd>
                   8895: 
1.28    ! rillig   8896:             <dt><span class="sect1"><a href="#id2634650">13.5.
1.1       grant    8897:             Package specific actions</a></span></dt>
                   8898: 
                   8899:             <dd>
                   8900:               <dl>
                   8901:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8902:                 "#id2634653">13.5.1. Package configuration
1.1       grant    8903:                 files</a></span></dt>
                   8904: 
                   8905:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8906:                 "#id2634756">13.5.2. User
1.2       hubertf  8907:                 interaction</a></span></dt>
1.1       grant    8908: 
                   8909:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8910:                 "#id2634801">13.5.3. Handling
1.1       grant    8911:                 licenses</a></span></dt>
                   8912: 
                   8913:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8914:                 "#id2634884">13.5.4. Creating an account from a
1.1       grant    8915:                 package</a></span></dt>
                   8916: 
                   8917:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8918:                 "#id2635014">13.5.5. Installing score
1.1       grant    8919:                 files</a></span></dt>
                   8920: 
                   8921:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8922:                 "#id2635058">13.5.6. Packages providing login
1.1       grant    8923:                 shells</a></span></dt>
                   8924: 
                   8925:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8926:                 "#id2635115">13.5.7. Packages containing perl
1.1       grant    8927:                 scripts</a></span></dt>
                   8928: 
                   8929:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8930:                 "#id2635133">13.5.8. Packages with hardcoded paths
1.1       grant    8931:                 to other interpreters</a></span></dt>
                   8932: 
                   8933:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8934:                 "#id2635155">13.5.9. Packages installing perl
1.1       grant    8935:                 modules</a></span></dt>
                   8936: 
                   8937:                 <dt><span class="sect2"><a href=
1.25      rillig   8938:                 "#faq.info-files">13.5.10. Packages installing info
1.1       grant    8939:                 files</a></span></dt>
                   8940: 
                   8941:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8942:                 "#id2635511">13.5.11. Packages installing GConf2
1.1       grant    8943:                 data files</a></span></dt>
                   8944: 
                   8945:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8946:                 "#id2635680">13.5.12. Packages installing
1.1       grant    8947:                 scrollkeeper data files</a></span></dt>
                   8948: 
                   8949:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8950:                 "#id2635731">13.5.13. Packages installing X11
1.1       grant    8951:                 fonts</a></span></dt>
                   8952: 
                   8953:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8954:                 "#id2635778">13.5.14. Packages installing GTK2
1.1       grant    8955:                 modules</a></span></dt>
                   8956: 
                   8957:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8958:                 "#id2635847">13.5.15. Packages installing SGML or
1.1       grant    8959:                 XML data</a></span></dt>
                   8960: 
                   8961:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8962:                 "#id2635899">13.5.16. Packages installing
1.1       grant    8963:                 extensions to the MIME database</a></span></dt>
                   8964: 
                   8965:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8966:                 "#id2636038">13.5.17. Packages using
1.1       grant    8967:                 intltool</a></span></dt>
1.18      xtraeme  8968: 
                   8969:                 <dt><span class="sect2"><a href=
1.28    ! rillig   8970:                 "#id2636052">13.5.18. Packages installing startup
1.18      xtraeme  8971:                 scripts</a></span></dt>
1.1       grant    8972:               </dl>
                   8973:             </dd>
                   8974: 
1.28    ! rillig   8975:             <dt><span class="sect1"><a href="#id2636073">13.6.
1.1       grant    8976:             Feedback to the author</a></span></dt>
                   8977:           </dl>
                   8978:         </div>
                   8979: 
                   8980:         <div class="sect1" lang="en" xml:lang="en">
                   8981:           <div class="titlepage">
                   8982:             <div>
                   8983:               <div>
                   8984:                 <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   8985:                 "id2632835" id="id2632835"></a>13.1.&nbsp;General
1.1       grant    8986:                 operation</h2>
                   8987:               </div>
                   8988:             </div>
                   8989:           </div>
                   8990: 
                   8991:           <div class="sect2" lang="en" xml:lang="en">
                   8992:             <div class="titlepage">
                   8993:               <div>
                   8994:                 <div>
1.28    ! rillig   8995:                   <h3 class="title"><a name="id2632838" id=
        !          8996:                   "id2632838"></a>13.1.1.&nbsp;How to pull in
1.1       grant    8997:                   variables from /etc/mk.conf</h3>
                   8998:                 </div>
                   8999:               </div>
                   9000:             </div>
                   9001: 
                   9002:             <p>The problem with package-defined variables that can
1.14      xtraeme  9003:             be overridden via <code class="varname">MAKECONF</code>
                   9004:             or <code class="filename">/etc/mk.conf</code> is that
                   9005:             <a href=
1.1       grant    9006:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   9007:             <span class="citerefentry"><span class=
                   9008:             "refentrytitle">make</span>(1)</span></a> expands a
                   9009:             variable as it is used, but evaluates preprocessor like
                   9010:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  9011:             So, to use any variable (which may be set in
                   9012:             <code class="filename">/etc/mk.conf</code>) in one of
                   9013:             the .if* statements, the file <code class=
                   9014:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    9015:             that .if* statement.</p>
                   9016: 
                   9017:             <p>Rather than have a number of ad-hoc ways of
1.14      xtraeme  9018:             including <code class="filename">/etc/mk.conf</code>,
                   9019:             should it exist, or <code class=
                   9020:             "varname">MAKECONF</code>, should it exist, include the
                   9021:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
                   9022:             file in the package Makefile before any
                   9023:             preprocessor-like .if, .ifdef, or .ifndef
                   9024:             statements:</p>
1.1       grant    9025:             <pre class="programlisting">
                   9026: .include "../../mk/bsd.prefs.mk"
                   9027:     
                   9028:     .if defined(USE_MENUS)
                   9029:       ...
                   9030:     .endif
                   9031: </pre>
                   9032: 
1.14      xtraeme  9033:             <p>If you wish to set the <code class=
                   9034:             "varname">CFLAGS</code> variable in <code class=
                   9035:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    9036:             use:</p>
                   9037:             <pre class="programlisting">
                   9038: CFLAGS+=  -your -flags
                   9039: </pre>
                   9040: 
1.14      xtraeme  9041:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   9042:             without the &#8220;<span class="quote">+</span>&#8221;)
                   9043:             may lead to problems with packages that need to add
                   9044:             their own flags. Also, you may want to take a look at
                   9045:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    9046:             href=
                   9047:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.20      ben      9048:             class="pkgname">devel/cpuflags</a> package if you're
                   9049:             interested in optimization for the current CPU.</p>
1.1       grant    9050:           </div>
                   9051: 
                   9052:           <div class="sect2" lang="en" xml:lang="en">
                   9053:             <div class="titlepage">
                   9054:               <div>
                   9055:                 <div>
1.28    ! rillig   9056:                   <h3 class="title"><a name="id2632921" id=
        !          9057:                   "id2632921"></a>13.1.2.&nbsp;Restricted
1.1       grant    9058:                   packages</h3>
                   9059:                 </div>
                   9060:               </div>
                   9061:             </div>
                   9062: 
                   9063:             <p>Some licenses restrict how software may be
                   9064:             re-distributed. In order to satisfy these restrictions,
                   9065:             the package system defines five make variables that can
                   9066:             be set to note these restrictions:</p>
                   9067: 
                   9068:             <div class="itemizedlist">
                   9069:               <ul type="disc">
                   9070:                 <li>
1.14      xtraeme  9071:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    9072: 
                   9073:                   <p>This variable should be set whenever a
                   9074:                   restriction exists (regardless of its kind). Set
                   9075:                   this variable to a string containing the reason
                   9076:                   for the restriction.</p>
                   9077:                 </li>
                   9078: 
                   9079:                 <li>
1.14      xtraeme  9080:                   <p><code class=
                   9081:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    9082: 
                   9083:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  9084:                   variable to <code class=
                   9085:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    9086:                   package may not be included on a CD-ROM.</p>
                   9087:                 </li>
                   9088: 
                   9089:                 <li>
1.14      xtraeme  9090:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    9091: 
                   9092:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  9093:                   Set this variable to <code class=
                   9094:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    9095:                   package may not not be made available on the
                   9096:                   Internet.</p>
                   9097:                 </li>
                   9098: 
                   9099:                 <li>
1.14      xtraeme  9100:                   <p><code class=
                   9101:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    9102: 
                   9103:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  9104:                   this variable to <code class=
                   9105:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    9106:                   of the source code or other distfile(s) is not
                   9107:                   allowed on CD-ROMs.</p>
                   9108:                 </li>
                   9109: 
                   9110:                 <li>
1.14      xtraeme  9111:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    9112: 
                   9113:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  9114:                   variable to <code class=
                   9115:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    9116:                   of the source code or other distfile(s) via the
                   9117:                   Internet is not allowed.</p>
                   9118:                 </li>
                   9119:               </ul>
                   9120:             </div>
                   9121: 
1.14      xtraeme  9122:             <p>Please note that the use of <code class=
                   9123:             "varname">NO_PACKAGE</code>, <code class=
                   9124:             "varname">IGNORE</code>, <code class=
                   9125:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    9126:             variables to denote restrictions is deprecated, because
                   9127:             they unconditionally prevent users from generating
                   9128:             binary packages!</p>
                   9129:           </div>
                   9130: 
                   9131:           <div class="sect2" lang="en" xml:lang="en">
                   9132:             <div class="titlepage">
                   9133:               <div>
                   9134:                 <div>
                   9135:                   <h3 class="title"><a name="dependencies" id=
1.25      rillig   9136:                   "dependencies"></a>13.1.3.&nbsp;Handling
1.1       grant    9137:                   dependencies</h3>
                   9138:                 </div>
                   9139:               </div>
                   9140:             </div>
                   9141: 
                   9142:             <p>Your package may depend on some other package being
                   9143:             present - and there are various ways of expressing this
1.14      xtraeme  9144:             dependency. pkgsrc supports the <code class=
                   9145:             "varname">BUILD_DEPENDS</code> and <code class=
                   9146:             "varname">DEPENDS</code> definitions, as well as
                   9147:             dependencies via <code class=
                   9148:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    9149:             way to handle dependencies, and which uses the
                   9150:             variables named above. See <a href="#buildlink" title=
1.25      rillig   9151:             "Chapter&nbsp;10.&nbsp;Buildlink methodology">Chapter&nbsp;10,
1.1       grant    9152:             <i>Buildlink methodology</i></a> for more
                   9153:             information.</p>
                   9154: 
                   9155:             <p>The basic difference between the two variables is as
1.14      xtraeme  9156:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    9157:             definition registers that pre-requisite in the binary
                   9158:             package so it will be pulled in when the binary package
1.14      xtraeme  9159:             is later installed, whilst the <code class=
                   9160:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    9161:             marking a dependency that is only needed for building
                   9162:             the package.</p>
                   9163: 
                   9164:             <p>This means that if you only need a package present
                   9165:             whilst you are building, it should be noted as a
1.14      xtraeme  9166:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    9167: 
1.14      xtraeme  9168:             <p>The format for a <code class=
                   9169:             "varname">BUILD_DEPENDS</code> and a <code class=
                   9170:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    9171:             <pre class="programlisting">
                   9172: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   9173: </pre>
                   9174: 
                   9175:             <p>Please note that the &#8220;<span class=
                   9176:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  9177:             any of the wildcard version numbers recognized by
1.1       grant    9178:             <a href=
                   9179:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   9180:             <span class="citerefentry"><span class=
                   9181:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   9182: 
                   9183:             <div class="orderedlist">
                   9184:               <ol type="1">
                   9185:                 <li>
                   9186:                   <p>If your package needs another package's
                   9187:                   binaries or libraries to build or run, and if
1.14      xtraeme  9188:                   that package has a <code class=
                   9189:                   "filename">buildlink3.mk</code> file available,
                   9190:                   use it:</p>
1.1       grant    9191:                   <pre class="programlisting">
                   9192:     .include "../../graphics/jpeg/buildlink3.mk"
                   9193:     
                   9194: </pre>
                   9195:                 </li>
                   9196: 
                   9197:                 <li>
                   9198:                   <p>If your package needs to use another package
1.14      xtraeme  9199:                   to build itself and there is no <code class=
                   9200:                   "filename">buildlink3.mk</code> file available,
                   9201:                   use the <code class=
                   9202:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    9203:                   <pre class="programlisting">
                   9204: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   9205: </pre>
                   9206:                 </li>
                   9207: 
                   9208:                 <li>
                   9209:                   <p>If your package needs a library with which to
1.14      xtraeme  9210:                   link and again there is no <code class=
                   9211:                   "filename">buildlink3.mk</code> file available,
                   9212:                   this is specified using the <code class=
                   9213:                   "varname">DEPENDS</code> definition. An example
                   9214:                   of this is the <a xmlns=
1.1       grant    9215:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9216:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      9217:                   class="pkgname">print/lyx</a> package, which uses
                   9218:                   the xpm library, version 3.4j to build:</p>
1.1       grant    9219:                   <pre class="programlisting">
                   9220: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   9221: </pre>
                   9222: 
                   9223:                   <p>You can also use wildcards in package
                   9224:                   dependences:</p>
                   9225:                   <pre class="programlisting">
                   9226: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   9227: </pre>
                   9228: 
                   9229:                   <p>Note that such wildcard dependencies are
                   9230:                   retained when creating binary packages. The
                   9231:                   dependency is checked when installing the binary
                   9232:                   package and any package which matches the pattern
                   9233:                   will be used. Wildcard dependencies should be
                   9234:                   used with care.</p>
                   9235: 
                   9236:                   <p>The &#8220;<span class=
                   9237:                   "quote">-[0-9]*</span>&#8221; should be used
                   9238:                   instead of &#8220;<span class=
                   9239:                   "quote">-*</span>&#8221; to avoid potentially
                   9240:                   ambiguous matches such as &#8220;<span class=
                   9241:                   "quote">tk-postgresql</span>&#8221; matching a
                   9242:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  9243:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    9244: 
                   9245:                   <p>Wildcards can also be used to specify that a
                   9246:                   package will only build against a certain minimum
                   9247:                   version of a pre-requisite:</p>
                   9248:                   <pre class="programlisting">
                   9249: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   9250: </pre>
                   9251: 
                   9252:                   <p>This means that the package will build against
                   9253:                   version 3.5.4 of the tiff library or newer. Such
                   9254:                   a dependency may be warranted if, for example,
                   9255:                   the API of the library has changed with version
                   9256:                   3.5.4 and a package would not compile against an
                   9257:                   earlier version of tiff.</p>
                   9258: 
                   9259:                   <p>Please note that such dependencies should only
                   9260:                   be updated if a package requires a newer
                   9261:                   pre-requisite, but not to denote recommendations
                   9262:                   such as security updates or ABI changes that do
                   9263:                   not prevent a package from building correctly.
                   9264:                   Such recommendations can be expressed using
1.14      xtraeme  9265:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    9266:                   <pre class="programlisting">
                   9267: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   9268: </pre>
                   9269: 
1.14      xtraeme  9270:                   <p>In addition to the above <code class=
                   9271:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    9272:                   while a package will build against
                   9273:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  9274:                   recommended. <code class=
                   9275:                   "varname">RECOMMENDED</code> entries will be
                   9276:                   turned into dependencies unless explicitly
                   9277:                   ignored (in which case a warning will be
                   9278:                   printed). Packages that are built with
1.1       grant    9279:                   recommendations ignored may not be uploaded to
                   9280:                   ftp.NetBSD.org by developers and should not be
                   9281:                   used across different systems that may have
                   9282:                   different versions of binary packages
                   9283:                   installed.</p>
                   9284: 
                   9285:                   <p>For security fixes, please update the package
                   9286:                   vulnerabilities file as well as setting
1.14      xtraeme  9287:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    9288:                   <a href="#security-handling" title=
1.25      rillig   9289:                   "13.1.7.&nbsp;Handling packages with security problems">
                   9290:                   Section 13.1.7, &#8220;Handling packages with
1.1       grant    9291:                   security problems&#8221;</a> for more
                   9292:                   information.</p>
                   9293:                 </li>
                   9294: 
                   9295:                 <li>
                   9296:                   <p>If your package needs some executable to be
1.17      sketch   9297:                   able to run correctly and if there's no
1.14      xtraeme  9298:                   <code class="filename">buildlink3.mk</code> file,
                   9299:                   this is specified using the <code class=
                   9300:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    9301:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   9302:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.20      ben      9303:                   class="pkgname">print/lyx</a> package needs to be
                   9304:                   able to execute the latex binary from the teTeX
                   9305:                   package when it runs, and that is specified:</p>
1.1       grant    9306:                   <pre class="programlisting">
                   9307: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   9308: </pre>
                   9309: 
                   9310:                   <p>The comment about wildcard dependencies from
                   9311:                   previous paragraph applies here, too.</p>
                   9312:                 </li>
                   9313:               </ol>
                   9314:             </div>
                   9315: 
                   9316:             <p>If your package needs files from another package to
                   9317:             build, see the first part of the &#8220;<span class=
                   9318:             "quote">do-configure</span>&#8221; target <a xmlns=
                   9319:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9320:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.20      ben      9321:             class="pkgname">print/ghostscript5</a> package (it
                   9322:             relies on the jpeg sources being present in source form
                   9323:             during the build):</p>
1.1       grant    9324:             <pre class="programlisting">
                   9325: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   9326:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   9327:     fi
                   9328: </pre>
                   9329: 
                   9330:             <p>If you build any other packages that way, please
                   9331:             make sure the working files are deleted too when this
                   9332:             package's working files are cleaned up. The easiest way
                   9333:             to do so is by adding a pre-clean target:</p>
                   9334:             <pre class="programlisting">
                   9335: pre-clean:
                   9336:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   9337: </pre>
                   9338: 
1.14      xtraeme  9339:             <p>Please also note the <code class=
                   9340:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   9341:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   9342:             which are provided as convenience definitions. The
1.24      wiz      9343:             former works out whether <a href=
                   9344:             "http://netbsd.gw.com/cgi-bin/man-cgi?msgfmt+1+NetBSD-current">
                   9345:             <span class="citerefentry"><span class=
                   9346:             "refentrytitle">msgfmt</span>(1)</span></a> is part of
                   9347:             the base system, and, if it isn't, installs the
                   9348:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9349:             href=
1.1       grant    9350:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.20      ben      9351:             class="pkgname">devel/gettext</a> package. The latter
                   9352:             adds a build dependency on either an installed version
                   9353:             of an older gettext package, or if it isn't, installs
                   9354:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9355:             href=
                   9356:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
                   9357:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    9358:           </div>
                   9359: 
                   9360:           <div class="sect2" lang="en" xml:lang="en">
                   9361:             <div class="titlepage">
                   9362:               <div>
                   9363:                 <div>
1.28    ! rillig   9364:                   <h3 class="title"><a name="id2633374" id=
        !          9365:                   "id2633374"></a>13.1.4.&nbsp;Handling conflicts
1.1       grant    9366:                   with other packages</h3>
                   9367:                 </div>
                   9368:               </div>
                   9369:             </div>
                   9370: 
                   9371:             <p>Your package may conflict with other packages a user
                   9372:             might already have installed on his system, e.g. if
                   9373:             your package installs the same set of files like
                   9374:             another package in our pkgsrc tree.</p>
                   9375: 
1.14      xtraeme  9376:             <p>In this case you can set <code class=
                   9377:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    9378:             packages (including version string) your package
                   9379:             conflicts with.</p>
                   9380: 
                   9381:             <p>For example <a xmlns=
                   9382:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9383:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.20      ben      9384:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
                   9385:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9386:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
                   9387:             class="pkgname">x11/Xaw-Xpm</a> install provide the
                   9388:             same shared library, thus you set in <code class=
                   9389:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    9390:             <pre class="programlisting">
                   9391: CONFLICTS=      Xaw-Xpm-[0-9]*
                   9392: </pre>
                   9393: 
1.14      xtraeme  9394:             <p>and in <code class=
                   9395:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    9396:             <pre class="programlisting">
                   9397: CONFLICTS=      Xaw3d-[0-9]*
                   9398: </pre>
                   9399: 
                   9400:             <p>Packages will automatically conflict with other
                   9401:             packages with the name prefix and a different version
                   9402:             string. &#8220;<span class=
                   9403:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   9404:             conflict with the older version &#8220;<span class=
                   9405:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   9406:           </div>
                   9407: 
                   9408:           <div class="sect2" lang="en" xml:lang="en">
                   9409:             <div class="titlepage">
                   9410:               <div>
                   9411:                 <div>
1.28    ! rillig   9412:                   <h3 class="title"><a name="id2633493" id=
        !          9413:                   "id2633493"></a>13.1.5.&nbsp;Packages that cannot
1.1       grant    9414:                   or should not be built</h3>
                   9415:                 </div>
                   9416:               </div>
                   9417:             </div>
                   9418: 
                   9419:             <p>There are several reasons why a package might be
                   9420:             instructed to not build under certain circumstances. If
                   9421:             the package builds and runs on most platforms, the
1.14      xtraeme  9422:             exceptions should be noted with <code class=
                   9423:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   9424:             builds and runs on a small handful of platforms, set
                   9425:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
                   9426:             If the package should be skipped (for example, because
                   9427:             it provides functionality already provided by the
                   9428:             system), set <code class=
                   9429:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   9430:             message. If the package should fail because some
                   9431:             preconditions are not met, set <code class=
                   9432:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    9433:             message.</p>
                   9434: 
1.14      xtraeme  9435:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    9436:             because it didn't provide enough information to
                   9437:             determine whether the build should fail.</p>
                   9438:           </div>
                   9439: 
                   9440:           <div class="sect2" lang="en" xml:lang="en">
                   9441:             <div class="titlepage">
                   9442:               <div>
                   9443:                 <div>
1.28    ! rillig   9444:                   <h3 class="title"><a name="id2633518" id=
        !          9445:                   "id2633518"></a>13.1.6.&nbsp;Packages which
1.1       grant    9446:                   should not be deleted, once installed</h3>
                   9447:                 </div>
                   9448:               </div>
                   9449:             </div>
                   9450: 
                   9451:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  9452:             has been installed, the <code class=
                   9453:             "varname">PKG_PRESERVE</code> definition should be set
                   9454:             in the package Makefile. This will be carried into any
1.1       grant    9455:             binary package that is made from this pkgsrc entry. A
                   9456:             &#8220;<span class="quote">preserved</span>&#8221;
                   9457:             package will not be deleted using <a href=
                   9458:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   9459:             <span class="citerefentry"><span class=
                   9460:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   9461:             the &#8220;<span class="quote">-f</span>&#8221; option
                   9462:             is used.</p>
                   9463:           </div>
                   9464: 
                   9465:           <div class="sect2" lang="en" xml:lang="en">
                   9466:             <div class="titlepage">
                   9467:               <div>
                   9468:                 <div>
                   9469:                   <h3 class="title"><a name="security-handling" id=
1.25      rillig   9470:                   "security-handling"></a>13.1.7.&nbsp;Handling
1.1       grant    9471:                   packages with security problems</h3>
                   9472:                 </div>
                   9473:               </div>
                   9474:             </div>
                   9475: 
                   9476:             <p>When a vulnerability is found, this should be noted
1.14      xtraeme  9477:             in <code class=
                   9478:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    9479:             and after the commit of that file, it should be copied
1.14      xtraeme  9480:             to both <code class=
                   9481:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
                   9482:             and <code class=
                   9483:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
                   9484:             on ftp.NetBSD.org using <code class=
                   9485:             "filename">localsrc/security/advisories/Makefile</code>.
                   9486:             In addition, if a <code class=
                   9487:             "filename">buildlink3.mk</code> file exists for an
                   9488:             affected package, bumping <code class=
                   9489:             "varname">PKGREVISION</code> and creating a
                   9490:             corresponding <code class=
                   9491:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   9492:             "replaceable"><code>pkg</code></em></code> entry should
                   9493:             be considered. See <a href="#buildlink" title=
1.25      rillig   9494:             "Chapter&nbsp;10.&nbsp;Buildlink methodology">Chapter&nbsp;10,
1.1       grant    9495:             <i>Buildlink methodology</i></a> for more information
1.14      xtraeme  9496:             about writing <code class=
                   9497:             "filename">buildlink3.mk</code> files and <code class=
                   9498:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    9499: 
                   9500:             <p>Also, if the fix should be applied to the stable
                   9501:             pkgsrc branch, be sure to submit a pullup request!</p>
                   9502:           </div>
                   9503: 
                   9504:           <div class="sect2" lang="en" xml:lang="en">
                   9505:             <div class="titlepage">
                   9506:               <div>
                   9507:                 <div>
1.28    ! rillig   9508:                   <h3 class="title"><a name="id2633678" id=
        !          9509:                   "id2633678"></a>13.1.8.&nbsp;How to handle
1.1       grant    9510:                   compiler bugs</h3>
                   9511:                 </div>
                   9512:               </div>
                   9513:             </div>
                   9514: 
                   9515:             <p>Some source files trigger bugs in the compiler,
                   9516:             based on combinations of compiler version and
                   9517:             architecture and almost always relation to optimisation
                   9518:             being enabled. Common symptoms are gcc internal errors
                   9519:             or never finishing compiling a file.</p>
                   9520: 
                   9521:             <p>Typically a workaround involves testing the
1.14      xtraeme  9522:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    9523:             version, disabling optimisation for that
1.14      xtraeme  9524:             file/<code class="varname">MACHINE_ARCH</code>/compiler
                   9525:             combination, and documenting it in <code class=
                   9526:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    9527:             number of examples!</p>
                   9528:           </div>
                   9529: 
                   9530:           <div class="sect2" lang="en" xml:lang="en">
                   9531:             <div class="titlepage">
                   9532:               <div>
                   9533:                 <div>
1.28    ! rillig   9534:                   <h3 class="title"><a name="id2633701" id=
        !          9535:                   "id2633701"></a>13.1.9.&nbsp;How to handle
1.1       grant    9536:                   incrementing versions when fixing an existing
                   9537:                   package</h3>
                   9538:                 </div>
                   9539:               </div>
                   9540:             </div>
                   9541: 
                   9542:             <p>When making fixes to an existing package it can be
1.14      xtraeme  9543:             useful to change the version number in <code class=
                   9544:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    9545:             future versions by the original author, a
                   9546:             &#8220;<span class="quote">nb1</span>&#8221;,
                   9547:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   9548:             suffix can be used on package versions by setting
1.14      xtraeme  9549:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   9550:             The &#8220;<span class="quote">nb</span>&#8221; is
                   9551:             treated like a &#8220;<span class=
                   9552:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    9553:             <pre class="programlisting">
                   9554:   DISTNAME= foo-17.42
                   9555:     PKGREVISION=  9
                   9556: </pre>
                   9557: 
1.14      xtraeme  9558:             <p>will result in a <code class=
                   9559:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    9560:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   9561: 
                   9562:             <p>When a new release of the package is released, the
1.14      xtraeme  9563:             <code class="varname">PKGREVISION</code> should be
                   9564:             removed. e.g. on a new minor release of the above
                   9565:             package, things should be like:</p>
1.1       grant    9566:             <pre class="programlisting">
                   9567: DISTNAME=   foo-17.43
                   9568: </pre>
                   9569:           </div>
                   9570: 
                   9571:           <div class="sect2" lang="en" xml:lang="en">
                   9572:             <div class="titlepage">
                   9573:               <div>
                   9574:                 <div>
1.28    ! rillig   9575:                   <h3 class="title"><a name="id2633818" id=
        !          9576:                   "id2633818"></a>13.1.10.&nbsp;Portability of
1.1       grant    9577:                   packages</h3>
                   9578:                 </div>
                   9579:               </div>
                   9580:             </div>
                   9581: 
                   9582:             <p>One appealing feature of pkgsrc is that it runs on
                   9583:             many different platforms. As a result, it is important
                   9584:             to ensure, where possible, that packages in pkgsrc are
                   9585:             portable. There are some particular details you should
                   9586:             pay attention to while working on pkgsrc.</p>
                   9587: 
                   9588:             <div class="sect3" lang="en" xml:lang="en">
                   9589:               <div class="titlepage">
                   9590:                 <div>
                   9591:                   <div>
1.28    ! rillig   9592:                     <h4 class="title"><a name="id2633824" id=
        !          9593:                     "id2633824"></a>13.1.10.1.&nbsp;${INSTALL},
1.1       grant    9594:                     ${INSTALL_DATA_DIR}, ...</h4>
                   9595:                   </div>
                   9596:                 </div>
                   9597:               </div>
                   9598: 
1.14      xtraeme  9599:               <p>The BSD-compatible <span><strong class=
                   9600:               "command">install</strong></span> supplied with some
1.1       grant    9601:               operating systems will not perform more than one
                   9602:               operation at a time. As such, you should call
                   9603:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   9604:               etc. like this:</p>
                   9605:               <pre class="programlisting">
                   9606: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   9607: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   9608: </pre>
                   9609:             </div>
                   9610:           </div>
                   9611:         </div>
                   9612: 
                   9613:         <div class="sect1" lang="en" xml:lang="en">
                   9614:           <div class="titlepage">
                   9615:             <div>
                   9616:               <div>
                   9617:                 <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   9618:                 "id2633843" id="id2633843"></a>13.2.&nbsp;Possible
1.1       grant    9619:                 downloading issues</h2>
                   9620:               </div>
                   9621:             </div>
                   9622:           </div>
                   9623: 
                   9624:           <div class="sect2" lang="en" xml:lang="en">
                   9625:             <div class="titlepage">
                   9626:               <div>
                   9627:                 <div>
1.28    ! rillig   9628:                   <h3 class="title"><a name="id2633846" id=
        !          9629:                   "id2633846"></a>13.2.1.&nbsp;Packages whose
1.1       grant    9630:                   distfiles aren't available for plain
                   9631:                   downloading</h3>
                   9632:                 </div>
                   9633:               </div>
                   9634:             </div>
                   9635: 
                   9636:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  9637:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   9638:             and a <span><strong class="command">make
                   9639:             fetch</strong></span> will call <code class=
                   9640:             "filename">files/getsite.sh</code> with the name of
                   9641:             each file to download as an argument, expecting it to
                   9642:             output the URL of the directory from which to download
                   9643:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9644:             href=
1.1       grant    9645:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.20      ben      9646:             class="pkgname">graphics/ns-cult3d</a> is an example of
                   9647:             this usage.</p>
1.1       grant    9648: 
                   9649:             <p>If the download can't be automated, because the user
                   9650:             must submit personal information to apply for a
                   9651:             password, or must pay for the source, or whatever, you
1.14      xtraeme  9652:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   9653:             a macro which displays a message explaining the
                   9654:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   9655:             must be executable shell commands, not just a message.
                   9656:             (Generally, it executes <code class=
                   9657:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    9658:             following packages use this: <a xmlns=
                   9659:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9660:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.20      ben      9661:             class="pkgname">audio/realplayer</a>, <a xmlns=
                   9662:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9663:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
                   9664:             class="pkgname">cad/simian</a>, <a xmlns=
                   9665:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9666:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
                   9667:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
                   9668:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9669:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
                   9670:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
                   9671:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9672:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
                   9673:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
                   9674:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9675:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
                   9676:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
                   9677:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9678:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
                   9679:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
                   9680:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9681:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
                   9682:             class="pkgname">www/openacs</a>. Try to be consistent
                   9683:             with them.</p>
1.1       grant    9684:           </div>
                   9685: 
                   9686:           <div class="sect2" lang="en" xml:lang="en">
                   9687:             <div class="titlepage">
                   9688:               <div>
                   9689:                 <div>
1.28    ! rillig   9690:                   <h3 class="title"><a name="id2633909" id=
        !          9691:                   "id2633909"></a>13.2.2.&nbsp;How to handle
1.1       grant    9692:                   modified distfiles with the 'old' name</h3>
                   9693:                 </div>
                   9694:               </div>
                   9695:             </div>
                   9696: 
                   9697:             <p>Sometimes authors of a software package make some
                   9698:             modifications after the software was released, and they
                   9699:             put up a new distfile without changing the package's
                   9700:             version number. If a package is already in pkgsrc at
                   9701:             that time, the md5 checksum will no longer match. The
                   9702:             correct way to work around this is to update the
                   9703:             package's md5 checksum to match the package on the
                   9704:             master site (beware, any mirrors may not be up to date
                   9705:             yet!), and to remove the old distfile from
1.14      xtraeme  9706:             ftp.NetBSD.org's <code class=
                   9707:             "filename">/pub/NetBSD/packages/distfiles</code>
1.1       grant    9708:             directory. Furthermore, a mail to the package's author
                   9709:             seems appropriate making sure the distfile was really
                   9710:             updated on purpose, and that no trojan horse or so
                   9711:             crept in.</p>
                   9712:           </div>
                   9713:         </div>
                   9714: 
                   9715:         <div class="sect1" lang="en" xml:lang="en">
                   9716:           <div class="titlepage">
                   9717:             <div>
                   9718:               <div>
                   9719:                 <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   9720:                 "id2633921" id=
        !          9721:                 "id2633921"></a>13.3.&nbsp;Configuration
1.1       grant    9722:                 gotchas</h2>
                   9723:               </div>
                   9724:             </div>
                   9725:           </div>
                   9726: 
                   9727:           <div class="sect2" lang="en" xml:lang="en">
                   9728:             <div class="titlepage">
                   9729:               <div>
                   9730:                 <div>
                   9731:                   <h3 class="title"><a name="fixes.libtool" id=
1.25      rillig   9732:                   "fixes.libtool"></a>13.3.1.&nbsp;Shared libraries
1.1       grant    9733:                   - libtool</h3>
                   9734:                 </div>
                   9735:               </div>
                   9736:             </div>
                   9737: 
                   9738:             <p>pkgsrc supports many different machines, with
                   9739:             different object formats like a.out and ELF, and
                   9740:             varying abilities to do shared library and dynamic
                   9741:             loading at all. To accompany this, varying commands and
                   9742:             options have to be passed to the compiler, linker, etc.
                   9743:             to get the Right Thing, which can be pretty annoying
                   9744:             especially if you don't have all the machines at your
                   9745:             hand to test things. The <a xmlns=
                   9746:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   9747:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.20      ben      9748:             class="pkgname">devel/libtool</a> pkg can help here, as
                   9749:             it just &#8220;<span class="quote">knows</span>&#8221;
                   9750:             how to build both static and dynamic libraries from a
                   9751:             set of source files, thus being platform
                   9752:             independent.</p>
1.1       grant    9753: 
                   9754:             <p>Here's how to use libtool in a pkg in seven simple
                   9755:             steps:</p>
                   9756: 
                   9757:             <div class="orderedlist">
                   9758:               <ol type="1">
                   9759:                 <li>
1.14      xtraeme  9760:                   <p>Add <code class=
                   9761:                   "varname">USE_LIBTOOL=yes</code> to the package
                   9762:                   Makefile.</p>
1.1       grant    9763:                 </li>
                   9764: 
                   9765:                 <li>
                   9766:                   <p>For library objects, use &#8220;<span class=
                   9767:                   "quote">${LIBTOOL} --mode=compile
                   9768:                   ${CC}</span>&#8221; in place of
                   9769:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   9770:                   You could even add it to the definition of
1.14      xtraeme  9771:                   <code class="varname">CC</code>, if only
                   9772:                   libraries are being built in a given Makefile.
                   9773:                   This one command will build both PIC and non-PIC
                   9774:                   library objects, so you need not have separate
                   9775:                   shared and non-shared library rules.</p>
1.1       grant    9776:                 </li>
                   9777: 
                   9778:                 <li>
                   9779:                   <p>For the linking of the library, remove any
                   9780:                   &#8220;<span class="quote">ar</span>&#8221;,
                   9781:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   9782:                   and &#8220;<span class="quote">ld
                   9783:                   -Bshareable</span>&#8221; commands, and instead
                   9784:                   use:</p>
                   9785:                   <pre class="programlisting">
                   9786: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   9787: </pre>
                   9788: 
                   9789:                   <p>Note that the library is changed to have a
1.14      xtraeme  9790:                   <code class="filename">.la</code> extension, and
                   9791:                   the objects are changed to have a <code class=
                   9792:                   "filename">.lo</code> extension. Change
                   9793:                   <code class="varname">OBJS</code> as necessary.
                   9794:                   This automatically creates all of the
                   9795:                   <code class="filename">.a</code>, <code class=
                   9796:                   "filename">.so.major.minor</code>, and ELF
                   9797:                   symlinks (if necessary) in the build directory.
                   9798:                   Be sure to include &#8220;<span class=
1.1       grant    9799:                   "quote">-version-info</span>&#8221;, especially
                   9800:                   when major and minor are zero, as libtool will
                   9801:                   otherwise strip off the shared library
                   9802:                   version.</p>
                   9803: 
                   9804:                   <p>From the libtool manual:</p>
                   9805:                   <pre class="programlisting">
                   9806:      So, libtool library versions are described by three integers:
                   9807: 
                   9808: CURRENT
                   9809:        The most recent interface number that this library implements.
                   9810: 
                   9811: REVISION
                   9812:        The implementation number of the CURRENT interface.
                   9813: 
                   9814: AGE
                   9815:        The difference between the newest and oldest interfaces that this
                   9816:        library implements.  In other words, the library implements all the
                   9817:        interface numbers in the range from number `CURRENT - AGE' to
                   9818:        `CURRENT'.
                   9819:        
                   9820:      If two libraries have identical CURRENT and AGE numbers, then the
                   9821: dynamic linker chooses the library with the greater REVISION number. 
                   9822: </pre>
                   9823: 
                   9824:                   <p>The &#8220;<span class=
                   9825:                   "quote">-release</span>&#8221; option will
                   9826:                   produce different results for a.out and ELF
                   9827:                   (excluding symlinks) in only one case. An ELF
                   9828:                   library of the form &#8220;<span class=
                   9829:                   "quote">libfoo-release.so.<span class=
                   9830:                   "emphasis"><em>x</em></span>.<span class=
                   9831:                   "emphasis"><em>y</em></span></span>&#8221; will
                   9832:                   have a symlink of &#8220;<span class=
                   9833:                   "quote">libfoo.so.<span class=
                   9834:                   "emphasis"><em>x</em></span>.<span class=
                   9835:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   9836:                   a.out platform. This is handled
                   9837:                   automatically.</p>
                   9838: 
                   9839:                   <p>The &#8220;<span class="quote">-rpath
                   9840:                   argument</span>&#8221; is the install directory
                   9841:                   of the library being built.</p>
                   9842: 
1.14      xtraeme  9843:                   <p>In the <code class="filename">PLIST</code>,
1.19      hubertf  9844:                   include only the <code class=
                   9845:                   "filename">.la</code> file, the other files will
                   9846:                   be added automatically.</p>
1.1       grant    9847:                 </li>
                   9848: 
                   9849:                 <li>
1.14      xtraeme  9850:                   <p>When linking shared object (<code class=
                   9851:                   "filename">.so</code>) files, i.e. files that are
1.24      wiz      9852:                   loaded via <a href=
                   9853:                   "http://netbsd.gw.com/cgi-bin/man-cgi?dlopen+3+NetBSD-current">
                   9854:                   <span class="citerefentry"><span class=
                   9855:                   "refentrytitle">dlopen</span>(3)</span></a>, NOT
                   9856:                   shared libraries, use &#8220;<span class=
                   9857:                   "quote">-module -avoid-version</span>&#8221; to
                   9858:                   prevent them getting version tacked on.</p>
1.1       grant    9859: 
1.14      xtraeme  9860:                   <p>The <code class="filename">PLIST</code> file
                   9861:                   gets the <code class="filename">foo.so</code>
                   9862:                   entry.</p>
1.1       grant    9863:                 </li>
                   9864: 
                   9865:                 <li>
                   9866:                   <p>When linking programs that depend on these
                   9867:                   libraries <span class=
                   9868:                   "emphasis"><em>before</em></span> they are
                   9869:                   installed, preface the <a href=
                   9870:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   9871:                   <span class="citerefentry"><span class=
                   9872:                   "refentrytitle">cc</span>(1)</span></a> or
                   9873:                   <a href=
                   9874:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   9875:                   <span class="citerefentry"><span class=
                   9876:                   "refentrytitle">ld</span>(1)</span></a> line with
                   9877:                   &#8220;<span class="quote">${LIBTOOL}
                   9878:                   --mode=link</span>&#8221;, and it will find the
                   9879:                   correct libraries (static or shared), but please
                   9880:                   be aware that libtool will not allow you to
                   9881:                   specify a relative path in -L (such as
                   9882:                   &#8220;<span class=
                   9883:                   "quote">-L../somelib</span>&#8221;), because it
                   9884:                   expects you to change that argument to be the
1.14      xtraeme  9885:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    9886:                   <pre class="programlisting">
                   9887: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   9888: </pre>
                   9889: 
                   9890:                   <p>should be changed to:</p>
                   9891:                   <pre class="programlisting">
1.14      xtraeme  9892: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   9893: "replaceable"><code>someprog</code></em> <em class=
                   9894: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    9895: </pre>
                   9896: 
                   9897:                   <p>and it will do the right thing with the
                   9898:                   libraries.</p>
                   9899:                 </li>
                   9900: 
                   9901:                 <li>
                   9902:                   <p>When installing libraries, preface the
                   9903:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   9904:                   <span class="citerefentry"><span class=
                   9905:                   "refentrytitle">install</span>(1)</span></a> or
                   9906:                   <a href=
                   9907:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   9908:                   <span class="citerefentry"><span class=
                   9909:                   "refentrytitle">cp</span>(1)</span></a> command
                   9910:                   with &#8220;<span class="quote">${LIBTOOL}
                   9911:                   --mode=install</span>&#8221;, and change the
1.14      xtraeme  9912:                   library name to <code class=
                   9913:                   "filename">.la</code>. e.g.</p>
1.1       grant    9914:                   <pre class="programlisting">
                   9915: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   9916: </pre>
                   9917: 
1.14      xtraeme  9918:                   <p>This will install the static <code class=
                   9919:                   "filename">.a</code>, shared library, any needed
1.1       grant    9920:                   symlinks, and run <a href=
                   9921:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   9922:                   <span class="citerefentry"><span class=
                   9923:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   9924:                 </li>
                   9925: 
                   9926:                 <li>
1.14      xtraeme  9927:                   <p>In your <code class="filename">PLIST</code>,
1.23      wiz      9928:                   include only the <code class=
                   9929:                   "filename">.la</code> file (this is a change from
                   9930:                   previous behaviour).</p>
1.1       grant    9931:                 </li>
                   9932:               </ol>
                   9933:             </div>
                   9934:           </div>
                   9935: 
                   9936:           <div class="sect2" lang="en" xml:lang="en">
                   9937:             <div class="titlepage">
                   9938:               <div>
                   9939:                 <div>
1.28    ! rillig   9940:                   <h3 class="title"><a name="id2634286" id=
        !          9941:                   "id2634286"></a>13.3.2.&nbsp;Using libtool on GNU
1.1       grant    9942:                   packages that already support libtool</h3>
                   9943:                 </div>
                   9944:               </div>
                   9945:             </div>
                   9946: 
1.14      xtraeme  9947:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   9948:             the package Makefile. This will override the package's
                   9949:             own libtool in most cases. For older libtool using
1.1       grant    9950:             packages, libtool is made by ltconfig script during the
                   9951:             do-configure step; you can check the libtool script
1.14      xtraeme  9952:             location by doing <span><strong class="command">make
                   9953:             configure; find work*/ -name
                   9954:             libtool</strong></span>.</p>
                   9955: 
                   9956:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   9957:             specifies which libtool scripts, relative to
                   9958:             <code class="varname">WRKSRC</code>, to override. By
                   9959:             default, it is set to &#8220;<span class=
                   9960:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   9961:             this does not match the location of the package's
                   9962:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  9963: 
1.14      xtraeme  9964:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    9965:             static libraries built and installed, then use
1.14      xtraeme  9966:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    9967:             instead.</p>
                   9968: 
                   9969:             <p>If your package makes use of the platform
                   9970:             independent library for loading dynamic shared objects,
                   9971:             that comes with libtool (libltdl), you should include
1.22      tv       9972:             devel/libltdl/buildlink3.mk.</p>
1.1       grant    9973: 
                   9974:             <p>Some packages use libtool incorrectly so that the
                   9975:             package may not work or build in some circumstances.
                   9976:             Some of the more common errors are:</p>
                   9977: 
                   9978:             <div class="itemizedlist">
                   9979:               <ul type="disc">
                   9980:                 <li>
                   9981:                   <p>The inclusion of a shared object (-module) as
                   9982:                   a dependent library in an executable or library.
                   9983:                   This in itself isn't a problem if one of two
                   9984:                   things has been done:</p>
                   9985: 
                   9986:                   <div class="orderedlist">
                   9987:                     <ol type="1">
                   9988:                       <li>
                   9989:                         <p>The shared object is named correctly,
1.14      xtraeme  9990:                         i.e. <code class=
                   9991:                         "filename">libfoo.la</code>, not
                   9992:                         <code class="filename">foo.la</code></p>
1.1       grant    9993:                       </li>
                   9994: 
                   9995:                       <li>
                   9996:                         <p>The -dlopen option is used when linking
                   9997:                         an executable.</p>
                   9998:                       </li>
                   9999:                     </ol>
                   10000:                   </div>
                   10001:                 </li>
                   10002: 
                   10003:                 <li>
                   10004:                   <p>The use of libltdl without the correct calls
                   10005:                   to initialisation routines. The function
                   10006:                   lt_dlinit() should be called and the macro
1.14      xtraeme  10007:                   <code class=
                   10008:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    10009:                   included in executables.</p>
                   10010:                 </li>
                   10011:               </ul>
                   10012:             </div>
                   10013:           </div>
                   10014: 
                   10015:           <div class="sect2" lang="en" xml:lang="en">
                   10016:             <div class="titlepage">
                   10017:               <div>
                   10018:                 <div>
1.28    ! rillig   10019:                   <h3 class="title"><a name="id2634504" id=
        !          10020:                   "id2634504"></a>13.3.3.&nbsp;GNU
1.1       grant    10021:                   Autoconf/Automake</h3>
                   10022:                 </div>
                   10023:               </div>
                   10024:             </div>
                   10025: 
                   10026:             <p>If a package needs GNU autoconf or automake to be
                   10027:             executed to regenerate the configure script and
                   10028:             Makefile.in makefile templates, then they should be
                   10029:             executed in a pre-configure target. Two Makefile
1.14      xtraeme  10030:             fragments are provided in <code class=
                   10031:             "filename">pkgsrc/mk/autoconf.mk</code> and
                   10032:             <code class="filename">pkgsrc/mk/automake.mk</code> to
                   10033:             help dealing with these tools. See comments in these
                   10034:             files for details.</p>
1.1       grant    10035: 
                   10036:             <p>For packages that need only autoconf:</p>
                   10037:             <pre class="programlisting">
                   10038: AUTOCONF_REQD=    2.50    # if default version is not good enough
                   10039: ...
                   10040: 
                   10041: pre-configure:
                   10042:           cd ${WRKSRC}; ${AUTOCONF}
                   10043: 
                   10044: ...
                   10045: .include "../../mk/autoconf.mk"
                   10046: </pre>
                   10047: 
                   10048:             <p>and for packages that need automake and
                   10049:             autoconf:</p>
                   10050:             <pre class="programlisting">
                   10051: AUTOMAKE_REQD=  1.7.1   # if default version is not good enough
                   10052: ...
                   10053: 
                   10054: pre-configure:
                   10055:           cd ${WRKSRC};                                           \
                   10056:           ${ACLOCAL};                                             \
                   10057:           ${AUTOHEADER};                                          \
                   10058:           ${AUTOMAKE} -a --foreign -i;                            \
                   10059:           ${AUTOCONF}
                   10060: 
                   10061: ...
                   10062: .include "../mk/automake.mk"
                   10063: </pre>
                   10064: 
                   10065:             <p>Packages which use GNU Automake will almost
                   10066:             certainly require GNU Make, but that's automatically
1.14      xtraeme  10067:             provided for you in <code class=
                   10068:             "filename">mk/automake.mk</code>.</p>
1.1       grant    10069: 
                   10070:             <p>There are times when the configure process makes
                   10071:             additional changes to the generated files, which then
                   10072:             causes the build process to try to re-execute the
                   10073:             automake sequence. This is prevented by touching
                   10074:             various files in the configure stage. If this causes
1.14      xtraeme  10075:             problems with your package you can set <code class=
                   10076:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    10077:             Makefile.</p>
                   10078:           </div>
                   10079:         </div>
                   10080: 
                   10081:         <div class="sect1" lang="en" xml:lang="en">
                   10082:           <div class="titlepage">
                   10083:             <div>
                   10084:               <div>
                   10085:                 <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   10086:                 "id2634617" id="id2634617"></a>13.4.&nbsp;Building
1.1       grant    10087:                 considerations</h2>
                   10088:               </div>
                   10089:             </div>
                   10090:           </div>
                   10091: 
                   10092:           <div class="sect2" lang="en" xml:lang="en">
                   10093:             <div class="titlepage">
                   10094:               <div>
                   10095:                 <div>
1.28    ! rillig   10096:                   <h3 class="title"><a name="id2634620" id=
        !          10097:                   "id2634620"></a>13.4.1.&nbsp;CPP defines</h3>
1.1       grant    10098:                 </div>
                   10099:               </div>
                   10100:             </div>
                   10101: 
                   10102:             <p>To port an application to NetBSD, it's usually
                   10103:             necessary for the compiler to be able to judge the
                   10104:             system on which it's compiling, and we use definitions
                   10105:             so that the C pre-processor can do this.</p>
                   10106: 
                   10107:             <p>To test whether you are working on a 4.4 BSD-derived
                   10108:             system, you should use the BSD definition, which is
1.14      xtraeme  10109:             defined in <code class=
                   10110:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    10111:             systems.</p>
                   10112:             <pre class="programlisting">
                   10113: #include &lt;sys/param.h&gt;
                   10114: </pre>
                   10115: 
                   10116:             <p>and then you can surround the BSD-specific parts of
                   10117:             your package's C/C++ code using this conditional:</p>
                   10118:             <pre class="programlisting">
                   10119: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   10120:     ...
                   10121: #endif
                   10122: </pre>
                   10123: 
                   10124:             <p>Please use the &#8220;<span class=
                   10125:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   10126:             it should only apply to features of NetBSD that are not
                   10127:             present in other 4.4-lite derived BSDs.</p>
                   10128:           </div>
                   10129:         </div>
                   10130: 
                   10131:         <div class="sect1" lang="en" xml:lang="en">
                   10132:           <div class="titlepage">
                   10133:             <div>
                   10134:               <div>
                   10135:                 <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   10136:                 "id2634650" id="id2634650"></a>13.5.&nbsp;Package
1.1       grant    10137:                 specific actions</h2>
                   10138:               </div>
                   10139:             </div>
                   10140:           </div>
                   10141: 
                   10142:           <div class="sect2" lang="en" xml:lang="en">
                   10143:             <div class="titlepage">
                   10144:               <div>
                   10145:                 <div>
1.28    ! rillig   10146:                   <h3 class="title"><a name="id2634653" id=
        !          10147:                   "id2634653"></a>13.5.1.&nbsp;Package
1.1       grant    10148:                   configuration files</h3>
                   10149:                 </div>
                   10150:               </div>
                   10151:             </div>
                   10152: 
                   10153:             <p>Packages should be taught to look for their
1.14      xtraeme  10154:             configuration files in <code class=
                   10155:             "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1       grant    10156:             through to the configure and build processes.
1.14      xtraeme  10157:             <code class="varname">PKG_SYSCONFDIR</code> may be
1.1       grant    10158:             customized in various ways by setting other make
                   10159:             variables:</p>
                   10160: 
                   10161:             <div class="itemizedlist">
                   10162:               <ul type="disc">
                   10163:                 <li>
1.14      xtraeme  10164:                   <p><code class="varname">PKG_SYSCONFBASE</code>
                   10165:                   is the main config directory under which all
                   10166:                   package configuration files are to be found. This
                   10167:                   defaults to <code class=
                   10168:                   "filename">${PREFIX}/etc</code>, but may be
                   10169:                   overridden in <code class=
                   10170:                   "filename">/etc/mk.conf</code>.</p>
1.1       grant    10171:                 </li>
                   10172: 
                   10173:                 <li>
1.14      xtraeme  10174:                   <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   10175:                   is the subdirectory of <code class=
                   10176:                   "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    10177:                   configuration files for a particular package may
                   10178:                   be found, e.g. the Apache configuration files may
1.14      xtraeme  10179:                   all be found under the <code class=
                   10180:                   "filename">httpd/</code> subdirectory of
                   10181:                   <code class="varname">${PKG_SYSCONFBASE}</code>.
                   10182:                   This should be set in the package Makefile.</p>
1.1       grant    10183:                 </li>
                   10184: 
                   10185:                 <li>
1.14      xtraeme  10186:                   <p>By default, <code class=
                   10187:                   "varname">PKG_SYSCONFDIR</code> is set to
                   10188:                   <code class=
                   10189:                   "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
                   10190:                   but this may be overridden by setting
                   10191:                   <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   10192:                   for a particular package, where <code class=
                   10193:                   "varname">PKG_SYSCONFVAR</code> defaults to
                   10194:                   <code class="varname">${PKGBASE}</code>. This is
                   10195:                   not meant to be set by a package Makefile, but is
1.1       grant    10196:                   reserved for users who wish to override the
1.14      xtraeme  10197:                   <code class="varname">PKG_SYSCONFDIR</code>
                   10198:                   setting for a particular package with a special
1.1       grant    10199:                   location.</p>
                   10200:                 </li>
                   10201:               </ul>
                   10202:             </div>
                   10203: 
                   10204:             <p>The only variables that users should customize are
1.14      xtraeme  10205:             <code class="varname">PKG_SYSCONFBASE</code> and
                   10206:             <code class=
                   10207:             "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
                   10208:             Users will typically want to set <code class=
                   10209:             "varname">PKG_SYSCONFBASE</code> to <code class=
                   10210:             "filename">/etc</code>, or to accept the default
                   10211:             location of <code class=
                   10212:             "filename">${PREFIX}/etc</code>.</p>
1.1       grant    10213:           </div>
                   10214: 
                   10215:           <div class="sect2" lang="en" xml:lang="en">
                   10216:             <div class="titlepage">
                   10217:               <div>
                   10218:                 <div>
1.28    ! rillig   10219:                   <h3 class="title"><a name="id2634756" id=
        !          10220:                   "id2634756"></a>13.5.2.&nbsp;User
1.2       hubertf  10221:                   interaction</h3>
1.1       grant    10222:                 </div>
                   10223:               </div>
                   10224:             </div>
                   10225: 
                   10226:             <p>Occasionally, packages require interaction from the
                   10227:             user, and this can be in a number of ways:</p>
                   10228: 
                   10229:             <div class="itemizedlist">
                   10230:               <ul type="disc">
                   10231:                 <li>
                   10232:                   <p>help in fetching the distfiles</p>
                   10233:                 </li>
                   10234: 
                   10235:                 <li>
                   10236:                   <p>help to configure the package before it is
                   10237:                   built</p>
                   10238:                 </li>
                   10239: 
                   10240:                 <li>
                   10241:                   <p>help during the build process</p>
                   10242:                 </li>
                   10243: 
                   10244:                 <li>
                   10245:                   <p>help during the installation of a package</p>
                   10246:                 </li>
                   10247:               </ul>
                   10248:             </div>
                   10249: 
1.14      xtraeme  10250:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    10251:             definition is provided to notify the pkgsrc mechanism
                   10252:             of an interactive stage which will be needed, and this
1.14      xtraeme  10253:             should be set in the package's <code class=
                   10254:             "filename">Makefile</code>. e.g.</p>
1.1       grant    10255:             <pre class="programlisting">
                   10256: INTERACTIVE_STAGE= build
                   10257: </pre>
                   10258: 
                   10259:             <p>Multiple interactive stages can be specified:</p>
                   10260:             <pre class="programlisting">
                   10261: INTERACTIVE_STAGE= configure install
                   10262: </pre>
                   10263:           </div>
                   10264: 
                   10265:           <div class="sect2" lang="en" xml:lang="en">
                   10266:             <div class="titlepage">
                   10267:               <div>
                   10268:                 <div>
1.28    ! rillig   10269:                   <h3 class="title"><a name="id2634801" id=
        !          10270:                   "id2634801"></a>13.5.3.&nbsp;Handling
1.1       grant    10271:                   licenses</h3>
                   10272:                 </div>
                   10273:               </div>
                   10274:             </div>
                   10275: 
                   10276:             <p>A package may underly a license which the user has
                   10277:             or has not agreed to accept. Usually, packages that
                   10278:             underly well-known Open Source licenses (e.g. the GNU
                   10279:             Public License, GPL) won't have any special license
                   10280:             tags added in pkgsrc which require special action by
                   10281:             the user of such packages, but there are quite a number
                   10282:             of other licenses out there that pkgsrc users may not
                   10283:             be able to follow, for whatever reasons. For these
                   10284:             cases, pkgsrc contains a mechanism to note that a
                   10285:             package underlies a certain license, and the user has
                   10286:             to accept the license before the package can be
                   10287:             installed.</p>
                   10288: 
                   10289:             <p>Placing a certain package under a certain license
1.14      xtraeme  10290:             works by setting the <code class=
                   10291:             "varname">LICENSE</code> variable to a string
                   10292:             identifying the license, e.g. in <a xmlns=
                   10293:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10294:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.20      ben      10295:             class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    10296:             <pre class="programlisting">
                   10297: LICENSE=        graphviz-license
                   10298: </pre>
                   10299: 
                   10300:             <p>When trying to build, the user will get a notice
                   10301:             that the package underlies a license which he hasn't
                   10302:             accepted (yet):</p>
                   10303:             <pre class="programlisting">
1.14      xtraeme  10304: <code class="prompt">%</code> <strong class=
                   10305: "userinput"><code>make</code></strong>
1.1       grant    10306: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   10307: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   10308: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   10309: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   10310: *** Error code 1
                   10311: </pre>
                   10312: 
1.14      xtraeme  10313:             <p>The license can be viewed with <span><strong class=
                   10314:             "command">make show-license</strong></span>, and if it
                   10315:             is considered appropriate, the line printed above can
                   10316:             be added to <code class="filename">/etc/mk.conf</code>
                   10317:             to indicate acceptance of the particular license:</p>
1.1       grant    10318:             <pre class="programlisting">
                   10319: ACCEPTABLE_LICENSES+=graphviz-license
                   10320: </pre>
                   10321: 
                   10322:             <p>When adding a package with a new license, the
1.14      xtraeme  10323:             license text should be added to <code class=
                   10324:             "filename">pkgsrc/licenses</code> for displaying. A
                   10325:             list of known licenses can be seen in this directory as
                   10326:             well as by looking at the list of (commented out)
                   10327:             <code class="varname">ACCEPTABLE_LICENSES</code>
                   10328:             variable settings in <code class=
                   10329:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    10330: 
1.17      sketch   10331:             <p>If there is a <span class=
1.1       grant    10332:             "emphasis"><em>really</em></span> pressing need to
                   10333:             accept all licenses at once, like when trying to
                   10334:             download or mirror all distfiles or doing a bulk build
                   10335:             to test if all packages in pkgsrc build, this can be
1.14      xtraeme  10336:             done by setting <code class=
                   10337:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    10338:           </div>
                   10339: 
                   10340:           <div class="sect2" lang="en" xml:lang="en">
                   10341:             <div class="titlepage">
                   10342:               <div>
                   10343:                 <div>
1.28    ! rillig   10344:                   <h3 class="title"><a name="id2634884" id=
        !          10345:                   "id2634884"></a>13.5.4.&nbsp;Creating an account
1.1       grant    10346:                   from a package</h3>
                   10347:                 </div>
                   10348:               </div>
                   10349:             </div>
                   10350: 
                   10351:             <p>There are two make variables used to control the
                   10352:             creation of package-specific groups and users at
1.14      xtraeme  10353:             pre-install time. The first is <code class=
                   10354:             "varname">PKG_GROUPS</code>, which is a list of
1.1       grant    10355:             group[:groupid] elements, where the groupid is
1.14      xtraeme  10356:             optional. The second is <code class=
                   10357:             "varname">PKG_USERS</code>, which is a list of elements
1.1       grant    10358:             of the form:</p>
                   10359:             <pre class="programlisting">
                   10360: user:group[:[userid][:[description][:[home][:shell]]]]
                   10361: </pre>
                   10362: 
                   10363:             <p>where only the user and group are required, the rest
                   10364:             being optional. A simple example is:</p>
                   10365:             <pre class="programlisting">
                   10366:   PKG_GROUPS=       foogroup
                   10367:     PKG_USERS=    foouser:foogroup
                   10368: </pre>
                   10369: 
                   10370:             <p>A more complex example is that creates two groups
                   10371:             and two users is:</p>
                   10372:             <pre class="programlisting">
                   10373:   PKG_GROUPS=       group1 group2:1005
                   10374:     PKG_USERS=    first:group1::First\\ User                      \
                   10375:                   second:group2::Second\\ User:/home/second:${SH}
                   10376: </pre>
                   10377: 
                   10378:             <p>By default, a new user will have home directory
1.14      xtraeme  10379:             <code class="filename">/nonexistent</code>, and login
                   10380:             shell <code class="filename">/sbin/nologin</code>
                   10381:             unless they are specified as part of the user
                   10382:             element.</p>
1.1       grant    10383: 
1.14      xtraeme  10384:             <p>The package <code class="filename">Makefile</code>
                   10385:             must also set <code class=
                   10386:             "varname">USE_PKGINSTALL=YES</code>. This will cause
                   10387:             the users and groups to be created at pre-install time,
                   10388:             and the admin will be prompted to remove them at
                   10389:             post-deinstall time. Automatic creation of the users
                   10390:             and groups can be toggled on and off by setting the
                   10391:             <code class="varname">PKG_CREATE_USERGROUP</code>
                   10392:             variable prior to package installation.</p>
1.1       grant    10393:           </div>
                   10394: 
                   10395:           <div class="sect2" lang="en" xml:lang="en">
                   10396:             <div class="titlepage">
                   10397:               <div>
                   10398:                 <div>
1.28    ! rillig   10399:                   <h3 class="title"><a name="id2635014" id=
        !          10400:                   "id2635014"></a>13.5.5.&nbsp;Installing score
1.1       grant    10401:                   files</h3>
                   10402:                 </div>
                   10403:               </div>
                   10404:             </div>
                   10405: 
                   10406:             <p>Certain packages, most of them in the games
                   10407:             category, install a score file that allows all users on
                   10408:             the system to record their highscores. In order for
                   10409:             this to work, the binaries need to be installed setgid
                   10410:             and the score files owned by the appropriate group
                   10411:             and/or owner (traditionally the "games" user/group).
                   10412:             The following variables, documented in more detail in
1.14      xtraeme  10413:             <code class="filename">mk/defaults/mk.conf</code>,
                   10414:             control this behaviour: <code class=
                   10415:             "varname">SETGIDGAME</code>, <code class=
                   10416:             "varname">GAMEDATAMODE</code>, <code class=
                   10417:             "varname">GAMEGRP</code>, <code class=
                   10418:             "varname">GAMEMODE</code>, <code class=
                   10419:             "varname">GAMEOWN</code>.</p>
1.1       grant    10420: 
                   10421:             <p>Note that per default, setgid installation of games
1.14      xtraeme  10422:             is disabled; setting <code class=
                   10423:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    10424:             variables accordingly.</p>
                   10425: 
                   10426:             <p>A package should therefor never hard code file
1.14      xtraeme  10427:             ownership or access permissions but rely on
                   10428:             <code class="varname">INSTALL_GAME</code> and
                   10429:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   10430:             these correctly.</p>
1.1       grant    10431:           </div>
                   10432: 
                   10433:           <div class="sect2" lang="en" xml:lang="en">
                   10434:             <div class="titlepage">
                   10435:               <div>
                   10436:                 <div>
1.28    ! rillig   10437:                   <h3 class="title"><a name="id2635058" id=
        !          10438:                   "id2635058"></a>13.5.6.&nbsp;Packages providing
1.1       grant    10439:                   login shells</h3>
                   10440:                 </div>
                   10441:               </div>
                   10442:             </div>
                   10443: 
                   10444:             <p>If the purpose of the package is to provide a login
1.14      xtraeme  10445:             shell, the variable <code class=
                   10446:             "varname">PKG_SHELL</code> should contain the full
                   10447:             pathname of the shell executable installed by this
                   10448:             package. The package <code class=
                   10449:             "filename">Makefile</code> must also set <code class=
                   10450:             "varname">USE_PKGINSTALL=YES</code> to use the
                   10451:             automatically generated <code class=
                   10452:             "filename">INSTALL</code>/<code class=
                   10453:             "filename">DEINSTALL</code> scripts.</p>
1.1       grant    10454: 
                   10455:             <p>An example taken from shells/zsh:</p>
                   10456:             <pre class="programlisting">
                   10457:   USE_PKGINSTALL=   YES
                   10458:     PKG_SHELL=    ${PREFIX}/bin/zsh
                   10459: </pre>
                   10460: 
1.14      xtraeme  10461:             <p>The shell is registered into <code class=
                   10462:             "filename">/etc/shells</code> file automatically in the
                   10463:             post-install target by the generated <code class=
                   10464:             "filename">INSTALL</code> script and removed in the
                   10465:             deinstall target by the <code class=
                   10466:             "filename">DEINSTALL</code> script.</p>
1.1       grant    10467:           </div>
                   10468: 
                   10469:           <div class="sect2" lang="en" xml:lang="en">
                   10470:             <div class="titlepage">
                   10471:               <div>
                   10472:                 <div>
1.28    ! rillig   10473:                   <h3 class="title"><a name="id2635115" id=
        !          10474:                   "id2635115"></a>13.5.7.&nbsp;Packages containing
1.1       grant    10475:                   perl scripts</h3>
                   10476:                 </div>
                   10477:               </div>
                   10478:             </div>
                   10479: 
                   10480:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  10481:             set <code class="varname">REPLACE_PERL</code> to ensure
                   10482:             that the proper interpreter path is set. <code class=
                   10483:             "varname">REPLACE_PERL</code> should contain a list of
                   10484:             scripts, relative to <code class=
                   10485:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    10486:           </div>
                   10487: 
                   10488:           <div class="sect2" lang="en" xml:lang="en">
                   10489:             <div class="titlepage">
                   10490:               <div>
                   10491:                 <div>
1.28    ! rillig   10492:                   <h3 class="title"><a name="id2635133" id=
        !          10493:                   "id2635133"></a>13.5.8.&nbsp;Packages with
1.1       grant    10494:                   hardcoded paths to other interpreters</h3>
                   10495:                 </div>
                   10496:               </div>
                   10497:             </div>
                   10498: 
                   10499:             <p>Your package may also contain scripts with hardcoded
                   10500:             paths to other interpreters besides (or as well as)
                   10501:             perl. To correct the full pathname to the script
                   10502:             interpreter, you need to set the following definitions
1.14      xtraeme  10503:             in your <code class="filename">Makefile</code> (we
                   10504:             shall use <span><strong class=
                   10505:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    10506:             <pre class="programlisting">
                   10507:   REPLACE_INTERPRETER+=     tcl
                   10508:     _REPLACE.tcl.old=     .*/bin/tclsh
                   10509:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   10510:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   10511:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   10512: </pre>
                   10513:           </div>
                   10514: 
                   10515:           <div class="sect2" lang="en" xml:lang="en">
                   10516:             <div class="titlepage">
                   10517:               <div>
                   10518:                 <div>
1.28    ! rillig   10519:                   <h3 class="title"><a name="id2635155" id=
        !          10520:                   "id2635155"></a>13.5.9.&nbsp;Packages installing
1.1       grant    10521:                   perl modules</h3>
                   10522:                 </div>
                   10523:               </div>
                   10524:             </div>
                   10525: 
                   10526:             <p>Makefiles of packages providing perl5 modules should
1.14      xtraeme  10527:             include the Makefile fragment <code class=
                   10528:             "filename">../../lang/perl5/module.mk</code>. It
                   10529:             provides a <span><strong class=
                   10530:             "command">do-configure</strong></span> target for the
                   10531:             standard perl configuration for such modules as well as
                   10532:             various hooks to tune this configuration. See comments
                   10533:             in this file for details.</p>
1.1       grant    10534: 
                   10535:             <p>Perl5 modules will install into different places
                   10536:             depending on the version of perl used during the build
                   10537:             process. To address this, pkgsrc will append lines to
1.14      xtraeme  10538:             the <code class="filename">PLIST</code> corresponding
                   10539:             to the files listed in the installed <code class=
                   10540:             "filename">.packlist</code> file generated by most
                   10541:             perl5 modules. This is invoked by defining <code class=
                   10542:             "varname">PERL5_PACKLIST</code> to a space-separated
                   10543:             list of paths to packlist files, e.g.:</p>
1.1       grant    10544:             <pre class="programlisting">
                   10545: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   10546: </pre>
                   10547: 
1.14      xtraeme  10548:             <p>The variables <code class=
                   10549:             "varname">PERL5_SITELIB</code>, <code class=
                   10550:             "varname">PERL5_SITEARCH</code>, and <code class=
                   10551:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    10552:             locations in which perl5 modules may be installed, and
                   10553:             may be used by perl5 packages that don't have a
                   10554:             packlist. These three variables are also substituted
1.14      xtraeme  10555:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    10556:           </div>
                   10557: 
                   10558:           <div class="sect2" lang="en" xml:lang="en">
                   10559:             <div class="titlepage">
                   10560:               <div>
                   10561:                 <div>
                   10562:                   <h3 class="title"><a name="faq.info-files" id=
1.25      rillig   10563:                   "faq.info-files"></a>13.5.10.&nbsp;Packages
1.1       grant    10564:                   installing info files</h3>
                   10565:                 </div>
                   10566:               </div>
                   10567:             </div>
                   10568: 
                   10569:             <p>Some packages install info files or use the
                   10570:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   10571:             &#8220;<span class="quote">install-info</span>&#8221;
                   10572:             commands. Each of the info files:</p>
                   10573: 
                   10574:             <div class="itemizedlist">
                   10575:               <ul type="disc">
                   10576:                 <li>
                   10577:                   <p>is considered to be installed in the directory
1.14      xtraeme  10578:                   <code class=
                   10579:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    10580:                 </li>
                   10581: 
                   10582:                 <li>
                   10583:                   <p>is registered in the Info directory file
1.14      xtraeme  10584:                   <code class=
                   10585:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    10586:                 </li>
                   10587: 
                   10588:                 <li>
                   10589:                   <p>and must be listed as a filename in the
1.14      xtraeme  10590:                   <code class="varname">INFO_FILES</code> variable
                   10591:                   in the package Makefile.</p>
1.1       grant    10592:                 </li>
                   10593:               </ul>
                   10594:             </div>
                   10595: 
1.14      xtraeme  10596:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    10597:             &#8220;<span class="quote">info</span>&#8221; and can
1.14      xtraeme  10598:             be overridden in the package Makefile. <code class=
                   10599:             "filename">INSTALL</code> and <code class=
                   10600:             "filename">DEINSTALL</code> scripts will be generated
                   10601:             to handle registration of the info files in the Info
1.1       grant    10602:             directory file. The &#8220;<span class=
                   10603:             "quote">install-info</span>&#8221; command used for the
                   10604:             info files registration is either provided by the
                   10605:             system, or by a special purpose package automatically
                   10606:             added as dependency if needed.</p>
                   10607: 
                   10608:             <p>A package which needs the &#8220;<span class=
                   10609:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  10610:             must define the variable <code class=
                   10611:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    10612:             minimum version of the &#8220;<span class=
                   10613:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  10614:             should be noted with the <code class=
                   10615:             "varname">TEXINFO_REQD</code> variable in the package
                   10616:             <code class="filename">Makefile</code>. By default, a
1.1       grant    10617:             minimum version of 3.12 is required. If the system does
1.14      xtraeme  10618:             not provide a <span><strong class=
                   10619:             "command">makeinfo</strong></span> command or if it
                   10620:             does not match the required minimum, a build dependency
                   10621:             on the <a xmlns=
                   10622:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    10623:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.20      ben      10624:             class="pkgname">devel/gtexinfo</a> package will be
                   10625:             added automatically.</p>
1.1       grant    10626: 
                   10627:             <p>The build and installation process of the software
                   10628:             provided by the package should not use the
1.14      xtraeme  10629:             <span><strong class=
                   10630:             "command">install-info</strong></span> command as the
                   10631:             registration of info files is the task of the package
                   10632:             <code class="filename">INSTALL</code> script, and it
                   10633:             must use the appropriate <span><strong class=
                   10634:             "command">makeinfo</strong></span> command.</p>
1.1       grant    10635: 
                   10636:             <p>To achieve this goal the pkgsrc infrastructure
1.14      xtraeme  10637:             creates overriding scripts for the <span><strong class=
                   10638:             "command">install-info</strong></span> and
                   10639:             <span><strong class="command">makeinfo</strong></span>
                   10640:             commands in a directory listed early in <code class=
                   10641:             "varname">PATH</code>.</p>
1.1       grant    10642: 
1.14      xtraeme  10643:             <p>The script overriding <span><strong class=
                   10644:             "command">install-info</strong></span> has no effect
                   10645:             except the logging of a message. The script overriding
                   10646:             <span><strong class="command">makeinfo</strong></span>
                   10647:             logs a message and according to the value of
                   10648:             <code class="varname">USE_MAKEINFO</code> and
                   10649:             <code class="varname">TEXINFO_REQD</code> either run
                   10650:             the appropriate <span><strong class=
                   10651:             "command">makeinfo</strong></span> command or exit on
                   10652:             error.</p>
1.1       grant    10653:           </div>
                   10654: 
                   10655:           <div class="sect2" lang="en" xml:lang="en">
                   10656:             <div class="titlepage">
                   10657:               <div>
                   10658:                 <div>
1.28    ! rillig   10659:                   <h3 class="title"><a name="id2635511" id=
        !          10660:                   "id2635511"></a>13.5.11.&nbsp;Packages installing
1.1       grant    10661:                   GConf2 data files</h3>
                   10662:                 </div>
                   10663:               </div>
                   10664:             </div>
                   10665: 
1.14      xtraeme  10666:             <p>If a package installs <code class=
                   10667:             "filename">.schemas</code> or <code class=
                   10668:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    10669:             need to take some extra steps to make sure they get
                   10670:             registered in the database:</p>
                   10671: 
                   10672:             <div class="orderedlist">
                   10673:               <ol type="1">
                   10674:                 <li>
1.14      xtraeme  10675:                   <p>Include <code class=
                   10676:                   "filename">../../devel/GConf2/schemas.mk</code>
                   10677:                   instead of its <code class=
                   10678:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    10679:                   care of rebuilding the GConf2 database at
                   10680:                   installation and deinstallation time, and tells
                   10681:                   the package where to install GConf2 data files
                   10682:                   using some standard configure arguments. It also
                   10683:                   disallows any access to the database directly
                   10684:                   from the package.</p>
                   10685:                 </li>
                   10686: 
                   10687:                 <li>
                   10688:                   <p>Ensure that the package installs its
1.14      xtraeme  10689:                   <code class="filename">.schemas</code> files
                   10690:                   under <code class=
                   10691:                   "filename">${PREFIX}/share/gconf/schemas</code>.
                   10692:                   If they get installed under <code class=
                   10693:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    10694:                   manually patch the package.</p>
                   10695:                 </li>
                   10696: 
                   10697:                 <li>
                   10698:                   <p>Check the PLIST and remove any entries under
                   10699:                   the etc/gconf directory, as they will be handled
                   10700:                   automatically. See <a href="#faq.conf" title=
1.14      xtraeme  10701:                   "6.14.&nbsp;Configuration files handling and placement">
                   10702:                   Section&nbsp;6.14, &#8220;Configuration files
1.1       grant    10703:                   handling and placement&#8221;</a> for more
                   10704:                   information.</p>
                   10705:                 </li>
                   10706: 
                   10707:                 <li>
1.14      xtraeme  10708:                   <p>Define the <code class=
                   10709:                   "varname">GCONF2_SCHEMAS</code> variable in your
                   10710:                   <code class="filename">Makefile</code> with a
                   10711:                   list of all <code class=
                   10712:                   "filename">.schemas</code> files installed by the
                   10713:                   package, if any. Names must not contain any
                   10714:                   directories in them.</p>
1.1       grant    10715:                 </li>
                   10716: 
                   10717:                 <li>
1.14      xtraeme  10718:                   <p>Define the <code class=
                   10719:                   "varname">GCONF2_ENTRIES</code> variable in your
                   10720:                   <code class="filename">Makefile</code> with a
                   10721:                   list of all <code class=
                   10722:                   "filename">.entries</code> files installed by the
                   10723:                   package, if any. Names must not contain any
                   10724:                   directories in them.</p>
1.1       grant    10725:                 </li>
                   10726:               </ol>
                   10727:             </div>
                   10728:           </div>
                   10729: 
                   10730:           <div class="sect2" lang="en" xml:lang="en">
                   10731:             <div class="titlepage">
                   10732:               <div>
                   10733:                 <div>
1.28    ! rillig   10734:                   <h3 class="title"><a name="id2635680" id=
        !          10735:                   "id2635680"></a>13.5.12.&nbsp;Packages installing
1.1       grant    10736:                   scrollkeeper data files</h3>
                   10737:                 </div>
                   10738:               </div>
                   10739:             </div>
                   10740: 
1.14      xtraeme  10741:             <p>If a package installs <code class=
                   10742:             "filename">.omf</code> files, used by scrollkeeper, you
                   10743:             need to take some extra steps to make sure they get
                   10744:             registered in the database:</p>
1.1       grant    10745: 
                   10746:             <div class="orderedlist">
                   10747:               <ol type="1">
                   10748:                 <li>
1.14      xtraeme  10749:                   <p>Include <code class=
                   10750:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
                   10751:                   instead of its <code class=
                   10752:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    10753:                   care of rebuilding the scrollkeeper database at
                   10754:                   installation and deinstallation time, and
                   10755:                   disallows any access to it directly from the
                   10756:                   package.</p>
                   10757:                 </li>
                   10758: 
                   10759:                 <li>
                   10760:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10761:                   the <code class=
                   10762:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    10763:                   as they will be handled automatically.</p>
                   10764:                 </li>
                   10765: 
                   10766:                 <li>
1.14      xtraeme  10767:                   <p>Remove the <code class=
                   10768:                   "filename">share/omf</code> directory from the
                   10769:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    10770:                 </li>
                   10771:               </ol>
                   10772:             </div>
                   10773:           </div>
                   10774: 
                   10775:           <div class="sect2" lang="en" xml:lang="en">
                   10776:             <div class="titlepage">
                   10777:               <div>
                   10778:                 <div>
1.28    ! rillig   10779:                   <h3 class="title"><a name="id2635731" id=
        !          10780:                   "id2635731"></a>13.5.13.&nbsp;Packages installing
1.1       grant    10781:                   X11 fonts</h3>
                   10782:                 </div>
                   10783:               </div>
                   10784:             </div>
                   10785: 
                   10786:             <p>If a package installs font files, you will need to
                   10787:             rebuild the fonts database in the directory where they
                   10788:             get installed at installation and deinstallation time.
1.14      xtraeme  10789:             This can be automatically done by using <code class=
                   10790:             "filename">mk/fonts.mk</code>, which you need to
                   10791:             include in your <code class=
                   10792:             "filename">Makefile</code>.</p>
1.1       grant    10793: 
                   10794:             <p>When the file is included, you can list the
1.14      xtraeme  10795:             directories where fonts are installed in the
                   10796:             <code class="varname">FONTS_<em class=
                   10797:             "replaceable"><code>type</code></em>_DIRS</code>
                   10798:             variables, where <em class=
                   10799:             "replaceable"><code>type</code></em> can be one of
                   10800:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    10801:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   10802:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.14      xtraeme  10803:             sure that the database file <code class=
                   10804:             "filename">fonts.dir</code> is not listed in the
1.1       grant    10805:             PLIST.</p>
                   10806: 
                   10807:             <p>Note that you should not create new directories for
                   10808:             fonts; instead use the standard ones to avoid that the
                   10809:             user needs to manually configure his X server to find
                   10810:             them.</p>
                   10811:           </div>
                   10812: 
                   10813:           <div class="sect2" lang="en" xml:lang="en">
                   10814:             <div class="titlepage">
                   10815:               <div>
                   10816:                 <div>
1.28    ! rillig   10817:                   <h3 class="title"><a name="id2635778" id=
        !          10818:                   "id2635778"></a>13.5.14.&nbsp;Packages installing
1.1       grant    10819:                   GTK2 modules</h3>
                   10820:                 </div>
                   10821:               </div>
                   10822:             </div>
                   10823: 
                   10824:             <p>If a package installs gtk2 immodules or loaders, you
                   10825:             need to take some extra steps to get them registered in
                   10826:             the GTK2 database properly:</p>
                   10827: 
                   10828:             <div class="orderedlist">
                   10829:               <ol type="1">
                   10830:                 <li>
1.14      xtraeme  10831:                   <p>Include <code class=
                   10832:                   "filename">../../x11/gtk2/modules.mk</code>
                   10833:                   instead of its <code class=
                   10834:                   "filename">buildlink3.mk</code> file. This takes
                   10835:                   care of rebuilding the database at installation
                   10836:                   and deinstallation time.</p>
1.1       grant    10837:                 </li>
                   10838: 
                   10839:                 <li>
1.14      xtraeme  10840:                   <p>Set <code class=
                   10841:                   "varname">GTK2_IMMODULES=YES</code> if your
                   10842:                   package installs GTK2 immodules.</p>
1.1       grant    10843:                 </li>
                   10844: 
                   10845:                 <li>
1.14      xtraeme  10846:                   <p>Set <code class=
                   10847:                   "varname">GTK2_LOADERS=YES</code> if your package
                   10848:                   installs GTK2 loaders.</p>
1.1       grant    10849:                 </li>
                   10850: 
                   10851:                 <li>
                   10852:                   <p>Patch the package to not touch any of the gtk2
                   10853:                   databases directly. These are:</p>
                   10854: 
                   10855:                   <div class="itemizedlist">
                   10856:                     <ul type="disc">
                   10857:                       <li>
1.14      xtraeme  10858:                         <p><code class=
                   10859:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    10860:                       </li>
                   10861: 
                   10862:                       <li>
1.14      xtraeme  10863:                         <p><code class=
                   10864:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    10865:                       </li>
                   10866:                     </ul>
                   10867:                   </div>
                   10868:                 </li>
                   10869: 
                   10870:                 <li>
                   10871:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10872:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    10873:                   directory, as they will be handled
                   10874:                   automatically.</p>
                   10875:                 </li>
                   10876:               </ol>
                   10877:             </div>
                   10878:           </div>
                   10879: 
                   10880:           <div class="sect2" lang="en" xml:lang="en">
                   10881:             <div class="titlepage">
                   10882:               <div>
                   10883:                 <div>
1.28    ! rillig   10884:                   <h3 class="title"><a name="id2635847" id=
        !          10885:                   "id2635847"></a>13.5.15.&nbsp;Packages installing
1.1       grant    10886:                   SGML or XML data</h3>
                   10887:                 </div>
                   10888:               </div>
                   10889:             </div>
                   10890: 
                   10891:             <p>If a package installs SGML or XML data files that
                   10892:             need to be registered in system-wide catalogs (like
                   10893:             DTDs, sub-catalogs, etc.), you need to take some extra
                   10894:             steps:</p>
                   10895: 
                   10896:             <div class="orderedlist">
                   10897:               <ol type="1">
                   10898:                 <li>
1.14      xtraeme  10899:                   <p>Include <code class=
                   10900:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
                   10901:                   in your <code class="filename">Makefile</code>,
                   10902:                   which takes care of registering those files in
1.1       grant    10903:                   system-wide catalogs at installation and
                   10904:                   deinstallation time.</p>
                   10905:                 </li>
                   10906: 
                   10907:                 <li>
1.14      xtraeme  10908:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   10909:                   to the full path of any SGML catalogs installed
                   10910:                   by the package.</p>
1.1       grant    10911:                 </li>
                   10912: 
                   10913:                 <li>
1.14      xtraeme  10914:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   10915:                   to the full path of any XML catalogs installed by
1.1       grant    10916:                   the package.</p>
                   10917:                 </li>
                   10918: 
                   10919:                 <li>
1.14      xtraeme  10920:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   10921:                   to individual entries to be added to the SGML
1.1       grant    10922:                   catalog. These come in groups of three strings;
                   10923:                   see xmlcatmgr(1) for more information
                   10924:                   (specifically, arguments recognized by the 'add'
                   10925:                   action). Note that you will normally not use this
                   10926:                   variable.</p>
                   10927:                 </li>
                   10928: 
                   10929:                 <li>
1.14      xtraeme  10930:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   10931:                   to individual entries to be added to the XML
1.1       grant    10932:                   catalog. These come in groups of three strings;
                   10933:                   see xmlcatmgr(1) for more information
                   10934:                   (specifically, arguments recognized by the 'add'
                   10935:                   action). Note that you will normally not use this
                   10936:                   variable.</p>
                   10937:                 </li>
                   10938:               </ol>
                   10939:             </div>
                   10940:           </div>
                   10941: 
                   10942:           <div class="sect2" lang="en" xml:lang="en">
                   10943:             <div class="titlepage">
                   10944:               <div>
                   10945:                 <div>
1.28    ! rillig   10946:                   <h3 class="title"><a name="id2635899" id=
        !          10947:                   "id2635899"></a>13.5.16.&nbsp;Packages installing
1.1       grant    10948:                   extensions to the MIME database</h3>
                   10949:                 </div>
                   10950:               </div>
                   10951:             </div>
                   10952: 
                   10953:             <p>If a package provides extensions to the MIME
1.14      xtraeme  10954:             database by installing <code class=
                   10955:             "filename">.xml</code> files inside <code class=
                   10956:             "filename">${PREFIX}/share/mime/packages</code>, you
                   10957:             need to take some extra steps to ensure that the
                   10958:             database is kept consistent with respect to these new
                   10959:             files:</p>
1.1       grant    10960: 
                   10961:             <div class="orderedlist">
                   10962:               <ol type="1">
                   10963:                 <li>
1.14      xtraeme  10964:                   <p>Include <code class=
                   10965:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
                   10966:                   (avoid using the <code class=
                   10967:                   "filename">buildlink3.mk</code> file from this
                   10968:                   same directory, which is reserved for inclusion
                   10969:                   from other <code class=
                   10970:                   "filename">buildlink3.mk</code> files). It takes
                   10971:                   care of rebuilding the MIME database at
                   10972:                   installation and deinstallation time, and
                   10973:                   disallows any access to it directly from the
1.1       grant    10974:                   package.</p>
                   10975:                 </li>
                   10976: 
                   10977:                 <li>
                   10978:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10979:                   the <code class="filename">share/mime</code>
1.1       grant    10980:                   directory, <span class=
                   10981:                   "emphasis"><em>except</em></span> for files saved
1.14      xtraeme  10982:                   under <code class=
                   10983:                   "filename">share/mime/packages</code>. The former
1.1       grant    10984:                   are handled automatically by the
                   10985:                   update-mime-database program, but the later are
                   10986:                   package-dependent and must be removed by the
                   10987:                   package that installed them in the first
                   10988:                   place.</p>
                   10989:                 </li>
                   10990: 
                   10991:                 <li>
1.14      xtraeme  10992:                   <p>Remove any <code class=
                   10993:                   "filename">share/mime/*</code> directories from
                   10994:                   the PLIST. They will be handled by the
1.1       grant    10995:                   shared-mime-info package.</p>
                   10996:                 </li>
                   10997:               </ol>
                   10998:             </div>
                   10999:           </div>
                   11000: 
                   11001:           <div class="sect2" lang="en" xml:lang="en">
                   11002:             <div class="titlepage">
                   11003:               <div>
                   11004:                 <div>
1.28    ! rillig   11005:                   <h3 class="title"><a name="id2636038" id=
        !          11006:                   "id2636038"></a>13.5.17.&nbsp;Packages using
1.1       grant    11007:                   intltool</h3>
                   11008:                 </div>
                   11009:               </div>
                   11010:             </div>
                   11011: 
                   11012:             <p>If a package uses intltool during its build, include
1.14      xtraeme  11013:             the <code class=
                   11014:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    11015:             file, which forces it to use the intltool package
                   11016:             provided by pkgsrc, instead of the one bundled with the
                   11017:             distribution file.</p>
                   11018: 
                   11019:             <p>This tracks intltool's build-time dependencies and
                   11020:             uses the latest available version; this way, the
                   11021:             package benefits of any bug fixes that may have
                   11022:             appeared since it was released.</p>
                   11023:           </div>
1.18      xtraeme  11024: 
                   11025:           <div class="sect2" lang="en" xml:lang="en">
                   11026:             <div class="titlepage">
                   11027:               <div>
                   11028:                 <div>
1.28    ! rillig   11029:                   <h3 class="title"><a name="id2636052" id=
        !          11030:                   "id2636052"></a>13.5.18.&nbsp;Packages installing
1.18      xtraeme  11031:                   startup scripts</h3>
                   11032:                 </div>
                   11033:               </div>
                   11034:             </div>
                   11035: 
                   11036:             <p>If a package contains a rc.d script, it won't be
                   11037:             copied into the startup directory by default, but you
                   11038:             can enable it, by adding the option <code class=
                   11039:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
                   11040:             "filename">/etc/mk.conf</code>. This option will copy
                   11041:             the scripts into <code class=
                   11042:             "filename">/etc/rc.d</code> when a package is
                   11043:             installed, and it will automatically remove the scripts
                   11044:             when the package is deinstalled.</p>
                   11045:           </div>
1.1       grant    11046:         </div>
                   11047: 
                   11048:         <div class="sect1" lang="en" xml:lang="en">
                   11049:           <div class="titlepage">
                   11050:             <div>
                   11051:               <div>
                   11052:                 <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   11053:                 "id2636073" id="id2636073"></a>13.6.&nbsp;Feedback
1.1       grant    11054:                 to the author</h2>
                   11055:               </div>
                   11056:             </div>
                   11057:           </div>
                   11058: 
                   11059:           <p>If you have found any bugs in the package you make
                   11060:           available, if you had to do special steps to make it run
                   11061:           under NetBSD or if you enhanced the software in various
                   11062:           other ways, be sure to report these changes back to the
                   11063:           original author of the program! With that kind of
                   11064:           support, the next release of the program can incorporate
                   11065:           these fixes, and people not using the NetBSD packages
                   11066:           system can win from your efforts.</p>
                   11067: 
                   11068:           <p>Support the idea of free software!</p>
                   11069:         </div>
                   11070:       </div>
                   11071: 
                   11072:       <div class="chapter" lang="en" xml:lang="en">
                   11073:         <div class="titlepage">
                   11074:           <div>
                   11075:             <div>
                   11076:               <h2 class="title"><a name="debug" id=
1.25      rillig   11077:               "debug"></a>Chapter&nbsp;14.&nbsp;Debugging</h2>
1.1       grant    11078:             </div>
                   11079:           </div>
                   11080:         </div>
                   11081: 
                   11082:         <p>To check out all the gotchas when building a package,
                   11083:         here are the steps that I do in order to get a package
                   11084:         working. Please note this is basically the same as what was
                   11085:         explained in the previous sections, only with some
                   11086:         debugging aids.</p>
                   11087: 
                   11088:         <div class="itemizedlist">
                   11089:           <ul type="disc">
                   11090:             <li>
1.14      xtraeme  11091:               <p>Be sure to set <code class=
                   11092:               "varname">PKG_DEVELOPER=1</code> in <code class=
                   11093:               "filename">/etc/mk.conf</code></p>
1.1       grant    11094:             </li>
                   11095: 
                   11096:             <li>
                   11097:               <p>Install <a xmlns=
                   11098:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   11099:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.20      ben      11100:               class="pkgname">pkgtools/url2pkg</a>, create a
                   11101:               directory for a new package, change into it, then run
                   11102:               <span><strong class=
                   11103:               "command">url2pkg</strong></span>:</p>
1.1       grant    11104:               <pre class="screen">
1.14      xtraeme  11105: <code class="prompt">%</code> <strong class=
                   11106: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   11107: "replaceable"><code>category</code></em>/<em class=
                   11108: "replaceable"><code>examplepkg</code></em></code></strong>
                   11109: <code class="prompt">%</code> <strong class=
                   11110: "userinput"><code>cd /usr/pkgsrc/<em class=
                   11111: "replaceable"><code>category</code></em>/<em class=
                   11112: "replaceable"><code>examplepkg</code></em></code></strong>
                   11113: <code class="prompt">%</code> <strong class=
                   11114: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    11115: </pre>
                   11116:             </li>
                   11117: 
                   11118:             <li>
1.14      xtraeme  11119:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    11120:               requested.</p>
                   11121:             </li>
                   11122: 
                   11123:             <li>
1.14      xtraeme  11124:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    11125:               file</p>
                   11126:             </li>
                   11127: 
                   11128:             <li>
1.14      xtraeme  11129:               <p>Run <span><strong class="command">make
                   11130:               configure</strong></span></p>
1.1       grant    11131:             </li>
                   11132: 
                   11133:             <li>
                   11134:               <p>Add any dependencies glimpsed from documentation
1.14      xtraeme  11135:               and the configure step to the package's <code class=
                   11136:               "filename">Makefile</code>.</p>
1.1       grant    11137:             </li>
                   11138: 
                   11139:             <li>
                   11140:               <p>Make the package compile, doing multiple rounds
                   11141:               of</p>
                   11142:               <pre class="screen">
1.14      xtraeme  11143: <code class="prompt">%</code> <strong class=
                   11144: "userinput"><code>make</code></strong>
                   11145: <code class="prompt">%</code> <strong class=
                   11146: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   11147: <code class="prompt">%</code> <strong class=
                   11148: "userinput"><code>mkpatches</code></strong>
                   11149: <code class="prompt">%</code> <strong class=
                   11150: "userinput"><code>patchdiff</code></strong>
                   11151: <code class="prompt">%</code> <strong class=
                   11152: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   11153: <code class="prompt">%</code> <strong class=
                   11154: "userinput"><code>make mps</code></strong>
                   11155: <code class="prompt">%</code> <strong class=
                   11156: "userinput"><code>make clean</code></strong>
1.1       grant    11157: </pre>
                   11158: 
                   11159:               <p>Doing as non-root user will ensure that no files
                   11160:               are modified that shouldn't be, especially during the
1.14      xtraeme  11161:               build phase. <span><strong class=
                   11162:               "command">mkpatches</strong></span>,
                   11163:               <span><strong class=
                   11164:               "command">patchdiff</strong></span> and
                   11165:               <span><strong class="command">pkgvi</strong></span>
                   11166:               are from the <a xmlns=
1.1       grant    11167:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   11168:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.20      ben      11169:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    11170:             </li>
                   11171: 
                   11172:             <li>
1.14      xtraeme  11173:               <p>Look at the <code class=
                   11174:               "filename">Makefile</code>, fix if necessary; see
                   11175:               <a href="#components.Makefile" title=
1.27      rillig   11176:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
1.14      xtraeme  11177:               &#8220;<code class=
                   11178:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    11179:             </li>
                   11180: 
                   11181:             <li>
1.14      xtraeme  11182:               <p>Generate a <code class=
                   11183:               "filename">PLIST</code>:</p>
1.1       grant    11184:               <pre class="screen">
1.14      xtraeme  11185: <code class="prompt">#</code> <strong class=
                   11186: "userinput"><code>make install</code></strong>
                   11187: <code class="prompt">#</code> <strong class=
                   11188: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   11189: <code class="prompt">#</code> <strong class=
                   11190: "userinput"><code>make deinstall</code></strong>
                   11191: <code class="prompt">#</code> <strong class=
                   11192: "userinput"><code>make install</code></strong>
                   11193: <code class="prompt">#</code> <strong class=
                   11194: "userinput"><code>make deinstall</code></strong>
1.1       grant    11195: </pre>
                   11196: 
1.14      xtraeme  11197:               <p>You usually need to be <code class=
                   11198:               "username">root</code> to do this. Look if there are
1.1       grant    11199:               any files left:</p>
                   11200:               <pre class="screen">
1.14      xtraeme  11201: <code class="prompt">#</code> <strong class=
                   11202: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    11203: </pre>
                   11204: 
                   11205:               <p>If this reveals any files that are missing in
1.14      xtraeme  11206:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    11207:             </li>
                   11208: 
                   11209:             <li>
1.14      xtraeme  11210:               <p>Now that the <code class="filename">PLIST</code>
                   11211:               is OK, install the package again and make a binary
1.1       grant    11212:               package:</p>
                   11213:               <pre class="screen">
1.14      xtraeme  11214: <code class="prompt">#</code> <strong class=
                   11215: "userinput"><code>make reinstall</code></strong>
                   11216: <code class="prompt">#</code> <strong class=
                   11217: "userinput"><code>make package</code></strong>
1.1       grant    11218: </pre>
                   11219:             </li>
                   11220: 
                   11221:             <li>
                   11222:               <p>Delete the installed package:</p>
                   11223:               <pre class="screen">
1.14      xtraeme  11224: <code class="prompt">#</code> <strong class=
                   11225: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    11226: </pre>
                   11227:             </li>
                   11228: 
                   11229:             <li>
1.14      xtraeme  11230:               <p>Repeat the above <span><strong class=
                   11231:               "command">make print-PLIST</strong></span> command,
                   11232:               which shouldn't find anything now:</p>
1.1       grant    11233:               <pre class="screen">
1.14      xtraeme  11234: <code class="prompt">#</code> <strong class=
                   11235: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    11236: </pre>
                   11237:             </li>
                   11238: 
                   11239:             <li>
                   11240:               <p>Reinstall the binary package:</p>
                   11241:               <pre class="screen">
1.14      xtraeme  11242: <code class="prompt">#</code> <strong class=
                   11243: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    11244: </pre>
                   11245:             </li>
                   11246: 
                   11247:             <li>
                   11248:               <p>Play with it. Make sure everything works.</p>
                   11249:             </li>
                   11250: 
                   11251:             <li>
1.14      xtraeme  11252:               <p>Run <span><strong class=
                   11253:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    11254:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   11255:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      11256:               class="pkgname">pkgtools/pkglint</a>, and fix the
                   11257:               problems it reports:</p>
1.1       grant    11258:               <pre class="screen">
1.14      xtraeme  11259: <code class="prompt">#</code> <strong class=
                   11260: "userinput"><code>pkglint</code></strong>
1.1       grant    11261: </pre>
                   11262:             </li>
                   11263: 
                   11264:             <li>
                   11265:               <p>Submit (or commit, if you have cvs access); see
                   11266:               <a href="#submit" title=
1.25      rillig   11267:               "Chapter&nbsp;15.&nbsp;Submitting and Committing">Chapter&nbsp;15,
1.1       grant    11268:               <i>Submitting and Committing</i></a>.</p>
                   11269:             </li>
                   11270:           </ul>
                   11271:         </div>
                   11272:       </div>
                   11273: 
                   11274:       <div class="chapter" lang="en" xml:lang="en">
                   11275:         <div class="titlepage">
                   11276:           <div>
                   11277:             <div>
                   11278:               <h2 class="title"><a name="submit" id=
1.25      rillig   11279:               "submit"></a>Chapter&nbsp;15.&nbsp;Submitting and
1.1       grant    11280:               Committing</h2>
                   11281:             </div>
                   11282:           </div>
                   11283:         </div>
                   11284: 
                   11285:         <div class="toc">
                   11286:           <p><b>Table of Contents</b></p>
                   11287: 
                   11288:           <dl>
1.28    ! rillig   11289:             <dt><span class="sect1"><a href="#id2636740">15.1.
1.1       grant    11290:             Submitting your packages</a></span></dt>
                   11291: 
1.28    ! rillig   11292:             <dt><span class="sect1"><a href="#id2636797">15.2.
1.1       grant    11293:             Committing: Importing a package into
                   11294:             CVS</a></span></dt>
                   11295: 
1.28    ! rillig   11296:             <dt><span class="sect1"><a href="#id2636860">15.3.
1.2       hubertf  11297:             Updating a package to a newer version</a></span></dt>
1.1       grant    11298: 
1.28    ! rillig   11299:             <dt><span class="sect1"><a href="#id2636880">15.4.
1.2       hubertf  11300:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    11301:           </dl>
                   11302:         </div>
                   11303: 
                   11304:         <div class="sect1" lang="en" xml:lang="en">
                   11305:           <div class="titlepage">
                   11306:             <div>
                   11307:               <div>
                   11308:                 <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   11309:                 "id2636740" id=
        !          11310:                 "id2636740"></a>15.1.&nbsp;Submitting your
1.1       grant    11311:                 packages</h2>
                   11312:               </div>
                   11313:             </div>
                   11314:           </div>
                   11315: 
                   11316:           <p>You have to separate between binary and
                   11317:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   11318:           packages here:</p>
                   11319: 
                   11320:           <div class="itemizedlist">
                   11321:             <ul type="disc">
                   11322:               <li>
                   11323:                 <p>precompiled binary packages</p>
                   11324: 
                   11325:                 <p>Our policy is that we accept binaries only from
                   11326:                 pkgsrc developers to guarantee that the packages
                   11327:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  11328:                 annoy anyone but rather to protect our users!
1.1       grant    11329:                 You're still free to put up your home-made binary
1.13      hubertf  11330:                 packages and tell the world where to get them.
                   11331:                 NetBSD developers doing bulk builds and wanting to
                   11332:                 upload them please see <a href="#bulk-upload"
                   11333:                 title="5.3.8.&nbsp;Uploading results of a bulk build">
                   11334:                 Section&nbsp;5.3.8, &#8220;Uploading results of a
                   11335:                 bulk build&#8221;</a>.</p>
1.1       grant    11336:               </li>
                   11337: 
                   11338:               <li>
                   11339:                 <p>packages</p>
                   11340: 
                   11341:                 <p>First, check that your package is complete,
                   11342:                 compiles and runs well; see <a href="#debug" title=
1.25      rillig   11343:                 "Chapter&nbsp;14.&nbsp;Debugging">Chapter&nbsp;14,
1.1       grant    11344:                 <i>Debugging</i></a> and the rest of this document.
1.24      wiz      11345:                 Next, generate an uuencoded gzipped <a href=
                   11346:                 "http://netbsd.gw.com/cgi-bin/man-cgi?tar+1+NetBSD-current">
                   11347:                 <span class="citerefentry"><span class=
                   11348:                 "refentrytitle">tar</span>(1)</span></a> archive,
1.1       grant    11349:                 preferably with all files in a single directory.
1.14      xtraeme  11350:                 Finally, <span><strong class=
                   11351:                 "command">send-pr</strong></span> with category
1.1       grant    11352:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   11353:                 synopsis which includes the package name and
                   11354:                 version number, a short description of your package
                   11355:                 (contents of the COMMENT variable or DESCR file are
                   11356:                 OK) and attach the archive to your PR.</p>
                   11357: 
                   11358:                 <p>If you want to submit several packages, please
                   11359:                 send a separate PR for each one, it's easier for us
                   11360:                 to track things that way.</p>
                   11361: 
                   11362:                 <p>Alternatively, you can also import new packages
                   11363:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   11364:                 work-in-progress</span>&#8221;); see the homepage
                   11365:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   11366:                 target=
                   11367:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   11368:                 details.</p>
                   11369:               </li>
                   11370:             </ul>
                   11371:           </div>
                   11372:         </div>
                   11373: 
                   11374:         <div class="sect1" lang="en" xml:lang="en">
                   11375:           <div class="titlepage">
                   11376:             <div>
                   11377:               <div>
                   11378:                 <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   11379:                 "id2636797" id=
        !          11380:                 "id2636797"></a>15.2.&nbsp;Committing: Importing a
1.1       grant    11381:                 package into CVS</h2>
                   11382:               </div>
                   11383:             </div>
                   11384:           </div>
                   11385: 
                   11386:           <p>This section is only of interest for pkgsrc developers
                   11387:           with write access to the pkgsrc repository. Please
                   11388:           remember that cvs imports files relative to the current
                   11389:           working directory, and that the pathname that you give
1.14      xtraeme  11390:           the <span><strong class="command">cvs
                   11391:           import</strong></span> command is so that it knows where
                   11392:           to place the files in the repository. Newly created
                   11393:           packages should be imported with a vendor tag of
                   11394:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   11395:           release tag of &#8220;<span class=
                   11396:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    11397:           <pre class="programlisting">
                   11398:   % cd .../pkgsrc/category/pkgname
                   11399:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   11400: </pre>
                   11401: 
                   11402:           <p>Remember to move the directory from which you imported
                   11403:           out of the way, or cvs will complain the next time you
                   11404:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   11405:           source tree. Also don't forget to add the new package to
1.14      xtraeme  11406:           the category's <code class=
                   11407:           "filename">Makefile</code>.</p>
1.1       grant    11408: 
                   11409:           <p>The commit message of the initial import should
1.14      xtraeme  11410:           include part of the <code class="filename">DESCR</code>
                   11411:           file, so people reading the mailing lists know what the
                   11412:           package is/does.</p>
1.1       grant    11413: 
                   11414:           <p>Please note all package updates/additions in
1.14      xtraeme  11415:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
                   11416:           very important to keep this file up to date and
                   11417:           conforming to the existing format, because it will be
                   11418:           used by scripts to automatically update pages on <a href=
1.1       grant    11419:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   11420:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   11421:           file and remove the entry for the package you updated, in
                   11422:           case it was mentioned there.</p>
                   11423: 
                   11424:           <p>For new packages, &#8220;<span class="quote">cvs
                   11425:           import</span>&#8221; is preferred to &#8220;<span class=
                   11426:           "quote">cvs add</span>&#8221; because the former gets
                   11427:           everything with a single command, and provides a
                   11428:           consistent tag.</p>
                   11429:         </div>
                   11430: 
                   11431:         <div class="sect1" lang="en" xml:lang="en">
                   11432:           <div class="titlepage">
                   11433:             <div>
                   11434:               <div>
                   11435:                 <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   11436:                 "id2636860" id="id2636860"></a>15.3.&nbsp;Updating
1.2       hubertf  11437:                 a package to a newer version</h2>
1.1       grant    11438:               </div>
                   11439:             </div>
                   11440:           </div>
                   11441: 
                   11442:           <p>Please always put a concise, appropriate and relevant
                   11443:           summary of the changes between old and new versions into
                   11444:           the commit log when updating a package. There are various
                   11445:           reasons for this:</p>
                   11446: 
                   11447:           <div class="itemizedlist">
                   11448:             <ul type="disc">
                   11449:               <li>
                   11450:                 <p>A URL is volatile, and can change over time. It
                   11451:                 may go away completely or its information may be
                   11452:                 overwritten by newer information.</p>
                   11453:               </li>
                   11454: 
                   11455:               <li>
                   11456:                 <p>Having the change information between old and
                   11457:                 new versions in our CVS repository is very useful
                   11458:                 for people who use either cvs or anoncvs.</p>
                   11459:               </li>
                   11460: 
                   11461:               <li>
                   11462:                 <p>Having the change information between old and
                   11463:                 new versions in our CVS repository is very useful
                   11464:                 for people who read the pkgsrc-changes mailing
                   11465:                 list, so that they can make tactical decisions
                   11466:                 about when to upgrade the package.</p>
                   11467:               </li>
                   11468:             </ul>
                   11469:           </div>
                   11470: 
1.18      xtraeme  11471:           <p>Please also recognize that, just because a new version
1.1       grant    11472:           of a package has been released, it should not
                   11473:           automatically be upgraded in the CVS repository. We
                   11474:           prefer to be conservative in the packages that are
                   11475:           included in pkgsrc - development or beta packages are not
                   11476:           really the best thing for most places in which pkgsrc is
                   11477:           used. Please use your judgement about what should go into
                   11478:           pkgsrc, and bear in mind that stability is to be
                   11479:           preferred above new and possibly untested features.</p>
                   11480:         </div>
                   11481: 
                   11482:         <div class="sect1" lang="en" xml:lang="en">
                   11483:           <div class="titlepage">
                   11484:             <div>
                   11485:               <div>
                   11486:                 <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   11487:                 "id2636880" id="id2636880"></a>15.4.&nbsp;Moving a
1.2       hubertf  11488:                 package in pkgsrc</h2>
1.1       grant    11489:               </div>
                   11490:             </div>
                   11491:           </div>
                   11492: 
                   11493:           <div class="orderedlist">
                   11494:             <ol type="1">
                   11495:               <li>
                   11496:                 <p>Make a copy of the directory somewhere else.</p>
                   11497:               </li>
                   11498: 
                   11499:               <li>
                   11500:                 <p>Remove all CVS dirs.</p>
                   11501: 
                   11502:                 <p>Alternatively to the first two steps you can
                   11503:                 also do:</p>
                   11504:                 <pre class="screen">
1.14      xtraeme  11505: <code class="prompt">%</code> <strong class=
                   11506: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    11507: </pre>
                   11508: 
                   11509:                 <p>and use that for further work.</p>
                   11510:               </li>
                   11511: 
                   11512:               <li>
1.14      xtraeme  11513:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   11514:                 any <code class="varname">DEPENDS</code> paths that
                   11515:                 just did &#8220;<span class=
1.1       grant    11516:                 "quote">../package</span>&#8221; instead of
                   11517:                 &#8220;<span class=
                   11518:                 "quote">../../category/package</span>&#8221;.</p>
                   11519:               </li>
                   11520: 
                   11521:               <li>
1.14      xtraeme  11522:                 <p><span><strong class="command">cvs
                   11523:                 import</strong></span> the modified package in the
                   11524:                 new place.</p>
1.1       grant    11525:               </li>
                   11526: 
                   11527:               <li>
                   11528:                 <p>Check if any package depends on it:</p>
                   11529:                 <pre class="screen">
1.14      xtraeme  11530: <code class="prompt">%</code> <strong class=
                   11531: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   11532: <code class="prompt">%</code> <strong class=
                   11533: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    11534: </pre>
                   11535:               </li>
                   11536: 
                   11537:               <li>
                   11538:                 <p>Fix paths in packages from step 5 to point to
                   11539:                 new location.</p>
                   11540:               </li>
                   11541: 
                   11542:               <li>
1.14      xtraeme  11543:                 <p><span><strong class="command">cvs rm
                   11544:                 (-f)</strong></span> the package at the old
                   11545:                 location.</p>
1.1       grant    11546:               </li>
                   11547: 
                   11548:               <li>
1.14      xtraeme  11549:                 <p>Remove from <code class=
                   11550:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    11551:               </li>
                   11552: 
                   11553:               <li>
1.14      xtraeme  11554:                 <p>Add to <code class=
                   11555:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    11556:               </li>
                   11557: 
                   11558:               <li>
                   11559:                 <p>Commit the changed and removed files:</p>
                   11560:                 <pre class="screen">
1.14      xtraeme  11561: <code class="prompt">%</code> <strong class=
                   11562: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    11563: </pre>
                   11564: 
                   11565:                 <p>(and any packages from step 5, of course).</p>
                   11566:               </li>
                   11567:             </ol>
                   11568:           </div>
                   11569:         </div>
                   11570:       </div>
                   11571:     </div>
                   11572: 
                   11573:     <div class="appendix" lang="en" xml:lang="en">
                   11574:       <div class="titlepage">
                   11575:         <div>
                   11576:           <div>
                   11577:             <h2 class="title"><a name="examples" id=
                   11578:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   11579:             package: bison</h2>
                   11580:           </div>
                   11581:         </div>
                   11582:       </div>
                   11583: 
                   11584:       <div class="toc">
                   11585:         <p><b>Table of Contents</b></p>
                   11586: 
                   11587:         <dl>
1.28    ! rillig   11588:           <dt><span class="sect1"><a href="#id2637037">A.1.
1.1       grant    11589:           files</a></span></dt>
                   11590: 
                   11591:           <dd>
                   11592:             <dl>
1.28    ! rillig   11593:               <dt><span class="sect2"><a href="#id2637041">A.1.1.
1.1       grant    11594:               Makefile</a></span></dt>
                   11595: 
1.28    ! rillig   11596:               <dt><span class="sect2"><a href="#id2637048">A.1.2.
1.1       grant    11597:               DESCR</a></span></dt>
                   11598: 
1.28    ! rillig   11599:               <dt><span class="sect2"><a href="#id2637063">A.1.3.
1.1       grant    11600:               PLIST</a></span></dt>
                   11601: 
1.28    ! rillig   11602:               <dt><span class="sect2"><a href="#id2637070">A.1.4.
1.14      xtraeme  11603:               Checking a package with <span><strong class=
                   11604:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    11605:             </dl>
                   11606:           </dd>
                   11607: 
1.28    ! rillig   11608:           <dt><span class="sect1"><a href="#id2637111">A.2. Steps
1.1       grant    11609:           for building, installing, packaging</a></span></dt>
                   11610:         </dl>
                   11611:       </div>
                   11612: 
                   11613:       <p>We checked to find a piece of software that wasn't in the
                   11614:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  11615:       would want to have <span><strong class=
                   11616:       "command">bison</strong></span> when Berkeley
                   11617:       <span><strong class="command">yacc</strong></span> is already
                   11618:       present in the tree is beyond us, but it's useful for the
                   11619:       purposes of this exercise.</p>
1.1       grant    11620: 
                   11621:       <div class="sect1" lang="en" xml:lang="en">
                   11622:         <div class="titlepage">
                   11623:           <div>
                   11624:             <div>
                   11625:               <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   11626:               "id2637037" id="id2637037"></a>A.1.&nbsp;files</h2>
1.1       grant    11627:             </div>
                   11628:           </div>
                   11629:         </div>
                   11630: 
                   11631:         <div class="sect2" lang="en" xml:lang="en">
                   11632:           <div class="titlepage">
                   11633:             <div>
                   11634:               <div>
1.28    ! rillig   11635:                 <h3 class="title"><a name="id2637041" id=
        !          11636:                 "id2637041"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    11637:               </div>
                   11638:             </div>
                   11639:           </div>
                   11640:           <pre class="programlisting">
1.17      sketch   11641: # $NetBSD$
1.1       grant    11642: #
                   11643: 
                   11644: DISTNAME=       bison-1.25
                   11645: CATEGORIES=     devel
                   11646: MASTER_SITES=   ${MASTER_SITE_GNU}
                   11647: 
                   11648: MAINTAINER=     thorpej@NetBSD.org
                   11649: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   11650: COMMENT=        GNU yacc clone
                   11651: 
                   11652: GNU_CONFIGURE=  yes
                   11653: INFO_FILES=     bison.info
                   11654: 
                   11655: .include "../../mk/bsd.pkg.mk"
                   11656: </pre>
                   11657:         </div>
                   11658: 
                   11659:         <div class="sect2" lang="en" xml:lang="en">
                   11660:           <div class="titlepage">
                   11661:             <div>
                   11662:               <div>
1.28    ! rillig   11663:                 <h3 class="title"><a name="id2637048" id=
        !          11664:                 "id2637048"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    11665:               </div>
                   11666:             </div>
                   11667:           </div>
                   11668:           <pre class="programlisting">
                   11669: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   11670: improvements.  Why you would want this when Berkeley <a href=
                   11671: "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
                   11672: of the NetBSD source tree is beyond me.
                   11673: </pre>
                   11674:         </div>
                   11675: 
                   11676:         <div class="sect2" lang="en" xml:lang="en">
                   11677:           <div class="titlepage">
                   11678:             <div>
                   11679:               <div>
1.28    ! rillig   11680:                 <h3 class="title"><a name="id2637063" id=
        !          11681:                 "id2637063"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    11682:               </div>
                   11683:             </div>
                   11684:           </div>
                   11685:           <pre class="programlisting">
1.17      sketch   11686: @comment $NetBSD$
1.1       grant    11687: bin/bison
                   11688: man/man1/bison.1.gz
                   11689: share/bison.simple
                   11690: share/bison.hairy
                   11691: </pre>
                   11692:         </div>
                   11693: 
                   11694:         <div class="sect2" lang="en" xml:lang="en">
                   11695:           <div class="titlepage">
                   11696:             <div>
                   11697:               <div>
1.28    ! rillig   11698:                 <h3 class="title"><a name="id2637070" id=
        !          11699:                 "id2637070"></a>A.1.4.&nbsp;Checking a package with
1.14      xtraeme  11700:                 <span><strong class=
                   11701:                 "command">pkglint</strong></span></h3>
1.1       grant    11702:               </div>
                   11703:             </div>
                   11704:           </div>
                   11705: 
                   11706:           <p>The NetBSD package system comes with <a xmlns=
                   11707:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   11708:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.20      ben      11709:           class="pkgname">pkgtools/pkglint</a> which helps to check
                   11710:           the contents of these files. After installation it is
                   11711:           quite easy to use, just change to the directory of the
                   11712:           package you wish to examine and execute
                   11713:           <span><strong class=
                   11714:           "command">pkglint</strong></span>:</p>
1.1       grant    11715:           <pre class="screen">
1.14      xtraeme  11716: <code class="prompt">$</code> <strong class=
                   11717: "userinput"><code>pkglint</code></strong>
1.1       grant    11718: looks fine.
                   11719: </pre>
                   11720: 
                   11721:           <p>Depending on the supplied command line arguments (see
                   11722:           pkglint(1)) more verbose checks will be performed. Use
1.14      xtraeme  11723:           e.g. <span><strong class="command">pkglint
                   11724:           -v</strong></span> for a very verbose check.</p>
1.1       grant    11725:         </div>
                   11726:       </div>
                   11727: 
                   11728:       <div class="sect1" lang="en" xml:lang="en">
                   11729:         <div class="titlepage">
                   11730:           <div>
                   11731:             <div>
                   11732:               <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   11733:               "id2637111" id="id2637111"></a>A.2.&nbsp;Steps for
1.1       grant    11734:               building, installing, packaging</h2>
                   11735:             </div>
                   11736:           </div>
                   11737:         </div>
                   11738: 
                   11739:         <p>Create the directory where the package lives, plus any
                   11740:         auxiliary directories:</p>
                   11741:         <pre class="screen">
1.14      xtraeme  11742: <code class="prompt">#</code> <strong class=
                   11743: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   11744: <code class="prompt">#</code> <strong class=
                   11745: "userinput"><code>mkdir bison</code></strong>
                   11746: <code class="prompt">#</code> <strong class=
                   11747: "userinput"><code>cd bison</code></strong>
                   11748: <code class="prompt">#</code> <strong class=
                   11749: "userinput"><code>mkdir patches</code></strong>
1.1       grant    11750: </pre>
                   11751: 
1.14      xtraeme  11752:         <p>Create <code class="filename">Makefile</code>,
                   11753:         <code class="filename">DESCR</code> and <code class=
                   11754:         "filename">PLIST</code> (see <a href="#components" title=
1.27      rillig   11755:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   11756:         Chapter 7, <i>Package components - files, directories and
1.1       grant    11757:         contents</i></a>) then continue with fetching the
                   11758:         distfile:</p>
                   11759:         <pre class="screen">
1.14      xtraeme  11760: <code class="prompt">#</code> <strong class=
                   11761: "userinput"><code>make fetch</code></strong>
1.1       grant    11762: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   11763: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   11764: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11765: ftp: Error retrieving file: 500 Internal error
                   11766: 
                   11767: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   11768: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11769: ftp: Error retrieving file: 500 Internal error
                   11770: 
                   11771: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   11772: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   11773: Successfully retrieved file.
                   11774: </pre>
                   11775: 
1.14      xtraeme  11776:         <p>Generate the checksum of the distfile into <code class=
                   11777:         "filename">distinfo</code>:</p>
1.1       grant    11778:         <pre class="screen">
1.14      xtraeme  11779: <code class="prompt">#</code> <strong class=
                   11780: "userinput"><code>make makesum</code></strong>
1.1       grant    11781: </pre>
                   11782: 
                   11783:         <p>Now compile:</p>
                   11784:         <pre class="screen">
1.14      xtraeme  11785: <code class="prompt">#</code> <strong class=
                   11786: "userinput"><code>make</code></strong>
1.1       grant    11787: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11788: ===&gt;  Extracting for bison-1.25
                   11789: ===&gt;  Patching for bison-1.25
                   11790: ===&gt;   Ignoring empty patch directory
                   11791: ===&gt;  Configuring for bison-1.25
                   11792: creating cache ./config.cache
                   11793: checking for gcc... cc
                   11794: checking whether we are using GNU C... yes
                   11795: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   11796: checking how to run the C preprocessor... cc -E
                   11797: checking for minix/config.h... no
                   11798: checking for POSIXized ISC... no
                   11799: checking whether cross-compiling... no
                   11800: checking for ANSI C header files... yes
                   11801: checking for string.h... yes
                   11802: checking for stdlib.h... yes
                   11803: checking for memory.h... yes
                   11804: checking for working const... yes
                   11805: checking for working alloca.h... no
                   11806: checking for alloca... yes
                   11807: checking for strerror... yes
                   11808: updating cache ./config.cache
                   11809: creating ./config.status
                   11810: creating Makefile
                   11811: ===&gt;  Building for bison-1.25
                   11812: 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
                   11813: 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
                   11814: 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
                   11815: 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
                   11816: 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
                   11817: 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 
                   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 getargs.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 gram.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 lalr.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 lex.c
                   11822: 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
                   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 nullable.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 output.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 print.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 reader.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 reduce.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 symtab.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 warshall.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 version.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 getopt.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 getopt1.c
                   11833: 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
                   11834: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   11835: rm -f bison.s1
                   11836: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   11837: </pre>
                   11838: 
                   11839:         <p>Everything seems OK, so install the files:</p>
                   11840:         <pre class="screen">
1.14      xtraeme  11841: <code class="prompt">#</code> <strong class=
                   11842: "userinput"><code>make install</code></strong>
1.1       grant    11843: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11844: ===&gt;  Installing for bison-1.25
                   11845: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   11846: rm -f /usr/pkg/bin/bison
                   11847: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   11848: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   11849: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   11850: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   11851: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   11852: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   11853: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   11854: ===&gt;  Registering installation for bison-1.25
                   11855: </pre>
                   11856: 
                   11857:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  11858:         remove it with <span><strong class="command">pkg_delete
                   11859:         bison</strong></span>. Should you decide that you want a
                   11860:         binary package, do this now:</p>
1.1       grant    11861:         <pre class="screen">
1.14      xtraeme  11862: <code class="prompt">#</code> <strong class=
                   11863: "userinput"><code>make package</code></strong>
1.1       grant    11864: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11865: ===&gt;  Building package for bison-1.25
                   11866: Creating package bison-1.25.tgz
                   11867: Registering depends:.
                   11868: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   11869: </pre>
                   11870: 
                   11871:         <p>Now that you don't need the source and object files any
                   11872:         more, clean up:</p>
                   11873:         <pre class="screen">
1.14      xtraeme  11874: <code class="prompt">#</code> <strong class=
                   11875: "userinput"><code>make clean</code></strong>
1.1       grant    11876: ===&gt;  Cleaning for bison-1.25
                   11877: </pre>
                   11878:       </div>
                   11879:     </div>
                   11880: 
                   11881:     <div class="appendix" lang="en" xml:lang="en">
                   11882:       <div class="titlepage">
                   11883:         <div>
                   11884:           <div>
                   11885:             <h2 class="title"><a name="logs" id=
                   11886:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   11887:           </div>
                   11888:         </div>
                   11889:       </div>
                   11890: 
                   11891:       <div class="toc">
                   11892:         <p><b>Table of Contents</b></p>
                   11893: 
                   11894:         <dl>
                   11895:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   11896:           Building figlet</a></span></dt>
                   11897: 
                   11898:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   11899:           Packaging figlet</a></span></dt>
                   11900:         </dl>
                   11901:       </div>
                   11902: 
                   11903:       <div class="sect1" lang="en" xml:lang="en">
                   11904:         <div class="titlepage">
                   11905:           <div>
                   11906:             <div>
                   11907:               <h2 class="title" style="clear: both"><a name=
                   11908:               "logs.building" id=
                   11909:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   11910:             </div>
                   11911:           </div>
                   11912:         </div>
                   11913:         <pre class="screen">
1.14      xtraeme  11914: <code class="prompt">#</code> <strong class=
                   11915: "userinput"><code>make</code></strong>
1.1       grant    11916: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11917: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   11918: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   11919: =&gt; [172219 bytes]
                   11920: Connected to ftp.plig.net.
                   11921: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   11922: 331 Guest login ok, send your complete e-mail address as password.
                   11923: 230-You are user #5 of 500 simultaneous users allowed.
                   11924: 230-
                   11925: 230-  ___ _             _ _                   
                   11926: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   11927: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   11928: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   11929: 230-         |_|   |_|     |___|         |___|
                   11930: 230-
                   11931: 230-** Welcome to ftp.plig.org **
                   11932: 230-
                   11933: 230-Please note that all transfers from this FTP site are logged. If you
                   11934: 230-do not like this, please disconnect now.
                   11935: 230-
                   11936: 230-This arhive is available via
                   11937: 230-
                   11938: 230-HTTP:  http://ftp.plig.org/
                   11939: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   11940: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   11941: 230-
                   11942: 230-Please email comments, bug reports and requests for packages to be
                   11943: 230-mirrored to ftp-admin@plig.org.   
                   11944: 230-
                   11945: 230-
                   11946: 230 Logged in anonymously.
                   11947: Remote system type is UNIX.
                   11948: Using binary mode to transfer files.
                   11949: 200 Type okay.
                   11950: 250 "/pub" is new cwd.
                   11951: 250-"/pub/figlet" is new cwd.
                   11952: 250-
                   11953: 250-Welcome to the figlet archive at ftp.figlet.org
                   11954: 250-    
                   11955: 250-    ftp://ftp.figlet.org/pub/figlet/
                   11956: 250-
                   11957: 250-The official FIGlet web page is:
                   11958: 250-    http://www.figlet.org/
                   11959: 250-
                   11960: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   11961: 250-contribute a font or something else, you can email us.
                   11962: 250 
                   11963: 250 "/pub/figlet/program" is new cwd.
                   11964: 250 "/pub/figlet/program/unix" is new cwd.
                   11965: local: figlet221.tar.gz remote: figlet221.tar.gz
                   11966: 502 Unimplemented command.
                   11967: 227 Entering Passive Mode (195,40,6,41,246,104)
                   11968: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   11969: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   11970: 226 Transfer completed.
                   11971: 172219 bytes received in 00:02 (75.99 KB/s)
                   11972: 221 Goodbye.
                   11973: =&gt; Checksum OK for figlet221.tar.gz.
                   11974: ===&gt; Extracting for figlet-2.2.1nb2
                   11975: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   11976: ===&gt; Patching for figlet-2.2.1nb2
                   11977: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   11978: ===&gt; Overriding tools for figlet-2.2.1nb2
                   11979: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   11980: ===&gt; Configuring for figlet-2.2.1nb2
                   11981: ===&gt; Building for figlet-2.2.1nb2
                   11982: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   11983: chmod a+x figlet
                   11984: gcc -O2 -o chkfont chkfont.c
                   11985: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  11986: <code class="prompt">#</code>
                   11987: <code class="prompt">#</code> <strong class=
                   11988: "userinput"><code>make install</code></strong>
1.1       grant    11989: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11990: ===&gt; Installing for figlet-2.2.1nb2
                   11991: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   11992: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   11993: mkdir -p /usr/pkg/share/figlet
                   11994: cp figlet /usr/pkg/bin
                   11995: cp chkfont /usr/pkg/bin
                   11996: chmod 555 figlist showfigfonts
                   11997: cp figlist /usr/pkg/bin
                   11998: cp showfigfonts /usr/pkg/bin
                   11999: cp fonts/*.flf /usr/pkg/share/figlet
                   12000: cp fonts/*.flc /usr/pkg/share/figlet
                   12001: cp figlet.6 /usr/pkg/man/man6
                   12002: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  12003: <code class="prompt">#</code>
1.1       grant    12004: </pre>
                   12005:       </div>
                   12006: 
                   12007:       <div class="sect1" lang="en" xml:lang="en">
                   12008:         <div class="titlepage">
                   12009:           <div>
                   12010:             <div>
                   12011:               <h2 class="title" style="clear: both"><a name=
                   12012:               "logs.package" id=
                   12013:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   12014:             </div>
                   12015:           </div>
                   12016:         </div>
                   12017:         <pre class="screen">
1.14      xtraeme  12018: <code class="prompt">#</code> <strong class=
                   12019: "userinput"><code>make package</code></strong>
1.1       grant    12020: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   12021: ===&gt; Packaging figlet-2.2.1nb2
                   12022: ===&gt; Building binary package for figlet-2.2.1nb2
                   12023: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   12024: Using SrcDir value of /usr/pkg
                   12025: Registering depends:.  
1.14      xtraeme  12026: <code class="prompt">#</code>
1.1       grant    12027: </pre>
                   12028:       </div>
                   12029:     </div>
                   12030: 
                   12031:     <div class="appendix" lang="en" xml:lang="en">
                   12032:       <div class="titlepage">
                   12033:         <div>
                   12034:           <div>
                   12035:             <h2 class="title"><a name="ftp-layout" id=
                   12036:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   12037:             FTP server's package archive</h2>
                   12038:           </div>
                   12039:         </div>
                   12040:       </div>
                   12041: 
                   12042:       <p>Layout for precompiled binary packages on
                   12043:       ftp.NetBSD.org:</p>
                   12044:       <pre class="programlisting">
                   12045: /pub/NetBSD/packages/
                   12046:                 distfiles/
                   12047: 
                   12048:                 # Unpacked pkgsrc trees
                   12049:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   12050:                 pkgsrc-2003Q4 -&gt; N/A
                   12051:                 pkgsrc-2004Q1/pkgsrc
                   12052: 
                   12053:                 # pkgsrc archives
                   12054:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   12055:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   12056:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   12057: 
                   12058:                 # Per pkgsrc-release/OS-release/arch package archives
                   12059:                 pkgsrc-2003Q4/
                   12060:                         NetBSD-1.6.2/
                   12061:                                 i386/
                   12062:                                         All/
                   12063:                                         archivers/
                   12064:                                                 foo -&gt; ../All/foo
                   12065:                                         ...
                   12066:                 pkgsrc-2004Q1/
                   12067:                         NetBSD-1.6.2/
                   12068:                                 i386/
                   12069:                                         All/
                   12070:                                         ...
                   12071:                         NetBSD-2.0/
                   12072:                                 i386/
                   12073:                                         All/
                   12074:                                         ...
                   12075:                         SunOS-5.9/
                   12076:                                 sparc/
                   12077:                                         All/
                   12078:                                         ...
                   12079:                                 x86/
                   12080:                                         All/
                   12081:                                         ...
                   12082: 
                   12083:                 # Per os-release package archive convenience links
                   12084:                 NetBSD-1.6.2 -&gt; 1.6.2
                   12085:                 1.6.2/
                   12086:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   12087:                         m68k/
                   12088:                                 All/
                   12089:                                 archivers/
                   12090:                                         foo -&gt; ../All/foo
                   12091:                                 ...
                   12092:                         amiga -&gt; m68k
                   12093:                         atari -&gt; m68k
                   12094:                         ...
                   12095: 
                   12096:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   12097:                 NetBSD-2.0/
                   12098:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   12099:                 SunOS-5.9/
                   12100:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   12101:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   12102:                         
                   12103: </pre>
                   12104: 
                   12105:       <p>To create:</p>
                   12106: 
                   12107:       <div class="orderedlist">
                   12108:         <ol type="1">
                   12109:           <li>
                   12110:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   12111:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   12112:             5.3, &#8220;Doing a bulk build of all
                   12113:             packages&#8221;</a></p>
                   12114:           </li>
                   12115: 
                   12116:           <li>
                   12117:             <p>Upload /usr/pkgsrc/packages to</p>
                   12118:             <pre class="programlisting">
                   12119:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  12120:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    12121:         `uname -s`-`uname -r`/                  # OS &amp; version
                   12122:         `uname -p`                              # architecture
                   12123:        
                   12124: </pre>
                   12125:           </li>
                   12126: 
                   12127:           <li>
1.14      xtraeme  12128:             <p>If necessary, create a symlink <span><strong class=
                   12129:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   12130:             (amiga -&gt; m68k, ...)</p>
1.1       grant    12131:           </li>
                   12132:         </ol>
                   12133:       </div>
                   12134:     </div>
1.2       hubertf  12135: 
                   12136:     <div class="appendix" lang="en" xml:lang="en">
                   12137:       <div class="titlepage">
                   12138:         <div>
                   12139:           <div>
                   12140:             <h2 class="title"><a name="editing" id=
                   12141:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   12142:             for the pkgsrc guide</h2>
                   12143:           </div>
                   12144:         </div>
                   12145:       </div>
                   12146: 
                   12147:       <div class="toc">
                   12148:         <p><b>Table of Contents</b></p>
                   12149: 
                   12150:         <dl>
1.28    ! rillig   12151:           <dt><span class="sect1"><a href="#id2637894">D.1.
1.2       hubertf  12152:           Targets</a></span></dt>
                   12153: 
1.28    ! rillig   12154:           <dt><span class="sect1"><a href="#id2637959">D.2.
1.2       hubertf  12155:           Procedure</a></span></dt>
                   12156:         </dl>
                   12157:       </div>
                   12158: 
                   12159:       <p>This section contains information on editing the pkgsrc
                   12160:       guide itself.</p>
                   12161: 
                   12162:       <div class="sect1" lang="en" xml:lang="en">
                   12163:         <div class="titlepage">
                   12164:           <div>
                   12165:             <div>
                   12166:               <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   12167:               "id2637894" id="id2637894"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  12168:             </div>
                   12169:           </div>
                   12170:         </div>
                   12171: 
1.14      xtraeme  12172:         <p>The pkgsrc guide's source code is stored in <code class=
                   12173:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  12174:         are created from it:</p>
                   12175: 
                   12176:         <div class="itemizedlist">
                   12177:           <ul type="disc">
                   12178:             <li>
1.14      xtraeme  12179:               <p><code class=
1.23      wiz      12180:               "filename">pkgsrc/doc/pkgsrc.txt</code></p>
1.2       hubertf  12181:             </li>
                   12182: 
                   12183:             <li>
1.14      xtraeme  12184:               <p><code class=
                   12185:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  12186:             </li>
                   12187: 
                   12188:             <li>
1.14      xtraeme  12189:               <p><code class=
                   12190:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  12191:               the documentation on the NetBSD website will be built
                   12192:               from pkgsrc and kept up to date on the web server
                   12193:               itself. This means you <span class=
                   12194:               "emphasis"><em>must</em></span> make sure that your
                   12195:               changes haven't broken the build!</p>
                   12196:             </li>
1.6       hubertf  12197: 
                   12198:             <li>
1.14      xtraeme  12199:               <p><code class=
                   12200:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  12201:               PDF version of the pkgsrc guide.</p>
                   12202:             </li>
                   12203: 
                   12204:             <li>
1.14      xtraeme  12205:               <p><code class=
                   12206:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  12207:               PostScript version of the pkgsrc guide.</p>
                   12208:             </li>
1.2       hubertf  12209:           </ul>
                   12210:         </div>
                   12211:       </div>
                   12212: 
                   12213:       <div class="sect1" lang="en" xml:lang="en">
                   12214:         <div class="titlepage">
                   12215:           <div>
                   12216:             <div>
                   12217:               <h2 class="title" style="clear: both"><a name=
1.28    ! rillig   12218:               "id2637959" id=
        !          12219:               "id2637959"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  12220:             </div>
                   12221:           </div>
                   12222:         </div>
                   12223: 
                   12224:         <p>The procedure to edit the pkgsrc guide is:</p>
                   12225: 
                   12226:         <div class="itemizedlist">
                   12227:           <ul type="disc">
                   12228:             <li>
1.6       hubertf  12229:               <p>Make sure you have the packages needed to
                   12230:               re-generate the pkgsrc guide (and other XML-based
                   12231:               NetBSD documentation) installed. These are
1.11      ben      12232:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  12233:               for creating the ASCII- and HTML-version, and
                   12234:               &#8220;<span class=
1.11      ben      12235:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  12236:               PostScript- and PDF version. You will need both
                   12237:               packages installed, to make sure documentation is
                   12238:               consistent across all formats. The packages can be
1.14      xtraeme  12239:               found in <code class=
                   12240:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
                   12241:               <code class=
                   12242:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  12243:             </li>
                   12244: 
                   12245:             <li>
1.14      xtraeme  12246:               <p>Edit the XML file(s) in <code class=
                   12247:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  12248:             </li>
                   12249: 
                   12250:             <li>
1.14      xtraeme  12251:               <p>Run <span><strong class="command">make extract
                   12252:               &amp;&amp; make do-lint</strong></span> in
                   12253:               <code class="filename">pkgsrc/doc/guide</code> to
                   12254:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  12255:             </li>
                   12256: 
                   12257:             <li>
1.14      xtraeme  12258:               <p>Run <span><strong class=
                   12259:               "command">make</strong></span> in <code class=
                   12260:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   12261:               and ASCII version.</p>
1.2       hubertf  12262:             </li>
                   12263: 
                   12264:             <li>
1.14      xtraeme  12265:               <p>If all is well, run <span><strong class=
                   12266:               "command">make install-doc</strong></span> to put the
                   12267:               generated files into <code class=
                   12268:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  12269:             </li>
                   12270: 
                   12271:             <li>
1.14      xtraeme  12272:               <p><span><strong class="command">cvs commit
                   12273:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  12274:             </li>
                   12275: 
                   12276:             <li>
1.14      xtraeme  12277:               <p><span><strong class="command">cvs commit -m
                   12278:               re-generate
                   12279:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  12280:             </li>
1.4       hubertf  12281: 
                   12282:             <li>
                   12283:               <p>Until the webserver on www.NetBSD.org is really
                   12284:               updated automatically to pick up changes to the
1.14      xtraeme  12285:               pkgsrc guide automatically, also run
1.18      xtraeme  12286:               <span><strong class="command">make install-htdocs
1.14      xtraeme  12287:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   12288:               similar, adjust <code class=
                   12289:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  12290:             </li>
                   12291: 
                   12292:             <li>
1.14      xtraeme  12293:               <p><span><strong class="command">cvs commit
                   12294:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  12295:             </li>
1.2       hubertf  12296:           </ul>
                   12297:         </div>
                   12298:       </div>
                   12299:     </div>
1.1       grant    12300:   </div>
                   12301: </body>
                   12302: </html>

CVSweb <webmaster@jp.NetBSD.org>