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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.19    ! hubertf     4:   "HTML Tidy for NetBSD (vers 1st October 2003), 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.19    ! hubertf    11:   "DocBook XSL Stylesheets V1.67.0" />
1.1       grant      12:   <meta name="description" content=
                     13:   "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
                     14:   </head>
                     15: 
                     16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
                     17: alink="#0000FF">
                     18:   <div class="book" lang="en" xml:lang="en">
                     19:     <div class="titlepage">
                     20:       <div>
                     21:         <div>
1.19    ! hubertf    22:           <h1 class="title"><a name="id2458253" id=
        !            23:           "id2458253"></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: 
                     68:         <div>
1.3       hubertf    69:           <p class="pubdate">$NetBSD: pkgsrc.xml,v 1.3 2004/10/22
                     70:           00:24:48 hubertf Exp $</p>
1.1       grant      71:         </div>
                     72: 
                     73:         <div>
                     74:           <div class="abstract">
                     75:             <p class="title"><b>Abstract</b></p>
                     76: 
                     77:             <p>Information about using the NetBSD package system
                     78:             (pkgsrc) from both a user view for installing packages
                     79:             as well as from a pkgsrc developers' view for creating
                     80:             new packages.</p>
                     81:           </div>
                     82:         </div>
                     83:       </div>
                     84:       <hr />
                     85:     </div>
                     86: 
                     87:     <div class="toc">
                     88:       <p><b>Table of Contents</b></p>
                     89: 
                     90:       <dl>
                     91:         <dt><span class="chapter"><a href="#introduction">1.
                     92:         Introduction</a></span></dt>
                     93: 
                     94:         <dd>
                     95:           <dl>
1.19    ! hubertf    96:             <dt><span class="sect1"><a href="#id2514136">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.19    ! hubertf   120:                 <dt><span class="sect1"><a href="#id2514722">2.1.
1.1       grant     121:                 As tar file</a></span></dt>
                    122: 
1.19    ! hubertf   123:                 <dt><span class="sect1"><a href="#id2514738">2.2.
1.1       grant     124:                 Via SUP</a></span></dt>
                    125: 
1.19    ! hubertf   126:                 <dt><span class="sect1"><a href="#id2514838">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.19    ! hubertf   136:                 <dt><span class="sect1"><a href="#id2514948">3.1.
1.1       grant     137:                 Bootstrapping pkgsrc</a></span></dt>
                    138: 
1.19    ! hubertf   139:                 <dt><span class="sect1"><a href="#id2515129">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.19    ! hubertf   145:                     "#id2515136">3.2.1. Darwin (Mac OS
1.1       grant     146:                     X)</a></span></dt>
                    147: 
                    148:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   149:                     "#id2515366">3.2.2. FreeBSD</a></span></dt>
1.1       grant     150: 
                    151:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   152:                     "#id2515878">3.2.3. Interix</a></span></dt>
1.1       grant     153: 
                    154:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   155:                     "#id2515976">3.2.4. IRIX</a></span></dt>
1.1       grant     156: 
                    157:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   158:                     "#id2516025">3.2.5. OpenBSD</a></span></dt>
1.1       grant     159: 
                    160:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   161:                     "#id2516274">3.2.6. Solaris</a></span></dt>
1.1       grant     162:                   </dl>
                    163:                 </dd>
                    164:               </dl>
                    165:             </dd>
                    166: 
                    167:             <dt><span class="chapter"><a href="#using">4. Using
                    168:             pkgsrc</a></span></dt>
                    169: 
                    170:             <dd>
                    171:               <dl>
                    172:                 <dt><span class="sect1"><a href=
                    173:                 "#getting-started">4.1. Working with binary
                    174:                 packages</a></span></dt>
                    175: 
                    176:                 <dd>
                    177:                   <dl>
                    178:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   179:                     "#id2516410">4.1.1. Where to get binary
1.1       grant     180:                     packages</a></span></dt>
                    181: 
                    182:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   183:                     "#id2516519">4.1.2. How to use binary
1.1       grant     184:                     packages</a></span></dt>
                    185: 
                    186:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   187:                     "#id2516585">4.1.3. A word of
1.1       grant     188:                     warning</a></span></dt>
                    189:                   </dl>
                    190:                 </dd>
                    191: 
1.19    ! hubertf   192:                 <dt><span class="sect1"><a href="#id2516597">4.2.
1.1       grant     193:                 Building packages from source</a></span></dt>
                    194: 
                    195:                 <dd>
                    196:                   <dl>
                    197:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   198:                     "#id2516606">4.2.1.
1.1       grant     199:                     Requirements</a></span></dt>
                    200: 
                    201:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   202:                     "#id2516627">4.2.2. Fetching
1.1       grant     203:                     distfiles</a></span></dt>
                    204: 
                    205:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   206:                     "#id2516747">4.2.3. How to build and
1.1       grant     207:                     install</a></span></dt>
                    208: 
                    209:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   210:                     "#id2517542">4.2.4. Selecting the
1.1       grant     211:                     compiler</a></span></dt>
                    212:                   </dl>
                    213:                 </dd>
                    214:               </dl>
                    215:             </dd>
                    216: 
                    217:             <dt><span class="chapter"><a href="#binary">5. Creating
                    218:             binary packages</a></span></dt>
                    219: 
                    220:             <dd>
                    221:               <dl>
1.19    ! hubertf   222:                 <dt><span class="sect1"><a href="#id2582755">5.1.
1.1       grant     223:                 Building a single binary package</a></span></dt>
                    224: 
1.19    ! hubertf   225:                 <dt><span class="sect1"><a href="#id2582833">5.2.
1.1       grant     226:                 Settings for creation of binary
                    227:                 packages</a></span></dt>
                    228: 
                    229:                 <dt><span class="sect1"><a href="#bulkbuild">5.3.
                    230:                 Doing a bulk build of all packages</a></span></dt>
                    231: 
                    232:                 <dd>
                    233:                   <dl>
                    234:                     <dt><span class="sect2"><a href=
                    235:                     "#binary.configuration">5.3.1.
                    236:                     Configuration</a></span></dt>
                    237: 
                    238:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   239:                     "#id2582972">5.3.2. Other environmental
1.1       grant     240:                     considerations</a></span></dt>
                    241: 
                    242:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   243:                     "#id2583081">5.3.3. Operation</a></span></dt>
1.1       grant     244: 
                    245:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   246:                     "#id2583219">5.3.4. What it
1.1       grant     247:                     does</a></span></dt>
                    248: 
                    249:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   250:                     "#id2583275">5.3.5. Disk space
1.1       grant     251:                     requirements</a></span></dt>
                    252: 
                    253:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   254:                     "#id2583302">5.3.6. Setting up a sandbox for
1.1       grant     255:                     chroot'ed builds</a></span></dt>
                    256: 
                    257:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   258:                     "#id2583763">5.3.7. Building a partial set of
1.1       grant     259:                     packages</a></span></dt>
1.13      hubertf   260: 
                    261:                     <dt><span class="sect2"><a href=
                    262:                     "#bulk-upload">5.3.8. Uploading results of a
                    263:                     bulk build</a></span></dt>
1.1       grant     264:                   </dl>
                    265:                 </dd>
                    266: 
1.19    ! hubertf   267:                 <dt><span class="sect1"><a href="#id2584200">5.4.
1.1       grant     268:                 Creating a multiple CD-ROM packages
                    269:                 collection</a></span></dt>
                    270: 
                    271:                 <dd>
                    272:                   <dl>
                    273:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   274:                     "#id2584215">5.4.1. Example of
1.1       grant     275:                     cdpack</a></span></dt>
                    276:                   </dl>
                    277:                 </dd>
                    278:               </dl>
                    279:             </dd>
                    280: 
                    281:             <dt><span class="chapter"><a href="#faq">6. Frequently
                    282:             Asked Questions</a></span></dt>
                    283: 
                    284:             <dd>
                    285:               <dl>
1.19    ! hubertf   286:                 <dt><span class="sect1"><a href="#id2584475">6.1.
1.18      xtraeme   287:                 Are there any mailing lists for pkg-related
1.1       grant     288:                 discussion?</a></span></dt>
                    289: 
1.19    ! hubertf   290:                 <dt><span class="sect1"><a href="#id2584610">6.2.
1.1       grant     291:                 Where's the pkgviews documentation?</a></span></dt>
                    292: 
1.5       hubertf   293:                 <dt><span class="sect1"><a href=
                    294:                 "#faq-pkgtools">6.3. Utilities for package
                    295:                 management (pkgtools)</a></span></dt>
1.1       grant     296: 
1.19    ! hubertf   297:                 <dt><span class="sect1"><a href="#id2584794">6.4.
1.1       grant     298:                 How to use pkgsrc as non-root</a></span></dt>
                    299: 
1.19    ! hubertf   300:                 <dt><span class="sect1"><a href="#id2584806">6.5.
1.15      xtraeme   301:                 How to resume transfers when fetching
                    302:                 distfiles?</a></span></dt>
1.14      xtraeme   303: 
1.19    ! hubertf   304:                 <dt><span class="sect1"><a href="#id2584849">6.6.
1.1       grant     305:                 How can I install/use XFree86 from
                    306:                 pkgsrc?</a></span></dt>
                    307: 
1.19    ! hubertf   308:                 <dt><span class="sect1"><a href="#id2584876">6.7.
1.1       grant     309:                 How can I install/use X.org from
                    310:                 pkgsrc?</a></span></dt>
                    311: 
1.19    ! hubertf   312:                 <dt><span class="sect1"><a href="#id2584904">6.8.
1.1       grant     313:                 How to fetch files from behind a
                    314:                 firewall</a></span></dt>
                    315: 
1.19    ! hubertf   316:                 <dt><span class="sect1"><a href="#id2584918">6.9.
1.14      xtraeme   317:                 How do I tell <span><strong class="command">make
                    318:                 fetch</strong></span> to do passive
1.1       grant     319:                 FTP?</a></span></dt>
                    320: 
1.19    ! hubertf   321:                 <dt><span class="sect1"><a href="#id2584969">6.10.
1.1       grant     322:                 How to fetch all distfiles at once</a></span></dt>
                    323: 
1.19    ! hubertf   324:                 <dt><span class="sect1"><a href="#id2585177">6.11.
1.14      xtraeme   325:                 What does &#8220;<span class="quote">Don't know how
                    326:                 to make /usr/share/tmac/tmac.andoc</span>&#8221;
                    327:                 mean?</a></span></dt>
1.13      hubertf   328: 
1.19    ! hubertf   329:                 <dt><span class="sect1"><a href="#id2585216">6.12.
1.14      xtraeme   330:                 What does &#8220;<span class="quote">Could not find
                    331:                 bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant     332: 
1.19    ! hubertf   333:                 <dt><span class="sect1"><a href="#id2585273">6.13.
1.1       grant     334:                 Using 'sudo' with pkgsrc</a></span></dt>
                    335: 
1.14      xtraeme   336:                 <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant     337:                 Configuration files handling and
                    338:                 placement</a></span></dt>
                    339: 
                    340:                 <dt><span class="sect1"><a href=
1.14      xtraeme   341:                 "#audit-packages">6.15. Automated security
1.1       grant     342:                 checks</a></span></dt>
                    343:               </dl>
                    344:             </dd>
                    345:           </dl>
                    346:         </dd>
                    347: 
1.2       hubertf   348:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     349:         pkgsrc developer's guide</a></span></dt>
                    350: 
                    351:         <dd>
                    352:           <dl>
                    353:             <dt><span class="chapter"><a href="#components">7.
                    354:             Package components - files, directories and
                    355:             contents</a></span></dt>
                    356: 
                    357:             <dd>
                    358:               <dl>
                    359:                 <dt><span class="sect1"><a href=
1.14      xtraeme   360:                 "#components.Makefile">7.1. <code class=
                    361:                 "filename">Makefile</code></a></span></dt>
1.1       grant     362: 
                    363:                 <dt><span class="sect1"><a href=
1.14      xtraeme   364:                 "#components.distinfo">7.2. <code class=
                    365:                 "filename">distinfo</code></a></span></dt>
1.1       grant     366: 
                    367:                 <dt><span class="sect1"><a href=
                    368:                 "#components.patches">7.3.
                    369:                 patches/*</a></span></dt>
                    370: 
1.19    ! hubertf   371:                 <dt><span class="sect1"><a href="#id2586455">7.4.
1.1       grant     372:                 Other mandatory files</a></span></dt>
                    373: 
                    374:                 <dt><span class="sect1"><a href=
                    375:                 "#components.optional">7.5. Optional
                    376:                 files</a></span></dt>
                    377: 
1.19    ! hubertf   378:                 <dt><span class="sect1"><a href="#id2586649">7.6.
1.14      xtraeme   379:                 <code class="filename">work*</code></a></span></dt>
1.1       grant     380: 
1.19    ! hubertf   381:                 <dt><span class="sect1"><a href="#id2586737">7.7.
1.14      xtraeme   382:                 <code class=
                    383:                 "filename">files/*</code></a></span></dt>
1.1       grant     384:               </dl>
                    385:             </dd>
                    386: 
                    387:             <dt><span class="chapter"><a href="#plist">8. PLIST
                    388:             issues</a></span></dt>
                    389: 
                    390:             <dd>
                    391:               <dl>
1.19    ! hubertf   392:                 <dt><span class="sect1"><a href="#id2586791">8.1.
1.1       grant     393:                 RCS ID</a></span></dt>
                    394: 
1.19    ! hubertf   395:                 <dt><span class="sect1"><a href="#id2586806">8.2.
1.14      xtraeme   396:                 Semi-automatic <code class="filename">PLIST</code>
                    397:                 generation</a></span></dt>
1.1       grant     398: 
                    399:                 <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme   400:                 Tweaking output of <span><strong class=
                    401:                 "command">make
                    402:                 print-PLIST</strong></span></a></span></dt>
1.1       grant     403: 
                    404:                 <dt><span class="sect1"><a href="#plist.misc">8.4.
                    405:                 Variable substitution in PLIST</a></span></dt>
                    406: 
1.19    ! hubertf   407:                 <dt><span class="sect1"><a href="#id2587127">8.5.
1.1       grant     408:                 Manpage-compression</a></span></dt>
                    409: 
1.19    ! hubertf   410:                 <dt><span class="sect1"><a href="#id2587169">8.6.
1.14      xtraeme   411:                 Changing PLIST source with <code class=
                    412:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     413: 
1.19    ! hubertf   414:                 <dt><span class="sect1"><a href="#id2587322">8.7.
1.1       grant     415:                 Platform specific and differing
                    416:                 PLISTs</a></span></dt>
                    417: 
                    418:                 <dt><span class="sect1"><a href=
                    419:                 "#faq.common-dirs">8.8. Sharing directories between
                    420:                 packages</a></span></dt>
                    421:               </dl>
                    422:             </dd>
                    423: 
                    424:             <dt><span class="chapter"><a href="#buildlink">9.
                    425:             Buildlink methodology</a></span></dt>
                    426: 
                    427:             <dd>
                    428:               <dl>
1.19    ! hubertf   429:                 <dt><span class="sect1"><a href="#id2587526">9.1.
1.1       grant     430:                 Converting packages to use
                    431:                 buildlink3</a></span></dt>
                    432: 
1.19    ! hubertf   433:                 <dt><span class="sect1"><a href="#id2587785">9.2.
1.14      xtraeme   434:                 Writing <code class="filename">buildlink3.mk</code>
                    435:                 files</a></span></dt>
1.1       grant     436: 
                    437:                 <dd>
                    438:                   <dl>
                    439:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   440:                     "#id2587854">9.2.1. Anatomy of a buildlink3.mk
1.1       grant     441:                     file</a></span></dt>
                    442: 
                    443:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   444:                     "#id2588295">9.2.2. Updating <code class=
1.14      xtraeme   445:                     "varname">BUILDLINK_DEPENDS.<em class=
                    446:                     "replaceable"><code>pkg</code></em></code> in
                    447:                     <code class="filename">buildlink3.mk</code>
1.1       grant     448:                     files</a></span></dt>
                    449:                   </dl>
                    450:                 </dd>
                    451: 
1.19    ! hubertf   452:                 <dt><span class="sect1"><a href="#id2588442">9.3.
1.14      xtraeme   453:                 Writing <code class="filename">builtin.mk</code>
                    454:                 files</a></span></dt>
1.1       grant     455: 
                    456:                 <dd>
                    457:                   <dl>
                    458:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   459:                     "#id2588523">9.3.1. Anatomy of a <code class=
1.14      xtraeme   460:                     "filename">builtin.mk</code>
1.1       grant     461:                     file</a></span></dt>
                    462: 
                    463:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   464:                     "#id2588819">9.3.2. Global preferences for
1.1       grant     465:                     native or pkgsrc software</a></span></dt>
                    466:                   </dl>
                    467:                 </dd>
                    468:               </dl>
                    469:             </dd>
                    470: 
                    471:             <dt><span class="chapter"><a href="#options">10.
                    472:             Options handling</a></span></dt>
                    473: 
                    474:             <dd>
                    475:               <dl>
1.19    ! hubertf   476:                 <dt><span class="sect1"><a href="#id2588960">10.1.
1.1       grant     477:                 Global default options</a></span></dt>
                    478: 
1.19    ! hubertf   479:                 <dt><span class="sect1"><a href="#id2588974">10.2.
1.14      xtraeme   480:                 Converting packages to use <code class=
                    481:                 "filename">bsd.options.mk</code></a></span></dt>
1.1       grant     482:               </dl>
                    483:             </dd>
                    484: 
                    485:             <dt><span class="chapter"><a href="#build">11. The
                    486:             build process</a></span></dt>
                    487: 
                    488:             <dd>
                    489:               <dl>
                    490:                 <dt><span class="sect1"><a href=
                    491:                 "#build.prefix">11.1. Program
                    492:                 location</a></span></dt>
                    493: 
1.19    ! hubertf   494:                 <dt><span class="sect1"><a href="#id2589582">11.2.
1.1       grant     495:                 Main targets</a></span></dt>
                    496: 
                    497:                 <dt><span class="sect1"><a href=
                    498:                 "#build.helpful-targets">11.3. Other helpful
                    499:                 targets</a></span></dt>
                    500:               </dl>
                    501:             </dd>
                    502: 
                    503:             <dt><span class="chapter"><a href="#fixes">12. Notes on
                    504:             fixes for packages</a></span></dt>
                    505: 
                    506:             <dd>
                    507:               <dl>
1.19    ! hubertf   508:                 <dt><span class="sect1"><a href="#id2590983">12.1.
1.1       grant     509:                 General operation</a></span></dt>
                    510: 
                    511:                 <dd>
                    512:                   <dl>
                    513:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   514:                     "#id2590986">12.1.1. How to pull in variables
1.1       grant     515:                     from /etc/mk.conf</a></span></dt>
                    516: 
                    517:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   518:                     "#id2591138">12.1.2. Restricted
1.1       grant     519:                     packages</a></span></dt>
                    520: 
                    521:                     <dt><span class="sect2"><a href=
                    522:                     "#dependencies">12.1.3. Handling
                    523:                     dependencies</a></span></dt>
                    524: 
                    525:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   526:                     "#id2591585">12.1.4. Handling conflicts with
1.1       grant     527:                     other packages</a></span></dt>
                    528: 
                    529:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   530:                     "#id2591703">12.1.5. Packages that cannot or
1.1       grant     531:                     should not be built</a></span></dt>
                    532: 
                    533:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   534:                     "#id2591729">12.1.6. Packages which should not
1.1       grant     535:                     be deleted, once installed</a></span></dt>
                    536: 
                    537:                     <dt><span class="sect2"><a href=
                    538:                     "#security-handling">12.1.7. Handling packages
                    539:                     with security problems</a></span></dt>
                    540: 
                    541:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   542:                     "#id2591889">12.1.8. How to handle compiler
1.1       grant     543:                     bugs</a></span></dt>
                    544: 
                    545:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   546:                     "#id2591911">12.1.9. How to handle incrementing
1.1       grant     547:                     versions when fixing an existing
                    548:                     package</a></span></dt>
                    549: 
                    550:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   551:                     "#id2591960">12.1.10. Portability of
1.1       grant     552:                     packages</a></span></dt>
                    553:                   </dl>
                    554:                 </dd>
                    555: 
1.19    ! hubertf   556:                 <dt><span class="sect1"><a href="#id2591985">12.2.
1.1       grant     557:                 Possible downloading issues</a></span></dt>
                    558: 
                    559:                 <dd>
                    560:                   <dl>
                    561:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   562:                     "#id2591988">12.2.1. Packages whose distfiles
1.1       grant     563:                     aren't available for plain
                    564:                     downloading</a></span></dt>
                    565: 
                    566:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   567:                     "#id2592051">12.2.2. How to handle modified
1.1       grant     568:                     distfiles with the 'old' name</a></span></dt>
                    569:                   </dl>
                    570:                 </dd>
                    571: 
1.19    ! hubertf   572:                 <dt><span class="sect1"><a href="#id2592062">12.3.
1.1       grant     573:                 Configuration gotchas</a></span></dt>
                    574: 
                    575:                 <dd>
                    576:                   <dl>
                    577:                     <dt><span class="sect2"><a href=
                    578:                     "#fixes.libtool">12.3.1. Shared libraries -
                    579:                     libtool</a></span></dt>
                    580: 
                    581:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   582:                     "#id2592441">12.3.2. Using libtool on GNU
1.1       grant     583:                     packages that already support
                    584:                     libtool</a></span></dt>
                    585: 
                    586:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   587:                     "#id2592594">12.3.3. GNU
1.1       grant     588:                     Autoconf/Automake</a></span></dt>
                    589:                   </dl>
                    590:                 </dd>
                    591: 
1.19    ! hubertf   592:                 <dt><span class="sect1"><a href="#id2592775">12.4.
1.1       grant     593:                 Building considerations</a></span></dt>
                    594: 
                    595:                 <dd>
                    596:                   <dl>
                    597:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   598:                     "#id2592778">12.4.1. CPP
1.1       grant     599:                     defines</a></span></dt>
                    600:                   </dl>
                    601:                 </dd>
                    602: 
1.19    ! hubertf   603:                 <dt><span class="sect1"><a href="#id2592808">12.5.
1.1       grant     604:                 Package specific actions</a></span></dt>
                    605: 
                    606:                 <dd>
                    607:                   <dl>
                    608:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   609:                     "#id2592811">12.5.1. Package configuration
1.1       grant     610:                     files</a></span></dt>
                    611: 
                    612:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   613:                     "#id2592982">12.5.2. User
1.2       hubertf   614:                     interaction</a></span></dt>
1.1       grant     615: 
                    616:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   617:                     "#id2593027">12.5.3. Handling
1.1       grant     618:                     licenses</a></span></dt>
                    619: 
                    620:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   621:                     "#id2593178">12.5.4. Creating an account from a
1.1       grant     622:                     package</a></span></dt>
                    623: 
                    624:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   625:                     "#id2593240">12.5.5. Installing score
1.1       grant     626:                     files</a></span></dt>
                    627: 
                    628:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   629:                     "#id2593284">12.5.6. Packages providing login
1.1       grant     630:                     shells</a></span></dt>
                    631: 
                    632:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   633:                     "#id2593341">12.5.7. Packages containing perl
1.1       grant     634:                     scripts</a></span></dt>
                    635: 
                    636:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   637:                     "#id2593360">12.5.8. Packages with hardcoded
1.1       grant     638:                     paths to other interpreters</a></span></dt>
                    639: 
                    640:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   641:                     "#id2593381">12.5.9. Packages installing perl
1.1       grant     642:                     modules</a></span></dt>
                    643: 
                    644:                     <dt><span class="sect2"><a href=
                    645:                     "#faq.info-files">12.5.10. Packages installing
                    646:                     info files</a></span></dt>
                    647: 
                    648:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   649:                     "#id2593601">12.5.11. Packages installing
1.1       grant     650:                     GConf2 data files</a></span></dt>
                    651: 
                    652:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   653:                     "#id2593769">12.5.12. Packages installing
1.1       grant     654:                     scrollkeeper data files</a></span></dt>
                    655: 
                    656:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   657:                     "#id2593889">12.5.13. Packages installing X11
1.1       grant     658:                     fonts</a></span></dt>
                    659: 
                    660:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   661:                     "#id2593936">12.5.14. Packages installing GTK2
1.1       grant     662:                     modules</a></span></dt>
                    663: 
                    664:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   665:                     "#id2594005">12.5.15. Packages installing SGML
1.1       grant     666:                     or XML data</a></span></dt>
                    667: 
                    668:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   669:                     "#id2594057">12.5.16. Packages installing
1.1       grant     670:                     extensions to the MIME database</a></span></dt>
                    671: 
                    672:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   673:                     "#id2594332">12.5.17. Packages using
1.1       grant     674:                     intltool</a></span></dt>
1.18      xtraeme   675: 
                    676:                     <dt><span class="sect2"><a href=
1.19    ! hubertf   677:                     "#id2594346">12.5.18. Packages installing
1.18      xtraeme   678:                     startup scripts</a></span></dt>
1.1       grant     679:                   </dl>
                    680:                 </dd>
                    681: 
1.19    ! hubertf   682:                 <dt><span class="sect1"><a href="#id2594368">12.6.
1.1       grant     683:                 Feedback to the author</a></span></dt>
                    684:               </dl>
                    685:             </dd>
                    686: 
                    687:             <dt><span class="chapter"><a href="#debug">13.
                    688:             Debugging</a></span></dt>
                    689: 
                    690:             <dt><span class="chapter"><a href="#submit">14.
                    691:             Submitting and Committing</a></span></dt>
                    692: 
                    693:             <dd>
                    694:               <dl>
1.19    ! hubertf   695:                 <dt><span class="sect1"><a href="#id2594898">14.1.
1.1       grant     696:                 Submitting your packages</a></span></dt>
                    697: 
1.19    ! hubertf   698:                 <dt><span class="sect1"><a href="#id2594949">14.2.
1.1       grant     699:                 Committing: Importing a package into
                    700:                 CVS</a></span></dt>
                    701: 
1.19    ! hubertf   702:                 <dt><span class="sect1"><a href="#id2595012">14.3.
1.2       hubertf   703:                 Updating a package to a newer
                    704:                 version</a></span></dt>
1.1       grant     705: 
1.19    ! hubertf   706:                 <dt><span class="sect1"><a href="#id2595031">14.4.
1.2       hubertf   707:                 Moving a package in pkgsrc</a></span></dt>
1.1       grant     708:               </dl>
                    709:             </dd>
                    710:           </dl>
                    711:         </dd>
                    712: 
                    713:         <dt><span class="appendix"><a href="#examples">A. A simple
                    714:         example package: bison</a></span></dt>
                    715: 
                    716:         <dd>
                    717:           <dl>
1.19    ! hubertf   718:             <dt><span class="sect1"><a href="#id2595257">A.1.
1.1       grant     719:             files</a></span></dt>
                    720: 
                    721:             <dd>
                    722:               <dl>
1.19    ! hubertf   723:                 <dt><span class="sect2"><a href="#id2595260">A.1.1.
1.1       grant     724:                 Makefile</a></span></dt>
                    725: 
1.19    ! hubertf   726:                 <dt><span class="sect2"><a href="#id2595268">A.1.2.
1.1       grant     727:                 DESCR</a></span></dt>
                    728: 
1.19    ! hubertf   729:                 <dt><span class="sect2"><a href="#id2595283">A.1.3.
1.1       grant     730:                 PLIST</a></span></dt>
                    731: 
1.19    ! hubertf   732:                 <dt><span class="sect2"><a href="#id2595290">A.1.4.
1.14      xtraeme   733:                 Checking a package with <span><strong class=
                    734:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant     735:               </dl>
                    736:             </dd>
                    737: 
1.19    ! hubertf   738:             <dt><span class="sect1"><a href="#id2595331">A.2. Steps
1.1       grant     739:             for building, installing, packaging</a></span></dt>
                    740:           </dl>
                    741:         </dd>
                    742: 
                    743:         <dt><span class="appendix"><a href="#logs">B. Build
                    744:         logs</a></span></dt>
                    745: 
                    746:         <dd>
                    747:           <dl>
                    748:             <dt><span class="sect1"><a href="#logs.building">B.1.
                    749:             Building figlet</a></span></dt>
                    750: 
                    751:             <dt><span class="sect1"><a href="#logs.package">B.2.
                    752:             Packaging figlet</a></span></dt>
                    753:           </dl>
                    754:         </dd>
                    755: 
                    756:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
                    757:         of the FTP server's package archive</a></span></dt>
1.2       hubertf   758: 
                    759:         <dt><span class="appendix"><a href="#editing">D. Editing
                    760:         guidelines for the pkgsrc guide</a></span></dt>
                    761: 
                    762:         <dd>
                    763:           <dl>
1.19    ! hubertf   764:             <dt><span class="sect1"><a href="#id2596182">D.1.
1.2       hubertf   765:             Targets</a></span></dt>
                    766: 
1.19    ! hubertf   767:             <dt><span class="sect1"><a href="#id2596389">D.2.
1.2       hubertf   768:             Procedure</a></span></dt>
                    769:           </dl>
                    770:         </dd>
1.1       grant     771:       </dl>
                    772:     </div>
                    773: 
                    774:     <div class="chapter" lang="en" xml:lang="en">
                    775:       <div class="titlepage">
                    776:         <div>
                    777:           <div>
                    778:             <h2 class="title"><a name="introduction" id=
                    779:             "introduction"></a>Chapter&nbsp;1.&nbsp;Introduction</h2>
                    780:           </div>
                    781:         </div>
                    782:       </div>
                    783: 
                    784:       <div class="toc">
                    785:         <p><b>Table of Contents</b></p>
                    786: 
                    787:         <dl>
1.19    ! hubertf   788:           <dt><span class="sect1"><a href="#id2514136">1.1.
1.1       grant     789:           Introduction</a></span></dt>
                    790: 
                    791:           <dt><span class="sect1"><a href="#overview">1.2.
                    792:           Overview</a></span></dt>
                    793: 
                    794:           <dt><span class="sect1"><a href="#terminology">1.3.
                    795:           Terminology</a></span></dt>
                    796: 
                    797:           <dt><span class="sect1"><a href="#typography">1.4.
                    798:           Typography</a></span></dt>
                    799:         </dl>
                    800:       </div>
                    801: 
                    802:       <div class="sect1" lang="en" xml:lang="en">
                    803:         <div class="titlepage">
                    804:           <div>
                    805:             <div>
                    806:               <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf   807:               "id2514136" id=
        !           808:               "id2514136"></a>1.1.&nbsp;Introduction</h2>
1.1       grant     809:             </div>
                    810:           </div>
                    811:         </div>
                    812: 
                    813:         <p>There is a lot of software freely available for Unix
                    814:         based systems, which usually runs on NetBSD and other
                    815:         Unix-flavoured systems, too, sometimes with some
                    816:         modifications. The NetBSD Packages Collection (pkgsrc)
                    817:         incorporates any such changes necessary to make that
                    818:         software run, and makes the installation (and
                    819:         de-installation) of the software package easy by means of a
                    820:         single command.</p>
                    821: 
                    822:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme   823:         the <span><strong class="command">pkg_*</strong></span>
                    824:         tools so that installation and de-installation, printing of
                    825:         an inventory of all installed packages and retrieval of
                    826:         one-line comments or more verbose descriptions are all
                    827:         simple.</p>
1.1       grant     828: 
                    829:         <p>pkgsrc currently contains several thousand packages,
                    830:         including:</p>
                    831: 
                    832:         <div class="itemizedlist">
                    833:           <ul type="disc">
                    834:             <li>
                    835:               <p><a xmlns=
                    836:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    837:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.19    ! hubertf   838:                  class="pkgname">www/apache</a> - The Apache web
        !           839:                  server</p>
1.1       grant     840:             </li>
                    841: 
                    842:             <li>
                    843:               <p><a xmlns=
                    844:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    845:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.19    ! hubertf   846:                  class="pkgname">www/mozilla</a> - The Mozilla web
        !           847:                  browser</p>
1.1       grant     848:             </li>
                    849: 
                    850:             <li>
                    851:               <p><a xmlns=
                    852:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    853:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.19    ! hubertf   854:                  class="pkgname">meta-pkgs/gnome</a> - The GNOME
        !           855:                  Desktop Environment</p>
1.1       grant     856:             </li>
                    857: 
                    858:             <li>
                    859:               <p><a xmlns=
                    860:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    861:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.19    ! hubertf   862:                  class="pkgname">meta-pkgs/kde3</a> - The K Desktop
        !           863:                  Environment</p>
1.1       grant     864:             </li>
                    865:           </ul>
                    866:         </div>
                    867: 
                    868:         <p>...just to name a few.</p>
                    869: 
                    870:         <p>pkgsrc has built-in support for handling varying
                    871:         dependencies, such as pthreads and X11, and extended
                    872:         features such as IPv6 support on a range of platforms.</p>
                    873: 
                    874:         <p>pkgsrc was derived from FreeBSD's ports system, and
                    875:         initially developed for NetBSD only. Since then, pkgsrc has
                    876:         grown a lot, and now supports the following platforms:</p>
                    877: 
                    878:         <div class="itemizedlist">
                    879:           <ul type="disc">
                    880:             <li>
                    881:               <p><a href="http://developer.apple.com/darwin/"
                    882:               target="_top">Darwin</a> (<a href=
                    883:               "http://www.apple.com/macosx/" target="_top">Mac OS
                    884:               X</a>)</p>
                    885:             </li>
                    886: 
                    887:             <li>
1.3       hubertf   888:               <p><a href="http://www.DragonFlyBSD.org/" target=
                    889:               "_top">DragonFlyBSD</a></p>
                    890:             </li>
                    891: 
                    892:             <li>
1.1       grant     893:               <p><a href="http://www.FreeBSD.org/" target=
                    894:               "_top">FreeBSD</a></p>
                    895:             </li>
                    896: 
                    897:             <li>
1.3       hubertf   898:               <p>Microsoft Windows, via <a href=
                    899:               "http://www.microsoft.com/windows/sfu/" target=
                    900:               "_top">Interix</a></p>
1.1       grant     901:             </li>
                    902: 
                    903:             <li>
                    904:               <p><a href="http://www.sgi.com/software/irix6.5/"
                    905:               target="_top">IRIX</a></p>
                    906:             </li>
                    907: 
                    908:             <li>
                    909:               <p><a href="http://www.linux.org/" target=
                    910:               "_top">Linux</a></p>
                    911:             </li>
                    912: 
                    913:             <li>
                    914:               <p><a href="http://www.NetBSD.org/" target=
                    915:               "_top">NetBSD</a> (of course)</p>
                    916:             </li>
                    917: 
                    918:             <li>
1.17      sketch    919:               <p><a href="http://h30097.www3.hp.com/" target=
                    920:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                    921:             </li>
                    922: 
                    923:             <li>
1.1       grant     924:               <p><a href="http://www.openbsd.org/" target=
                    925:               "_top">OpenBSD</a></p>
                    926:             </li>
                    927: 
                    928:             <li>
                    929:               <p><a href="http://www.sun.com/solaris/" target=
                    930:               "_top">Solaris</a></p>
                    931:             </li>
                    932:           </ul>
                    933:         </div>
                    934:       </div>
                    935: 
                    936:       <div class="sect1" lang="en" xml:lang="en">
                    937:         <div class="titlepage">
                    938:           <div>
                    939:             <div>
                    940:               <h2 class="title" style="clear: both"><a name=
                    941:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
                    942:             </div>
                    943:           </div>
                    944:         </div>
                    945: 
                    946:         <p>This document is divided into two parts. The first,
                    947:         <a href="#users-guide" title=
1.2       hubertf   948:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
                    949:         user's guide</a>, describes how one can use one of the
                    950:         packages in the Package Collection, either by installing a
                    951:         precompiled binary package, or by building one's own copy
                    952:         using the NetBSD package system. The second part, <a href=
1.1       grant     953:         "#developers-guide" title=
1.2       hubertf   954:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                    955:         pkgsrc developer's guide</a>, explains how to prepare a
                    956:         package so it can be easily built by other NetBSD users
                    957:         without knowing about the package's building details.</p>
1.1       grant     958: 
                    959:         <p>This document is available in various formats:</p>
                    960: 
                    961:         <div class="itemizedlist">
                    962:           <ul type="disc">
                    963:             <li>
                    964:               <p><a href="index.html" target="_top">HTML</a></p>
                    965:             </li>
                    966: 
                    967:             <li>
                    968:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                    969:             </li>
                    970: 
                    971:             <li>
                    972:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                    973:             </li>
                    974: 
                    975:             <li>
                    976:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                    977:             </li>
                    978:           </ul>
                    979:         </div>
                    980:       </div>
                    981: 
                    982:       <div class="sect1" lang="en" xml:lang="en">
                    983:         <div class="titlepage">
                    984:           <div>
                    985:             <div>
                    986:               <h2 class="title" style="clear: both"><a name=
                    987:               "terminology" id=
                    988:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                    989:             </div>
                    990:           </div>
                    991:         </div>
                    992: 
                    993:         <p>There has been a lot of talk about &#8220;<span class=
                    994:         "quote">ports</span>&#8221;, &#8220;<span class=
                    995:         "quote">packages</span>&#8221;, etc. so far. Here is a
                    996:         description of all the terminology used within this
                    997:         document.</p>
                    998: 
                    999:         <div class="variablelist">
                   1000:           <dl>
                   1001:             <dt><span class="term">Package</span></dt>
                   1002: 
                   1003:             <dd>
                   1004:               <p>A set of files and building instructions that
                   1005:               describe what's necessary to build a certain piece of
                   1006:               software using pkgsrc. Packages are traditionally
1.14      xtraeme  1007:               stored under <code class=
                   1008:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1009:             </dd>
                   1010: 
                   1011:             <dt><span class="term">The NetBSD package
                   1012:             system</span></dt>
                   1013: 
                   1014:             <dd>
                   1015:               <p>This is the former name of &#8220;<span class=
                   1016:               "quote">pkgsrc</span>&#8221;. It is part of the
                   1017:               NetBSD operating system and can be bootstrap to run
                   1018:               on non-NetBSD operating systems as well. It handles
                   1019:               building (compiling), installing, and removing of
                   1020:               packages.</p>
                   1021:             </dd>
                   1022: 
                   1023:             <dt><span class="term">Distfile</span></dt>
                   1024: 
                   1025:             <dd>
                   1026:               <p>This term describes the file or files that are
                   1027:               provided by the author of the piece of software to
                   1028:               distribute his work. All the changes necessary to
                   1029:               build on NetBSD are reflected in the corresponding
                   1030:               package. Usually the distfile is in the form of a
                   1031:               compressed tar-archive, but other types are possible,
1.14      xtraeme  1032:               too. Distfiles are usually stored below <code class=
                   1033:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1034:             </dd>
                   1035: 
                   1036:             <dt><span class="term">Port</span></dt>
                   1037: 
                   1038:             <dd>
                   1039:               <p>This is the term used by FreeBSD and OpenBSD
                   1040:               people for what we call a package. In NetBSD
                   1041:               terminology, &#8220;<span class=
                   1042:               "quote">port</span>&#8221; refers to a different
                   1043:               architecture.</p>
                   1044:             </dd>
                   1045: 
                   1046:             <dt><span class="term">Precompiled/binary
                   1047:             package</span></dt>
                   1048: 
                   1049:             <dd>
                   1050:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1051:               distfile and stuffed together in a single
                   1052:               <code class="filename">.tgz</code> file so it can be
                   1053:               installed on machines of the same machine
                   1054:               architecture without the need to recompile. Packages
                   1055:               are usually generated in <code class=
                   1056:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1057:               an archive on <a href=
1.1       grant    1058:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1059:               "_top">ftp.NetBSD.org</a>.</p>
                   1060: 
                   1061:               <p>Sometimes, this is referred to by the term
                   1062:               &#8220;<span class="quote">package</span>&#8221; too,
                   1063:               especially in the context of precompiled
                   1064:               packages.</p>
                   1065:             </dd>
                   1066: 
                   1067:             <dt><span class="term">Program</span></dt>
                   1068: 
                   1069:             <dd>
                   1070:               <p>The piece of software to be installed which will
                   1071:               be constructed from all the files in the Distfile by
                   1072:               the actions defined in the corresponding package.</p>
                   1073:             </dd>
                   1074:           </dl>
                   1075:         </div>
                   1076:       </div>
                   1077: 
                   1078:       <div class="sect1" lang="en" xml:lang="en">
                   1079:         <div class="titlepage">
                   1080:           <div>
                   1081:             <div>
                   1082:               <h2 class="title" style="clear: both"><a name=
                   1083:               "typography" id=
                   1084:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1085:             </div>
                   1086:           </div>
                   1087:         </div>
                   1088: 
                   1089:         <p>When giving examples for commands, shell prompts are
                   1090:         used to show if the command should/can be issued as root,
                   1091:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1092:         privileges are sufficient. We use a <code class=
                   1093:         "prompt">#</code> for root's shell prompt, and a
                   1094:         <code class="prompt">$</code> for users' shell prompt,
                   1095:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1096:       </div>
                   1097:     </div>
                   1098: 
                   1099:     <div class="part" lang="en" xml:lang="en">
                   1100:       <div class="titlepage">
                   1101:         <div>
                   1102:           <div>
                   1103:             <h1 class="title"><a name="users-guide" id=
1.2       hubertf  1104:             "users-guide"></a>The pkgsrc user's guide</h1>
1.1       grant    1105:           </div>
                   1106:         </div>
                   1107:       </div>
                   1108: 
                   1109:       <div class="toc">
                   1110:         <p><b>Table of Contents</b></p>
                   1111: 
                   1112:         <dl>
                   1113:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1114:           get pkgsrc</a></span></dt>
                   1115: 
                   1116:           <dd>
                   1117:             <dl>
1.19    ! hubertf  1118:               <dt><span class="sect1"><a href="#id2514722">2.1. As
1.1       grant    1119:               tar file</a></span></dt>
                   1120: 
1.19    ! hubertf  1121:               <dt><span class="sect1"><a href="#id2514738">2.2. Via
1.1       grant    1122:               SUP</a></span></dt>
                   1123: 
1.19    ! hubertf  1124:               <dt><span class="sect1"><a href="#id2514838">2.3. Via
1.1       grant    1125:               CVS</a></span></dt>
                   1126:             </dl>
                   1127:           </dd>
                   1128: 
                   1129:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1130:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1131: 
                   1132:           <dd>
                   1133:             <dl>
1.19    ! hubertf  1134:               <dt><span class="sect1"><a href="#id2514948">3.1.
1.1       grant    1135:               Bootstrapping pkgsrc</a></span></dt>
                   1136: 
1.19    ! hubertf  1137:               <dt><span class="sect1"><a href="#id2515129">3.2.
1.1       grant    1138:               Platform specific notes</a></span></dt>
                   1139: 
                   1140:               <dd>
                   1141:                 <dl>
                   1142:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1143:                   "#id2515136">3.2.1. Darwin (Mac OS
1.1       grant    1144:                   X)</a></span></dt>
                   1145: 
                   1146:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1147:                   "#id2515366">3.2.2. FreeBSD</a></span></dt>
1.1       grant    1148: 
                   1149:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1150:                   "#id2515878">3.2.3. Interix</a></span></dt>
1.1       grant    1151: 
                   1152:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1153:                   "#id2515976">3.2.4. IRIX</a></span></dt>
1.1       grant    1154: 
                   1155:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1156:                   "#id2516025">3.2.5. OpenBSD</a></span></dt>
1.1       grant    1157: 
                   1158:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1159:                   "#id2516274">3.2.6. Solaris</a></span></dt>
1.1       grant    1160:                 </dl>
                   1161:               </dd>
                   1162:             </dl>
                   1163:           </dd>
                   1164: 
                   1165:           <dt><span class="chapter"><a href="#using">4. Using
                   1166:           pkgsrc</a></span></dt>
                   1167: 
                   1168:           <dd>
                   1169:             <dl>
                   1170:               <dt><span class="sect1"><a href=
                   1171:               "#getting-started">4.1. Working with binary
                   1172:               packages</a></span></dt>
                   1173: 
                   1174:               <dd>
                   1175:                 <dl>
                   1176:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1177:                   "#id2516410">4.1.1. Where to get binary
1.1       grant    1178:                   packages</a></span></dt>
                   1179: 
                   1180:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1181:                   "#id2516519">4.1.2. How to use binary
1.1       grant    1182:                   packages</a></span></dt>
                   1183: 
                   1184:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1185:                   "#id2516585">4.1.3. A word of
1.1       grant    1186:                   warning</a></span></dt>
                   1187:                 </dl>
                   1188:               </dd>
                   1189: 
1.19    ! hubertf  1190:               <dt><span class="sect1"><a href="#id2516597">4.2.
1.1       grant    1191:               Building packages from source</a></span></dt>
                   1192: 
                   1193:               <dd>
                   1194:                 <dl>
                   1195:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1196:                   "#id2516606">4.2.1. Requirements</a></span></dt>
1.1       grant    1197: 
                   1198:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1199:                   "#id2516627">4.2.2. Fetching
1.1       grant    1200:                   distfiles</a></span></dt>
                   1201: 
                   1202:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1203:                   "#id2516747">4.2.3. How to build and
1.1       grant    1204:                   install</a></span></dt>
                   1205: 
                   1206:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1207:                   "#id2517542">4.2.4. Selecting the
1.1       grant    1208:                   compiler</a></span></dt>
                   1209:                 </dl>
                   1210:               </dd>
                   1211:             </dl>
                   1212:           </dd>
                   1213: 
                   1214:           <dt><span class="chapter"><a href="#binary">5. Creating
                   1215:           binary packages</a></span></dt>
                   1216: 
                   1217:           <dd>
                   1218:             <dl>
1.19    ! hubertf  1219:               <dt><span class="sect1"><a href="#id2582755">5.1.
1.1       grant    1220:               Building a single binary package</a></span></dt>
                   1221: 
1.19    ! hubertf  1222:               <dt><span class="sect1"><a href="#id2582833">5.2.
1.1       grant    1223:               Settings for creation of binary
                   1224:               packages</a></span></dt>
                   1225: 
                   1226:               <dt><span class="sect1"><a href="#bulkbuild">5.3.
                   1227:               Doing a bulk build of all packages</a></span></dt>
                   1228: 
                   1229:               <dd>
                   1230:                 <dl>
                   1231:                   <dt><span class="sect2"><a href=
                   1232:                   "#binary.configuration">5.3.1.
                   1233:                   Configuration</a></span></dt>
                   1234: 
                   1235:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1236:                   "#id2582972">5.3.2. Other environmental
1.1       grant    1237:                   considerations</a></span></dt>
                   1238: 
                   1239:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1240:                   "#id2583081">5.3.3. Operation</a></span></dt>
1.1       grant    1241: 
                   1242:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1243:                   "#id2583219">5.3.4. What it does</a></span></dt>
1.1       grant    1244: 
                   1245:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1246:                   "#id2583275">5.3.5. Disk space
1.1       grant    1247:                   requirements</a></span></dt>
                   1248: 
                   1249:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1250:                   "#id2583302">5.3.6. Setting up a sandbox for
1.1       grant    1251:                   chroot'ed builds</a></span></dt>
                   1252: 
                   1253:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1254:                   "#id2583763">5.3.7. Building a partial set of
1.1       grant    1255:                   packages</a></span></dt>
1.13      hubertf  1256: 
                   1257:                   <dt><span class="sect2"><a href=
                   1258:                   "#bulk-upload">5.3.8. Uploading results of a bulk
                   1259:                   build</a></span></dt>
1.1       grant    1260:                 </dl>
                   1261:               </dd>
                   1262: 
1.19    ! hubertf  1263:               <dt><span class="sect1"><a href="#id2584200">5.4.
1.1       grant    1264:               Creating a multiple CD-ROM packages
                   1265:               collection</a></span></dt>
                   1266: 
                   1267:               <dd>
                   1268:                 <dl>
                   1269:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  1270:                   "#id2584215">5.4.1. Example of
1.1       grant    1271:                   cdpack</a></span></dt>
                   1272:                 </dl>
                   1273:               </dd>
                   1274:             </dl>
                   1275:           </dd>
                   1276: 
                   1277:           <dt><span class="chapter"><a href="#faq">6. Frequently
                   1278:           Asked Questions</a></span></dt>
                   1279: 
                   1280:           <dd>
                   1281:             <dl>
1.19    ! hubertf  1282:               <dt><span class="sect1"><a href="#id2584475">6.1. Are
1.18      xtraeme  1283:               there any mailing lists for pkg-related
1.1       grant    1284:               discussion?</a></span></dt>
                   1285: 
1.19    ! hubertf  1286:               <dt><span class="sect1"><a href="#id2584610">6.2.
1.1       grant    1287:               Where's the pkgviews documentation?</a></span></dt>
                   1288: 
1.5       hubertf  1289:               <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    1290:               Utilities for package management
                   1291:               (pkgtools)</a></span></dt>
                   1292: 
1.19    ! hubertf  1293:               <dt><span class="sect1"><a href="#id2584794">6.4. How
1.1       grant    1294:               to use pkgsrc as non-root</a></span></dt>
                   1295: 
1.19    ! hubertf  1296:               <dt><span class="sect1"><a href="#id2584806">6.5. How
1.15      xtraeme  1297:               to resume transfers when fetching
                   1298:               distfiles?</a></span></dt>
1.14      xtraeme  1299: 
1.19    ! hubertf  1300:               <dt><span class="sect1"><a href="#id2584849">6.6. How
1.1       grant    1301:               can I install/use XFree86 from
                   1302:               pkgsrc?</a></span></dt>
                   1303: 
1.19    ! hubertf  1304:               <dt><span class="sect1"><a href="#id2584876">6.7. How
1.1       grant    1305:               can I install/use X.org from pkgsrc?</a></span></dt>
                   1306: 
1.19    ! hubertf  1307:               <dt><span class="sect1"><a href="#id2584904">6.8. How
1.1       grant    1308:               to fetch files from behind a firewall</a></span></dt>
                   1309: 
1.19    ! hubertf  1310:               <dt><span class="sect1"><a href="#id2584918">6.9. How
1.14      xtraeme  1311:               do I tell <span><strong class="command">make
                   1312:               fetch</strong></span> to do passive
1.1       grant    1313:               FTP?</a></span></dt>
                   1314: 
1.19    ! hubertf  1315:               <dt><span class="sect1"><a href="#id2584969">6.10.
1.14      xtraeme  1316:               How to fetch all distfiles at once</a></span></dt>
1.1       grant    1317: 
1.19    ! hubertf  1318:               <dt><span class="sect1"><a href="#id2585177">6.11.
1.14      xtraeme  1319:               What does &#8220;<span class="quote">Don't know how
                   1320:               to make /usr/share/tmac/tmac.andoc</span>&#8221;
                   1321:               mean?</a></span></dt>
1.13      hubertf  1322: 
1.19    ! hubertf  1323:               <dt><span class="sect1"><a href="#id2585216">6.12.
1.14      xtraeme  1324:               What does &#8220;<span class="quote">Could not find
                   1325:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1326: 
1.19    ! hubertf  1327:               <dt><span class="sect1"><a href="#id2585273">6.13.
1.1       grant    1328:               Using 'sudo' with pkgsrc</a></span></dt>
                   1329: 
1.14      xtraeme  1330:               <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    1331:               Configuration files handling and
                   1332:               placement</a></span></dt>
                   1333: 
                   1334:               <dt><span class="sect1"><a href=
1.14      xtraeme  1335:               "#audit-packages">6.15. Automated security
1.1       grant    1336:               checks</a></span></dt>
                   1337:             </dl>
                   1338:           </dd>
                   1339:         </dl>
                   1340:       </div>
                   1341: 
                   1342:       <div class="chapter" lang="en" xml:lang="en">
                   1343:         <div class="titlepage">
                   1344:           <div>
                   1345:             <div>
                   1346:               <h2 class="title"><a name="getting" id=
                   1347:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1348:               pkgsrc</h2>
                   1349:             </div>
                   1350:           </div>
                   1351:         </div>
                   1352: 
                   1353:         <div class="toc">
                   1354:           <p><b>Table of Contents</b></p>
                   1355: 
                   1356:           <dl>
1.19    ! hubertf  1357:             <dt><span class="sect1"><a href="#id2514722">2.1. As
1.1       grant    1358:             tar file</a></span></dt>
                   1359: 
1.19    ! hubertf  1360:             <dt><span class="sect1"><a href="#id2514738">2.2. Via
1.1       grant    1361:             SUP</a></span></dt>
                   1362: 
1.19    ! hubertf  1363:             <dt><span class="sect1"><a href="#id2514838">2.3. Via
1.1       grant    1364:             CVS</a></span></dt>
                   1365:           </dl>
                   1366:         </div>
                   1367: 
                   1368:         <p>There are three ways to get pkgsrc. Either as a tar
                   1369:         file, via SUP, or via CVS. All three ways are described
                   1370:         here.</p>
                   1371: 
                   1372:         <div class="sect1" lang="en" xml:lang="en">
                   1373:           <div class="titlepage">
                   1374:             <div>
                   1375:               <div>
                   1376:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  1377:                 "id2514722" id="id2514722"></a>2.1.&nbsp;As tar
1.1       grant    1378:                 file</h2>
                   1379:               </div>
                   1380:             </div>
                   1381:           </div>
                   1382: 
                   1383:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1384:           file from <a href=
1.11      ben      1385:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.19    ! hubertf  1386:              target="_top">ftp.NetBSD.org</a> and unpack it into
        !          1387:              <code class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1388:         </div>
                   1389: 
                   1390:         <div class="sect1" lang="en" xml:lang="en">
                   1391:           <div class="titlepage">
                   1392:             <div>
                   1393:               <div>
                   1394:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  1395:                 "id2514738" id="id2514738"></a>2.2.&nbsp;Via
1.1       grant    1396:                 SUP</h2>
                   1397:               </div>
                   1398:             </div>
                   1399:           </div>
                   1400: 
                   1401:           <p>As an alternative to the tar file, you can get pkgsrc
                   1402:           via the Software Update Protocol, SUP. To do so, make
                   1403:           sure your supfile has a line</p>
                   1404:           <pre class="programlisting">
                   1405: release=pkgsrc
                   1406: </pre>
                   1407: 
1.14      xtraeme  1408:           <p>in it, see the examples in <code class=
                   1409:           "filename">/usr/share/examples/supfiles</code>, and that
                   1410:           the <code class="filename">/usr/pkgsrc</code> directory
                   1411:           exists. Then, simply run <span><strong class=
                   1412:           "command">sup -v <em class=
                   1413:           "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1414:         </div>
                   1415: 
                   1416:         <div class="sect1" lang="en" xml:lang="en">
                   1417:           <div class="titlepage">
                   1418:             <div>
                   1419:               <div>
                   1420:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  1421:                 "id2514838" id="id2514838"></a>2.3.&nbsp;Via
1.1       grant    1422:                 CVS</h2>
                   1423:               </div>
                   1424:             </div>
                   1425:           </div>
                   1426: 
                   1427:           <p>To get pkgsrc via CVS, make sure you have
                   1428:           &#8220;<span class="quote">cvs</span>&#8221; installed.
                   1429:           If not present on your system, it can be found as
                   1430:           precompiled binary on ftp.NetBSD.org. To do an initial
                   1431:           (full) checkout of pkgsrc, do the following steps:</p>
                   1432:           <pre class="screen">
1.14      xtraeme  1433: <code class="prompt">%</code> <strong class=
                   1434: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1435: <code class="prompt">%</code> <strong class=
                   1436: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1437: <code class="prompt">%</code> <strong class=
                   1438: "userinput"><code>cd /usr</code></strong>
                   1439: <code class="prompt">%</code> <strong class=
                   1440: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1441: </pre>
                   1442: 
                   1443:           <p>This will create the <code class=
                   1444:           "filename">pkgsrc</code> directory in your <code class=
                   1445:           "filename">/usr</code>, and all the package source will
                   1446:           be stored under <code class=
                   1447:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1448:           initial checkout, make sure you have <code class=
                   1449:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1450:           <pre class="screen">
1.14      xtraeme  1451: <code class="prompt">%</code> <strong class=
                   1452: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1453: <code class="prompt">%</code> <strong class=
                   1454: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1455: </pre>
                   1456: 
                   1457:           <p>Please also note that it is possible to have multiple
                   1458:           copies of the pkgsrc hierarchy in use at any one time -
                   1459:           all work is done relatively within the pkgsrc tree.</p>
                   1460:         </div>
                   1461:       </div>
                   1462: 
                   1463:       <div class="chapter" lang="en" xml:lang="en">
                   1464:         <div class="titlepage">
                   1465:           <div>
                   1466:             <div>
                   1467:               <h2 class="title"><a name="platforms" id=
                   1468:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1469:               systems other than NetBSD</h2>
                   1470:             </div>
                   1471:           </div>
                   1472:         </div>
                   1473: 
                   1474:         <div class="toc">
                   1475:           <p><b>Table of Contents</b></p>
                   1476: 
                   1477:           <dl>
1.19    ! hubertf  1478:             <dt><span class="sect1"><a href="#id2514948">3.1.
1.1       grant    1479:             Bootstrapping pkgsrc</a></span></dt>
                   1480: 
1.19    ! hubertf  1481:             <dt><span class="sect1"><a href="#id2515129">3.2.
1.1       grant    1482:             Platform specific notes</a></span></dt>
                   1483: 
                   1484:             <dd>
                   1485:               <dl>
1.19    ! hubertf  1486:                 <dt><span class="sect2"><a href="#id2515136">3.2.1.
1.1       grant    1487:                 Darwin (Mac OS X)</a></span></dt>
                   1488: 
1.19    ! hubertf  1489:                 <dt><span class="sect2"><a href="#id2515366">3.2.2.
1.1       grant    1490:                 FreeBSD</a></span></dt>
                   1491: 
1.19    ! hubertf  1492:                 <dt><span class="sect2"><a href="#id2515878">3.2.3.
1.1       grant    1493:                 Interix</a></span></dt>
                   1494: 
1.19    ! hubertf  1495:                 <dt><span class="sect2"><a href="#id2515976">3.2.4.
1.1       grant    1496:                 IRIX</a></span></dt>
                   1497: 
1.19    ! hubertf  1498:                 <dt><span class="sect2"><a href="#id2516025">3.2.5.
1.1       grant    1499:                 OpenBSD</a></span></dt>
                   1500: 
1.19    ! hubertf  1501:                 <dt><span class="sect2"><a href="#id2516274">3.2.6.
1.1       grant    1502:                 Solaris</a></span></dt>
                   1503:               </dl>
                   1504:             </dd>
                   1505:           </dl>
                   1506:         </div>
                   1507: 
                   1508:         <div class="sect1" lang="en" xml:lang="en">
                   1509:           <div class="titlepage">
                   1510:             <div>
                   1511:               <div>
                   1512:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  1513:                 "id2514948" id=
        !          1514:                 "id2514948"></a>3.1.&nbsp;Bootstrapping pkgsrc</h2>
1.1       grant    1515:               </div>
                   1516:             </div>
                   1517:           </div>
                   1518: 
                   1519:           <p>For Operating Systems other than NetBSD, we provide a
                   1520:           bootstrap kit to build the required tools to use pkgsrc
                   1521:           on your platform. Besides support for native NetBSD,
                   1522:           pkgsrc and the bootstrap kit have support for the
                   1523:           following operating systems:</p>
                   1524: 
                   1525:           <div class="itemizedlist">
                   1526:             <ul type="disc">
                   1527:               <li>
                   1528:                 <p>Darwin (Mac OS X)</p>
                   1529:               </li>
                   1530: 
                   1531:               <li>
1.16      grant    1532:                 <p>DragonFlyBSD</p>
                   1533:               </li>
                   1534: 
                   1535:               <li>
1.1       grant    1536:                 <p>FreeBSD</p>
                   1537:               </li>
                   1538: 
                   1539:               <li>
                   1540:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1541:               </li>
                   1542: 
                   1543:               <li>
                   1544:                 <p>IRIX</p>
                   1545:               </li>
                   1546: 
                   1547:               <li>
                   1548:                 <p>Linux</p>
                   1549:               </li>
                   1550: 
                   1551:               <li>
                   1552:                 <p>OpenBSD</p>
                   1553:               </li>
                   1554: 
                   1555:               <li>
                   1556:                 <p>Solaris</p>
                   1557:               </li>
1.16      grant    1558: 
                   1559:               <li>
                   1560:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1561:               </li>
1.1       grant    1562:             </ul>
                   1563:           </div>
                   1564: 
                   1565:           <p>Support for other platforms is under development.</p>
                   1566: 
                   1567:           <p>Installing the bootstrap kit should be as simple
                   1568:           as:</p>
                   1569:           <pre class="screen">
1.14      xtraeme  1570: <code class="prompt">#</code> <strong class=
                   1571: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1572: <code class="prompt">#</code> <strong class=
                   1573: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1574: <code class="prompt">#</code> <strong class=
                   1575: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1576: </pre>
                   1577: 
                   1578:           <p>See <a href="#getting" title=
                   1579:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter 2,
                   1580:           <i>Where to get pkgsrc</i></a> for other ways to get
1.14      xtraeme  1581:           pkgsrc before bootstrapping. The given
                   1582:           <span><strong class="command">bootstrap</strong></span>
                   1583:           command will use the defaults of <code class=
                   1584:           "filename">/usr/pkg</code> for the <span class=
                   1585:           "emphasis"><em>prefix</em></span> where programs will be
                   1586:           installed in, and <code class=
                   1587:           "filename">/var/db/pkg</code> for the package database
1.1       grant    1588:           directory where pkgsrc will do it's internal bookkeeping.
                   1589:           However, these can also be set using command-line
                   1590:           parameters.</p>
                   1591: 
                   1592:           <p>Binary packages for the pkgsrc tools and an initial
                   1593:           set of packages is available for supported platforms. An
                   1594:           up-to-date list of these can be found on <a href=
                   1595:           "http://www.pkgsrc.org/" target=
                   1596:           "_top">www.pkgsrc.org</a>.</p>
                   1597:         </div>
                   1598: 
                   1599:         <div class="sect1" lang="en" xml:lang="en">
                   1600:           <div class="titlepage">
                   1601:             <div>
                   1602:               <div>
                   1603:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  1604:                 "id2515129" id="id2515129"></a>3.2.&nbsp;Platform
1.1       grant    1605:                 specific notes</h2>
                   1606:               </div>
                   1607:             </div>
                   1608:           </div>
                   1609: 
                   1610:           <p>Here are some platform-specific notes you should be
                   1611:           aware of.</p>
                   1612: 
                   1613:           <div class="sect2" lang="en" xml:lang="en">
                   1614:             <div class="titlepage">
                   1615:               <div>
                   1616:                 <div>
1.19    ! hubertf  1617:                   <h3 class="title"><a name="id2515136" id=
        !          1618:                   "id2515136"></a>3.2.1.&nbsp;Darwin (Mac OS
1.1       grant    1619:                   X)</h3>
                   1620:                 </div>
                   1621:               </div>
                   1622:             </div>
                   1623: 
                   1624:             <p>Darwin 5.x and 6.x are supported. There are two
                   1625:             methods of using pkgsrc on Mac OS X, by using a
                   1626:             <a href="#platform.osx-image" title=
                   1627:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1628:             <a href="#platform.osx-ufs" title=
                   1629:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1630:             partition</a>.</p>
                   1631: 
                   1632:             <p>Before you start, you will need to download and
                   1633:             install the Mac OS X Developer Tools from Apple's
                   1634:             Developer Connection. See <a href=
                   1635:             "http://developer.apple.com/macosx/" target=
                   1636:             "_top">http://developer.apple.com/macosx/</a> for
                   1637:             details. Also, make sure you install X11 for Mac OS X
                   1638:             and the X11 SDK from <a href=
                   1639:             "http://www.apple.com/macosx/x11/download/" target=
                   1640:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1641:             you intend to build packages that use the X11 Window
                   1642:             System.</p>
                   1643: 
                   1644:             <p>If you already have a UFS partition, or have a spare
                   1645:             partition that you can format as UFS, it is recommended
                   1646:             to use that instead of the disk image. It'll be
                   1647:             somewhat faster and will mount automatically at boot
                   1648:             time, where you must manually mount a disk image.</p>
                   1649: 
                   1650:             <div class="note" style=
                   1651:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1652:               <h3 class="title">Note</h3>
                   1653: 
                   1654:               <p>You cannot use a HFS+ file system for pkgsrc,
                   1655:               because pkgsrc currently requires the filesystem to
                   1656:               be case-sensitive, and HFS+ is not.</p>
                   1657:             </div>
                   1658: 
                   1659:             <div class="sect3" lang="en" xml:lang="en">
                   1660:               <div class="titlepage">
                   1661:                 <div>
                   1662:                   <div>
                   1663:                     <h4 class="title"><a name="platform.osx-image"
                   1664:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
                   1665:                     a disk image</h4>
                   1666:                   </div>
                   1667:                 </div>
                   1668:               </div>
                   1669: 
                   1670:               <p>Create the disk image:</p>
                   1671:               <pre class="screen">
1.14      xtraeme  1672: <code class="prompt">#</code> <strong class=
                   1673: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1674: <code class="prompt">#</code> <strong class=
                   1675: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   1676: <code class="prompt">#</code> <strong class=
                   1677: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   1678: <code class="prompt">#</code> <strong class=
                   1679: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    1680: </pre>
                   1681: 
                   1682:               <p>That's it!</p>
                   1683:             </div>
                   1684: 
                   1685:             <div class="sect3" lang="en" xml:lang="en">
                   1686:               <div class="titlepage">
                   1687:                 <div>
                   1688:                   <div>
                   1689:                     <h4 class="title"><a name="platform.osx-ufs"
                   1690:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
                   1691:                     UFS partition</h4>
                   1692:                   </div>
                   1693:                 </div>
                   1694:               </div>
                   1695: 
1.14      xtraeme  1696:               <p>By default, <code class="filename">/usr</code>
                   1697:               will be on your root file system, normally HFS+. It
                   1698:               is possible to use the default <span class=
                   1699:               "emphasis"><em>prefix</em></span> of <code class=
                   1700:               "filename">/usr/pkg</code> by symlinking <code class=
                   1701:               "filename">/usr/pkg</code> to a directory on a UFS
                   1702:               file system. Obviously, another symlink is required
                   1703:               if you want to place the package database directory
                   1704:               outside the <span class=
                   1705:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    1706:               <pre class="screen">
1.14      xtraeme  1707: <code class="prompt">#</code> <strong class=
                   1708: "userinput"><code>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</code></strong>
1.1       grant    1709: </pre>
                   1710: 
                   1711:               <p>If you created your partitions at the time of
                   1712:               installing Mac OS X and formatted the target
                   1713:               partition as UFS, it should automatically mount on
1.14      xtraeme  1714:               <code class="filename">/Volumes/&lt;volume
                   1715:               name&gt;</code> when the machine boots. If you are
1.1       grant    1716:               (re)formatting a partition as UFS, you need to ensure
                   1717:               that the partition map correctly reflects
                   1718:               &#8220;<span class="quote">Apple_UFS</span>&#8221;
                   1719:               and not &#8220;<span class=
                   1720:               "quote">Apple_HFS</span>&#8221;.</p>
                   1721: 
                   1722:               <p>The problem is that none of the disk tools will
                   1723:               let you touch a disk that is booted from. You can
                   1724:               unmount the partition, but even if you newfs it, the
                   1725:               partition type will be incorrect and the automounter
                   1726:               won't mount it. It can be mounted manually, but it
                   1727:               won't appear in Finder.</p>
                   1728: 
                   1729:               <p>You'll need to boot off of the OS X Installation
                   1730:               (User) CD. When the Installation program starts, go
                   1731:               up to the menu and select Disk Utility. Now, you will
                   1732:               be able to select the partition you want to be UFS,
                   1733:               and Format it Apple UFS. Quit the Disk Utility, quit
                   1734:               the installer which will reboot your machine. The new
                   1735:               UFS file system will appear in Finder.</p>
                   1736: 
                   1737:               <p>Be aware that the permissions on the new file
                   1738:               system will be writable by root only.</p>
                   1739: 
                   1740:               <p>This note is as of 10.2 (Jaguar) and applies to
                   1741:               earlier versions. Hopefully Apple will fix Disk
                   1742:               Utility in 10.3 (Panther).</p>
                   1743:             </div>
                   1744:           </div>
                   1745: 
                   1746:           <div class="sect2" lang="en" xml:lang="en">
                   1747:             <div class="titlepage">
                   1748:               <div>
                   1749:                 <div>
1.19    ! hubertf  1750:                   <h3 class="title"><a name="id2515366" id=
        !          1751:                   "id2515366"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    1752:                 </div>
                   1753:               </div>
                   1754:             </div>
                   1755: 
                   1756:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   1757:             supported, other versions may work.</p>
                   1758: 
                   1759:             <p>Care should be taken so that the tools that this kit
                   1760:             installs do not conflict with the FreeBSD userland
                   1761:             tools. There are several steps:</p>
                   1762: 
                   1763:             <div class="orderedlist">
                   1764:               <ol type="1">
                   1765:                 <li>
                   1766:                   <p>FreeBSD stores its ports pkg database in
1.14      xtraeme  1767:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    1768:                   therefore recommended that you choose a different
1.14      xtraeme  1769:                   location (e.g. <code class=
                   1770:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    1771:                   --pkgdbdir option to the bootstrap script.</p>
                   1772:                 </li>
                   1773: 
                   1774:                 <li>
                   1775:                   <p>If you do not intend to use the FreeBSD ports
                   1776:                   tools, it's probably a good idea to move them out
                   1777:                   of the way to avoid confusion, e.g.</p>
                   1778:                   <pre class="screen">
1.14      xtraeme  1779: <code class="prompt">#</code> <strong class=
                   1780: "userinput"><code>cd /usr/sbin</code></strong>
                   1781: <code class="prompt">#</code> <strong class=
                   1782: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   1783: <code class="prompt">#</code> <strong class=
                   1784: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   1785: <code class="prompt">#</code> <strong class=
                   1786: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   1787: <code class="prompt">#</code> <strong class=
                   1788: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    1789: </pre>
                   1790:                 </li>
                   1791: 
                   1792:                 <li>
1.14      xtraeme  1793:                   <p>An example <code class=
                   1794:                   "filename">/etc/mk.conf</code> file will be
                   1795:                   placed in <code class=
                   1796:                   "filename">/etc/mk.conf.example</code> file when
                   1797:                   you use the bootstrap script.</p>
1.1       grant    1798:                 </li>
                   1799:               </ol>
                   1800:             </div>
                   1801:           </div>
                   1802: 
                   1803:           <div class="sect2" lang="en" xml:lang="en">
                   1804:             <div class="titlepage">
                   1805:               <div>
                   1806:                 <div>
1.19    ! hubertf  1807:                   <h3 class="title"><a name="id2515878" id=
        !          1808:                   "id2515878"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    1809:                 </div>
                   1810:               </div>
                   1811:             </div>
                   1812: 
                   1813:             <p>Interix is a POSIX compatible subsystem for the
                   1814:             Windows NT kernel, providing a Unix-like environment
                   1815:             with a tighter kernel integration than available with
                   1816:             Cygwin. It is part of the Windows Services for Unix
                   1817:             package, available for free for any licensed copy of
1.19    ! hubertf  1818:             Windows 2000, XP (not including XP Home), or 2003. SFU
        !          1819:             can be downloaded from <a href=
        !          1820:             "http://www.microsoft.com/windows/sfu/" target=
1.1       grant    1821:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   1822: 
                   1823:             <p>Services for Unix 3.5, current as of this writing,
                   1824:             has been tested. 3.0 or 3.1 may work, but are not
                   1825:             officially supported. (The main difference in 3.0/3.1
                   1826:             is lack of pthreads.)</p>
                   1827: 
                   1828:             <div class="sect3" lang="en" xml:lang="en">
                   1829:               <div class="titlepage">
                   1830:                 <div>
                   1831:                   <div>
                   1832:                     <h4 class="title"><a name=
                   1833:                     "platform.interix-sfu-install" id=
                   1834:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  1835:                     installing Interix/SFU</h4>
1.1       grant    1836:                   </div>
                   1837:                 </div>
                   1838:               </div>
                   1839: 
                   1840:               <p>At an absolute minimum, the following packages
                   1841:               must be installed from the Windows Services for Unix
                   1842:               3.5 distribution in order to use pkgsrc:</p>
                   1843: 
                   1844:               <div class="itemizedlist">
                   1845:                 <ul type="disc">
                   1846:                   <li>
                   1847:                     <p>Utilities -&gt; Base Utilities</p>
                   1848:                   </li>
                   1849: 
                   1850:                   <li>
                   1851:                     <p>Interix GNU Components -&gt; (all)</p>
                   1852:                   </li>
                   1853: 
                   1854:                   <li>
                   1855:                     <p>Remote Connectivity</p>
                   1856:                   </li>
                   1857: 
                   1858:                   <li>
                   1859:                     <p>Interix SDK</p>
                   1860:                   </li>
                   1861:                 </ul>
                   1862:               </div>
                   1863: 
                   1864:               <p>When using pkgsrc on Interix, DO NOT install the
                   1865:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   1866:               without shared module support, installed to
                   1867:               /usr/local, and will only cause confusion. Instead,
                   1868:               install Perl 5.8 from pkgsrc (or from a binary
                   1869:               package).</p>
                   1870: 
                   1871:               <p>The Remote Connectivity subcomponent "Windows
                   1872:               Remote Shell Service" does not need to be installed,
                   1873:               but Remote Connectivity itself should be installed in
                   1874:               order to have a working inetd.</p>
                   1875: 
                   1876:               <p>Finally, during installation you may be asked
                   1877:               whether to enable setuid behavior for Interix
                   1878:               programs, and whether to make pathnames default to
                   1879:               case-sensitive. Setuid should be enabled, and
                   1880:               case-sensitivity MUST be enabled. (Without
                   1881:               case-sensitivity, a large number of packages
                   1882:               including perl will not build.)</p>
                   1883:             </div>
                   1884: 
                   1885:             <div class="sect3" lang="en" xml:lang="en">
                   1886:               <div class="titlepage">
                   1887:                 <div>
                   1888:                   <div>
                   1889:                     <h4 class="title"><a name=
                   1890:                     "platform.interix-sfu-postinstall" id=
                   1891:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   1892:                     to do if Interix/SFU is already installed</h4>
                   1893:                   </div>
                   1894:                 </div>
                   1895:               </div>
                   1896: 
                   1897:               <p>If SFU is already installed and you wish to alter
                   1898:               these settings to work with pkgsrc, note the
                   1899:               following things.</p>
                   1900: 
                   1901:               <div class="itemizedlist">
                   1902:                 <ul type="disc">
                   1903:                   <li>
                   1904:                     <p>To uninstall UNIX Perl, use Add/Remove
                   1905:                     Programs, select Microsoft Windows Services for
                   1906:                     UNIX, then click Change. In the installer,
                   1907:                     choose Add or Remove, then uncheck
                   1908:                     Utilities-&gt;UNIX Perl.</p>
                   1909:                   </li>
                   1910: 
                   1911:                   <li>
                   1912:                     <p>To enable case-sensitivity for the
                   1913:                     filesystem, run REGEDIT.EXE, and change the
                   1914:                     following registry key:</p>
                   1915: 
                   1916:                     <p>
                   1917:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   1918:                     Manager\kernel</p>
                   1919: 
                   1920:                     <p>Set the DWORD value "obcaseinsensitive" to
                   1921:                     0; then reboot.</p>
                   1922:                   </li>
                   1923: 
                   1924:                   <li>
                   1925:                     <p>To enable setuid binaries (optional), run
                   1926:                     REGEDIT.EXE, and change the following registry
                   1927:                     key:</p>
                   1928: 
                   1929:                     <p>
                   1930:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   1931:                     for UNIX</p>
                   1932: 
                   1933:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   1934:                     to 1; then reboot.</p>
                   1935:                   </li>
                   1936:                 </ul>
                   1937:               </div>
                   1938:             </div>
                   1939: 
                   1940:             <div class="sect3" lang="en" xml:lang="en">
                   1941:               <div class="titlepage">
                   1942:                 <div>
                   1943:                   <div>
                   1944:                     <h4 class="title"><a name=
                   1945:                     "platform.interix-notes" id=
                   1946:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   1947:                     notes for using pkgsrc</h4>
                   1948:                   </div>
                   1949:                 </div>
                   1950:               </div>
                   1951: 
                   1952:               <p>The package imanager (either the pkgsrc "su" user,
                   1953:               or the user running "pkg_add") must be a member of
                   1954:               the local Administrators group. Such a user must also
                   1955:               be used to run the bootstrap. This is slightly
                   1956:               relaxed from the normal pkgsrc requirement of
                   1957:               "root".</p>
                   1958: 
                   1959:               <p>The package manager should use a umask of 002.
                   1960:               "make install" will automatically complain if this is
                   1961:               not the case. This ensures that directories written
                   1962:               in /var/db/pkg are Administrators-group
                   1963:               writeable.</p>
                   1964: 
                   1965:               <p>The popular Interix binary packages from
                   1966:               http://www.interopsystems.com/ use an older version
                   1967:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   1968:               used in conjunction with pkgsrc. If you choose to use
                   1969:               them at the same time as the pkgsrc packages, ensure
                   1970:               that you use the proper pkg_* tools for each type of
                   1971:               binary package.</p>
1.19    ! hubertf  1972: 
        !          1973:               <p>The TERM setting used for DOS-type console windows
        !          1974:               (including those invoked by the csh and ksh startup
        !          1975:               shortcuts) is "interix". Most systems don't have a
        !          1976:               termcap/terminfo entry for it, but the following
        !          1977:               .termcap entry provides adequate emulation in most
        !          1978:               cases:</p>
        !          1979:               <pre class="programlisting">
        !          1980: interix:kP=\E[S:kN=\E[T:kH=\E[U:dc@:DC@:tc=pcansi:
        !          1981: </pre>
1.1       grant    1982:             </div>
                   1983:           </div>
                   1984: 
                   1985:           <div class="sect2" lang="en" xml:lang="en">
                   1986:             <div class="titlepage">
                   1987:               <div>
                   1988:                 <div>
1.19    ! hubertf  1989:                   <h3 class="title"><a name="id2515976" id=
        !          1990:                   "id2515976"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    1991:                 </div>
                   1992:               </div>
                   1993:             </div>
                   1994: 
                   1995:             <p>You will need a working C compiler, either gcc or
                   1996:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  1997:             the <code class="varname">CC</code> environment
                   1998:             variable according to your preference. If you do not
                   1999:             have a license for the MIPSpro compiler suite, you can
1.1       grant    2000:             download a gcc tardist file from <a href=
                   2001:             "http://freeware.sgi.com/" target=
                   2002:             "_top">http://freeware.sgi.com/</a>.</p>
                   2003: 
                   2004:             <p>Please note that you will need IRIX 6.5.17 or
                   2005:             higher, as this is the earliest version of IRIX
                   2006:             providing support for if_indextoname(3),
                   2007:             if_nametoindex(3), etc.</p>
                   2008: 
                   2009:             <p>At this point in time, pkgsrc only supports one ABI.
                   2010:             That is, you can not switch between the old 32-bit ABI,
                   2011:             the new 32-bit ABI and the 64-bit ABI. If you start out
                   2012:             using "abi=n32", that's what all your packages will be
                   2013:             built with.</p>
                   2014: 
                   2015:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2016:             conflicting <code class="varname">CFLAGS</code> in your
                   2017:             environment or the <code class=
                   2018:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2019:             that you do not try to link n32 object files with lib64
1.14      xtraeme  2020:             or vice versa. Check your <code class=
                   2021:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2022: 
                   2023:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2024:             from a different host, please make sure to set
1.14      xtraeme  2025:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2026:             directory, as it appears that IRIX linker occasionally
                   2027:             runs into issues when trying to link over a network
                   2028:             mounted filesystem.</p>
                   2029: 
                   2030:             <p>The bootstrapping process should set all the right
                   2031:             options for programs such as imake(1), but you may want
                   2032:             to set some options depending on your local setup.
1.14      xtraeme  2033:             Please see <code class=
                   2034:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.1       grant    2035:             course, your compilers man pages for details.</p>
                   2036:           </div>
                   2037: 
                   2038:           <div class="sect2" lang="en" xml:lang="en">
                   2039:             <div class="titlepage">
                   2040:               <div>
                   2041:                 <div>
1.19    ! hubertf  2042:                   <h3 class="title"><a name="id2516025" id=
        !          2043:                   "id2516025"></a>3.2.5.&nbsp;OpenBSD</h3>
1.1       grant    2044:                 </div>
                   2045:               </div>
                   2046:             </div>
                   2047: 
                   2048:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2049: 
                   2050:             <p>Care should be taken so that the tools that this kit
                   2051:             installs do not conflict with the OpenBSD userland
                   2052:             tools. There are several steps:</p>
                   2053: 
                   2054:             <div class="orderedlist">
                   2055:               <ol type="1">
                   2056:                 <li>
                   2057:                   <p>OpenBSD stores its ports pkg database in
1.14      xtraeme  2058:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    2059:                   therefore recommended that you choose a different
1.14      xtraeme  2060:                   location (e.g. <code class=
                   2061:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2062:                   --pkgdbdir option to the bootstrap script.</p>
                   2063:                 </li>
                   2064: 
                   2065:                 <li>
                   2066:                   <p>If you do not intend to use the OpenBSD ports
                   2067:                   tools, it's probably a good idea to move them out
                   2068:                   of the way to avoid confusion, e.g.</p>
                   2069:                   <pre class="screen">
1.14      xtraeme  2070: <code class="prompt">#</code> <strong class=
                   2071: "userinput"><code>cd /usr/sbin</code></strong>
                   2072: <code class="prompt">#</code> <strong class=
                   2073: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2074: <code class="prompt">#</code> <strong class=
                   2075: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2076: <code class="prompt">#</code> <strong class=
                   2077: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2078: <code class="prompt">#</code> <strong class=
                   2079: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2080: </pre>
                   2081:                 </li>
                   2082: 
                   2083:                 <li>
1.14      xtraeme  2084:                   <p>An example <code class=
                   2085:                   "filename">/etc/mk.conf</code> file will be
                   2086:                   placed in <code class=
                   2087:                   "filename">/etc/mk.conf.example</code> file when
                   2088:                   you use the bootstrap script. OpenBSD's make
                   2089:                   program uses <code class=
                   2090:                   "filename">/etc/mk.conf</code> as well. You can
1.1       grant    2091:                   work around this by enclosing all the pkgsrc
                   2092:                   specific parts of the file with:</p>
                   2093:                   <pre class="programlisting">
                   2094: .ifdef BSD_PKG_MK
1.11      ben      2095: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1       grant    2096: .else
                   2097: # OpenBSD stuff
                   2098: .endif
                   2099: </pre>
                   2100:                 </li>
                   2101:               </ol>
                   2102:             </div>
                   2103:           </div>
                   2104: 
                   2105:           <div class="sect2" lang="en" xml:lang="en">
                   2106:             <div class="titlepage">
                   2107:               <div>
                   2108:                 <div>
1.19    ! hubertf  2109:                   <h3 class="title"><a name="id2516274" id=
        !          2110:                   "id2516274"></a>3.2.6.&nbsp;Solaris</h3>
1.1       grant    2111:                 </div>
                   2112:               </div>
                   2113:             </div>
                   2114: 
                   2115:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2116:             sparc. You will need a working C compiler. Both gcc
                   2117:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2118: 
                   2119:             <p>The following packages are required on Solaris 8 for
                   2120:             the bootstrap process and to build packages.</p>
                   2121: 
                   2122:             <div class="itemizedlist">
                   2123:               <ul type="disc">
                   2124:                 <li>
                   2125:                   <p>SUNWsprot</p>
                   2126:                 </li>
                   2127: 
                   2128:                 <li>
                   2129:                   <p>SUNWarc</p>
                   2130:                 </li>
                   2131: 
                   2132:                 <li>
                   2133:                   <p>SUNWbtool</p>
                   2134:                 </li>
                   2135: 
                   2136:                 <li>
                   2137:                   <p>SUNWtoo</p>
                   2138:                 </li>
                   2139: 
                   2140:                 <li>
                   2141:                   <p>SUNWlibm</p>
                   2142:                 </li>
                   2143:               </ul>
                   2144:             </div>
                   2145: 
                   2146:             <p>Please note the use of GNU binutils on Solaris is
                   2147:             <span class="emphasis"><em>not</em></span>
                   2148:             supported.</p>
                   2149: 
                   2150:             <div class="sect3" lang="en" xml:lang="en">
                   2151:               <div class="titlepage">
                   2152:                 <div>
                   2153:                   <div>
1.19    ! hubertf  2154:                     <h4 class="title"><a name="id2516305" id=
        !          2155:                     "id2516305"></a>3.2.6.1.&nbsp;If you are using
1.1       grant    2156:                     gcc</h4>
                   2157:                   </div>
                   2158:                 </div>
                   2159:               </div>
                   2160: 
                   2161:               <p>It makes life much simpler if you only use the
                   2162:               same gcc consistently for building all packages.</p>
                   2163: 
                   2164:               <p>It is recommended that an external gcc be used
                   2165:               only for bootstrapping, then either build gcc from
                   2166:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2167:               href=
                   2168:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.19    ! hubertf  2169:                  class="pkgname">lang/gcc</a> or install a binary
        !          2170:                  gcc package, then remove gcc used during
        !          2171:                  bootstrapping.</p>
1.1       grant    2172: 
                   2173:               <p>Binary packages of gcc can be found through
                   2174:               <a href=
                   2175:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.19    ! hubertf  2176:                  target=
        !          2177:                  "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2178:             </div>
                   2179: 
                   2180:             <div class="sect3" lang="en" xml:lang="en">
                   2181:               <div class="titlepage">
                   2182:                 <div>
                   2183:                   <div>
1.19    ! hubertf  2184:                     <h4 class="title"><a name="id2516326" id=
        !          2185:                     "id2516326"></a>3.2.6.2.&nbsp;If you are using
1.1       grant    2186:                     Sun WorkShop</h4>
                   2187:                   </div>
                   2188:                 </div>
                   2189:               </div>
                   2190: 
                   2191:               <p>You will need at least the following packages
                   2192:               installed (from WorkShop 5.0)</p>
                   2193: 
                   2194:               <div class="itemizedlist">
                   2195:                 <ul type="disc">
                   2196:                   <li>
                   2197:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2198:                   </li>
                   2199: 
                   2200:                   <li>
                   2201:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2202:                   </li>
                   2203: 
                   2204:                   <li>
                   2205:                     <p>SPROild - Sun WorkShop Incremental
                   2206:                     Linker</p>
                   2207:                   </li>
                   2208: 
                   2209:                   <li>
                   2210:                     <p>SPROlang - Sun WorkShop Compilers common
                   2211:                     components</p>
                   2212:                   </li>
                   2213:                 </ul>
                   2214:               </div>
                   2215: 
1.14      xtraeme  2216:               <p>You should set <code class="varname">CC</code>,
                   2217:               <code class="varname">CXX</code> and optionally,
                   2218:               <code class="varname">CPP</code> in <code class=
                   2219:               "filename">/etc/mk.conf</code>, eg.</p>
1.1       grant    2220:               <pre class="programlisting">
                   2221: CC=        cc
                   2222: CXX=    CC
                   2223: CPP=    /usr/ccs/lib/cpp
                   2224: </pre>
                   2225: 
                   2226:               <p>You may also want to build 64-bit binaries,
                   2227:               eg.</p>
                   2228:               <pre class="programlisting">
                   2229: CFLAGS= -xtarget=ultra -xarch=v9
                   2230: </pre>
                   2231: 
                   2232:               <p>Whichever compiler you use, please ensure the
                   2233:               compiler tools and your $prefix are in your
1.14      xtraeme  2234:               <code class="varname">PATH</code>. This includes
                   2235:               <code class="filename">/usr/ccs/{bin,lib}</code> and
                   2236:               eg. <code class=
                   2237:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2238:             </div>
                   2239:           </div>
                   2240:         </div>
                   2241:       </div>
                   2242: 
                   2243:       <div class="chapter" lang="en" xml:lang="en">
                   2244:         <div class="titlepage">
                   2245:           <div>
                   2246:             <div>
                   2247:               <h2 class="title"><a name="using" id=
                   2248:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2249:             </div>
                   2250:           </div>
                   2251:         </div>
                   2252: 
                   2253:         <div class="toc">
                   2254:           <p><b>Table of Contents</b></p>
                   2255: 
                   2256:           <dl>
                   2257:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2258:             Working with binary packages</a></span></dt>
                   2259: 
                   2260:             <dd>
                   2261:               <dl>
1.19    ! hubertf  2262:                 <dt><span class="sect2"><a href="#id2516410">4.1.1.
1.1       grant    2263:                 Where to get binary packages</a></span></dt>
                   2264: 
1.19    ! hubertf  2265:                 <dt><span class="sect2"><a href="#id2516519">4.1.2.
1.1       grant    2266:                 How to use binary packages</a></span></dt>
                   2267: 
1.19    ! hubertf  2268:                 <dt><span class="sect2"><a href="#id2516585">4.1.3.
1.1       grant    2269:                 A word of warning</a></span></dt>
                   2270:               </dl>
                   2271:             </dd>
                   2272: 
1.19    ! hubertf  2273:             <dt><span class="sect1"><a href="#id2516597">4.2.
1.1       grant    2274:             Building packages from source</a></span></dt>
                   2275: 
                   2276:             <dd>
                   2277:               <dl>
1.19    ! hubertf  2278:                 <dt><span class="sect2"><a href="#id2516606">4.2.1.
1.1       grant    2279:                 Requirements</a></span></dt>
                   2280: 
1.19    ! hubertf  2281:                 <dt><span class="sect2"><a href="#id2516627">4.2.2.
1.1       grant    2282:                 Fetching distfiles</a></span></dt>
                   2283: 
1.19    ! hubertf  2284:                 <dt><span class="sect2"><a href="#id2516747">4.2.3.
1.1       grant    2285:                 How to build and install</a></span></dt>
                   2286: 
1.19    ! hubertf  2287:                 <dt><span class="sect2"><a href="#id2517542">4.2.4.
1.1       grant    2288:                 Selecting the compiler</a></span></dt>
                   2289:               </dl>
                   2290:             </dd>
                   2291:           </dl>
                   2292:         </div>
                   2293: 
                   2294:         <div class="sect1" lang="en" xml:lang="en">
                   2295:           <div class="titlepage">
                   2296:             <div>
                   2297:               <div>
                   2298:                 <h2 class="title" style="clear: both"><a name=
                   2299:                 "getting-started" id=
                   2300:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2301:                 packages</h2>
                   2302:               </div>
                   2303:             </div>
                   2304:           </div>
                   2305: 
                   2306:           <p>This section describes how to find, retrieve and
                   2307:           install a precompiled binary package that someone else
                   2308:           already prepared for your type of machine.</p>
                   2309: 
                   2310:           <div class="sect2" lang="en" xml:lang="en">
                   2311:             <div class="titlepage">
                   2312:               <div>
                   2313:                 <div>
1.19    ! hubertf  2314:                   <h3 class="title"><a name="id2516410" id=
        !          2315:                   "id2516410"></a>4.1.1.&nbsp;Where to get binary
1.1       grant    2316:                   packages</h3>
                   2317:                 </div>
                   2318:               </div>
                   2319:             </div>
                   2320: 
                   2321:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.14      xtraeme  2322:             and its mirrors in the directory <code class=
                   2323:             "filename">/pub/NetBSD/packages</code> for anonymous
                   2324:             FTP access. Please pick the right subdirectory there as
                   2325:             indicated by <span><strong class="command">uname
                   2326:             -p</strong></span>. In that directory, there is a
1.1       grant    2327:             subdirectory for each category plus a subdirectory
1.14      xtraeme  2328:             <code class="filename">All</code> which includes the
                   2329:             actual binaries in <code class="filename">.tgz</code>
                   2330:             files. The category subdirectories use symbolic links
                   2331:             to those files (this is the same directory layout as in
                   2332:             <code class=
                   2333:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2334: 
                   2335:             <p>This same directory layout applies for CDROM
                   2336:             distributions, only that the directory may be rooted
1.14      xtraeme  2337:             somewhere else, probably somewhere below <code class=
                   2338:             "filename">/cdrom</code>. Please consult your CDROMs
1.1       grant    2339:             documentation for the exact location.</p>
                   2340:           </div>
                   2341: 
                   2342:           <div class="sect2" lang="en" xml:lang="en">
                   2343:             <div class="titlepage">
                   2344:               <div>
                   2345:                 <div>
1.19    ! hubertf  2346:                   <h3 class="title"><a name="id2516519" id=
        !          2347:                   "id2516519"></a>4.1.2.&nbsp;How to use binary
1.1       grant    2348:                   packages</h3>
                   2349:                 </div>
                   2350:               </div>
                   2351:             </div>
                   2352: 
                   2353:             <p>If you have the files on a CDROM or downloaded them
                   2354:             to your hard disk, youcan install them with the
1.14      xtraeme  2355:             following command (be sure to<span><strong class=
                   2356:             "command">su</strong></span> to root first):</p>
1.1       grant    2357:             <pre class="screen">
1.14      xtraeme  2358: <code class="prompt">#</code> <strong class=
                   2359: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    2360: </pre>
                   2361: 
                   2362:             <p>If you have FTP access and you don't want to
                   2363:             download the packages via FTP prior to installation,
1.14      xtraeme  2364:             you can do this automatically by giving
                   2365:             <span><strong class="command">pkg_add</strong></span>
                   2366:             an FTP URL:</p>
1.1       grant    2367:             <pre class="screen">
1.14      xtraeme  2368: <code class="prompt">#</code> <strong class=
                   2369: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/&lt;OSvers&gt;/&lt;arch&gt;/All/package.tgz</code></strong>
1.1       grant    2370: </pre>
                   2371: 
                   2372:             <p>If there is any doubt, the uname utility can be used
                   2373:             to determine the &lt;OSvers&gt;, and &lt;arch&gt; by
1.14      xtraeme  2374:             running <span><strong class="command">uname
                   2375:             -rp</strong></span>.</p>
1.1       grant    2376: 
                   2377:             <p>Also note that any prerequisite packages needed to
                   2378:             run the package in question will be installed, too,
                   2379:             assuming they are present where you install from.</p>
                   2380: 
                   2381:             <p>After you've installed packages, be sure to have
1.14      xtraeme  2382:             <code class="filename">/usr/pkg/bin</code> in your
                   2383:             <code class="varname">PATH</code> so you can actually
                   2384:             start the just installed program.</p>
1.1       grant    2385:           </div>
                   2386: 
                   2387:           <div class="sect2" lang="en" xml:lang="en">
                   2388:             <div class="titlepage">
                   2389:               <div>
                   2390:                 <div>
1.19    ! hubertf  2391:                   <h3 class="title"><a name="id2516585" id=
        !          2392:                   "id2516585"></a>4.1.3.&nbsp;A word of
1.1       grant    2393:                   warning</h3>
                   2394:                 </div>
                   2395:               </div>
                   2396:             </div>
                   2397: 
                   2398:             <p>Please pay very careful attention to the warnings
                   2399:             expressed in the <a href=
                   2400:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2401:             <span class="citerefentry"><span class=
                   2402:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2403:             page about the inherent dangers of installing binary
                   2404:             packages which you did not create yourself, and the
                   2405:             security holes that can be introduced onto your system
                   2406:             by indiscriminate adding of such files.</p>
                   2407:           </div>
                   2408:         </div>
                   2409: 
                   2410:         <div class="sect1" lang="en" xml:lang="en">
                   2411:           <div class="titlepage">
                   2412:             <div>
                   2413:               <div>
                   2414:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  2415:                 "id2516597" id="id2516597"></a>4.2.&nbsp;Building
1.1       grant    2416:                 packages from source</h2>
                   2417:               </div>
                   2418:             </div>
                   2419:           </div>
                   2420: 
                   2421:           <p>This assumes that the package is already in pkgsrc. If
                   2422:           it is not, see <a href="#developers-guide" title=
1.2       hubertf  2423:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
                   2424:           &#8220;The pkgsrc developer's guide&#8221;</a>.</p>
1.1       grant    2425: 
                   2426:           <div class="sect2" lang="en" xml:lang="en">
                   2427:             <div class="titlepage">
                   2428:               <div>
                   2429:                 <div>
1.19    ! hubertf  2430:                   <h3 class="title"><a name="id2516606" id=
        !          2431:                   "id2516606"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2432:                 </div>
                   2433:               </div>
                   2434:             </div>
                   2435: 
                   2436:             <p>To build packages from source on a NetBSD system the
                   2437:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2438:             &#8220;<span class="quote">text</span>&#8221;
                   2439:             distribution sets must be installed. If you want to
                   2440:             build X11 related packages the &#8220;<span class=
                   2441:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2442:             "quote">xcomp</span>&#8221; distribution sets are
                   2443:             required, too.</p>
                   2444:           </div>
                   2445: 
                   2446:           <div class="sect2" lang="en" xml:lang="en">
                   2447:             <div class="titlepage">
                   2448:               <div>
                   2449:                 <div>
1.19    ! hubertf  2450:                   <h3 class="title"><a name="id2516627" id=
        !          2451:                   "id2516627"></a>4.2.2.&nbsp;Fetching
1.1       grant    2452:                   distfiles</h3>
                   2453:                 </div>
                   2454:               </div>
                   2455:             </div>
                   2456: 
                   2457:             <p>The distfile (i.e. the unmodified source) must exist
                   2458:             on your system for the packages system to be able to
                   2459:             build it. If it does not exist, pkgsrc will use
                   2460:             <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   2461:             <span class="citerefentry"><span class=
                   2462:             "refentrytitle">ftp</span>(1)</span></a> to fetch it
                   2463:             automatically.</p>
                   2464: 
                   2465:             <p>You can overwrite some of the major distribution
                   2466:             sites to fit to sites that are close to your own. Have
1.14      xtraeme  2467:             a look at <code class=
                   2468:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
                   2469:             some examples - in particular, look for the
                   2470:             <code class="varname">MASTER_SORT</code>, <code class=
                   2471:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   2472:             "varname">INET_COUNTRY</code> definitions. This may
                   2473:             save some of your bandwidth and time.</p>
1.1       grant    2474: 
                   2475:             <p>You can change these settings either in your shell's
                   2476:             environment, or, if you want to keep the settings, by
1.14      xtraeme  2477:             editing the <code class="filename">/etc/mk.conf</code>
1.1       grant    2478:             file, and adding the definitions there.</p>
                   2479: 
                   2480:             <p>If you don't have a permanent Internet connection
                   2481:             and you want to know which files to download,
1.14      xtraeme  2482:             <span><strong class="command">make
                   2483:             fetch-list</strong></span> will tell you what you'll
                   2484:             need. Put these distfiles into <code class=
                   2485:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    2486:           </div>
                   2487: 
                   2488:           <div class="sect2" lang="en" xml:lang="en">
                   2489:             <div class="titlepage">
                   2490:               <div>
                   2491:                 <div>
1.19    ! hubertf  2492:                   <h3 class="title"><a name="id2516747" id=
        !          2493:                   "id2516747"></a>4.2.3.&nbsp;How to build and
1.1       grant    2494:                   install</h3>
                   2495:                 </div>
                   2496:               </div>
                   2497:             </div>
                   2498: 
                   2499:             <p>Assuming that the distfile has been fetched (see
                   2500:             previous section), become root and change into the
1.14      xtraeme  2501:             relevant directory and running <span><strong class=
                   2502:             "command">make</strong></span>. For example, type</p>
1.1       grant    2503:             <pre class="screen">
1.14      xtraeme  2504: <code class="prompt">%</code> <strong class=
                   2505: "userinput"><code>cd misc/figlet</code></strong>
                   2506: <code class="prompt">%</code> <strong class=
                   2507: "userinput"><code>make</code></strong>
1.1       grant    2508: </pre>
                   2509: 
                   2510:             <p>at the shell prompt to build the various components
                   2511:             of the package, and</p>
                   2512:             <pre class="screen">
1.14      xtraeme  2513: <code class="prompt">#</code> <strong class=
                   2514: "userinput"><code>make install</code></strong>
1.1       grant    2515: </pre>
                   2516: 
                   2517:             <p>to install the various components into the correct
                   2518:             places on your system. Installing the package on your
                   2519:             system requires you to be root. However, pkgsrc has a
                   2520:             <span class="emphasis"><em>just-in-time-su</em></span>
                   2521:             feature, which allows you to only become root for the
                   2522:             actual installation step</p>
                   2523: 
                   2524:             <p>Taking the figlet utility as an example, we can
                   2525:             install it on our system by building as shown in
                   2526:             <a href="#logs" title=
                   2527:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
                   2528:             logs</i></a>.</p>
                   2529: 
                   2530:             <p>The program is installed under the default root of
1.14      xtraeme  2531:             the packages tree - <code class=
                   2532:             "filename">/usr/pkg</code>. Should this not conform to
                   2533:             your tastes, set the <code class=
                   2534:             "varname">LOCALBASE</code> variable in your
1.1       grant    2535:             environment, and it will use that value as the root of
1.14      xtraeme  2536:             your packages tree. So, to use <code class=
                   2537:             "filename">/usr/local</code>, set <code class=
                   2538:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    2539:             environment. Please note that you should use a
                   2540:             directory which is dedicated to packages and not shared
1.14      xtraeme  2541:             with other programs (ie, do not try and use
                   2542:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   2543:             should not try to add any of your own files or
                   2544:             directories (such as <code class=
                   2545:             "filename">src/</code>, <code class=
                   2546:             "filename">obj/</code>, or <code class=
                   2547:             "filename">pkgsrc/</code>) below the <code class=
                   2548:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    2549:             possible conflicts between programs and other files
                   2550:             installed by the package system and whatever else may
                   2551:             have been installed there.</p>
                   2552: 
1.14      xtraeme  2553:             <p>Some packages look in <code class=
                   2554:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    2555:             configuration options at build time. Have a look at
1.14      xtraeme  2556:             <code class=
                   2557:             "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
                   2558:             overview of what will be set there by default.
                   2559:             Environment variables such as <code class=
                   2560:             "varname">LOCALBASE</code> can be set in <code class=
                   2561:             "filename">/etc/mk.conf</code> to save having to
                   2562:             remember to set them each time you want to use
                   2563:             pkgsrc.</p>
1.1       grant    2564: 
                   2565:             <p>Occasionally, people want to &#8220;<span class=
                   2566:             "quote">look under the covers</span>&#8221; to see what
                   2567:             is going on when a package is building or being
                   2568:             installed. This may be for debugging purposes, or out
                   2569:             of simple curiosity. A number of utility values have
                   2570:             been added to help with this.</p>
                   2571: 
                   2572:             <div class="orderedlist">
                   2573:               <ol type="1">
                   2574:                 <li>
                   2575:                   <p>If you invoke the <a href=
                   2576:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2577:                   <span class="citerefentry"><span class=
                   2578:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  2579:                   with <code class=
                   2580:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   2581:                   amount of information will be displayed. For
                   2582:                   example,</p>
1.1       grant    2583:                   <pre class="screen">
1.14      xtraeme  2584: <strong class=
                   2585: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    2586: </pre>
                   2587: 
                   2588:                   <p>will show all the commands that are invoked,
                   2589:                   up to and including the &#8220;<span class=
                   2590:                   "quote">patch</span>&#8221; stage.</p>
                   2591:                 </li>
                   2592: 
                   2593:                 <li>
                   2594:                   <p>If you want to know the value of a certain
1.14      xtraeme  2595:                   make(1) definition, then the <code class=
                   2596:                   "varname">VARNAME</code> definition should be
                   2597:                   used, in conjunction with the show-var target.
                   2598:                   e.g. to show the expansion of the <a href=
1.1       grant    2599:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2600:                   <span class="citerefentry"><span class=
                   2601:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  2602:                   variable <code class=
                   2603:                   "varname">DISTFILES</code>:</p>
1.1       grant    2604:                   <pre class="screen">
1.14      xtraeme  2605: <code class="prompt">%</code> <strong class=
                   2606: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    2607: /usr/pkg
1.14      xtraeme  2608: <code class="prompt">%</code>
1.1       grant    2609:           
                   2610: </pre>
                   2611:                 </li>
                   2612:               </ol>
                   2613:             </div>
                   2614: 
                   2615:             <p>If you want to install a binary package that you've
                   2616:             either created yourself (see next section), that you
                   2617:             put into pkgsrc/packages manually or that is located on
1.8       wiz      2618:             a remote FTP server, you can use the "bin-install"
1.1       grant    2619:             target. This target will install a binary package - if
                   2620:             available - via <a href=
                   2621:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2622:             <span class="citerefentry"><span class=
                   2623:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  2624:             <span><strong class="command">make
                   2625:             package</strong></span>. The list of remote FTP sites
                   2626:             searched is kept in the variable <code class=
                   2627:             "varname">BINPKG_SITES</code>, which defaults to
                   2628:             ftp.NetBSD.org. Any flags that should be added to
                   2629:             <a href=
1.1       grant    2630:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2631:             <span class="citerefentry"><span class=
                   2632:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  2633:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
                   2634:             See <code class=
                   2635:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   2636:             details.</p>
1.1       grant    2637: 
                   2638:             <p>A final word of warning: If you setup a system that
1.14      xtraeme  2639:             has a non-standard setting for <code class=
                   2640:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    2641:             any packages are installed, as you can not use several
                   2642:             directories for the same purpose. Doing so will result
                   2643:             in pkgsrc not being able to properly detect your
                   2644:             installed packages, and fail miserably. Note also that
                   2645:             precompiled binary packages are usually built with the
1.14      xtraeme  2646:             default <code class="varname">LOCALBASE</code> of
                   2647:             <code class="filename">/usr/pkg</code>, and that you
                   2648:             should <span class="emphasis"><em>not</em></span>
                   2649:             install any if you use a non-standard <code class=
                   2650:             "varname">LOCALBASE</code>.</p>
1.1       grant    2651:           </div>
                   2652: 
                   2653:           <div class="sect2" lang="en" xml:lang="en">
                   2654:             <div class="titlepage">
                   2655:               <div>
                   2656:                 <div>
1.19    ! hubertf  2657:                   <h3 class="title"><a name="id2517542" id=
        !          2658:                   "id2517542"></a>4.2.4.&nbsp;Selecting the
1.1       grant    2659:                   compiler</h3>
                   2660:                 </div>
                   2661:               </div>
                   2662:             </div>
                   2663: 
                   2664:             <p>By default, pkgsrc will use GCC to build packages.
                   2665:             This may be overridden by setting the following
                   2666:             variables in /etc/mk.conf:</p>
                   2667: 
                   2668:             <div class="variablelist">
                   2669:               <dl>
1.14      xtraeme  2670:                 <dt><span class="term"><code class=
                   2671:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    2672: 
                   2673:                 <dd>
                   2674:                   <p>This is a list of values specifying the chain
                   2675:                   of compilers to invoke when building packages.
                   2676:                   Valid values are:</p>
                   2677: 
                   2678:                   <div class="itemizedlist">
                   2679:                     <ul type="disc">
                   2680:                       <li>
1.14      xtraeme  2681:                         <p><code class="varname">distcc</code>:
1.1       grant    2682:                         distributed C/C++ (chainable)</p>
                   2683:                       </li>
                   2684: 
                   2685:                       <li>
1.14      xtraeme  2686:                         <p><code class="varname">ccache</code>:
1.1       grant    2687:                         compiler cache (chainable)</p>
                   2688:                       </li>
                   2689: 
                   2690:                       <li>
1.14      xtraeme  2691:                         <p><code class="varname">gcc</code>: GNU
                   2692:                         C/C++ Compiler</p>
1.1       grant    2693:                       </li>
                   2694: 
                   2695:                       <li>
1.14      xtraeme  2696:                         <p><code class="varname">mipspro</code>:
1.1       grant    2697:                         Silicon Graphics, Inc. MIPSpro
                   2698:                         (n32/n64)</p>
                   2699:                       </li>
                   2700: 
                   2701:                       <li>
1.14      xtraeme  2702:                         <p><code class="varname">mipspro</code>:
1.1       grant    2703:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   2704:                       </li>
                   2705: 
                   2706:                       <li>
1.14      xtraeme  2707:                         <p><code class="varname">sunpro</code>:
1.1       grant    2708:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   2709:                         Studio</p>
                   2710:                       </li>
                   2711:                     </ul>
                   2712:                   </div>
                   2713: 
                   2714:                   <p>The default is &#8220;<span class=
1.14      xtraeme  2715:                   "quote"><code class=
                   2716:                   "varname">gcc</code></span>&#8221;. You can use
                   2717:                   <code class="varname">ccache</code> and/or
                   2718:                   <code class="varname">distcc</code> with an
                   2719:                   appropriate <code class=
                   2720:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   2721:                   &#8220;<span class="quote"><code class=
                   2722:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    2723:                   variable should always be terminated with a value
                   2724:                   for a real compiler.</p>
                   2725:                 </dd>
                   2726: 
1.14      xtraeme  2727:                 <dt><span class="term"><code class=
                   2728:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    2729: 
                   2730:                 <dd>
                   2731:                   <p>This specifies the minimum version of GCC to
                   2732:                   use when building packages. If the system GCC
                   2733:                   doesn't satisfy this requirement, then pkgsrc
                   2734:                   will build and install one of the GCC packages to
                   2735:                   use instead.</p>
                   2736:                 </dd>
                   2737:               </dl>
                   2738:             </div>
                   2739:           </div>
                   2740:         </div>
                   2741:       </div>
                   2742: 
                   2743:       <div class="chapter" lang="en" xml:lang="en">
                   2744:         <div class="titlepage">
                   2745:           <div>
                   2746:             <div>
                   2747:               <h2 class="title"><a name="binary" id=
                   2748:               "binary"></a>Chapter&nbsp;5.&nbsp;Creating binary
                   2749:               packages</h2>
                   2750:             </div>
                   2751:           </div>
                   2752:         </div>
                   2753: 
                   2754:         <div class="toc">
                   2755:           <p><b>Table of Contents</b></p>
                   2756: 
                   2757:           <dl>
1.19    ! hubertf  2758:             <dt><span class="sect1"><a href="#id2582755">5.1.
1.1       grant    2759:             Building a single binary package</a></span></dt>
                   2760: 
1.19    ! hubertf  2761:             <dt><span class="sect1"><a href="#id2582833">5.2.
1.1       grant    2762:             Settings for creation of binary
                   2763:             packages</a></span></dt>
                   2764: 
                   2765:             <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
                   2766:             a bulk build of all packages</a></span></dt>
                   2767: 
                   2768:             <dd>
                   2769:               <dl>
                   2770:                 <dt><span class="sect2"><a href=
                   2771:                 "#binary.configuration">5.3.1.
                   2772:                 Configuration</a></span></dt>
                   2773: 
1.19    ! hubertf  2774:                 <dt><span class="sect2"><a href="#id2582972">5.3.2.
1.1       grant    2775:                 Other environmental considerations</a></span></dt>
                   2776: 
1.19    ! hubertf  2777:                 <dt><span class="sect2"><a href="#id2583081">5.3.3.
1.1       grant    2778:                 Operation</a></span></dt>
                   2779: 
1.19    ! hubertf  2780:                 <dt><span class="sect2"><a href="#id2583219">5.3.4.
1.1       grant    2781:                 What it does</a></span></dt>
                   2782: 
1.19    ! hubertf  2783:                 <dt><span class="sect2"><a href="#id2583275">5.3.5.
1.1       grant    2784:                 Disk space requirements</a></span></dt>
                   2785: 
1.19    ! hubertf  2786:                 <dt><span class="sect2"><a href="#id2583302">5.3.6.
1.1       grant    2787:                 Setting up a sandbox for chroot'ed
                   2788:                 builds</a></span></dt>
                   2789: 
1.19    ! hubertf  2790:                 <dt><span class="sect2"><a href="#id2583763">5.3.7.
1.1       grant    2791:                 Building a partial set of packages</a></span></dt>
1.13      hubertf  2792: 
                   2793:                 <dt><span class="sect2"><a href=
                   2794:                 "#bulk-upload">5.3.8. Uploading results of a bulk
                   2795:                 build</a></span></dt>
1.1       grant    2796:               </dl>
                   2797:             </dd>
                   2798: 
1.19    ! hubertf  2799:             <dt><span class="sect1"><a href="#id2584200">5.4.
1.1       grant    2800:             Creating a multiple CD-ROM packages
                   2801:             collection</a></span></dt>
                   2802: 
                   2803:             <dd>
                   2804:               <dl>
1.19    ! hubertf  2805:                 <dt><span class="sect2"><a href="#id2584215">5.4.1.
1.1       grant    2806:                 Example of cdpack</a></span></dt>
                   2807:               </dl>
                   2808:             </dd>
                   2809:           </dl>
                   2810:         </div>
                   2811: 
                   2812:         <div class="sect1" lang="en" xml:lang="en">
                   2813:           <div class="titlepage">
                   2814:             <div>
                   2815:               <div>
                   2816:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  2817:                 "id2582755" id="id2582755"></a>5.1.&nbsp;Building a
1.1       grant    2818:                 single binary package</h2>
                   2819:               </div>
                   2820:             </div>
                   2821:           </div>
                   2822: 
                   2823:           <p>Once you have built and installed a package, you can
                   2824:           create a <span class="emphasis"><em>binary
                   2825:           package</em></span> which can be installed on another
                   2826:           system with <a href=
                   2827:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2828:           <span class="citerefentry"><span class=
                   2829:           "refentrytitle">pkg_add</span>(1)</span></a> This saves
                   2830:           having to build the same package on a group of hosts and
                   2831:           wasting CPU time. It also provides a simple means for
                   2832:           others to install your package, should you distribute
                   2833:           it.</p>
                   2834: 
                   2835:           <p>To create a binary package, change into the
1.14      xtraeme  2836:           appropriate directory in pkgsrc, and run
                   2837:           <span><strong class="command">make
                   2838:           package</strong></span>:</p>
1.1       grant    2839:           <pre class="screen">
1.14      xtraeme  2840: <code class="prompt">#</code> <strong class=
                   2841: "userinput"><code>cd misc/figlet</code></strong>
                   2842: <code class="prompt">#</code> <strong class=
                   2843: "userinput"><code>make package</code></strong>
1.1       grant    2844: </pre>
                   2845: 
                   2846:           <p>This will build and install your package (if not
                   2847:           already done), and then build a binary package from what
1.14      xtraeme  2848:           was installed. You can then use the <span><strong class=
                   2849:           "command">pkg_*</strong></span> tools to manipulate it.
                   2850:           Binary packages are created by default in <code class=
                   2851:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    2852:           gzipped tar file. See <a href="#logs.package" title=
                   2853:           "B.2.&nbsp;Packaging figlet">Section B.2,
                   2854:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   2855:           the above <a xmlns=
                   2856:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   2857:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.19    ! hubertf  2858:              class="pkgname">misc/figlet</a> example.</p>
1.1       grant    2859: 
                   2860:           <p>See <a href="#submit" title=
                   2861:           "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter
                   2862:           14, <i>Submitting and Committing</i></a> for information
                   2863:           on how to submit such a binary package.</p>
                   2864:         </div>
                   2865: 
                   2866:         <div class="sect1" lang="en" xml:lang="en">
                   2867:           <div class="titlepage">
                   2868:             <div>
                   2869:               <div>
                   2870:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  2871:                 "id2582833" id="id2582833"></a>5.2.&nbsp;Settings
1.1       grant    2872:                 for creation of binary packages</h2>
                   2873:               </div>
                   2874:             </div>
                   2875:           </div>
                   2876: 
                   2877:           <p>See <a href="#build.helpful-targets" title=
                   2878:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   2879:           &#8220;Other helpful targets&#8221;</a>.</p>
                   2880:         </div>
                   2881: 
                   2882:         <div class="sect1" lang="en" xml:lang="en">
                   2883:           <div class="titlepage">
                   2884:             <div>
                   2885:               <div>
                   2886:                 <h2 class="title" style="clear: both"><a name=
                   2887:                 "bulkbuild" id="bulkbuild"></a>5.3.&nbsp;Doing a
                   2888:                 bulk build of all packages</h2>
                   2889:               </div>
                   2890:             </div>
                   2891:           </div>
                   2892: 
                   2893:           <p>If you want to get a full set of precompiled binary
                   2894:           packages, this section describes how to get them. Beware
                   2895:           that the bulk build will remove all currently installed
                   2896:           packages from your system! Having a FTP server configured
                   2897:           either on the machine doing the bulk builds or on a
                   2898:           nearby NFS server can help to make the packages available
                   2899:           to everyone. See <a href=
                   2900:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   2901:           <span class="citerefentry"><span class=
                   2902:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   2903:           information. If you use a remote NFS server's storage, be
                   2904:           sure to not actually compile on NFS storage, as this
                   2905:           slows things down a lot.</p>
                   2906: 
                   2907:           <div class="sect2" lang="en" xml:lang="en">
                   2908:             <div class="titlepage">
                   2909:               <div>
                   2910:                 <div>
                   2911:                   <h3 class="title"><a name="binary.configuration"
                   2912:                   id=
                   2913:                   "binary.configuration"></a>5.3.1.&nbsp;Configuration</h3>
                   2914:                 </div>
                   2915:               </div>
                   2916:             </div>
                   2917: 
                   2918:             <div class="sect3" lang="en" xml:lang="en">
                   2919:               <div class="titlepage">
                   2920:                 <div>
                   2921:                   <div>
                   2922:                     <h4 class="title"><a name="binary.mk.conf" id=
                   2923:                     "binary.mk.conf"></a>5.3.1.1.&nbsp;/etc/mk.conf</h4>
                   2924:                   </div>
                   2925:                 </div>
                   2926:               </div>
                   2927: 
1.14      xtraeme  2928:               <p>You may want to set things in <code class=
                   2929:               "filename">/etc/mk.conf</code>. Look at <code class=
                   2930:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    2931:               details of the default settings. You will want to
1.14      xtraeme  2932:               ensure that <code class=
                   2933:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   2934:               policy. As used in this example, <code class=
                   2935:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    2936:               "emphasis"><em>all</em></span> licenses.</p>
                   2937:               <pre class="programlisting">
                   2938: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   2939: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   2940: BSDSRCDIR=      /usr/src
                   2941: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   2942: OBJHOSTNAME?=   yes               # use work.`hostname`
                   2943: FAILOVER_FETCH= yes               # insist on the correct checksum
                   2944: PKG_DEVELOPER?= yes
                   2945: _ACCEPTABLE=    yes
                   2946: </pre>
                   2947:             </div>
                   2948: 
                   2949:             <div class="sect3" lang="en" xml:lang="en">
                   2950:               <div class="titlepage">
                   2951:                 <div>
                   2952:                   <div>
1.19    ! hubertf  2953:                     <h4 class="title"><a name="id2582897" id=
        !          2954:                     "id2582897"></a>5.3.1.2.&nbsp;<code class=
1.14      xtraeme  2955:                     "filename">build.conf</code></h4>
1.1       grant    2956:                   </div>
                   2957:                 </div>
                   2958:               </div>
                   2959: 
1.14      xtraeme  2960:               <p>In <code class="filename">pkgsrc/mk/bulk</code>,
                   2961:               copy <code class="filename">build.conf-example</code>
                   2962:               to <code class="filename">build.conf</code> and edit
                   2963:               it, following the comments in that file. This is the
1.1       grant    2964:               config file that determines where log files are
                   2965:               generated after the build, where to mail the build
                   2966:               report to, where your pkgsrc tree is located and
                   2967:               which user to <a href=
                   2968:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   2969:               <span class="citerefentry"><span class=
                   2970:               "refentrytitle">su</span>(8)</span></a> to to do a
1.14      xtraeme  2971:               <span><strong class="command">cvs
                   2972:               update</strong></span>.</p>
1.1       grant    2973:             </div>
                   2974: 
                   2975:             <div class="sect3" lang="en" xml:lang="en">
                   2976:               <div class="titlepage">
                   2977:                 <div>
                   2978:                   <div>
1.19    ! hubertf  2979:                     <h4 class="title"><a name="id2582933" id=
        !          2980:                     "id2582933"></a>5.3.1.3.&nbsp;<code class=
1.14      xtraeme  2981:                     "filename">pre-build.local</code></h4>
1.1       grant    2982:                   </div>
                   2983:                 </div>
                   2984:               </div>
                   2985: 
                   2986:               <p>It is possible to configure the bulk build to
                   2987:               perform certain site specific tasks at the end of the
1.14      xtraeme  2988:               pre-build stage. If the file <code class=
                   2989:               "filename">pre-build.local</code> exists in
                   2990:               <code class="filename">/usr/pkgsrc/mk/bulk</code> it
                   2991:               will be executed (as a sh(1) script) at the end of
                   2992:               the usual pre-build stage. An example use of
                   2993:               <code class="filename">pre-build.local</code> is to
                   2994:               have the line:</p>
1.1       grant    2995:               <pre class="screen">
1.14      xtraeme  2996: <code class="prompt">#</code> <strong class=
                   2997: "userinput"><code>echo "I do not have enough disk space to build this pig." \
                   2998:     &gt; pkgsrc/games/crafty-book-enormous/$BROKENF</code></strong>
1.1       grant    2999: </pre>
                   3000: 
                   3001:               <p>to prevent the system from trying to build a
                   3002:               particular package which requires nearly 3 GB of disk
                   3003:               space.</p>
                   3004:             </div>
                   3005:           </div>
                   3006: 
                   3007:           <div class="sect2" lang="en" xml:lang="en">
                   3008:             <div class="titlepage">
                   3009:               <div>
                   3010:                 <div>
1.19    ! hubertf  3011:                   <h3 class="title"><a name="id2582972" id=
        !          3012:                   "id2582972"></a>5.3.2.&nbsp;Other environmental
1.1       grant    3013:                   considerations</h3>
                   3014:                 </div>
                   3015:               </div>
                   3016:             </div>
                   3017: 
1.14      xtraeme  3018:             <p>As <code class="filename">/usr/pkg</code> will be
1.1       grant    3019:             completely deleted at the start of bulk builds, make
                   3020:             sure your login shell is placed somewhere else. Either
1.14      xtraeme  3021:             drop it into <code class=
                   3022:             "filename">/usr/local/bin</code> (and adjust your login
                   3023:             shell in the passwd file), or (re-)install it via
                   3024:             <a href=
1.1       grant    3025:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3026:             <span class="citerefentry"><span class=
                   3027:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.14      xtraeme  3028:             <code class="filename">/etc/rc.local</code>, so you can
1.1       grant    3029:             login after a reboot (remember that your current
                   3030:             process won't die if the package is removed, you just
                   3031:             can't start any new instances of the shell any more).
                   3032:             Also, if you use NetBSD earlier than 1.5, or you still
                   3033:             want to use the pkgsrc version of ssh for some reason,
                   3034:             be sure to install ssh before starting it from
1.14      xtraeme  3035:             <code class="filename">rc.local</code>:</p>
1.1       grant    3036:             <pre class="programlisting">
                   3037: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   3038: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   3039:     /usr/pkg/etc/rc.d/sshd
                   3040: fi
                   3041: </pre>
                   3042: 
                   3043:             <p>Not doing so will result in you being not able to
                   3044:             log in via ssh after the bulk build is finished or if
                   3045:             the machine gets rebooted or crashes. You have been
                   3046:             warned! :)</p>
                   3047:           </div>
                   3048: 
                   3049:           <div class="sect2" lang="en" xml:lang="en">
                   3050:             <div class="titlepage">
                   3051:               <div>
                   3052:                 <div>
1.19    ! hubertf  3053:                   <h3 class="title"><a name="id2583081" id=
        !          3054:                   "id2583081"></a>5.3.3.&nbsp;Operation</h3>
1.1       grant    3055:                 </div>
                   3056:               </div>
                   3057:             </div>
                   3058: 
                   3059:             <p>Make sure you don't need any of the packages still
                   3060:             installed.</p>
                   3061: 
                   3062:             <div class="warning" style=
                   3063:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3064:               <h3 class="title">Warning</h3>
                   3065: 
                   3066:               <p>During the bulk build, <span class=
                   3067:               "emphasis"><em>all packages will be
                   3068:               removed!</em></span></p>
                   3069:             </div>
                   3070: 
                   3071:             <p>Be sure to remove all other things that might
                   3072:             interfere with builds, like some libs installed in
1.14      xtraeme  3073:             <code class="filename">/usr/local</code>, etc. then
                   3074:             become root and type:</p>
1.1       grant    3075:             <pre class="screen">
1.14      xtraeme  3076: <code class="prompt">#</code> <strong class=
                   3077: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   3078: <code class="prompt">#</code> <strong class=
                   3079: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    3080: </pre>
                   3081: 
                   3082:             <p>If for some reason your last build didn't complete
                   3083:             (power failure, system panic, ...), you can continue it
                   3084:             by running:</p>
                   3085:             <pre class="screen">
1.14      xtraeme  3086: <code class="prompt">#</code> <strong class=
                   3087: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    3088: </pre>
                   3089: 
                   3090:             <p>At the end of the bulk build, you will get a summary
                   3091:             via mail, and find build logs in the directory
1.14      xtraeme  3092:             specified by <code class="varname">FTP</code> in the
                   3093:             <code class="filename">build.conf</code> file.</p>
1.1       grant    3094:           </div>
                   3095: 
                   3096:           <div class="sect2" lang="en" xml:lang="en">
                   3097:             <div class="titlepage">
                   3098:               <div>
                   3099:                 <div>
1.19    ! hubertf  3100:                   <h3 class="title"><a name="id2583219" id=
        !          3101:                   "id2583219"></a>5.3.4.&nbsp;What it does</h3>
1.1       grant    3102:                 </div>
                   3103:               </div>
                   3104:             </div>
                   3105: 
                   3106:             <p>The bulk builds consist of three steps:</p>
                   3107: 
                   3108:             <div class="variablelist">
                   3109:               <dl>
                   3110:                 <dt><span class="term">1. pre-build</span></dt>
                   3111: 
                   3112:                 <dd>
                   3113:                   <p>The script updates your pkgsrc tree via
                   3114:                   (anon)cvs, then cleans out any broken distfiles,
                   3115:                   and removes all packages installed.</p>
                   3116:                 </dd>
                   3117: 
                   3118:                 <dt><span class="term">2. the bulk
                   3119:                 build</span></dt>
                   3120: 
                   3121:                 <dd>
                   3122:                   <p>This is basically &#8220;<span class=
                   3123:                   "quote">make bulk-package</span>&#8221; with an
                   3124:                   optimised order in which packages will be built.
                   3125:                   Packages that don't require other packages will
                   3126:                   be built first, and packages with many
                   3127:                   dependencies will be built later.</p>
                   3128:                 </dd>
                   3129: 
                   3130:                 <dt><span class="term">3. post-build</span></dt>
                   3131: 
                   3132:                 <dd>
                   3133:                   <p>Generates a report that's placed in the
1.14      xtraeme  3134:                   directory specified in the <code class=
                   3135:                   "filename">build.conf</code> file named
                   3136:                   <code class="filename">broken.html</code>, a
                   3137:                   short version of that report will also be mailed
                   3138:                   to the build's admin.</p>
1.1       grant    3139:                 </dd>
                   3140:               </dl>
                   3141:             </div>
                   3142: 
                   3143:             <p>During the build, a list of broken packages will be
1.14      xtraeme  3144:             compiled in <code class=
                   3145:             "filename">/usr/pkgsrc/.broken</code> (or <code class=
                   3146:             "filename">.../.broken.${MACHINE}</code> if
                   3147:             <code class="varname">OBJMACHINE</code> is set),
                   3148:             individual build logs of broken builds can be found in
                   3149:             the package's directory. These files are used by the
                   3150:             bulk-targets to mark broken builds to not waste time
                   3151:             trying to rebuild them, and they can be used to debug
                   3152:             these broken package builds later.</p>
1.1       grant    3153:           </div>
                   3154: 
                   3155:           <div class="sect2" lang="en" xml:lang="en">
                   3156:             <div class="titlepage">
                   3157:               <div>
                   3158:                 <div>
1.19    ! hubertf  3159:                   <h3 class="title"><a name="id2583275" id=
        !          3160:                   "id2583275"></a>5.3.5.&nbsp;Disk space
1.1       grant    3161:                   requirements</h3>
                   3162:                 </div>
                   3163:               </div>
                   3164:             </div>
                   3165: 
                   3166:             <p>Currently, roughly the following requirements are
                   3167:             valid for NetBSD 2.0/i386:</p>
                   3168: 
                   3169:             <div class="itemizedlist">
                   3170:               <ul type="disc">
                   3171:                 <li>
                   3172:                   <p>10 GB - distfiles (NFS ok)</p>
                   3173:                 </li>
                   3174: 
                   3175:                 <li>
                   3176:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   3177:                 </li>
                   3178: 
                   3179:                 <li>
                   3180:                   <p>5 GB - temp space for compiling (local disk
                   3181:                   recommended)</p>
                   3182:                 </li>
                   3183:               </ul>
                   3184:             </div>
                   3185: 
                   3186:             <p>Note that all pkgs will be de-installed as soon as
                   3187:             they are turned into a binary package, and that sources
                   3188:             are removed, so there is no excessively huge demand to
                   3189:             disk space. Afterwards, if the package is needed again,
                   3190:             it will be installed via <a href=
                   3191:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3192:             <span class="citerefentry"><span class=
                   3193:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   3194:             building again, so there are no cycles wasted by
                   3195:             recompiling.</p>
                   3196:           </div>
                   3197: 
                   3198:           <div class="sect2" lang="en" xml:lang="en">
                   3199:             <div class="titlepage">
                   3200:               <div>
                   3201:                 <div>
1.19    ! hubertf  3202:                   <h3 class="title"><a name="id2583302" id=
        !          3203:                   "id2583302"></a>5.3.6.&nbsp;Setting up a sandbox
1.1       grant    3204:                   for chroot'ed builds</h3>
                   3205:                 </div>
                   3206:               </div>
                   3207:             </div>
                   3208: 
1.12      agc      3209:             <p>If you don't want all the packages nuked from a
                   3210:             machine (rendering it useless for anything but pkg
                   3211:             compiling), there is the possibility of doing the pkg
                   3212:             bulk build inside a chroot environment.</p>
                   3213: 
                   3214:             <p>The first step is to set up a chroot sandbox, e.g.
1.14      xtraeme  3215:             <code class="filename">/usr/sandbox</code>. This can be
1.12      agc      3216:             done by using null mounts, or manually.</p>
                   3217: 
1.14      xtraeme  3218:             <p>There is a shell script called <code class=
                   3219:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   3220:             set up the sandbox environment using null mounts. It
                   3221:             will also create a script called <code class=
                   3222:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      3223:             environment, which will allow the null mounts to be
1.14      xtraeme  3224:             activated using the <span><strong class=
                   3225:             "command">sandbox mount</strong></span> command and
                   3226:             deactivated using the <span><strong class=
                   3227:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      3228: 
                   3229:             <p>To set up a sandbox environment by hand, after
                   3230:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  3231:             doing a <span><strong class="command">make distribution
                   3232:             DESTDIR=/usr/sandbox</strong></span> in <code class=
                   3233:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      3234:             items are present and properly configured:</p>
1.1       grant    3235: 
                   3236:             <div class="procedure">
                   3237:               <ol type="1">
                   3238:                 <li>
                   3239:                   <p>Kernel</p>
                   3240:                   <pre class="screen">
1.14      xtraeme  3241: <code class="prompt">#</code> <strong class=
                   3242: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    3243: </pre>
                   3244:                 </li>
                   3245: 
                   3246:                 <li>
1.14      xtraeme  3247:                   <p><code class="filename">/dev/*</code></p>
1.1       grant    3248:                   <pre class="screen">
1.14      xtraeme  3249: <code class="prompt">#</code> <strong class=
                   3250: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    3251: </pre>
                   3252:                 </li>
                   3253: 
                   3254:                 <li>
1.14      xtraeme  3255:                   <p><code class="filename">/etc/resolv.conf</code>
1.1       grant    3256:                   (for <a xmlns=
                   3257:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3258:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.19    ! hubertf  3259:                      class="pkgname">security/smtpd</a> and
        !          3260:                      mail):</p>
1.1       grant    3261:                   <pre class="screen">
1.14      xtraeme  3262: <code class="prompt">#</code> <strong class=
                   3263: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    3264: </pre>
                   3265:                 </li>
                   3266: 
                   3267:                 <li>
                   3268:                   <p>Working(!) mail config (hostname,
                   3269:                   sendmail.cf):</p>
                   3270:                   <pre class="screen">
1.14      xtraeme  3271: <code class="prompt">#</code> <strong class=
                   3272: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    3273: </pre>
                   3274:                 </li>
                   3275: 
                   3276:                 <li>
1.14      xtraeme  3277:                   <p><code class="filename">/etc/localtime</code>
                   3278:                   (for <a xmlns=
1.1       grant    3279:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3280:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.19    ! hubertf  3281:                      class="pkgname">security/smtpd</a>):</p>
1.1       grant    3282:                   <pre class="screen">
1.14      xtraeme  3283: <code class="prompt">#</code> <strong class=
                   3284: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    3285: </pre>
                   3286:                 </li>
                   3287: 
                   3288:                 <li>
1.14      xtraeme  3289:                   <p><code class="filename">/usr/src</code> (system
1.1       grant    3290:                   sources, for <a xmlns=
                   3291:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3292:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.19    ! hubertf  3293:                      class="pkgname">sysutils/aperture</a>,
        !          3294:                      <a xmlns=
        !          3295:                      "http://www.w3.org/TR/xhtml1/transitional"
        !          3296:                      href=
        !          3297:                      "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
        !          3298:                      class="pkgname">net/ppp-mppe</a>):</p>
1.1       grant    3299:                   <pre class="screen">
1.14      xtraeme  3300: <code class="prompt">#</code> <strong class=
                   3301: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   3302: <code class="prompt">#</code> <strong class=
                   3303: "userinput"><code>ln -s cvs/src-1.6 src</code></strong>
1.1       grant    3304: </pre>
                   3305:                 </li>
                   3306: 
                   3307:                 <li>
1.14      xtraeme  3308:                   <p>Create <code class=
                   3309:                   "filename">/var/db/pkg</code> (not part of
                   3310:                   default install):</p>
1.1       grant    3311:                   <pre class="screen">
1.14      xtraeme  3312: <code class="prompt">#</code> <strong class=
                   3313: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    3314: </pre>
                   3315:                 </li>
                   3316: 
                   3317:                 <li>
1.14      xtraeme  3318:                   <p>Create <code class="filename">/usr/pkg</code>
                   3319:                   (not part of default install):</p>
1.1       grant    3320:                   <pre class="screen">
1.14      xtraeme  3321: <code class="prompt">#</code> <strong class=
                   3322: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    3323: </pre>
                   3324:                 </li>
                   3325: 
                   3326:                 <li>
1.14      xtraeme  3327:                   <p>Checkout pkgsrc via cvs into <code class=
                   3328:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    3329:                   <pre class="screen">
1.14      xtraeme  3330: <code class="prompt">#</code> <strong class=
                   3331: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   3332: <code class="prompt">#</code> <strong class=
                   3333: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    3334: </pre>
                   3335: 
                   3336:                   <p>Do not mount/link this to the copy of your
                   3337:                   pkgsrc tree you do development in, as this will
                   3338:                   likely cause problems!</p>
                   3339:                 </li>
                   3340: 
                   3341:                 <li>
1.14      xtraeme  3342:                   <p>Make <code class=
                   3343:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
                   3344:                   and <code class="filename">.../distfiles</code>
                   3345:                   point somewhere appropriate. NFS- and/or
                   3346:                   nullfs-mounts may come in handy!</p>
1.1       grant    3347:                 </li>
                   3348: 
                   3349:                 <li>
1.14      xtraeme  3350:                   <p>Edit <code class=
                   3351:                   "filename">/etc/mk.conf</code>, see <a href=
                   3352:                   "#binary.mk.conf" title=
1.1       grant    3353:                   "5.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;5.3.1.1,
                   3354:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   3355:                 </li>
                   3356: 
                   3357:                 <li>
1.14      xtraeme  3358:                   <p>Adjust <code class=
                   3359:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    3360:                   needs.</p>
                   3361:                 </li>
                   3362: 
                   3363:                 <li>
1.14      xtraeme  3364:                   <p>If you have set <code class=
                   3365:                   "varname">CVS_USER</code> in <code class=
                   3366:                   "filename">build.conf</code>, make sure that
                   3367:                   account exists and can do a <span><strong class=
                   3368:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    3369:                   properly!</p>
                   3370:                 </li>
                   3371:               </ol>
                   3372:             </div>
                   3373: 
                   3374:             <p>When the chroot sandbox is setup, you can start the
                   3375:             build with the following steps:</p>
                   3376:             <pre class="screen">
1.14      xtraeme  3377: <code class="prompt">#</code> <strong class=
                   3378: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   3379: <code class="prompt">#</code> <strong class=
                   3380: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    3381: </pre>
                   3382: 
                   3383:             <p>This will just jump inside the sandbox and start
                   3384:             building. At the end of the build, mail will be sent
                   3385:             with the results of the build. Created binary pkgs will
1.14      xtraeme  3386:             be in <code class=
                   3387:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    3388:             (wherever that points/mounts to/from).</p>
                   3389:           </div>
                   3390: 
                   3391:           <div class="sect2" lang="en" xml:lang="en">
                   3392:             <div class="titlepage">
                   3393:               <div>
                   3394:                 <div>
1.19    ! hubertf  3395:                   <h3 class="title"><a name="id2583763" id=
        !          3396:                   "id2583763"></a>5.3.7.&nbsp;Building a partial
1.1       grant    3397:                   set of packages</h3>
                   3398:                 </div>
                   3399:               </div>
                   3400:             </div>
                   3401: 
                   3402:             <p>In addition to building a complete set of all
1.14      xtraeme  3403:             packages in pkgsrc, the <code class=
                   3404:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   3405:             used to build a subset of the packages contained in
                   3406:             pkgsrc. By setting defining <code class=
                   3407:             "varname">SPECIFIC_PKGS</code> in <code class=
                   3408:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    3409: 
                   3410:             <div class="itemizedlist">
                   3411:               <ul type="disc">
                   3412:                 <li>
                   3413:                   <p>SITE_SPECIFIC_PKGS</p>
                   3414:                 </li>
                   3415: 
                   3416:                 <li>
                   3417:                   <p>HOST_SPECIFIC_PKGS</p>
                   3418:                 </li>
                   3419: 
                   3420:                 <li>
                   3421:                   <p>GROUP_SPECIFIC_PKGS</p>
                   3422:                 </li>
                   3423: 
                   3424:                 <li>
                   3425:                   <p>USER_SPECIFIC_PKGS</p>
                   3426:                 </li>
                   3427:               </ul>
                   3428:             </div>
                   3429: 
                   3430:             <p>will define the set of packages which should be
                   3431:             built. The bulk build code will also include any
                   3432:             packages which are needed as dependencies for the
                   3433:             explicitly listed packages.</p>
                   3434: 
                   3435:             <p>One use of this is to do a bulk build with
1.14      xtraeme  3436:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    3437:             sandbox periodically to have a complete set of the
                   3438:             binary packages needed for your site available without
                   3439:             the overhead of building extra packages that are not
                   3440:             needed.</p>
                   3441:           </div>
1.13      hubertf  3442: 
                   3443:           <div class="sect2" lang="en" xml:lang="en">
                   3444:             <div class="titlepage">
                   3445:               <div>
                   3446:                 <div>
                   3447:                   <h3 class="title"><a name="bulk-upload" id=
                   3448:                   "bulk-upload"></a>5.3.8.&nbsp;Uploading results
                   3449:                   of a bulk build</h3>
                   3450:                 </div>
                   3451:               </div>
                   3452:             </div>
                   3453: 
                   3454:             <p>This section describes how pkgsrc developers can
                   3455:             upload binary pkgs built by bulk builds to
                   3456:             ftp.NetBSD.org.</p>
                   3457: 
1.17      sketch   3458:             <p>If you would like to automatically create checksum
                   3459:             files for the binary packages you intend to upload,
                   3460:             remember to set <code class="varname">MKSUMS=yes</code>
                   3461:             in your <code class=
                   3462:             "filename">mk/bulk/build.conf</code>.</p>
                   3463: 
                   3464:             <p>If you would like to PGP sign the checksum files
                   3465:             (highly recommended!), remember to set <code class=
                   3466:             "varname">SIGN_AS=username@NetBSD.org</code> in your
                   3467:             <code class="filename">mk/bulk/build.conf</code>. This
                   3468:             will prompt you for your gpg password to sign the files
                   3469:             before uploading everything.</p>
                   3470: 
                   3471:             <p>Then, make sure that you have <code class=
1.14      xtraeme  3472:             "varname">RSYNC_DST</code> set properly in your
                   3473:             <code class="filename">mk/bulk/build.conf</code> file,
                   3474:             i.e. adjust it to something like one of the
                   3475:             following:</p>
1.13      hubertf  3476:             <pre class="screen">
                   3477: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3478: </pre>
                   3479: 
                   3480:             <p>Please use appropviate values for "pkgsrc-200xQ4",
                   3481:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  3482:             ftp.NetBSD.org is different from <code class=
                   3483:             "varname">CVS_USER</code>, write your login directly
                   3484:             into the variable, e.g. my local account is "feyrer",
                   3485:             but for my login "hubertf", I use:</p>
1.13      hubertf  3486:             <pre class="screen">
                   3487: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3488: </pre>
                   3489: 
1.14      xtraeme  3490:             <p>A separate <code class="filename">upload</code>
1.13      hubertf  3491:             directory is used here to allow "closing" the directory
                   3492:             during upload. To do so, run the following command on
                   3493:             ftp.NetBSD.org next:</p>
                   3494:             <pre class="screen">
1.14      xtraeme  3495: nbftp% <strong class=
                   3496: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  3497: </pre>
                   3498: 
1.14      xtraeme  3499:             <p>Please note that <code class=
                   3500:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  3501:             appropriate for packages for the NetBSD operating
                   3502:             system. Binary packages for other operating systems
1.14      xtraeme  3503:             should go into <code class=
                   3504:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  3505: 
                   3506:             <p>Before uploading the binary pkgs, ssh authentication
                   3507:             needs to be setup next. This example shows how to setup
                   3508:             temporary keys for the root account <span class=
                   3509:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   3510:             that no keys should be present there usually):</p>
                   3511:             <pre class="screen">
1.14      xtraeme  3512: <code class="prompt">#</code> <strong class=
                   3513: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   3514: chroot-<code class="prompt">#</code> <strong class=
                   3515: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   3516: chroot-<code class="prompt">#</code> <strong class=
                   3517: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   3518: chroot-<code class="prompt">#</code> <strong class=
                   3519: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  3520: </pre>
                   3521: 
1.14      xtraeme  3522:             <p>Now take the output of <code class=
                   3523:             "filename">id-dsa.pub</code> and append it to your
                   3524:             <code class="filename">~/.ssh/authorized_keys</code>
1.17      sketch   3525:             file on ftp.NetBSD.org. You can remove the key after
1.14      xtraeme  3526:             the upload is done!</p>
1.13      hubertf  3527: 
                   3528:             <p>Next, test if your ssh connection really works:</p>
                   3529:             <pre class="screen">
1.14      xtraeme  3530: chroot-<code class="prompt">#</code> <strong class=
                   3531: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  3532: </pre>
                   3533: 
                   3534:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   3535: 
                   3536:             <p>Now after all this works, you can exit the sandbox
                   3537:             and start the upload:</p>
                   3538:             <pre class="screen">
1.14      xtraeme  3539: chroot-<code class="prompt">#</code> <strong class=
                   3540: "userinput"><code>exit</code></strong>        
                   3541: <code class="prompt">#</code> <strong class=
                   3542: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   3543: <code class="prompt">#</code> <strong class=
                   3544: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  3545: </pre>
                   3546: 
                   3547:             <p>The upload process may take quite some time. Use
                   3548:             "ls" or "du" on the FTP server to monitor progress of
                   3549:             the upload.</p>
                   3550: 
                   3551:             <p>After the upload has ended, first thing is to revoke
                   3552:             ssh access:</p>
                   3553:             <pre class="screen">
1.14      xtraeme  3554: nbftp% <strong class=
                   3555: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  3556: Gdd:x! 
                   3557: </pre>
                   3558: 
                   3559:             <p>Use whatever is needed to remove the key you've
                   3560:             entered before! Last, move the uploaded packages out of
1.14      xtraeme  3561:             the <code class="filename">upload</code> directory to
                   3562:             have them accessible to everyone:</p>
1.13      hubertf  3563:             <pre class="screen">
1.14      xtraeme  3564: nbftp% <strong class=
                   3565: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   3566: nbftp% <strong class=
                   3567: "userinput"><code>mv upload/* .</code></strong>
                   3568: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   3569: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  3570: </pre>
                   3571:           </div>
1.1       grant    3572:         </div>
                   3573: 
                   3574:         <div class="sect1" lang="en" xml:lang="en">
                   3575:           <div class="titlepage">
                   3576:             <div>
                   3577:               <div>
                   3578:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  3579:                 "id2584200" id="id2584200"></a>5.4.&nbsp;Creating a
1.1       grant    3580:                 multiple CD-ROM packages collection</h2>
                   3581:               </div>
                   3582:             </div>
                   3583:           </div>
                   3584: 
                   3585:           <p>After your pkgsrc bulk-build has completed, you may
                   3586:           wish to create a CD-ROM set of the resulting binary
                   3587:           packages to assist in installing packages on other
                   3588:           machines. The <a xmlns=
                   3589:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3590:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.19    ! hubertf  3591:              class="pkgname">pkgtools/cdpack</a> package provides a
        !          3592:              simple tool for creating the ISO 9660 images.
        !          3593:              <span><strong class="command">cdpack</strong></span>
        !          3594:              arranges the packages on the CD-ROMs in a way that
        !          3595:              keeps all the dependencies for given package on the
        !          3596:              same CD as that package.</p>
1.1       grant    3597: 
                   3598:           <div class="sect2" lang="en" xml:lang="en">
                   3599:             <div class="titlepage">
                   3600:               <div>
                   3601:                 <div>
1.19    ! hubertf  3602:                   <h3 class="title"><a name="id2584215" id=
        !          3603:                   "id2584215"></a>5.4.1.&nbsp;Example of
1.1       grant    3604:                   cdpack</h3>
                   3605:                 </div>
                   3606:               </div>
                   3607:             </div>
                   3608: 
                   3609:             <p>Complete documentation for cdpack is found in the
                   3610:             cdpack(1) manpage. The following short example assumes
1.14      xtraeme  3611:             that the binary packages are left in <code class=
                   3612:             "filename">/usr/pkgsrc/packages/All</code> and that
                   3613:             sufficient disk space exists in <code class=
                   3614:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    3615:             <pre class="screen">
1.14      xtraeme  3616: <code class="prompt">#</code> <strong class=
                   3617: "userinput"><code>mkdir /u2/images</code></strong>
                   3618: <code class="prompt">#</code> <strong class=
                   3619: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   3620: <code class="prompt">#</code> <strong class=
                   3621: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3622: </pre>
                   3623: 
                   3624:             <p>If you wish to include a common set of files
1.14      xtraeme  3625:             (<code class="filename">COPYRIGHT</code>, <code class=
                   3626:             "filename">README</code>, etc.) on each CD in the
1.1       grant    3627:             collection, then you need to create a directory which
                   3628:             contains these files. e.g.</p>
                   3629:             <pre class="screen">
1.14      xtraeme  3630: <code class="prompt">#</code> <strong class=
                   3631: "userinput"><code>mkdir /tmp/common</code></strong>
                   3632: <code class="prompt">#</code> <strong class=
                   3633: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   3634: <code class="prompt">#</code> <strong class=
                   3635: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   3636: <code class="prompt">#</code> <strong class=
                   3637: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   3638: <code class="prompt">#</code> <strong class=
                   3639: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   3640: <code class="prompt">#</code> <strong class=
                   3641: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   3642: <code class="prompt">#</code> <strong class=
                   3643: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    3644: </pre>
                   3645: 
                   3646:             <p>Now create the images:</p>
                   3647:             <pre class="screen">
1.14      xtraeme  3648: <code class="prompt">#</code> <strong class=
                   3649: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3650: </pre>
                   3651: 
1.14      xtraeme  3652:             <p>Each image will contain <code class=
                   3653:             "filename">README</code>, <code class=
                   3654:             "filename">COPYING</code>, and <code class=
                   3655:             "filename">bin/myscript</code> in their root
1.1       grant    3656:             directories.</p>
                   3657:           </div>
                   3658:         </div>
                   3659:       </div>
                   3660: 
                   3661:       <div class="chapter" lang="en" xml:lang="en">
                   3662:         <div class="titlepage">
                   3663:           <div>
                   3664:             <div>
                   3665:               <h2 class="title"><a name="faq" id=
                   3666:               "faq"></a>Chapter&nbsp;6.&nbsp;Frequently Asked
                   3667:               Questions</h2>
                   3668:             </div>
                   3669:           </div>
                   3670:         </div>
                   3671: 
                   3672:         <div class="toc">
                   3673:           <p><b>Table of Contents</b></p>
                   3674: 
                   3675:           <dl>
1.19    ! hubertf  3676:             <dt><span class="sect1"><a href="#id2584475">6.1. Are
1.18      xtraeme  3677:             there any mailing lists for pkg-related
1.1       grant    3678:             discussion?</a></span></dt>
                   3679: 
1.19    ! hubertf  3680:             <dt><span class="sect1"><a href="#id2584610">6.2.
1.1       grant    3681:             Where's the pkgviews documentation?</a></span></dt>
                   3682: 
1.5       hubertf  3683:             <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    3684:             Utilities for package management
                   3685:             (pkgtools)</a></span></dt>
                   3686: 
1.19    ! hubertf  3687:             <dt><span class="sect1"><a href="#id2584794">6.4. How
1.1       grant    3688:             to use pkgsrc as non-root</a></span></dt>
                   3689: 
1.19    ! hubertf  3690:             <dt><span class="sect1"><a href="#id2584806">6.5. How
1.15      xtraeme  3691:             to resume transfers when fetching
                   3692:             distfiles?</a></span></dt>
1.14      xtraeme  3693: 
1.19    ! hubertf  3694:             <dt><span class="sect1"><a href="#id2584849">6.6. How
1.1       grant    3695:             can I install/use XFree86 from pkgsrc?</a></span></dt>
                   3696: 
1.19    ! hubertf  3697:             <dt><span class="sect1"><a href="#id2584876">6.7. How
1.1       grant    3698:             can I install/use X.org from pkgsrc?</a></span></dt>
                   3699: 
1.19    ! hubertf  3700:             <dt><span class="sect1"><a href="#id2584904">6.8. How
1.1       grant    3701:             to fetch files from behind a firewall</a></span></dt>
                   3702: 
1.19    ! hubertf  3703:             <dt><span class="sect1"><a href="#id2584918">6.9. How
1.14      xtraeme  3704:             do I tell <span><strong class="command">make
                   3705:             fetch</strong></span> to do passive
                   3706:             FTP?</a></span></dt>
1.1       grant    3707: 
1.19    ! hubertf  3708:             <dt><span class="sect1"><a href="#id2584969">6.10. How
1.1       grant    3709:             to fetch all distfiles at once</a></span></dt>
                   3710: 
1.19    ! hubertf  3711:             <dt><span class="sect1"><a href="#id2585177">6.11. What
1.14      xtraeme  3712:             does &#8220;<span class="quote">Don't know how to make
                   3713:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    3714:             mean?</a></span></dt>
                   3715: 
1.19    ! hubertf  3716:             <dt><span class="sect1"><a href="#id2585216">6.12. What
1.14      xtraeme  3717:             does &#8220;<span class="quote">Could not find
                   3718:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    3719: 
1.19    ! hubertf  3720:             <dt><span class="sect1"><a href="#id2585273">6.13.
1.1       grant    3721:             Using 'sudo' with pkgsrc</a></span></dt>
                   3722: 
1.14      xtraeme  3723:             <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    3724:             Configuration files handling and
                   3725:             placement</a></span></dt>
                   3726: 
1.14      xtraeme  3727:             <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1       grant    3728:             Automated security checks</a></span></dt>
                   3729:           </dl>
                   3730:         </div>
                   3731: 
                   3732:         <p>This section contains hints, tips &amp; tricks on
                   3733:         special things in pkgsrc that we didn't find a better place
                   3734:         for in the previous chapters, and it contains items for
                   3735:         both pkgsrc users and developers.</p>
                   3736: 
                   3737:         <div class="sect1" lang="en" xml:lang="en">
                   3738:           <div class="titlepage">
                   3739:             <div>
                   3740:               <div>
                   3741:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  3742:                 "id2584475" id="id2584475"></a>6.1.&nbsp;Are there
1.18      xtraeme  3743:                 any mailing lists for pkg-related discussion?</h2>
1.1       grant    3744:               </div>
                   3745:             </div>
                   3746:           </div>
                   3747: 
1.18      xtraeme  3748:           <p>The following mailing lists may be of interest to
                   3749:           pkgsrc users:</p>
                   3750: 
                   3751:           <div class="itemizedlist">
                   3752:             <ul type="disc">
                   3753:               <li>
                   3754:                 <p><a href=
                   3755:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
1.19    ! hubertf  3756:                    target="_top">pkgsrc-bugs</a> -- a list where
        !          3757:                    problem reports related to pkgsrc are sent and
        !          3758:                    discussed</p>
1.18      xtraeme  3759:               </li>
                   3760: 
                   3761:               <li>
                   3762:                 <p><a href=
                   3763:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
1.19    ! hubertf  3764:                    target="_top">pkgsrc-bulk</a> -- a list where
        !          3765:                    the results of pkgsrc bulk builds are sent and
        !          3766:                    discussed</p>
1.18      xtraeme  3767:               </li>
                   3768: 
                   3769:               <li>
                   3770:                 <p><a href=
                   3771:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
1.19    ! hubertf  3772:                    target="_top">pkgsrc-changes</a> -- a list where
        !          3773:                    all commit messages to pkgsrc are sent</p>
1.18      xtraeme  3774:               </li>
                   3775: 
                   3776:               <li>
                   3777:                 <p><a href=
                   3778:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
1.19    ! hubertf  3779:                    target="_top">tech-pkg</a> -- a general
        !          3780:                    discussion list for all things related to
        !          3781:                    pkgsrc</p>
1.18      xtraeme  3782:               </li>
                   3783:             </ul>
                   3784:           </div>
                   3785: 
                   3786:           <p>To subscribe, do:</p>
1.1       grant    3787:           <pre class="programlisting">
1.18      xtraeme  3788: <code class="prompt">%</code> echo subscribe <em class=
                   3789: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    3790: </pre>
                   3791: 
1.18      xtraeme  3792:           <p>Archives for all these mailing lists are available
                   3793:           from <a href="http://mail-index.NetBSD.org/" target=
                   3794:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    3795:         </div>
                   3796: 
                   3797:         <div class="sect1" lang="en" xml:lang="en">
                   3798:           <div class="titlepage">
                   3799:             <div>
                   3800:               <div>
                   3801:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  3802:                 "id2584610" id="id2584610"></a>6.2.&nbsp;Where's
1.1       grant    3803:                 the pkgviews documentation?</h2>
                   3804:               </div>
                   3805:             </div>
                   3806:           </div>
                   3807: 
                   3808:           <p>Pkgviews is tightly integrated with buildlink. You can
1.14      xtraeme  3809:           find a pkgviews User's guide in <code class=
                   3810:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    3811:         </div>
                   3812: 
                   3813:         <div class="sect1" lang="en" xml:lang="en">
                   3814:           <div class="titlepage">
                   3815:             <div>
                   3816:               <div>
                   3817:                 <h2 class="title" style="clear: both"><a name=
1.5       hubertf  3818:                 "faq-pkgtools" id=
                   3819:                 "faq-pkgtools"></a>6.3.&nbsp;Utilities for package
                   3820:                 management (pkgtools)</h2>
1.1       grant    3821:               </div>
                   3822:             </div>
                   3823:           </div>
                   3824: 
1.14      xtraeme  3825:           <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1       grant    3826:           directory pkgtools contains a number of useful utilities
                   3827:           for both users and developers of pkgsrc. This section
                   3828:           attempts only to make the reader aware of the utilities
                   3829:           and when they might be useful, and not to duplicate the
                   3830:           documentation that comes with each package.</p>
                   3831: 
                   3832:           <p>Utilities used by pkgsrc (automatically installed when
                   3833:           needed):</p>
                   3834: 
                   3835:           <div class="itemizedlist">
                   3836:             <ul type="disc">
                   3837:               <li>
                   3838:                 <p><a xmlns=
                   3839:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3840:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.19    ! hubertf  3841:                    class="pkgname">pkgtools/x11-links</a>: symlinks
        !          3842:                    for use by buildlink</p>
1.1       grant    3843:               </li>
                   3844:             </ul>
                   3845:           </div>
                   3846: 
                   3847:           <p>OS tool augmentation (automatically installed when
                   3848:           needed):</p>
                   3849: 
                   3850:           <div class="itemizedlist">
                   3851:             <ul type="disc">
                   3852:               <li>
                   3853:                 <p><a xmlns=
                   3854:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3855:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.19    ! hubertf  3856:                    class="pkgname">pkgtools/digest</a>: calculates
        !          3857:                    SHA1 checksums (and other kinds)</p>
1.1       grant    3858:               </li>
                   3859: 
                   3860:               <li>
                   3861:                 <p><a xmlns=
                   3862:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3863:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.19    ! hubertf  3864:                    class="pkgname">pkgtools/libnbcompat</a>: compat
        !          3865:                    library for pkg tools</p>
1.1       grant    3866:               </li>
                   3867: 
                   3868:               <li>
                   3869:                 <p><a xmlns=
                   3870:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3871:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.19    ! hubertf  3872:                    class="pkgname">pkgtools/mtree</a>: installed on
        !          3873:                    non-BSD systems due to lack of native mtree</p>
1.1       grant    3874:               </li>
                   3875: 
                   3876:               <li>
                   3877:                 <p><a xmlns=
                   3878:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3879:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.19    ! hubertf  3880:                    class="pkgname">pkgtools/pkg_install</a>:
        !          3881:                    up-to-date replacement for
        !          3882:                    /usr/sbin/pkg_install, or for use on operating
        !          3883:                    systems where pkg_install is not present</p>
1.1       grant    3884:               </li>
                   3885:             </ul>
                   3886:           </div>
                   3887: 
                   3888:           <p>Utilities used by pkgsrc (not automatically
                   3889:           installed):</p>
                   3890: 
                   3891:           <div class="itemizedlist">
                   3892:             <ul type="disc">
                   3893:               <li>
                   3894:                 <p><a xmlns=
                   3895:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3896:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.19    ! hubertf  3897:                    class="pkgname">pkgtools/pkg_tarup</a>: create a
        !          3898:                    binary package from an already-installed
        !          3899:                    package. used by 'make replace' to save the old
        !          3900:                    package</p>
1.1       grant    3901:               </li>
                   3902: 
                   3903:               <li>
                   3904:                 <p><a xmlns=
                   3905:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  3906:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.19    ! hubertf  3907:                    class="pkgname">pkgtools/dfdisk</a>: adds extra
        !          3908:                    functionality to pkgsrc, allowing it to fetch
        !          3909:                    distfiles from multiple locations. It currently
        !          3910:                    supports the following methods: multiple CD-ROMs
        !          3911:                    and network FTP/HTTP connections.</p>
1.5       hubertf  3912:               </li>
                   3913: 
                   3914:               <li>
                   3915:                 <p><a xmlns=
                   3916:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    3917:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.19    ! hubertf  3918:                    class="pkgname">pkgtools/xpkgwedge</a>: put X11
        !          3919:                    packages someplace else (enabled by default)</p>
1.1       grant    3920:               </li>
1.5       hubertf  3921: 
                   3922:               <li>
                   3923:                 <p><a xmlns=
                   3924:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3925:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.19    ! hubertf  3926:                    class="pkgname">devel/cpuflags</a>: will
        !          3927:                    determine the best compiler flags to optimise
        !          3928:                    code for your current CPU and compiler.</p>
1.5       hubertf  3929:               </li>
1.1       grant    3930:             </ul>
                   3931:           </div>
                   3932: 
                   3933:           <p>Utilities for keeping track of installed packages,
                   3934:           being up to date, etc:</p>
                   3935: 
                   3936:           <div class="itemizedlist">
                   3937:             <ul type="disc">
                   3938:               <li>
                   3939:                 <p><a xmlns=
                   3940:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3941:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.19    ! hubertf  3942:                    class="pkgname">pkgtools/pkg_chk</a>: installs
        !          3943:                    pkg_chk, which reports on packages whose
        !          3944:                    installed versions do not match the latest
        !          3945:                    pkgsrc entries</p>
1.1       grant    3946:               </li>
                   3947: 
                   3948:               <li>
                   3949:                 <p><a xmlns=
                   3950:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3951:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.19    ! hubertf  3952:                    class="pkgname">pkgtools/pkgdep</a>: makes
        !          3953:                    dependency graphs of packages, to aid in
        !          3954:                    choosing a strategy for updating</p>
1.1       grant    3955:               </li>
                   3956: 
                   3957:               <li>
                   3958:                 <p><a xmlns=
                   3959:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3960:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.19    ! hubertf  3961:                    class="pkgname">pkgtools/pkgdepgraph</a>: make
        !          3962:                    graph from above (uses graphviz)</p>
1.1       grant    3963:               </li>
                   3964: 
                   3965:               <li>
                   3966:                 <p><a xmlns=
                   3967:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3968:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.19    ! hubertf  3969:                    class="pkgname">pkgtools/pkglint</a>: This
        !          3970:                    provides two distinct abilities: check a pkgsrc
        !          3971:                    entry for correctness (pkglint) check for and
        !          3972:                    remove out-of-date distfiles and binary packages
        !          3973:                    (lintpkgsrc)</p>
1.1       grant    3974:               </li>
                   3975: 
                   3976:               <li>
                   3977:                 <p><a xmlns=
                   3978:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3979:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.19    ! hubertf  3980:                    class="pkgname">pkgtools/pkgsurvey</a>: report
        !          3981:                    what packages you have installed</p>
1.1       grant    3982:               </li>
                   3983:             </ul>
                   3984:           </div>
                   3985: 
                   3986:           <p>Utilities for people maintaining or creating
                   3987:           individual packages:</p>
                   3988: 
                   3989:           <div class="itemizedlist">
                   3990:             <ul type="disc">
                   3991:               <li>
                   3992:                 <p><a xmlns=
                   3993:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3994:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.19    ! hubertf  3995:                    class="pkgname">pkgtools/pkgdiff</a>: automate
        !          3996:                    making and maintaining patches for a package
        !          3997:                    (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1       grant    3998:               </li>
                   3999: 
                   4000:               <li>
                   4001:                 <p><a xmlns=
                   4002:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4003:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.19    ! hubertf  4004:                    class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
        !          4005:                    "http://www.w3.org/TR/xhtml1/transitional" href=
        !          4006:                    "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
        !          4007:                    class="pkgname">pkgtools/url2pkg</a>: aids in
        !          4008:                    converting to pkgsrc</p>
1.1       grant    4009:               </li>
                   4010: 
                   4011:               <li>
                   4012:                 <p><a xmlns=
                   4013:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4014:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.19    ! hubertf  4015:                    class="pkgname">pkgtools/gensolpkg</a>: convert
        !          4016:                    pkgsrc to a Solaris package</p>
1.1       grant    4017:               </li>
                   4018:             </ul>
                   4019:           </div>
                   4020: 
                   4021:           <p>Utilities for people maintaining pkgsrc (or more
                   4022:           obscure pkg utilities)</p>
                   4023: 
                   4024:           <div class="itemizedlist">
                   4025:             <ul type="disc">
                   4026:               <li>
                   4027:                 <p><a xmlns=
                   4028:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4029:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.19    ! hubertf  4030:                    class="pkgname">pkgtools/pkgconflict</a>: find
        !          4031:                    packages that conflict but aren't marked as
        !          4032:                    such</p>
1.1       grant    4033:               </li>
                   4034: 
                   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/pkg_comp/README.html"
1.19    ! hubertf  4039:                    class="pkgname">pkgtools/pkg_comp</a>: build
        !          4040:                    packages in a chrooted area</p>
1.1       grant    4041:               </li>
                   4042: 
                   4043:               <li>
                   4044:                 <p><a xmlns=
                   4045:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4046:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.19    ! hubertf  4047:                    class="pkgname">pkgtools/libkver</a>: spoof
        !          4048:                    kernel version for chrooted cross builds</p>
1.1       grant    4049:               </li>
                   4050:             </ul>
                   4051:           </div>
                   4052:         </div>
                   4053: 
                   4054:         <div class="sect1" lang="en" xml:lang="en">
                   4055:           <div class="titlepage">
                   4056:             <div>
                   4057:               <div>
                   4058:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  4059:                 "id2584794" id="id2584794"></a>6.4.&nbsp;How to use
1.1       grant    4060:                 pkgsrc as non-root</h2>
                   4061:               </div>
                   4062:             </div>
                   4063:           </div>
                   4064: 
                   4065:           <p>If you want to use pkgsrc as non-root user, you can
                   4066:           set some variables to make pkgsrc work under these
                   4067:           conditions. Please see <a href=
                   4068:           "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.19    ! hubertf  4069:              target="_top">this message</a> for more details.</p>
1.14      xtraeme  4070:         </div>
                   4071: 
                   4072:         <div class="sect1" lang="en" xml:lang="en">
                   4073:           <div class="titlepage">
                   4074:             <div>
                   4075:               <div>
                   4076:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  4077:                 "id2584806" id="id2584806"></a>6.5.&nbsp;How to
1.15      xtraeme  4078:                 resume transfers when fetching distfiles?</h2>
1.14      xtraeme  4079:               </div>
                   4080:             </div>
                   4081:           </div>
                   4082: 
1.15      xtraeme  4083:           <p>By default resuming transfers in pkgsrc is disabled,
                   4084:           but you can enable this feature by adding the option
                   4085:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
                   4086:           into <code class="filename">/etc/mk.conf</code>. If,
                   4087:           during a fetch step, an incomplete distfile is found,
                   4088:           pkgsrc will try to resume it.</p>
                   4089: 
                   4090:           <p>You can also use a different program than the default
                   4091:           ftp(1) by changing the <code class=
                   4092:           "varname">FETCH_CMD</code> variable. Don't forget to set
                   4093:           <code class="varname">FETCH_RESUME_ARGS</code> and
                   4094:           <code class="varname">FETCH_OUTPUT_ARGS</code> if you are
                   4095:           not using default values.</p>
1.14      xtraeme  4096: 
                   4097:           <p>For example, if you want to use <code class=
                   4098:           "filename">wget</code> to resume downloads, you'll have
                   4099:           to use something like:</p>
                   4100:           <pre class="programlisting">
                   4101:         FETCH_CMD=wget
                   4102:         .if defined(FETCH_CMD) &amp;&amp; ${FETCH_CMD} == "wget"
                   4103:         FETCH_BEFORE_ARGS=--passive-ftp
                   4104:         FETCH_RESUME_ARGS=-c
                   4105:         FETCH_OUTPUT_ARGS=-O
                   4106:         .endif
                   4107:     
                   4108: </pre>
1.1       grant    4109:         </div>
                   4110: 
                   4111:         <div class="sect1" lang="en" xml:lang="en">
                   4112:           <div class="titlepage">
                   4113:             <div>
                   4114:               <div>
                   4115:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  4116:                 "id2584849" id="id2584849"></a>6.6.&nbsp;How can I
1.1       grant    4117:                 install/use XFree86 from pkgsrc?</h2>
                   4118:               </div>
                   4119:             </div>
                   4120:           </div>
                   4121: 
                   4122:           <p>If you want to use XFree86 from pkgsrc instead of your
1.14      xtraeme  4123:           system's own X11 (<code class=
                   4124:           "filename">/usr/X11R6</code>, <code class=
                   4125:           "filename">/usr/openwin</code>, ...), you will have to
                   4126:           add the following line into <code class=
1.15      xtraeme  4127:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4128:           <pre class="programlisting">
                   4129:       X11_TYPE=XFree86
                   4130:     
                   4131: </pre>
                   4132:         </div>
                   4133: 
                   4134:         <div class="sect1" lang="en" xml:lang="en">
                   4135:           <div class="titlepage">
                   4136:             <div>
                   4137:               <div>
                   4138:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  4139:                 "id2584876" id="id2584876"></a>6.7.&nbsp;How can I
1.1       grant    4140:                 install/use X.org from pkgsrc?</h2>
                   4141:               </div>
                   4142:             </div>
                   4143:           </div>
                   4144: 
                   4145:           <p>If you want to use X.org from pkgsrc instead of your
1.14      xtraeme  4146:           system's own X11 (<code class=
                   4147:           "filename">/usr/X11R6</code>, <code class=
                   4148:           "filename">/usr/openwin</code>, ...) you will have to add
                   4149:           the following line into <code class=
1.15      xtraeme  4150:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4151:           <pre class="programlisting">
                   4152:       X11_TYPE=xorg
                   4153:     
                   4154: </pre>
                   4155:         </div>
                   4156: 
                   4157:         <div class="sect1" lang="en" xml:lang="en">
                   4158:           <div class="titlepage">
                   4159:             <div>
                   4160:               <div>
                   4161:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  4162:                 "id2584904" id="id2584904"></a>6.8.&nbsp;How to
1.1       grant    4163:                 fetch files from behind a firewall</h2>
                   4164:               </div>
                   4165:             </div>
                   4166:           </div>
                   4167: 
                   4168:           <p>If you are sitting behind a firewall which does not
                   4169:           allow direct connections to Internet hosts (i.e.
                   4170:           non-NAT), you may specify the relevant proxy hosts. This
                   4171:           is done using an environment variable in the form of a
                   4172:           URL e.g. in Amdahl, the machine &#8220;<span class=
                   4173:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   4174:           firewalls, and it uses port 80 as the proxy port number.
                   4175:           So the proxy environment variables are:</p>
                   4176:           <pre class="programlisting">
                   4177:   ftp_proxy=ftp://orpheus.amdahl.com:80/
                   4178: http_proxy=http://orpheus.amdahl.com:80/
                   4179: </pre>
                   4180:         </div>
                   4181: 
                   4182:         <div class="sect1" lang="en" xml:lang="en">
                   4183:           <div class="titlepage">
                   4184:             <div>
                   4185:               <div>
                   4186:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  4187:                 "id2584918" id="id2584918"></a>6.9.&nbsp;How do I
1.14      xtraeme  4188:                 tell <span><strong class="command">make
                   4189:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    4190:               </div>
                   4191:             </div>
                   4192:           </div>
                   4193: 
                   4194:           <p>This depends on which utility is used to retrieve
1.14      xtraeme  4195:           distfiles. From <code class="filename">bsd.pkg.mk</code>,
                   4196:           <code class="varname">FETCH_CMD</code> is assigned the
                   4197:           first available command from the following list:</p>
1.1       grant    4198:           <pre class="programlisting">
                   4199: ${LOCALBASE}/bin/ftp
                   4200: /usr/bin/ftp
                   4201: </pre>
                   4202: 
                   4203:           <p>On a default NetBSD installation, this will be
1.14      xtraeme  4204:           <code class="filename">/usr/bin/ftp</code>, which
1.1       grant    4205:           automatically tries passive connections first, and falls
                   4206:           back to active connections if the server refuses to do
                   4207:           passive. For the other tools, add the following to your
1.14      xtraeme  4208:           <code class="filename">/etc/mk.conf</code> file:
                   4209:           <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    4210: 
1.14      xtraeme  4211:           <p>Having that option present will prevent <code class=
                   4212:           "filename">/usr/bin/ftp</code> from falling back to
                   4213:           active transfers.</p>
1.1       grant    4214:         </div>
                   4215: 
                   4216:         <div class="sect1" lang="en" xml:lang="en">
                   4217:           <div class="titlepage">
                   4218:             <div>
                   4219:               <div>
                   4220:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  4221:                 "id2584969" id="id2584969"></a>6.10.&nbsp;How to
1.1       grant    4222:                 fetch all distfiles at once</h2>
                   4223:               </div>
                   4224:             </div>
                   4225:           </div>
                   4226: 
                   4227:           <p>You would like to download all the distfiles in a
                   4228:           single batch from work or university, where you can't run
1.14      xtraeme  4229:           a <span><strong class="command">make
                   4230:           fetch</strong></span>. There is an archive of distfiles
                   4231:           on <a href=
1.1       grant    4232:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   4233:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   4234:           entire directory may not be appropriate.</p>
                   4235: 
1.14      xtraeme  4236:           <p>The answer here is to do a <span><strong class=
                   4237:           "command">make fetch-list</strong></span> in <code class=
                   4238:           "filename">/usr/pkgsrc</code> or one of it's
1.1       grant    4239:           subdirectories, carry the resulting list to your machine
                   4240:           at work/school and use it there If you don't have a
                   4241:           NetBSD-compatible ftp(1) (like lukemftp) at work, don't
1.14      xtraeme  4242:           forget to set <code class="varname">FETCH_CMD</code> to
1.1       grant    4243:           something that fetches a URL:</p>
                   4244: 
                   4245:           <p>At home:</p>
                   4246:           <pre class="screen">
1.14      xtraeme  4247: <code class="prompt">%</code> <strong class=
                   4248: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4249: <code class="prompt">%</code> <strong class=
                   4250: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   4251: <code class="prompt">%</code> <strong class=
                   4252: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    4253: </pre>
                   4254: 
                   4255:           <p>At work:</p>
                   4256:           <pre class="screen">
1.14      xtraeme  4257: <code class="prompt">%</code> <strong class=
                   4258: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    4259: </pre>
                   4260: 
1.14      xtraeme  4261:           <p>then tar up <code class=
                   4262:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    4263: 
                   4264:           <p>If you have a machine running NetBSD, and you want to
                   4265:           get <span class="emphasis"><em>all</em></span> distfiles
                   4266:           (even ones that aren't for your machine architecture),
                   4267:           you can do so by using the above-mentioned
1.14      xtraeme  4268:           <span><strong class="command">make
                   4269:           fetch-list</strong></span> approach, or fetch the
                   4270:           distfiles directly by running:</p>
1.1       grant    4271:           <pre class="screen">
1.14      xtraeme  4272: <code class="prompt">%</code> <strong class=
                   4273: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    4274: </pre>
                   4275: 
1.14      xtraeme  4276:           <p>If you even decide to ignore <code class=
                   4277:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   4278:           can get everything by running:</p>
1.1       grant    4279:           <pre class="screen">
1.14      xtraeme  4280: <code class="prompt">%</code> <strong class=
                   4281: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    4282: </pre>
                   4283:         </div>
                   4284: 
                   4285:         <div class="sect1" lang="en" xml:lang="en">
                   4286:           <div class="titlepage">
                   4287:             <div>
                   4288:               <div>
                   4289:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  4290:                 "id2585177" id="id2585177"></a>6.11.&nbsp;What does
1.1       grant    4291:                 &#8220;<span class="quote">Don't know how to make
                   4292:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   4293:               </div>
                   4294:             </div>
                   4295:           </div>
                   4296: 
                   4297:           <p>When compiling the <a xmlns=
                   4298:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4299:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.19    ! hubertf  4300:              class="pkgname">pkgtools/pkg_install</a> package, you
        !          4301:              get the error from make that it doesn't know how to
        !          4302:              make <code class=
        !          4303:              "filename">/usr/share/tmac/tmac.andoc</code>? This
        !          4304:              indicates that you don't have installed the
        !          4305:              &#8220;<span class="quote">text</span>&#8221; set on
        !          4306:              your machine (nroff, ...). It is recommended to do
        !          4307:              that to format manpages.</p>
1.1       grant    4308: 
                   4309:           <p>In the case of the <a xmlns=
                   4310:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4311:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.19    ! hubertf  4312:              class="pkgname">pkgtools/pkg_install</a> package, you
        !          4313:              can get away with setting <code class=
        !          4314:              "varname">NOMAN=YES</code> either in the environment
        !          4315:              or in <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    4316:         </div>
                   4317: 
                   4318:         <div class="sect1" lang="en" xml:lang="en">
                   4319:           <div class="titlepage">
                   4320:             <div>
                   4321:               <div>
                   4322:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  4323:                 "id2585216" id="id2585216"></a>6.12.&nbsp;What does
1.1       grant    4324:                 &#8220;<span class="quote">Could not find
                   4325:                 bsd.own.mk</span>&#8221; mean?</h2>
                   4326:               </div>
                   4327:             </div>
                   4328:           </div>
                   4329: 
1.14      xtraeme  4330:           <p>You didn't install the compiler set, <code class=
                   4331:           "filename">comp.tgz</code>, when you installed your
                   4332:           NetBSD machine. Please get it and install it, by
                   4333:           extracting it in <code class="filename">/</code>:</p>
1.1       grant    4334:           <pre class="screen">
1.14      xtraeme  4335: <code class="prompt">#</code> <strong class=
                   4336: "userinput"><code>cd /</code></strong>
                   4337: <code class="prompt">#</code> <strong class=
                   4338: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    4339: </pre>
                   4340: 
1.14      xtraeme  4341:           <p><code class="filename">comp.tgz</code> is part of
                   4342:           every NetBSD release. Get the one that corresponds to
                   4343:           your release (determine via <span><strong class=
                   4344:           "command">uname -r</strong></span>).</p>
1.1       grant    4345:         </div>
                   4346: 
                   4347:         <div class="sect1" lang="en" xml:lang="en">
                   4348:           <div class="titlepage">
                   4349:             <div>
                   4350:               <div>
                   4351:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  4352:                 "id2585273" id="id2585273"></a>6.13.&nbsp;Using
1.1       grant    4353:                 'sudo' with pkgsrc</h2>
                   4354:               </div>
                   4355:             </div>
                   4356:           </div>
                   4357: 
                   4358:           <p>When installing packages as non-root user and using
                   4359:           the just-in-time su(1) feature of pkgsrc, it can become
                   4360:           annoying to type in the root password for each required
                   4361:           package installed. To avoid this, the sudo package can be
                   4362:           used, which does password caching over a limited time. To
                   4363:           use it, install sudo (either as binary package or from
                   4364:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   4365:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.19    ! hubertf  4366:              class="pkgname">security/sudo</a>) and then put the
        !          4367:              following into your <code class=
        !          4368:              "filename">/etc/mk.conf</code>:</p>
1.1       grant    4369:           <pre class="programlisting">
                   4370:         .if exists(/usr/pkg/bin/sudo)
                   4371:         SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
                   4372:         .endif
                   4373:     
                   4374: </pre>
                   4375:         </div>
                   4376: 
                   4377:         <div class="sect1" lang="en" xml:lang="en">
                   4378:           <div class="titlepage">
                   4379:             <div>
                   4380:               <div>
                   4381:                 <h2 class="title" style="clear: both"><a name=
                   4382:                 "faq.conf" id=
1.14      xtraeme  4383:                 "faq.conf"></a>6.14.&nbsp;Configuration files
1.1       grant    4384:                 handling and placement</h2>
                   4385:               </div>
                   4386:             </div>
                   4387:           </div>
                   4388: 
1.14      xtraeme  4389:           <p>The global variable <code class=
                   4390:           "varname">PKG_SYSCONFBASE</code> (and some others) can be
                   4391:           set by the system administrator in <code class=
                   4392:           "filename">/etc/mk.conf</code> to define the place where
1.1       grant    4393:           configuration files get installed. Therefore, packages
                   4394:           must be adapted to support this feature. Keep in mind
                   4395:           that you should only install files that are strictly
                   4396:           necessary in the configuration directory, files that can
1.14      xtraeme  4397:           go to <code class="filename">$PREFIX/share</code> should
                   4398:           go there.</p>
1.1       grant    4399: 
                   4400:           <p>We will take a look at available variables first
1.14      xtraeme  4401:           (<code class="filename">bsd.pkg.mk</code> contains more
                   4402:           information). <code class="varname">PKG_SYSCONFDIR</code>
                   4403:           is where the configuration files for a package may be
                   4404:           found (that is, the full path, e.g. <code class=
                   4405:           "filename">/etc</code> or <code class=
                   4406:           "filename">/usr/pkg/etc</code>). This value may be
1.1       grant    4407:           customized in various ways:</p>
                   4408: 
                   4409:           <div class="orderedlist">
                   4410:             <ol type="1">
                   4411:               <li>
1.14      xtraeme  4412:                 <p><code class="varname">PKG_SYSCONFBASE</code> is
                   4413:                 the main config directory under which all package
1.1       grant    4414:                 configuration files are to be found. Users will
1.14      xtraeme  4415:                 typically want to set it to <code class=
                   4416:                 "filename">/etc</code>, or accept the default
                   4417:                 location of <code class=
                   4418:                 "filename">$PREFIX/etc</code>.</p>
1.1       grant    4419:               </li>
                   4420: 
                   4421:               <li>
1.14      xtraeme  4422:                 <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   4423:                 is the subdirectory of <code class=
                   4424:                 "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    4425:                 configuration files for a particular package may be
1.14      xtraeme  4426:                 found. Defaults to <code class=
                   4427:                 "varname">${SYSCONFBASE}</code>.</p>
1.1       grant    4428:               </li>
                   4429: 
                   4430:               <li>
1.14      xtraeme  4431:                 <p><code class="varname">PKG_SYSCONFVAR</code> is
                   4432:                 the special suffix used to distinguish any
                   4433:                 overriding values for a particular package (see
                   4434:                 next item). It defaults to <code class=
                   4435:                 "varname">${PKGBASE}</code>, but for a collection
                   4436:                 of related packages that should all have the same
                   4437:                 <code class="varname">PKG_SYSCONFDIR</code> value,
                   4438:                 it can be set in each of the package Makefiles to a
                   4439:                 common value.</p>
1.1       grant    4440:               </li>
                   4441: 
                   4442:               <li>
1.14      xtraeme  4443:                 <p><code class=
                   4444:                 "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   4445:                 overrides the value of <code class=
                   4446:                 "varname">${PKG_SYSCONFDIR}</code> for packages
                   4447:                 with the same value for <code class=
                   4448:                 "varname">PKG_SYSCONFVAR</code>.</p>
1.1       grant    4449: 
                   4450:                 <p>As an example, all the various KDE packages may
1.14      xtraeme  4451:                 want to set <code class=
                   4452:                 "varname">PKG_SYSCONFVAR</code> to
                   4453:                 &#8220;<span class="quote">kde</span>&#8221; so
                   4454:                 admins can set <code class=
                   4455:                 "varname">PKG_SYSCONFDIR.kde</code> in <code class=
                   4456:                 "filename">/etc/mk.conf</code> to define where to
1.1       grant    4457:                 install KDE config files.</p>
                   4458:               </li>
                   4459:             </ol>
                   4460:           </div>
                   4461: 
                   4462:           <p>Programs' configuration directory should be defined
                   4463:           during the configure stage. Packages that use GNU
                   4464:           autoconf can usually do this by using the
                   4465:           &#8220;<span class="quote">--sysconfdir</span>&#8221;
                   4466:           parameter, but this brings some problems as we will see
                   4467:           now. When you change this pathname in packages, you
                   4468:           should not allow them to install files in that directory
                   4469:           directly. Instead they need to install those files under
1.14      xtraeme  4470:           <code class="filename">share/examples/${PKGNAME}</code>
                   4471:           so <code class="filename">PLIST</code> can register
                   4472:           them.</p>
1.1       grant    4473: 
                   4474:           <p>Once you have the required configuration files in
1.14      xtraeme  4475:           place (under the <code class=
                   4476:           "filename">share/examples</code> directory) the variable
                   4477:           <code class="varname">CONF_FILES</code> should be set to
                   4478:           copy them into <code class=
                   4479:           "varname">PKG_SYSCONFDIR</code>. The contents of this
                   4480:           variable is formed by pairs of filenames; the first
1.1       grant    4481:           element of the pair specifies the file inside the
1.14      xtraeme  4482:           examples directory (registered by <code class=
                   4483:           "filename">PLIST</code>) and the second element specifies
1.1       grant    4484:           the target file. This is done this way to allow binary
                   4485:           packages to place files in the right directory using
1.14      xtraeme  4486:           <code class="filename">INSTALL</code>/<code class=
                   4487:           "filename">DEINSTALL</code> scripts which are created
                   4488:           automatically. The package <code class=
                   4489:           "filename">Makefile</code> must also set <code class=
                   4490:           "varname">USE_PKGINSTALL=YES</code> to use these
1.1       grant    4491:           automatically generated scripts. The automatic copying of
                   4492:           config files can be toggled by setting the environment
1.14      xtraeme  4493:           variable <code class="varname">PKG_CONFIG</code> prior to
1.1       grant    4494:           package installation.</p>
                   4495: 
                   4496:           <p>Here is an example, taken from mail/mutt/Makefile:</p>
                   4497:           <pre class="programlisting">
                   4498:   EGDIR=            ${PREFIX}/share/doc/mutt/samples
                   4499: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   4500: </pre>
                   4501: 
                   4502:           <p>As you can see, this package installs configuration
1.14      xtraeme  4503:           files inside <code class="varname">EGDIR</code>, which
                   4504:           are registered by <code class="filename">PLIST</code>.
                   4505:           After that, the variable <code class=
                   4506:           "varname">CONF_FILES</code> lists the installed file
                   4507:           first and then the target file. Users will also get an
                   4508:           automatic message when files are installed using this
                   4509:           method.</p>
1.1       grant    4510:         </div>
                   4511: 
                   4512:         <div class="sect1" lang="en" xml:lang="en">
                   4513:           <div class="titlepage">
                   4514:             <div>
                   4515:               <div>
                   4516:                 <h2 class="title" style="clear: both"><a name=
                   4517:                 "audit-packages" id=
1.14      xtraeme  4518:                 "audit-packages"></a>6.15.&nbsp;Automated security
1.1       grant    4519:                 checks</h2>
                   4520:               </div>
                   4521:             </div>
                   4522:           </div>
                   4523: 
                   4524:           <p>Please be aware that there can often be bugs in
                   4525:           third-party software, and some of these bugs can leave a
                   4526:           machine vulnerable to exploitation by attackers. In an
                   4527:           effort to lessen the exposure, the NetBSD packages team
                   4528:           maintains a database of known-exploits to packages which
                   4529:           have at one time been included in pkgsrc. The database
                   4530:           can be downloaded automatically, and a security audit of
                   4531:           all packages installed on a system can take place. To do
                   4532:           this, install the <a xmlns=
                   4533:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4534:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.19    ! hubertf  4535:              class="pkgname">security/audit-packages</a> package.
        !          4536:              It has two components:</p>
1.1       grant    4537: 
                   4538:           <div class="orderedlist">
                   4539:             <ol type="1">
                   4540:               <li>
                   4541:                 <p>&#8220;<span class=
                   4542:                 "quote">download-vulnerability-list</span>&#8221;,
                   4543:                 an easy way to download a list of the security
                   4544:                 vulnerabilities information. This list is kept up
                   4545:                 to date by the NetBSD security officer and the
                   4546:                 NetBSD packages team, and is distributed from the
                   4547:                 NetBSD ftp server:</p>
                   4548: 
                   4549:                 <p><a href=
                   4550:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.19    ! hubertf  4551:                    target=
        !          4552:                    "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    4553:               </li>
                   4554: 
                   4555:               <li>
                   4556:                 <p>&#8220;<span class=
                   4557:                 "quote">audit-packages</span>&#8221;, an easy way
                   4558:                 to audit the current machine, checking each
                   4559:                 vulnerability which is known. If a vulnerable
                   4560:                 package is installed, it will be shown by output to
                   4561:                 stdout, including a description of the type of
                   4562:                 vulnerability, and a URL containing more
                   4563:                 information.</p>
                   4564:               </li>
                   4565:             </ol>
                   4566:           </div>
                   4567: 
                   4568:           <p>Use of the audit-packages package is strongly
                   4569:           recommended!</p>
                   4570: 
                   4571:           <p>The following message is displayed as part of the
                   4572:           audit-packages installation procedure:</p>
                   4573:           <pre class="screen">
                   4574: ===========================================================================
1.18      xtraeme  4575: $NetBSD: faq.xml,v 1.5 2005/02/24 14:24:32 jschauma Exp $
1.1       grant    4576: 
                   4577: You may wish to have the vulnerabilities file downloaded daily so that
                   4578: it remains current.  This may be done by adding an appropriate entry
                   4579: to the root users crontab(5) entry.  For example the entry
                   4580: 
                   4581: # download vulnerabilities file
                   4582: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list &gt;/dev/null 2&gt;&amp;1
                   4583: 
                   4584: will update the vulnerability list every day at 3AM. You may wish to do
                   4585: this more often than once a day.
                   4586: 
                   4587: In addition, you may wish to run the package audit from the daily
                   4588: security script.  This may be accomplished by adding the following
                   4589: lines to /etc/security.local
                   4590: 
                   4591: if [ -x ${PREFIX}/sbin/audit-packages ]; then
                   4592:           ${PREFIX}/sbin/audit-packages
                   4593: fi
                   4594: 
                   4595: ===========================================================================
                   4596:     
                   4597: </pre>
                   4598:         </div>
                   4599:       </div>
                   4600:     </div>
                   4601: 
                   4602:     <div class="part" lang="en" xml:lang="en">
                   4603:       <div class="titlepage">
                   4604:         <div>
                   4605:           <div>
                   4606:             <h1 class="title"><a name="developers-guide" id=
1.2       hubertf  4607:             "developers-guide"></a>The pkgsrc developer's
                   4608:             guide</h1>
1.1       grant    4609:           </div>
                   4610:         </div>
                   4611:       </div>
                   4612: 
                   4613:       <div class="toc">
                   4614:         <p><b>Table of Contents</b></p>
                   4615: 
                   4616:         <dl>
                   4617:           <dt><span class="chapter"><a href="#components">7.
                   4618:           Package components - files, directories and
                   4619:           contents</a></span></dt>
                   4620: 
                   4621:           <dd>
                   4622:             <dl>
                   4623:               <dt><span class="sect1"><a href=
1.14      xtraeme  4624:               "#components.Makefile">7.1. <code class=
                   4625:               "filename">Makefile</code></a></span></dt>
1.1       grant    4626: 
                   4627:               <dt><span class="sect1"><a href=
1.14      xtraeme  4628:               "#components.distinfo">7.2. <code class=
                   4629:               "filename">distinfo</code></a></span></dt>
1.1       grant    4630: 
                   4631:               <dt><span class="sect1"><a href=
                   4632:               "#components.patches">7.3. patches/*</a></span></dt>
                   4633: 
1.19    ! hubertf  4634:               <dt><span class="sect1"><a href="#id2586455">7.4.
1.1       grant    4635:               Other mandatory files</a></span></dt>
                   4636: 
                   4637:               <dt><span class="sect1"><a href=
                   4638:               "#components.optional">7.5. Optional
                   4639:               files</a></span></dt>
                   4640: 
1.19    ! hubertf  4641:               <dt><span class="sect1"><a href="#id2586649">7.6.
1.14      xtraeme  4642:               <code class="filename">work*</code></a></span></dt>
1.1       grant    4643: 
1.19    ! hubertf  4644:               <dt><span class="sect1"><a href="#id2586737">7.7.
1.14      xtraeme  4645:               <code class="filename">files/*</code></a></span></dt>
1.1       grant    4646:             </dl>
                   4647:           </dd>
                   4648: 
                   4649:           <dt><span class="chapter"><a href="#plist">8. PLIST
                   4650:           issues</a></span></dt>
                   4651: 
                   4652:           <dd>
                   4653:             <dl>
1.19    ! hubertf  4654:               <dt><span class="sect1"><a href="#id2586791">8.1. RCS
1.1       grant    4655:               ID</a></span></dt>
                   4656: 
1.19    ! hubertf  4657:               <dt><span class="sect1"><a href="#id2586806">8.2.
1.14      xtraeme  4658:               Semi-automatic <code class="filename">PLIST</code>
                   4659:               generation</a></span></dt>
1.1       grant    4660: 
                   4661:               <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme  4662:               Tweaking output of <span><strong class="command">make
                   4663:               print-PLIST</strong></span></a></span></dt>
1.1       grant    4664: 
                   4665:               <dt><span class="sect1"><a href="#plist.misc">8.4.
                   4666:               Variable substitution in PLIST</a></span></dt>
                   4667: 
1.19    ! hubertf  4668:               <dt><span class="sect1"><a href="#id2587127">8.5.
1.1       grant    4669:               Manpage-compression</a></span></dt>
                   4670: 
1.19    ! hubertf  4671:               <dt><span class="sect1"><a href="#id2587169">8.6.
1.14      xtraeme  4672:               Changing PLIST source with <code class=
                   4673:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    4674: 
1.19    ! hubertf  4675:               <dt><span class="sect1"><a href="#id2587322">8.7.
1.1       grant    4676:               Platform specific and differing
                   4677:               PLISTs</a></span></dt>
                   4678: 
                   4679:               <dt><span class="sect1"><a href=
                   4680:               "#faq.common-dirs">8.8. Sharing directories between
                   4681:               packages</a></span></dt>
                   4682:             </dl>
                   4683:           </dd>
                   4684: 
                   4685:           <dt><span class="chapter"><a href="#buildlink">9.
                   4686:           Buildlink methodology</a></span></dt>
                   4687: 
                   4688:           <dd>
                   4689:             <dl>
1.19    ! hubertf  4690:               <dt><span class="sect1"><a href="#id2587526">9.1.
1.1       grant    4691:               Converting packages to use buildlink3</a></span></dt>
                   4692: 
1.19    ! hubertf  4693:               <dt><span class="sect1"><a href="#id2587785">9.2.
1.14      xtraeme  4694:               Writing <code class="filename">buildlink3.mk</code>
                   4695:               files</a></span></dt>
1.1       grant    4696: 
                   4697:               <dd>
                   4698:                 <dl>
                   4699:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4700:                   "#id2587854">9.2.1. Anatomy of a buildlink3.mk
1.1       grant    4701:                   file</a></span></dt>
                   4702: 
                   4703:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4704:                   "#id2588295">9.2.2. Updating <code class=
1.14      xtraeme  4705:                   "varname">BUILDLINK_DEPENDS.<em class=
                   4706:                   "replaceable"><code>pkg</code></em></code> in
                   4707:                   <code class="filename">buildlink3.mk</code>
1.1       grant    4708:                   files</a></span></dt>
                   4709:                 </dl>
                   4710:               </dd>
                   4711: 
1.19    ! hubertf  4712:               <dt><span class="sect1"><a href="#id2588442">9.3.
1.14      xtraeme  4713:               Writing <code class="filename">builtin.mk</code>
                   4714:               files</a></span></dt>
1.1       grant    4715: 
                   4716:               <dd>
                   4717:                 <dl>
                   4718:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4719:                   "#id2588523">9.3.1. Anatomy of a <code class=
1.14      xtraeme  4720:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    4721: 
                   4722:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4723:                   "#id2588819">9.3.2. Global preferences for native
1.1       grant    4724:                   or pkgsrc software</a></span></dt>
                   4725:                 </dl>
                   4726:               </dd>
                   4727:             </dl>
                   4728:           </dd>
                   4729: 
                   4730:           <dt><span class="chapter"><a href="#options">10. Options
                   4731:           handling</a></span></dt>
                   4732: 
                   4733:           <dd>
                   4734:             <dl>
1.19    ! hubertf  4735:               <dt><span class="sect1"><a href="#id2588960">10.1.
1.1       grant    4736:               Global default options</a></span></dt>
                   4737: 
1.19    ! hubertf  4738:               <dt><span class="sect1"><a href="#id2588974">10.2.
1.14      xtraeme  4739:               Converting packages to use <code class=
                   4740:               "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    4741:             </dl>
                   4742:           </dd>
                   4743: 
                   4744:           <dt><span class="chapter"><a href="#build">11. The build
                   4745:           process</a></span></dt>
                   4746: 
                   4747:           <dd>
                   4748:             <dl>
                   4749:               <dt><span class="sect1"><a href="#build.prefix">11.1.
                   4750:               Program location</a></span></dt>
                   4751: 
1.19    ! hubertf  4752:               <dt><span class="sect1"><a href="#id2589582">11.2.
1.1       grant    4753:               Main targets</a></span></dt>
                   4754: 
                   4755:               <dt><span class="sect1"><a href=
                   4756:               "#build.helpful-targets">11.3. Other helpful
                   4757:               targets</a></span></dt>
                   4758:             </dl>
                   4759:           </dd>
                   4760: 
                   4761:           <dt><span class="chapter"><a href="#fixes">12. Notes on
                   4762:           fixes for packages</a></span></dt>
                   4763: 
                   4764:           <dd>
                   4765:             <dl>
1.19    ! hubertf  4766:               <dt><span class="sect1"><a href="#id2590983">12.1.
1.1       grant    4767:               General operation</a></span></dt>
                   4768: 
                   4769:               <dd>
                   4770:                 <dl>
                   4771:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4772:                   "#id2590986">12.1.1. How to pull in variables
1.1       grant    4773:                   from /etc/mk.conf</a></span></dt>
                   4774: 
                   4775:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4776:                   "#id2591138">12.1.2. Restricted
1.1       grant    4777:                   packages</a></span></dt>
                   4778: 
                   4779:                   <dt><span class="sect2"><a href=
                   4780:                   "#dependencies">12.1.3. Handling
                   4781:                   dependencies</a></span></dt>
                   4782: 
                   4783:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4784:                   "#id2591585">12.1.4. Handling conflicts with
1.1       grant    4785:                   other packages</a></span></dt>
                   4786: 
                   4787:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4788:                   "#id2591703">12.1.5. Packages that cannot or
1.1       grant    4789:                   should not be built</a></span></dt>
                   4790: 
                   4791:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4792:                   "#id2591729">12.1.6. Packages which should not be
1.1       grant    4793:                   deleted, once installed</a></span></dt>
                   4794: 
                   4795:                   <dt><span class="sect2"><a href=
                   4796:                   "#security-handling">12.1.7. Handling packages
                   4797:                   with security problems</a></span></dt>
                   4798: 
                   4799:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4800:                   "#id2591889">12.1.8. How to handle compiler
1.1       grant    4801:                   bugs</a></span></dt>
                   4802: 
                   4803:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4804:                   "#id2591911">12.1.9. How to handle incrementing
1.1       grant    4805:                   versions when fixing an existing
                   4806:                   package</a></span></dt>
                   4807: 
                   4808:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4809:                   "#id2591960">12.1.10. Portability of
1.1       grant    4810:                   packages</a></span></dt>
                   4811:                 </dl>
                   4812:               </dd>
                   4813: 
1.19    ! hubertf  4814:               <dt><span class="sect1"><a href="#id2591985">12.2.
1.1       grant    4815:               Possible downloading issues</a></span></dt>
                   4816: 
                   4817:               <dd>
                   4818:                 <dl>
                   4819:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4820:                   "#id2591988">12.2.1. Packages whose distfiles
1.1       grant    4821:                   aren't available for plain
                   4822:                   downloading</a></span></dt>
                   4823: 
                   4824:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4825:                   "#id2592051">12.2.2. How to handle modified
1.1       grant    4826:                   distfiles with the 'old' name</a></span></dt>
                   4827:                 </dl>
                   4828:               </dd>
                   4829: 
1.19    ! hubertf  4830:               <dt><span class="sect1"><a href="#id2592062">12.3.
1.1       grant    4831:               Configuration gotchas</a></span></dt>
                   4832: 
                   4833:               <dd>
                   4834:                 <dl>
                   4835:                   <dt><span class="sect2"><a href=
                   4836:                   "#fixes.libtool">12.3.1. Shared libraries -
                   4837:                   libtool</a></span></dt>
                   4838: 
                   4839:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4840:                   "#id2592441">12.3.2. Using libtool on GNU
1.1       grant    4841:                   packages that already support
                   4842:                   libtool</a></span></dt>
                   4843: 
                   4844:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4845:                   "#id2592594">12.3.3. GNU
1.1       grant    4846:                   Autoconf/Automake</a></span></dt>
                   4847:                 </dl>
                   4848:               </dd>
                   4849: 
1.19    ! hubertf  4850:               <dt><span class="sect1"><a href="#id2592775">12.4.
1.1       grant    4851:               Building considerations</a></span></dt>
                   4852: 
                   4853:               <dd>
                   4854:                 <dl>
                   4855:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4856:                   "#id2592778">12.4.1. CPP defines</a></span></dt>
1.1       grant    4857:                 </dl>
                   4858:               </dd>
                   4859: 
1.19    ! hubertf  4860:               <dt><span class="sect1"><a href="#id2592808">12.5.
1.1       grant    4861:               Package specific actions</a></span></dt>
                   4862: 
                   4863:               <dd>
                   4864:                 <dl>
                   4865:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4866:                   "#id2592811">12.5.1. Package configuration
1.1       grant    4867:                   files</a></span></dt>
                   4868: 
                   4869:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4870:                   "#id2592982">12.5.2. User
1.2       hubertf  4871:                   interaction</a></span></dt>
1.1       grant    4872: 
                   4873:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4874:                   "#id2593027">12.5.3. Handling
1.1       grant    4875:                   licenses</a></span></dt>
                   4876: 
                   4877:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4878:                   "#id2593178">12.5.4. Creating an account from a
1.1       grant    4879:                   package</a></span></dt>
                   4880: 
                   4881:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4882:                   "#id2593240">12.5.5. Installing score
1.1       grant    4883:                   files</a></span></dt>
                   4884: 
                   4885:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4886:                   "#id2593284">12.5.6. Packages providing login
1.1       grant    4887:                   shells</a></span></dt>
                   4888: 
                   4889:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4890:                   "#id2593341">12.5.7. Packages containing perl
1.1       grant    4891:                   scripts</a></span></dt>
                   4892: 
                   4893:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4894:                   "#id2593360">12.5.8. Packages with hardcoded
1.1       grant    4895:                   paths to other interpreters</a></span></dt>
                   4896: 
                   4897:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4898:                   "#id2593381">12.5.9. Packages installing perl
1.1       grant    4899:                   modules</a></span></dt>
                   4900: 
                   4901:                   <dt><span class="sect2"><a href=
                   4902:                   "#faq.info-files">12.5.10. Packages installing
                   4903:                   info files</a></span></dt>
                   4904: 
                   4905:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4906:                   "#id2593601">12.5.11. Packages installing GConf2
1.1       grant    4907:                   data files</a></span></dt>
                   4908: 
                   4909:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4910:                   "#id2593769">12.5.12. Packages installing
1.1       grant    4911:                   scrollkeeper data files</a></span></dt>
                   4912: 
                   4913:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4914:                   "#id2593889">12.5.13. Packages installing X11
1.1       grant    4915:                   fonts</a></span></dt>
                   4916: 
                   4917:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4918:                   "#id2593936">12.5.14. Packages installing GTK2
1.1       grant    4919:                   modules</a></span></dt>
                   4920: 
                   4921:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4922:                   "#id2594005">12.5.15. Packages installing SGML or
1.1       grant    4923:                   XML data</a></span></dt>
                   4924: 
                   4925:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4926:                   "#id2594057">12.5.16. Packages installing
1.1       grant    4927:                   extensions to the MIME database</a></span></dt>
                   4928: 
                   4929:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4930:                   "#id2594332">12.5.17. Packages using
1.1       grant    4931:                   intltool</a></span></dt>
1.18      xtraeme  4932: 
                   4933:                   <dt><span class="sect2"><a href=
1.19    ! hubertf  4934:                   "#id2594346">12.5.18. Packages installing startup
1.18      xtraeme  4935:                   scripts</a></span></dt>
1.1       grant    4936:                 </dl>
                   4937:               </dd>
                   4938: 
1.19    ! hubertf  4939:               <dt><span class="sect1"><a href="#id2594368">12.6.
1.1       grant    4940:               Feedback to the author</a></span></dt>
                   4941:             </dl>
                   4942:           </dd>
                   4943: 
                   4944:           <dt><span class="chapter"><a href="#debug">13.
                   4945:           Debugging</a></span></dt>
                   4946: 
                   4947:           <dt><span class="chapter"><a href="#submit">14.
                   4948:           Submitting and Committing</a></span></dt>
                   4949: 
                   4950:           <dd>
                   4951:             <dl>
1.19    ! hubertf  4952:               <dt><span class="sect1"><a href="#id2594898">14.1.
1.1       grant    4953:               Submitting your packages</a></span></dt>
                   4954: 
1.19    ! hubertf  4955:               <dt><span class="sect1"><a href="#id2594949">14.2.
1.1       grant    4956:               Committing: Importing a package into
                   4957:               CVS</a></span></dt>
                   4958: 
1.19    ! hubertf  4959:               <dt><span class="sect1"><a href="#id2595012">14.3.
1.2       hubertf  4960:               Updating a package to a newer version</a></span></dt>
1.1       grant    4961: 
1.19    ! hubertf  4962:               <dt><span class="sect1"><a href="#id2595031">14.4.
1.2       hubertf  4963:               Moving a package in pkgsrc</a></span></dt>
1.1       grant    4964:             </dl>
                   4965:           </dd>
                   4966:         </dl>
                   4967:       </div>
                   4968: 
                   4969:       <div class="chapter" lang="en" xml:lang="en">
                   4970:         <div class="titlepage">
                   4971:           <div>
                   4972:             <div>
                   4973:               <h2 class="title"><a name="components" id=
                   4974:               "components"></a>Chapter&nbsp;7.&nbsp;Package
                   4975:               components - files, directories and contents</h2>
                   4976:             </div>
                   4977:           </div>
                   4978:         </div>
                   4979: 
                   4980:         <div class="toc">
                   4981:           <p><b>Table of Contents</b></p>
                   4982: 
                   4983:           <dl>
                   4984:             <dt><span class="sect1"><a href=
1.14      xtraeme  4985:             "#components.Makefile">7.1. <code class=
                   4986:             "filename">Makefile</code></a></span></dt>
1.1       grant    4987: 
                   4988:             <dt><span class="sect1"><a href=
1.14      xtraeme  4989:             "#components.distinfo">7.2. <code class=
                   4990:             "filename">distinfo</code></a></span></dt>
1.1       grant    4991: 
                   4992:             <dt><span class="sect1"><a href=
                   4993:             "#components.patches">7.3. patches/*</a></span></dt>
                   4994: 
1.19    ! hubertf  4995:             <dt><span class="sect1"><a href="#id2586455">7.4. Other
1.1       grant    4996:             mandatory files</a></span></dt>
                   4997: 
                   4998:             <dt><span class="sect1"><a href=
                   4999:             "#components.optional">7.5. Optional
                   5000:             files</a></span></dt>
                   5001: 
1.19    ! hubertf  5002:             <dt><span class="sect1"><a href="#id2586649">7.6.
1.14      xtraeme  5003:             <code class="filename">work*</code></a></span></dt>
1.1       grant    5004: 
1.19    ! hubertf  5005:             <dt><span class="sect1"><a href="#id2586737">7.7.
1.14      xtraeme  5006:             <code class="filename">files/*</code></a></span></dt>
1.1       grant    5007:           </dl>
                   5008:         </div>
                   5009: 
                   5010:         <p>Whenever you're preparing a package, there are a number
                   5011:         of files involved which are described in the following
                   5012:         sections.</p>
                   5013: 
                   5014:         <div class="sect1" lang="en" xml:lang="en">
                   5015:           <div class="titlepage">
                   5016:             <div>
                   5017:               <div>
                   5018:                 <h2 class="title" style="clear: both"><a name=
                   5019:                 "components.Makefile" id=
1.14      xtraeme  5020:                 "components.Makefile"></a>7.1.&nbsp;<code class=
                   5021:                 "filename">Makefile</code></h2>
1.1       grant    5022:               </div>
                   5023:             </div>
                   5024:           </div>
                   5025: 
                   5026:           <p>Building, installation and creation of a binary
1.14      xtraeme  5027:           package are all controlled by the package's <code class=
                   5028:           "filename">Makefile</code>.</p>
1.1       grant    5029: 
1.14      xtraeme  5030:           <p>There is a <code class="filename">Makefile</code> for
                   5031:           each package. This file includes the standard
                   5032:           <code class="filename">bsd.pkg.mk</code> file (referenced
                   5033:           as <code class="filename">../../mk/bsd.pkg.mk</code>),
                   5034:           which sets all the definitions and actions necessary for
                   5035:           the package to compile and install itself. The mandatory
                   5036:           variables are the <code class="varname">DISTNAME</code>
                   5037:           which specifies the base name of the distribution file to
                   5038:           be downloaded from the site on the Internet, <code class=
                   5039:           "varname">MASTER_SITES</code> which specifies that site,
                   5040:           <code class="varname">CATEGORIES</code> which denotes the
                   5041:           categories into which the package falls, <code class=
                   5042:           "varname">PKGNAME</code> which is the name of the
                   5043:           package, the <code class="varname">MAINTAINER</code>'s
                   5044:           name, and the <code class="varname">COMMENT</code>
                   5045:           variable, which should contain a one-line description of
                   5046:           the package (the package name should not appear, it will
                   5047:           be added automatically). The maintainer variable is there
                   5048:           so that anyone who quibbles with the (always completely
                   5049:           correct) decisions taken by the guy who maintains the
                   5050:           package can complain vigorously, or send chocolate as a
                   5051:           sign of appreciation.</p>
1.1       grant    5052: 
1.14      xtraeme  5053:           <p>The <code class="varname">MASTER_SITES</code> may be
                   5054:           set to one of the predefined sites:</p>
1.1       grant    5055:           <pre class="programlisting">
                   5056:         ${MASTER_SITE_APACHE}
                   5057:         ${MASTER_SITE_DEBIAN}
                   5058:         ${MASTER_SITE_GNOME}
                   5059:         ${MASTER_SITE_GNU}
                   5060:         ${MASTER_SITE_GNUSTEP}
1.9       dillo    5061:         ${MASTER_SITE_IFARCHIVE}
1.1       grant    5062:         ${MASTER_SITE_MOZILLA}
                   5063:         ${MASTER_SITE_PERL_CPAN}
                   5064:         ${MASTER_SITE_SOURCEFORGE}
                   5065:         ${MASTER_SITE_SUNSITE}
                   5066:         ${MASTER_SITE_R_CRAN}
                   5067:         ${MASTER_SITE_SUSE}
                   5068:         ${MASTER_SITE_TEX_CTAN}
                   5069:         ${MASTER_SITE_XCONTRIB}
                   5070:         ${MASTER_SITE_XEMACS} 
                   5071: </pre>
                   5072: 
                   5073:           <p>If one of these predefined sites is chosen, you may
                   5074:           require the ability to specify a subdirectory of that
                   5075:           site. Since these macros may expand to more than one
                   5076:           actual site, you <span class=
                   5077:           "emphasis"><em>must</em></span> use the following
                   5078:           construct to specify a subdirectory:</p>
                   5079:           <pre class="programlisting">
                   5080:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   5081:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   5082: </pre>
                   5083: 
                   5084:           <p>Note the trailing slash after the subdirectory
                   5085:           name.</p>
                   5086: 
                   5087:           <div class="note" style=
                   5088:           "margin-left: 0.5in; margin-right: 0.5in;">
                   5089:             <h3 class="title">Note</h3>
                   5090: 
1.14      xtraeme  5091:             <p><code class="varname">MASTER_SITE_SUBDIR</code> has
                   5092:             been deprecated and <span class="emphasis"><em>should
                   5093:             no longer be used</em></span>.</p>
1.1       grant    5094:           </div>
                   5095: 
1.14      xtraeme  5096:           <p>If the package has multiple <code class=
                   5097:           "varname">DISTFILES</code> or multiple <code class=
                   5098:           "varname">PATCHFILES</code> from different sites, set
                   5099:           <code class="varname">SITES_foo</code> to a list of URI's
1.1       grant    5100:           where file &#8220;<span class="quote">foo</span>&#8221;
                   5101:           may be found. &#8220;<span class=
                   5102:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   5103:           <pre class="programlisting">
                   5104: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   5105: DISTFILES+=     foo-file.tar.gz
                   5106: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   5107:         http://www.somewhereelse.com/mirror/somehow/
                   5108: </pre>
                   5109: 
1.14      xtraeme  5110:           <p>Note that the normal default setting of <code class=
                   5111:           "varname">DISTFILES</code> must be made explicit if you
1.1       grant    5112:           want to add to it (rather than replace it), as you
                   5113:           usually would.</p>
                   5114: 
                   5115:           <p>Currently the following values are available for
1.14      xtraeme  5116:           <code class="varname">CATEGORIES</code>. If more than one
                   5117:           is used, they need to be separated by spaces:</p>
1.1       grant    5118:           <pre class="programlisting">
                   5119: archivers     cross         geography     meta-pkgs     security
                   5120: audio         databases     graphics      misc          shells
                   5121: benchmarks    devel         ham           multimedia    sysutils
                   5122: biology       editors       inputmethod   net           textproc
                   5123: cad           emulators     lang          news          time
                   5124: chat          finance       mail          parallel      wm
                   5125: comms         fonts         math          pkgtools      www
                   5126: converters    games         mbone         print         x11
                   5127: </pre>
                   5128: 
                   5129:           <p>Please pay attention to the following gotchas:</p>
                   5130: 
                   5131:           <div class="itemizedlist">
                   5132:             <ul type="disc">
                   5133:               <li>
1.14      xtraeme  5134:                 <p>Add <code class="varname">MANCOMPRESSED</code>
                   5135:                 if manpages are installed in compressed form by the
                   5136:                 package; see comment in <code class=
                   5137:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    5138:               </li>
                   5139: 
                   5140:               <li>
1.14      xtraeme  5141:                 <p>Replace <code class="filename">/usr/local</code>
1.1       grant    5142:                 with &#8220;<span class=
                   5143:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   5144:                 patches, below).</p>
                   5145:               </li>
                   5146: 
                   5147:               <li>
                   5148:                 <p>If the package installs any info files, see
                   5149:                 <a href="#faq.info-files" title=
                   5150:                 "12.5.10.&nbsp;Packages installing info files">Section
                   5151:                 12.5.10, &#8220;Packages installing info
                   5152:                 files&#8221;</a>.</p>
                   5153:               </li>
                   5154: 
                   5155:               <li>
1.14      xtraeme  5156:                 <p>Set <code class="varname">MAINTAINER</code> to
                   5157:                 be yourself. If you really can't maintain the
                   5158:                 package for future updates, set it to <code class=
1.1       grant    5159:                 "email">&lt;<a href=
1.14      xtraeme  5160:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.1       grant    5161:               </li>
                   5162: 
                   5163:               <li>
                   5164:                 <p>If a home page for the software in question
1.14      xtraeme  5165:                 exists, add the variable <code class=
                   5166:                 "varname">HOMEPAGE</code> right after <code class=
                   5167:                 "varname">MAINTAINER</code>. The value of this
1.1       grant    5168:                 variable should be the URL for the home page.</p>
                   5169:               </li>
                   5170: 
                   5171:               <li>
1.14      xtraeme  5172:                 <p>Be sure to set the <code class=
                   5173:                 "varname">COMMENT</code> variable to a short
1.1       grant    5174:                 description of the package, not containing the
                   5175:                 pkg's name.</p>
                   5176:               </li>
                   5177:             </ul>
                   5178:           </div>
                   5179:         </div>
                   5180: 
                   5181:         <div class="sect1" lang="en" xml:lang="en">
                   5182:           <div class="titlepage">
                   5183:             <div>
                   5184:               <div>
                   5185:                 <h2 class="title" style="clear: both"><a name=
                   5186:                 "components.distinfo" id=
1.14      xtraeme  5187:                 "components.distinfo"></a>7.2.&nbsp;<code class=
                   5188:                 "filename">distinfo</code></h2>
1.1       grant    5189:               </div>
                   5190:             </div>
                   5191:           </div>
                   5192: 
                   5193:           <p>Most important, the mandatory message digest, or
                   5194:           checksum, of all the distfiles needed for the package to
                   5195:           compile, confirming they match the original file
                   5196:           distributed by the author. This ensures that the distfile
                   5197:           retrieved from the Internet has not been corrupted during
                   5198:           transfer or altered by a malign force to introduce a
1.14      xtraeme  5199:           security hole. It is generated using the
                   5200:           <span><strong class="command">make
                   5201:           makesum</strong></span> command. The digest algorithm
                   5202:           used was, at one stage, md5, but that was felt lacking
                   5203:           compared to sha1, and so sha1 is now the default
1.1       grant    5204:           algorithm. The distfile size is also generated and stored
                   5205:           in new distinfo files. The <a xmlns=
                   5206:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5207:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.19    ! hubertf  5208:              class="pkgname">pkgtools/digest</a> utility calculates
        !          5209:              all of the digests in the distinfo file, and it
        !          5210:              provides various different algorithms. At the current
        !          5211:              time, the algorithms provided are: <span class=
        !          5212:              "emphasis"><em>md5</em></span>, <span class=
        !          5213:              "emphasis"><em>rmd160</em></span>, <span class=
        !          5214:              "emphasis"><em>sha1</em></span>, <span class=
        !          5215:              "emphasis"><em>sha256</em></span>, <span class=
        !          5216:              "emphasis"><em>sha384</em></span> and <span class=
        !          5217:              "emphasis"><em>sha512</em></span>.</p>
1.1       grant    5218: 
                   5219:           <p>Some packages have different sets of distfiles on a
                   5220:           per architecture basis, for example <a xmlns=
                   5221:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5222:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.19    ! hubertf  5223:              class="pkgname">www/navigator</a>). These are kept in
        !          5224:              the same distinfo file and care should be taken when
        !          5225:              upgrading such a package to ensure distfile
        !          5226:              information is not lost.</p>
1.1       grant    5227: 
                   5228:           <p>The message digest/checksum for all the official
1.14      xtraeme  5229:           patches found in the <code class=
                   5230:           "filename">patches/</code> directory (see <a href=
                   5231:           "#components.patches" title=
1.1       grant    5232:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   5233:           &#8220;patches/*&#8221;</a>) for the package is also
1.14      xtraeme  5234:           stored in the <code class="filename">distinfo</code>
                   5235:           file. This is a message digest/checksum of all lines in
                   5236:           the patch file except the NetBSD RCS Id. This file is
                   5237:           generated by invoking <span><strong class="command">make
                   5238:           makepatchsum</strong></span> (or <span><strong class=
                   5239:           "command">make mps</strong></span> if you're in a
                   5240:           hurry).</p>
1.1       grant    5241:         </div>
                   5242: 
                   5243:         <div class="sect1" lang="en" xml:lang="en">
                   5244:           <div class="titlepage">
                   5245:             <div>
                   5246:               <div>
                   5247:                 <h2 class="title" style="clear: both"><a name=
                   5248:                 "components.patches" id=
                   5249:                 "components.patches"></a>7.3.&nbsp;patches/*</h2>
                   5250:               </div>
                   5251:             </div>
                   5252:           </div>
                   5253: 
                   5254:           <p>This directory contains files that are used by the
                   5255:           <a href=
                   5256:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   5257:           <span class="citerefentry"><span class=
                   5258:           "refentrytitle">patch</span>(1)</span></a> command to
                   5259:           modify the sources as distributed in the distribution
                   5260:           file into a form that will compile and run perfectly on
                   5261:           NetBSD. The files are applied successively in alphabetic
                   5262:           order (as returned by a shell &#8220;<span class=
                   5263:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.14      xtraeme  5264:           <code class="filename">patch-aa</code> is applied before
                   5265:           <code class="filename">patch-ab</code>, etc.</p>
1.1       grant    5266: 
1.14      xtraeme  5267:           <p>The <code class="filename">patch-*</code> files should
                   5268:           be in <span><strong class="command">diff
                   5269:           -bu</strong></span> format, and apply without a fuzz to
                   5270:           avoid problems. (To force patches to apply with fuzz you
                   5271:           can set <code class=
                   5272:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    5273:           not put changes for more than one file into a single
                   5274:           patch-file, as this will make future modifications more
                   5275:           difficult.</p>
                   5276: 
                   5277:           <p>Similar, a file should be patched at most once, not
                   5278:           several times by several different patches. If a file
                   5279:           needs several patches, they should be combined into one
                   5280:           file.</p>
                   5281: 
                   5282:           <p>One important thing to mention is to pay attention
                   5283:           that no RCS IDs get stored in the patch files, as these
                   5284:           will cause problems when later checked into the NetBSD
1.14      xtraeme  5285:           CVS tree. Use the <span><strong class=
                   5286:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    5287:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5288:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.19    ! hubertf  5289:              class="pkgname">pkgtools/pkgdiff</a> package to avoid
        !          5290:              these problems.</p>
1.1       grant    5291: 
                   5292:           <p>For even more automation, we recommend using
1.14      xtraeme  5293:           <span><strong class="command">mkpatches</strong></span>
                   5294:           from the same package to make a whole set of patches. You
                   5295:           just have to backup files before you edit them to
                   5296:           <code class="filename">filename.orig</code>, e.g. with
                   5297:           <span><strong class="command">cp -p filename
                   5298:           filename.orig</strong></span> or, easier, by using
                   5299:           <span><strong class="command">pkgvi</strong></span> again
                   5300:           from the same package. If you upgrade a package this way,
                   5301:           you can easily compare the new set of patches with the
                   5302:           previously existing one with <span><strong class=
                   5303:           "command">patchdiff</strong></span>.</p>
1.1       grant    5304: 
                   5305:           <p>When you have finished a package, remember to generate
                   5306:           the checksums for the patch files by using the
1.14      xtraeme  5307:           <span><strong class="command">make
                   5308:           makepatchsum</strong></span> command, see <a href=
                   5309:           "#components.distinfo" title=
1.5       hubertf  5310:           "7.2.&nbsp;distinfo">Section&nbsp;7.2,
1.14      xtraeme  5311:           &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    5312: 
                   5313:           <p>Patch files that are distributed by the author or
1.14      xtraeme  5314:           other maintainers can be listed in <code class=
                   5315:           "varname">$PATCHFILES</code>.</p>
1.1       grant    5316: 
                   5317:           <p>If it is desired to store any patches that should not
                   5318:           be committed into pkgsrc, they can be kept outside the
1.14      xtraeme  5319:           pkgsrc tree in the <code class=
                   5320:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    5321:           tree there is expected to have the same
                   5322:           &#8220;<span class="quote">category/package</span>&#8221;
                   5323:           structure as pkgsrc, and patches are expected to be
1.14      xtraeme  5324:           stored inside these dirs (also known as <code class=
                   5325:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
                   5326:           you want to keep a private patch for <code class=
                   5327:           "filename">pkgsrc/graphics/png</code>, keep it in
                   5328:           <code class=
                   5329:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   5330:           files in the named directory are expected to be patch
1.1       grant    5331:           files, and <span class="emphasis"><em>they are applied
                   5332:           after pkgsrc patches are applied</em></span>.</p>
                   5333:         </div>
                   5334: 
                   5335:         <div class="sect1" lang="en" xml:lang="en">
                   5336:           <div class="titlepage">
                   5337:             <div>
                   5338:               <div>
                   5339:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  5340:                 "id2586455" id="id2586455"></a>7.4.&nbsp;Other
1.1       grant    5341:                 mandatory files</h2>
                   5342:               </div>
                   5343:             </div>
                   5344:           </div>
                   5345: 
                   5346:           <div class="variablelist">
                   5347:             <dl>
1.14      xtraeme  5348:               <dt><span class="term"><code class=
                   5349:               "filename">DESCR</code></span></dt>
1.1       grant    5350: 
                   5351:               <dd>
                   5352:                 <p>A multi-line description of the piece of
                   5353:                 software. This should include any credits where
                   5354:                 they are due. Please bear in mind that others do
                   5355:                 not share your sense of humour (or spelling
                   5356:                 idiosyncrasies), and that others will read
                   5357:                 everything that you write here.</p>
                   5358:               </dd>
                   5359: 
1.14      xtraeme  5360:               <dt><span class="term"><code class=
                   5361:               "filename">PLIST</code></span></dt>
1.1       grant    5362: 
                   5363:               <dd>
                   5364:                 <p>This file governs the files that are installed
                   5365:                 on your system: all the binaries, manual pages,
                   5366:                 etc. There are other directives which may be
                   5367:                 entered in this file, to control the creation and
                   5368:                 deletion of directories, and the location of
                   5369:                 inserted files. See <a href="#plist" title=
                   5370:                 "Chapter&nbsp;8.&nbsp;PLIST issues">Chapter&nbsp;8,
                   5371:                 <i>PLIST issues</i></a> for more information.</p>
                   5372:               </dd>
                   5373:             </dl>
                   5374:           </div>
                   5375:         </div>
                   5376: 
                   5377:         <div class="sect1" lang="en" xml:lang="en">
                   5378:           <div class="titlepage">
                   5379:             <div>
                   5380:               <div>
                   5381:                 <h2 class="title" style="clear: both"><a name=
                   5382:                 "components.optional" id=
                   5383:                 "components.optional"></a>7.5.&nbsp;Optional
                   5384:                 files</h2>
                   5385:               </div>
                   5386:             </div>
                   5387:           </div>
                   5388: 
                   5389:           <div class="variablelist">
                   5390:             <dl>
1.14      xtraeme  5391:               <dt><span class="term"><code class=
                   5392:               "filename">INSTALL</code></span></dt>
1.1       grant    5393: 
                   5394:               <dd>
                   5395:                 <p>This shell script is invoked twice by <a href=
                   5396:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5397:                 <span class="citerefentry"><span class=
                   5398:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   5399:                 time after package extraction and before files are
                   5400:                 moved in place, the second time after the files to
                   5401:                 install are moved in place. This can be used to do
                   5402:                 any custom procedures not possible with @exec
1.14      xtraeme  5403:                 commands in <code class="filename">PLIST</code>.
                   5404:                 See <a href=
1.1       grant    5405:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5406:                 <span class="citerefentry"><span class=
                   5407:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   5408:                 <a href=
                   5409:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5410:                 <span class="citerefentry"><span class=
                   5411:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5412:                 more information.</p>
                   5413:               </dd>
                   5414: 
1.14      xtraeme  5415:               <dt><span class="term"><code class=
                   5416:               "filename">DEINSTALL</code></span></dt>
1.1       grant    5417: 
                   5418:               <dd>
                   5419:                 <p>This script is executed before and after any
                   5420:                 files are removed. It is this script's
                   5421:                 responsibility to clean up any additional messy
                   5422:                 details around the package's installation, since
                   5423:                 all pkg_delete knows is how to delete the files
                   5424:                 created in the original distribution. See <a href=
                   5425:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   5426:                 <span class="citerefentry"><span class=
                   5427:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   5428:                 <a href=
                   5429:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5430:                 <span class="citerefentry"><span class=
                   5431:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5432:                 more information.</p>
                   5433:               </dd>
                   5434: 
1.14      xtraeme  5435:               <dt><span class="term"><code class=
                   5436:               "filename">MESSAGE</code></span></dt>
1.1       grant    5437: 
                   5438:               <dd>
                   5439:                 <p>Display this file after installation of the
                   5440:                 package. Useful for things like legal notices on
                   5441:                 almost-free software and hints for updating config
                   5442:                 files after installing modules for apache, PHP etc.
                   5443:                 Please note that you can modify variables in it
1.14      xtraeme  5444:                 easily by using <code class=
                   5445:                 "varname">MESSAGE_SUBST</code> in the package's
                   5446:                 <code class="filename">Makefile</code>:</p>
1.1       grant    5447:                 <pre class="programlisting">
                   5448: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   5449: </pre>
                   5450: 
                   5451:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.14      xtraeme  5452:                 "quote">somevalue</span>&#8221; in <code class=
                   5453:                 "filename">MESSAGE</code>.</p>
1.1       grant    5454:               </dd>
                   5455:             </dl>
                   5456:           </div>
                   5457:         </div>
                   5458: 
                   5459:         <div class="sect1" lang="en" xml:lang="en">
                   5460:           <div class="titlepage">
                   5461:             <div>
                   5462:               <div>
                   5463:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  5464:                 "id2586649" id=
        !          5465:                 "id2586649"></a>7.6.&nbsp;<code class=
1.14      xtraeme  5466:                 "filename">work*</code></h2>
1.1       grant    5467:               </div>
                   5468:             </div>
                   5469:           </div>
                   5470: 
1.14      xtraeme  5471:           <p>When you type <span><strong class=
                   5472:           "command">make</strong></span> the distribution files are
                   5473:           unpacked into this directory. It can be removed by
                   5474:           running <span><strong class="command">make
                   5475:           clean</strong></span>. Besides the sources, this
                   5476:           directory is also used to keep various timestamp
1.1       grant    5477:           files.</p>
                   5478: 
                   5479:           <p>If a package doesn't create a subdirectory for itself
                   5480:           (like GNU software does, for instance), but extracts
                   5481:           itself in the current directory, you should set
1.14      xtraeme  5482:           <code class="varname">WRKSRC</code> accordingly, e.g.
1.1       grant    5483:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   5484:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.19    ! hubertf  5485:              class="pkgname">editors/sam</a> again, but the quick
        !          5486:              answer is:</p>
1.1       grant    5487:           <pre class="programlisting">
                   5488: WRKSRC=                ${WRKDIR}
                   5489: </pre>
                   5490: 
1.14      xtraeme  5491:           <p>Please note that the old <code class=
                   5492:           "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1       grant    5493:           should not be used. Also, if your package doesn't create
1.14      xtraeme  5494:           a subdir with the name of <code class=
                   5495:           "varname">DISTNAME</code> but some different name, set
                   5496:           <code class="varname">WRKSRC</code> to point to the
                   5497:           proper name in <code class="filename">${WRKDIR}</code>.
                   5498:           See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5499:           href=
1.1       grant    5500:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.19    ! hubertf  5501:              class="pkgname">lang/tcl</a> and <a xmlns=
        !          5502:              "http://www.w3.org/TR/xhtml1/transitional" href=
        !          5503:              "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
        !          5504:              class="pkgname">x11/tk</a> for examples, and here is
        !          5505:              another one:</p>
1.1       grant    5506:           <pre class="programlisting">
                   5507: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   5508: </pre>
                   5509: 
                   5510:           <p>The name of the working directory created by pkgsrc is
1.14      xtraeme  5511:           <code class="filename">work</code> by default. If the
                   5512:           same pkgsrc tree should be used on several different
                   5513:           platforms, the variable <code class=
                   5514:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1       grant    5515:           attach the platform to the directory name, e.g.
1.14      xtraeme  5516:           <code class="filename">work.i386</code> or <code class=
                   5517:           "filename">work.sparc</code>.</p>
1.1       grant    5518:         </div>
                   5519: 
                   5520:         <div class="sect1" lang="en" xml:lang="en">
                   5521:           <div class="titlepage">
                   5522:             <div>
                   5523:               <div>
                   5524:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  5525:                 "id2586737" id=
        !          5526:                 "id2586737"></a>7.7.&nbsp;<code class=
1.14      xtraeme  5527:                 "filename">files/*</code></h2>
1.1       grant    5528:               </div>
                   5529:             </div>
                   5530:           </div>
                   5531: 
                   5532:           <p>If you have any files that you wish to be placed in
                   5533:           the package prior to configuration or building, you could
                   5534:           place these files here and use a &#8220;<span class=
                   5535:           "quote">${CP}</span>&#8221; command in the
                   5536:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   5537:           target to achieve this. Alternatively, you could simply
1.14      xtraeme  5538:           diff the file against <code class=
                   5539:           "filename">/dev/null</code> and use the patch mechanism
                   5540:           to manage the creation of this file.</p>
1.1       grant    5541:         </div>
                   5542:       </div>
                   5543: 
                   5544:       <div class="chapter" lang="en" xml:lang="en">
                   5545:         <div class="titlepage">
                   5546:           <div>
                   5547:             <div>
                   5548:               <h2 class="title"><a name="plist" id=
                   5549:               "plist"></a>Chapter&nbsp;8.&nbsp;PLIST issues</h2>
                   5550:             </div>
                   5551:           </div>
                   5552:         </div>
                   5553: 
                   5554:         <div class="toc">
                   5555:           <p><b>Table of Contents</b></p>
                   5556: 
                   5557:           <dl>
1.19    ! hubertf  5558:             <dt><span class="sect1"><a href="#id2586791">8.1. RCS
1.1       grant    5559:             ID</a></span></dt>
                   5560: 
1.19    ! hubertf  5561:             <dt><span class="sect1"><a href="#id2586806">8.2.
1.14      xtraeme  5562:             Semi-automatic <code class="filename">PLIST</code>
                   5563:             generation</a></span></dt>
1.1       grant    5564: 
                   5565:             <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme  5566:             Tweaking output of <span><strong class="command">make
                   5567:             print-PLIST</strong></span></a></span></dt>
1.1       grant    5568: 
                   5569:             <dt><span class="sect1"><a href="#plist.misc">8.4.
                   5570:             Variable substitution in PLIST</a></span></dt>
                   5571: 
1.19    ! hubertf  5572:             <dt><span class="sect1"><a href="#id2587127">8.5.
1.1       grant    5573:             Manpage-compression</a></span></dt>
                   5574: 
1.19    ! hubertf  5575:             <dt><span class="sect1"><a href="#id2587169">8.6.
1.14      xtraeme  5576:             Changing PLIST source with <code class=
                   5577:             "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5578: 
1.19    ! hubertf  5579:             <dt><span class="sect1"><a href="#id2587322">8.7.
1.1       grant    5580:             Platform specific and differing PLISTs</a></span></dt>
                   5581: 
                   5582:             <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
                   5583:             Sharing directories between packages</a></span></dt>
                   5584:           </dl>
                   5585:         </div>
                   5586: 
1.14      xtraeme  5587:         <p>The <code class="filename">PLIST</code> file contains a
1.1       grant    5588:         package's &#8220;<span class="quote">packing
                   5589:         list</span>&#8221;, i.e. a list of files that belong to the
1.14      xtraeme  5590:         package (relative to the <code class=
                   5591:         "filename">${PREFIX}</code> directory it's been installed
                   5592:         in) plus some additional statements - see the <a href=
1.1       grant    5593:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5594:         <span class="citerefentry"><span class=
                   5595:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   5596:         a full list. This chapter addresses some issues that need
1.14      xtraeme  5597:         attention when dealing with the <code class=
                   5598:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    5599: 
                   5600:         <div class="sect1" lang="en" xml:lang="en">
                   5601:           <div class="titlepage">
                   5602:             <div>
                   5603:               <div>
                   5604:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  5605:                 "id2586791" id="id2586791"></a>8.1.&nbsp;RCS
1.1       grant    5606:                 ID</h2>
                   5607:               </div>
                   5608:             </div>
                   5609:           </div>
                   5610: 
                   5611:           <p>Be sure to add a RCS ID line as the first thing in any
1.14      xtraeme  5612:           <code class="filename">PLIST</code> file you write:</p>
1.1       grant    5613:           <pre class="programlisting">
1.17      sketch   5614: @comment $NetBSD$
1.1       grant    5615: </pre>
                   5616:         </div>
                   5617: 
                   5618:         <div class="sect1" lang="en" xml:lang="en">
                   5619:           <div class="titlepage">
                   5620:             <div>
                   5621:               <div>
                   5622:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  5623:                 "id2586806" id=
        !          5624:                 "id2586806"></a>8.2.&nbsp;Semi-automatic
1.14      xtraeme  5625:                 <code class="filename">PLIST</code> generation</h2>
1.1       grant    5626:               </div>
                   5627:             </div>
                   5628:           </div>
                   5629: 
1.14      xtraeme  5630:           <p>You can use the <span><strong class="command">make
                   5631:           print-PLIST</strong></span> command to output a PLIST
                   5632:           that matches any new files since the package was
                   5633:           extracted. See <a href="#build.helpful-targets" title=
1.1       grant    5634:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   5635:           &#8220;Other helpful targets&#8221;</a> for more
                   5636:           information on this target.</p>
                   5637:         </div>
                   5638: 
                   5639:         <div class="sect1" lang="en" xml:lang="en">
                   5640:           <div class="titlepage">
                   5641:             <div>
                   5642:               <div>
                   5643:                 <h2 class="title" style="clear: both"><a name=
                   5644:                 "print-PLIST" id=
                   5645:                 "print-PLIST"></a>8.3.&nbsp;Tweaking output of
1.14      xtraeme  5646:                 <span><strong class="command">make
                   5647:                 print-PLIST</strong></span></h2>
1.1       grant    5648:               </div>
                   5649:             </div>
                   5650:           </div>
                   5651: 
                   5652:           <p>If you have used any of the *-dirs packages, as
                   5653:           explained in <a href="#faq.common-dirs" title=
                   5654:           "8.8.&nbsp;Sharing directories between packages">Section&nbsp;8.8,
                   5655:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  5656:           you may have noticed that <span><strong class=
                   5657:           "command">make print-PLIST</strong></span> outputs a set
                   5658:           of <code class="varname">@comment</code>s instead of real
                   5659:           <code class="varname">@dirrm</code> lines. You can also
                   5660:           do this for specific directories and files, so that the
                   5661:           results of that command are very close to reality. This
                   5662:           helps <span class="emphasis"><em>a lot</em></span> during
                   5663:           the update of packages.</p>
                   5664: 
                   5665:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   5666:           variable takes a set of AWK patterns and actions that are
                   5667:           used to filter the output of print-PLIST. You can
                   5668:           <span class="emphasis"><em>append</em></span> any chunk
                   5669:           of AWK scripting you like to it, but be careful with
1.1       grant    5670:           quoting.</p>
                   5671: 
1.14      xtraeme  5672:           <p>For example, to get all files inside the <code class=
                   5673:           "filename">libdata/foo</code> directory removed from the
1.1       grant    5674:           resulting PLIST:</p>
                   5675:           <pre class="programlisting">
                   5676:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   5677:     
                   5678: </pre>
                   5679: 
1.14      xtraeme  5680:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    5681:           lines referring to a specific (shared) directory
1.14      xtraeme  5682:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    5683:           <pre class="programlisting">
                   5684:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   5685:     
                   5686: </pre>
                   5687:         </div>
                   5688: 
                   5689:         <div class="sect1" lang="en" xml:lang="en">
                   5690:           <div class="titlepage">
                   5691:             <div>
                   5692:               <div>
                   5693:                 <h2 class="title" style="clear: both"><a name=
                   5694:                 "plist.misc" id="plist.misc"></a>8.4.&nbsp;Variable
                   5695:                 substitution in PLIST</h2>
                   5696:               </div>
                   5697:             </div>
                   5698:           </div>
                   5699: 
                   5700:           <p>A number of variables are substituted automatically in
                   5701:           PLISTs when a package is installed on a system. This
                   5702:           includes the following variables:</p>
                   5703: 
                   5704:           <div class="variablelist">
                   5705:             <dl>
1.14      xtraeme  5706:               <dt><span class="term"><code class=
                   5707:               "varname">${MACHINE_ARCH}</code>, <code class=
                   5708:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    5709: 
                   5710:               <dd>
                   5711:                 <p>Some packages like emacs and perl embed
                   5712:                 information about which architecture they were
                   5713:                 built on into the pathnames where they install
                   5714:                 their file. To handle this case, PLIST will be
                   5715:                 preprocessed before actually used, and the symbol
1.14      xtraeme  5716:                 &#8220;<span class="quote"><code class=
                   5717:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   5718:                 be replaced by what <span><strong class=
                   5719:                 "command">uname -p</strong></span> gives. The same
                   5720:                 is done if the string <code class=
                   5721:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   5722:                 PLIST somewhere - use this on packages that have
                   5723:                 GNU autoconf created configure scripts.</p>
1.1       grant    5724: 
                   5725:                 <div class="note" style=
                   5726:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   5727:                   <h3 class="title">Legacy note</h3>
                   5728: 
                   5729:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  5730:                   "quote"><code class=
                   5731:                   "varname">$ARCH</code></span>&#8221; that was
                   5732:                   replaced by the output of <span><strong class=
                   5733:                   "command">uname -m</strong></span>, but that's no
1.1       grant    5734:                   longer supported and has been removed.</p>
                   5735:                 </div>
                   5736:               </dd>
                   5737: 
1.14      xtraeme  5738:               <dt><span class="term"><code class=
                   5739:               "varname">${OPSYS}</code>, <code class=
                   5740:               "varname">${LOWER_OPSYS}</code>, <code class=
                   5741:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    5742: 
                   5743:               <dd>
                   5744:                 <p>Some packages want to embed the OS name and
                   5745:                 version into some paths. To do this, use these
1.14      xtraeme  5746:                 variables in the <code class=
                   5747:                 "filename">PLIST</code>:</p>
1.1       grant    5748: 
                   5749:                 <div class="itemizedlist">
                   5750:                   <ul type="disc">
                   5751:                     <li>
1.14      xtraeme  5752:                       <p><code class="varname">${OPSYS}</code> -
                   5753:                       output of &#8220;<span class=
                   5754:                       "quote"><span><strong class="command">uname
                   5755:                       -s</strong></span></span>&#8221;</p>
1.1       grant    5756:                     </li>
                   5757: 
                   5758:                     <li>
1.14      xtraeme  5759:                       <p><code class=
                   5760:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   5761:                       common name (eg. &#8220;<span class=
                   5762:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    5763:                     </li>
                   5764: 
                   5765:                     <li>
1.14      xtraeme  5766:                       <p><code class="varname">${OS_VERSION}</code>
                   5767:                       - &#8220;<span class=
                   5768:                       "quote"><span><strong class="command">uname
                   5769:                       -r</strong></span></span>&#8221;</p>
1.1       grant    5770:                     </li>
                   5771:                   </ul>
                   5772:                 </div>
                   5773:               </dd>
                   5774: 
1.14      xtraeme  5775:               <dt><span class="term"><code class=
                   5776:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    5777: 
                   5778:               <dd>
                   5779:                 <p>Packages that install locale files should list
                   5780:                 them in the PLIST as &#8220;<span class=
                   5781:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   5782:                 instead of &#8220;<span class=
                   5783:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   5784:                 This properly handles the fact that different
                   5785:                 operating systems expect locale files to be either
1.14      xtraeme  5786:                 in <code class="filename">share</code> or
                   5787:                 <code class="filename">lib</code> by default.</p>
1.1       grant    5788:               </dd>
                   5789:             </dl>
                   5790:           </div>
                   5791: 
                   5792:           <p>For a complete list of values which are replaced by
1.14      xtraeme  5793:           default, please look in <code class=
                   5794:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    5795:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   5796: 
                   5797:           <p>If you want to change other variables not listed
                   5798:           above, you can add variables and their expansions to this
1.14      xtraeme  5799:           variable in the following way, similar to <code class=
                   5800:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    5801:           "#components.optional" title=
                   5802:           "7.5.&nbsp;Optional files">Section&nbsp;7.5,
                   5803:           &#8220;Optional files&#8221;</a>):</p>
                   5804:           <pre class="programlisting">
                   5805: PLIST_SUBST+=    SOMEVAR="somevalue"
                   5806: </pre>
                   5807: 
                   5808:           <p>This replaces all occurrences of &#8220;<span class=
                   5809:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   5810:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   5811:         </div>
                   5812: 
                   5813:         <div class="sect1" lang="en" xml:lang="en">
                   5814:           <div class="titlepage">
                   5815:             <div>
                   5816:               <div>
                   5817:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  5818:                 "id2587127" id=
        !          5819:                 "id2587127"></a>8.5.&nbsp;Manpage-compression</h2>
1.1       grant    5820:               </div>
                   5821:             </div>
                   5822:           </div>
                   5823: 
                   5824:           <p>Manpages should be installed in compressed form if
1.14      xtraeme  5825:           <code class="varname">MANZ</code> is set (in <code class=
                   5826:           "filename">bsd.own.mk</code>), and uncompressed
                   5827:           otherwise. To handle this in the <code class=
                   5828:           "filename">PLIST</code> file, the suffix
                   5829:           &#8220;<span class="quote">.gz</span>&#8221; is
                   5830:           appended/removed automatically for manpages according to
                   5831:           <code class="varname">MANZ</code> and <code class=
                   5832:           "varname">MANCOMPRESSED</code> being set or not, see
                   5833:           above for details. This modification of the <code class=
                   5834:           "filename">PLIST</code> file is done on a copy of it, not
                   5835:           <code class="filename">PLIST</code> itself.</p>
1.1       grant    5836:         </div>
                   5837: 
                   5838:         <div class="sect1" lang="en" xml:lang="en">
                   5839:           <div class="titlepage">
                   5840:             <div>
                   5841:               <div>
                   5842:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  5843:                 "id2587169" id="id2587169"></a>8.6.&nbsp;Changing
1.14      xtraeme  5844:                 PLIST source with <code class=
                   5845:                 "varname">PLIST_SRC</code></h2>
1.1       grant    5846:               </div>
                   5847:             </div>
                   5848:           </div>
                   5849: 
1.14      xtraeme  5850:           <p>To use one or more files as source for the
                   5851:           <code class="filename">PLIST</code> used in generating
                   5852:           the binary package, set the variable <code class=
                   5853:           "varname">PLIST_SRC</code> to the names of that file(s).
1.1       grant    5854:           The files are later concatenated using cat(1), and order
                   5855:           of things is important.</p>
                   5856:         </div>
                   5857: 
                   5858:         <div class="sect1" lang="en" xml:lang="en">
                   5859:           <div class="titlepage">
                   5860:             <div>
                   5861:               <div>
                   5862:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  5863:                 "id2587322" id="id2587322"></a>8.7.&nbsp;Platform
1.1       grant    5864:                 specific and differing PLISTs</h2>
                   5865:               </div>
                   5866:             </div>
                   5867:           </div>
                   5868: 
                   5869:           <p>Some packages decide to install a different set of
                   5870:           files based on the operating system being used. These
                   5871:           differences can be automatically handled by using the
                   5872:           following files:</p>
                   5873: 
                   5874:           <div class="itemizedlist">
                   5875:             <ul type="disc">
                   5876:               <li>
1.14      xtraeme  5877:                 <p><code class="filename">PLIST.common</code></p>
1.1       grant    5878:               </li>
                   5879: 
                   5880:               <li>
1.14      xtraeme  5881:                 <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1       grant    5882:               </li>
                   5883: 
                   5884:               <li>
1.14      xtraeme  5885:                 <p><code class=
                   5886:                 "filename">PLIST.common_end</code></p>
1.1       grant    5887:               </li>
                   5888:             </ul>
                   5889:           </div>
                   5890: 
1.14      xtraeme  5891:           <p>If <code class="filename">PLIST.${OPSYS}</code>
                   5892:           exists, these files are used instead of <code class=
                   5893:           "filename">PLIST</code>. This allows packages which
                   5894:           behave in this way to be handled gracefully. Manually
                   5895:           overriding <code class="varname">PLIST_SRC</code> for
                   5896:           other more exotic uses is also possible.</p>
1.1       grant    5897:         </div>
                   5898: 
                   5899:         <div class="sect1" lang="en" xml:lang="en">
                   5900:           <div class="titlepage">
                   5901:             <div>
                   5902:               <div>
                   5903:                 <h2 class="title" style="clear: both"><a name=
                   5904:                 "faq.common-dirs" id=
                   5905:                 "faq.common-dirs"></a>8.8.&nbsp;Sharing directories
                   5906:                 between packages</h2>
                   5907:               </div>
                   5908:             </div>
                   5909:           </div>
                   5910: 
                   5911:           <p>A &#8220;<span class="quote">shared
                   5912:           directory</span>&#8221; is a directory where multiple
                   5913:           (and unrelated) packages install files. These directories
                   5914:           are problematic because you have to add special tricks in
                   5915:           the PLIST to conditionally remove them, or have some
                   5916:           centralized package handle them.</p>
                   5917: 
                   5918:           <p>Within pkgsrc, you'll find both approaches. If a
                   5919:           directory is shared by a few unrelated packages, it's
                   5920:           often not worth to add an extra package to remove it.
                   5921:           Therefore, one simply does:</p>
                   5922:           <pre class="programlisting">
                   5923:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   5924:     
                   5925: </pre>
                   5926: 
                   5927:           <p>in the PLISTs of all affected packages, instead of the
                   5928:           regular "@dirrm" line.</p>
                   5929: 
                   5930:           <p>However, if the directory is shared across many
                   5931:           packages, two different solutions are available:</p>
                   5932: 
                   5933:           <div class="orderedlist">
                   5934:             <ol type="1">
                   5935:               <li>
                   5936:                 <p>If the packages have a common dependency, the
                   5937:                 directory can be removed in that. For example, see
                   5938:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5939:                 href=
                   5940:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.19    ! hubertf  5941:                    class="pkgname">textproc/scrollkeeper</a>, which
        !          5942:                    removes the shared directory <code class=
        !          5943:                    "filename">share/omf</code>.</p>
1.1       grant    5944:               </li>
                   5945: 
                   5946:               <li>
                   5947:                 <p>If the packages using the directory are not
                   5948:                 related at all (they have no common dependencies),
                   5949:                 a *-dirs package is used.</p>
                   5950:               </li>
                   5951:             </ol>
                   5952:           </div>
                   5953: 
                   5954:           <p>From now on, we'll discuss the second solution. To get
                   5955:           an idea of the *-dirs packages available, issue:</p>
                   5956:           <pre class="programlisting">
1.14      xtraeme  5957:       <code class="prompt">%</code> cd .../pkgsrc
                   5958:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    5959:     
                   5960: </pre>
                   5961: 
                   5962:           <p>Their use from other packages is very simple. The
1.14      xtraeme  5963:           <code class="varname">USE_DIRS</code> variable takes a
                   5964:           list of package names (without the &#8220;<span class=
1.1       grant    5965:           "quote">-dirs</span>&#8221; part) together with the
                   5966:           required version number (always pick the latest one when
                   5967:           writting new packages).</p>
                   5968: 
                   5969:           <p>For example, if a package installs files under
1.14      xtraeme  5970:           <code class="filename">share/applications</code>, it
                   5971:           should have the following line in it:</p>
1.1       grant    5972:           <pre class="programlisting">
                   5973:       USE_DIRS+= xdg-1.1
                   5974:     
                   5975: </pre>
                   5976: 
1.14      xtraeme  5977:           <p>After regenerating the PLIST using
                   5978:           <span><strong class="command">make
                   5979:           print-PLIST</strong></span>, you should get the right
                   5980:           (commented out) lines.</p>
1.1       grant    5981: 
1.14      xtraeme  5982:           <p>Note that, even if your package is using <code class=
                   5983:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    5984:           *-x11-dirs packages. Just specify the name without that
1.14      xtraeme  5985:           part and pkgsrc (in particular, <code class=
                   5986:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    5987:         </div>
                   5988:       </div>
                   5989: 
                   5990:       <div class="chapter" lang="en" xml:lang="en">
                   5991:         <div class="titlepage">
                   5992:           <div>
                   5993:             <div>
                   5994:               <h2 class="title"><a name="buildlink" id=
                   5995:               "buildlink"></a>Chapter&nbsp;9.&nbsp;Buildlink
                   5996:               methodology</h2>
                   5997:             </div>
                   5998:           </div>
                   5999:         </div>
                   6000: 
                   6001:         <div class="toc">
                   6002:           <p><b>Table of Contents</b></p>
                   6003: 
                   6004:           <dl>
1.19    ! hubertf  6005:             <dt><span class="sect1"><a href="#id2587526">9.1.
1.1       grant    6006:             Converting packages to use buildlink3</a></span></dt>
                   6007: 
1.19    ! hubertf  6008:             <dt><span class="sect1"><a href="#id2587785">9.2.
1.14      xtraeme  6009:             Writing <code class="filename">buildlink3.mk</code>
                   6010:             files</a></span></dt>
1.1       grant    6011: 
                   6012:             <dd>
                   6013:               <dl>
1.19    ! hubertf  6014:                 <dt><span class="sect2"><a href="#id2587854">9.2.1.
1.1       grant    6015:                 Anatomy of a buildlink3.mk file</a></span></dt>
                   6016: 
1.19    ! hubertf  6017:                 <dt><span class="sect2"><a href="#id2588295">9.2.2.
1.14      xtraeme  6018:                 Updating <code class=
                   6019:                 "varname">BUILDLINK_DEPENDS.<em class=
                   6020:                 "replaceable"><code>pkg</code></em></code> in
                   6021:                 <code class="filename">buildlink3.mk</code>
1.1       grant    6022:                 files</a></span></dt>
                   6023:               </dl>
                   6024:             </dd>
                   6025: 
1.19    ! hubertf  6026:             <dt><span class="sect1"><a href="#id2588442">9.3.
1.14      xtraeme  6027:             Writing <code class="filename">builtin.mk</code>
                   6028:             files</a></span></dt>
1.1       grant    6029: 
                   6030:             <dd>
                   6031:               <dl>
1.19    ! hubertf  6032:                 <dt><span class="sect2"><a href="#id2588523">9.3.1.
1.14      xtraeme  6033:                 Anatomy of a <code class=
                   6034:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    6035: 
1.19    ! hubertf  6036:                 <dt><span class="sect2"><a href="#id2588819">9.3.2.
1.1       grant    6037:                 Global preferences for native or pkgsrc
                   6038:                 software</a></span></dt>
                   6039:               </dl>
                   6040:             </dd>
                   6041:           </dl>
                   6042:         </div>
                   6043: 
                   6044:         <p>Buildlink is a framework in pkgsrc that controls what
                   6045:         headers and libraries are seen by a package's configure and
                   6046:         build processes. This is implemented in a two step
                   6047:         process:</p>
                   6048: 
                   6049:         <div class="orderedlist">
                   6050:           <ol type="1">
                   6051:             <li>
                   6052:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  6053:               into <code class="varname">BUILDLINK_DIR</code>,
                   6054:               which by default is a subdirectory of <code class=
                   6055:               "varname">WRKDIR</code>.</p>
1.1       grant    6056:             </li>
                   6057: 
                   6058:             <li>
                   6059:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  6060:               the normal compiler tools that translate <code class=
                   6061:               "option">-I${LOCALBASE}/include</code> and
                   6062:               <code class="option">-L${LOCALBASE}/lib</code> into
                   6063:               references to <code class=
                   6064:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   6065:               also make native compiler on some operating systems
                   6066:               look like GCC, so that packages that expect GCC won't
                   6067:               require modifications to build with those native
                   6068:               compilers.</p>
1.1       grant    6069:             </li>
                   6070:           </ol>
                   6071:         </div>
                   6072: 
                   6073:         <p>This normalizes the environment in which a package is
                   6074:         built so that the package may be built consistently despite
                   6075:         what other software may be installed. Please note that the
1.14      xtraeme  6076:         normal system header and library paths, e.g. <code class=
                   6077:         "filename">/usr/include</code>, <code class=
                   6078:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    6079:         buildlink3 is designed to insulate the package build from
                   6080:         non-system-supplied software.</p>
                   6081: 
                   6082:         <div class="sect1" lang="en" xml:lang="en">
                   6083:           <div class="titlepage">
                   6084:             <div>
                   6085:               <div>
                   6086:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  6087:                 "id2587526" id="id2587526"></a>9.1.&nbsp;Converting
1.1       grant    6088:                 packages to use buildlink3</h2>
                   6089:               </div>
                   6090:             </div>
                   6091:           </div>
                   6092: 
                   6093:           <p>The process of converting packages to use the
                   6094:           buildlink3 framework (&#8220;<span class=
                   6095:           "quote">bl3ifying</span>&#8221;) is fairly
                   6096:           straightforward. The things to keep in mind are:</p>
                   6097: 
                   6098:           <div class="orderedlist">
                   6099:             <ol type="1">
                   6100:               <li>
1.14      xtraeme  6101:                 <p>Set <code class="varname">USE_BUILDLINK3</code>
                   6102:                 to &#8220;<span class=
                   6103:                 "quote">yes</span>&#8221;.</p>
1.1       grant    6104:               </li>
                   6105: 
                   6106:               <li>
                   6107:                 <p>Ensure that the build always calls the wrapper
                   6108:                 scripts instead of the actual toolchain. Some
                   6109:                 packages are tricky, and the only way to know for
1.14      xtraeme  6110:                 sure is the check <code class=
                   6111:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    6112:                 wrappers are being invoked.</p>
                   6113:               </li>
                   6114: 
                   6115:               <li>
1.14      xtraeme  6116:                 <p>Don't override <code class=
                   6117:                 "varname">PREFIX</code> from within the package
                   6118:                 Makefile, e.g. Java VMs, standalone shells, etc.,
                   6119:                 because the code to symlink files into <code class=
                   6120:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    6121:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  6122:                 <em class=
                   6123:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    6124:               </li>
                   6125: 
                   6126:               <li>
                   6127:                 <p>Remember that <span class=
1.14      xtraeme  6128:                 "emphasis"><em>only</em></span> the <code class=
                   6129:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    6130:                 in a package's Makefile are added as dependencies
                   6131:                 for that package.</p>
                   6132:               </li>
                   6133:             </ol>
                   6134:           </div>
                   6135: 
                   6136:           <p>If a dependency on a particular package is required
                   6137:           for its libraries and headers, then we replace:</p>
                   6138:           <pre class="programlisting">
                   6139: DEPENDS+=       foo&gt;=1.1.0:../../category/foo
                   6140: </pre>
                   6141: 
                   6142:           <p>with</p>
                   6143:           <pre class="programlisting">
                   6144: .include "../../category/foo/buildlink3.mk"
                   6145: </pre>
                   6146: 
1.14      xtraeme  6147:           <p>There are several <code class=
                   6148:           "filename">buildlink3.mk</code> files in <code class=
                   6149:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    6150:           issues:</p>
                   6151: 
                   6152:           <div class="itemizedlist">
                   6153:             <ul type="disc">
                   6154:               <li>
1.14      xtraeme  6155:                 <p><code class="filename">bdb.buildlink3.mk</code>
1.1       grant    6156:                 chooses either the native or a pkgsrc Berkeley DB
1.14      xtraeme  6157:                 implementation based on the values of <code class=
                   6158:                 "varname">BDB_ACCEPTED</code> and <code class=
                   6159:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    6160:               </li>
                   6161: 
                   6162:               <li>
1.14      xtraeme  6163:                 <p><code class=
                   6164:                 "filename">curses.buildlink3.mk</code> If the
                   6165:                 system comes with neither Curses nor NCurses, this
                   6166:                 will take care to install the <a xmlns=
                   6167:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    6168:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.19    ! hubertf  6169:                    class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    6170:               </li>
                   6171: 
                   6172:               <li>
1.14      xtraeme  6173:                 <p><code class="filename">krb5.buildlink3.mk</code>
                   6174:                 uses the value of <code class=
                   6175:                 "varname">KRB5_ACCEPTED</code> to choose between
1.1       grant    6176:                 adding a dependency on Heimdal or MIT-krb5 for
                   6177:                 packages that require a Kerberos 5
                   6178:                 implementation.</p>
                   6179:               </li>
                   6180: 
                   6181:               <li>
1.14      xtraeme  6182:                 <p><code class=
                   6183:                 "filename">motif.buildlink3.mk</code> checks for a
                   6184:                 system-provided Motif installation or adds a
                   6185:                 dependency on <a xmlns=
1.1       grant    6186:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6187:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.19    ! hubertf  6188:                    class="pkgname">x11/lesstif</a> or <a xmlns=
        !          6189:                    "http://www.w3.org/TR/xhtml1/transitional" href=
        !          6190:                    "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
        !          6191:                    class="pkgname">x11/openmotif</a>;</p>
1.1       grant    6192:               </li>
                   6193: 
                   6194:               <li>
1.14      xtraeme  6195:                 <p><code class=
                   6196:                 "filename">ossaudio.buildlink3.mk</code> defines
                   6197:                 several variables that may be used by packages that
                   6198:                 use the Open Sound System (OSS) API;</p>
1.1       grant    6199:               </li>
                   6200: 
                   6201:               <li>
1.14      xtraeme  6202:                 <p><code class=
                   6203:                 "filename">pgsql.buildlink3.mk</code> will accept
                   6204:                 either Postgres 7.3 or 7.4, whichever is found
                   6205:                 installed. See the file for more information.</p>
1.1       grant    6206:               </li>
                   6207: 
                   6208:               <li>
1.14      xtraeme  6209:                 <p><code class=
                   6210:                 "filename">pthread.buildlink3.mk</code> uses the
                   6211:                 value of <code class="varname">PTHREAD_OPTS</code>
                   6212:                 and checks for native pthreads or adds a dependency
                   6213:                 on <a xmlns=
1.1       grant    6214:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6215:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.19    ! hubertf  6216:                    class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    6217:               </li>
                   6218: 
                   6219:               <li>
1.14      xtraeme  6220:                 <p><code class="filename">xaw.buildlink3.mk</code>
                   6221:                 uses the value of <code class=
                   6222:                 "varname">XAW_TYPE</code> to choose a particular
                   6223:                 Athena widgets library.</p>
1.1       grant    6224:               </li>
                   6225:             </ul>
                   6226:           </div>
                   6227: 
1.14      xtraeme  6228:           <p>The comments in those <code class=
                   6229:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    6230:           complete description of how to use them properly.</p>
                   6231:         </div>
                   6232: 
                   6233:         <div class="sect1" lang="en" xml:lang="en">
                   6234:           <div class="titlepage">
                   6235:             <div>
                   6236:               <div>
                   6237:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  6238:                 "id2587785" id="id2587785"></a>9.2.&nbsp;Writing
1.14      xtraeme  6239:                 <code class="filename">buildlink3.mk</code>
                   6240:                 files</h2>
1.1       grant    6241:               </div>
                   6242:             </div>
                   6243:           </div>
                   6244: 
1.14      xtraeme  6245:           <p>A package's <code class=
                   6246:           "filename">buildlink3.mk</code> file is included by
                   6247:           Makefiles to indicate the need to compile and link
                   6248:           against header files and libraries provided by the
                   6249:           package. A <code class="filename">buildlink3.mk</code>
                   6250:           file should always provide enough information to add the
                   6251:           correct type of dependency relationship and include any
                   6252:           other <code class="filename">buildlink3.mk</code> files
                   6253:           that it needs to find headers and libraries that it needs
                   6254:           in turn.</p>
1.1       grant    6255: 
1.14      xtraeme  6256:           <p>To generate an initial <code class=
                   6257:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    6258:           Rene Hexel's <a xmlns=
                   6259:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6260:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.19    ! hubertf  6261:              class="pkgname">pkgtools/createbuildlink</a> package
        !          6262:              is highly recommended. For most packages, the
        !          6263:              following command will generate a good starting point
        !          6264:              for <code class="filename">buildlink3.mk</code>
        !          6265:              files:</p>
1.1       grant    6266:           <pre class="screen">
1.14      xtraeme  6267: <code class="prompt">%</code> <strong class=
                   6268: "userinput"><code>cd pkgsrc/<em class=
                   6269: "replaceable"><code>category</code></em>/<em class=
                   6270: "replaceable"><code>pkgdir</code></em>
                   6271: <code class=
                   6272: "prompt">%</code> createbuildlink -3 &gt;buildlink3.mk</code></strong>
1.1       grant    6273: </pre>
                   6274: 
                   6275:           <div class="sect2" lang="en" xml:lang="en">
                   6276:             <div class="titlepage">
                   6277:               <div>
                   6278:                 <div>
1.19    ! hubertf  6279:                   <h3 class="title"><a name="id2587854" id=
        !          6280:                   "id2587854"></a>9.2.1. Anatomy of a buildlink3.mk
1.1       grant    6281:                   file</h3>
                   6282:                 </div>
                   6283:               </div>
                   6284:             </div>
                   6285: 
1.14      xtraeme  6286:             <p>The following real-life example <code class=
                   6287:             "filename">buildlink3.mk</code> is taken from
                   6288:             <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    6289:             <pre class="programlisting">
1.17      sketch   6290: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    6291: 
                   6292: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   6293: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   6294: 
                   6295: .if !empty(BUILDLINK_DEPTH:M+)
                   6296: BUILDLINK_DEPENDS+=     tiff
                   6297: .endif
                   6298: 
                   6299: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   6300: BUILDLINK_PACKAGES+=    tiff
                   6301: 
                   6302: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   6303: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   6304: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   6305: .endif  # TIFF_BUILDLINK3_MK
                   6306: 
                   6307: .include "../../devel/zlib/buildlink3.mk"
                   6308: .include "../../graphics/jpeg/buildlink3.mk"
                   6309: 
                   6310: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   6311: </pre>
                   6312: 
1.14      xtraeme  6313:             <p>The header and footer manipulate <code class=
                   6314:             "varname">BUILDLINK_DEPTH</code>, which is common
                   6315:             across all <code class="filename">buildlink3.mk</code>
                   6316:             files and is used to track at what depth we are
                   6317:             including <code class="filename">buildlink3.mk</code>
                   6318:             files.</p>
1.1       grant    6319: 
                   6320:             <p>The first section controls if the dependency on
1.14      xtraeme  6321:             <em class="replaceable"><code>pkg</code></em> is added.
                   6322:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    6323:             global list of packages for which dependencies are
                   6324:             added by buildlink3.</p>
                   6325: 
                   6326:             <p>The second section advises pkgsrc that the
1.14      xtraeme  6327:             <code class="filename">buildlink3.mk</code> file for
                   6328:             <em class="replaceable"><code>pkg</code></em> has been
                   6329:             included at some point. <code class=
                   6330:             "varname">BUILDLINK_PACKAGES</code> is the global list
                   6331:             of packages for which <code class=
                   6332:             "filename">buildlink3.mk</code> files have been
                   6333:             included. It must <span class=
                   6334:             "emphasis"><em>always</em></span> be appended to within
                   6335:             a <code class="filename">buildlink3.mk</code> file.</p>
1.1       grant    6336: 
                   6337:             <p>The third section is protected from multiple
1.14      xtraeme  6338:             inclusion and controls how the dependency on <em class=
                   6339:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    6340:             important variables are set in the section:</p>
                   6341: 
                   6342:             <div class="itemizedlist">
                   6343:               <ul type="disc">
                   6344:                 <li>
1.14      xtraeme  6345:                   <p><code class=
                   6346:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6347:                   "replaceable"><code>pkg</code></em></code> is the
                   6348:                   actual dependency recorded in the installed
                   6349:                   package; this should always be set using
                   6350:                   <span><strong class="command">+=</strong></span>
                   6351:                   to ensure that we're appending to any
                   6352:                   pre-existing list of values. This variable should
                   6353:                   be set to the first version of the package that
                   6354:                   had the last change in the major number of a
                   6355:                   shared library or that had a major API
                   6356:                   change.</p>
1.1       grant    6357:                 </li>
                   6358: 
                   6359:                 <li>
1.14      xtraeme  6360:                   <p><code class=
                   6361:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   6362:                   "replaceable"><code>pkg</code></em></code> is the
                   6363:                   location of the <em class=
                   6364:                   "replaceable"><code>pkg</code></em> pkgsrc
1.1       grant    6365:                   directory;</p>
                   6366:                 </li>
                   6367: 
                   6368:                 <li>
1.14      xtraeme  6369:                   <p><code class=
                   6370:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6371:                   "replaceable"><code>pkg</code></em></code> (not
                   6372:                   shown above) controls whether we use <code class=
                   6373:                   "varname">BUILD_DEPENDS</code> or <code class=
                   6374:                   "varname">DEPENDS</code> to add the dependency on
                   6375:                   <em class="replaceable"><code>pkg</code></em>.
                   6376:                   The build dependency is selected by setting
                   6377:                   <code class=
                   6378:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6379:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    6380:                   &#8220;<span class="quote">build</span>&#8221;.
                   6381:                   By default, the full dependency is used.</p>
                   6382:                 </li>
                   6383: 
                   6384:                 <li>
1.14      xtraeme  6385:                   <p><code class=
                   6386:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6387:                   "replaceable"><code>pkg</code></em></code> and
                   6388:                   <code class=
                   6389:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
                   6390:                   <code>pkg</code></em></code> (not shown above)
                   6391:                   are lists of subdirectories of <code class=
                   6392:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6393:                   "replaceable"><code>pkg</code></em>}</code> to
                   6394:                   add to the header and library search paths. These
1.1       grant    6395:                   default to &#8220;<span class=
                   6396:                   "quote">include</span>&#8221; and
                   6397:                   &#8220;<span class="quote">lib</span>&#8221;
                   6398:                   respectively.</p>
                   6399:                 </li>
                   6400: 
                   6401:                 <li>
1.14      xtraeme  6402:                   <p><code class=
                   6403:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   6404:                   "replaceable"><code>pkg</code></em></code> (not
                   6405:                   shown above) is the list of preprocessor flags to
                   6406:                   add to <code class="varname">CPPFLAGS</code>,
                   6407:                   which are passed on to the configure and build
                   6408:                   phases. The &#8220;<span class=
                   6409:                   "quote">-I</span>&#8221; option should be avoided
                   6410:                   and instead be handled using <code class=
                   6411:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6412:                   "replaceable"><code>pkg</code></em></code> as
                   6413:                   above.</p>
1.1       grant    6414:                 </li>
                   6415:               </ul>
                   6416:             </div>
                   6417: 
                   6418:             <p>The following variables are all optionally defined
                   6419:             within this second section (protected against multiple
                   6420:             inclusion) and control which package files are
1.14      xtraeme  6421:             symlinked into <code class=
                   6422:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    6423:             are transformed during the symlinking:</p>
                   6424: 
                   6425:             <div class="itemizedlist">
                   6426:               <ul type="disc">
                   6427:                 <li>
1.14      xtraeme  6428:                   <p><code class=
                   6429:                   "varname">BUILDLINK_FILES.<em class=
                   6430:                   "replaceable"><code>pkg</code></em></code> (not
                   6431:                   shown above) is a shell glob pattern relative to
                   6432:                   <code class=
                   6433:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6434:                   "replaceable"><code>pkg</code></em>}</code> to be
                   6435:                   symlinked into <code class=
                   6436:                   "filename">${BUILDLINK_DIR}</code>, e.g.
                   6437:                   <code class="filename">include/*.h</code>.</p>
1.1       grant    6438:                 </li>
                   6439: 
                   6440:                 <li>
1.14      xtraeme  6441:                   <p><code class=
                   6442:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   6443:                   "replaceable"><code>pkg</code></em></code> (not
                   6444:                   shown above) is a shell pipeline that outputs to
                   6445:                   stdout a list of files relative to <code class=
                   6446:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6447:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    6448:                   resulting files are to be symlinked into
1.14      xtraeme  6449:                   <code class="filename">${BUILDLINK_DIR}</code>.
                   6450:                   By default, this takes the <code class=
                   6451:                   "filename">+CONTENTS</code> of a <em class=
                   6452:                   "replaceable"><code>pkg</code></em> and filters
                   6453:                   it through <code class=
                   6454:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   6455:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    6456:                 </li>
                   6457: 
                   6458:                 <li>
1.14      xtraeme  6459:                   <p><code class=
                   6460:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6461:                   "replaceable"><code>pkg</code></em></code> (not
                   6462:                   shown above) is a filter command that filters
                   6463:                   <code class="filename">+CONTENTS</code> input
                   6464:                   into a list of files relative to <code class=
                   6465:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6466:                   "replaceable"><code>pkg</code></em>}</code> on
                   6467:                   stdout. By default for overwrite packages,
                   6468:                   <code class=
                   6469:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6470:                   "replaceable"><code>pkg</code></em></code>
                   6471:                   outputs the contents of the <code class=
                   6472:                   "filename">include</code> and <code class=
                   6473:                   "filename">lib</code> directories in the package
                   6474:                   <code class="filename">+CONTENTS</code>, and for
                   6475:                   pkgviews packages, it outputs any libtool
                   6476:                   archives in <code class="filename">lib</code>
1.1       grant    6477:                   directories.</p>
                   6478:                 </li>
                   6479: 
                   6480:                 <li>
1.14      xtraeme  6481:                   <p><code class=
                   6482:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   6483:                   "replaceable"><code>pkg</code></em></code> (not
                   6484:                   shown above) is a list of sed arguments used to
1.1       grant    6485:                   transform the name of the source filename into a
1.14      xtraeme  6486:                   destination filename, e.g. <span><strong class=
1.1       grant    6487:                   "command">-e
1.14      xtraeme  6488:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    6489:                 </li>
                   6490:               </ul>
                   6491:             </div>
                   6492: 
1.14      xtraeme  6493:             <p>The last section includes any <code class=
                   6494:             "filename">buildlink3.mk</code> needed for <em class=
                   6495:             "replaceable"><code>pkg</code></em>'s library
                   6496:             dependencies. Including these <code class=
                   6497:             "filename">buildlink3.mk</code> files means that the
                   6498:             headers and libraries for these dependencies are also
                   6499:             symlinked into <code class=
                   6500:             "filename">${BUILDLINK_DIR}</code> whenever the
                   6501:             <em class="replaceable"><code>pkg</code></em>
                   6502:             <code class="filename">buildlink3.mk</code> file is
                   6503:             included.</p>
1.1       grant    6504:           </div>
                   6505: 
                   6506:           <div class="sect2" lang="en" xml:lang="en">
                   6507:             <div class="titlepage">
                   6508:               <div>
                   6509:                 <div>
1.19    ! hubertf  6510:                   <h3 class="title"><a name="id2588295" id=
        !          6511:                   "id2588295"></a>9.2.2. Updating <code class=
1.14      xtraeme  6512:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6513:                   "replaceable"><code>pkg</code></em></code> in
                   6514:                   <code class="filename">buildlink3.mk</code>
                   6515:                   files</h3>
1.1       grant    6516:                 </div>
                   6517:               </div>
                   6518:             </div>
                   6519: 
                   6520:             <p>There are two situations that require increasing the
1.14      xtraeme  6521:             dependency listed in <code class=
                   6522:             "varname">BUILDLINK_DEPENDS.<em class=
                   6523:             "replaceable"><code>pkg</code></em></code> after a
                   6524:             package update:</p>
1.1       grant    6525: 
                   6526:             <div class="orderedlist">
                   6527:               <ol type="1">
                   6528:                 <li>
                   6529:                   <p>if the sonames (major number of the library
                   6530:                   version) of any installed shared libraries
                   6531:                   change;</p>
                   6532:                 </li>
                   6533: 
                   6534:                 <li>
                   6535:                   <p>if the API or interface to the header files
                   6536:                   change.</p>
                   6537:                 </li>
                   6538:               </ol>
                   6539:             </div>
                   6540: 
1.14      xtraeme  6541:             <p>In these cases, <code class=
                   6542:             "varname">BUILDLINK_DEPENDS.<em class=
                   6543:             "replaceable"><code>pkg</code></em></code> should be
                   6544:             adjusted to require at least the new package version.
                   6545:             In some cases, the packages that depend on this new
                   6546:             version may need their <code class=
                   6547:             "varname">PKGREVISION</code>s increased and, if they
                   6548:             have <code class="filename">buildlink3.mk</code> files,
                   6549:             their <code class=
                   6550:             "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
                   6551:             pkg</code></em></code> adjusted, too. This is needed so
                   6552:             that binary packages made using it will require the
                   6553:             correct package dependency and not settle for an older
                   6554:             one which will not contain the necessary shared
                   6555:             libraries.</p>
1.1       grant    6556: 
                   6557:             <p>Please take careful consideration before adjusting
1.14      xtraeme  6558:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   6559:             "replaceable"><code>pkg</code></em></code> as we don't
                   6560:             want to cause unneeded package deletions and rebuilds.
                   6561:             In many cases, new versions of packages work just fine
                   6562:             with older dependencies. See <a href="#dependencies"
                   6563:             title="12.1.3.&nbsp;Handling dependencies">Section
                   6564:             12.1.3, &#8220;Handling dependencies&#8221;</a> and
                   6565:             <a href="#buildlink" title=
1.1       grant    6566:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter 9,
                   6567:             <i>Buildlink methodology</i></a> for more information
                   6568:             about dependencies on other packages, including the
1.14      xtraeme  6569:             <code class="varname">BUILDLINK_RECOMMENDED</code> and
                   6570:             <code class="varname">RECOMMENDED</code>
                   6571:             definitions.</p>
1.1       grant    6572:           </div>
                   6573:         </div>
                   6574: 
                   6575:         <div class="sect1" lang="en" xml:lang="en">
                   6576:           <div class="titlepage">
                   6577:             <div>
                   6578:               <div>
                   6579:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  6580:                 "id2588442" id="id2588442"></a>9.3.&nbsp;Writing
1.14      xtraeme  6581:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    6582:               </div>
                   6583:             </div>
                   6584:           </div>
                   6585: 
                   6586:           <p>Some packages in pkgsrc install headers and libraries
                   6587:           that coincide with headers and libraries present in the
1.14      xtraeme  6588:           base system. Aside from a <code class=
                   6589:           "filename">buildlink3.mk</code> file, these packages
                   6590:           should also include a <code class=
                   6591:           "filename">builtin.mk</code> file that includes the
                   6592:           necessary checks to decide whether using the built-in
                   6593:           software or the pkgsrc software is appropriate.</p>
1.1       grant    6594: 
                   6595:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  6596:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    6597: 
                   6598:           <div class="orderedlist">
                   6599:             <ol type="1">
                   6600:               <li>
1.14      xtraeme  6601:                 <p>It should set <code class=
                   6602:                 "varname">USE_BUILTIN.<em class=
                   6603:                 "replaceable"><code>pkg</code></em></code> to
                   6604:                 either &#8220;<span class="quote">yes</span>&#8221;
                   6605:                 or &#8220;<span class="quote">no</span>&#8221;
                   6606:                 after it is included.</p>
1.1       grant    6607:               </li>
                   6608: 
                   6609:               <li>
                   6610:                 <p>It should <span class=
                   6611:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  6612:                 <code class="varname">USE_BUILTIN.<em class=
                   6613:                 "replaceable"><code>pkg</code></em></code> which is
                   6614:                 already set before the <code class=
                   6615:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    6616:               </li>
                   6617: 
                   6618:               <li>
                   6619:                 <p>It should be written to allow multiple
                   6620:                 inclusion. This is <span class=
                   6621:                 "emphasis"><em>very</em></span> important and takes
1.14      xtraeme  6622:                 careful attention to <code class=
                   6623:                 "filename">Makefile</code> coding.</p>
1.1       grant    6624:               </li>
                   6625:             </ol>
                   6626:           </div>
                   6627: 
                   6628:           <div class="sect2" lang="en" xml:lang="en">
                   6629:             <div class="titlepage">
                   6630:               <div>
                   6631:                 <div>
1.19    ! hubertf  6632:                   <h3 class="title"><a name="id2588523" id=
        !          6633:                   "id2588523"></a>9.3.1.&nbsp;Anatomy of a
1.14      xtraeme  6634:                   <code class="filename">builtin.mk</code>
                   6635:                   file</h3>
1.1       grant    6636:                 </div>
                   6637:               </div>
                   6638:             </div>
                   6639: 
                   6640:             <p>The following is the recommended template for
                   6641:             builtin.mk files:</p>
                   6642:             <pre class="programlisting">
                   6643: .if !defined(IS_BUILTIN.foo)
                   6644: #
                   6645: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   6646: # genuinely exists in the system or not.
                   6647: #
                   6648: IS_BUILTIN.foo?=        no
                   6649: 
                   6650: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   6651: # version can be determined.
                   6652: #
                   6653: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   6654: BUILTIN_PKG.foo?=       foo-1.0
                   6655: .  endif
                   6656: .endif  # IS_BUILTIN.foo
                   6657: 
                   6658: .if !defined(USE_BUILTIN.foo)
                   6659: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   6660: .  if defined(BUILTIN_PKG.foo)
                   6661: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   6662: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   6663: USE_BUILTIN.foo!=                                                       \
                   6664:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   6665:               ${ECHO} "yes";                                            \
                   6666:       else                                                              \
                   6667:               ${ECHO} "no";                                             \
                   6668:       fi
                   6669: .      endif
                   6670: .    endfor
                   6671: .  endif
                   6672: .endif  # USE_BUILTIN.foo
                   6673: 
                   6674: CHECK_BUILTIN.foo?=     no
                   6675: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   6676: #
                   6677: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   6678: # "yes" or "no".
                   6679: #
                   6680: .endif  # CHECK_BUILTIN.foo
                   6681:       
                   6682: </pre>
                   6683: 
1.14      xtraeme  6684:             <p>The first section sets <code class=
                   6685:             "varname">IS_BUILTIN.<em class=
                   6686:             "replaceable"><code>pkg</code></em></code> depending on
                   6687:             if <em class="replaceable"><code>pkg</code></em> really
                   6688:             exists in the base system. This should not be a base
                   6689:             system software with similar functionality to
                   6690:             <em class="replaceable"><code>pkg</code></em>; it
                   6691:             should only be &#8220;<span class=
                   6692:             "quote">yes</span>&#8221; if the actual package is
                   6693:             included as part of the base system. This variable is
                   6694:             only used internally within the <code class=
                   6695:             "filename">builtin.mk</code> file.</p>
                   6696: 
                   6697:             <p>The second section sets <code class=
                   6698:             "varname">BUILTIN_PKG.<em class=
                   6699:             "replaceable"><code>pkg</code></em></code> to the
                   6700:             version of <em class=
                   6701:             "replaceable"><code>pkg</code></em> in the base system
                   6702:             if it exists (if <code class=
                   6703:             "varname">IS_BUILTIN.<em class=
                   6704:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6705:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  6706:             variable is only used internally within the
                   6707:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    6708: 
1.14      xtraeme  6709:             <p>The third section sets <code class=
                   6710:             "varname">USE_BUILTIN.<em class=
                   6711:             "replaceable"><code>pkg</code></em></code> and is
                   6712:             <span class="emphasis"><em>required</em></span> in all
                   6713:             <code class="filename">builtin.mk</code> files. The
                   6714:             code in this section must make the determination
                   6715:             whether the built-in software is adequate to satisfy
                   6716:             the dependencies listed in <code class=
                   6717:             "varname">BUILDLINK_DEPENDS.<em class=
                   6718:             "replaceable"><code>pkg</code></em></code>. This is
                   6719:             typically done by comparing <code class=
                   6720:             "varname">BUILTIN_PKG.<em class=
                   6721:             "replaceable"><code>pkg</code></em></code> against each
                   6722:             of the dependencies in <code class=
                   6723:             "varname">BUILDLINK_DEPENDS.<em class=
                   6724:             "replaceable"><code>pkg</code></em></code>.
                   6725:             <code class="varname">USE_BUILTIN.<em class=
                   6726:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    6727:             "emphasis"><em>must</em></span> be set to the correct
1.14      xtraeme  6728:             value by the end of the <code class=
                   6729:             "filename">builtin.mk</code> file. Note that
                   6730:             <code class="varname">USE_BUILTIN.<em class=
                   6731:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    6732:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  6733:             <code class="varname">IS_BUILTIN.<em class=
                   6734:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6735:             &#8220;<span class="quote">no</span>&#8221; because we
                   6736:             may make the determination that the built-in version of
                   6737:             the software is similar enough to be used as a
                   6738:             replacement.</p>
                   6739: 
1.14      xtraeme  6740:             <p>The last section is guarded by <code class=
                   6741:             "varname">CHECK_BUILTIN.<em class=
                   6742:             "replaceable"><code>pkg</code></em></code>, and
                   6743:             includes code that uses the value of <code class=
                   6744:             "varname">USE_BUILTIN.<em class=
                   6745:             "replaceable"><code>pkg</code></em></code> set in the
                   6746:             previous section. This typically includes, e.g., adding
1.1       grant    6747:             additional dependency restrictions and listing
1.14      xtraeme  6748:             additional files to symlink into <code class=
                   6749:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   6750:             "varname">BUILDLINK_FILES.<em class=
                   6751:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    6752:           </div>
                   6753: 
                   6754:           <div class="sect2" lang="en" xml:lang="en">
                   6755:             <div class="titlepage">
                   6756:               <div>
                   6757:                 <div>
1.19    ! hubertf  6758:                   <h3 class="title"><a name="id2588819" id=
        !          6759:                   "id2588819"></a>9.3.2.&nbsp;Global preferences
1.1       grant    6760:                   for native or pkgsrc software</h3>
                   6761:                 </div>
                   6762:               </div>
                   6763:             </div>
                   6764: 
                   6765:             <p>When building packages, it's possible to choose
                   6766:             whether to set a global preference for using either the
                   6767:             built-in (native) version or the pkgsrc version of
                   6768:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  6769:             setting <code class="varname">PREFER_PKGSRC</code> and
                   6770:             <code class="varname">PREFER_NATIVE</code>. These
                   6771:             variables take values of either &#8220;<span class=
1.1       grant    6772:             "quote">yes</span>&#8221;, &#8220;<span class=
                   6773:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  6774:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   6775:             to use the pkgsrc versions of software, while
                   6776:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   6777:             to use the built-in versions. Preferences are
                   6778:             determined by the most specific instance of the package
                   6779:             in either <code class="varname">PREFER_PKGSRC</code> or
                   6780:             <code class="varname">PREFER_NATIVE</code>. If a
                   6781:             package is specified in neither or in both variables,
                   6782:             then <code class="varname">PREFER_PKGSRC</code> has
                   6783:             precedence over <code class=
                   6784:             "varname">PREFER_NATIVE</code>. For example, to require
                   6785:             using pkgsrc versions of software for all but the most
                   6786:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    6787:             <pre class="programlisting">
                   6788:         PREFER_PKGSRC=  yes
                   6789:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   6790:       
                   6791: </pre>
                   6792: 
                   6793:             <p>A package <span class=
1.14      xtraeme  6794:             "emphasis"><em>must</em></span> have a <code class=
                   6795:             "filename">builtin.mk</code> file to be listed in
                   6796:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   6797:             it is simply ignored in that list.</p>
1.1       grant    6798:           </div>
                   6799:         </div>
                   6800:       </div>
                   6801: 
                   6802:       <div class="chapter" lang="en" xml:lang="en">
                   6803:         <div class="titlepage">
                   6804:           <div>
                   6805:             <div>
                   6806:               <h2 class="title"><a name="options" id=
                   6807:               "options"></a>Chapter&nbsp;10.&nbsp;Options
                   6808:               handling</h2>
                   6809:             </div>
                   6810:           </div>
                   6811:         </div>
                   6812: 
                   6813:         <div class="toc">
                   6814:           <p><b>Table of Contents</b></p>
                   6815: 
                   6816:           <dl>
1.19    ! hubertf  6817:             <dt><span class="sect1"><a href="#id2588960">10.1.
1.1       grant    6818:             Global default options</a></span></dt>
                   6819: 
1.19    ! hubertf  6820:             <dt><span class="sect1"><a href="#id2588974">10.2.
1.14      xtraeme  6821:             Converting packages to use <code class=
                   6822:             "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    6823:           </dl>
                   6824:         </div>
                   6825: 
                   6826:         <p>Many packages have the ability to be built to support
1.14      xtraeme  6827:         different sets of features. <code class=
                   6828:         "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1       grant    6829:         that provides generic handling of those options that
                   6830:         determine different ways in which the packages can be
                   6831:         built. It's possible for the user to specify exactly which
                   6832:         sets of options will be built into a package or to allow a
                   6833:         set of global default options apply.</p>
                   6834: 
                   6835:         <div class="sect1" lang="en" xml:lang="en">
                   6836:           <div class="titlepage">
                   6837:             <div>
                   6838:               <div>
                   6839:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  6840:                 "id2588960" id="id2588960"></a>10.1.&nbsp;Global
1.1       grant    6841:                 default options</h2>
                   6842:               </div>
                   6843:             </div>
                   6844:           </div>
                   6845: 
1.14      xtraeme  6846:           <p>Global default options are listed in <code class=
                   6847:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1       grant    6848:           the options that should be built into every package if
                   6849:           that option is supported. This variable should be set in
1.14      xtraeme  6850:           <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    6851:         </div>
                   6852: 
                   6853:         <div class="sect1" lang="en" xml:lang="en">
                   6854:           <div class="titlepage">
                   6855:             <div>
                   6856:               <div>
                   6857:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  6858:                 "id2588974" id=
        !          6859:                 "id2588974"></a>10.2.&nbsp;Converting packages to
1.14      xtraeme  6860:                 use <code class=
                   6861:                 "filename">bsd.options.mk</code></h2>
1.1       grant    6862:               </div>
                   6863:             </div>
                   6864:           </div>
                   6865: 
1.14      xtraeme  6866:           <p>The following example shows how <code class=
                   6867:           "filename">bsd.options.mk</code> should be use in a
                   6868:           package <code class="filename">Makefile</code>, or in a
                   6869:           file, e.g. <code class="filename">options.mk</code>, that
                   6870:           is included by the main package <code class=
                   6871:           "filename">Makefile</code>.</p>
1.1       grant    6872:           <pre class="programlisting">
                   6873: # Global and legacy options
                   6874: .if defined(WIBBLE_USE_OPENLDAP) &amp;&amp; !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
                   6875: PKG_DEFAULT_OPTIONS+=   ldap
                   6876: .endif
                   6877: .if defined(USE_SASL2) &amp;&amp; !empty(USE_SASL2:M[yY][eE][sS])
                   6878: PKG_DEFAULT_OPTIONS+=   sasl
                   6879: .endif
                   6880: 
                   6881: PKG_OPTIONS_VAR=        PKG_OPTIONS.wibble
                   6882: PKG_SUPPORTED_OPTIONS=  ldap sasl
                   6883: #
                   6884: # Default options for "wibble" package.
                   6885: #
                   6886: .if !defined(PKG_OPTIONS.wibble)
                   6887: PKG_DEFAULT_OPTIONS+=   sasl
                   6888: endif
                   6889: .include "../../mk/bsd.options.mk"
                   6890: 
                   6891: # Package-specific option-handling
                   6892: 
                   6893: ###
                   6894: ### LDAP support
                   6895: ###
                   6896: .if !empty(PKG_OPTIONS:Mldap)
                   6897: .  include "../../databases/openldap/buildlink3.mk"
                   6898: CONFIGURE_ARGS+=      --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   6899: .endif
                   6900: 
                   6901: ###
                   6902: ### SASL authentication
                   6903: ###
                   6904: .if !empty(PKG_OPTIONS:Msasl)
                   6905: .  include "../../security/cyrus-sasl2/buildlink3.mk"
                   6906: CONFIGURE_ARGS+=        --enable-sasl=${BUILDLINK_PREFIX.sasl}
                   6907: .endif
                   6908:       
                   6909: </pre>
                   6910: 
                   6911:           <p>The first section only exists if you are converting a
                   6912:           package that had its own ad-hoc options handling to use
1.14      xtraeme  6913:           <code class="filename">bsd.options.mk</code>. It converts
1.1       grant    6914:           global or legacy options variables into an equivalent
1.14      xtraeme  6915:           <code class="varname">PKG_OPTIONS.<em class=
                   6916:           "replaceable"><code>pkg</code></em></code> value. These
                   6917:           sections will be removed over time as the old options are
                   6918:           in turn deprecated and removed.</p>
1.1       grant    6919: 
                   6920:           <p>The second section contains the information about
                   6921:           which build options are supported by the package, and any
                   6922:           default options settings if needed.</p>
                   6923: 
                   6924:           <div class="orderedlist">
                   6925:             <ol type="1">
                   6926:               <li>
1.14      xtraeme  6927:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
                   6928:                 a list of the name of the <a href=
1.1       grant    6929:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6930:                 <span class="citerefentry"><span class=
                   6931:                 "refentrytitle">make</span>(1)</span></a> variables
                   6932:                 that contain the options the user wishes to select.
                   6933:                 The recommended value is &#8220;<span class=
1.14      xtraeme  6934:                 "quote">PKG_OPTIONS.<em class=
                   6935:                 "replaceable"><code>pkg</code></em></span>&#8221;
                   6936:                 but any package-specific value may be used. This
1.1       grant    6937:                 variable should be set in a package Makefile.</p>
                   6938:               </li>
                   6939: 
                   6940:               <li>
1.14      xtraeme  6941:                 <p><code class=
                   6942:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
                   6943:                 build options supported by the package. This
                   6944:                 variable should be set in a package Makefile.</p>
1.1       grant    6945:               </li>
                   6946: 
                   6947:               <li>
1.14      xtraeme  6948:                 <p><code class="varname">${PKG_OPTIONS_VAR}</code>
                   6949:                 (the variables named in <code class=
                   6950:                 "varname">PKG_OPTIONS_VAR</code>) are variables
                   6951:                 that list the selected build options and override
                   6952:                 any default options given in <code class=
                   6953:                 "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1       grant    6954:                 options begin with a &#8220;<span class=
                   6955:                 "quote">-</span>&#8221;, then that option is always
                   6956:                 removed from the selected build options, e.g.</p>
                   6957:                 <pre class="programlisting">
                   6958:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   6959:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6960:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
                   6961:         # implies PKG_OPTIONS == "kerberos ldap"
                   6962:           
                   6963: </pre>
                   6964: 
                   6965:                 <p>or</p>
                   6966:                 <pre class="programlisting">
                   6967:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6968:         WIBBLE_OPTIONS=         kerberos -ldap ldap
                   6969:         # implies PKG_OPTIONS == "kerberos"
                   6970:           
                   6971: </pre>
                   6972: 
1.14      xtraeme  6973:                 <p>This variable should be set in <code class=
                   6974:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    6975:               </li>
                   6976:             </ol>
                   6977:           </div>
                   6978: 
                   6979:           <p>After the inclusion of bsd.options.mk, the following
                   6980:           variables are set:</p>
                   6981: 
                   6982:           <div class="itemizedlist">
                   6983:             <ul type="disc">
                   6984:               <li>
1.14      xtraeme  6985:                 <p><code class="varname">PKG_OPTIONS</code>
                   6986:                 contains the list of the selected build options,
                   6987:                 properly filtered to remove unsupported and
                   6988:                 duplicate options.</p>
1.1       grant    6989:               </li>
                   6990:             </ul>
                   6991:           </div>
                   6992: 
                   6993:           <p>The remaining sections contain the logic that is
                   6994:           specific to each option. There should be a check for
1.14      xtraeme  6995:           every option listed in <code class=
                   6996:           "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
                   6997:           be clear documentation on what turning on the option will
                   6998:           do in the comments preceding each section. The correct
                   6999:           way to check for an option is to check whether it is
                   7000:           listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1       grant    7001:         </div>
                   7002:       </div>
                   7003: 
                   7004:       <div class="chapter" lang="en" xml:lang="en">
                   7005:         <div class="titlepage">
                   7006:           <div>
                   7007:             <div>
                   7008:               <h2 class="title"><a name="build" id=
                   7009:               "build"></a>Chapter&nbsp;11.&nbsp;The build
                   7010:               process</h2>
                   7011:             </div>
                   7012:           </div>
                   7013:         </div>
                   7014: 
                   7015:         <div class="toc">
                   7016:           <p><b>Table of Contents</b></p>
                   7017: 
                   7018:           <dl>
                   7019:             <dt><span class="sect1"><a href="#build.prefix">11.1.
                   7020:             Program location</a></span></dt>
                   7021: 
1.19    ! hubertf  7022:             <dt><span class="sect1"><a href="#id2589582">11.2. Main
1.1       grant    7023:             targets</a></span></dt>
                   7024: 
                   7025:             <dt><span class="sect1"><a href=
                   7026:             "#build.helpful-targets">11.3. Other helpful
                   7027:             targets</a></span></dt>
                   7028:           </dl>
                   7029:         </div>
                   7030: 
                   7031:         <p>The basic steps for building a program are always the
                   7032:         same. First the program's source (<span class=
                   7033:         "emphasis"><em>distfile</em></span>) must be brought to the
                   7034:         local system and then extracted. After any patches to
                   7035:         compile properly on NetBSD are applied, the software can be
                   7036:         configured, then built (usually by compiling), and finally
                   7037:         the generated binaries, etc. can be put into place on the
                   7038:         system. These are exactly the steps performed by the NetBSD
                   7039:         package system, which is implemented as a series of targets
1.14      xtraeme  7040:         in a central Makefile, <code class=
                   7041:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    7042: 
                   7043:         <div class="sect1" lang="en" xml:lang="en">
                   7044:           <div class="titlepage">
                   7045:             <div>
                   7046:               <div>
                   7047:                 <h2 class="title" style="clear: both"><a name=
                   7048:                 "build.prefix" id=
                   7049:                 "build.prefix"></a>11.1.&nbsp;Program location</h2>
                   7050:               </div>
                   7051:             </div>
                   7052:           </div>
                   7053: 
                   7054:           <p>Before outlining the process performed by the NetBSD
                   7055:           package system in the next section, here's a brief
                   7056:           discussion on where programs are installed, and which
                   7057:           variables influence this.</p>
                   7058: 
1.14      xtraeme  7059:           <p>The automatic variable <code class=
                   7060:           "varname">PREFIX</code> indicates where all files of the
                   7061:           final program shall be installed. It is usually set to
                   7062:           <code class="varname">LOCALBASE</code> (<code class=
                   7063:           "filename">/usr/pkg</code>), or <code class=
                   7064:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    7065:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  7066:           The value of <code class="varname">PREFIX</code> needs to
                   7067:           be put into the various places in the program's source
                   7068:           where paths to these files are encoded. See <a href=
1.1       grant    7069:           "#components.patches" title=
                   7070:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   7071:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   7072:           title=
                   7073:           "12.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;12.3.1,
                   7074:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   7075:           details.</p>
                   7076: 
                   7077:           <p>When choosing which of these variables to use, follow
                   7078:           the following rules:</p>
                   7079: 
                   7080:           <div class="itemizedlist">
                   7081:             <ul type="disc">
                   7082:               <li>
1.14      xtraeme  7083:                 <p><code class="varname">PREFIX</code> always
                   7084:                 points to the location where the current pkg will
                   7085:                 be installed. When referring to a pkg's own
1.1       grant    7086:                 installation path, use &#8220;<span class=
                   7087:                 "quote">${PREFIX}</span>&#8221;.</p>
                   7088:               </li>
                   7089: 
                   7090:               <li>
1.14      xtraeme  7091:                 <p><code class="varname">LOCALBASE</code> is where
                   7092:                 all non-X11 pkgs are installed. If you need to
1.1       grant    7093:                 construct a -I or -L argument to the compiler to
                   7094:                 find includes and libraries installed by another
                   7095:                 non-X11 pkg, use &#8220;<span class=
                   7096:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   7097:               </li>
                   7098: 
                   7099:               <li>
1.14      xtraeme  7100:                 <p><code class="varname">X11BASE</code> is where
                   7101:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    7102:                 installed. When looking for <span class=
                   7103:                 "emphasis"><em>standard</em></span> X11 includes
                   7104:                 (not those installed by a pkg), use
                   7105:                 &#8220;<span class=
                   7106:                 "quote">${X11BASE}</span>&#8221;.</p>
                   7107:               </li>
                   7108: 
                   7109:               <li>
                   7110:                 <p>X11 based are special in that they may be
1.14      xtraeme  7111:                 installed in either <code class=
                   7112:                 "varname">X11BASE</code> or <code class=
                   7113:                 "varname">LOCALBASE</code>.</p>
1.1       grant    7114: 
                   7115:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  7116:                 <code class="varname">LOCALBASE</code> whenever
                   7117:                 possible. Note that you will need to set
                   7118:                 <code class="varname">USE_X11</code> in them to
                   7119:                 request the presence of X11 and to get the right
                   7120:                 compilation flags.</p>
1.1       grant    7121: 
                   7122:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  7123:                 be installed under <code class=
                   7124:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    7125:                 app-defaults files. These packages are special and
1.14      xtraeme  7126:                 they must be placed under <code class=
                   7127:                 "varname">X11BASE</code>. To accomplish this, set
                   7128:                 either <code class="varname">USE_X11BASE</code> or
                   7129:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    7130:                 package.</p>
                   7131: 
1.14      xtraeme  7132:                 <p>Some notes: <code class="varname">USE_X11</code>
                   7133:                 and <code class="varname">USE_X11BASE</code> are
                   7134:                 mutually exclusive. If you need to find includes or
                   7135:                 libraries installed by a pkg that has <code class=
                   7136:                 "varname">USE_IMAKE</code> or <code class=
                   7137:                 "varname">USE_X11BASE</code> in its pkg
                   7138:                 <code class="filename">Makefile</code>, you need to
                   7139:                 use <span class="emphasis"><em>both</em></span>
                   7140:                 <code class="filename">${X11BASE}</code> and
                   7141:                 <code class="filename">${LOCALBASE}</code>. To
                   7142:                 force installation of all X11 packages in
                   7143:                 <code class="varname">LOCALBASE</code>, the
                   7144:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7145:                 href=
1.1       grant    7146:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.19    ! hubertf  7147:                    class="pkgname">pkgtools/xpkgwedge</a> is
        !          7148:                    enabled by default.</p>
1.1       grant    7149:               </li>
                   7150: 
                   7151:               <li>
1.14      xtraeme  7152:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    7153:                 used to refer to the installed location of an X11
1.14      xtraeme  7154:                 package. <code class="varname">X11PREFIX</code>
                   7155:                 will be set to <code class="varname">X11BASE</code>
                   7156:                 if xpkgwedge is not installed, and to <code class=
                   7157:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    7158:                 installed.</p>
                   7159:               </li>
                   7160: 
                   7161:               <li>
                   7162:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  7163:                 have some packages installed in <code class=
                   7164:                 "varname">X11BASE</code> and some in <code class=
                   7165:                 "varname">LOCALBASE</code>. To determine the prefix
                   7166:                 of an installed package, the <code class=
                   7167:                 "varname">EVAL_PREFIX</code> definition can be
                   7168:                 used. It takes pairs in the format
                   7169:                 &#8220;<span class=
1.1       grant    7170:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.14      xtraeme  7171:                 the make(1) variable <code class=
                   7172:                 "varname">DIRNAME</code> will be set to the prefix
                   7173:                 of the installed package &lt;package&gt;, or
1.1       grant    7174:                 &#8220;<span class=
                   7175:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   7176:                 is not installed.</p>
                   7177: 
                   7178:                 <p>This is best illustrated by example.</p>
                   7179: 
1.14      xtraeme  7180:                 <p>The following lines are taken from <code class=
                   7181:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    7182:                 <pre class="programlisting">
1.14      xtraeme  7183: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    7184: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   7185:                         --with-gtk-prefix="${GTKDIR}"           \
                   7186:                         --enable-multibyte
                   7187: </pre>
                   7188: 
                   7189:                 <p>Specific defaults can be defined for the
1.14      xtraeme  7190:                 packages evaluated using <code class=
                   7191:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    7192:                 of the form:</p>
                   7193:                 <pre class="programlisting">
                   7194: GTKDIR_DEFAULT= ${LOCALBASE}
                   7195: </pre>
                   7196: 
1.14      xtraeme  7197:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    7198:                 corresponds to the first definition in the
1.14      xtraeme  7199:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    7200:               </li>
                   7201: 
                   7202:               <li>
1.14      xtraeme  7203:                 <p>Within <code class="filename">${PREFIX}</code>,
1.1       grant    7204:                 packages should install files according to hier(7),
                   7205:                 with the exception that manual pages go into
1.14      xtraeme  7206:                 <code class="filename">${PREFIX}/man</code>, not
                   7207:                 <code class=
                   7208:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    7209:               </li>
                   7210:             </ul>
                   7211:           </div>
                   7212:         </div>
                   7213: 
                   7214:         <div class="sect1" lang="en" xml:lang="en">
                   7215:           <div class="titlepage">
                   7216:             <div>
                   7217:               <div>
                   7218:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  7219:                 "id2589582" id="id2589582"></a>11.2.&nbsp;Main
1.1       grant    7220:                 targets</h2>
                   7221:               </div>
                   7222:             </div>
                   7223:           </div>
                   7224: 
                   7225:           <p>The main targets used during the build process defined
1.14      xtraeme  7226:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    7227: 
                   7228:           <div class="variablelist">
                   7229:             <dl>
                   7230:               <dt><span class="term">fetch</span></dt>
                   7231: 
                   7232:               <dd>
                   7233:                 <p>This will check if the file(s) given in the
1.14      xtraeme  7234:                 variables <code class="varname">DISTFILES</code>
                   7235:                 and <code class="varname">PATCHFILES</code> (as
                   7236:                 defined in the package's Makefile) are present on
                   7237:                 the local system in <code class=
                   7238:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   7239:                 are not present, an attempt will be made to fetch
                   7240:                 them using commands of the form:</p>
1.1       grant    7241:                 <pre class="programlisting">
                   7242: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   7243: </pre>
                   7244: 
                   7245:                 <p>where ${site} varies through several
1.14      xtraeme  7246:                 possibilities in turn: first, <code class=
                   7247:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   7248:                 then the sites specified in either <code class=
                   7249:                 "varname">SITES_file</code> if defined, else
                   7250:                 <code class="varname">MASTER_SITES</code> or
                   7251:                 <code class="varname">PATCH_SITES</code>, as
                   7252:                 applies, then finally the value of <code class=
                   7253:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   7254:                 all except the first can be optionally sorted by
                   7255:                 the user, via setting either <code class=
                   7256:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   7257:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    7258:               </dd>
                   7259: 
                   7260:               <dt><span class="term">checksum</span></dt>
                   7261: 
                   7262:               <dd>
                   7263:                 <p>After the distfile(s) are fetched, their
                   7264:                 checksum is generated and compared with the
                   7265:                 checksums stored in the distinfo file. If the
                   7266:                 checksums don't match, the build is aborted. This
                   7267:                 is to ensure the same distfile is used for
                   7268:                 building, and that the distfile wasn't changed,
                   7269:                 e.g. by some malign force, deliberately changed
                   7270:                 distfiles on the master distribution site or
                   7271:                 network lossage.</p>
                   7272:               </dd>
                   7273: 
                   7274:               <dt><span class="term">extract</span></dt>
                   7275: 
                   7276:               <dd>
                   7277:                 <p>When the distfiles are present on the local
                   7278:                 system, they need to be extracted, as they are
                   7279:                 usually in the form of some compressed archive
1.14      xtraeme  7280:                 format, most commonly <code class=
                   7281:                 "filename">.tar.gz</code>.</p>
1.1       grant    7282: 
                   7283:                 <p>If only some of the distfiles need to be
                   7284:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  7285:                 be put into <code class=
                   7286:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    7287: 
1.14      xtraeme  7288:                 <p>If the distfiles are not in <code class=
                   7289:                 "filename">.tar.gz</code> format, they can be
                   7290:                 extracted by setting either <code class=
                   7291:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   7292:                 "varname">EXTRACT_CMD</code>, <code class=
                   7293:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   7294:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   7295:                 the former case, pkgsrc knows how to extract a
                   7296:                 number of suffixes (<code class=
                   7297:                 "filename">.tar.gz</code>, <code class=
                   7298:                 "filename">.tgz</code>, <code class=
                   7299:                 "filename">.tar.gz2</code>, <code class=
                   7300:                 "filename">.tbz</code>, <code class=
                   7301:                 "filename">.tar.Z</code>, <code class=
                   7302:                 "filename">.tar</code>, <code class=
                   7303:                 "filename">.shar.gz</code>, <code class=
                   7304:                 "filename">.shar.bz2</code>, <code class=
                   7305:                 "filename">.shar.Z</code>, <code class=
                   7306:                 "filename">.shar</code>, <code class=
                   7307:                 "filename">.Z</code>, <code class=
                   7308:                 "filename">.bz2</code> and <code class=
                   7309:                 "filename">.gz</code>; see the definition of the
                   7310:                 various <code class="varname">DECOMPRESS_CMD</code>
                   7311:                 variables <code class="filename">bsd.pkg.mk</code>
                   7312:                 for a complete list). Here's an example on how to
                   7313:                 use the other variables for a program that comes
                   7314:                 with a compressed shell archive whose name ends in
                   7315:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    7316:                 <pre class="programlisting">
                   7317:      EXTRACT_SUFX=   .msg.gz
                   7318:      EXTRACT_CMD=            zcat
                   7319:      EXTRACT_BEFORE_ARGS=
                   7320:      EXTRACT_AFTER_ARGS=     |sh
                   7321: </pre>
                   7322:               </dd>
                   7323: 
                   7324:               <dt><span class="term">patch</span></dt>
                   7325: 
                   7326:               <dd>
                   7327:                 <p>After extraction, all the patches named by the
1.14      xtraeme  7328:                 <code class="varname">PATCHFILES</code>, those
                   7329:                 present in the patches subdirectory of the package
                   7330:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
                   7331:                 <code class=
                   7332:                 "filename">/usr/local/patches/graphics/png</code>)
                   7333:                 are applied. Patchfiles ending in <code class=
                   7334:                 "filename">.Z</code> or <code class=
                   7335:                 "filename">.gz</code> are uncompressed before they
                   7336:                 are applied, files ending in <code class=
                   7337:                 "filename">.orig</code> or <code class=
                   7338:                 "filename">.rej</code> are ignored. Any special
                   7339:                 options to patch(1) can be handed in <code class=
                   7340:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   7341:                 "#components.patches" title=
1.1       grant    7342:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   7343:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   7344: 
                   7345:                 <p>By default patch(1) is given special args to
                   7346:                 make it fail if the patches apply with some lines
                   7347:                 of fuzz. Please fix (regen) the patches so that
                   7348:                 they apply cleanly. The rationale behind this is
                   7349:                 that patches that don't apply cleanly may end up
                   7350:                 being applied in the wrong place, and cause severe
                   7351:                 harm there.</p>
                   7352:               </dd>
                   7353: 
                   7354:               <dt><span class="term">configure</span></dt>
                   7355: 
                   7356:               <dd>
                   7357:                 <p>Most pieces of software need information on the
                   7358:                 header files, system calls, and library routines
                   7359:                 which are available in NetBSD. This is the process
                   7360:                 known as configuration, and is usually automated.
                   7361:                 In most cases, a script is supplied with the
                   7362:                 source, and its invocation results in generation of
                   7363:                 header files, Makefiles, etc.</p>
                   7364: 
                   7365:                 <p>If the program's distfile contains its own
                   7366:                 configure script, this can be invoked by setting
1.14      xtraeme  7367:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    7368:                 configure script is a GNU autoconf script,
1.14      xtraeme  7369:                 <code class="varname">GNU_CONFIGURE</code> should
                   7370:                 be specified instead. In either case, any arguments
                   7371:                 to the configure script can be specified in the
                   7372:                 <code class="varname">CONFIGURE_ARGS</code>
                   7373:                 variable, and the configure script's name can be
                   7374:                 set in <code class=
                   7375:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   7376:                 from the default &#8220;<span class=
1.1       grant    7377:                 "quote">configure</span>&#8221;. Here's an example
                   7378:                 from the <a xmlns=
                   7379:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7380:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.19    ! hubertf  7381:                    class="pkgname">sysutils/top</a> package:</p>
1.1       grant    7382:                 <pre class="programlisting">
                   7383: HAS_CONFIGURE=          yes
                   7384: CONFIGURE_SCRIPT=       Configure
                   7385: CONFIGURE_ARGS+=        netbsd13
                   7386: </pre>
                   7387: 
                   7388:                 <p>If the program uses an Imakefile for
                   7389:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  7390:                 by setting <code class="varname">USE_IMAKE</code>
                   7391:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   7392:                 (If you only want the package installed in
                   7393:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   7394:                 not being run, set <code class=
                   7395:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    7396:               </dd>
                   7397: 
                   7398:               <dt><span class="term">build</span></dt>
                   7399: 
                   7400:               <dd>
                   7401:                 <p>Once configuration has taken place, the software
1.14      xtraeme  7402:                 will be built by invoking <code class=
                   7403:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   7404:                 "varname">$MAKEFILE</code> with <code class=
                   7405:                 "varname">$BUILD_TARGET</code> as the target to
                   7406:                 build. The default <code class=
                   7407:                 "varname">MAKE_PROGRAM</code> is
                   7408:                 &#8220;<span class="quote">gmake</span>&#8221; if
                   7409:                 <code class="varname">USE_GNU_TOOLS</code> contains
1.7       wiz      7410:                 &#8220;<span class="quote">make</span>&#8221;,
1.1       grant    7411:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  7412:                 otherwise. <code class="varname">MAKEFILE</code> is
                   7413:                 set to &#8220;<span class=
1.1       grant    7414:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  7415:                 <code class="varname">BUILD_TARGET</code> defaults
                   7416:                 to &#8220;<span class="quote">all</span>&#8221;.
                   7417:                 Any of these variables can be set in the package's
1.1       grant    7418:                 Makefile to change the default build process.</p>
                   7419:               </dd>
                   7420: 
                   7421:               <dt><span class="term">install</span></dt>
                   7422: 
                   7423:               <dd>
                   7424:                 <p>Once the build stage has completed, the final
                   7425:                 step is to install the software in public
                   7426:                 directories, so users can access the programs and
1.14      xtraeme  7427:                 files. As in the build-target, <code class=
                   7428:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   7429:                 <code class="varname">$MAKEFILE</code> here, but
                   7430:                 with the <code class=
                   7431:                 "varname">$INSTALL_TARGET</code> instead, the
                   7432:                 latter defaulting to &#8220;<span class=
                   7433:                 "quote">install</span>&#8221; (plus
                   7434:                 &#8220;<span class=
                   7435:                 "quote">install.man</span>&#8221;, if <code class=
                   7436:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    7437:               </dd>
                   7438:             </dl>
                   7439:           </div>
                   7440: 
                   7441:           <p>If no target is specified, the default is
                   7442:           &#8220;<span class="quote">build</span>&#8221;. If a
                   7443:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  7444:           e.g. <span><strong class="command">make
                   7445:           build</strong></span> will also perform the equivalent
                   7446:           of:</p>
1.1       grant    7447:           <pre class="programlisting">
                   7448: make fetch
                   7449: make checksum
                   7450: make extract
                   7451: make patch
                   7452: make configure
                   7453: make build
                   7454: </pre>
                   7455:         </div>
                   7456: 
                   7457:         <div class="sect1" lang="en" xml:lang="en">
                   7458:           <div class="titlepage">
                   7459:             <div>
                   7460:               <div>
                   7461:                 <h2 class="title" style="clear: both"><a name=
                   7462:                 "build.helpful-targets" id=
                   7463:                 "build.helpful-targets"></a>11.3.&nbsp;Other
                   7464:                 helpful targets</h2>
                   7465:               </div>
                   7466:             </div>
                   7467:           </div>
                   7468: 
                   7469:           <div class="variablelist">
                   7470:             <dl>
                   7471:               <dt><span class="term">pre/post-*</span></dt>
                   7472: 
                   7473:               <dd>
                   7474:                 <p>For any of the main targets described in the
                   7475:                 previous section, two auxiliary targets exist with
                   7476:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   7477:                 &#8220;<span class="quote">post-</span>&#8221; used
                   7478:                 as a prefix for the main target's name. These
                   7479:                 targets are invoked before and after the main
                   7480:                 target is called, allowing extra configuration or
                   7481:                 installation steps be performed from a package's
                   7482:                 Makefile, for example, which a program's configure
                   7483:                 script or install target omitted.</p>
                   7484:               </dd>
                   7485: 
                   7486:               <dt><span class="term">do-*</span></dt>
                   7487: 
                   7488:               <dd>
                   7489:                 <p>Should one of the main targets do the wrong
                   7490:                 thing, and should there be no variable to fix this,
                   7491:                 you can redefine it with the do-* target. (Note
                   7492:                 that redefining the target itself instead of the
                   7493:                 do-* target is a bad idea, as the pre-* and post-*
                   7494:                 targets won't be called anymore, etc.) You will not
                   7495:                 usually need to do this.</p>
                   7496:               </dd>
                   7497: 
                   7498:               <dt><span class="term">reinstall</span></dt>
                   7499: 
                   7500:               <dd>
1.14      xtraeme  7501:                 <p>If you did a <span><strong class="command">make
                   7502:                 install</strong></span> and you noticed some file
                   7503:                 was not installed properly, you can repeat the
1.1       grant    7504:                 installation with this target, which will ignore
                   7505:                 the &#8220;<span class="quote">already
                   7506:                 installed</span>&#8221; flag.</p>
                   7507:               </dd>
                   7508: 
                   7509:               <dt><span class="term">deinstall</span></dt>
                   7510: 
                   7511:               <dd>
                   7512:                 <p>This target does a pkg_delete(1) in the current
                   7513:                 directory, effectively de-installing the package.
                   7514:                 The following variables can be used to tune the
                   7515:                 behaviour:</p>
                   7516: 
                   7517:                 <div class="variablelist">
                   7518:                   <dl>
1.14      xtraeme  7519:                     <dt><span class="term"><code class=
                   7520:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    7521: 
                   7522:                     <dd>
                   7523:                       <p>Add a "-v" to the <a href=
                   7524:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7525:                       <span class="citerefentry"><span class=
                   7526:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7527:                       command.</p>
                   7528:                     </dd>
                   7529: 
1.14      xtraeme  7530:                     <dt><span class="term"><code class=
                   7531:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    7532: 
                   7533:                     <dd>
                   7534:                       <p>Remove all packages that require (depend
                   7535:                       on) the given package. This can be used to
                   7536:                       remove any packages that may have been pulled
                   7537:                       in by a given package, e.g. if
1.14      xtraeme  7538:                       <span><strong class="command">make deinstall
                   7539:                       DEINSTALLDEPENDS=1</strong></span> is done in
                   7540:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    7541:                       this is likely to remove whole KDE. Works by
                   7542:                       adding &#8220;<span class=
                   7543:                       "quote">-R</span>&#8221; to the <a href=
                   7544:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7545:                       <span class="citerefentry"><span class=
                   7546:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7547:                       command line.</p>
                   7548:                     </dd>
                   7549:                   </dl>
                   7550:                 </div>
                   7551:               </dd>
                   7552: 
                   7553:               <dt><span class="term">update</span></dt>
                   7554: 
                   7555:               <dd>
                   7556:                 <p>This target causes the current package to be
                   7557:                 updated to the latest version. The package and all
                   7558:                 depending packages first get de-installed, then
                   7559:                 current versions of the corresponding packages get
                   7560:                 compiled and installed. This is similar to manually
                   7561:                 noting which packages are currently installed, then
1.14      xtraeme  7562:                 performing a series of <span><strong class=
                   7563:                 "command">make deinstall</strong></span> and
                   7564:                 <span><strong class="command">make
                   7565:                 install</strong></span> (or whatever <code class=
                   7566:                 "varname">UPDATE_TARGET</code> is set to) for these
                   7567:                 packages.</p>
1.1       grant    7568: 
                   7569:                 <p>You can use the &#8220;<span class=
                   7570:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  7571:                 package updating in case a previous
                   7572:                 <span><strong class="command">make
                   7573:                 update</strong></span> was interrupted for some
                   7574:                 reason. However, in this case, make sure you don't
                   7575:                 call <span><strong class="command">make
                   7576:                 clean</strong></span> or otherwise remove the list
                   7577:                 of dependent packages in <code class=
                   7578:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    7579:                 ability to automatically update the current package
                   7580:                 along with the dependent packages you have
                   7581:                 installed.</p>
                   7582: 
1.14      xtraeme  7583:                 <p>Resuming an interrupted <span><strong class=
                   7584:                 "command">make update</strong></span> will only
                   7585:                 work as long as the package tree remains unchanged.
                   7586:                 If the source code for one of the packages to be
                   7587:                 updated has been changed, resuming
                   7588:                 <span><strong class="command">make
                   7589:                 update</strong></span> will most certainly
                   7590:                 fail!</p>
1.1       grant    7591: 
                   7592:                 <p>The following variables can be used either on
1.14      xtraeme  7593:                 the command line or in <code class=
                   7594:                 "filename">/etc/mk.conf</code> to alter the
                   7595:                 behaviour of <span><strong class="command">make
                   7596:                 update</strong></span>:</p>
1.1       grant    7597: 
                   7598:                 <div class="variablelist">
                   7599:                   <dl>
1.14      xtraeme  7600:                     <dt><span class="term"><code class=
                   7601:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    7602: 
                   7603:                     <dd>
                   7604:                       <p>Install target to recursively use for the
                   7605:                       updated package and the dependent packages.
1.14      xtraeme  7606:                       Defaults to <code class=
                   7607:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    7608:                       &#8220;<span class=
                   7609:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  7610:                       <span><strong class="command">make
                   7611:                       update</strong></span>. e.g.
                   7612:                       <span><strong class="command">make update
                   7613:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    7614:                     </dd>
                   7615: 
1.14      xtraeme  7616:                     <dt><span class="term"><code class=
                   7617:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    7618: 
                   7619:                     <dd>
                   7620:                       <p>Don't clean up after updating. Useful if
                   7621:                       you want to leave the work sources of the
                   7622:                       updated packages around for inspection or
                   7623:                       other purposes. Be sure you eventually clean
                   7624:                       up the source tree (see the
                   7625:                       &#8220;<span class=
                   7626:                       "quote">clean-update</span>&#8221; target
                   7627:                       below) or you may run into troubles with old
                   7628:                       source code still lying around on your next
1.14      xtraeme  7629:                       <span><strong class=
                   7630:                       "command">make</strong></span> or
                   7631:                       <span><strong class="command">make
                   7632:                       update</strong></span>.</p>
1.1       grant    7633:                     </dd>
                   7634: 
1.14      xtraeme  7635:                     <dt><span class="term"><code class=
                   7636:                     "varname">REINSTALL</code></span></dt>
1.1       grant    7637: 
                   7638:                     <dd>
                   7639:                       <p>Deinstall each package before installing
1.14      xtraeme  7640:                       (making <code class=
                   7641:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    7642:                       necessary if the &#8220;<span class=
                   7643:                       "quote">clean-update</span>&#8221; target
                   7644:                       (see below) was called after interrupting a
1.14      xtraeme  7645:                       running <span><strong class="command">make
                   7646:                       update</strong></span>.</p>
1.1       grant    7647:                     </dd>
                   7648: 
1.14      xtraeme  7649:                     <dt><span class="term"><code class=
                   7650:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    7651: 
                   7652:                     <dd>
                   7653:                       <p>Allows you to disable recursion and
                   7654:                       hardcode the target for packages. The default
                   7655:                       is &#8220;<span class=
                   7656:                       "quote">update</span>&#8221; for the update
                   7657:                       target, facilitating a recursive update of
1.14      xtraeme  7658:                       prerequisite packages. Only set <code class=
                   7659:                       "varname">DEPENDS_TARGET</code> if you want
                   7660:                       to disable recursive updates. Use
                   7661:                       <code class="varname">UPDATE_TARGET</code>
                   7662:                       instead to just set a specific target for
                   7663:                       each package to be installed during
                   7664:                       <span><strong class="command">make
                   7665:                       update</strong></span> (see above).</p>
1.1       grant    7666:                     </dd>
                   7667:                   </dl>
                   7668:                 </div>
                   7669:               </dd>
                   7670: 
                   7671:               <dt><span class="term">clean-update</span></dt>
                   7672: 
                   7673:               <dd>
                   7674:                 <p>Clean the source tree for all packages that
1.14      xtraeme  7675:                 would get updated if <span><strong class=
                   7676:                 "command">make update</strong></span> was called
                   7677:                 from the current directory. This target should not
                   7678:                 be used if the current package (or any of its
                   7679:                 depending packages) have already been de-installed
                   7680:                 (e.g., after calling <span><strong class=
                   7681:                 "command">make update</strong></span>) or you may
                   7682:                 lose some packages you intended to update. As a
                   7683:                 rule of thumb: only use this target <span class=
                   7684:                 "emphasis"><em>before</em></span> the first time
                   7685:                 you run <span><strong class="command">make
                   7686:                 update</strong></span> and only if you have a dirty
                   7687:                 package tree (e.g., if you used <code class=
                   7688:                 "varname">NOCLEAN</code>).</p>
1.1       grant    7689: 
                   7690:                 <p>If you unsure about whether your tree is clean
1.14      xtraeme  7691:                 you can either perform a <span><strong class=
                   7692:                 "command">make clean</strong></span> at the top of
                   7693:                 the tree, or use the following sequence of commands
1.1       grant    7694:                 from the directory of the package you want to
                   7695:                 update (<span class=
                   7696:                 "emphasis"><em>before</em></span> running
1.14      xtraeme  7697:                 <span><strong class="command">make
                   7698:                 update</strong></span> for the first time,
                   7699:                 otherwise you lose all the packages you wanted to
                   7700:                 update!):</p>
1.1       grant    7701:                 <pre class="screen">
1.14      xtraeme  7702: <code class="prompt">#</code> <strong class=
                   7703: "userinput"><code>make clean-update</code></strong>
                   7704: <code class="prompt">#</code> <strong class=
                   7705: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   7706: <code class="prompt">#</code> <strong class=
                   7707: "userinput"><code>make update</code></strong>
1.1       grant    7708: </pre>
                   7709: 
                   7710:                 <p>The following variables can be used either on
1.14      xtraeme  7711:                 the command line or in <code class=
                   7712:                 "filename">/etc/mk.conf</code> to alter the
                   7713:                 behaviour of <span><strong class="command">make
                   7714:                 clean-update</strong></span>:</p>
1.1       grant    7715: 
                   7716:                 <div class="variablelist">
                   7717:                   <dl>
1.14      xtraeme  7718:                     <dt><span class="term"><code class=
                   7719:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    7720: 
                   7721:                     <dd>
1.14      xtraeme  7722:                       <p>After <span><strong class="command">make
                   7723:                       clean</strong></span>, do not reconstruct the
                   7724:                       list of directories to update for this
                   7725:                       package. Only use this if
                   7726:                       <span><strong class="command">make
                   7727:                       update</strong></span> successfully installed
                   7728:                       all packages you wanted to update. Normally,
                   7729:                       this is done automatically on
                   7730:                       <span><strong class="command">make
                   7731:                       update</strong></span>, but may have been
                   7732:                       suppressed by the <code class=
                   7733:                       "varname">NOCLEAN</code> variable (see
1.1       grant    7734:                       above).</p>
                   7735:                     </dd>
                   7736:                   </dl>
                   7737:                 </div>
                   7738:               </dd>
                   7739: 
                   7740:               <dt><span class="term">info</span></dt>
                   7741: 
                   7742:               <dd>
                   7743:                 <p>This target invokes <a href=
                   7744:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   7745:                 <span class="citerefentry"><span class=
                   7746:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   7747:                 the current package. You can use this to check
                   7748:                 which version of a package is installed.</p>
                   7749:               </dd>
                   7750: 
                   7751:               <dt><span class="term">readme</span></dt>
                   7752: 
                   7753:               <dd>
1.14      xtraeme  7754:                 <p>This target generates a <code class=
                   7755:                 "filename">README.html</code> file, which can be
1.1       grant    7756:                 viewed using a browser such as <a xmlns=
                   7757:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7758:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.19    ! hubertf  7759:                    class="pkgname">www/mozilla</a> or <a xmlns=
        !          7760:                    "http://www.w3.org/TR/xhtml1/transitional" href=
        !          7761:                    "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
        !          7762:                    class="pkgname">www/links</a>. The generated
        !          7763:                    files contain references to any packages which
        !          7764:                    are in the <code class="varname">PACKAGES</code>
        !          7765:                    directory on the local host. The generated files
        !          7766:                    can be made to refer to URLs based on
        !          7767:                    <code class="varname">FTP_PKG_URL_HOST</code>
        !          7768:                    and <code class=
        !          7769:                    "varname">FTP_PKG_URL_DIR</code>. For example,
        !          7770:                    if I wanted to generate <code class=
        !          7771:                    "filename">README.html</code> files which
        !          7772:                    pointed to binary packages on the local machine,
        !          7773:                    in the directory <code class=
        !          7774:                    "filename">/usr/packages</code>, set <code class=
        !          7775:                    "varname">FTP_PKG_URL_HOST=file://localhost</code>
        !          7776:                    and <code class=
        !          7777:                    "varname">FTP_PKG_URL_DIR=/usr/packages</code>.
        !          7778:                    The <code class="varname">${PACKAGES}</code>
        !          7779:                    directory and its subdirectories will be
        !          7780:                    searched for all the binary packages.</p>
1.1       grant    7781:               </dd>
                   7782: 
                   7783:               <dt><span class="term">readme-all</span></dt>
                   7784: 
                   7785:               <dd>
1.14      xtraeme  7786:                 <p>Use this target to create a file <code class=
                   7787:                 "filename">README-all.html</code> which contains a
1.1       grant    7788:                 list of all packages currently available in the
                   7789:                 NetBSD Packages Collection, together with the
                   7790:                 category they belong to and a short description.
1.14      xtraeme  7791:                 This file is compiled from the <code class=
                   7792:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    7793:                 sure to run this <span class=
1.14      xtraeme  7794:                 "emphasis"><em>after</em></span> a
                   7795:                 <span><strong class="command">make
                   7796:                 readme</strong></span>.</p>
1.1       grant    7797:               </dd>
                   7798: 
                   7799:               <dt><span class="term">cdrom-readme</span></dt>
                   7800: 
                   7801:               <dd>
                   7802:                 <p>This is very much the same as the
                   7803:                 &#8220;<span class="quote">readme</span>&#8221;
                   7804:                 target (see above), but is to be used when
                   7805:                 generating a pkgsrc tree to be written to a CD-ROM.
1.14      xtraeme  7806:                 This target also produces <code class=
                   7807:                 "filename">README.html</code> files, and can be
                   7808:                 made to refer to URLs based on <code class=
                   7809:                 "varname">CDROM_PKG_URL_HOST</code> and
                   7810:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    7811:               </dd>
                   7812: 
                   7813:               <dt><span class="term">show-distfiles</span></dt>
                   7814: 
                   7815:               <dd>
                   7816:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  7817:                 are needed to build the package. (<code class=
                   7818:                 "varname">DISTFILES</code> and <code class=
                   7819:                 "varname">PATCHFILES</code>, but not <code class=
                   7820:                 "filename">patches/*</code>)</p>
1.1       grant    7821:               </dd>
                   7822: 
                   7823:               <dt><span class="term">show-downlevel</span></dt>
                   7824: 
                   7825:               <dd>
                   7826:                 <p>This target shows nothing if the package is not
                   7827:                 installed. If a version of this package is
                   7828:                 installed, but is not the version provided in this
                   7829:                 version of pkgsrc, then a warning message is
                   7830:                 displayed. This target can be used to show which of
                   7831:                 your installed packages are downlevel, and so the
                   7832:                 old versions can be deleted, and the current ones
                   7833:                 added.</p>
                   7834:               </dd>
                   7835: 
                   7836:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   7837: 
                   7838:               <dd>
                   7839:                 <p>This target shows the directory in the pkgsrc
                   7840:                 hierarchy from which the package can be built and
                   7841:                 installed. This may not be the same directory as
                   7842:                 the one from which the package was installed. This
                   7843:                 target is intended to be used by people who may
                   7844:                 wish to upgrade many packages on a single host, and
                   7845:                 can be invoked from the top-level pkgsrc Makefile
                   7846:                 by using the &#8220;<span class=
                   7847:                 "quote">show-host-specific-pkgs</span>&#8221;
                   7848:                 target.</p>
                   7849:               </dd>
                   7850: 
                   7851:               <dt><span class=
                   7852:               "term">show-installed-depends</span></dt>
                   7853: 
                   7854:               <dd>
                   7855:                 <p>This target shows which installed packages match
1.14      xtraeme  7856:                 the current package's <code class=
                   7857:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    7858:                 dependencies are causing build problems.</p>
                   7859:               </dd>
                   7860: 
                   7861:               <dt><span class="term">check-shlibs</span></dt>
                   7862: 
                   7863:               <dd>
                   7864:                 <p>After a package is installed, check all its
                   7865:                 binaries and (on ELF platforms) shared libraries to
                   7866:                 see if they find the shared libs they need. Run by
1.14      xtraeme  7867:                 default if <code class=
                   7868:                 "varname">PKG_DEVELOPER</code> is set in
                   7869:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    7870:               </dd>
                   7871: 
                   7872:               <dt><span class="term">print-PLIST</span></dt>
                   7873: 
                   7874:               <dd>
                   7875:                 <p>After a &#8220;<span class="quote">make
                   7876:                 install</span>&#8221; from a new or upgraded pkg,
                   7877:                 this prints out an attempt to generate a new
1.14      xtraeme  7878:                 <code class="filename">PLIST</code> from a
                   7879:                 <span><strong class="command">find -newer
                   7880:                 work/.extract_done</strong></span>. An attempt is
                   7881:                 made to care for shared libs etc., but it is
1.1       grant    7882:                 <span class="emphasis"><em>strongly</em></span>
                   7883:                 recommended to review the result before putting it
1.14      xtraeme  7884:                 into <code class="filename">PLIST</code>. On
                   7885:                 upgrades, it's useful to diff the output of this
                   7886:                 command against an already existing <code class=
                   7887:                 "filename">PLIST</code> file.</p>
1.1       grant    7888: 
                   7889:                 <p>If the package installs files via tar(1) or
                   7890:                 other methods that don't update file access times,
                   7891:                 be sure to add these files manually to your
1.14      xtraeme  7892:                 <code class="filename">PLIST</code>, as the
1.1       grant    7893:                 &#8220;<span class="quote">find
                   7894:                 -newer</span>&#8221; command used by this target
                   7895:                 won't catch them!</p>
                   7896: 
                   7897:                 <p>See <a href="#print-PLIST" title=
                   7898:                 "8.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;8.3,
1.14      xtraeme  7899:                 &#8220;Tweaking output of <span><strong class=
                   7900:                 "command">make
                   7901:                 print-PLIST</strong></span>&#8221;</a> for more
                   7902:                 information on this target.</p>
1.1       grant    7903:               </dd>
                   7904: 
                   7905:               <dt><span class="term">bulk-package</span></dt>
                   7906: 
                   7907:               <dd>
                   7908:                 <p>Used to do bulk builds. If an appropriate binary
                   7909:                 package already exists, no action is taken. If not,
                   7910:                 this target will compile, install and package it
1.14      xtraeme  7911:                 (and it's depends, if <code class=
                   7912:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    7913:                 <a href="#binary.configuration" title=
                   7914:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   7915:                 &#8220;Configuration&#8221;</a>. After creating the
                   7916:                 binary package, the sources, the just-installed
                   7917:                 package and it's required packages are removed,
                   7918:                 preserving free disk space.</p>
                   7919: 
                   7920:                 <p><span class="emphasis"><em>Beware that this
                   7921:                 target may deinstall all packages installed on a
                   7922:                 system!</em></span></p>
                   7923:               </dd>
                   7924: 
                   7925:               <dt><span class="term">bulk-install</span></dt>
                   7926: 
                   7927:               <dd>
                   7928:                 <p>Used during bulk-installs to install required
                   7929:                 packages. If an upto-date binary package is
                   7930:                 available, it will be installed via <a href=
                   7931:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7932:                 <span class="citerefentry"><span class=
                   7933:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  7934:                 not, <span><strong class="command">make
                   7935:                 bulk-package</strong></span> will be executed, but
                   7936:                 the installed binary not be removed.</p>
1.1       grant    7937: 
                   7938:                 <p>A binary package is considered
                   7939:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   7940:                 to be installed via <a href=
                   7941:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7942:                 <span class="citerefentry"><span class=
                   7943:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   7944:                 if:</p>
                   7945: 
                   7946:                 <div class="itemizedlist">
                   7947:                   <ul type="disc">
                   7948:                     <li>
1.14      xtraeme  7949:                       <p>None of the package's files (<code class=
                   7950:                       "filename">Makefile</code>, ...) were
                   7951:                       modified since it was built.</p>
1.1       grant    7952:                     </li>
                   7953: 
                   7954:                     <li>
                   7955:                       <p>None of the package's required (binary)
                   7956:                       packages were modified since it was
                   7957:                       built.</p>
                   7958:                     </li>
                   7959:                   </ul>
                   7960:                 </div>
                   7961: 
                   7962:                 <p><span class="emphasis"><em>Beware that this
                   7963:                 target may deinstall all packages installed on a
                   7964:                 system!</em></span></p>
                   7965:               </dd>
                   7966:             </dl>
                   7967:           </div>
                   7968:         </div>
                   7969:       </div>
                   7970: 
                   7971:       <div class="chapter" lang="en" xml:lang="en">
                   7972:         <div class="titlepage">
                   7973:           <div>
                   7974:             <div>
                   7975:               <h2 class="title"><a name="fixes" id=
                   7976:               "fixes"></a>Chapter&nbsp;12.&nbsp;Notes on fixes for
                   7977:               packages</h2>
                   7978:             </div>
                   7979:           </div>
                   7980:         </div>
                   7981: 
                   7982:         <div class="toc">
                   7983:           <p><b>Table of Contents</b></p>
                   7984: 
                   7985:           <dl>
1.19    ! hubertf  7986:             <dt><span class="sect1"><a href="#id2590983">12.1.
1.1       grant    7987:             General operation</a></span></dt>
                   7988: 
                   7989:             <dd>
                   7990:               <dl>
                   7991:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  7992:                 "#id2590986">12.1.1. How to pull in variables from
1.1       grant    7993:                 /etc/mk.conf</a></span></dt>
                   7994: 
                   7995:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  7996:                 "#id2591138">12.1.2. Restricted
1.1       grant    7997:                 packages</a></span></dt>
                   7998: 
                   7999:                 <dt><span class="sect2"><a href=
                   8000:                 "#dependencies">12.1.3. Handling
                   8001:                 dependencies</a></span></dt>
                   8002: 
                   8003:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8004:                 "#id2591585">12.1.4. Handling conflicts with other
1.1       grant    8005:                 packages</a></span></dt>
                   8006: 
                   8007:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8008:                 "#id2591703">12.1.5. Packages that cannot or should
1.1       grant    8009:                 not be built</a></span></dt>
                   8010: 
                   8011:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8012:                 "#id2591729">12.1.6. Packages which should not be
1.1       grant    8013:                 deleted, once installed</a></span></dt>
                   8014: 
                   8015:                 <dt><span class="sect2"><a href=
                   8016:                 "#security-handling">12.1.7. Handling packages with
                   8017:                 security problems</a></span></dt>
                   8018: 
                   8019:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8020:                 "#id2591889">12.1.8. How to handle compiler
1.1       grant    8021:                 bugs</a></span></dt>
                   8022: 
                   8023:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8024:                 "#id2591911">12.1.9. How to handle incrementing
1.1       grant    8025:                 versions when fixing an existing
                   8026:                 package</a></span></dt>
                   8027: 
                   8028:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8029:                 "#id2591960">12.1.10. Portability of
1.1       grant    8030:                 packages</a></span></dt>
                   8031:               </dl>
                   8032:             </dd>
                   8033: 
1.19    ! hubertf  8034:             <dt><span class="sect1"><a href="#id2591985">12.2.
1.1       grant    8035:             Possible downloading issues</a></span></dt>
                   8036: 
                   8037:             <dd>
                   8038:               <dl>
                   8039:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8040:                 "#id2591988">12.2.1. Packages whose distfiles
1.1       grant    8041:                 aren't available for plain
                   8042:                 downloading</a></span></dt>
                   8043: 
                   8044:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8045:                 "#id2592051">12.2.2. How to handle modified
1.1       grant    8046:                 distfiles with the 'old' name</a></span></dt>
                   8047:               </dl>
                   8048:             </dd>
                   8049: 
1.19    ! hubertf  8050:             <dt><span class="sect1"><a href="#id2592062">12.3.
1.1       grant    8051:             Configuration gotchas</a></span></dt>
                   8052: 
                   8053:             <dd>
                   8054:               <dl>
                   8055:                 <dt><span class="sect2"><a href=
                   8056:                 "#fixes.libtool">12.3.1. Shared libraries -
                   8057:                 libtool</a></span></dt>
                   8058: 
                   8059:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8060:                 "#id2592441">12.3.2. Using libtool on GNU packages
1.1       grant    8061:                 that already support libtool</a></span></dt>
                   8062: 
                   8063:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8064:                 "#id2592594">12.3.3. GNU
1.1       grant    8065:                 Autoconf/Automake</a></span></dt>
                   8066:               </dl>
                   8067:             </dd>
                   8068: 
1.19    ! hubertf  8069:             <dt><span class="sect1"><a href="#id2592775">12.4.
1.1       grant    8070:             Building considerations</a></span></dt>
                   8071: 
                   8072:             <dd>
                   8073:               <dl>
                   8074:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8075:                 "#id2592778">12.4.1. CPP defines</a></span></dt>
1.1       grant    8076:               </dl>
                   8077:             </dd>
                   8078: 
1.19    ! hubertf  8079:             <dt><span class="sect1"><a href="#id2592808">12.5.
1.1       grant    8080:             Package specific actions</a></span></dt>
                   8081: 
                   8082:             <dd>
                   8083:               <dl>
                   8084:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8085:                 "#id2592811">12.5.1. Package configuration
1.1       grant    8086:                 files</a></span></dt>
                   8087: 
                   8088:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8089:                 "#id2592982">12.5.2. User
1.2       hubertf  8090:                 interaction</a></span></dt>
1.1       grant    8091: 
                   8092:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8093:                 "#id2593027">12.5.3. Handling
1.1       grant    8094:                 licenses</a></span></dt>
                   8095: 
                   8096:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8097:                 "#id2593178">12.5.4. Creating an account from a
1.1       grant    8098:                 package</a></span></dt>
                   8099: 
                   8100:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8101:                 "#id2593240">12.5.5. Installing score
1.1       grant    8102:                 files</a></span></dt>
                   8103: 
                   8104:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8105:                 "#id2593284">12.5.6. Packages providing login
1.1       grant    8106:                 shells</a></span></dt>
                   8107: 
                   8108:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8109:                 "#id2593341">12.5.7. Packages containing perl
1.1       grant    8110:                 scripts</a></span></dt>
                   8111: 
                   8112:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8113:                 "#id2593360">12.5.8. Packages with hardcoded paths
1.1       grant    8114:                 to other interpreters</a></span></dt>
                   8115: 
                   8116:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8117:                 "#id2593381">12.5.9. Packages installing perl
1.1       grant    8118:                 modules</a></span></dt>
                   8119: 
                   8120:                 <dt><span class="sect2"><a href=
                   8121:                 "#faq.info-files">12.5.10. Packages installing info
                   8122:                 files</a></span></dt>
                   8123: 
                   8124:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8125:                 "#id2593601">12.5.11. Packages installing GConf2
1.1       grant    8126:                 data files</a></span></dt>
                   8127: 
                   8128:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8129:                 "#id2593769">12.5.12. Packages installing
1.1       grant    8130:                 scrollkeeper data files</a></span></dt>
                   8131: 
                   8132:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8133:                 "#id2593889">12.5.13. Packages installing X11
1.1       grant    8134:                 fonts</a></span></dt>
                   8135: 
                   8136:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8137:                 "#id2593936">12.5.14. Packages installing GTK2
1.1       grant    8138:                 modules</a></span></dt>
                   8139: 
                   8140:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8141:                 "#id2594005">12.5.15. Packages installing SGML or
1.1       grant    8142:                 XML data</a></span></dt>
                   8143: 
                   8144:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8145:                 "#id2594057">12.5.16. Packages installing
1.1       grant    8146:                 extensions to the MIME database</a></span></dt>
                   8147: 
                   8148:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8149:                 "#id2594332">12.5.17. Packages using
1.1       grant    8150:                 intltool</a></span></dt>
1.18      xtraeme  8151: 
                   8152:                 <dt><span class="sect2"><a href=
1.19    ! hubertf  8153:                 "#id2594346">12.5.18. Packages installing startup
1.18      xtraeme  8154:                 scripts</a></span></dt>
1.1       grant    8155:               </dl>
                   8156:             </dd>
                   8157: 
1.19    ! hubertf  8158:             <dt><span class="sect1"><a href="#id2594368">12.6.
1.1       grant    8159:             Feedback to the author</a></span></dt>
                   8160:           </dl>
                   8161:         </div>
                   8162: 
                   8163:         <div class="sect1" lang="en" xml:lang="en">
                   8164:           <div class="titlepage">
                   8165:             <div>
                   8166:               <div>
                   8167:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  8168:                 "id2590983" id="id2590983"></a>12.1.&nbsp;General
1.1       grant    8169:                 operation</h2>
                   8170:               </div>
                   8171:             </div>
                   8172:           </div>
                   8173: 
                   8174:           <div class="sect2" lang="en" xml:lang="en">
                   8175:             <div class="titlepage">
                   8176:               <div>
                   8177:                 <div>
1.19    ! hubertf  8178:                   <h3 class="title"><a name="id2590986" id=
        !          8179:                   "id2590986"></a>12.1.1.&nbsp;How to pull in
1.1       grant    8180:                   variables from /etc/mk.conf</h3>
                   8181:                 </div>
                   8182:               </div>
                   8183:             </div>
                   8184: 
                   8185:             <p>The problem with package-defined variables that can
1.14      xtraeme  8186:             be overridden via <code class="varname">MAKECONF</code>
                   8187:             or <code class="filename">/etc/mk.conf</code> is that
                   8188:             <a href=
1.1       grant    8189:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8190:             <span class="citerefentry"><span class=
                   8191:             "refentrytitle">make</span>(1)</span></a> expands a
                   8192:             variable as it is used, but evaluates preprocessor like
                   8193:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  8194:             So, to use any variable (which may be set in
                   8195:             <code class="filename">/etc/mk.conf</code>) in one of
                   8196:             the .if* statements, the file <code class=
                   8197:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    8198:             that .if* statement.</p>
                   8199: 
                   8200:             <p>Rather than have a number of ad-hoc ways of
1.14      xtraeme  8201:             including <code class="filename">/etc/mk.conf</code>,
                   8202:             should it exist, or <code class=
                   8203:             "varname">MAKECONF</code>, should it exist, include the
                   8204:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
                   8205:             file in the package Makefile before any
                   8206:             preprocessor-like .if, .ifdef, or .ifndef
                   8207:             statements:</p>
1.1       grant    8208:             <pre class="programlisting">
                   8209: .include "../../mk/bsd.prefs.mk"
                   8210:     
                   8211:     .if defined(USE_MENUS)
                   8212:       ...
                   8213:     .endif
                   8214: </pre>
                   8215: 
1.14      xtraeme  8216:             <p>If you wish to set the <code class=
                   8217:             "varname">CFLAGS</code> variable in <code class=
                   8218:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    8219:             use:</p>
                   8220:             <pre class="programlisting">
                   8221: CFLAGS+=  -your -flags
                   8222: </pre>
                   8223: 
1.14      xtraeme  8224:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   8225:             without the &#8220;<span class="quote">+</span>&#8221;)
                   8226:             may lead to problems with packages that need to add
                   8227:             their own flags. Also, you may want to take a look at
                   8228:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    8229:             href=
                   8230:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.19    ! hubertf  8231:                class="pkgname">devel/cpuflags</a> package if you're
        !          8232:                interested in optimization for the current CPU.</p>
1.1       grant    8233:           </div>
                   8234: 
                   8235:           <div class="sect2" lang="en" xml:lang="en">
                   8236:             <div class="titlepage">
                   8237:               <div>
                   8238:                 <div>
1.19    ! hubertf  8239:                   <h3 class="title"><a name="id2591138" id=
        !          8240:                   "id2591138"></a>12.1.2.&nbsp;Restricted
1.1       grant    8241:                   packages</h3>
                   8242:                 </div>
                   8243:               </div>
                   8244:             </div>
                   8245: 
                   8246:             <p>Some licenses restrict how software may be
                   8247:             re-distributed. In order to satisfy these restrictions,
                   8248:             the package system defines five make variables that can
                   8249:             be set to note these restrictions:</p>
                   8250: 
                   8251:             <div class="itemizedlist">
                   8252:               <ul type="disc">
                   8253:                 <li>
1.14      xtraeme  8254:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    8255: 
                   8256:                   <p>This variable should be set whenever a
                   8257:                   restriction exists (regardless of its kind). Set
                   8258:                   this variable to a string containing the reason
                   8259:                   for the restriction.</p>
                   8260:                 </li>
                   8261: 
                   8262:                 <li>
1.14      xtraeme  8263:                   <p><code class=
                   8264:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    8265: 
                   8266:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  8267:                   variable to <code class=
                   8268:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8269:                   package may not be included on a CD-ROM.</p>
                   8270:                 </li>
                   8271: 
                   8272:                 <li>
1.14      xtraeme  8273:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    8274: 
                   8275:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  8276:                   Set this variable to <code class=
                   8277:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8278:                   package may not not be made available on the
                   8279:                   Internet.</p>
                   8280:                 </li>
                   8281: 
                   8282:                 <li>
1.14      xtraeme  8283:                   <p><code class=
                   8284:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    8285: 
                   8286:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  8287:                   this variable to <code class=
                   8288:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8289:                   of the source code or other distfile(s) is not
                   8290:                   allowed on CD-ROMs.</p>
                   8291:                 </li>
                   8292: 
                   8293:                 <li>
1.14      xtraeme  8294:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    8295: 
                   8296:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  8297:                   variable to <code class=
                   8298:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8299:                   of the source code or other distfile(s) via the
                   8300:                   Internet is not allowed.</p>
                   8301:                 </li>
                   8302:               </ul>
                   8303:             </div>
                   8304: 
1.14      xtraeme  8305:             <p>Please note that the use of <code class=
                   8306:             "varname">NO_PACKAGE</code>, <code class=
                   8307:             "varname">IGNORE</code>, <code class=
                   8308:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    8309:             variables to denote restrictions is deprecated, because
                   8310:             they unconditionally prevent users from generating
                   8311:             binary packages!</p>
                   8312:           </div>
                   8313: 
                   8314:           <div class="sect2" lang="en" xml:lang="en">
                   8315:             <div class="titlepage">
                   8316:               <div>
                   8317:                 <div>
                   8318:                   <h3 class="title"><a name="dependencies" id=
                   8319:                   "dependencies"></a>12.1.3.&nbsp;Handling
                   8320:                   dependencies</h3>
                   8321:                 </div>
                   8322:               </div>
                   8323:             </div>
                   8324: 
                   8325:             <p>Your package may depend on some other package being
                   8326:             present - and there are various ways of expressing this
1.14      xtraeme  8327:             dependency. pkgsrc supports the <code class=
                   8328:             "varname">BUILD_DEPENDS</code> and <code class=
                   8329:             "varname">DEPENDS</code> definitions, as well as
                   8330:             dependencies via <code class=
                   8331:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    8332:             way to handle dependencies, and which uses the
                   8333:             variables named above. See <a href="#buildlink" title=
                   8334:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8335:             <i>Buildlink methodology</i></a> for more
                   8336:             information.</p>
                   8337: 
                   8338:             <p>The basic difference between the two variables is as
1.14      xtraeme  8339:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    8340:             definition registers that pre-requisite in the binary
                   8341:             package so it will be pulled in when the binary package
1.14      xtraeme  8342:             is later installed, whilst the <code class=
                   8343:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    8344:             marking a dependency that is only needed for building
                   8345:             the package.</p>
                   8346: 
                   8347:             <p>This means that if you only need a package present
                   8348:             whilst you are building, it should be noted as a
1.14      xtraeme  8349:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    8350: 
1.14      xtraeme  8351:             <p>The format for a <code class=
                   8352:             "varname">BUILD_DEPENDS</code> and a <code class=
                   8353:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    8354:             <pre class="programlisting">
                   8355: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   8356: </pre>
                   8357: 
                   8358:             <p>Please note that the &#8220;<span class=
                   8359:             "quote">pre-req-package-name</span>&#8221; may include
1.18      xtraeme  8360:             any of the wildcard version numbers recognized by
1.1       grant    8361:             <a href=
                   8362:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   8363:             <span class="citerefentry"><span class=
                   8364:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   8365: 
                   8366:             <div class="orderedlist">
                   8367:               <ol type="1">
                   8368:                 <li>
                   8369:                   <p>If your package needs another package's
                   8370:                   binaries or libraries to build or run, and if
1.14      xtraeme  8371:                   that package has a <code class=
                   8372:                   "filename">buildlink3.mk</code> file available,
                   8373:                   use it:</p>
1.1       grant    8374:                   <pre class="programlisting">
                   8375:     .include "../../graphics/jpeg/buildlink3.mk"
                   8376:     
                   8377: </pre>
                   8378:                 </li>
                   8379: 
                   8380:                 <li>
                   8381:                   <p>If your package needs to use another package
1.14      xtraeme  8382:                   to build itself and there is no <code class=
                   8383:                   "filename">buildlink3.mk</code> file available,
                   8384:                   use the <code class=
                   8385:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    8386:                   <pre class="programlisting">
                   8387: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   8388: </pre>
                   8389:                 </li>
                   8390: 
                   8391:                 <li>
                   8392:                   <p>If your package needs a library with which to
1.14      xtraeme  8393:                   link and again there is no <code class=
                   8394:                   "filename">buildlink3.mk</code> file available,
                   8395:                   this is specified using the <code class=
                   8396:                   "varname">DEPENDS</code> definition. An example
                   8397:                   of this is the <a xmlns=
1.1       grant    8398:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8399:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.19    ! hubertf  8400:                      class="pkgname">print/lyx</a> package, which
        !          8401:                      uses the xpm library, version 3.4j to
        !          8402:                      build:</p>
1.1       grant    8403:                   <pre class="programlisting">
                   8404: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   8405: </pre>
                   8406: 
                   8407:                   <p>You can also use wildcards in package
                   8408:                   dependences:</p>
                   8409:                   <pre class="programlisting">
                   8410: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   8411: </pre>
                   8412: 
                   8413:                   <p>Note that such wildcard dependencies are
                   8414:                   retained when creating binary packages. The
                   8415:                   dependency is checked when installing the binary
                   8416:                   package and any package which matches the pattern
                   8417:                   will be used. Wildcard dependencies should be
                   8418:                   used with care.</p>
                   8419: 
                   8420:                   <p>The &#8220;<span class=
                   8421:                   "quote">-[0-9]*</span>&#8221; should be used
                   8422:                   instead of &#8220;<span class=
                   8423:                   "quote">-*</span>&#8221; to avoid potentially
                   8424:                   ambiguous matches such as &#8220;<span class=
                   8425:                   "quote">tk-postgresql</span>&#8221; matching a
                   8426:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  8427:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    8428: 
                   8429:                   <p>Wildcards can also be used to specify that a
                   8430:                   package will only build against a certain minimum
                   8431:                   version of a pre-requisite:</p>
                   8432:                   <pre class="programlisting">
                   8433: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   8434: </pre>
                   8435: 
                   8436:                   <p>This means that the package will build against
                   8437:                   version 3.5.4 of the tiff library or newer. Such
                   8438:                   a dependency may be warranted if, for example,
                   8439:                   the API of the library has changed with version
                   8440:                   3.5.4 and a package would not compile against an
                   8441:                   earlier version of tiff.</p>
                   8442: 
                   8443:                   <p>Please note that such dependencies should only
                   8444:                   be updated if a package requires a newer
                   8445:                   pre-requisite, but not to denote recommendations
                   8446:                   such as security updates or ABI changes that do
                   8447:                   not prevent a package from building correctly.
                   8448:                   Such recommendations can be expressed using
1.14      xtraeme  8449:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    8450:                   <pre class="programlisting">
                   8451: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   8452: </pre>
                   8453: 
1.14      xtraeme  8454:                   <p>In addition to the above <code class=
                   8455:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    8456:                   while a package will build against
                   8457:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  8458:                   recommended. <code class=
                   8459:                   "varname">RECOMMENDED</code> entries will be
                   8460:                   turned into dependencies unless explicitly
                   8461:                   ignored (in which case a warning will be
                   8462:                   printed). Packages that are built with
1.1       grant    8463:                   recommendations ignored may not be uploaded to
                   8464:                   ftp.NetBSD.org by developers and should not be
                   8465:                   used across different systems that may have
                   8466:                   different versions of binary packages
                   8467:                   installed.</p>
                   8468: 
                   8469:                   <p>For security fixes, please update the package
                   8470:                   vulnerabilities file as well as setting
1.14      xtraeme  8471:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    8472:                   <a href="#security-handling" title=
                   8473:                   "12.1.7.&nbsp;Handling packages with security problems">
                   8474:                   Section 12.1.7, &#8220;Handling packages with
                   8475:                   security problems&#8221;</a> for more
                   8476:                   information.</p>
                   8477:                 </li>
                   8478: 
                   8479:                 <li>
                   8480:                   <p>If your package needs some executable to be
1.17      sketch   8481:                   able to run correctly and if there's no
1.14      xtraeme  8482:                   <code class="filename">buildlink3.mk</code> file,
                   8483:                   this is specified using the <code class=
                   8484:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    8485:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8486:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.19    ! hubertf  8487:                      class="pkgname">print/lyx</a> package needs to
        !          8488:                      be able to execute the latex binary from the
        !          8489:                      teTeX package when it runs, and that is
        !          8490:                      specified:</p>
1.1       grant    8491:                   <pre class="programlisting">
                   8492: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   8493: </pre>
                   8494: 
                   8495:                   <p>The comment about wildcard dependencies from
                   8496:                   previous paragraph applies here, too.</p>
                   8497:                 </li>
                   8498:               </ol>
                   8499:             </div>
                   8500: 
                   8501:             <p>If your package needs files from another package to
                   8502:             build, see the first part of the &#8220;<span class=
                   8503:             "quote">do-configure</span>&#8221; target <a xmlns=
                   8504:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8505:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.19    ! hubertf  8506:                class="pkgname">print/ghostscript5</a> package (it
        !          8507:                relies on the jpeg sources being present in source
        !          8508:                form during the build):</p>
1.1       grant    8509:             <pre class="programlisting">
                   8510: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   8511:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   8512:     fi
                   8513: </pre>
                   8514: 
                   8515:             <p>If you build any other packages that way, please
                   8516:             make sure the working files are deleted too when this
                   8517:             package's working files are cleaned up. The easiest way
                   8518:             to do so is by adding a pre-clean target:</p>
                   8519:             <pre class="programlisting">
                   8520: pre-clean:
                   8521:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   8522: </pre>
                   8523: 
1.14      xtraeme  8524:             <p>Please also note the <code class=
                   8525:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   8526:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   8527:             which are provided as convenience definitions. The
                   8528:             former works out whether msgfmt(1) is part of the base
                   8529:             system, and, if it isn't, installs the <a xmlns=
1.1       grant    8530:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8531:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.19    ! hubertf  8532:                class="pkgname">devel/gettext</a> package. The
        !          8533:                latter adds a build dependency on either an
        !          8534:                installed version of an older gettext package, or if
        !          8535:                it isn't, installs the <a xmlns=
        !          8536:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8537:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
        !          8538:                class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    8539:           </div>
                   8540: 
                   8541:           <div class="sect2" lang="en" xml:lang="en">
                   8542:             <div class="titlepage">
                   8543:               <div>
                   8544:                 <div>
1.19    ! hubertf  8545:                   <h3 class="title"><a name="id2591585" id=
        !          8546:                   "id2591585"></a>12.1.4.&nbsp;Handling conflicts
1.1       grant    8547:                   with other packages</h3>
                   8548:                 </div>
                   8549:               </div>
                   8550:             </div>
                   8551: 
                   8552:             <p>Your package may conflict with other packages a user
                   8553:             might already have installed on his system, e.g. if
                   8554:             your package installs the same set of files like
                   8555:             another package in our pkgsrc tree.</p>
                   8556: 
1.14      xtraeme  8557:             <p>In this case you can set <code class=
                   8558:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    8559:             packages (including version string) your package
                   8560:             conflicts with.</p>
                   8561: 
                   8562:             <p>For example <a xmlns=
                   8563:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8564:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.19    ! hubertf  8565:                class="pkgname">x11/Xaw3d</a> and <a xmlns=
        !          8566:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8567:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
        !          8568:                class="pkgname">x11/Xaw-Xpm</a> install provide the
        !          8569:                same shared library, thus you set in <code class=
        !          8570:                "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    8571:             <pre class="programlisting">
                   8572: CONFLICTS=      Xaw-Xpm-[0-9]*
                   8573: </pre>
                   8574: 
1.14      xtraeme  8575:             <p>and in <code class=
                   8576:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    8577:             <pre class="programlisting">
                   8578: CONFLICTS=      Xaw3d-[0-9]*
                   8579: </pre>
                   8580: 
                   8581:             <p>Packages will automatically conflict with other
                   8582:             packages with the name prefix and a different version
                   8583:             string. &#8220;<span class=
                   8584:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   8585:             conflict with the older version &#8220;<span class=
                   8586:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   8587:           </div>
                   8588: 
                   8589:           <div class="sect2" lang="en" xml:lang="en">
                   8590:             <div class="titlepage">
                   8591:               <div>
                   8592:                 <div>
1.19    ! hubertf  8593:                   <h3 class="title"><a name="id2591703" id=
        !          8594:                   "id2591703"></a>12.1.5.&nbsp;Packages that cannot
1.1       grant    8595:                   or should not be built</h3>
                   8596:                 </div>
                   8597:               </div>
                   8598:             </div>
                   8599: 
                   8600:             <p>There are several reasons why a package might be
                   8601:             instructed to not build under certain circumstances. If
                   8602:             the package builds and runs on most platforms, the
1.14      xtraeme  8603:             exceptions should be noted with <code class=
                   8604:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   8605:             builds and runs on a small handful of platforms, set
                   8606:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
                   8607:             If the package should be skipped (for example, because
                   8608:             it provides functionality already provided by the
                   8609:             system), set <code class=
                   8610:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   8611:             message. If the package should fail because some
                   8612:             preconditions are not met, set <code class=
                   8613:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    8614:             message.</p>
                   8615: 
1.14      xtraeme  8616:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    8617:             because it didn't provide enough information to
                   8618:             determine whether the build should fail.</p>
                   8619:           </div>
                   8620: 
                   8621:           <div class="sect2" lang="en" xml:lang="en">
                   8622:             <div class="titlepage">
                   8623:               <div>
                   8624:                 <div>
1.19    ! hubertf  8625:                   <h3 class="title"><a name="id2591729" id=
        !          8626:                   "id2591729"></a>12.1.6.&nbsp;Packages which
1.1       grant    8627:                   should not be deleted, once installed</h3>
                   8628:                 </div>
                   8629:               </div>
                   8630:             </div>
                   8631: 
                   8632:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  8633:             has been installed, the <code class=
                   8634:             "varname">PKG_PRESERVE</code> definition should be set
                   8635:             in the package Makefile. This will be carried into any
1.1       grant    8636:             binary package that is made from this pkgsrc entry. A
                   8637:             &#8220;<span class="quote">preserved</span>&#8221;
                   8638:             package will not be deleted using <a href=
                   8639:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8640:             <span class="citerefentry"><span class=
                   8641:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   8642:             the &#8220;<span class="quote">-f</span>&#8221; option
                   8643:             is used.</p>
                   8644:           </div>
                   8645: 
                   8646:           <div class="sect2" lang="en" xml:lang="en">
                   8647:             <div class="titlepage">
                   8648:               <div>
                   8649:                 <div>
                   8650:                   <h3 class="title"><a name="security-handling" id=
                   8651:                   "security-handling"></a>12.1.7.&nbsp;Handling
                   8652:                   packages with security problems</h3>
                   8653:                 </div>
                   8654:               </div>
                   8655:             </div>
                   8656: 
                   8657:             <p>When a vulnerability is found, this should be noted
1.14      xtraeme  8658:             in <code class=
                   8659:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    8660:             and after the commit of that file, it should be copied
1.14      xtraeme  8661:             to both <code class=
                   8662:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
                   8663:             and <code class=
                   8664:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
                   8665:             on ftp.NetBSD.org using <code class=
                   8666:             "filename">localsrc/security/advisories/Makefile</code>.
                   8667:             In addition, if a <code class=
                   8668:             "filename">buildlink3.mk</code> file exists for an
                   8669:             affected package, bumping <code class=
                   8670:             "varname">PKGREVISION</code> and creating a
                   8671:             corresponding <code class=
                   8672:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   8673:             "replaceable"><code>pkg</code></em></code> entry should
                   8674:             be considered. See <a href="#buildlink" title=
1.1       grant    8675:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8676:             <i>Buildlink methodology</i></a> for more information
1.14      xtraeme  8677:             about writing <code class=
                   8678:             "filename">buildlink3.mk</code> files and <code class=
                   8679:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    8680: 
                   8681:             <p>Also, if the fix should be applied to the stable
                   8682:             pkgsrc branch, be sure to submit a pullup request!</p>
                   8683:           </div>
                   8684: 
                   8685:           <div class="sect2" lang="en" xml:lang="en">
                   8686:             <div class="titlepage">
                   8687:               <div>
                   8688:                 <div>
1.19    ! hubertf  8689:                   <h3 class="title"><a name="id2591889" id=
        !          8690:                   "id2591889"></a>12.1.8.&nbsp;How to handle
1.1       grant    8691:                   compiler bugs</h3>
                   8692:                 </div>
                   8693:               </div>
                   8694:             </div>
                   8695: 
                   8696:             <p>Some source files trigger bugs in the compiler,
                   8697:             based on combinations of compiler version and
                   8698:             architecture and almost always relation to optimisation
                   8699:             being enabled. Common symptoms are gcc internal errors
                   8700:             or never finishing compiling a file.</p>
                   8701: 
                   8702:             <p>Typically a workaround involves testing the
1.14      xtraeme  8703:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    8704:             version, disabling optimisation for that
1.14      xtraeme  8705:             file/<code class="varname">MACHINE_ARCH</code>/compiler
                   8706:             combination, and documenting it in <code class=
                   8707:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    8708:             number of examples!</p>
                   8709:           </div>
                   8710: 
                   8711:           <div class="sect2" lang="en" xml:lang="en">
                   8712:             <div class="titlepage">
                   8713:               <div>
                   8714:                 <div>
1.19    ! hubertf  8715:                   <h3 class="title"><a name="id2591911" id=
        !          8716:                   "id2591911"></a>12.1.9.&nbsp;How to handle
1.1       grant    8717:                   incrementing versions when fixing an existing
                   8718:                   package</h3>
                   8719:                 </div>
                   8720:               </div>
                   8721:             </div>
                   8722: 
                   8723:             <p>When making fixes to an existing package it can be
1.14      xtraeme  8724:             useful to change the version number in <code class=
                   8725:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    8726:             future versions by the original author, a
                   8727:             &#8220;<span class="quote">nb1</span>&#8221;,
                   8728:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   8729:             suffix can be used on package versions by setting
1.14      xtraeme  8730:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   8731:             The &#8220;<span class="quote">nb</span>&#8221; is
                   8732:             treated like a &#8220;<span class=
                   8733:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    8734:             <pre class="programlisting">
                   8735:   DISTNAME= foo-17.42
                   8736:     PKGREVISION=  9
                   8737: </pre>
                   8738: 
1.14      xtraeme  8739:             <p>will result in a <code class=
                   8740:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    8741:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   8742: 
                   8743:             <p>When a new release of the package is released, the
1.14      xtraeme  8744:             <code class="varname">PKGREVISION</code> should be
                   8745:             removed. e.g. on a new minor release of the above
                   8746:             package, things should be like:</p>
1.1       grant    8747:             <pre class="programlisting">
                   8748: DISTNAME=   foo-17.43
                   8749: </pre>
                   8750:           </div>
                   8751: 
                   8752:           <div class="sect2" lang="en" xml:lang="en">
                   8753:             <div class="titlepage">
                   8754:               <div>
                   8755:                 <div>
1.19    ! hubertf  8756:                   <h3 class="title"><a name="id2591960" id=
        !          8757:                   "id2591960"></a>12.1.10.&nbsp;Portability of
1.1       grant    8758:                   packages</h3>
                   8759:                 </div>
                   8760:               </div>
                   8761:             </div>
                   8762: 
                   8763:             <p>One appealing feature of pkgsrc is that it runs on
                   8764:             many different platforms. As a result, it is important
                   8765:             to ensure, where possible, that packages in pkgsrc are
                   8766:             portable. There are some particular details you should
                   8767:             pay attention to while working on pkgsrc.</p>
                   8768: 
                   8769:             <div class="sect3" lang="en" xml:lang="en">
                   8770:               <div class="titlepage">
                   8771:                 <div>
                   8772:                   <div>
1.19    ! hubertf  8773:                     <h4 class="title"><a name="id2591965" id=
        !          8774:                     "id2591965"></a>12.1.10.1.&nbsp;${INSTALL},
1.1       grant    8775:                     ${INSTALL_DATA_DIR}, ...</h4>
                   8776:                   </div>
                   8777:                 </div>
                   8778:               </div>
                   8779: 
1.14      xtraeme  8780:               <p>The BSD-compatible <span><strong class=
                   8781:               "command">install</strong></span> supplied with some
1.1       grant    8782:               operating systems will not perform more than one
                   8783:               operation at a time. As such, you should call
                   8784:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   8785:               etc. like this:</p>
                   8786:               <pre class="programlisting">
                   8787: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   8788: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   8789: </pre>
                   8790:             </div>
                   8791:           </div>
                   8792:         </div>
                   8793: 
                   8794:         <div class="sect1" lang="en" xml:lang="en">
                   8795:           <div class="titlepage">
                   8796:             <div>
                   8797:               <div>
                   8798:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  8799:                 "id2591985" id="id2591985"></a>12.2.&nbsp;Possible
1.1       grant    8800:                 downloading issues</h2>
                   8801:               </div>
                   8802:             </div>
                   8803:           </div>
                   8804: 
                   8805:           <div class="sect2" lang="en" xml:lang="en">
                   8806:             <div class="titlepage">
                   8807:               <div>
                   8808:                 <div>
1.19    ! hubertf  8809:                   <h3 class="title"><a name="id2591988" id=
        !          8810:                   "id2591988"></a>12.2.1.&nbsp;Packages whose
1.1       grant    8811:                   distfiles aren't available for plain
                   8812:                   downloading</h3>
                   8813:                 </div>
                   8814:               </div>
                   8815:             </div>
                   8816: 
                   8817:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  8818:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   8819:             and a <span><strong class="command">make
                   8820:             fetch</strong></span> will call <code class=
                   8821:             "filename">files/getsite.sh</code> with the name of
                   8822:             each file to download as an argument, expecting it to
                   8823:             output the URL of the directory from which to download
                   8824:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8825:             href=
1.1       grant    8826:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.19    ! hubertf  8827:                class="pkgname">graphics/ns-cult3d</a> is an example
        !          8828:                of this usage.</p>
1.1       grant    8829: 
                   8830:             <p>If the download can't be automated, because the user
                   8831:             must submit personal information to apply for a
                   8832:             password, or must pay for the source, or whatever, you
1.14      xtraeme  8833:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   8834:             a macro which displays a message explaining the
                   8835:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   8836:             must be executable shell commands, not just a message.
                   8837:             (Generally, it executes <code class=
                   8838:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    8839:             following packages use this: <a xmlns=
                   8840:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8841:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.19    ! hubertf  8842:                class="pkgname">audio/realplayer</a>, <a xmlns=
        !          8843:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8844:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
        !          8845:                class="pkgname">cad/simian</a>, <a xmlns=
        !          8846:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8847:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
        !          8848:                class="pkgname">devel/ipv6socket</a>, <a xmlns=
        !          8849:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8850:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
        !          8851:                class="pkgname">emulators/vmware-module</a>,
        !          8852:                <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          8853:                href=
        !          8854:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
        !          8855:                class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
        !          8856:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8857:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
        !          8858:                class="pkgname">sysutils/storage-manager</a>,
        !          8859:                <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          8860:                href=
        !          8861:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
        !          8862:                class="pkgname">www/ap-aolserver</a>, <a xmlns=
        !          8863:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8864:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
        !          8865:                class="pkgname">www/openacs</a>. Try to be
        !          8866:                consistent with them.</p>
1.1       grant    8867:           </div>
                   8868: 
                   8869:           <div class="sect2" lang="en" xml:lang="en">
                   8870:             <div class="titlepage">
                   8871:               <div>
                   8872:                 <div>
1.19    ! hubertf  8873:                   <h3 class="title"><a name="id2592051" id=
        !          8874:                   "id2592051"></a>12.2.2.&nbsp;How to handle
1.1       grant    8875:                   modified distfiles with the 'old' name</h3>
                   8876:                 </div>
                   8877:               </div>
                   8878:             </div>
                   8879: 
                   8880:             <p>Sometimes authors of a software package make some
                   8881:             modifications after the software was released, and they
                   8882:             put up a new distfile without changing the package's
                   8883:             version number. If a package is already in pkgsrc at
                   8884:             that time, the md5 checksum will no longer match. The
                   8885:             correct way to work around this is to update the
                   8886:             package's md5 checksum to match the package on the
                   8887:             master site (beware, any mirrors may not be up to date
                   8888:             yet!), and to remove the old distfile from
1.14      xtraeme  8889:             ftp.NetBSD.org's <code class=
                   8890:             "filename">/pub/NetBSD/packages/distfiles</code>
1.1       grant    8891:             directory. Furthermore, a mail to the package's author
                   8892:             seems appropriate making sure the distfile was really
                   8893:             updated on purpose, and that no trojan horse or so
                   8894:             crept in.</p>
                   8895:           </div>
                   8896:         </div>
                   8897: 
                   8898:         <div class="sect1" lang="en" xml:lang="en">
                   8899:           <div class="titlepage">
                   8900:             <div>
                   8901:               <div>
                   8902:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  8903:                 "id2592062" id=
        !          8904:                 "id2592062"></a>12.3.&nbsp;Configuration
1.1       grant    8905:                 gotchas</h2>
                   8906:               </div>
                   8907:             </div>
                   8908:           </div>
                   8909: 
                   8910:           <div class="sect2" lang="en" xml:lang="en">
                   8911:             <div class="titlepage">
                   8912:               <div>
                   8913:                 <div>
                   8914:                   <h3 class="title"><a name="fixes.libtool" id=
                   8915:                   "fixes.libtool"></a>12.3.1.&nbsp;Shared libraries
                   8916:                   - libtool</h3>
                   8917:                 </div>
                   8918:               </div>
                   8919:             </div>
                   8920: 
                   8921:             <p>pkgsrc supports many different machines, with
                   8922:             different object formats like a.out and ELF, and
                   8923:             varying abilities to do shared library and dynamic
                   8924:             loading at all. To accompany this, varying commands and
                   8925:             options have to be passed to the compiler, linker, etc.
                   8926:             to get the Right Thing, which can be pretty annoying
                   8927:             especially if you don't have all the machines at your
                   8928:             hand to test things. The <a xmlns=
                   8929:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8930:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.19    ! hubertf  8931:                class="pkgname">devel/libtool</a> pkg can help here,
        !          8932:                as it just &#8220;<span class=
        !          8933:                "quote">knows</span>&#8221; how to build both static
        !          8934:                and dynamic libraries from a set of source files,
        !          8935:                thus being platform independent.</p>
1.1       grant    8936: 
                   8937:             <p>Here's how to use libtool in a pkg in seven simple
                   8938:             steps:</p>
                   8939: 
                   8940:             <div class="orderedlist">
                   8941:               <ol type="1">
                   8942:                 <li>
1.14      xtraeme  8943:                   <p>Add <code class=
                   8944:                   "varname">USE_LIBTOOL=yes</code> to the package
                   8945:                   Makefile.</p>
1.1       grant    8946:                 </li>
                   8947: 
                   8948:                 <li>
                   8949:                   <p>For library objects, use &#8220;<span class=
                   8950:                   "quote">${LIBTOOL} --mode=compile
                   8951:                   ${CC}</span>&#8221; in place of
                   8952:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   8953:                   You could even add it to the definition of
1.14      xtraeme  8954:                   <code class="varname">CC</code>, if only
                   8955:                   libraries are being built in a given Makefile.
                   8956:                   This one command will build both PIC and non-PIC
                   8957:                   library objects, so you need not have separate
                   8958:                   shared and non-shared library rules.</p>
1.1       grant    8959:                 </li>
                   8960: 
                   8961:                 <li>
                   8962:                   <p>For the linking of the library, remove any
                   8963:                   &#8220;<span class="quote">ar</span>&#8221;,
                   8964:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   8965:                   and &#8220;<span class="quote">ld
                   8966:                   -Bshareable</span>&#8221; commands, and instead
                   8967:                   use:</p>
                   8968:                   <pre class="programlisting">
                   8969: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   8970: </pre>
                   8971: 
                   8972:                   <p>Note that the library is changed to have a
1.14      xtraeme  8973:                   <code class="filename">.la</code> extension, and
                   8974:                   the objects are changed to have a <code class=
                   8975:                   "filename">.lo</code> extension. Change
                   8976:                   <code class="varname">OBJS</code> as necessary.
                   8977:                   This automatically creates all of the
                   8978:                   <code class="filename">.a</code>, <code class=
                   8979:                   "filename">.so.major.minor</code>, and ELF
                   8980:                   symlinks (if necessary) in the build directory.
                   8981:                   Be sure to include &#8220;<span class=
1.1       grant    8982:                   "quote">-version-info</span>&#8221;, especially
                   8983:                   when major and minor are zero, as libtool will
                   8984:                   otherwise strip off the shared library
                   8985:                   version.</p>
                   8986: 
                   8987:                   <p>From the libtool manual:</p>
                   8988:                   <pre class="programlisting">
                   8989:      So, libtool library versions are described by three integers:
                   8990: 
                   8991: CURRENT
                   8992:        The most recent interface number that this library implements.
                   8993: 
                   8994: REVISION
                   8995:        The implementation number of the CURRENT interface.
                   8996: 
                   8997: AGE
                   8998:        The difference between the newest and oldest interfaces that this
                   8999:        library implements.  In other words, the library implements all the
                   9000:        interface numbers in the range from number `CURRENT - AGE' to
                   9001:        `CURRENT'.
                   9002:        
                   9003:      If two libraries have identical CURRENT and AGE numbers, then the
                   9004: dynamic linker chooses the library with the greater REVISION number. 
                   9005: </pre>
                   9006: 
                   9007:                   <p>The &#8220;<span class=
                   9008:                   "quote">-release</span>&#8221; option will
                   9009:                   produce different results for a.out and ELF
                   9010:                   (excluding symlinks) in only one case. An ELF
                   9011:                   library of the form &#8220;<span class=
                   9012:                   "quote">libfoo-release.so.<span class=
                   9013:                   "emphasis"><em>x</em></span>.<span class=
                   9014:                   "emphasis"><em>y</em></span></span>&#8221; will
                   9015:                   have a symlink of &#8220;<span class=
                   9016:                   "quote">libfoo.so.<span class=
                   9017:                   "emphasis"><em>x</em></span>.<span class=
                   9018:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   9019:                   a.out platform. This is handled
                   9020:                   automatically.</p>
                   9021: 
                   9022:                   <p>The &#8220;<span class="quote">-rpath
                   9023:                   argument</span>&#8221; is the install directory
                   9024:                   of the library being built.</p>
                   9025: 
1.14      xtraeme  9026:                   <p>In the <code class="filename">PLIST</code>,
1.19    ! hubertf  9027:                   include only the <code class=
        !          9028:                   "filename">.la</code> file, the other files will
        !          9029:                   be added automatically.</p>
1.1       grant    9030:                 </li>
                   9031: 
                   9032:                 <li>
1.14      xtraeme  9033:                   <p>When linking shared object (<code class=
                   9034:                   "filename">.so</code>) files, i.e. files that are
1.1       grant    9035:                   loaded via dlopen(3), NOT shared libraries, use
                   9036:                   &#8220;<span class="quote">-module
                   9037:                   -avoid-version</span>&#8221; to prevent them
                   9038:                   getting version tacked on.</p>
                   9039: 
1.14      xtraeme  9040:                   <p>The <code class="filename">PLIST</code> file
                   9041:                   gets the <code class="filename">foo.so</code>
                   9042:                   entry.</p>
1.1       grant    9043:                 </li>
                   9044: 
                   9045:                 <li>
                   9046:                   <p>When linking programs that depend on these
                   9047:                   libraries <span class=
                   9048:                   "emphasis"><em>before</em></span> they are
                   9049:                   installed, preface the <a href=
                   9050:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   9051:                   <span class="citerefentry"><span class=
                   9052:                   "refentrytitle">cc</span>(1)</span></a> or
                   9053:                   <a href=
                   9054:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   9055:                   <span class="citerefentry"><span class=
                   9056:                   "refentrytitle">ld</span>(1)</span></a> line with
                   9057:                   &#8220;<span class="quote">${LIBTOOL}
                   9058:                   --mode=link</span>&#8221;, and it will find the
                   9059:                   correct libraries (static or shared), but please
                   9060:                   be aware that libtool will not allow you to
                   9061:                   specify a relative path in -L (such as
                   9062:                   &#8220;<span class=
                   9063:                   "quote">-L../somelib</span>&#8221;), because it
                   9064:                   expects you to change that argument to be the
1.14      xtraeme  9065:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    9066:                   <pre class="programlisting">
                   9067: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   9068: </pre>
                   9069: 
                   9070:                   <p>should be changed to:</p>
                   9071:                   <pre class="programlisting">
1.14      xtraeme  9072: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   9073: "replaceable"><code>someprog</code></em> <em class=
                   9074: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    9075: </pre>
                   9076: 
                   9077:                   <p>and it will do the right thing with the
                   9078:                   libraries.</p>
                   9079:                 </li>
                   9080: 
                   9081:                 <li>
                   9082:                   <p>When installing libraries, preface the
                   9083:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   9084:                   <span class="citerefentry"><span class=
                   9085:                   "refentrytitle">install</span>(1)</span></a> or
                   9086:                   <a href=
                   9087:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   9088:                   <span class="citerefentry"><span class=
                   9089:                   "refentrytitle">cp</span>(1)</span></a> command
                   9090:                   with &#8220;<span class="quote">${LIBTOOL}
                   9091:                   --mode=install</span>&#8221;, and change the
1.14      xtraeme  9092:                   library name to <code class=
                   9093:                   "filename">.la</code>. e.g.</p>
1.1       grant    9094:                   <pre class="programlisting">
                   9095: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   9096: </pre>
                   9097: 
1.14      xtraeme  9098:                   <p>This will install the static <code class=
                   9099:                   "filename">.a</code>, shared library, any needed
1.1       grant    9100:                   symlinks, and run <a href=
                   9101:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   9102:                   <span class="citerefentry"><span class=
                   9103:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   9104:                 </li>
                   9105: 
                   9106:                 <li>
1.14      xtraeme  9107:                   <p>In your <code class="filename">PLIST</code>,
                   9108:                   include all of the <code class=
                   9109:                   "filename">.a</code>, <code class=
                   9110:                   "filename">.la</code>, and <code class=
                   9111:                   "filename">.so</code>, <code class=
                   9112:                   "filename">.so.CURRENT</code> and <code class=
                   9113:                   "filename">.so.CURRENT.REVISION</code> files
                   9114:                   (this is a change from the previous
                   9115:                   behaviour).</p>
1.1       grant    9116:                 </li>
                   9117:               </ol>
                   9118:             </div>
                   9119:           </div>
                   9120: 
                   9121:           <div class="sect2" lang="en" xml:lang="en">
                   9122:             <div class="titlepage">
                   9123:               <div>
                   9124:                 <div>
1.19    ! hubertf  9125:                   <h3 class="title"><a name="id2592441" id=
        !          9126:                   "id2592441"></a>12.3.2.&nbsp;Using libtool on GNU
1.1       grant    9127:                   packages that already support libtool</h3>
                   9128:                 </div>
                   9129:               </div>
                   9130:             </div>
                   9131: 
1.14      xtraeme  9132:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   9133:             the package Makefile. This will override the package's
                   9134:             own libtool in most cases. For older libtool using
1.1       grant    9135:             packages, libtool is made by ltconfig script during the
                   9136:             do-configure step; you can check the libtool script
1.14      xtraeme  9137:             location by doing <span><strong class="command">make
                   9138:             configure; find work*/ -name
                   9139:             libtool</strong></span>.</p>
                   9140: 
                   9141:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   9142:             specifies which libtool scripts, relative to
                   9143:             <code class="varname">WRKSRC</code>, to override. By
                   9144:             default, it is set to &#8220;<span class=
                   9145:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   9146:             this does not match the location of the package's
                   9147:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  9148: 
1.14      xtraeme  9149:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    9150:             static libraries built and installed, then use
1.14      xtraeme  9151:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    9152:             instead.</p>
                   9153: 
                   9154:             <p>If your package makes use of the platform
                   9155:             independent library for loading dynamic shared objects,
                   9156:             that comes with libtool (libltdl), you should include
1.14      xtraeme  9157:             the libtool buildlink3.mk (and set <code class=
                   9158:             "varname">USE_BUILDLINK3=YES</code>).</p>
1.1       grant    9159: 
                   9160:             <p>Some packages use libtool incorrectly so that the
                   9161:             package may not work or build in some circumstances.
                   9162:             Some of the more common errors are:</p>
                   9163: 
                   9164:             <div class="itemizedlist">
                   9165:               <ul type="disc">
                   9166:                 <li>
                   9167:                   <p>The inclusion of a shared object (-module) as
                   9168:                   a dependent library in an executable or library.
                   9169:                   This in itself isn't a problem if one of two
                   9170:                   things has been done:</p>
                   9171: 
                   9172:                   <div class="orderedlist">
                   9173:                     <ol type="1">
                   9174:                       <li>
                   9175:                         <p>The shared object is named correctly,
1.14      xtraeme  9176:                         i.e. <code class=
                   9177:                         "filename">libfoo.la</code>, not
                   9178:                         <code class="filename">foo.la</code></p>
1.1       grant    9179:                       </li>
                   9180: 
                   9181:                       <li>
                   9182:                         <p>The -dlopen option is used when linking
                   9183:                         an executable.</p>
                   9184:                       </li>
                   9185:                     </ol>
                   9186:                   </div>
                   9187:                 </li>
                   9188: 
                   9189:                 <li>
                   9190:                   <p>The use of libltdl without the correct calls
                   9191:                   to initialisation routines. The function
                   9192:                   lt_dlinit() should be called and the macro
1.14      xtraeme  9193:                   <code class=
                   9194:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    9195:                   included in executables.</p>
                   9196:                 </li>
                   9197:               </ul>
                   9198:             </div>
                   9199:           </div>
                   9200: 
                   9201:           <div class="sect2" lang="en" xml:lang="en">
                   9202:             <div class="titlepage">
                   9203:               <div>
                   9204:                 <div>
1.19    ! hubertf  9205:                   <h3 class="title"><a name="id2592594" id=
        !          9206:                   "id2592594"></a>12.3.3.&nbsp;GNU
1.1       grant    9207:                   Autoconf/Automake</h3>
                   9208:                 </div>
                   9209:               </div>
                   9210:             </div>
                   9211: 
                   9212:             <p>If a package needs GNU autoconf or automake to be
                   9213:             executed to regenerate the configure script and
                   9214:             Makefile.in makefile templates, then they should be
                   9215:             executed in a pre-configure target. Two Makefile
1.14      xtraeme  9216:             fragments are provided in <code class=
                   9217:             "filename">pkgsrc/mk/autoconf.mk</code> and
                   9218:             <code class="filename">pkgsrc/mk/automake.mk</code> to
                   9219:             help dealing with these tools. See comments in these
                   9220:             files for details.</p>
1.1       grant    9221: 
                   9222:             <p>For packages that need only autoconf:</p>
                   9223:             <pre class="programlisting">
                   9224: AUTOCONF_REQD=    2.50    # if default version is not good enough
                   9225: ...
                   9226: 
                   9227: pre-configure:
                   9228:           cd ${WRKSRC}; ${AUTOCONF}
                   9229: 
                   9230: ...
                   9231: .include "../../mk/autoconf.mk"
                   9232: </pre>
                   9233: 
                   9234:             <p>and for packages that need automake and
                   9235:             autoconf:</p>
                   9236:             <pre class="programlisting">
                   9237: AUTOMAKE_REQD=  1.7.1   # if default version is not good enough
                   9238: ...
                   9239: 
                   9240: pre-configure:
                   9241:           cd ${WRKSRC};                                           \
                   9242:           ${ACLOCAL};                                             \
                   9243:           ${AUTOHEADER};                                          \
                   9244:           ${AUTOMAKE} -a --foreign -i;                            \
                   9245:           ${AUTOCONF}
                   9246: 
                   9247: ...
                   9248: .include "../mk/automake.mk"
                   9249: </pre>
                   9250: 
                   9251:             <p>Packages which use GNU Automake will almost
                   9252:             certainly require GNU Make, but that's automatically
1.14      xtraeme  9253:             provided for you in <code class=
                   9254:             "filename">mk/automake.mk</code>.</p>
1.1       grant    9255: 
                   9256:             <p>There are times when the configure process makes
                   9257:             additional changes to the generated files, which then
                   9258:             causes the build process to try to re-execute the
                   9259:             automake sequence. This is prevented by touching
                   9260:             various files in the configure stage. If this causes
1.14      xtraeme  9261:             problems with your package you can set <code class=
                   9262:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    9263:             Makefile.</p>
                   9264:           </div>
                   9265:         </div>
                   9266: 
                   9267:         <div class="sect1" lang="en" xml:lang="en">
                   9268:           <div class="titlepage">
                   9269:             <div>
                   9270:               <div>
                   9271:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  9272:                 "id2592775" id="id2592775"></a>12.4.&nbsp;Building
1.1       grant    9273:                 considerations</h2>
                   9274:               </div>
                   9275:             </div>
                   9276:           </div>
                   9277: 
                   9278:           <div class="sect2" lang="en" xml:lang="en">
                   9279:             <div class="titlepage">
                   9280:               <div>
                   9281:                 <div>
1.19    ! hubertf  9282:                   <h3 class="title"><a name="id2592778" id=
        !          9283:                   "id2592778"></a>12.4.1.&nbsp;CPP defines</h3>
1.1       grant    9284:                 </div>
                   9285:               </div>
                   9286:             </div>
                   9287: 
                   9288:             <p>To port an application to NetBSD, it's usually
                   9289:             necessary for the compiler to be able to judge the
                   9290:             system on which it's compiling, and we use definitions
                   9291:             so that the C pre-processor can do this.</p>
                   9292: 
                   9293:             <p>To test whether you are working on a 4.4 BSD-derived
                   9294:             system, you should use the BSD definition, which is
1.14      xtraeme  9295:             defined in <code class=
                   9296:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    9297:             systems.</p>
                   9298:             <pre class="programlisting">
                   9299: #include &lt;sys/param.h&gt;
                   9300: </pre>
                   9301: 
                   9302:             <p>and then you can surround the BSD-specific parts of
                   9303:             your package's C/C++ code using this conditional:</p>
                   9304:             <pre class="programlisting">
                   9305: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   9306:     ...
                   9307: #endif
                   9308: </pre>
                   9309: 
                   9310:             <p>Please use the &#8220;<span class=
                   9311:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   9312:             it should only apply to features of NetBSD that are not
                   9313:             present in other 4.4-lite derived BSDs.</p>
                   9314:           </div>
                   9315:         </div>
                   9316: 
                   9317:         <div class="sect1" lang="en" xml:lang="en">
                   9318:           <div class="titlepage">
                   9319:             <div>
                   9320:               <div>
                   9321:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  9322:                 "id2592808" id="id2592808"></a>12.5.&nbsp;Package
1.1       grant    9323:                 specific actions</h2>
                   9324:               </div>
                   9325:             </div>
                   9326:           </div>
                   9327: 
                   9328:           <div class="sect2" lang="en" xml:lang="en">
                   9329:             <div class="titlepage">
                   9330:               <div>
                   9331:                 <div>
1.19    ! hubertf  9332:                   <h3 class="title"><a name="id2592811" id=
        !          9333:                   "id2592811"></a>12.5.1.&nbsp;Package
1.1       grant    9334:                   configuration files</h3>
                   9335:                 </div>
                   9336:               </div>
                   9337:             </div>
                   9338: 
                   9339:             <p>Packages should be taught to look for their
1.14      xtraeme  9340:             configuration files in <code class=
                   9341:             "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1       grant    9342:             through to the configure and build processes.
1.14      xtraeme  9343:             <code class="varname">PKG_SYSCONFDIR</code> may be
1.1       grant    9344:             customized in various ways by setting other make
                   9345:             variables:</p>
                   9346: 
                   9347:             <div class="itemizedlist">
                   9348:               <ul type="disc">
                   9349:                 <li>
1.14      xtraeme  9350:                   <p><code class="varname">PKG_SYSCONFBASE</code>
                   9351:                   is the main config directory under which all
                   9352:                   package configuration files are to be found. This
                   9353:                   defaults to <code class=
                   9354:                   "filename">${PREFIX}/etc</code>, but may be
                   9355:                   overridden in <code class=
                   9356:                   "filename">/etc/mk.conf</code>.</p>
1.1       grant    9357:                 </li>
                   9358: 
                   9359:                 <li>
1.14      xtraeme  9360:                   <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   9361:                   is the subdirectory of <code class=
                   9362:                   "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    9363:                   configuration files for a particular package may
                   9364:                   be found, e.g. the Apache configuration files may
1.14      xtraeme  9365:                   all be found under the <code class=
                   9366:                   "filename">httpd/</code> subdirectory of
                   9367:                   <code class="varname">${PKG_SYSCONFBASE}</code>.
                   9368:                   This should be set in the package Makefile.</p>
1.1       grant    9369:                 </li>
                   9370: 
                   9371:                 <li>
1.14      xtraeme  9372:                   <p>By default, <code class=
                   9373:                   "varname">PKG_SYSCONFDIR</code> is set to
                   9374:                   <code class=
                   9375:                   "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
                   9376:                   but this may be overridden by setting
                   9377:                   <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9378:                   for a particular package, where <code class=
                   9379:                   "varname">PKG_SYSCONFVAR</code> defaults to
                   9380:                   <code class="varname">${PKGBASE}</code>. This is
                   9381:                   not meant to be set by a package Makefile, but is
1.1       grant    9382:                   reserved for users who wish to override the
1.14      xtraeme  9383:                   <code class="varname">PKG_SYSCONFDIR</code>
                   9384:                   setting for a particular package with a special
1.1       grant    9385:                   location.</p>
                   9386:                 </li>
                   9387:               </ul>
                   9388:             </div>
                   9389: 
                   9390:             <p>The only variables that users should customize are
1.14      xtraeme  9391:             <code class="varname">PKG_SYSCONFBASE</code> and
                   9392:             <code class=
                   9393:             "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
                   9394:             Users will typically want to set <code class=
                   9395:             "varname">PKG_SYSCONFBASE</code> to <code class=
                   9396:             "filename">/etc</code>, or to accept the default
                   9397:             location of <code class=
                   9398:             "filename">${PREFIX}/etc</code>.</p>
1.1       grant    9399:           </div>
                   9400: 
                   9401:           <div class="sect2" lang="en" xml:lang="en">
                   9402:             <div class="titlepage">
                   9403:               <div>
                   9404:                 <div>
1.19    ! hubertf  9405:                   <h3 class="title"><a name="id2592982" id=
        !          9406:                   "id2592982"></a>12.5.2.&nbsp;User
1.2       hubertf  9407:                   interaction</h3>
1.1       grant    9408:                 </div>
                   9409:               </div>
                   9410:             </div>
                   9411: 
                   9412:             <p>Occasionally, packages require interaction from the
                   9413:             user, and this can be in a number of ways:</p>
                   9414: 
                   9415:             <div class="itemizedlist">
                   9416:               <ul type="disc">
                   9417:                 <li>
                   9418:                   <p>help in fetching the distfiles</p>
                   9419:                 </li>
                   9420: 
                   9421:                 <li>
                   9422:                   <p>help to configure the package before it is
                   9423:                   built</p>
                   9424:                 </li>
                   9425: 
                   9426:                 <li>
                   9427:                   <p>help during the build process</p>
                   9428:                 </li>
                   9429: 
                   9430:                 <li>
                   9431:                   <p>help during the installation of a package</p>
                   9432:                 </li>
                   9433:               </ul>
                   9434:             </div>
                   9435: 
1.14      xtraeme  9436:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    9437:             definition is provided to notify the pkgsrc mechanism
                   9438:             of an interactive stage which will be needed, and this
1.14      xtraeme  9439:             should be set in the package's <code class=
                   9440:             "filename">Makefile</code>. e.g.</p>
1.1       grant    9441:             <pre class="programlisting">
                   9442: INTERACTIVE_STAGE= build
                   9443: </pre>
                   9444: 
                   9445:             <p>Multiple interactive stages can be specified:</p>
                   9446:             <pre class="programlisting">
                   9447: INTERACTIVE_STAGE= configure install
                   9448: </pre>
                   9449:           </div>
                   9450: 
                   9451:           <div class="sect2" lang="en" xml:lang="en">
                   9452:             <div class="titlepage">
                   9453:               <div>
                   9454:                 <div>
1.19    ! hubertf  9455:                   <h3 class="title"><a name="id2593027" id=
        !          9456:                   "id2593027"></a>12.5.3.&nbsp;Handling
1.1       grant    9457:                   licenses</h3>
                   9458:                 </div>
                   9459:               </div>
                   9460:             </div>
                   9461: 
                   9462:             <p>A package may underly a license which the user has
                   9463:             or has not agreed to accept. Usually, packages that
                   9464:             underly well-known Open Source licenses (e.g. the GNU
                   9465:             Public License, GPL) won't have any special license
                   9466:             tags added in pkgsrc which require special action by
                   9467:             the user of such packages, but there are quite a number
                   9468:             of other licenses out there that pkgsrc users may not
                   9469:             be able to follow, for whatever reasons. For these
                   9470:             cases, pkgsrc contains a mechanism to note that a
                   9471:             package underlies a certain license, and the user has
                   9472:             to accept the license before the package can be
                   9473:             installed.</p>
                   9474: 
                   9475:             <p>Placing a certain package under a certain license
1.14      xtraeme  9476:             works by setting the <code class=
                   9477:             "varname">LICENSE</code> variable to a string
                   9478:             identifying the license, e.g. in <a xmlns=
                   9479:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9480:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.19    ! hubertf  9481:                class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    9482:             <pre class="programlisting">
                   9483: LICENSE=        graphviz-license
                   9484: </pre>
                   9485: 
                   9486:             <p>When trying to build, the user will get a notice
                   9487:             that the package underlies a license which he hasn't
                   9488:             accepted (yet):</p>
                   9489:             <pre class="programlisting">
1.14      xtraeme  9490: <code class="prompt">%</code> <strong class=
                   9491: "userinput"><code>make</code></strong>
1.1       grant    9492: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   9493: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   9494: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   9495: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   9496: *** Error code 1
                   9497: </pre>
                   9498: 
1.14      xtraeme  9499:             <p>The license can be viewed with <span><strong class=
                   9500:             "command">make show-license</strong></span>, and if it
                   9501:             is considered appropriate, the line printed above can
                   9502:             be added to <code class="filename">/etc/mk.conf</code>
                   9503:             to indicate acceptance of the particular license:</p>
1.1       grant    9504:             <pre class="programlisting">
                   9505: ACCEPTABLE_LICENSES+=graphviz-license
                   9506: </pre>
                   9507: 
                   9508:             <p>When adding a package with a new license, the
1.14      xtraeme  9509:             license text should be added to <code class=
                   9510:             "filename">pkgsrc/licenses</code> for displaying. A
                   9511:             list of known licenses can be seen in this directory as
                   9512:             well as by looking at the list of (commented out)
                   9513:             <code class="varname">ACCEPTABLE_LICENSES</code>
                   9514:             variable settings in <code class=
                   9515:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    9516: 
1.17      sketch   9517:             <p>If there is a <span class=
1.1       grant    9518:             "emphasis"><em>really</em></span> pressing need to
                   9519:             accept all licenses at once, like when trying to
                   9520:             download or mirror all distfiles or doing a bulk build
                   9521:             to test if all packages in pkgsrc build, this can be
1.14      xtraeme  9522:             done by setting <code class=
                   9523:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    9524:           </div>
                   9525: 
                   9526:           <div class="sect2" lang="en" xml:lang="en">
                   9527:             <div class="titlepage">
                   9528:               <div>
                   9529:                 <div>
1.19    ! hubertf  9530:                   <h3 class="title"><a name="id2593178" id=
        !          9531:                   "id2593178"></a>12.5.4.&nbsp;Creating an account
1.1       grant    9532:                   from a package</h3>
                   9533:                 </div>
                   9534:               </div>
                   9535:             </div>
                   9536: 
                   9537:             <p>There are two make variables used to control the
                   9538:             creation of package-specific groups and users at
1.14      xtraeme  9539:             pre-install time. The first is <code class=
                   9540:             "varname">PKG_GROUPS</code>, which is a list of
1.1       grant    9541:             group[:groupid] elements, where the groupid is
1.14      xtraeme  9542:             optional. The second is <code class=
                   9543:             "varname">PKG_USERS</code>, which is a list of elements
1.1       grant    9544:             of the form:</p>
                   9545:             <pre class="programlisting">
                   9546: user:group[:[userid][:[description][:[home][:shell]]]]
                   9547: </pre>
                   9548: 
                   9549:             <p>where only the user and group are required, the rest
                   9550:             being optional. A simple example is:</p>
                   9551:             <pre class="programlisting">
                   9552:   PKG_GROUPS=       foogroup
                   9553:     PKG_USERS=    foouser:foogroup
                   9554: </pre>
                   9555: 
                   9556:             <p>A more complex example is that creates two groups
                   9557:             and two users is:</p>
                   9558:             <pre class="programlisting">
                   9559:   PKG_GROUPS=       group1 group2:1005
                   9560:     PKG_USERS=    first:group1::First\\ User                      \
                   9561:                   second:group2::Second\\ User:/home/second:${SH}
                   9562: </pre>
                   9563: 
                   9564:             <p>By default, a new user will have home directory
1.14      xtraeme  9565:             <code class="filename">/nonexistent</code>, and login
                   9566:             shell <code class="filename">/sbin/nologin</code>
                   9567:             unless they are specified as part of the user
                   9568:             element.</p>
1.1       grant    9569: 
1.14      xtraeme  9570:             <p>The package <code class="filename">Makefile</code>
                   9571:             must also set <code class=
                   9572:             "varname">USE_PKGINSTALL=YES</code>. This will cause
                   9573:             the users and groups to be created at pre-install time,
                   9574:             and the admin will be prompted to remove them at
                   9575:             post-deinstall time. Automatic creation of the users
                   9576:             and groups can be toggled on and off by setting the
                   9577:             <code class="varname">PKG_CREATE_USERGROUP</code>
                   9578:             variable prior to package installation.</p>
1.1       grant    9579:           </div>
                   9580: 
                   9581:           <div class="sect2" lang="en" xml:lang="en">
                   9582:             <div class="titlepage">
                   9583:               <div>
                   9584:                 <div>
1.19    ! hubertf  9585:                   <h3 class="title"><a name="id2593240" id=
        !          9586:                   "id2593240"></a>12.5.5.&nbsp;Installing score
1.1       grant    9587:                   files</h3>
                   9588:                 </div>
                   9589:               </div>
                   9590:             </div>
                   9591: 
                   9592:             <p>Certain packages, most of them in the games
                   9593:             category, install a score file that allows all users on
                   9594:             the system to record their highscores. In order for
                   9595:             this to work, the binaries need to be installed setgid
                   9596:             and the score files owned by the appropriate group
                   9597:             and/or owner (traditionally the "games" user/group).
                   9598:             The following variables, documented in more detail in
1.14      xtraeme  9599:             <code class="filename">mk/defaults/mk.conf</code>,
                   9600:             control this behaviour: <code class=
                   9601:             "varname">SETGIDGAME</code>, <code class=
                   9602:             "varname">GAMEDATAMODE</code>, <code class=
                   9603:             "varname">GAMEGRP</code>, <code class=
                   9604:             "varname">GAMEMODE</code>, <code class=
                   9605:             "varname">GAMEOWN</code>.</p>
1.1       grant    9606: 
                   9607:             <p>Note that per default, setgid installation of games
1.14      xtraeme  9608:             is disabled; setting <code class=
                   9609:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    9610:             variables accordingly.</p>
                   9611: 
                   9612:             <p>A package should therefor never hard code file
1.14      xtraeme  9613:             ownership or access permissions but rely on
                   9614:             <code class="varname">INSTALL_GAME</code> and
                   9615:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   9616:             these correctly.</p>
1.1       grant    9617:           </div>
                   9618: 
                   9619:           <div class="sect2" lang="en" xml:lang="en">
                   9620:             <div class="titlepage">
                   9621:               <div>
                   9622:                 <div>
1.19    ! hubertf  9623:                   <h3 class="title"><a name="id2593284" id=
        !          9624:                   "id2593284"></a>12.5.6.&nbsp;Packages providing
1.1       grant    9625:                   login shells</h3>
                   9626:                 </div>
                   9627:               </div>
                   9628:             </div>
                   9629: 
                   9630:             <p>If the purpose of the package is to provide a login
1.14      xtraeme  9631:             shell, the variable <code class=
                   9632:             "varname">PKG_SHELL</code> should contain the full
                   9633:             pathname of the shell executable installed by this
                   9634:             package. The package <code class=
                   9635:             "filename">Makefile</code> must also set <code class=
                   9636:             "varname">USE_PKGINSTALL=YES</code> to use the
                   9637:             automatically generated <code class=
                   9638:             "filename">INSTALL</code>/<code class=
                   9639:             "filename">DEINSTALL</code> scripts.</p>
1.1       grant    9640: 
                   9641:             <p>An example taken from shells/zsh:</p>
                   9642:             <pre class="programlisting">
                   9643:   USE_PKGINSTALL=   YES
                   9644:     PKG_SHELL=    ${PREFIX}/bin/zsh
                   9645: </pre>
                   9646: 
1.14      xtraeme  9647:             <p>The shell is registered into <code class=
                   9648:             "filename">/etc/shells</code> file automatically in the
                   9649:             post-install target by the generated <code class=
                   9650:             "filename">INSTALL</code> script and removed in the
                   9651:             deinstall target by the <code class=
                   9652:             "filename">DEINSTALL</code> script.</p>
1.1       grant    9653:           </div>
                   9654: 
                   9655:           <div class="sect2" lang="en" xml:lang="en">
                   9656:             <div class="titlepage">
                   9657:               <div>
                   9658:                 <div>
1.19    ! hubertf  9659:                   <h3 class="title"><a name="id2593341" id=
        !          9660:                   "id2593341"></a>12.5.7.&nbsp;Packages containing
1.1       grant    9661:                   perl scripts</h3>
                   9662:                 </div>
                   9663:               </div>
                   9664:             </div>
                   9665: 
                   9666:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  9667:             set <code class="varname">REPLACE_PERL</code> to ensure
                   9668:             that the proper interpreter path is set. <code class=
                   9669:             "varname">REPLACE_PERL</code> should contain a list of
                   9670:             scripts, relative to <code class=
                   9671:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    9672:           </div>
                   9673: 
                   9674:           <div class="sect2" lang="en" xml:lang="en">
                   9675:             <div class="titlepage">
                   9676:               <div>
                   9677:                 <div>
1.19    ! hubertf  9678:                   <h3 class="title"><a name="id2593360" id=
        !          9679:                   "id2593360"></a>12.5.8.&nbsp;Packages with
1.1       grant    9680:                   hardcoded paths to other interpreters</h3>
                   9681:                 </div>
                   9682:               </div>
                   9683:             </div>
                   9684: 
                   9685:             <p>Your package may also contain scripts with hardcoded
                   9686:             paths to other interpreters besides (or as well as)
                   9687:             perl. To correct the full pathname to the script
                   9688:             interpreter, you need to set the following definitions
1.14      xtraeme  9689:             in your <code class="filename">Makefile</code> (we
                   9690:             shall use <span><strong class=
                   9691:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    9692:             <pre class="programlisting">
                   9693:   REPLACE_INTERPRETER+=     tcl
                   9694:     _REPLACE.tcl.old=     .*/bin/tclsh
                   9695:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   9696:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   9697:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   9698: </pre>
                   9699:           </div>
                   9700: 
                   9701:           <div class="sect2" lang="en" xml:lang="en">
                   9702:             <div class="titlepage">
                   9703:               <div>
                   9704:                 <div>
1.19    ! hubertf  9705:                   <h3 class="title"><a name="id2593381" id=
        !          9706:                   "id2593381"></a>12.5.9.&nbsp;Packages installing
1.1       grant    9707:                   perl modules</h3>
                   9708:                 </div>
                   9709:               </div>
                   9710:             </div>
                   9711: 
                   9712:             <p>Makefiles of packages providing perl5 modules should
1.14      xtraeme  9713:             include the Makefile fragment <code class=
                   9714:             "filename">../../lang/perl5/module.mk</code>. It
                   9715:             provides a <span><strong class=
                   9716:             "command">do-configure</strong></span> target for the
                   9717:             standard perl configuration for such modules as well as
                   9718:             various hooks to tune this configuration. See comments
                   9719:             in this file for details.</p>
1.1       grant    9720: 
                   9721:             <p>Perl5 modules will install into different places
                   9722:             depending on the version of perl used during the build
                   9723:             process. To address this, pkgsrc will append lines to
1.14      xtraeme  9724:             the <code class="filename">PLIST</code> corresponding
                   9725:             to the files listed in the installed <code class=
                   9726:             "filename">.packlist</code> file generated by most
                   9727:             perl5 modules. This is invoked by defining <code class=
                   9728:             "varname">PERL5_PACKLIST</code> to a space-separated
                   9729:             list of paths to packlist files, e.g.:</p>
1.1       grant    9730:             <pre class="programlisting">
                   9731: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   9732: </pre>
                   9733: 
1.14      xtraeme  9734:             <p>The variables <code class=
                   9735:             "varname">PERL5_SITELIB</code>, <code class=
                   9736:             "varname">PERL5_SITEARCH</code>, and <code class=
                   9737:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    9738:             locations in which perl5 modules may be installed, and
                   9739:             may be used by perl5 packages that don't have a
                   9740:             packlist. These three variables are also substituted
1.14      xtraeme  9741:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    9742:           </div>
                   9743: 
                   9744:           <div class="sect2" lang="en" xml:lang="en">
                   9745:             <div class="titlepage">
                   9746:               <div>
                   9747:                 <div>
                   9748:                   <h3 class="title"><a name="faq.info-files" id=
                   9749:                   "faq.info-files"></a>12.5.10.&nbsp;Packages
                   9750:                   installing info files</h3>
                   9751:                 </div>
                   9752:               </div>
                   9753:             </div>
                   9754: 
                   9755:             <p>Some packages install info files or use the
                   9756:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   9757:             &#8220;<span class="quote">install-info</span>&#8221;
                   9758:             commands. Each of the info files:</p>
                   9759: 
                   9760:             <div class="itemizedlist">
                   9761:               <ul type="disc">
                   9762:                 <li>
                   9763:                   <p>is considered to be installed in the directory
1.14      xtraeme  9764:                   <code class=
                   9765:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    9766:                 </li>
                   9767: 
                   9768:                 <li>
                   9769:                   <p>is registered in the Info directory file
1.14      xtraeme  9770:                   <code class=
                   9771:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    9772:                 </li>
                   9773: 
                   9774:                 <li>
                   9775:                   <p>and must be listed as a filename in the
1.14      xtraeme  9776:                   <code class="varname">INFO_FILES</code> variable
                   9777:                   in the package Makefile.</p>
1.1       grant    9778:                 </li>
                   9779:               </ul>
                   9780:             </div>
                   9781: 
1.14      xtraeme  9782:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    9783:             &#8220;<span class="quote">info</span>&#8221; and can
1.14      xtraeme  9784:             be overridden in the package Makefile. <code class=
                   9785:             "filename">INSTALL</code> and <code class=
                   9786:             "filename">DEINSTALL</code> scripts will be generated
                   9787:             to handle registration of the info files in the Info
1.1       grant    9788:             directory file. The &#8220;<span class=
                   9789:             "quote">install-info</span>&#8221; command used for the
                   9790:             info files registration is either provided by the
                   9791:             system, or by a special purpose package automatically
                   9792:             added as dependency if needed.</p>
                   9793: 
                   9794:             <p>A package which needs the &#8220;<span class=
                   9795:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  9796:             must define the variable <code class=
                   9797:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    9798:             minimum version of the &#8220;<span class=
                   9799:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  9800:             should be noted with the <code class=
                   9801:             "varname">TEXINFO_REQD</code> variable in the package
                   9802:             <code class="filename">Makefile</code>. By default, a
1.1       grant    9803:             minimum version of 3.12 is required. If the system does
1.14      xtraeme  9804:             not provide a <span><strong class=
                   9805:             "command">makeinfo</strong></span> command or if it
                   9806:             does not match the required minimum, a build dependency
                   9807:             on the <a xmlns=
                   9808:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9809:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.19    ! hubertf  9810:                class="pkgname">devel/gtexinfo</a> package will be
        !          9811:                added automatically.</p>
1.1       grant    9812: 
                   9813:             <p>The build and installation process of the software
                   9814:             provided by the package should not use the
1.14      xtraeme  9815:             <span><strong class=
                   9816:             "command">install-info</strong></span> command as the
                   9817:             registration of info files is the task of the package
                   9818:             <code class="filename">INSTALL</code> script, and it
                   9819:             must use the appropriate <span><strong class=
                   9820:             "command">makeinfo</strong></span> command.</p>
1.1       grant    9821: 
                   9822:             <p>To achieve this goal the pkgsrc infrastructure
1.14      xtraeme  9823:             creates overriding scripts for the <span><strong class=
                   9824:             "command">install-info</strong></span> and
                   9825:             <span><strong class="command">makeinfo</strong></span>
                   9826:             commands in a directory listed early in <code class=
                   9827:             "varname">PATH</code>.</p>
1.1       grant    9828: 
1.14      xtraeme  9829:             <p>The script overriding <span><strong class=
                   9830:             "command">install-info</strong></span> has no effect
                   9831:             except the logging of a message. The script overriding
                   9832:             <span><strong class="command">makeinfo</strong></span>
                   9833:             logs a message and according to the value of
                   9834:             <code class="varname">USE_MAKEINFO</code> and
                   9835:             <code class="varname">TEXINFO_REQD</code> either run
                   9836:             the appropriate <span><strong class=
                   9837:             "command">makeinfo</strong></span> command or exit on
                   9838:             error.</p>
1.1       grant    9839:           </div>
                   9840: 
                   9841:           <div class="sect2" lang="en" xml:lang="en">
                   9842:             <div class="titlepage">
                   9843:               <div>
                   9844:                 <div>
1.19    ! hubertf  9845:                   <h3 class="title"><a name="id2593601" id=
        !          9846:                   "id2593601"></a>12.5.11.&nbsp;Packages installing
1.1       grant    9847:                   GConf2 data files</h3>
                   9848:                 </div>
                   9849:               </div>
                   9850:             </div>
                   9851: 
1.14      xtraeme  9852:             <p>If a package installs <code class=
                   9853:             "filename">.schemas</code> or <code class=
                   9854:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    9855:             need to take some extra steps to make sure they get
                   9856:             registered in the database:</p>
                   9857: 
                   9858:             <div class="orderedlist">
                   9859:               <ol type="1">
                   9860:                 <li>
1.14      xtraeme  9861:                   <p>Include <code class=
                   9862:                   "filename">../../devel/GConf2/schemas.mk</code>
                   9863:                   instead of its <code class=
                   9864:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9865:                   care of rebuilding the GConf2 database at
                   9866:                   installation and deinstallation time, and tells
                   9867:                   the package where to install GConf2 data files
                   9868:                   using some standard configure arguments. It also
                   9869:                   disallows any access to the database directly
                   9870:                   from the package.</p>
                   9871:                 </li>
                   9872: 
                   9873:                 <li>
                   9874:                   <p>Ensure that the package installs its
1.14      xtraeme  9875:                   <code class="filename">.schemas</code> files
                   9876:                   under <code class=
                   9877:                   "filename">${PREFIX}/share/gconf/schemas</code>.
                   9878:                   If they get installed under <code class=
                   9879:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    9880:                   manually patch the package.</p>
                   9881:                 </li>
                   9882: 
                   9883:                 <li>
                   9884:                   <p>Check the PLIST and remove any entries under
                   9885:                   the etc/gconf directory, as they will be handled
                   9886:                   automatically. See <a href="#faq.conf" title=
1.14      xtraeme  9887:                   "6.14.&nbsp;Configuration files handling and placement">
                   9888:                   Section&nbsp;6.14, &#8220;Configuration files
1.1       grant    9889:                   handling and placement&#8221;</a> for more
                   9890:                   information.</p>
                   9891:                 </li>
                   9892: 
                   9893:                 <li>
1.14      xtraeme  9894:                   <p>Define the <code class=
                   9895:                   "varname">GCONF2_SCHEMAS</code> variable in your
                   9896:                   <code class="filename">Makefile</code> with a
                   9897:                   list of all <code class=
                   9898:                   "filename">.schemas</code> files installed by the
                   9899:                   package, if any. Names must not contain any
                   9900:                   directories in them.</p>
1.1       grant    9901:                 </li>
                   9902: 
                   9903:                 <li>
1.14      xtraeme  9904:                   <p>Define the <code class=
                   9905:                   "varname">GCONF2_ENTRIES</code> variable in your
                   9906:                   <code class="filename">Makefile</code> with a
                   9907:                   list of all <code class=
                   9908:                   "filename">.entries</code> files installed by the
                   9909:                   package, if any. Names must not contain any
                   9910:                   directories in them.</p>
1.1       grant    9911:                 </li>
                   9912:               </ol>
                   9913:             </div>
                   9914:           </div>
                   9915: 
                   9916:           <div class="sect2" lang="en" xml:lang="en">
                   9917:             <div class="titlepage">
                   9918:               <div>
                   9919:                 <div>
1.19    ! hubertf  9920:                   <h3 class="title"><a name="id2593769" id=
        !          9921:                   "id2593769"></a>12.5.12.&nbsp;Packages installing
1.1       grant    9922:                   scrollkeeper data files</h3>
                   9923:                 </div>
                   9924:               </div>
                   9925:             </div>
                   9926: 
1.14      xtraeme  9927:             <p>If a package installs <code class=
                   9928:             "filename">.omf</code> files, used by scrollkeeper, you
                   9929:             need to take some extra steps to make sure they get
                   9930:             registered in the database:</p>
1.1       grant    9931: 
                   9932:             <div class="orderedlist">
                   9933:               <ol type="1">
                   9934:                 <li>
1.14      xtraeme  9935:                   <p>Include <code class=
                   9936:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
                   9937:                   instead of its <code class=
                   9938:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9939:                   care of rebuilding the scrollkeeper database at
                   9940:                   installation and deinstallation time, and
                   9941:                   disallows any access to it directly from the
                   9942:                   package.</p>
                   9943:                 </li>
                   9944: 
                   9945:                 <li>
                   9946:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  9947:                   the <code class=
                   9948:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    9949:                   as they will be handled automatically.</p>
                   9950:                 </li>
                   9951: 
                   9952:                 <li>
1.14      xtraeme  9953:                   <p>Remove the <code class=
                   9954:                   "filename">share/omf</code> directory from the
                   9955:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    9956:                 </li>
                   9957:               </ol>
                   9958:             </div>
                   9959:           </div>
                   9960: 
                   9961:           <div class="sect2" lang="en" xml:lang="en">
                   9962:             <div class="titlepage">
                   9963:               <div>
                   9964:                 <div>
1.19    ! hubertf  9965:                   <h3 class="title"><a name="id2593889" id=
        !          9966:                   "id2593889"></a>12.5.13.&nbsp;Packages installing
1.1       grant    9967:                   X11 fonts</h3>
                   9968:                 </div>
                   9969:               </div>
                   9970:             </div>
                   9971: 
                   9972:             <p>If a package installs font files, you will need to
                   9973:             rebuild the fonts database in the directory where they
                   9974:             get installed at installation and deinstallation time.
1.14      xtraeme  9975:             This can be automatically done by using <code class=
                   9976:             "filename">mk/fonts.mk</code>, which you need to
                   9977:             include in your <code class=
                   9978:             "filename">Makefile</code>.</p>
1.1       grant    9979: 
                   9980:             <p>When the file is included, you can list the
1.14      xtraeme  9981:             directories where fonts are installed in the
                   9982:             <code class="varname">FONTS_<em class=
                   9983:             "replaceable"><code>type</code></em>_DIRS</code>
                   9984:             variables, where <em class=
                   9985:             "replaceable"><code>type</code></em> can be one of
                   9986:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    9987:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   9988:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.14      xtraeme  9989:             sure that the database file <code class=
                   9990:             "filename">fonts.dir</code> is not listed in the
1.1       grant    9991:             PLIST.</p>
                   9992: 
                   9993:             <p>Note that you should not create new directories for
                   9994:             fonts; instead use the standard ones to avoid that the
                   9995:             user needs to manually configure his X server to find
                   9996:             them.</p>
                   9997:           </div>
                   9998: 
                   9999:           <div class="sect2" lang="en" xml:lang="en">
                   10000:             <div class="titlepage">
                   10001:               <div>
                   10002:                 <div>
1.19    ! hubertf  10003:                   <h3 class="title"><a name="id2593936" id=
        !          10004:                   "id2593936"></a>12.5.14.&nbsp;Packages installing
1.1       grant    10005:                   GTK2 modules</h3>
                   10006:                 </div>
                   10007:               </div>
                   10008:             </div>
                   10009: 
                   10010:             <p>If a package installs gtk2 immodules or loaders, you
                   10011:             need to take some extra steps to get them registered in
                   10012:             the GTK2 database properly:</p>
                   10013: 
                   10014:             <div class="orderedlist">
                   10015:               <ol type="1">
                   10016:                 <li>
1.14      xtraeme  10017:                   <p>Include <code class=
                   10018:                   "filename">../../x11/gtk2/modules.mk</code>
                   10019:                   instead of its <code class=
                   10020:                   "filename">buildlink3.mk</code> file. This takes
                   10021:                   care of rebuilding the database at installation
                   10022:                   and deinstallation time.</p>
1.1       grant    10023:                 </li>
                   10024: 
                   10025:                 <li>
1.14      xtraeme  10026:                   <p>Set <code class=
                   10027:                   "varname">GTK2_IMMODULES=YES</code> if your
                   10028:                   package installs GTK2 immodules.</p>
1.1       grant    10029:                 </li>
                   10030: 
                   10031:                 <li>
1.14      xtraeme  10032:                   <p>Set <code class=
                   10033:                   "varname">GTK2_LOADERS=YES</code> if your package
                   10034:                   installs GTK2 loaders.</p>
1.1       grant    10035:                 </li>
                   10036: 
                   10037:                 <li>
                   10038:                   <p>Patch the package to not touch any of the gtk2
                   10039:                   databases directly. These are:</p>
                   10040: 
                   10041:                   <div class="itemizedlist">
                   10042:                     <ul type="disc">
                   10043:                       <li>
1.14      xtraeme  10044:                         <p><code class=
                   10045:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    10046:                       </li>
                   10047: 
                   10048:                       <li>
1.14      xtraeme  10049:                         <p><code class=
                   10050:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    10051:                       </li>
                   10052:                     </ul>
                   10053:                   </div>
                   10054:                 </li>
                   10055: 
                   10056:                 <li>
                   10057:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10058:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    10059:                   directory, as they will be handled
                   10060:                   automatically.</p>
                   10061:                 </li>
                   10062:               </ol>
                   10063:             </div>
                   10064:           </div>
                   10065: 
                   10066:           <div class="sect2" lang="en" xml:lang="en">
                   10067:             <div class="titlepage">
                   10068:               <div>
                   10069:                 <div>
1.19    ! hubertf  10070:                   <h3 class="title"><a name="id2594005" id=
        !          10071:                   "id2594005"></a>12.5.15.&nbsp;Packages installing
1.1       grant    10072:                   SGML or XML data</h3>
                   10073:                 </div>
                   10074:               </div>
                   10075:             </div>
                   10076: 
                   10077:             <p>If a package installs SGML or XML data files that
                   10078:             need to be registered in system-wide catalogs (like
                   10079:             DTDs, sub-catalogs, etc.), you need to take some extra
                   10080:             steps:</p>
                   10081: 
                   10082:             <div class="orderedlist">
                   10083:               <ol type="1">
                   10084:                 <li>
1.14      xtraeme  10085:                   <p>Include <code class=
                   10086:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
                   10087:                   in your <code class="filename">Makefile</code>,
                   10088:                   which takes care of registering those files in
1.1       grant    10089:                   system-wide catalogs at installation and
                   10090:                   deinstallation time.</p>
                   10091:                 </li>
                   10092: 
                   10093:                 <li>
1.14      xtraeme  10094:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   10095:                   to the full path of any SGML catalogs installed
                   10096:                   by the package.</p>
1.1       grant    10097:                 </li>
                   10098: 
                   10099:                 <li>
1.14      xtraeme  10100:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   10101:                   to the full path of any XML catalogs installed by
1.1       grant    10102:                   the package.</p>
                   10103:                 </li>
                   10104: 
                   10105:                 <li>
1.14      xtraeme  10106:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   10107:                   to individual entries to be added to the SGML
1.1       grant    10108:                   catalog. These come in groups of three strings;
                   10109:                   see xmlcatmgr(1) for more information
                   10110:                   (specifically, arguments recognized by the 'add'
                   10111:                   action). Note that you will normally not use this
                   10112:                   variable.</p>
                   10113:                 </li>
                   10114: 
                   10115:                 <li>
1.14      xtraeme  10116:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   10117:                   to individual entries to be added to the XML
1.1       grant    10118:                   catalog. These come in groups of three strings;
                   10119:                   see xmlcatmgr(1) for more information
                   10120:                   (specifically, arguments recognized by the 'add'
                   10121:                   action). Note that you will normally not use this
                   10122:                   variable.</p>
                   10123:                 </li>
                   10124:               </ol>
                   10125:             </div>
                   10126:           </div>
                   10127: 
                   10128:           <div class="sect2" lang="en" xml:lang="en">
                   10129:             <div class="titlepage">
                   10130:               <div>
                   10131:                 <div>
1.19    ! hubertf  10132:                   <h3 class="title"><a name="id2594057" id=
        !          10133:                   "id2594057"></a>12.5.16.&nbsp;Packages installing
1.1       grant    10134:                   extensions to the MIME database</h3>
                   10135:                 </div>
                   10136:               </div>
                   10137:             </div>
                   10138: 
                   10139:             <p>If a package provides extensions to the MIME
1.14      xtraeme  10140:             database by installing <code class=
                   10141:             "filename">.xml</code> files inside <code class=
                   10142:             "filename">${PREFIX}/share/mime/packages</code>, you
                   10143:             need to take some extra steps to ensure that the
                   10144:             database is kept consistent with respect to these new
                   10145:             files:</p>
1.1       grant    10146: 
                   10147:             <div class="orderedlist">
                   10148:               <ol type="1">
                   10149:                 <li>
1.14      xtraeme  10150:                   <p>Include <code class=
                   10151:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
                   10152:                   (avoid using the <code class=
                   10153:                   "filename">buildlink3.mk</code> file from this
                   10154:                   same directory, which is reserved for inclusion
                   10155:                   from other <code class=
                   10156:                   "filename">buildlink3.mk</code> files). It takes
                   10157:                   care of rebuilding the MIME database at
                   10158:                   installation and deinstallation time, and
                   10159:                   disallows any access to it directly from the
1.1       grant    10160:                   package.</p>
                   10161:                 </li>
                   10162: 
                   10163:                 <li>
                   10164:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10165:                   the <code class="filename">share/mime</code>
1.1       grant    10166:                   directory, <span class=
                   10167:                   "emphasis"><em>except</em></span> for files saved
1.14      xtraeme  10168:                   under <code class=
                   10169:                   "filename">share/mime/packages</code>. The former
1.1       grant    10170:                   are handled automatically by the
                   10171:                   update-mime-database program, but the later are
                   10172:                   package-dependent and must be removed by the
                   10173:                   package that installed them in the first
                   10174:                   place.</p>
                   10175:                 </li>
                   10176: 
                   10177:                 <li>
1.14      xtraeme  10178:                   <p>Remove any <code class=
                   10179:                   "filename">share/mime/*</code> directories from
                   10180:                   the PLIST. They will be handled by the
1.1       grant    10181:                   shared-mime-info package.</p>
                   10182:                 </li>
                   10183:               </ol>
                   10184:             </div>
                   10185:           </div>
                   10186: 
                   10187:           <div class="sect2" lang="en" xml:lang="en">
                   10188:             <div class="titlepage">
                   10189:               <div>
                   10190:                 <div>
1.19    ! hubertf  10191:                   <h3 class="title"><a name="id2594332" id=
        !          10192:                   "id2594332"></a>12.5.17.&nbsp;Packages using
1.1       grant    10193:                   intltool</h3>
                   10194:                 </div>
                   10195:               </div>
                   10196:             </div>
                   10197: 
                   10198:             <p>If a package uses intltool during its build, include
1.14      xtraeme  10199:             the <code class=
                   10200:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    10201:             file, which forces it to use the intltool package
                   10202:             provided by pkgsrc, instead of the one bundled with the
                   10203:             distribution file.</p>
                   10204: 
                   10205:             <p>This tracks intltool's build-time dependencies and
                   10206:             uses the latest available version; this way, the
                   10207:             package benefits of any bug fixes that may have
                   10208:             appeared since it was released.</p>
                   10209:           </div>
1.18      xtraeme  10210: 
                   10211:           <div class="sect2" lang="en" xml:lang="en">
                   10212:             <div class="titlepage">
                   10213:               <div>
                   10214:                 <div>
1.19    ! hubertf  10215:                   <h3 class="title"><a name="id2594346" id=
        !          10216:                   "id2594346"></a>12.5.18.&nbsp;Packages installing
1.18      xtraeme  10217:                   startup scripts</h3>
                   10218:                 </div>
                   10219:               </div>
                   10220:             </div>
                   10221: 
                   10222:             <p>If a package contains a rc.d script, it won't be
                   10223:             copied into the startup directory by default, but you
                   10224:             can enable it, by adding the option <code class=
                   10225:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
                   10226:             "filename">/etc/mk.conf</code>. This option will copy
                   10227:             the scripts into <code class=
                   10228:             "filename">/etc/rc.d</code> when a package is
                   10229:             installed, and it will automatically remove the scripts
                   10230:             when the package is deinstalled.</p>
                   10231:           </div>
1.1       grant    10232:         </div>
                   10233: 
                   10234:         <div class="sect1" lang="en" xml:lang="en">
                   10235:           <div class="titlepage">
                   10236:             <div>
                   10237:               <div>
                   10238:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  10239:                 "id2594368" id="id2594368"></a>12.6.&nbsp;Feedback
1.1       grant    10240:                 to the author</h2>
                   10241:               </div>
                   10242:             </div>
                   10243:           </div>
                   10244: 
                   10245:           <p>If you have found any bugs in the package you make
                   10246:           available, if you had to do special steps to make it run
                   10247:           under NetBSD or if you enhanced the software in various
                   10248:           other ways, be sure to report these changes back to the
                   10249:           original author of the program! With that kind of
                   10250:           support, the next release of the program can incorporate
                   10251:           these fixes, and people not using the NetBSD packages
                   10252:           system can win from your efforts.</p>
                   10253: 
                   10254:           <p>Support the idea of free software!</p>
                   10255:         </div>
                   10256:       </div>
                   10257: 
                   10258:       <div class="chapter" lang="en" xml:lang="en">
                   10259:         <div class="titlepage">
                   10260:           <div>
                   10261:             <div>
                   10262:               <h2 class="title"><a name="debug" id=
                   10263:               "debug"></a>Chapter&nbsp;13.&nbsp;Debugging</h2>
                   10264:             </div>
                   10265:           </div>
                   10266:         </div>
                   10267: 
                   10268:         <p>To check out all the gotchas when building a package,
                   10269:         here are the steps that I do in order to get a package
                   10270:         working. Please note this is basically the same as what was
                   10271:         explained in the previous sections, only with some
                   10272:         debugging aids.</p>
                   10273: 
                   10274:         <div class="itemizedlist">
                   10275:           <ul type="disc">
                   10276:             <li>
1.14      xtraeme  10277:               <p>Be sure to set <code class=
                   10278:               "varname">PKG_DEVELOPER=1</code> in <code class=
                   10279:               "filename">/etc/mk.conf</code></p>
1.1       grant    10280:             </li>
                   10281: 
                   10282:             <li>
                   10283:               <p>Install <a xmlns=
                   10284:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10285:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.19    ! hubertf  10286:                  class="pkgname">pkgtools/url2pkg</a>, create a
        !          10287:                  directory for a new package, change into it, then
        !          10288:                  run <span><strong class=
        !          10289:                  "command">url2pkg</strong></span>:</p>
1.1       grant    10290:               <pre class="screen">
1.14      xtraeme  10291: <code class="prompt">%</code> <strong class=
                   10292: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   10293: "replaceable"><code>category</code></em>/<em class=
                   10294: "replaceable"><code>examplepkg</code></em></code></strong>
                   10295: <code class="prompt">%</code> <strong class=
                   10296: "userinput"><code>cd /usr/pkgsrc/<em class=
                   10297: "replaceable"><code>category</code></em>/<em class=
                   10298: "replaceable"><code>examplepkg</code></em></code></strong>
                   10299: <code class="prompt">%</code> <strong class=
                   10300: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    10301: </pre>
                   10302:             </li>
                   10303: 
                   10304:             <li>
1.14      xtraeme  10305:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    10306:               requested.</p>
                   10307:             </li>
                   10308: 
                   10309:             <li>
1.14      xtraeme  10310:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    10311:               file</p>
                   10312:             </li>
                   10313: 
                   10314:             <li>
1.14      xtraeme  10315:               <p>Run <span><strong class="command">make
                   10316:               configure</strong></span></p>
1.1       grant    10317:             </li>
                   10318: 
                   10319:             <li>
                   10320:               <p>Add any dependencies glimpsed from documentation
1.14      xtraeme  10321:               and the configure step to the package's <code class=
                   10322:               "filename">Makefile</code>.</p>
1.1       grant    10323:             </li>
                   10324: 
                   10325:             <li>
                   10326:               <p>Make the package compile, doing multiple rounds
                   10327:               of</p>
                   10328:               <pre class="screen">
1.14      xtraeme  10329: <code class="prompt">%</code> <strong class=
                   10330: "userinput"><code>make</code></strong>
                   10331: <code class="prompt">%</code> <strong class=
                   10332: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   10333: <code class="prompt">%</code> <strong class=
                   10334: "userinput"><code>mkpatches</code></strong>
                   10335: <code class="prompt">%</code> <strong class=
                   10336: "userinput"><code>patchdiff</code></strong>
                   10337: <code class="prompt">%</code> <strong class=
                   10338: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   10339: <code class="prompt">%</code> <strong class=
                   10340: "userinput"><code>make mps</code></strong>
                   10341: <code class="prompt">%</code> <strong class=
                   10342: "userinput"><code>make clean</code></strong>
1.1       grant    10343: </pre>
                   10344: 
                   10345:               <p>Doing as non-root user will ensure that no files
                   10346:               are modified that shouldn't be, especially during the
1.14      xtraeme  10347:               build phase. <span><strong class=
                   10348:               "command">mkpatches</strong></span>,
                   10349:               <span><strong class=
                   10350:               "command">patchdiff</strong></span> and
                   10351:               <span><strong class="command">pkgvi</strong></span>
                   10352:               are from the <a xmlns=
1.1       grant    10353:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10354:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.19    ! hubertf  10355:                  class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    10356:             </li>
                   10357: 
                   10358:             <li>
1.14      xtraeme  10359:               <p>Look at the <code class=
                   10360:               "filename">Makefile</code>, fix if necessary; see
                   10361:               <a href="#components.Makefile" title=
                   10362:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
                   10363:               &#8220;<code class=
                   10364:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    10365:             </li>
                   10366: 
                   10367:             <li>
1.14      xtraeme  10368:               <p>Generate a <code class=
                   10369:               "filename">PLIST</code>:</p>
1.1       grant    10370:               <pre class="screen">
1.14      xtraeme  10371: <code class="prompt">#</code> <strong class=
                   10372: "userinput"><code>make install</code></strong>
                   10373: <code class="prompt">#</code> <strong class=
                   10374: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   10375: <code class="prompt">#</code> <strong class=
                   10376: "userinput"><code>make deinstall</code></strong>
                   10377: <code class="prompt">#</code> <strong class=
                   10378: "userinput"><code>make install</code></strong>
                   10379: <code class="prompt">#</code> <strong class=
                   10380: "userinput"><code>make deinstall</code></strong>
1.1       grant    10381: </pre>
                   10382: 
1.14      xtraeme  10383:               <p>You usually need to be <code class=
                   10384:               "username">root</code> to do this. Look if there are
1.1       grant    10385:               any files left:</p>
                   10386:               <pre class="screen">
1.14      xtraeme  10387: <code class="prompt">#</code> <strong class=
                   10388: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10389: </pre>
                   10390: 
                   10391:               <p>If this reveals any files that are missing in
1.14      xtraeme  10392:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    10393:             </li>
                   10394: 
                   10395:             <li>
1.14      xtraeme  10396:               <p>Now that the <code class="filename">PLIST</code>
                   10397:               is OK, install the package again and make a binary
1.1       grant    10398:               package:</p>
                   10399:               <pre class="screen">
1.14      xtraeme  10400: <code class="prompt">#</code> <strong class=
                   10401: "userinput"><code>make reinstall</code></strong>
                   10402: <code class="prompt">#</code> <strong class=
                   10403: "userinput"><code>make package</code></strong>
1.1       grant    10404: </pre>
                   10405:             </li>
                   10406: 
                   10407:             <li>
                   10408:               <p>Delete the installed package:</p>
                   10409:               <pre class="screen">
1.14      xtraeme  10410: <code class="prompt">#</code> <strong class=
                   10411: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    10412: </pre>
                   10413:             </li>
                   10414: 
                   10415:             <li>
1.14      xtraeme  10416:               <p>Repeat the above <span><strong class=
                   10417:               "command">make print-PLIST</strong></span> command,
                   10418:               which shouldn't find anything now:</p>
1.1       grant    10419:               <pre class="screen">
1.14      xtraeme  10420: <code class="prompt">#</code> <strong class=
                   10421: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10422: </pre>
                   10423:             </li>
                   10424: 
                   10425:             <li>
                   10426:               <p>Reinstall the binary package:</p>
                   10427:               <pre class="screen">
1.14      xtraeme  10428: <code class="prompt">#</code> <strong class=
                   10429: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    10430: </pre>
                   10431:             </li>
                   10432: 
                   10433:             <li>
                   10434:               <p>Play with it. Make sure everything works.</p>
                   10435:             </li>
                   10436: 
                   10437:             <li>
1.14      xtraeme  10438:               <p>Run <span><strong class=
                   10439:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    10440:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10441:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.19    ! hubertf  10442:                  class="pkgname">pkgtools/pkglint</a>, and fix the
        !          10443:                  problems it reports:</p>
1.1       grant    10444:               <pre class="screen">
1.14      xtraeme  10445: <code class="prompt">#</code> <strong class=
                   10446: "userinput"><code>pkglint</code></strong>
1.1       grant    10447: </pre>
                   10448:             </li>
                   10449: 
                   10450:             <li>
                   10451:               <p>Submit (or commit, if you have cvs access); see
                   10452:               <a href="#submit" title=
                   10453:               "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter&nbsp;14,
                   10454:               <i>Submitting and Committing</i></a>.</p>
                   10455:             </li>
                   10456:           </ul>
                   10457:         </div>
                   10458:       </div>
                   10459: 
                   10460:       <div class="chapter" lang="en" xml:lang="en">
                   10461:         <div class="titlepage">
                   10462:           <div>
                   10463:             <div>
                   10464:               <h2 class="title"><a name="submit" id=
                   10465:               "submit"></a>Chapter&nbsp;14.&nbsp;Submitting and
                   10466:               Committing</h2>
                   10467:             </div>
                   10468:           </div>
                   10469:         </div>
                   10470: 
                   10471:         <div class="toc">
                   10472:           <p><b>Table of Contents</b></p>
                   10473: 
                   10474:           <dl>
1.19    ! hubertf  10475:             <dt><span class="sect1"><a href="#id2594898">14.1.
1.1       grant    10476:             Submitting your packages</a></span></dt>
                   10477: 
1.19    ! hubertf  10478:             <dt><span class="sect1"><a href="#id2594949">14.2.
1.1       grant    10479:             Committing: Importing a package into
                   10480:             CVS</a></span></dt>
                   10481: 
1.19    ! hubertf  10482:             <dt><span class="sect1"><a href="#id2595012">14.3.
1.2       hubertf  10483:             Updating a package to a newer version</a></span></dt>
1.1       grant    10484: 
1.19    ! hubertf  10485:             <dt><span class="sect1"><a href="#id2595031">14.4.
1.2       hubertf  10486:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    10487:           </dl>
                   10488:         </div>
                   10489: 
                   10490:         <div class="sect1" lang="en" xml:lang="en">
                   10491:           <div class="titlepage">
                   10492:             <div>
                   10493:               <div>
                   10494:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  10495:                 "id2594898" id=
        !          10496:                 "id2594898"></a>14.1.&nbsp;Submitting your
1.1       grant    10497:                 packages</h2>
                   10498:               </div>
                   10499:             </div>
                   10500:           </div>
                   10501: 
                   10502:           <p>You have to separate between binary and
                   10503:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   10504:           packages here:</p>
                   10505: 
                   10506:           <div class="itemizedlist">
                   10507:             <ul type="disc">
                   10508:               <li>
                   10509:                 <p>precompiled binary packages</p>
                   10510: 
                   10511:                 <p>Our policy is that we accept binaries only from
                   10512:                 pkgsrc developers to guarantee that the packages
                   10513:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  10514:                 annoy anyone but rather to protect our users!
1.1       grant    10515:                 You're still free to put up your home-made binary
1.13      hubertf  10516:                 packages and tell the world where to get them.
                   10517:                 NetBSD developers doing bulk builds and wanting to
                   10518:                 upload them please see <a href="#bulk-upload"
                   10519:                 title="5.3.8.&nbsp;Uploading results of a bulk build">
                   10520:                 Section&nbsp;5.3.8, &#8220;Uploading results of a
                   10521:                 bulk build&#8221;</a>.</p>
1.1       grant    10522:               </li>
                   10523: 
                   10524:               <li>
                   10525:                 <p>packages</p>
                   10526: 
                   10527:                 <p>First, check that your package is complete,
                   10528:                 compiles and runs well; see <a href="#debug" title=
                   10529:                 "Chapter&nbsp;13.&nbsp;Debugging">Chapter&nbsp;13,
                   10530:                 <i>Debugging</i></a> and the rest of this document.
                   10531:                 Next, generate an uuencoded gzipped tar(1) archive,
                   10532:                 preferably with all files in a single directory.
1.14      xtraeme  10533:                 Finally, <span><strong class=
                   10534:                 "command">send-pr</strong></span> with category
1.1       grant    10535:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   10536:                 synopsis which includes the package name and
                   10537:                 version number, a short description of your package
                   10538:                 (contents of the COMMENT variable or DESCR file are
                   10539:                 OK) and attach the archive to your PR.</p>
                   10540: 
                   10541:                 <p>If you want to submit several packages, please
                   10542:                 send a separate PR for each one, it's easier for us
                   10543:                 to track things that way.</p>
                   10544: 
                   10545:                 <p>Alternatively, you can also import new packages
                   10546:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   10547:                 work-in-progress</span>&#8221;); see the homepage
                   10548:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   10549:                 target=
                   10550:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   10551:                 details.</p>
                   10552:               </li>
                   10553:             </ul>
                   10554:           </div>
                   10555:         </div>
                   10556: 
                   10557:         <div class="sect1" lang="en" xml:lang="en">
                   10558:           <div class="titlepage">
                   10559:             <div>
                   10560:               <div>
                   10561:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  10562:                 "id2594949" id=
        !          10563:                 "id2594949"></a>14.2.&nbsp;Committing: Importing a
1.1       grant    10564:                 package into CVS</h2>
                   10565:               </div>
                   10566:             </div>
                   10567:           </div>
                   10568: 
                   10569:           <p>This section is only of interest for pkgsrc developers
                   10570:           with write access to the pkgsrc repository. Please
                   10571:           remember that cvs imports files relative to the current
                   10572:           working directory, and that the pathname that you give
1.14      xtraeme  10573:           the <span><strong class="command">cvs
                   10574:           import</strong></span> command is so that it knows where
                   10575:           to place the files in the repository. Newly created
                   10576:           packages should be imported with a vendor tag of
                   10577:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   10578:           release tag of &#8220;<span class=
                   10579:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    10580:           <pre class="programlisting">
                   10581:   % cd .../pkgsrc/category/pkgname
                   10582:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   10583: </pre>
                   10584: 
                   10585:           <p>Remember to move the directory from which you imported
                   10586:           out of the way, or cvs will complain the next time you
                   10587:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   10588:           source tree. Also don't forget to add the new package to
1.14      xtraeme  10589:           the category's <code class=
                   10590:           "filename">Makefile</code>.</p>
1.1       grant    10591: 
                   10592:           <p>The commit message of the initial import should
1.14      xtraeme  10593:           include part of the <code class="filename">DESCR</code>
                   10594:           file, so people reading the mailing lists know what the
                   10595:           package is/does.</p>
1.1       grant    10596: 
                   10597:           <p>Please note all package updates/additions in
1.14      xtraeme  10598:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
                   10599:           very important to keep this file up to date and
                   10600:           conforming to the existing format, because it will be
                   10601:           used by scripts to automatically update pages on <a href=
1.1       grant    10602:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   10603:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   10604:           file and remove the entry for the package you updated, in
                   10605:           case it was mentioned there.</p>
                   10606: 
                   10607:           <p>For new packages, &#8220;<span class="quote">cvs
                   10608:           import</span>&#8221; is preferred to &#8220;<span class=
                   10609:           "quote">cvs add</span>&#8221; because the former gets
                   10610:           everything with a single command, and provides a
                   10611:           consistent tag.</p>
                   10612:         </div>
                   10613: 
                   10614:         <div class="sect1" lang="en" xml:lang="en">
                   10615:           <div class="titlepage">
                   10616:             <div>
                   10617:               <div>
                   10618:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  10619:                 "id2595012" id="id2595012"></a>14.3.&nbsp;Updating
1.2       hubertf  10620:                 a package to a newer version</h2>
1.1       grant    10621:               </div>
                   10622:             </div>
                   10623:           </div>
                   10624: 
                   10625:           <p>Please always put a concise, appropriate and relevant
                   10626:           summary of the changes between old and new versions into
                   10627:           the commit log when updating a package. There are various
                   10628:           reasons for this:</p>
                   10629: 
                   10630:           <div class="itemizedlist">
                   10631:             <ul type="disc">
                   10632:               <li>
                   10633:                 <p>A URL is volatile, and can change over time. It
                   10634:                 may go away completely or its information may be
                   10635:                 overwritten by newer information.</p>
                   10636:               </li>
                   10637: 
                   10638:               <li>
                   10639:                 <p>Having the change information between old and
                   10640:                 new versions in our CVS repository is very useful
                   10641:                 for people who use either cvs or anoncvs.</p>
                   10642:               </li>
                   10643: 
                   10644:               <li>
                   10645:                 <p>Having the change information between old and
                   10646:                 new versions in our CVS repository is very useful
                   10647:                 for people who read the pkgsrc-changes mailing
                   10648:                 list, so that they can make tactical decisions
                   10649:                 about when to upgrade the package.</p>
                   10650:               </li>
                   10651:             </ul>
                   10652:           </div>
                   10653: 
1.18      xtraeme  10654:           <p>Please also recognize that, just because a new version
1.1       grant    10655:           of a package has been released, it should not
                   10656:           automatically be upgraded in the CVS repository. We
                   10657:           prefer to be conservative in the packages that are
                   10658:           included in pkgsrc - development or beta packages are not
                   10659:           really the best thing for most places in which pkgsrc is
                   10660:           used. Please use your judgement about what should go into
                   10661:           pkgsrc, and bear in mind that stability is to be
                   10662:           preferred above new and possibly untested features.</p>
                   10663:         </div>
                   10664: 
                   10665:         <div class="sect1" lang="en" xml:lang="en">
                   10666:           <div class="titlepage">
                   10667:             <div>
                   10668:               <div>
                   10669:                 <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  10670:                 "id2595031" id="id2595031"></a>14.4.&nbsp;Moving a
1.2       hubertf  10671:                 package in pkgsrc</h2>
1.1       grant    10672:               </div>
                   10673:             </div>
                   10674:           </div>
                   10675: 
                   10676:           <div class="orderedlist">
                   10677:             <ol type="1">
                   10678:               <li>
                   10679:                 <p>Make a copy of the directory somewhere else.</p>
                   10680:               </li>
                   10681: 
                   10682:               <li>
                   10683:                 <p>Remove all CVS dirs.</p>
                   10684: 
                   10685:                 <p>Alternatively to the first two steps you can
                   10686:                 also do:</p>
                   10687:                 <pre class="screen">
1.14      xtraeme  10688: <code class="prompt">%</code> <strong class=
                   10689: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    10690: </pre>
                   10691: 
                   10692:                 <p>and use that for further work.</p>
                   10693:               </li>
                   10694: 
                   10695:               <li>
1.14      xtraeme  10696:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   10697:                 any <code class="varname">DEPENDS</code> paths that
                   10698:                 just did &#8220;<span class=
1.1       grant    10699:                 "quote">../package</span>&#8221; instead of
                   10700:                 &#8220;<span class=
                   10701:                 "quote">../../category/package</span>&#8221;.</p>
                   10702:               </li>
                   10703: 
                   10704:               <li>
1.14      xtraeme  10705:                 <p><span><strong class="command">cvs
                   10706:                 import</strong></span> the modified package in the
                   10707:                 new place.</p>
1.1       grant    10708:               </li>
                   10709: 
                   10710:               <li>
                   10711:                 <p>Check if any package depends on it:</p>
                   10712:                 <pre class="screen">
1.14      xtraeme  10713: <code class="prompt">%</code> <strong class=
                   10714: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   10715: <code class="prompt">%</code> <strong class=
                   10716: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    10717: </pre>
                   10718:               </li>
                   10719: 
                   10720:               <li>
                   10721:                 <p>Fix paths in packages from step 5 to point to
                   10722:                 new location.</p>
                   10723:               </li>
                   10724: 
                   10725:               <li>
1.14      xtraeme  10726:                 <p><span><strong class="command">cvs rm
                   10727:                 (-f)</strong></span> the package at the old
                   10728:                 location.</p>
1.1       grant    10729:               </li>
                   10730: 
                   10731:               <li>
1.14      xtraeme  10732:                 <p>Remove from <code class=
                   10733:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    10734:               </li>
                   10735: 
                   10736:               <li>
1.14      xtraeme  10737:                 <p>Add to <code class=
                   10738:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    10739:               </li>
                   10740: 
                   10741:               <li>
                   10742:                 <p>Commit the changed and removed files:</p>
                   10743:                 <pre class="screen">
1.14      xtraeme  10744: <code class="prompt">%</code> <strong class=
                   10745: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    10746: </pre>
                   10747: 
                   10748:                 <p>(and any packages from step 5, of course).</p>
                   10749:               </li>
                   10750:             </ol>
                   10751:           </div>
                   10752:         </div>
                   10753:       </div>
                   10754:     </div>
                   10755: 
                   10756:     <div class="appendix" lang="en" xml:lang="en">
                   10757:       <div class="titlepage">
                   10758:         <div>
                   10759:           <div>
                   10760:             <h2 class="title"><a name="examples" id=
                   10761:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   10762:             package: bison</h2>
                   10763:           </div>
                   10764:         </div>
                   10765:       </div>
                   10766: 
                   10767:       <div class="toc">
                   10768:         <p><b>Table of Contents</b></p>
                   10769: 
                   10770:         <dl>
1.19    ! hubertf  10771:           <dt><span class="sect1"><a href="#id2595257">A.1.
1.1       grant    10772:           files</a></span></dt>
                   10773: 
                   10774:           <dd>
                   10775:             <dl>
1.19    ! hubertf  10776:               <dt><span class="sect2"><a href="#id2595260">A.1.1.
1.1       grant    10777:               Makefile</a></span></dt>
                   10778: 
1.19    ! hubertf  10779:               <dt><span class="sect2"><a href="#id2595268">A.1.2.
1.1       grant    10780:               DESCR</a></span></dt>
                   10781: 
1.19    ! hubertf  10782:               <dt><span class="sect2"><a href="#id2595283">A.1.3.
1.1       grant    10783:               PLIST</a></span></dt>
                   10784: 
1.19    ! hubertf  10785:               <dt><span class="sect2"><a href="#id2595290">A.1.4.
1.14      xtraeme  10786:               Checking a package with <span><strong class=
                   10787:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    10788:             </dl>
                   10789:           </dd>
                   10790: 
1.19    ! hubertf  10791:           <dt><span class="sect1"><a href="#id2595331">A.2. Steps
1.1       grant    10792:           for building, installing, packaging</a></span></dt>
                   10793:         </dl>
                   10794:       </div>
                   10795: 
                   10796:       <p>We checked to find a piece of software that wasn't in the
                   10797:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  10798:       would want to have <span><strong class=
                   10799:       "command">bison</strong></span> when Berkeley
                   10800:       <span><strong class="command">yacc</strong></span> is already
                   10801:       present in the tree is beyond us, but it's useful for the
                   10802:       purposes of this exercise.</p>
1.1       grant    10803: 
                   10804:       <div class="sect1" lang="en" xml:lang="en">
                   10805:         <div class="titlepage">
                   10806:           <div>
                   10807:             <div>
                   10808:               <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  10809:               "id2595257" id="id2595257"></a>A.1.&nbsp;files</h2>
1.1       grant    10810:             </div>
                   10811:           </div>
                   10812:         </div>
                   10813: 
                   10814:         <div class="sect2" lang="en" xml:lang="en">
                   10815:           <div class="titlepage">
                   10816:             <div>
                   10817:               <div>
1.19    ! hubertf  10818:                 <h3 class="title"><a name="id2595260" id=
        !          10819:                 "id2595260"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    10820:               </div>
                   10821:             </div>
                   10822:           </div>
                   10823:           <pre class="programlisting">
1.17      sketch   10824: # $NetBSD$
1.1       grant    10825: #
                   10826: 
                   10827: DISTNAME=       bison-1.25
                   10828: CATEGORIES=     devel
                   10829: MASTER_SITES=   ${MASTER_SITE_GNU}
                   10830: 
                   10831: MAINTAINER=     thorpej@NetBSD.org
                   10832: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   10833: COMMENT=        GNU yacc clone
                   10834: 
                   10835: GNU_CONFIGURE=  yes
                   10836: INFO_FILES=     bison.info
                   10837: 
                   10838: .include "../../mk/bsd.pkg.mk"
                   10839: </pre>
                   10840:         </div>
                   10841: 
                   10842:         <div class="sect2" lang="en" xml:lang="en">
                   10843:           <div class="titlepage">
                   10844:             <div>
                   10845:               <div>
1.19    ! hubertf  10846:                 <h3 class="title"><a name="id2595268" id=
        !          10847:                 "id2595268"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    10848:               </div>
                   10849:             </div>
                   10850:           </div>
                   10851:           <pre class="programlisting">
                   10852: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   10853: improvements.  Why you would want this when Berkeley <a href=
                   10854: "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
                   10855: of the NetBSD source tree is beyond me.
                   10856: </pre>
                   10857:         </div>
                   10858: 
                   10859:         <div class="sect2" lang="en" xml:lang="en">
                   10860:           <div class="titlepage">
                   10861:             <div>
                   10862:               <div>
1.19    ! hubertf  10863:                 <h3 class="title"><a name="id2595283" id=
        !          10864:                 "id2595283"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    10865:               </div>
                   10866:             </div>
                   10867:           </div>
                   10868:           <pre class="programlisting">
1.17      sketch   10869: @comment $NetBSD$
1.1       grant    10870: bin/bison
                   10871: man/man1/bison.1.gz
                   10872: share/bison.simple
                   10873: share/bison.hairy
                   10874: </pre>
                   10875:         </div>
                   10876: 
                   10877:         <div class="sect2" lang="en" xml:lang="en">
                   10878:           <div class="titlepage">
                   10879:             <div>
                   10880:               <div>
1.19    ! hubertf  10881:                 <h3 class="title"><a name="id2595290" id=
        !          10882:                 "id2595290"></a>A.1.4.&nbsp;Checking a package with
1.14      xtraeme  10883:                 <span><strong class=
                   10884:                 "command">pkglint</strong></span></h3>
1.1       grant    10885:               </div>
                   10886:             </div>
                   10887:           </div>
                   10888: 
                   10889:           <p>The NetBSD package system comes with <a xmlns=
                   10890:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   10891:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.19    ! hubertf  10892:              class="pkgname">pkgtools/pkglint</a> which helps to
        !          10893:              check the contents of these files. After installation
        !          10894:              it is quite easy to use, just change to the directory
        !          10895:              of the package you wish to examine and execute
        !          10896:              <span><strong class=
        !          10897:              "command">pkglint</strong></span>:</p>
1.1       grant    10898:           <pre class="screen">
1.14      xtraeme  10899: <code class="prompt">$</code> <strong class=
                   10900: "userinput"><code>pkglint</code></strong>
1.1       grant    10901: OK: checking ./DESCR.
                   10902: OK: checking Makefile.
                   10903: OK: checking distinfo.
                   10904: OK: checking patches/patch-aa.
                   10905: looks fine.
                   10906: </pre>
                   10907: 
                   10908:           <p>Depending on the supplied command line arguments (see
                   10909:           pkglint(1)) more verbose checks will be performed. Use
1.14      xtraeme  10910:           e.g. <span><strong class="command">pkglint
                   10911:           -v</strong></span> for a very verbose check.</p>
1.1       grant    10912:         </div>
                   10913:       </div>
                   10914: 
                   10915:       <div class="sect1" lang="en" xml:lang="en">
                   10916:         <div class="titlepage">
                   10917:           <div>
                   10918:             <div>
                   10919:               <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  10920:               "id2595331" id="id2595331"></a>A.2.&nbsp;Steps for
1.1       grant    10921:               building, installing, packaging</h2>
                   10922:             </div>
                   10923:           </div>
                   10924:         </div>
                   10925: 
                   10926:         <p>Create the directory where the package lives, plus any
                   10927:         auxiliary directories:</p>
                   10928:         <pre class="screen">
1.14      xtraeme  10929: <code class="prompt">#</code> <strong class=
                   10930: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   10931: <code class="prompt">#</code> <strong class=
                   10932: "userinput"><code>mkdir bison</code></strong>
                   10933: <code class="prompt">#</code> <strong class=
                   10934: "userinput"><code>cd bison</code></strong>
                   10935: <code class="prompt">#</code> <strong class=
                   10936: "userinput"><code>mkdir patches</code></strong>
1.1       grant    10937: </pre>
                   10938: 
1.14      xtraeme  10939:         <p>Create <code class="filename">Makefile</code>,
                   10940:         <code class="filename">DESCR</code> and <code class=
                   10941:         "filename">PLIST</code> (see <a href="#components" title=
1.1       grant    10942:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   10943:         Chapter 7, <i>Package components - files, directories and
                   10944:         contents</i></a>) then continue with fetching the
                   10945:         distfile:</p>
                   10946:         <pre class="screen">
1.14      xtraeme  10947: <code class="prompt">#</code> <strong class=
                   10948: "userinput"><code>make fetch</code></strong>
1.1       grant    10949: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   10950: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   10951: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10952: ftp: Error retrieving file: 500 Internal error
                   10953: 
                   10954: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   10955: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10956: ftp: Error retrieving file: 500 Internal error
                   10957: 
                   10958: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   10959: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10960: Successfully retrieved file.
                   10961: </pre>
                   10962: 
1.14      xtraeme  10963:         <p>Generate the checksum of the distfile into <code class=
                   10964:         "filename">distinfo</code>:</p>
1.1       grant    10965:         <pre class="screen">
1.14      xtraeme  10966: <code class="prompt">#</code> <strong class=
                   10967: "userinput"><code>make makesum</code></strong>
1.1       grant    10968: </pre>
                   10969: 
                   10970:         <p>Now compile:</p>
                   10971:         <pre class="screen">
1.14      xtraeme  10972: <code class="prompt">#</code> <strong class=
                   10973: "userinput"><code>make</code></strong>
1.1       grant    10974: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10975: ===&gt;  Extracting for bison-1.25
                   10976: ===&gt;  Patching for bison-1.25
                   10977: ===&gt;   Ignoring empty patch directory
                   10978: ===&gt;  Configuring for bison-1.25
                   10979: creating cache ./config.cache
                   10980: checking for gcc... cc
                   10981: checking whether we are using GNU C... yes
                   10982: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   10983: checking how to run the C preprocessor... cc -E
                   10984: checking for minix/config.h... no
                   10985: checking for POSIXized ISC... no
                   10986: checking whether cross-compiling... no
                   10987: checking for ANSI C header files... yes
                   10988: checking for string.h... yes
                   10989: checking for stdlib.h... yes
                   10990: checking for memory.h... yes
                   10991: checking for working const... yes
                   10992: checking for working alloca.h... no
                   10993: checking for alloca... yes
                   10994: checking for strerror... yes
                   10995: updating cache ./config.cache
                   10996: creating ./config.status
                   10997: creating Makefile
                   10998: ===&gt;  Building for bison-1.25
                   10999: 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
                   11000: 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
                   11001: 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
                   11002: 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
                   11003: 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
                   11004: 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 
                   11005: 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
                   11006: 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
                   11007: 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
                   11008: 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
                   11009: 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
                   11010: 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
                   11011: 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
                   11012: 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
                   11013: 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
                   11014: 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
                   11015: 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
                   11016: 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
                   11017: 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
                   11018: 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
                   11019: 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
                   11020: 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
                   11021: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   11022: rm -f bison.s1
                   11023: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   11024: </pre>
                   11025: 
                   11026:         <p>Everything seems OK, so install the files:</p>
                   11027:         <pre class="screen">
1.14      xtraeme  11028: <code class="prompt">#</code> <strong class=
                   11029: "userinput"><code>make install</code></strong>
1.1       grant    11030: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11031: ===&gt;  Installing for bison-1.25
                   11032: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   11033: rm -f /usr/pkg/bin/bison
                   11034: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   11035: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   11036: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   11037: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   11038: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   11039: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   11040: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   11041: ===&gt;  Registering installation for bison-1.25
                   11042: </pre>
                   11043: 
                   11044:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  11045:         remove it with <span><strong class="command">pkg_delete
                   11046:         bison</strong></span>. Should you decide that you want a
                   11047:         binary package, do this now:</p>
1.1       grant    11048:         <pre class="screen">
1.14      xtraeme  11049: <code class="prompt">#</code> <strong class=
                   11050: "userinput"><code>make package</code></strong>
1.1       grant    11051: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11052: ===&gt;  Building package for bison-1.25
                   11053: Creating package bison-1.25.tgz
                   11054: Registering depends:.
                   11055: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   11056: </pre>
                   11057: 
                   11058:         <p>Now that you don't need the source and object files any
                   11059:         more, clean up:</p>
                   11060:         <pre class="screen">
1.14      xtraeme  11061: <code class="prompt">#</code> <strong class=
                   11062: "userinput"><code>make clean</code></strong>
1.1       grant    11063: ===&gt;  Cleaning for bison-1.25
                   11064: </pre>
                   11065:       </div>
                   11066:     </div>
                   11067: 
                   11068:     <div class="appendix" lang="en" xml:lang="en">
                   11069:       <div class="titlepage">
                   11070:         <div>
                   11071:           <div>
                   11072:             <h2 class="title"><a name="logs" id=
                   11073:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   11074:           </div>
                   11075:         </div>
                   11076:       </div>
                   11077: 
                   11078:       <div class="toc">
                   11079:         <p><b>Table of Contents</b></p>
                   11080: 
                   11081:         <dl>
                   11082:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   11083:           Building figlet</a></span></dt>
                   11084: 
                   11085:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   11086:           Packaging figlet</a></span></dt>
                   11087:         </dl>
                   11088:       </div>
                   11089: 
                   11090:       <div class="sect1" lang="en" xml:lang="en">
                   11091:         <div class="titlepage">
                   11092:           <div>
                   11093:             <div>
                   11094:               <h2 class="title" style="clear: both"><a name=
                   11095:               "logs.building" id=
                   11096:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   11097:             </div>
                   11098:           </div>
                   11099:         </div>
                   11100:         <pre class="screen">
1.14      xtraeme  11101: <code class="prompt">#</code> <strong class=
                   11102: "userinput"><code>make</code></strong>
1.1       grant    11103: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11104: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   11105: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   11106: =&gt; [172219 bytes]
                   11107: Connected to ftp.plig.net.
                   11108: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   11109: 331 Guest login ok, send your complete e-mail address as password.
                   11110: 230-You are user #5 of 500 simultaneous users allowed.
                   11111: 230-
                   11112: 230-  ___ _             _ _                   
                   11113: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   11114: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   11115: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   11116: 230-         |_|   |_|     |___|         |___|
                   11117: 230-
                   11118: 230-** Welcome to ftp.plig.org **
                   11119: 230-
                   11120: 230-Please note that all transfers from this FTP site are logged. If you
                   11121: 230-do not like this, please disconnect now.
                   11122: 230-
                   11123: 230-This arhive is available via
                   11124: 230-
                   11125: 230-HTTP:  http://ftp.plig.org/
                   11126: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   11127: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   11128: 230-
                   11129: 230-Please email comments, bug reports and requests for packages to be
                   11130: 230-mirrored to ftp-admin@plig.org.   
                   11131: 230-
                   11132: 230-
                   11133: 230 Logged in anonymously.
                   11134: Remote system type is UNIX.
                   11135: Using binary mode to transfer files.
                   11136: 200 Type okay.
                   11137: 250 "/pub" is new cwd.
                   11138: 250-"/pub/figlet" is new cwd.
                   11139: 250-
                   11140: 250-Welcome to the figlet archive at ftp.figlet.org
                   11141: 250-    
                   11142: 250-    ftp://ftp.figlet.org/pub/figlet/
                   11143: 250-
                   11144: 250-The official FIGlet web page is:
                   11145: 250-    http://www.figlet.org/
                   11146: 250-
                   11147: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   11148: 250-contribute a font or something else, you can email us.
                   11149: 250 
                   11150: 250 "/pub/figlet/program" is new cwd.
                   11151: 250 "/pub/figlet/program/unix" is new cwd.
                   11152: local: figlet221.tar.gz remote: figlet221.tar.gz
                   11153: 502 Unimplemented command.
                   11154: 227 Entering Passive Mode (195,40,6,41,246,104)
                   11155: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   11156: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   11157: 226 Transfer completed.
                   11158: 172219 bytes received in 00:02 (75.99 KB/s)
                   11159: 221 Goodbye.
                   11160: =&gt; Checksum OK for figlet221.tar.gz.
                   11161: ===&gt; Extracting for figlet-2.2.1nb2
                   11162: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   11163: ===&gt; Patching for figlet-2.2.1nb2
                   11164: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   11165: ===&gt; Overriding tools for figlet-2.2.1nb2
                   11166: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   11167: ===&gt; Configuring for figlet-2.2.1nb2
                   11168: ===&gt; Building for figlet-2.2.1nb2
                   11169: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   11170: chmod a+x figlet
                   11171: gcc -O2 -o chkfont chkfont.c
                   11172: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  11173: <code class="prompt">#</code>
                   11174: <code class="prompt">#</code> <strong class=
                   11175: "userinput"><code>make install</code></strong>
1.1       grant    11176: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11177: ===&gt; Installing for figlet-2.2.1nb2
                   11178: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   11179: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   11180: mkdir -p /usr/pkg/share/figlet
                   11181: cp figlet /usr/pkg/bin
                   11182: cp chkfont /usr/pkg/bin
                   11183: chmod 555 figlist showfigfonts
                   11184: cp figlist /usr/pkg/bin
                   11185: cp showfigfonts /usr/pkg/bin
                   11186: cp fonts/*.flf /usr/pkg/share/figlet
                   11187: cp fonts/*.flc /usr/pkg/share/figlet
                   11188: cp figlet.6 /usr/pkg/man/man6
                   11189: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  11190: <code class="prompt">#</code>
1.1       grant    11191: </pre>
                   11192:       </div>
                   11193: 
                   11194:       <div class="sect1" lang="en" xml:lang="en">
                   11195:         <div class="titlepage">
                   11196:           <div>
                   11197:             <div>
                   11198:               <h2 class="title" style="clear: both"><a name=
                   11199:               "logs.package" id=
                   11200:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   11201:             </div>
                   11202:           </div>
                   11203:         </div>
                   11204:         <pre class="screen">
1.14      xtraeme  11205: <code class="prompt">#</code> <strong class=
                   11206: "userinput"><code>make package</code></strong>
1.1       grant    11207: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11208: ===&gt; Packaging figlet-2.2.1nb2
                   11209: ===&gt; Building binary package for figlet-2.2.1nb2
                   11210: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   11211: Using SrcDir value of /usr/pkg
                   11212: Registering depends:.  
1.14      xtraeme  11213: <code class="prompt">#</code>
1.1       grant    11214: </pre>
                   11215:       </div>
                   11216:     </div>
                   11217: 
                   11218:     <div class="appendix" lang="en" xml:lang="en">
                   11219:       <div class="titlepage">
                   11220:         <div>
                   11221:           <div>
                   11222:             <h2 class="title"><a name="ftp-layout" id=
                   11223:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   11224:             FTP server's package archive</h2>
                   11225:           </div>
                   11226:         </div>
                   11227:       </div>
                   11228: 
                   11229:       <p>Layout for precompiled binary packages on
                   11230:       ftp.NetBSD.org:</p>
                   11231:       <pre class="programlisting">
                   11232: /pub/NetBSD/packages/
                   11233:                 distfiles/
                   11234: 
                   11235:                 # Unpacked pkgsrc trees
                   11236:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   11237:                 pkgsrc-2003Q4 -&gt; N/A
                   11238:                 pkgsrc-2004Q1/pkgsrc
                   11239: 
                   11240:                 # pkgsrc archives
                   11241:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   11242:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   11243:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   11244: 
                   11245:                 # Per pkgsrc-release/OS-release/arch package archives
                   11246:                 pkgsrc-2003Q4/
                   11247:                         NetBSD-1.6.2/
                   11248:                                 i386/
                   11249:                                         All/
                   11250:                                         archivers/
                   11251:                                                 foo -&gt; ../All/foo
                   11252:                                         ...
                   11253:                 pkgsrc-2004Q1/
                   11254:                         NetBSD-1.6.2/
                   11255:                                 i386/
                   11256:                                         All/
                   11257:                                         ...
                   11258:                         NetBSD-2.0/
                   11259:                                 i386/
                   11260:                                         All/
                   11261:                                         ...
                   11262:                         SunOS-5.9/
                   11263:                                 sparc/
                   11264:                                         All/
                   11265:                                         ...
                   11266:                                 x86/
                   11267:                                         All/
                   11268:                                         ...
                   11269: 
                   11270:                 # Per os-release package archive convenience links
                   11271:                 NetBSD-1.6.2 -&gt; 1.6.2
                   11272:                 1.6.2/
                   11273:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   11274:                         m68k/
                   11275:                                 All/
                   11276:                                 archivers/
                   11277:                                         foo -&gt; ../All/foo
                   11278:                                 ...
                   11279:                         amiga -&gt; m68k
                   11280:                         atari -&gt; m68k
                   11281:                         ...
                   11282: 
                   11283:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   11284:                 NetBSD-2.0/
                   11285:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   11286:                 SunOS-5.9/
                   11287:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   11288:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   11289:                         
                   11290: </pre>
                   11291: 
                   11292:       <p>To create:</p>
                   11293: 
                   11294:       <div class="orderedlist">
                   11295:         <ol type="1">
                   11296:           <li>
                   11297:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   11298:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   11299:             5.3, &#8220;Doing a bulk build of all
                   11300:             packages&#8221;</a></p>
                   11301:           </li>
                   11302: 
                   11303:           <li>
                   11304:             <p>Upload /usr/pkgsrc/packages to</p>
                   11305:             <pre class="programlisting">
                   11306:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  11307:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    11308:         `uname -s`-`uname -r`/                  # OS &amp; version
                   11309:         `uname -p`                              # architecture
                   11310:        
                   11311: </pre>
                   11312:           </li>
                   11313: 
                   11314:           <li>
1.14      xtraeme  11315:             <p>If necessary, create a symlink <span><strong class=
                   11316:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   11317:             (amiga -&gt; m68k, ...)</p>
1.1       grant    11318:           </li>
                   11319:         </ol>
                   11320:       </div>
                   11321:     </div>
1.2       hubertf  11322: 
                   11323:     <div class="appendix" lang="en" xml:lang="en">
                   11324:       <div class="titlepage">
                   11325:         <div>
                   11326:           <div>
                   11327:             <h2 class="title"><a name="editing" id=
                   11328:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   11329:             for the pkgsrc guide</h2>
                   11330:           </div>
                   11331:         </div>
                   11332:       </div>
                   11333: 
                   11334:       <div class="toc">
                   11335:         <p><b>Table of Contents</b></p>
                   11336: 
                   11337:         <dl>
1.19    ! hubertf  11338:           <dt><span class="sect1"><a href="#id2596182">D.1.
1.2       hubertf  11339:           Targets</a></span></dt>
                   11340: 
1.19    ! hubertf  11341:           <dt><span class="sect1"><a href="#id2596389">D.2.
1.2       hubertf  11342:           Procedure</a></span></dt>
                   11343:         </dl>
                   11344:       </div>
                   11345: 
                   11346:       <p>This section contains information on editing the pkgsrc
                   11347:       guide itself.</p>
                   11348: 
                   11349:       <div class="sect1" lang="en" xml:lang="en">
                   11350:         <div class="titlepage">
                   11351:           <div>
                   11352:             <div>
                   11353:               <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  11354:               "id2596182" id="id2596182"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  11355:             </div>
                   11356:           </div>
                   11357:         </div>
                   11358: 
1.14      xtraeme  11359:         <p>The pkgsrc guide's source code is stored in <code class=
                   11360:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  11361:         are created from it:</p>
                   11362: 
                   11363:         <div class="itemizedlist">
                   11364:           <ul type="disc">
                   11365:             <li>
1.14      xtraeme  11366:               <p><code class=
                   11367:               "filename">pkgsrc/doc/pkgsrc.txt</code>, which
                   11368:               replaces <code class=
                   11369:               "filename">pkgsrc/Packages.txt</code></p>
1.2       hubertf  11370:             </li>
                   11371: 
                   11372:             <li>
1.14      xtraeme  11373:               <p><code class=
                   11374:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  11375:             </li>
                   11376: 
                   11377:             <li>
1.14      xtraeme  11378:               <p><code class=
                   11379:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  11380:               the documentation on the NetBSD website will be built
                   11381:               from pkgsrc and kept up to date on the web server
                   11382:               itself. This means you <span class=
                   11383:               "emphasis"><em>must</em></span> make sure that your
                   11384:               changes haven't broken the build!</p>
                   11385:             </li>
1.6       hubertf  11386: 
                   11387:             <li>
1.14      xtraeme  11388:               <p><code class=
                   11389:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  11390:               PDF version of the pkgsrc guide.</p>
                   11391:             </li>
                   11392: 
                   11393:             <li>
1.14      xtraeme  11394:               <p><code class=
                   11395:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  11396:               PostScript version of the pkgsrc guide.</p>
                   11397:             </li>
1.2       hubertf  11398:           </ul>
                   11399:         </div>
                   11400:       </div>
                   11401: 
                   11402:       <div class="sect1" lang="en" xml:lang="en">
                   11403:         <div class="titlepage">
                   11404:           <div>
                   11405:             <div>
                   11406:               <h2 class="title" style="clear: both"><a name=
1.19    ! hubertf  11407:               "id2596389" id=
        !          11408:               "id2596389"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  11409:             </div>
                   11410:           </div>
                   11411:         </div>
                   11412: 
                   11413:         <p>The procedure to edit the pkgsrc guide is:</p>
                   11414: 
                   11415:         <div class="itemizedlist">
                   11416:           <ul type="disc">
                   11417:             <li>
1.6       hubertf  11418:               <p>Make sure you have the packages needed to
                   11419:               re-generate the pkgsrc guide (and other XML-based
                   11420:               NetBSD documentation) installed. These are
1.11      ben      11421:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  11422:               for creating the ASCII- and HTML-version, and
                   11423:               &#8220;<span class=
1.11      ben      11424:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  11425:               PostScript- and PDF version. You will need both
                   11426:               packages installed, to make sure documentation is
                   11427:               consistent across all formats. The packages can be
1.14      xtraeme  11428:               found in <code class=
                   11429:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
                   11430:               <code class=
                   11431:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  11432:             </li>
                   11433: 
                   11434:             <li>
1.14      xtraeme  11435:               <p>Edit the XML file(s) in <code class=
                   11436:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  11437:             </li>
                   11438: 
                   11439:             <li>
1.14      xtraeme  11440:               <p>Run <span><strong class="command">make extract
                   11441:               &amp;&amp; make do-lint</strong></span> in
                   11442:               <code class="filename">pkgsrc/doc/guide</code> to
                   11443:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  11444:             </li>
                   11445: 
                   11446:             <li>
1.14      xtraeme  11447:               <p>Run <span><strong class=
                   11448:               "command">make</strong></span> in <code class=
                   11449:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   11450:               and ASCII version.</p>
1.2       hubertf  11451:             </li>
                   11452: 
                   11453:             <li>
1.14      xtraeme  11454:               <p>If all is well, run <span><strong class=
                   11455:               "command">make install-doc</strong></span> to put the
                   11456:               generated files into <code class=
                   11457:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  11458:             </li>
                   11459: 
                   11460:             <li>
1.14      xtraeme  11461:               <p><span><strong class="command">cvs commit
                   11462:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  11463:             </li>
                   11464: 
                   11465:             <li>
1.14      xtraeme  11466:               <p><span><strong class="command">cvs commit -m
                   11467:               re-generate
                   11468:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  11469:             </li>
1.4       hubertf  11470: 
                   11471:             <li>
                   11472:               <p>Until the webserver on www.NetBSD.org is really
                   11473:               updated automatically to pick up changes to the
1.14      xtraeme  11474:               pkgsrc guide automatically, also run
1.18      xtraeme  11475:               <span><strong class="command">make install-htdocs
1.14      xtraeme  11476:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   11477:               similar, adjust <code class=
                   11478:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  11479:             </li>
                   11480: 
                   11481:             <li>
1.14      xtraeme  11482:               <p><span><strong class="command">cvs commit
                   11483:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  11484:             </li>
1.2       hubertf  11485:           </ul>
                   11486:         </div>
                   11487:       </div>
                   11488:     </div>
1.1       grant    11489:   </div>
                   11490: </body>
                   11491: </html>

CVSweb <webmaster@jp.NetBSD.org>