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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.14      xtraeme     4:   "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
1.1       grant       5:   <meta http-equiv="Content-Type" content=
                      6:   "text/html; charset=us-ascii" />
                      7: 
                      8:   <title>The pkgsrc guide</title>
                      9:   <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
                     10:   <meta name="generator" content=
1.14      xtraeme    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.14      xtraeme    22:           <h1 class="title"><a name="id2458392" id=
                     23:           "id2458392"></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.14      xtraeme    96:             <dt><span class="sect1"><a href="#id2514274">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.14      xtraeme   120:                 <dt><span class="sect1"><a href="#id2514852">2.1.
1.1       grant     121:                 As tar file</a></span></dt>
                    122: 
1.14      xtraeme   123:                 <dt><span class="sect1"><a href="#id2514868">2.2.
1.1       grant     124:                 Via SUP</a></span></dt>
                    125: 
1.14      xtraeme   126:                 <dt><span class="sect1"><a href="#id2514968">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.14      xtraeme   136:                 <dt><span class="sect1"><a href="#id2515078">3.1.
1.1       grant     137:                 Bootstrapping pkgsrc</a></span></dt>
                    138: 
1.14      xtraeme   139:                 <dt><span class="sect1"><a href="#id2515253">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.14      xtraeme   145:                     "#id2515259">3.2.1. Darwin (Mac OS
1.1       grant     146:                     X)</a></span></dt>
                    147: 
                    148:                     <dt><span class="sect2"><a href=
1.14      xtraeme   149:                     "#id2515558">3.2.2. FreeBSD</a></span></dt>
1.1       grant     150: 
                    151:                     <dt><span class="sect2"><a href=
1.14      xtraeme   152:                     "#id2515660">3.2.3. Interix</a></span></dt>
1.1       grant     153: 
                    154:                     <dt><span class="sect2"><a href=
1.14      xtraeme   155:                     "#id2515751">3.2.4. IRIX</a></span></dt>
1.1       grant     156: 
                    157:                     <dt><span class="sect2"><a href=
1.14      xtraeme   158:                     "#id2516278">3.2.5. OpenBSD</a></span></dt>
1.1       grant     159: 
                    160:                     <dt><span class="sect2"><a href=
1.14      xtraeme   161:                     "#id2516390">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.14      xtraeme   179:                     "#id2516526">4.1.1. Where to get binary
1.1       grant     180:                     packages</a></span></dt>
                    181: 
                    182:                     <dt><span class="sect2"><a href=
1.14      xtraeme   183:                     "#id2516567">4.1.2. How to use binary
1.1       grant     184:                     packages</a></span></dt>
                    185: 
                    186:                     <dt><span class="sect2"><a href=
1.14      xtraeme   187:                     "#id2516633">4.1.3. A word of
1.1       grant     188:                     warning</a></span></dt>
                    189:                   </dl>
                    190:                 </dd>
                    191: 
1.14      xtraeme   192:                 <dt><span class="sect1"><a href="#id2516645">4.2.
1.1       grant     193:                 Building packages from source</a></span></dt>
                    194: 
                    195:                 <dd>
                    196:                   <dl>
                    197:                     <dt><span class="sect2"><a href=
1.14      xtraeme   198:                     "#id2516723">4.2.1.
1.1       grant     199:                     Requirements</a></span></dt>
                    200: 
                    201:                     <dt><span class="sect2"><a href=
1.14      xtraeme   202:                     "#id2516743">4.2.2. Fetching
1.1       grant     203:                     distfiles</a></span></dt>
                    204: 
                    205:                     <dt><span class="sect2"><a href=
1.14      xtraeme   206:                     "#id2516864">4.2.3. How to build and
1.1       grant     207:                     install</a></span></dt>
                    208: 
                    209:                     <dt><span class="sect2"><a href=
1.14      xtraeme   210:                     "#id2517180">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.14      xtraeme   222:                 <dt><span class="sect1"><a href="#id2517335">5.1.
1.1       grant     223:                 Building a single binary package</a></span></dt>
                    224: 
1.14      xtraeme   225:                 <dt><span class="sect1"><a href="#id2517822">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.14      xtraeme   239:                     "#id2517962">5.3.2. Other environmental
1.1       grant     240:                     considerations</a></span></dt>
                    241: 
                    242:                     <dt><span class="sect2"><a href=
1.14      xtraeme   243:                     "#id2518003">5.3.3. Operation</a></span></dt>
1.1       grant     244: 
                    245:                     <dt><span class="sect2"><a href=
1.14      xtraeme   246:                     "#id2583267">5.3.4. What it
1.1       grant     247:                     does</a></span></dt>
                    248: 
                    249:                     <dt><span class="sect2"><a href=
1.14      xtraeme   250:                     "#id2583392">5.3.5. Disk space
1.1       grant     251:                     requirements</a></span></dt>
                    252: 
                    253:                     <dt><span class="sect2"><a href=
1.14      xtraeme   254:                     "#id2583418">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.14      xtraeme   258:                     "#id2583811">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.14      xtraeme   267:                 <dt><span class="sect1"><a href="#id2584227">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.14      xtraeme   274:                     "#id2584310">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.14      xtraeme   286:                 <dt><span class="sect1"><a href="#id2584502">6.1.
1.1       grant     287:                 Is there a mailing list for pkg-related
                    288:                 discussion?</a></span></dt>
                    289: 
1.14      xtraeme   290:                 <dt><span class="sect1"><a href="#id2584600">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.14      xtraeme   297:                 <dt><span class="sect1"><a href="#id2584853">6.4.
1.1       grant     298:                 How to use pkgsrc as non-root</a></span></dt>
                    299: 
1.14      xtraeme   300:                 <dt><span class="sect1"><a href="#id2584865">6.5.
1.15    ! xtraeme   301:                 How to resume transfers when fetching
        !           302:                 distfiles?</a></span></dt>
1.14      xtraeme   303: 
1.15    ! xtraeme   304:                 <dt><span class="sect1"><a href="#id2584907">6.6.
1.1       grant     305:                 How can I install/use XFree86 from
                    306:                 pkgsrc?</a></span></dt>
                    307: 
1.15    ! xtraeme   308:                 <dt><span class="sect1"><a href="#id2584935">6.7.
1.1       grant     309:                 How can I install/use X.org from
                    310:                 pkgsrc?</a></span></dt>
                    311: 
1.15    ! xtraeme   312:                 <dt><span class="sect1"><a href="#id2584963">6.8.
1.1       grant     313:                 How to fetch files from behind a
                    314:                 firewall</a></span></dt>
                    315: 
1.15    ! xtraeme   316:                 <dt><span class="sect1"><a href="#id2584977">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.15    ! xtraeme   321:                 <dt><span class="sect1"><a href="#id2585028">6.10.
1.1       grant     322:                 How to fetch all distfiles at once</a></span></dt>
                    323: 
1.15    ! xtraeme   324:                 <dt><span class="sect1"><a href="#id2585168">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.15    ! xtraeme   329:                 <dt><span class="sect1"><a href="#id2585206">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.15    ! xtraeme   333:                 <dt><span class="sect1"><a href="#id2585264">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.15    ! xtraeme   371:                 <dt><span class="sect1"><a href="#id2586445">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.15    ! xtraeme   378:                 <dt><span class="sect1"><a href="#id2586640">7.6.
1.14      xtraeme   379:                 <code class="filename">work*</code></a></span></dt>
1.1       grant     380: 
1.15    ! xtraeme   381:                 <dt><span class="sect1"><a href="#id2586727">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.15    ! xtraeme   392:                 <dt><span class="sect1"><a href="#id2586781">8.1.
1.1       grant     393:                 RCS ID</a></span></dt>
                    394: 
1.15    ! xtraeme   395:                 <dt><span class="sect1"><a href="#id2586796">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.15    ! xtraeme   407:                 <dt><span class="sect1"><a href="#id2587186">8.5.
1.1       grant     408:                 Manpage-compression</a></span></dt>
                    409: 
1.15    ! xtraeme   410:                 <dt><span class="sect1"><a href="#id2587227">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.15    ! xtraeme   414:                 <dt><span class="sect1"><a href="#id2587244">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.15    ! xtraeme   429:                 <dt><span class="sect1"><a href="#id2587653">9.1.
1.1       grant     430:                 Converting packages to use
                    431:                 buildlink3</a></span></dt>
                    432: 
1.15    ! xtraeme   433:                 <dt><span class="sect1"><a href="#id2587844">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.15    ! xtraeme   440:                     "#id2587913">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.15    ! xtraeme   444:                     "#id2588354">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.15    ! xtraeme   452:                 <dt><span class="sect1"><a href="#id2588433">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.15    ! xtraeme   459:                     "#id2588582">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.15    ! xtraeme   464:                     "#id2588877">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.15    ! xtraeme   476:                 <dt><span class="sect1"><a href="#id2588950">10.1.
1.1       grant     477:                 Global default options</a></span></dt>
                    478: 
1.15    ! xtraeme   479:                 <dt><span class="sect1"><a href="#id2588965">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.15    ! xtraeme   494:                 <dt><span class="sect1"><a href="#id2589573">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.15    ! xtraeme   508:                 <dt><span class="sect1"><a href="#id2590973">12.1.
1.1       grant     509:                 General operation</a></span></dt>
                    510: 
                    511:                 <dd>
                    512:                   <dl>
                    513:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   514:                     "#id2590977">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.15    ! xtraeme   518:                     "#id2591128">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.15    ! xtraeme   526:                     "#id2591643">12.1.4. Handling conflicts with
1.1       grant     527:                     other packages</a></span></dt>
                    528: 
                    529:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   530:                     "#id2591762">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.15    ! xtraeme   534:                     "#id2591787">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.15    ! xtraeme   542:                     "#id2591879">12.1.8. How to handle compiler
1.1       grant     543:                     bugs</a></span></dt>
                    544: 
                    545:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   546:                     "#id2591901">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.15    ! xtraeme   551:                     "#id2591950">12.1.10. Portability of
1.1       grant     552:                     packages</a></span></dt>
                    553:                   </dl>
                    554:                 </dd>
                    555: 
1.15    ! xtraeme   556:                 <dt><span class="sect1"><a href="#id2591975">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.15    ! xtraeme   562:                     "#id2591978">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.15    ! xtraeme   567:                     "#id2592109">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.15    ! xtraeme   572:                 <dt><span class="sect1"><a href="#id2592121">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.15    ! xtraeme   582:                     "#id2592529">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.15    ! xtraeme   587:                     "#id2592613">12.3.3. GNU
1.1       grant     588:                     Autoconf/Automake</a></span></dt>
                    589:                   </dl>
                    590:                 </dd>
                    591: 
1.15    ! xtraeme   592:                 <dt><span class="sect1"><a href="#id2592726">12.4.
1.1       grant     593:                 Building considerations</a></span></dt>
                    594: 
                    595:                 <dd>
                    596:                   <dl>
                    597:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   598:                     "#id2592729">12.4.1. CPP
1.1       grant     599:                     defines</a></span></dt>
                    600:                   </dl>
                    601:                 </dd>
                    602: 
1.15    ! xtraeme   603:                 <dt><span class="sect1"><a href="#id2592759">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.15    ! xtraeme   609:                     "#id2592762">12.5.1. Package configuration
1.1       grant     610:                     files</a></span></dt>
                    611: 
                    612:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   613:                     "#id2592933">12.5.2. User
1.2       hubertf   614:                     interaction</a></span></dt>
1.1       grant     615: 
                    616:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   617:                     "#id2593046">12.5.3. Handling
1.1       grant     618:                     licenses</a></span></dt>
                    619: 
                    620:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   621:                     "#id2593197">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.15    ! xtraeme   625:                     "#id2593328">12.5.5. Installing score
1.1       grant     626:                     files</a></span></dt>
                    627: 
                    628:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   629:                     "#id2593371">12.5.6. Packages providing login
1.1       grant     630:                     shells</a></span></dt>
                    631: 
                    632:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   633:                     "#id2593429">12.5.7. Packages containing perl
1.1       grant     634:                     scripts</a></span></dt>
                    635: 
                    636:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   637:                     "#id2593447">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.15    ! xtraeme   641:                     "#id2593468">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.15    ! xtraeme   649:                     "#id2593688">12.5.11. Packages installing
1.1       grant     650:                     GConf2 data files</a></span></dt>
                    651: 
                    652:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   653:                     "#id2593788">12.5.12. Packages installing
1.1       grant     654:                     scrollkeeper data files</a></span></dt>
                    655: 
                    656:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   657:                     "#id2593840">12.5.13. Packages installing X11
1.1       grant     658:                     fonts</a></span></dt>
                    659: 
                    660:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   661:                     "#id2593886">12.5.14. Packages installing GTK2
1.1       grant     662:                     modules</a></span></dt>
                    663: 
                    664:                     <dt><span class="sect2"><a href=
1.15    ! xtraeme   665:                     "#id2593956">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.15    ! xtraeme   669:                     "#id2594076">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.15    ! xtraeme   673:                     "#id2594283">12.5.17. Packages using
1.1       grant     674:                     intltool</a></span></dt>
                    675:                   </dl>
                    676:                 </dd>
                    677: 
1.15    ! xtraeme   678:                 <dt><span class="sect1"><a href="#id2594297">12.6.
1.1       grant     679:                 Feedback to the author</a></span></dt>
                    680:               </dl>
                    681:             </dd>
                    682: 
                    683:             <dt><span class="chapter"><a href="#debug">13.
                    684:             Debugging</a></span></dt>
                    685: 
                    686:             <dt><span class="chapter"><a href="#submit">14.
                    687:             Submitting and Committing</a></span></dt>
                    688: 
                    689:             <dd>
                    690:               <dl>
1.15    ! xtraeme   691:                 <dt><span class="sect1"><a href="#id2594827">14.1.
1.1       grant     692:                 Submitting your packages</a></span></dt>
                    693: 
1.15    ! xtraeme   694:                 <dt><span class="sect1"><a href="#id2594878">14.2.
1.1       grant     695:                 Committing: Importing a package into
                    696:                 CVS</a></span></dt>
                    697: 
1.15    ! xtraeme   698:                 <dt><span class="sect1"><a href="#id2594941">14.3.
1.2       hubertf   699:                 Updating a package to a newer
                    700:                 version</a></span></dt>
1.1       grant     701: 
1.15    ! xtraeme   702:                 <dt><span class="sect1"><a href="#id2594961">14.4.
1.2       hubertf   703:                 Moving a package in pkgsrc</a></span></dt>
1.1       grant     704:               </dl>
                    705:             </dd>
                    706:           </dl>
                    707:         </dd>
                    708: 
                    709:         <dt><span class="appendix"><a href="#examples">A. A simple
                    710:         example package: bison</a></span></dt>
                    711: 
                    712:         <dd>
                    713:           <dl>
1.15    ! xtraeme   714:             <dt><span class="sect1"><a href="#id2595255">A.1.
1.1       grant     715:             files</a></span></dt>
                    716: 
                    717:             <dd>
                    718:               <dl>
1.15    ! xtraeme   719:                 <dt><span class="sect2"><a href="#id2595258">A.1.1.
1.1       grant     720:                 Makefile</a></span></dt>
                    721: 
1.15    ! xtraeme   722:                 <dt><span class="sect2"><a href="#id2595266">A.1.2.
1.1       grant     723:                 DESCR</a></span></dt>
                    724: 
1.15    ! xtraeme   725:                 <dt><span class="sect2"><a href="#id2595281">A.1.3.
1.1       grant     726:                 PLIST</a></span></dt>
                    727: 
1.15    ! xtraeme   728:                 <dt><span class="sect2"><a href="#id2595288">A.1.4.
1.14      xtraeme   729:                 Checking a package with <span><strong class=
                    730:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant     731:               </dl>
                    732:             </dd>
                    733: 
1.15    ! xtraeme   734:             <dt><span class="sect1"><a href="#id2595329">A.2. Steps
1.1       grant     735:             for building, installing, packaging</a></span></dt>
                    736:           </dl>
                    737:         </dd>
                    738: 
                    739:         <dt><span class="appendix"><a href="#logs">B. Build
                    740:         logs</a></span></dt>
                    741: 
                    742:         <dd>
                    743:           <dl>
                    744:             <dt><span class="sect1"><a href="#logs.building">B.1.
                    745:             Building figlet</a></span></dt>
                    746: 
                    747:             <dt><span class="sect1"><a href="#logs.package">B.2.
                    748:             Packaging figlet</a></span></dt>
                    749:           </dl>
                    750:         </dd>
                    751: 
                    752:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
                    753:         of the FTP server's package archive</a></span></dt>
1.2       hubertf   754: 
                    755:         <dt><span class="appendix"><a href="#editing">D. Editing
                    756:         guidelines for the pkgsrc guide</a></span></dt>
                    757: 
                    758:         <dd>
                    759:           <dl>
1.15    ! xtraeme   760:             <dt><span class="sect1"><a href="#id2595975">D.1.
1.2       hubertf   761:             Targets</a></span></dt>
                    762: 
1.15    ! xtraeme   763:             <dt><span class="sect1"><a href="#id2596387">D.2.
1.2       hubertf   764:             Procedure</a></span></dt>
                    765:           </dl>
                    766:         </dd>
1.1       grant     767:       </dl>
                    768:     </div>
                    769: 
                    770:     <div class="chapter" lang="en" xml:lang="en">
                    771:       <div class="titlepage">
                    772:         <div>
                    773:           <div>
                    774:             <h2 class="title"><a name="introduction" id=
                    775:             "introduction"></a>Chapter&nbsp;1.&nbsp;Introduction</h2>
                    776:           </div>
                    777:         </div>
                    778:       </div>
                    779: 
                    780:       <div class="toc">
                    781:         <p><b>Table of Contents</b></p>
                    782: 
                    783:         <dl>
1.14      xtraeme   784:           <dt><span class="sect1"><a href="#id2514274">1.1.
1.1       grant     785:           Introduction</a></span></dt>
                    786: 
                    787:           <dt><span class="sect1"><a href="#overview">1.2.
                    788:           Overview</a></span></dt>
                    789: 
                    790:           <dt><span class="sect1"><a href="#terminology">1.3.
                    791:           Terminology</a></span></dt>
                    792: 
                    793:           <dt><span class="sect1"><a href="#typography">1.4.
                    794:           Typography</a></span></dt>
                    795:         </dl>
                    796:       </div>
                    797: 
                    798:       <div class="sect1" lang="en" xml:lang="en">
                    799:         <div class="titlepage">
                    800:           <div>
                    801:             <div>
                    802:               <h2 class="title" style="clear: both"><a name=
1.14      xtraeme   803:               "id2514274" id=
                    804:               "id2514274"></a>1.1.&nbsp;Introduction</h2>
1.1       grant     805:             </div>
                    806:           </div>
                    807:         </div>
                    808: 
                    809:         <p>There is a lot of software freely available for Unix
                    810:         based systems, which usually runs on NetBSD and other
                    811:         Unix-flavoured systems, too, sometimes with some
                    812:         modifications. The NetBSD Packages Collection (pkgsrc)
                    813:         incorporates any such changes necessary to make that
                    814:         software run, and makes the installation (and
                    815:         de-installation) of the software package easy by means of a
                    816:         single command.</p>
                    817: 
                    818:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme   819:         the <span><strong class="command">pkg_*</strong></span>
                    820:         tools so that installation and de-installation, printing of
                    821:         an inventory of all installed packages and retrieval of
                    822:         one-line comments or more verbose descriptions are all
                    823:         simple.</p>
1.1       grant     824: 
                    825:         <p>pkgsrc currently contains several thousand packages,
                    826:         including:</p>
                    827: 
                    828:         <div class="itemizedlist">
                    829:           <ul type="disc">
                    830:             <li>
                    831:               <p><a xmlns=
                    832:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    833:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.14      xtraeme   834:               class="pkgname">www/apache</a> - The Apache web
                    835:               server</p>
1.1       grant     836:             </li>
                    837: 
                    838:             <li>
                    839:               <p><a xmlns=
                    840:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    841:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.14      xtraeme   842:               class="pkgname">www/mozilla</a> - The Mozilla web
                    843:               browser</p>
1.1       grant     844:             </li>
                    845: 
                    846:             <li>
                    847:               <p><a xmlns=
                    848:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    849:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.14      xtraeme   850:               class="pkgname">meta-pkgs/gnome</a> - The GNOME
                    851:               Desktop Environment</p>
1.1       grant     852:             </li>
                    853: 
                    854:             <li>
                    855:               <p><a xmlns=
                    856:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    857:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.14      xtraeme   858:               class="pkgname">meta-pkgs/kde3</a> - The K Desktop
                    859:               Environment</p>
1.1       grant     860:             </li>
                    861:           </ul>
                    862:         </div>
                    863: 
                    864:         <p>...just to name a few.</p>
                    865: 
                    866:         <p>pkgsrc has built-in support for handling varying
                    867:         dependencies, such as pthreads and X11, and extended
                    868:         features such as IPv6 support on a range of platforms.</p>
                    869: 
                    870:         <p>pkgsrc was derived from FreeBSD's ports system, and
                    871:         initially developed for NetBSD only. Since then, pkgsrc has
                    872:         grown a lot, and now supports the following platforms:</p>
                    873: 
                    874:         <div class="itemizedlist">
                    875:           <ul type="disc">
                    876:             <li>
                    877:               <p><a href="http://developer.apple.com/darwin/"
                    878:               target="_top">Darwin</a> (<a href=
                    879:               "http://www.apple.com/macosx/" target="_top">Mac OS
                    880:               X</a>)</p>
                    881:             </li>
                    882: 
                    883:             <li>
1.3       hubertf   884:               <p><a href="http://www.DragonFlyBSD.org/" target=
                    885:               "_top">DragonFlyBSD</a></p>
                    886:             </li>
                    887: 
                    888:             <li>
1.1       grant     889:               <p><a href="http://www.FreeBSD.org/" target=
                    890:               "_top">FreeBSD</a></p>
                    891:             </li>
                    892: 
                    893:             <li>
1.3       hubertf   894:               <p>Microsoft Windows, via <a href=
                    895:               "http://www.microsoft.com/windows/sfu/" target=
                    896:               "_top">Interix</a></p>
1.1       grant     897:             </li>
                    898: 
                    899:             <li>
                    900:               <p><a href="http://www.sgi.com/software/irix6.5/"
                    901:               target="_top">IRIX</a></p>
                    902:             </li>
                    903: 
                    904:             <li>
                    905:               <p><a href="http://www.linux.org/" target=
                    906:               "_top">Linux</a></p>
                    907:             </li>
                    908: 
                    909:             <li>
                    910:               <p><a href="http://www.NetBSD.org/" target=
                    911:               "_top">NetBSD</a> (of course)</p>
                    912:             </li>
                    913: 
                    914:             <li>
                    915:               <p><a href="http://www.openbsd.org/" target=
                    916:               "_top">OpenBSD</a></p>
                    917:             </li>
                    918: 
                    919:             <li>
                    920:               <p><a href="http://www.sun.com/solaris/" target=
                    921:               "_top">Solaris</a></p>
                    922:             </li>
                    923:           </ul>
                    924:         </div>
                    925:       </div>
                    926: 
                    927:       <div class="sect1" lang="en" xml:lang="en">
                    928:         <div class="titlepage">
                    929:           <div>
                    930:             <div>
                    931:               <h2 class="title" style="clear: both"><a name=
                    932:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
                    933:             </div>
                    934:           </div>
                    935:         </div>
                    936: 
                    937:         <p>This document is divided into two parts. The first,
                    938:         <a href="#users-guide" title=
1.2       hubertf   939:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
                    940:         user's guide</a>, describes how one can use one of the
                    941:         packages in the Package Collection, either by installing a
                    942:         precompiled binary package, or by building one's own copy
                    943:         using the NetBSD package system. The second part, <a href=
1.1       grant     944:         "#developers-guide" title=
1.2       hubertf   945:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                    946:         pkgsrc developer's guide</a>, explains how to prepare a
                    947:         package so it can be easily built by other NetBSD users
                    948:         without knowing about the package's building details.</p>
1.1       grant     949: 
                    950:         <p>This document is available in various formats:</p>
                    951: 
                    952:         <div class="itemizedlist">
                    953:           <ul type="disc">
                    954:             <li>
                    955:               <p><a href="index.html" target="_top">HTML</a></p>
                    956:             </li>
                    957: 
                    958:             <li>
                    959:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                    960:             </li>
                    961: 
                    962:             <li>
                    963:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                    964:             </li>
                    965: 
                    966:             <li>
                    967:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                    968:             </li>
                    969:           </ul>
                    970:         </div>
                    971:       </div>
                    972: 
                    973:       <div class="sect1" lang="en" xml:lang="en">
                    974:         <div class="titlepage">
                    975:           <div>
                    976:             <div>
                    977:               <h2 class="title" style="clear: both"><a name=
                    978:               "terminology" id=
                    979:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                    980:             </div>
                    981:           </div>
                    982:         </div>
                    983: 
                    984:         <p>There has been a lot of talk about &#8220;<span class=
                    985:         "quote">ports</span>&#8221;, &#8220;<span class=
                    986:         "quote">packages</span>&#8221;, etc. so far. Here is a
                    987:         description of all the terminology used within this
                    988:         document.</p>
                    989: 
                    990:         <div class="variablelist">
                    991:           <dl>
                    992:             <dt><span class="term">Package</span></dt>
                    993: 
                    994:             <dd>
                    995:               <p>A set of files and building instructions that
                    996:               describe what's necessary to build a certain piece of
                    997:               software using pkgsrc. Packages are traditionally
1.14      xtraeme   998:               stored under <code class=
                    999:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1000:             </dd>
                   1001: 
                   1002:             <dt><span class="term">The NetBSD package
                   1003:             system</span></dt>
                   1004: 
                   1005:             <dd>
                   1006:               <p>This is the former name of &#8220;<span class=
                   1007:               "quote">pkgsrc</span>&#8221;. It is part of the
                   1008:               NetBSD operating system and can be bootstrap to run
                   1009:               on non-NetBSD operating systems as well. It handles
                   1010:               building (compiling), installing, and removing of
                   1011:               packages.</p>
                   1012:             </dd>
                   1013: 
                   1014:             <dt><span class="term">Distfile</span></dt>
                   1015: 
                   1016:             <dd>
                   1017:               <p>This term describes the file or files that are
                   1018:               provided by the author of the piece of software to
                   1019:               distribute his work. All the changes necessary to
                   1020:               build on NetBSD are reflected in the corresponding
                   1021:               package. Usually the distfile is in the form of a
                   1022:               compressed tar-archive, but other types are possible,
1.14      xtraeme  1023:               too. Distfiles are usually stored below <code class=
                   1024:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1025:             </dd>
                   1026: 
                   1027:             <dt><span class="term">Port</span></dt>
                   1028: 
                   1029:             <dd>
                   1030:               <p>This is the term used by FreeBSD and OpenBSD
                   1031:               people for what we call a package. In NetBSD
                   1032:               terminology, &#8220;<span class=
                   1033:               "quote">port</span>&#8221; refers to a different
                   1034:               architecture.</p>
                   1035:             </dd>
                   1036: 
                   1037:             <dt><span class="term">Precompiled/binary
                   1038:             package</span></dt>
                   1039: 
                   1040:             <dd>
                   1041:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1042:               distfile and stuffed together in a single
                   1043:               <code class="filename">.tgz</code> file so it can be
                   1044:               installed on machines of the same machine
                   1045:               architecture without the need to recompile. Packages
                   1046:               are usually generated in <code class=
                   1047:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1048:               an archive on <a href=
1.1       grant    1049:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1050:               "_top">ftp.NetBSD.org</a>.</p>
                   1051: 
                   1052:               <p>Sometimes, this is referred to by the term
                   1053:               &#8220;<span class="quote">package</span>&#8221; too,
                   1054:               especially in the context of precompiled
                   1055:               packages.</p>
                   1056:             </dd>
                   1057: 
                   1058:             <dt><span class="term">Program</span></dt>
                   1059: 
                   1060:             <dd>
                   1061:               <p>The piece of software to be installed which will
                   1062:               be constructed from all the files in the Distfile by
                   1063:               the actions defined in the corresponding package.</p>
                   1064:             </dd>
                   1065:           </dl>
                   1066:         </div>
                   1067:       </div>
                   1068: 
                   1069:       <div class="sect1" lang="en" xml:lang="en">
                   1070:         <div class="titlepage">
                   1071:           <div>
                   1072:             <div>
                   1073:               <h2 class="title" style="clear: both"><a name=
                   1074:               "typography" id=
                   1075:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1076:             </div>
                   1077:           </div>
                   1078:         </div>
                   1079: 
                   1080:         <p>When giving examples for commands, shell prompts are
                   1081:         used to show if the command should/can be issued as root,
                   1082:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1083:         privileges are sufficient. We use a <code class=
                   1084:         "prompt">#</code> for root's shell prompt, and a
                   1085:         <code class="prompt">$</code> for users' shell prompt,
                   1086:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1087:       </div>
                   1088:     </div>
                   1089: 
                   1090:     <div class="part" lang="en" xml:lang="en">
                   1091:       <div class="titlepage">
                   1092:         <div>
                   1093:           <div>
                   1094:             <h1 class="title"><a name="users-guide" id=
1.2       hubertf  1095:             "users-guide"></a>The pkgsrc user's guide</h1>
1.1       grant    1096:           </div>
                   1097:         </div>
                   1098:       </div>
                   1099: 
                   1100:       <div class="toc">
                   1101:         <p><b>Table of Contents</b></p>
                   1102: 
                   1103:         <dl>
                   1104:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1105:           get pkgsrc</a></span></dt>
                   1106: 
                   1107:           <dd>
                   1108:             <dl>
1.14      xtraeme  1109:               <dt><span class="sect1"><a href="#id2514852">2.1. As
1.1       grant    1110:               tar file</a></span></dt>
                   1111: 
1.14      xtraeme  1112:               <dt><span class="sect1"><a href="#id2514868">2.2. Via
1.1       grant    1113:               SUP</a></span></dt>
                   1114: 
1.14      xtraeme  1115:               <dt><span class="sect1"><a href="#id2514968">2.3. Via
1.1       grant    1116:               CVS</a></span></dt>
                   1117:             </dl>
                   1118:           </dd>
                   1119: 
                   1120:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1121:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1122: 
                   1123:           <dd>
                   1124:             <dl>
1.14      xtraeme  1125:               <dt><span class="sect1"><a href="#id2515078">3.1.
1.1       grant    1126:               Bootstrapping pkgsrc</a></span></dt>
                   1127: 
1.14      xtraeme  1128:               <dt><span class="sect1"><a href="#id2515253">3.2.
1.1       grant    1129:               Platform specific notes</a></span></dt>
                   1130: 
                   1131:               <dd>
                   1132:                 <dl>
                   1133:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1134:                   "#id2515259">3.2.1. Darwin (Mac OS
1.1       grant    1135:                   X)</a></span></dt>
                   1136: 
                   1137:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1138:                   "#id2515558">3.2.2. FreeBSD</a></span></dt>
1.1       grant    1139: 
                   1140:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1141:                   "#id2515660">3.2.3. Interix</a></span></dt>
1.1       grant    1142: 
                   1143:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1144:                   "#id2515751">3.2.4. IRIX</a></span></dt>
1.1       grant    1145: 
                   1146:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1147:                   "#id2516278">3.2.5. OpenBSD</a></span></dt>
1.1       grant    1148: 
                   1149:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1150:                   "#id2516390">3.2.6. Solaris</a></span></dt>
1.1       grant    1151:                 </dl>
                   1152:               </dd>
                   1153:             </dl>
                   1154:           </dd>
                   1155: 
                   1156:           <dt><span class="chapter"><a href="#using">4. Using
                   1157:           pkgsrc</a></span></dt>
                   1158: 
                   1159:           <dd>
                   1160:             <dl>
                   1161:               <dt><span class="sect1"><a href=
                   1162:               "#getting-started">4.1. Working with binary
                   1163:               packages</a></span></dt>
                   1164: 
                   1165:               <dd>
                   1166:                 <dl>
                   1167:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1168:                   "#id2516526">4.1.1. Where to get binary
1.1       grant    1169:                   packages</a></span></dt>
                   1170: 
                   1171:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1172:                   "#id2516567">4.1.2. How to use binary
1.1       grant    1173:                   packages</a></span></dt>
                   1174: 
                   1175:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1176:                   "#id2516633">4.1.3. A word of
1.1       grant    1177:                   warning</a></span></dt>
                   1178:                 </dl>
                   1179:               </dd>
                   1180: 
1.14      xtraeme  1181:               <dt><span class="sect1"><a href="#id2516645">4.2.
1.1       grant    1182:               Building packages from source</a></span></dt>
                   1183: 
                   1184:               <dd>
                   1185:                 <dl>
                   1186:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1187:                   "#id2516723">4.2.1. Requirements</a></span></dt>
1.1       grant    1188: 
                   1189:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1190:                   "#id2516743">4.2.2. Fetching
1.1       grant    1191:                   distfiles</a></span></dt>
                   1192: 
                   1193:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1194:                   "#id2516864">4.2.3. How to build and
1.1       grant    1195:                   install</a></span></dt>
                   1196: 
                   1197:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1198:                   "#id2517180">4.2.4. Selecting the
1.1       grant    1199:                   compiler</a></span></dt>
                   1200:                 </dl>
                   1201:               </dd>
                   1202:             </dl>
                   1203:           </dd>
                   1204: 
                   1205:           <dt><span class="chapter"><a href="#binary">5. Creating
                   1206:           binary packages</a></span></dt>
                   1207: 
                   1208:           <dd>
                   1209:             <dl>
1.14      xtraeme  1210:               <dt><span class="sect1"><a href="#id2517335">5.1.
1.1       grant    1211:               Building a single binary package</a></span></dt>
                   1212: 
1.14      xtraeme  1213:               <dt><span class="sect1"><a href="#id2517822">5.2.
1.1       grant    1214:               Settings for creation of binary
                   1215:               packages</a></span></dt>
                   1216: 
                   1217:               <dt><span class="sect1"><a href="#bulkbuild">5.3.
                   1218:               Doing a bulk build of all packages</a></span></dt>
                   1219: 
                   1220:               <dd>
                   1221:                 <dl>
                   1222:                   <dt><span class="sect2"><a href=
                   1223:                   "#binary.configuration">5.3.1.
                   1224:                   Configuration</a></span></dt>
                   1225: 
                   1226:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1227:                   "#id2517962">5.3.2. Other environmental
1.1       grant    1228:                   considerations</a></span></dt>
                   1229: 
                   1230:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1231:                   "#id2518003">5.3.3. Operation</a></span></dt>
1.1       grant    1232: 
                   1233:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1234:                   "#id2583267">5.3.4. What it does</a></span></dt>
1.1       grant    1235: 
                   1236:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1237:                   "#id2583392">5.3.5. Disk space
1.1       grant    1238:                   requirements</a></span></dt>
                   1239: 
                   1240:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1241:                   "#id2583418">5.3.6. Setting up a sandbox for
1.1       grant    1242:                   chroot'ed builds</a></span></dt>
                   1243: 
                   1244:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1245:                   "#id2583811">5.3.7. Building a partial set of
1.1       grant    1246:                   packages</a></span></dt>
1.13      hubertf  1247: 
                   1248:                   <dt><span class="sect2"><a href=
                   1249:                   "#bulk-upload">5.3.8. Uploading results of a bulk
                   1250:                   build</a></span></dt>
1.1       grant    1251:                 </dl>
                   1252:               </dd>
                   1253: 
1.14      xtraeme  1254:               <dt><span class="sect1"><a href="#id2584227">5.4.
1.1       grant    1255:               Creating a multiple CD-ROM packages
                   1256:               collection</a></span></dt>
                   1257: 
                   1258:               <dd>
                   1259:                 <dl>
                   1260:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1261:                   "#id2584310">5.4.1. Example of
1.1       grant    1262:                   cdpack</a></span></dt>
                   1263:                 </dl>
                   1264:               </dd>
                   1265:             </dl>
                   1266:           </dd>
                   1267: 
                   1268:           <dt><span class="chapter"><a href="#faq">6. Frequently
                   1269:           Asked Questions</a></span></dt>
                   1270: 
                   1271:           <dd>
                   1272:             <dl>
1.14      xtraeme  1273:               <dt><span class="sect1"><a href="#id2584502">6.1. Is
1.1       grant    1274:               there a mailing list for pkg-related
                   1275:               discussion?</a></span></dt>
                   1276: 
1.14      xtraeme  1277:               <dt><span class="sect1"><a href="#id2584600">6.2.
1.1       grant    1278:               Where's the pkgviews documentation?</a></span></dt>
                   1279: 
1.5       hubertf  1280:               <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    1281:               Utilities for package management
                   1282:               (pkgtools)</a></span></dt>
                   1283: 
1.14      xtraeme  1284:               <dt><span class="sect1"><a href="#id2584853">6.4. How
1.1       grant    1285:               to use pkgsrc as non-root</a></span></dt>
                   1286: 
1.14      xtraeme  1287:               <dt><span class="sect1"><a href="#id2584865">6.5. How
1.15    ! xtraeme  1288:               to resume transfers when fetching
        !          1289:               distfiles?</a></span></dt>
1.14      xtraeme  1290: 
1.15    ! xtraeme  1291:               <dt><span class="sect1"><a href="#id2584907">6.6. How
1.1       grant    1292:               can I install/use XFree86 from
                   1293:               pkgsrc?</a></span></dt>
                   1294: 
1.15    ! xtraeme  1295:               <dt><span class="sect1"><a href="#id2584935">6.7. How
1.1       grant    1296:               can I install/use X.org from pkgsrc?</a></span></dt>
                   1297: 
1.15    ! xtraeme  1298:               <dt><span class="sect1"><a href="#id2584963">6.8. How
1.1       grant    1299:               to fetch files from behind a firewall</a></span></dt>
                   1300: 
1.15    ! xtraeme  1301:               <dt><span class="sect1"><a href="#id2584977">6.9. How
1.14      xtraeme  1302:               do I tell <span><strong class="command">make
                   1303:               fetch</strong></span> to do passive
1.1       grant    1304:               FTP?</a></span></dt>
                   1305: 
1.15    ! xtraeme  1306:               <dt><span class="sect1"><a href="#id2585028">6.10.
1.14      xtraeme  1307:               How to fetch all distfiles at once</a></span></dt>
1.1       grant    1308: 
1.15    ! xtraeme  1309:               <dt><span class="sect1"><a href="#id2585168">6.11.
1.14      xtraeme  1310:               What does &#8220;<span class="quote">Don't know how
                   1311:               to make /usr/share/tmac/tmac.andoc</span>&#8221;
                   1312:               mean?</a></span></dt>
1.13      hubertf  1313: 
1.15    ! xtraeme  1314:               <dt><span class="sect1"><a href="#id2585206">6.12.
1.14      xtraeme  1315:               What does &#8220;<span class="quote">Could not find
                   1316:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1317: 
1.15    ! xtraeme  1318:               <dt><span class="sect1"><a href="#id2585264">6.13.
1.1       grant    1319:               Using 'sudo' with pkgsrc</a></span></dt>
                   1320: 
1.14      xtraeme  1321:               <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    1322:               Configuration files handling and
                   1323:               placement</a></span></dt>
                   1324: 
                   1325:               <dt><span class="sect1"><a href=
1.14      xtraeme  1326:               "#audit-packages">6.15. Automated security
1.1       grant    1327:               checks</a></span></dt>
                   1328:             </dl>
                   1329:           </dd>
                   1330:         </dl>
                   1331:       </div>
                   1332: 
                   1333:       <div class="chapter" lang="en" xml:lang="en">
                   1334:         <div class="titlepage">
                   1335:           <div>
                   1336:             <div>
                   1337:               <h2 class="title"><a name="getting" id=
                   1338:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1339:               pkgsrc</h2>
                   1340:             </div>
                   1341:           </div>
                   1342:         </div>
                   1343: 
                   1344:         <div class="toc">
                   1345:           <p><b>Table of Contents</b></p>
                   1346: 
                   1347:           <dl>
1.14      xtraeme  1348:             <dt><span class="sect1"><a href="#id2514852">2.1. As
1.1       grant    1349:             tar file</a></span></dt>
                   1350: 
1.14      xtraeme  1351:             <dt><span class="sect1"><a href="#id2514868">2.2. Via
1.1       grant    1352:             SUP</a></span></dt>
                   1353: 
1.14      xtraeme  1354:             <dt><span class="sect1"><a href="#id2514968">2.3. Via
1.1       grant    1355:             CVS</a></span></dt>
                   1356:           </dl>
                   1357:         </div>
                   1358: 
                   1359:         <p>There are three ways to get pkgsrc. Either as a tar
                   1360:         file, via SUP, or via CVS. All three ways are described
                   1361:         here.</p>
                   1362: 
                   1363:         <div class="sect1" lang="en" xml:lang="en">
                   1364:           <div class="titlepage">
                   1365:             <div>
                   1366:               <div>
                   1367:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  1368:                 "id2514852" id="id2514852"></a>2.1.&nbsp;As tar
1.1       grant    1369:                 file</h2>
                   1370:               </div>
                   1371:             </div>
                   1372:           </div>
                   1373: 
                   1374:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1375:           file from <a href=
1.11      ben      1376:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.14      xtraeme  1377:           target="_top">ftp.NetBSD.org</a> and unpack it into
                   1378:           <code class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1379:         </div>
                   1380: 
                   1381:         <div class="sect1" lang="en" xml:lang="en">
                   1382:           <div class="titlepage">
                   1383:             <div>
                   1384:               <div>
                   1385:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  1386:                 "id2514868" id="id2514868"></a>2.2.&nbsp;Via
1.1       grant    1387:                 SUP</h2>
                   1388:               </div>
                   1389:             </div>
                   1390:           </div>
                   1391: 
                   1392:           <p>As an alternative to the tar file, you can get pkgsrc
                   1393:           via the Software Update Protocol, SUP. To do so, make
                   1394:           sure your supfile has a line</p>
                   1395:           <pre class="programlisting">
                   1396: release=pkgsrc
                   1397: </pre>
                   1398: 
1.14      xtraeme  1399:           <p>in it, see the examples in <code class=
                   1400:           "filename">/usr/share/examples/supfiles</code>, and that
                   1401:           the <code class="filename">/usr/pkgsrc</code> directory
                   1402:           exists. Then, simply run <span><strong class=
                   1403:           "command">sup -v <em class=
                   1404:           "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1405:         </div>
                   1406: 
                   1407:         <div class="sect1" lang="en" xml:lang="en">
                   1408:           <div class="titlepage">
                   1409:             <div>
                   1410:               <div>
                   1411:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  1412:                 "id2514968" id="id2514968"></a>2.3.&nbsp;Via
1.1       grant    1413:                 CVS</h2>
                   1414:               </div>
                   1415:             </div>
                   1416:           </div>
                   1417: 
                   1418:           <p>To get pkgsrc via CVS, make sure you have
                   1419:           &#8220;<span class="quote">cvs</span>&#8221; installed.
                   1420:           If not present on your system, it can be found as
                   1421:           precompiled binary on ftp.NetBSD.org. To do an initial
                   1422:           (full) checkout of pkgsrc, do the following steps:</p>
                   1423:           <pre class="screen">
1.14      xtraeme  1424: <code class="prompt">%</code> <strong class=
                   1425: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1426: <code class="prompt">%</code> <strong class=
                   1427: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1428: <code class="prompt">%</code> <strong class=
                   1429: "userinput"><code>cd /usr</code></strong>
                   1430: <code class="prompt">%</code> <strong class=
                   1431: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1432: </pre>
                   1433: 
                   1434:           <p>This will create the <code class=
                   1435:           "filename">pkgsrc</code> directory in your <code class=
                   1436:           "filename">/usr</code>, and all the package source will
                   1437:           be stored under <code class=
                   1438:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1439:           initial checkout, make sure you have <code class=
                   1440:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1441:           <pre class="screen">
1.14      xtraeme  1442: <code class="prompt">%</code> <strong class=
                   1443: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1444: <code class="prompt">%</code> <strong class=
                   1445: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1446: </pre>
                   1447: 
                   1448:           <p>Please also note that it is possible to have multiple
                   1449:           copies of the pkgsrc hierarchy in use at any one time -
                   1450:           all work is done relatively within the pkgsrc tree.</p>
                   1451:         </div>
                   1452:       </div>
                   1453: 
                   1454:       <div class="chapter" lang="en" xml:lang="en">
                   1455:         <div class="titlepage">
                   1456:           <div>
                   1457:             <div>
                   1458:               <h2 class="title"><a name="platforms" id=
                   1459:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1460:               systems other than NetBSD</h2>
                   1461:             </div>
                   1462:           </div>
                   1463:         </div>
                   1464: 
                   1465:         <div class="toc">
                   1466:           <p><b>Table of Contents</b></p>
                   1467: 
                   1468:           <dl>
1.14      xtraeme  1469:             <dt><span class="sect1"><a href="#id2515078">3.1.
1.1       grant    1470:             Bootstrapping pkgsrc</a></span></dt>
                   1471: 
1.14      xtraeme  1472:             <dt><span class="sect1"><a href="#id2515253">3.2.
1.1       grant    1473:             Platform specific notes</a></span></dt>
                   1474: 
                   1475:             <dd>
                   1476:               <dl>
1.14      xtraeme  1477:                 <dt><span class="sect2"><a href="#id2515259">3.2.1.
1.1       grant    1478:                 Darwin (Mac OS X)</a></span></dt>
                   1479: 
1.14      xtraeme  1480:                 <dt><span class="sect2"><a href="#id2515558">3.2.2.
1.1       grant    1481:                 FreeBSD</a></span></dt>
                   1482: 
1.14      xtraeme  1483:                 <dt><span class="sect2"><a href="#id2515660">3.2.3.
1.1       grant    1484:                 Interix</a></span></dt>
                   1485: 
1.14      xtraeme  1486:                 <dt><span class="sect2"><a href="#id2515751">3.2.4.
1.1       grant    1487:                 IRIX</a></span></dt>
                   1488: 
1.14      xtraeme  1489:                 <dt><span class="sect2"><a href="#id2516278">3.2.5.
1.1       grant    1490:                 OpenBSD</a></span></dt>
                   1491: 
1.14      xtraeme  1492:                 <dt><span class="sect2"><a href="#id2516390">3.2.6.
1.1       grant    1493:                 Solaris</a></span></dt>
                   1494:               </dl>
                   1495:             </dd>
                   1496:           </dl>
                   1497:         </div>
                   1498: 
                   1499:         <div class="sect1" lang="en" xml:lang="en">
                   1500:           <div class="titlepage">
                   1501:             <div>
                   1502:               <div>
                   1503:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  1504:                 "id2515078" id=
                   1505:                 "id2515078"></a>3.1.&nbsp;Bootstrapping pkgsrc</h2>
1.1       grant    1506:               </div>
                   1507:             </div>
                   1508:           </div>
                   1509: 
                   1510:           <p>For Operating Systems other than NetBSD, we provide a
                   1511:           bootstrap kit to build the required tools to use pkgsrc
                   1512:           on your platform. Besides support for native NetBSD,
                   1513:           pkgsrc and the bootstrap kit have support for the
                   1514:           following operating systems:</p>
                   1515: 
                   1516:           <div class="itemizedlist">
                   1517:             <ul type="disc">
                   1518:               <li>
                   1519:                 <p>Darwin (Mac OS X)</p>
                   1520:               </li>
                   1521: 
                   1522:               <li>
                   1523:                 <p>FreeBSD</p>
                   1524:               </li>
                   1525: 
                   1526:               <li>
                   1527:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1528:               </li>
                   1529: 
                   1530:               <li>
                   1531:                 <p>IRIX</p>
                   1532:               </li>
                   1533: 
                   1534:               <li>
                   1535:                 <p>Linux</p>
                   1536:               </li>
                   1537: 
                   1538:               <li>
                   1539:                 <p>OpenBSD</p>
                   1540:               </li>
                   1541: 
                   1542:               <li>
                   1543:                 <p>Solaris</p>
                   1544:               </li>
                   1545:             </ul>
                   1546:           </div>
                   1547: 
                   1548:           <p>Support for other platforms is under development.</p>
                   1549: 
                   1550:           <p>Installing the bootstrap kit should be as simple
                   1551:           as:</p>
                   1552:           <pre class="screen">
1.14      xtraeme  1553: <code class="prompt">#</code> <strong class=
                   1554: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1555: <code class="prompt">#</code> <strong class=
                   1556: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1557: <code class="prompt">#</code> <strong class=
                   1558: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1559: </pre>
                   1560: 
                   1561:           <p>See <a href="#getting" title=
                   1562:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter 2,
                   1563:           <i>Where to get pkgsrc</i></a> for other ways to get
1.14      xtraeme  1564:           pkgsrc before bootstrapping. The given
                   1565:           <span><strong class="command">bootstrap</strong></span>
                   1566:           command will use the defaults of <code class=
                   1567:           "filename">/usr/pkg</code> for the <span class=
                   1568:           "emphasis"><em>prefix</em></span> where programs will be
                   1569:           installed in, and <code class=
                   1570:           "filename">/var/db/pkg</code> for the package database
1.1       grant    1571:           directory where pkgsrc will do it's internal bookkeeping.
                   1572:           However, these can also be set using command-line
                   1573:           parameters.</p>
                   1574: 
                   1575:           <p>Binary packages for the pkgsrc tools and an initial
                   1576:           set of packages is available for supported platforms. An
                   1577:           up-to-date list of these can be found on <a href=
                   1578:           "http://www.pkgsrc.org/" target=
                   1579:           "_top">www.pkgsrc.org</a>.</p>
                   1580:         </div>
                   1581: 
                   1582:         <div class="sect1" lang="en" xml:lang="en">
                   1583:           <div class="titlepage">
                   1584:             <div>
                   1585:               <div>
                   1586:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  1587:                 "id2515253" id="id2515253"></a>3.2.&nbsp;Platform
1.1       grant    1588:                 specific notes</h2>
                   1589:               </div>
                   1590:             </div>
                   1591:           </div>
                   1592: 
                   1593:           <p>Here are some platform-specific notes you should be
                   1594:           aware of.</p>
                   1595: 
                   1596:           <div class="sect2" lang="en" xml:lang="en">
                   1597:             <div class="titlepage">
                   1598:               <div>
                   1599:                 <div>
1.14      xtraeme  1600:                   <h3 class="title"><a name="id2515259" id=
                   1601:                   "id2515259"></a>3.2.1.&nbsp;Darwin (Mac OS
1.1       grant    1602:                   X)</h3>
                   1603:                 </div>
                   1604:               </div>
                   1605:             </div>
                   1606: 
                   1607:             <p>Darwin 5.x and 6.x are supported. There are two
                   1608:             methods of using pkgsrc on Mac OS X, by using a
                   1609:             <a href="#platform.osx-image" title=
                   1610:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1611:             <a href="#platform.osx-ufs" title=
                   1612:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1613:             partition</a>.</p>
                   1614: 
                   1615:             <p>Before you start, you will need to download and
                   1616:             install the Mac OS X Developer Tools from Apple's
                   1617:             Developer Connection. See <a href=
                   1618:             "http://developer.apple.com/macosx/" target=
                   1619:             "_top">http://developer.apple.com/macosx/</a> for
                   1620:             details. Also, make sure you install X11 for Mac OS X
                   1621:             and the X11 SDK from <a href=
                   1622:             "http://www.apple.com/macosx/x11/download/" target=
                   1623:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1624:             you intend to build packages that use the X11 Window
                   1625:             System.</p>
                   1626: 
                   1627:             <p>If you already have a UFS partition, or have a spare
                   1628:             partition that you can format as UFS, it is recommended
                   1629:             to use that instead of the disk image. It'll be
                   1630:             somewhat faster and will mount automatically at boot
                   1631:             time, where you must manually mount a disk image.</p>
                   1632: 
                   1633:             <div class="note" style=
                   1634:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1635:               <h3 class="title">Note</h3>
                   1636: 
                   1637:               <p>You cannot use a HFS+ file system for pkgsrc,
                   1638:               because pkgsrc currently requires the filesystem to
                   1639:               be case-sensitive, and HFS+ is not.</p>
                   1640:             </div>
                   1641: 
                   1642:             <div class="sect3" lang="en" xml:lang="en">
                   1643:               <div class="titlepage">
                   1644:                 <div>
                   1645:                   <div>
                   1646:                     <h4 class="title"><a name="platform.osx-image"
                   1647:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
                   1648:                     a disk image</h4>
                   1649:                   </div>
                   1650:                 </div>
                   1651:               </div>
                   1652: 
                   1653:               <p>Create the disk image:</p>
                   1654:               <pre class="screen">
1.14      xtraeme  1655: <code class="prompt">#</code> <strong class=
                   1656: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1657: <code class="prompt">#</code> <strong class=
                   1658: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   1659: <code class="prompt">#</code> <strong class=
                   1660: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   1661: <code class="prompt">#</code> <strong class=
                   1662: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    1663: </pre>
                   1664: 
                   1665:               <p>That's it!</p>
                   1666:             </div>
                   1667: 
                   1668:             <div class="sect3" lang="en" xml:lang="en">
                   1669:               <div class="titlepage">
                   1670:                 <div>
                   1671:                   <div>
                   1672:                     <h4 class="title"><a name="platform.osx-ufs"
                   1673:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
                   1674:                     UFS partition</h4>
                   1675:                   </div>
                   1676:                 </div>
                   1677:               </div>
                   1678: 
1.14      xtraeme  1679:               <p>By default, <code class="filename">/usr</code>
                   1680:               will be on your root file system, normally HFS+. It
                   1681:               is possible to use the default <span class=
                   1682:               "emphasis"><em>prefix</em></span> of <code class=
                   1683:               "filename">/usr/pkg</code> by symlinking <code class=
                   1684:               "filename">/usr/pkg</code> to a directory on a UFS
                   1685:               file system. Obviously, another symlink is required
                   1686:               if you want to place the package database directory
                   1687:               outside the <span class=
                   1688:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    1689:               <pre class="screen">
1.14      xtraeme  1690: <code class="prompt">#</code> <strong class=
                   1691: "userinput"><code>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</code></strong>
1.1       grant    1692: </pre>
                   1693: 
                   1694:               <p>If you created your partitions at the time of
                   1695:               installing Mac OS X and formatted the target
                   1696:               partition as UFS, it should automatically mount on
1.14      xtraeme  1697:               <code class="filename">/Volumes/&lt;volume
                   1698:               name&gt;</code> when the machine boots. If you are
1.1       grant    1699:               (re)formatting a partition as UFS, you need to ensure
                   1700:               that the partition map correctly reflects
                   1701:               &#8220;<span class="quote">Apple_UFS</span>&#8221;
                   1702:               and not &#8220;<span class=
                   1703:               "quote">Apple_HFS</span>&#8221;.</p>
                   1704: 
                   1705:               <p>The problem is that none of the disk tools will
                   1706:               let you touch a disk that is booted from. You can
                   1707:               unmount the partition, but even if you newfs it, the
                   1708:               partition type will be incorrect and the automounter
                   1709:               won't mount it. It can be mounted manually, but it
                   1710:               won't appear in Finder.</p>
                   1711: 
                   1712:               <p>You'll need to boot off of the OS X Installation
                   1713:               (User) CD. When the Installation program starts, go
                   1714:               up to the menu and select Disk Utility. Now, you will
                   1715:               be able to select the partition you want to be UFS,
                   1716:               and Format it Apple UFS. Quit the Disk Utility, quit
                   1717:               the installer which will reboot your machine. The new
                   1718:               UFS file system will appear in Finder.</p>
                   1719: 
                   1720:               <p>Be aware that the permissions on the new file
                   1721:               system will be writable by root only.</p>
                   1722: 
                   1723:               <p>This note is as of 10.2 (Jaguar) and applies to
                   1724:               earlier versions. Hopefully Apple will fix Disk
                   1725:               Utility in 10.3 (Panther).</p>
                   1726:             </div>
                   1727:           </div>
                   1728: 
                   1729:           <div class="sect2" lang="en" xml:lang="en">
                   1730:             <div class="titlepage">
                   1731:               <div>
                   1732:                 <div>
1.14      xtraeme  1733:                   <h3 class="title"><a name="id2515558" id=
                   1734:                   "id2515558"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    1735:                 </div>
                   1736:               </div>
                   1737:             </div>
                   1738: 
                   1739:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   1740:             supported, other versions may work.</p>
                   1741: 
                   1742:             <p>Care should be taken so that the tools that this kit
                   1743:             installs do not conflict with the FreeBSD userland
                   1744:             tools. There are several steps:</p>
                   1745: 
                   1746:             <div class="orderedlist">
                   1747:               <ol type="1">
                   1748:                 <li>
                   1749:                   <p>FreeBSD stores its ports pkg database in
1.14      xtraeme  1750:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    1751:                   therefore recommended that you choose a different
1.14      xtraeme  1752:                   location (e.g. <code class=
                   1753:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    1754:                   --pkgdbdir option to the bootstrap script.</p>
                   1755:                 </li>
                   1756: 
                   1757:                 <li>
                   1758:                   <p>If you do not intend to use the FreeBSD ports
                   1759:                   tools, it's probably a good idea to move them out
                   1760:                   of the way to avoid confusion, e.g.</p>
                   1761:                   <pre class="screen">
1.14      xtraeme  1762: <code class="prompt">#</code> <strong class=
                   1763: "userinput"><code>cd /usr/sbin</code></strong>
                   1764: <code class="prompt">#</code> <strong class=
                   1765: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   1766: <code class="prompt">#</code> <strong class=
                   1767: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   1768: <code class="prompt">#</code> <strong class=
                   1769: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   1770: <code class="prompt">#</code> <strong class=
                   1771: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    1772: </pre>
                   1773:                 </li>
                   1774: 
                   1775:                 <li>
1.14      xtraeme  1776:                   <p>An example <code class=
                   1777:                   "filename">/etc/mk.conf</code> file will be
                   1778:                   placed in <code class=
                   1779:                   "filename">/etc/mk.conf.example</code> file when
                   1780:                   you use the bootstrap script.</p>
1.1       grant    1781:                 </li>
                   1782:               </ol>
                   1783:             </div>
                   1784:           </div>
                   1785: 
                   1786:           <div class="sect2" lang="en" xml:lang="en">
                   1787:             <div class="titlepage">
                   1788:               <div>
                   1789:                 <div>
1.14      xtraeme  1790:                   <h3 class="title"><a name="id2515660" id=
                   1791:                   "id2515660"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    1792:                 </div>
                   1793:               </div>
                   1794:             </div>
                   1795: 
                   1796:             <p>Interix is a POSIX compatible subsystem for the
                   1797:             Windows NT kernel, providing a Unix-like environment
                   1798:             with a tighter kernel integration than available with
                   1799:             Cygwin. It is part of the Windows Services for Unix
                   1800:             package, available for free for any licensed copy of
                   1801:             Windows 2000, XP, or 2003. SFU can be downloaded from
                   1802:             <a href="http://www.microsoft.com/windows/sfu/" target=
                   1803:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   1804: 
                   1805:             <p>Services for Unix 3.5, current as of this writing,
                   1806:             has been tested. 3.0 or 3.1 may work, but are not
                   1807:             officially supported. (The main difference in 3.0/3.1
                   1808:             is lack of pthreads.)</p>
                   1809: 
                   1810:             <div class="sect3" lang="en" xml:lang="en">
                   1811:               <div class="titlepage">
                   1812:                 <div>
                   1813:                   <div>
                   1814:                     <h4 class="title"><a name=
                   1815:                     "platform.interix-sfu-install" id=
                   1816:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  1817:                     installing Interix/SFU</h4>
1.1       grant    1818:                   </div>
                   1819:                 </div>
                   1820:               </div>
                   1821: 
                   1822:               <p>At an absolute minimum, the following packages
                   1823:               must be installed from the Windows Services for Unix
                   1824:               3.5 distribution in order to use pkgsrc:</p>
                   1825: 
                   1826:               <div class="itemizedlist">
                   1827:                 <ul type="disc">
                   1828:                   <li>
                   1829:                     <p>Utilities -&gt; Base Utilities</p>
                   1830:                   </li>
                   1831: 
                   1832:                   <li>
                   1833:                     <p>Interix GNU Components -&gt; (all)</p>
                   1834:                   </li>
                   1835: 
                   1836:                   <li>
                   1837:                     <p>Remote Connectivity</p>
                   1838:                   </li>
                   1839: 
                   1840:                   <li>
                   1841:                     <p>Interix SDK</p>
                   1842:                   </li>
                   1843:                 </ul>
                   1844:               </div>
                   1845: 
                   1846:               <p>When using pkgsrc on Interix, DO NOT install the
                   1847:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   1848:               without shared module support, installed to
                   1849:               /usr/local, and will only cause confusion. Instead,
                   1850:               install Perl 5.8 from pkgsrc (or from a binary
                   1851:               package).</p>
                   1852: 
                   1853:               <p>The Remote Connectivity subcomponent "Windows
                   1854:               Remote Shell Service" does not need to be installed,
                   1855:               but Remote Connectivity itself should be installed in
                   1856:               order to have a working inetd.</p>
                   1857: 
                   1858:               <p>Finally, during installation you may be asked
                   1859:               whether to enable setuid behavior for Interix
                   1860:               programs, and whether to make pathnames default to
                   1861:               case-sensitive. Setuid should be enabled, and
                   1862:               case-sensitivity MUST be enabled. (Without
                   1863:               case-sensitivity, a large number of packages
                   1864:               including perl will not build.)</p>
                   1865:             </div>
                   1866: 
                   1867:             <div class="sect3" lang="en" xml:lang="en">
                   1868:               <div class="titlepage">
                   1869:                 <div>
                   1870:                   <div>
                   1871:                     <h4 class="title"><a name=
                   1872:                     "platform.interix-sfu-postinstall" id=
                   1873:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   1874:                     to do if Interix/SFU is already installed</h4>
                   1875:                   </div>
                   1876:                 </div>
                   1877:               </div>
                   1878: 
                   1879:               <p>If SFU is already installed and you wish to alter
                   1880:               these settings to work with pkgsrc, note the
                   1881:               following things.</p>
                   1882: 
                   1883:               <div class="itemizedlist">
                   1884:                 <ul type="disc">
                   1885:                   <li>
                   1886:                     <p>To uninstall UNIX Perl, use Add/Remove
                   1887:                     Programs, select Microsoft Windows Services for
                   1888:                     UNIX, then click Change. In the installer,
                   1889:                     choose Add or Remove, then uncheck
                   1890:                     Utilities-&gt;UNIX Perl.</p>
                   1891:                   </li>
                   1892: 
                   1893:                   <li>
                   1894:                     <p>To enable case-sensitivity for the
                   1895:                     filesystem, run REGEDIT.EXE, and change the
                   1896:                     following registry key:</p>
                   1897: 
                   1898:                     <p>
                   1899:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   1900:                     Manager\kernel</p>
                   1901: 
                   1902:                     <p>Set the DWORD value "obcaseinsensitive" to
                   1903:                     0; then reboot.</p>
                   1904:                   </li>
                   1905: 
                   1906:                   <li>
                   1907:                     <p>To enable setuid binaries (optional), run
                   1908:                     REGEDIT.EXE, and change the following registry
                   1909:                     key:</p>
                   1910: 
                   1911:                     <p>
                   1912:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   1913:                     for UNIX</p>
                   1914: 
                   1915:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   1916:                     to 1; then reboot.</p>
                   1917:                   </li>
                   1918:                 </ul>
                   1919:               </div>
                   1920:             </div>
                   1921: 
                   1922:             <div class="sect3" lang="en" xml:lang="en">
                   1923:               <div class="titlepage">
                   1924:                 <div>
                   1925:                   <div>
                   1926:                     <h4 class="title"><a name=
                   1927:                     "platform.interix-notes" id=
                   1928:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   1929:                     notes for using pkgsrc</h4>
                   1930:                   </div>
                   1931:                 </div>
                   1932:               </div>
                   1933: 
                   1934:               <p>The package imanager (either the pkgsrc "su" user,
                   1935:               or the user running "pkg_add") must be a member of
                   1936:               the local Administrators group. Such a user must also
                   1937:               be used to run the bootstrap. This is slightly
                   1938:               relaxed from the normal pkgsrc requirement of
                   1939:               "root".</p>
                   1940: 
                   1941:               <p>The package manager should use a umask of 002.
                   1942:               "make install" will automatically complain if this is
                   1943:               not the case. This ensures that directories written
                   1944:               in /var/db/pkg are Administrators-group
                   1945:               writeable.</p>
                   1946: 
                   1947:               <p>The popular Interix binary packages from
                   1948:               http://www.interopsystems.com/ use an older version
                   1949:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   1950:               used in conjunction with pkgsrc. If you choose to use
                   1951:               them at the same time as the pkgsrc packages, ensure
                   1952:               that you use the proper pkg_* tools for each type of
                   1953:               binary package.</p>
                   1954:             </div>
                   1955:           </div>
                   1956: 
                   1957:           <div class="sect2" lang="en" xml:lang="en">
                   1958:             <div class="titlepage">
                   1959:               <div>
                   1960:                 <div>
1.14      xtraeme  1961:                   <h3 class="title"><a name="id2515751" id=
                   1962:                   "id2515751"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    1963:                 </div>
                   1964:               </div>
                   1965:             </div>
                   1966: 
                   1967:             <p>You will need a working C compiler, either gcc or
                   1968:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  1969:             the <code class="varname">CC</code> environment
                   1970:             variable according to your preference. If you do not
                   1971:             have a license for the MIPSpro compiler suite, you can
1.1       grant    1972:             download a gcc tardist file from <a href=
                   1973:             "http://freeware.sgi.com/" target=
                   1974:             "_top">http://freeware.sgi.com/</a>.</p>
                   1975: 
                   1976:             <p>Please note that you will need IRIX 6.5.17 or
                   1977:             higher, as this is the earliest version of IRIX
                   1978:             providing support for if_indextoname(3),
                   1979:             if_nametoindex(3), etc.</p>
                   1980: 
                   1981:             <p>At this point in time, pkgsrc only supports one ABI.
                   1982:             That is, you can not switch between the old 32-bit ABI,
                   1983:             the new 32-bit ABI and the 64-bit ABI. If you start out
                   1984:             using "abi=n32", that's what all your packages will be
                   1985:             built with.</p>
                   1986: 
                   1987:             <p>Therefore, please make sure that you have no
1.14      xtraeme  1988:             conflicting <code class="varname">CFLAGS</code> in your
                   1989:             environment or the <code class=
                   1990:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    1991:             that you do not try to link n32 object files with lib64
1.14      xtraeme  1992:             or vice versa. Check your <code class=
                   1993:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    1994: 
                   1995:             <p>If you have the actual pkgsrc tree mounted via NFS
                   1996:             from a different host, please make sure to set
1.14      xtraeme  1997:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    1998:             directory, as it appears that IRIX linker occasionally
                   1999:             runs into issues when trying to link over a network
                   2000:             mounted filesystem.</p>
                   2001: 
                   2002:             <p>The bootstrapping process should set all the right
                   2003:             options for programs such as imake(1), but you may want
                   2004:             to set some options depending on your local setup.
1.14      xtraeme  2005:             Please see <code class=
                   2006:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.1       grant    2007:             course, your compilers man pages for details.</p>
                   2008:           </div>
                   2009: 
                   2010:           <div class="sect2" lang="en" xml:lang="en">
                   2011:             <div class="titlepage">
                   2012:               <div>
                   2013:                 <div>
1.14      xtraeme  2014:                   <h3 class="title"><a name="id2516278" id=
                   2015:                   "id2516278"></a>3.2.5.&nbsp;OpenBSD</h3>
1.1       grant    2016:                 </div>
                   2017:               </div>
                   2018:             </div>
                   2019: 
                   2020:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2021: 
                   2022:             <p>Care should be taken so that the tools that this kit
                   2023:             installs do not conflict with the OpenBSD userland
                   2024:             tools. There are several steps:</p>
                   2025: 
                   2026:             <div class="orderedlist">
                   2027:               <ol type="1">
                   2028:                 <li>
                   2029:                   <p>OpenBSD stores its ports pkg database in
1.14      xtraeme  2030:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    2031:                   therefore recommended that you choose a different
1.14      xtraeme  2032:                   location (e.g. <code class=
                   2033:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2034:                   --pkgdbdir option to the bootstrap script.</p>
                   2035:                 </li>
                   2036: 
                   2037:                 <li>
                   2038:                   <p>If you do not intend to use the OpenBSD ports
                   2039:                   tools, it's probably a good idea to move them out
                   2040:                   of the way to avoid confusion, e.g.</p>
                   2041:                   <pre class="screen">
1.14      xtraeme  2042: <code class="prompt">#</code> <strong class=
                   2043: "userinput"><code>cd /usr/sbin</code></strong>
                   2044: <code class="prompt">#</code> <strong class=
                   2045: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2046: <code class="prompt">#</code> <strong class=
                   2047: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2048: <code class="prompt">#</code> <strong class=
                   2049: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2050: <code class="prompt">#</code> <strong class=
                   2051: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2052: </pre>
                   2053:                 </li>
                   2054: 
                   2055:                 <li>
1.14      xtraeme  2056:                   <p>An example <code class=
                   2057:                   "filename">/etc/mk.conf</code> file will be
                   2058:                   placed in <code class=
                   2059:                   "filename">/etc/mk.conf.example</code> file when
                   2060:                   you use the bootstrap script. OpenBSD's make
                   2061:                   program uses <code class=
                   2062:                   "filename">/etc/mk.conf</code> as well. You can
1.1       grant    2063:                   work around this by enclosing all the pkgsrc
                   2064:                   specific parts of the file with:</p>
                   2065:                   <pre class="programlisting">
                   2066: .ifdef BSD_PKG_MK
1.11      ben      2067: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1       grant    2068: .else
                   2069: # OpenBSD stuff
                   2070: .endif
                   2071: </pre>
                   2072:                 </li>
                   2073:               </ol>
                   2074:             </div>
                   2075:           </div>
                   2076: 
                   2077:           <div class="sect2" lang="en" xml:lang="en">
                   2078:             <div class="titlepage">
                   2079:               <div>
                   2080:                 <div>
1.14      xtraeme  2081:                   <h3 class="title"><a name="id2516390" id=
                   2082:                   "id2516390"></a>3.2.6.&nbsp;Solaris</h3>
1.1       grant    2083:                 </div>
                   2084:               </div>
                   2085:             </div>
                   2086: 
                   2087:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2088:             sparc. You will need a working C compiler. Both gcc
                   2089:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2090: 
                   2091:             <p>The following packages are required on Solaris 8 for
                   2092:             the bootstrap process and to build packages.</p>
                   2093: 
                   2094:             <div class="itemizedlist">
                   2095:               <ul type="disc">
                   2096:                 <li>
                   2097:                   <p>SUNWsprot</p>
                   2098:                 </li>
                   2099: 
                   2100:                 <li>
                   2101:                   <p>SUNWarc</p>
                   2102:                 </li>
                   2103: 
                   2104:                 <li>
                   2105:                   <p>SUNWbtool</p>
                   2106:                 </li>
                   2107: 
                   2108:                 <li>
                   2109:                   <p>SUNWtoo</p>
                   2110:                 </li>
                   2111: 
                   2112:                 <li>
                   2113:                   <p>SUNWlibm</p>
                   2114:                 </li>
                   2115:               </ul>
                   2116:             </div>
                   2117: 
                   2118:             <p>Please note the use of GNU binutils on Solaris is
                   2119:             <span class="emphasis"><em>not</em></span>
                   2120:             supported.</p>
                   2121: 
                   2122:             <div class="sect3" lang="en" xml:lang="en">
                   2123:               <div class="titlepage">
                   2124:                 <div>
                   2125:                   <div>
1.14      xtraeme  2126:                     <h4 class="title"><a name="id2516421" id=
                   2127:                     "id2516421"></a>3.2.6.1.&nbsp;If you are using
1.1       grant    2128:                     gcc</h4>
                   2129:                   </div>
                   2130:                 </div>
                   2131:               </div>
                   2132: 
                   2133:               <p>It makes life much simpler if you only use the
                   2134:               same gcc consistently for building all packages.</p>
                   2135: 
                   2136:               <p>It is recommended that an external gcc be used
                   2137:               only for bootstrapping, then either build gcc from
                   2138:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2139:               href=
                   2140:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.14      xtraeme  2141:               class="pkgname">lang/gcc</a> or install a binary gcc
                   2142:               package, then remove gcc used during
                   2143:               bootstrapping.</p>
1.1       grant    2144: 
                   2145:               <p>Binary packages of gcc can be found through
                   2146:               <a href=
                   2147:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.14      xtraeme  2148:               target=
                   2149:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2150:             </div>
                   2151: 
                   2152:             <div class="sect3" lang="en" xml:lang="en">
                   2153:               <div class="titlepage">
                   2154:                 <div>
                   2155:                   <div>
1.14      xtraeme  2156:                     <h4 class="title"><a name="id2516442" id=
                   2157:                     "id2516442"></a>3.2.6.2.&nbsp;If you are using
1.1       grant    2158:                     Sun WorkShop</h4>
                   2159:                   </div>
                   2160:                 </div>
                   2161:               </div>
                   2162: 
                   2163:               <p>You will need at least the following packages
                   2164:               installed (from WorkShop 5.0)</p>
                   2165: 
                   2166:               <div class="itemizedlist">
                   2167:                 <ul type="disc">
                   2168:                   <li>
                   2169:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2170:                   </li>
                   2171: 
                   2172:                   <li>
                   2173:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2174:                   </li>
                   2175: 
                   2176:                   <li>
                   2177:                     <p>SPROild - Sun WorkShop Incremental
                   2178:                     Linker</p>
                   2179:                   </li>
                   2180: 
                   2181:                   <li>
                   2182:                     <p>SPROlang - Sun WorkShop Compilers common
                   2183:                     components</p>
                   2184:                   </li>
                   2185:                 </ul>
                   2186:               </div>
                   2187: 
1.14      xtraeme  2188:               <p>You should set <code class="varname">CC</code>,
                   2189:               <code class="varname">CXX</code> and optionally,
                   2190:               <code class="varname">CPP</code> in <code class=
                   2191:               "filename">/etc/mk.conf</code>, eg.</p>
1.1       grant    2192:               <pre class="programlisting">
                   2193: CC=        cc
                   2194: CXX=    CC
                   2195: CPP=    /usr/ccs/lib/cpp
                   2196: </pre>
                   2197: 
                   2198:               <p>You may also want to build 64-bit binaries,
                   2199:               eg.</p>
                   2200:               <pre class="programlisting">
                   2201: CFLAGS= -xtarget=ultra -xarch=v9
                   2202: </pre>
                   2203: 
                   2204:               <p>Whichever compiler you use, please ensure the
                   2205:               compiler tools and your $prefix are in your
1.14      xtraeme  2206:               <code class="varname">PATH</code>. This includes
                   2207:               <code class="filename">/usr/ccs/{bin,lib}</code> and
                   2208:               eg. <code class=
                   2209:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2210:             </div>
                   2211:           </div>
                   2212:         </div>
                   2213:       </div>
                   2214: 
                   2215:       <div class="chapter" lang="en" xml:lang="en">
                   2216:         <div class="titlepage">
                   2217:           <div>
                   2218:             <div>
                   2219:               <h2 class="title"><a name="using" id=
                   2220:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2221:             </div>
                   2222:           </div>
                   2223:         </div>
                   2224: 
                   2225:         <div class="toc">
                   2226:           <p><b>Table of Contents</b></p>
                   2227: 
                   2228:           <dl>
                   2229:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2230:             Working with binary packages</a></span></dt>
                   2231: 
                   2232:             <dd>
                   2233:               <dl>
1.14      xtraeme  2234:                 <dt><span class="sect2"><a href="#id2516526">4.1.1.
1.1       grant    2235:                 Where to get binary packages</a></span></dt>
                   2236: 
1.14      xtraeme  2237:                 <dt><span class="sect2"><a href="#id2516567">4.1.2.
1.1       grant    2238:                 How to use binary packages</a></span></dt>
                   2239: 
1.14      xtraeme  2240:                 <dt><span class="sect2"><a href="#id2516633">4.1.3.
1.1       grant    2241:                 A word of warning</a></span></dt>
                   2242:               </dl>
                   2243:             </dd>
                   2244: 
1.14      xtraeme  2245:             <dt><span class="sect1"><a href="#id2516645">4.2.
1.1       grant    2246:             Building packages from source</a></span></dt>
                   2247: 
                   2248:             <dd>
                   2249:               <dl>
1.14      xtraeme  2250:                 <dt><span class="sect2"><a href="#id2516723">4.2.1.
1.1       grant    2251:                 Requirements</a></span></dt>
                   2252: 
1.14      xtraeme  2253:                 <dt><span class="sect2"><a href="#id2516743">4.2.2.
1.1       grant    2254:                 Fetching distfiles</a></span></dt>
                   2255: 
1.14      xtraeme  2256:                 <dt><span class="sect2"><a href="#id2516864">4.2.3.
1.1       grant    2257:                 How to build and install</a></span></dt>
                   2258: 
1.14      xtraeme  2259:                 <dt><span class="sect2"><a href="#id2517180">4.2.4.
1.1       grant    2260:                 Selecting the compiler</a></span></dt>
                   2261:               </dl>
                   2262:             </dd>
                   2263:           </dl>
                   2264:         </div>
                   2265: 
                   2266:         <div class="sect1" lang="en" xml:lang="en">
                   2267:           <div class="titlepage">
                   2268:             <div>
                   2269:               <div>
                   2270:                 <h2 class="title" style="clear: both"><a name=
                   2271:                 "getting-started" id=
                   2272:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2273:                 packages</h2>
                   2274:               </div>
                   2275:             </div>
                   2276:           </div>
                   2277: 
                   2278:           <p>This section describes how to find, retrieve and
                   2279:           install a precompiled binary package that someone else
                   2280:           already prepared for your type of machine.</p>
                   2281: 
                   2282:           <div class="sect2" lang="en" xml:lang="en">
                   2283:             <div class="titlepage">
                   2284:               <div>
                   2285:                 <div>
1.14      xtraeme  2286:                   <h3 class="title"><a name="id2516526" id=
                   2287:                   "id2516526"></a>4.1.1.&nbsp;Where to get binary
1.1       grant    2288:                   packages</h3>
                   2289:                 </div>
                   2290:               </div>
                   2291:             </div>
                   2292: 
                   2293:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.14      xtraeme  2294:             and its mirrors in the directory <code class=
                   2295:             "filename">/pub/NetBSD/packages</code> for anonymous
                   2296:             FTP access. Please pick the right subdirectory there as
                   2297:             indicated by <span><strong class="command">uname
                   2298:             -p</strong></span>. In that directory, there is a
1.1       grant    2299:             subdirectory for each category plus a subdirectory
1.14      xtraeme  2300:             <code class="filename">All</code> which includes the
                   2301:             actual binaries in <code class="filename">.tgz</code>
                   2302:             files. The category subdirectories use symbolic links
                   2303:             to those files (this is the same directory layout as in
                   2304:             <code class=
                   2305:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2306: 
                   2307:             <p>This same directory layout applies for CDROM
                   2308:             distributions, only that the directory may be rooted
1.14      xtraeme  2309:             somewhere else, probably somewhere below <code class=
                   2310:             "filename">/cdrom</code>. Please consult your CDROMs
1.1       grant    2311:             documentation for the exact location.</p>
                   2312:           </div>
                   2313: 
                   2314:           <div class="sect2" lang="en" xml:lang="en">
                   2315:             <div class="titlepage">
                   2316:               <div>
                   2317:                 <div>
1.14      xtraeme  2318:                   <h3 class="title"><a name="id2516567" id=
                   2319:                   "id2516567"></a>4.1.2.&nbsp;How to use binary
1.1       grant    2320:                   packages</h3>
                   2321:                 </div>
                   2322:               </div>
                   2323:             </div>
                   2324: 
                   2325:             <p>If you have the files on a CDROM or downloaded them
                   2326:             to your hard disk, youcan install them with the
1.14      xtraeme  2327:             following command (be sure to<span><strong class=
                   2328:             "command">su</strong></span> to root first):</p>
1.1       grant    2329:             <pre class="screen">
1.14      xtraeme  2330: <code class="prompt">#</code> <strong class=
                   2331: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    2332: </pre>
                   2333: 
                   2334:             <p>If you have FTP access and you don't want to
                   2335:             download the packages via FTP prior to installation,
1.14      xtraeme  2336:             you can do this automatically by giving
                   2337:             <span><strong class="command">pkg_add</strong></span>
                   2338:             an FTP URL:</p>
1.1       grant    2339:             <pre class="screen">
1.14      xtraeme  2340: <code class="prompt">#</code> <strong class=
                   2341: "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    2342: </pre>
                   2343: 
                   2344:             <p>If there is any doubt, the uname utility can be used
                   2345:             to determine the &lt;OSvers&gt;, and &lt;arch&gt; by
1.14      xtraeme  2346:             running <span><strong class="command">uname
                   2347:             -rp</strong></span>.</p>
1.1       grant    2348: 
                   2349:             <p>Also note that any prerequisite packages needed to
                   2350:             run the package in question will be installed, too,
                   2351:             assuming they are present where you install from.</p>
                   2352: 
                   2353:             <p>After you've installed packages, be sure to have
1.14      xtraeme  2354:             <code class="filename">/usr/pkg/bin</code> in your
                   2355:             <code class="varname">PATH</code> so you can actually
                   2356:             start the just installed program.</p>
1.1       grant    2357:           </div>
                   2358: 
                   2359:           <div class="sect2" lang="en" xml:lang="en">
                   2360:             <div class="titlepage">
                   2361:               <div>
                   2362:                 <div>
1.14      xtraeme  2363:                   <h3 class="title"><a name="id2516633" id=
                   2364:                   "id2516633"></a>4.1.3.&nbsp;A word of
1.1       grant    2365:                   warning</h3>
                   2366:                 </div>
                   2367:               </div>
                   2368:             </div>
                   2369: 
                   2370:             <p>Please pay very careful attention to the warnings
                   2371:             expressed in the <a href=
                   2372:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2373:             <span class="citerefentry"><span class=
                   2374:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2375:             page about the inherent dangers of installing binary
                   2376:             packages which you did not create yourself, and the
                   2377:             security holes that can be introduced onto your system
                   2378:             by indiscriminate adding of such files.</p>
                   2379:           </div>
                   2380:         </div>
                   2381: 
                   2382:         <div class="sect1" lang="en" xml:lang="en">
                   2383:           <div class="titlepage">
                   2384:             <div>
                   2385:               <div>
                   2386:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  2387:                 "id2516645" id="id2516645"></a>4.2.&nbsp;Building
1.1       grant    2388:                 packages from source</h2>
                   2389:               </div>
                   2390:             </div>
                   2391:           </div>
                   2392: 
                   2393:           <p>This assumes that the package is already in pkgsrc. If
                   2394:           it is not, see <a href="#developers-guide" title=
1.2       hubertf  2395:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
                   2396:           &#8220;The pkgsrc developer's guide&#8221;</a>.</p>
1.1       grant    2397: 
                   2398:           <div class="sect2" lang="en" xml:lang="en">
                   2399:             <div class="titlepage">
                   2400:               <div>
                   2401:                 <div>
1.14      xtraeme  2402:                   <h3 class="title"><a name="id2516723" id=
                   2403:                   "id2516723"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2404:                 </div>
                   2405:               </div>
                   2406:             </div>
                   2407: 
                   2408:             <p>To build packages from source on a NetBSD system the
                   2409:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2410:             &#8220;<span class="quote">text</span>&#8221;
                   2411:             distribution sets must be installed. If you want to
                   2412:             build X11 related packages the &#8220;<span class=
                   2413:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2414:             "quote">xcomp</span>&#8221; distribution sets are
                   2415:             required, too.</p>
                   2416:           </div>
                   2417: 
                   2418:           <div class="sect2" lang="en" xml:lang="en">
                   2419:             <div class="titlepage">
                   2420:               <div>
                   2421:                 <div>
1.14      xtraeme  2422:                   <h3 class="title"><a name="id2516743" id=
                   2423:                   "id2516743"></a>4.2.2.&nbsp;Fetching
1.1       grant    2424:                   distfiles</h3>
                   2425:                 </div>
                   2426:               </div>
                   2427:             </div>
                   2428: 
                   2429:             <p>The distfile (i.e. the unmodified source) must exist
                   2430:             on your system for the packages system to be able to
                   2431:             build it. If it does not exist, pkgsrc will use
                   2432:             <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   2433:             <span class="citerefentry"><span class=
                   2434:             "refentrytitle">ftp</span>(1)</span></a> to fetch it
                   2435:             automatically.</p>
                   2436: 
                   2437:             <p>You can overwrite some of the major distribution
                   2438:             sites to fit to sites that are close to your own. Have
1.14      xtraeme  2439:             a look at <code class=
                   2440:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
                   2441:             some examples - in particular, look for the
                   2442:             <code class="varname">MASTER_SORT</code>, <code class=
                   2443:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   2444:             "varname">INET_COUNTRY</code> definitions. This may
                   2445:             save some of your bandwidth and time.</p>
1.1       grant    2446: 
                   2447:             <p>You can change these settings either in your shell's
                   2448:             environment, or, if you want to keep the settings, by
1.14      xtraeme  2449:             editing the <code class="filename">/etc/mk.conf</code>
1.1       grant    2450:             file, and adding the definitions there.</p>
                   2451: 
                   2452:             <p>If you don't have a permanent Internet connection
                   2453:             and you want to know which files to download,
1.14      xtraeme  2454:             <span><strong class="command">make
                   2455:             fetch-list</strong></span> will tell you what you'll
                   2456:             need. Put these distfiles into <code class=
                   2457:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    2458:           </div>
                   2459: 
                   2460:           <div class="sect2" lang="en" xml:lang="en">
                   2461:             <div class="titlepage">
                   2462:               <div>
                   2463:                 <div>
1.14      xtraeme  2464:                   <h3 class="title"><a name="id2516864" id=
                   2465:                   "id2516864"></a>4.2.3.&nbsp;How to build and
1.1       grant    2466:                   install</h3>
                   2467:                 </div>
                   2468:               </div>
                   2469:             </div>
                   2470: 
                   2471:             <p>Assuming that the distfile has been fetched (see
                   2472:             previous section), become root and change into the
1.14      xtraeme  2473:             relevant directory and running <span><strong class=
                   2474:             "command">make</strong></span>. For example, type</p>
1.1       grant    2475:             <pre class="screen">
1.14      xtraeme  2476: <code class="prompt">%</code> <strong class=
                   2477: "userinput"><code>cd misc/figlet</code></strong>
                   2478: <code class="prompt">%</code> <strong class=
                   2479: "userinput"><code>make</code></strong>
1.1       grant    2480: </pre>
                   2481: 
                   2482:             <p>at the shell prompt to build the various components
                   2483:             of the package, and</p>
                   2484:             <pre class="screen">
1.14      xtraeme  2485: <code class="prompt">#</code> <strong class=
                   2486: "userinput"><code>make install</code></strong>
1.1       grant    2487: </pre>
                   2488: 
                   2489:             <p>to install the various components into the correct
                   2490:             places on your system. Installing the package on your
                   2491:             system requires you to be root. However, pkgsrc has a
                   2492:             <span class="emphasis"><em>just-in-time-su</em></span>
                   2493:             feature, which allows you to only become root for the
                   2494:             actual installation step</p>
                   2495: 
                   2496:             <p>Taking the figlet utility as an example, we can
                   2497:             install it on our system by building as shown in
                   2498:             <a href="#logs" title=
                   2499:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
                   2500:             logs</i></a>.</p>
                   2501: 
                   2502:             <p>The program is installed under the default root of
1.14      xtraeme  2503:             the packages tree - <code class=
                   2504:             "filename">/usr/pkg</code>. Should this not conform to
                   2505:             your tastes, set the <code class=
                   2506:             "varname">LOCALBASE</code> variable in your
1.1       grant    2507:             environment, and it will use that value as the root of
1.14      xtraeme  2508:             your packages tree. So, to use <code class=
                   2509:             "filename">/usr/local</code>, set <code class=
                   2510:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    2511:             environment. Please note that you should use a
                   2512:             directory which is dedicated to packages and not shared
1.14      xtraeme  2513:             with other programs (ie, do not try and use
                   2514:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   2515:             should not try to add any of your own files or
                   2516:             directories (such as <code class=
                   2517:             "filename">src/</code>, <code class=
                   2518:             "filename">obj/</code>, or <code class=
                   2519:             "filename">pkgsrc/</code>) below the <code class=
                   2520:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    2521:             possible conflicts between programs and other files
                   2522:             installed by the package system and whatever else may
                   2523:             have been installed there.</p>
                   2524: 
1.14      xtraeme  2525:             <p>Some packages look in <code class=
                   2526:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    2527:             configuration options at build time. Have a look at
1.14      xtraeme  2528:             <code class=
                   2529:             "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
                   2530:             overview of what will be set there by default.
                   2531:             Environment variables such as <code class=
                   2532:             "varname">LOCALBASE</code> can be set in <code class=
                   2533:             "filename">/etc/mk.conf</code> to save having to
                   2534:             remember to set them each time you want to use
                   2535:             pkgsrc.</p>
1.1       grant    2536: 
                   2537:             <p>Occasionally, people want to &#8220;<span class=
                   2538:             "quote">look under the covers</span>&#8221; to see what
                   2539:             is going on when a package is building or being
                   2540:             installed. This may be for debugging purposes, or out
                   2541:             of simple curiosity. A number of utility values have
                   2542:             been added to help with this.</p>
                   2543: 
                   2544:             <div class="orderedlist">
                   2545:               <ol type="1">
                   2546:                 <li>
                   2547:                   <p>If you invoke the <a href=
                   2548:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2549:                   <span class="citerefentry"><span class=
                   2550:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  2551:                   with <code class=
                   2552:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   2553:                   amount of information will be displayed. For
                   2554:                   example,</p>
1.1       grant    2555:                   <pre class="screen">
1.14      xtraeme  2556: <strong class=
                   2557: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    2558: </pre>
                   2559: 
                   2560:                   <p>will show all the commands that are invoked,
                   2561:                   up to and including the &#8220;<span class=
                   2562:                   "quote">patch</span>&#8221; stage.</p>
                   2563:                 </li>
                   2564: 
                   2565:                 <li>
                   2566:                   <p>If you want to know the value of a certain
1.14      xtraeme  2567:                   make(1) definition, then the <code class=
                   2568:                   "varname">VARNAME</code> definition should be
                   2569:                   used, in conjunction with the show-var target.
                   2570:                   e.g. to show the expansion of the <a href=
1.1       grant    2571:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2572:                   <span class="citerefentry"><span class=
                   2573:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  2574:                   variable <code class=
                   2575:                   "varname">DISTFILES</code>:</p>
1.1       grant    2576:                   <pre class="screen">
1.14      xtraeme  2577: <code class="prompt">%</code> <strong class=
                   2578: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    2579: /usr/pkg
1.14      xtraeme  2580: <code class="prompt">%</code>
1.1       grant    2581:           
                   2582: </pre>
                   2583:                 </li>
                   2584:               </ol>
                   2585:             </div>
                   2586: 
                   2587:             <p>If you want to install a binary package that you've
                   2588:             either created yourself (see next section), that you
                   2589:             put into pkgsrc/packages manually or that is located on
1.8       wiz      2590:             a remote FTP server, you can use the "bin-install"
1.1       grant    2591:             target. This target will install a binary package - if
                   2592:             available - via <a href=
                   2593:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2594:             <span class="citerefentry"><span class=
                   2595:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  2596:             <span><strong class="command">make
                   2597:             package</strong></span>. The list of remote FTP sites
                   2598:             searched is kept in the variable <code class=
                   2599:             "varname">BINPKG_SITES</code>, which defaults to
                   2600:             ftp.NetBSD.org. Any flags that should be added to
                   2601:             <a href=
1.1       grant    2602:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2603:             <span class="citerefentry"><span class=
                   2604:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  2605:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
                   2606:             See <code class=
                   2607:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   2608:             details.</p>
1.1       grant    2609: 
                   2610:             <p>A final word of warning: If you setup a system that
1.14      xtraeme  2611:             has a non-standard setting for <code class=
                   2612:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    2613:             any packages are installed, as you can not use several
                   2614:             directories for the same purpose. Doing so will result
                   2615:             in pkgsrc not being able to properly detect your
                   2616:             installed packages, and fail miserably. Note also that
                   2617:             precompiled binary packages are usually built with the
1.14      xtraeme  2618:             default <code class="varname">LOCALBASE</code> of
                   2619:             <code class="filename">/usr/pkg</code>, and that you
                   2620:             should <span class="emphasis"><em>not</em></span>
                   2621:             install any if you use a non-standard <code class=
                   2622:             "varname">LOCALBASE</code>.</p>
1.1       grant    2623:           </div>
                   2624: 
                   2625:           <div class="sect2" lang="en" xml:lang="en">
                   2626:             <div class="titlepage">
                   2627:               <div>
                   2628:                 <div>
1.14      xtraeme  2629:                   <h3 class="title"><a name="id2517180" id=
                   2630:                   "id2517180"></a>4.2.4.&nbsp;Selecting the
1.1       grant    2631:                   compiler</h3>
                   2632:                 </div>
                   2633:               </div>
                   2634:             </div>
                   2635: 
                   2636:             <p>By default, pkgsrc will use GCC to build packages.
                   2637:             This may be overridden by setting the following
                   2638:             variables in /etc/mk.conf:</p>
                   2639: 
                   2640:             <div class="variablelist">
                   2641:               <dl>
1.14      xtraeme  2642:                 <dt><span class="term"><code class=
                   2643:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    2644: 
                   2645:                 <dd>
                   2646:                   <p>This is a list of values specifying the chain
                   2647:                   of compilers to invoke when building packages.
                   2648:                   Valid values are:</p>
                   2649: 
                   2650:                   <div class="itemizedlist">
                   2651:                     <ul type="disc">
                   2652:                       <li>
1.14      xtraeme  2653:                         <p><code class="varname">distcc</code>:
1.1       grant    2654:                         distributed C/C++ (chainable)</p>
                   2655:                       </li>
                   2656: 
                   2657:                       <li>
1.14      xtraeme  2658:                         <p><code class="varname">ccache</code>:
1.1       grant    2659:                         compiler cache (chainable)</p>
                   2660:                       </li>
                   2661: 
                   2662:                       <li>
1.14      xtraeme  2663:                         <p><code class="varname">gcc</code>: GNU
                   2664:                         C/C++ Compiler</p>
1.1       grant    2665:                       </li>
                   2666: 
                   2667:                       <li>
1.14      xtraeme  2668:                         <p><code class="varname">mipspro</code>:
1.1       grant    2669:                         Silicon Graphics, Inc. MIPSpro
                   2670:                         (n32/n64)</p>
                   2671:                       </li>
                   2672: 
                   2673:                       <li>
1.14      xtraeme  2674:                         <p><code class="varname">mipspro</code>:
1.1       grant    2675:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   2676:                       </li>
                   2677: 
                   2678:                       <li>
1.14      xtraeme  2679:                         <p><code class="varname">sunpro</code>:
1.1       grant    2680:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   2681:                         Studio</p>
                   2682:                       </li>
                   2683:                     </ul>
                   2684:                   </div>
                   2685: 
                   2686:                   <p>The default is &#8220;<span class=
1.14      xtraeme  2687:                   "quote"><code class=
                   2688:                   "varname">gcc</code></span>&#8221;. You can use
                   2689:                   <code class="varname">ccache</code> and/or
                   2690:                   <code class="varname">distcc</code> with an
                   2691:                   appropriate <code class=
                   2692:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   2693:                   &#8220;<span class="quote"><code class=
                   2694:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    2695:                   variable should always be terminated with a value
                   2696:                   for a real compiler.</p>
                   2697:                 </dd>
                   2698: 
1.14      xtraeme  2699:                 <dt><span class="term"><code class=
                   2700:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    2701: 
                   2702:                 <dd>
                   2703:                   <p>This specifies the minimum version of GCC to
                   2704:                   use when building packages. If the system GCC
                   2705:                   doesn't satisfy this requirement, then pkgsrc
                   2706:                   will build and install one of the GCC packages to
                   2707:                   use instead.</p>
                   2708:                 </dd>
                   2709:               </dl>
                   2710:             </div>
                   2711:           </div>
                   2712:         </div>
                   2713:       </div>
                   2714: 
                   2715:       <div class="chapter" lang="en" xml:lang="en">
                   2716:         <div class="titlepage">
                   2717:           <div>
                   2718:             <div>
                   2719:               <h2 class="title"><a name="binary" id=
                   2720:               "binary"></a>Chapter&nbsp;5.&nbsp;Creating binary
                   2721:               packages</h2>
                   2722:             </div>
                   2723:           </div>
                   2724:         </div>
                   2725: 
                   2726:         <div class="toc">
                   2727:           <p><b>Table of Contents</b></p>
                   2728: 
                   2729:           <dl>
1.14      xtraeme  2730:             <dt><span class="sect1"><a href="#id2517335">5.1.
1.1       grant    2731:             Building a single binary package</a></span></dt>
                   2732: 
1.14      xtraeme  2733:             <dt><span class="sect1"><a href="#id2517822">5.2.
1.1       grant    2734:             Settings for creation of binary
                   2735:             packages</a></span></dt>
                   2736: 
                   2737:             <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
                   2738:             a bulk build of all packages</a></span></dt>
                   2739: 
                   2740:             <dd>
                   2741:               <dl>
                   2742:                 <dt><span class="sect2"><a href=
                   2743:                 "#binary.configuration">5.3.1.
                   2744:                 Configuration</a></span></dt>
                   2745: 
1.14      xtraeme  2746:                 <dt><span class="sect2"><a href="#id2517962">5.3.2.
1.1       grant    2747:                 Other environmental considerations</a></span></dt>
                   2748: 
1.14      xtraeme  2749:                 <dt><span class="sect2"><a href="#id2518003">5.3.3.
1.1       grant    2750:                 Operation</a></span></dt>
                   2751: 
1.14      xtraeme  2752:                 <dt><span class="sect2"><a href="#id2583267">5.3.4.
1.1       grant    2753:                 What it does</a></span></dt>
                   2754: 
1.14      xtraeme  2755:                 <dt><span class="sect2"><a href="#id2583392">5.3.5.
1.1       grant    2756:                 Disk space requirements</a></span></dt>
                   2757: 
1.14      xtraeme  2758:                 <dt><span class="sect2"><a href="#id2583418">5.3.6.
1.1       grant    2759:                 Setting up a sandbox for chroot'ed
                   2760:                 builds</a></span></dt>
                   2761: 
1.14      xtraeme  2762:                 <dt><span class="sect2"><a href="#id2583811">5.3.7.
1.1       grant    2763:                 Building a partial set of packages</a></span></dt>
1.13      hubertf  2764: 
                   2765:                 <dt><span class="sect2"><a href=
                   2766:                 "#bulk-upload">5.3.8. Uploading results of a bulk
                   2767:                 build</a></span></dt>
1.1       grant    2768:               </dl>
                   2769:             </dd>
                   2770: 
1.14      xtraeme  2771:             <dt><span class="sect1"><a href="#id2584227">5.4.
1.1       grant    2772:             Creating a multiple CD-ROM packages
                   2773:             collection</a></span></dt>
                   2774: 
                   2775:             <dd>
                   2776:               <dl>
1.14      xtraeme  2777:                 <dt><span class="sect2"><a href="#id2584310">5.4.1.
1.1       grant    2778:                 Example of cdpack</a></span></dt>
                   2779:               </dl>
                   2780:             </dd>
                   2781:           </dl>
                   2782:         </div>
                   2783: 
                   2784:         <div class="sect1" lang="en" xml:lang="en">
                   2785:           <div class="titlepage">
                   2786:             <div>
                   2787:               <div>
                   2788:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  2789:                 "id2517335" id="id2517335"></a>5.1.&nbsp;Building a
1.1       grant    2790:                 single binary package</h2>
                   2791:               </div>
                   2792:             </div>
                   2793:           </div>
                   2794: 
                   2795:           <p>Once you have built and installed a package, you can
                   2796:           create a <span class="emphasis"><em>binary
                   2797:           package</em></span> which can be installed on another
                   2798:           system with <a href=
                   2799:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2800:           <span class="citerefentry"><span class=
                   2801:           "refentrytitle">pkg_add</span>(1)</span></a> This saves
                   2802:           having to build the same package on a group of hosts and
                   2803:           wasting CPU time. It also provides a simple means for
                   2804:           others to install your package, should you distribute
                   2805:           it.</p>
                   2806: 
                   2807:           <p>To create a binary package, change into the
1.14      xtraeme  2808:           appropriate directory in pkgsrc, and run
                   2809:           <span><strong class="command">make
                   2810:           package</strong></span>:</p>
1.1       grant    2811:           <pre class="screen">
1.14      xtraeme  2812: <code class="prompt">#</code> <strong class=
                   2813: "userinput"><code>cd misc/figlet</code></strong>
                   2814: <code class="prompt">#</code> <strong class=
                   2815: "userinput"><code>make package</code></strong>
1.1       grant    2816: </pre>
                   2817: 
                   2818:           <p>This will build and install your package (if not
                   2819:           already done), and then build a binary package from what
1.14      xtraeme  2820:           was installed. You can then use the <span><strong class=
                   2821:           "command">pkg_*</strong></span> tools to manipulate it.
                   2822:           Binary packages are created by default in <code class=
                   2823:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    2824:           gzipped tar file. See <a href="#logs.package" title=
                   2825:           "B.2.&nbsp;Packaging figlet">Section B.2,
                   2826:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   2827:           the above <a xmlns=
                   2828:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   2829:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.14      xtraeme  2830:           class="pkgname">misc/figlet</a> example.</p>
1.1       grant    2831: 
                   2832:           <p>See <a href="#submit" title=
                   2833:           "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter
                   2834:           14, <i>Submitting and Committing</i></a> for information
                   2835:           on how to submit such a binary package.</p>
                   2836:         </div>
                   2837: 
                   2838:         <div class="sect1" lang="en" xml:lang="en">
                   2839:           <div class="titlepage">
                   2840:             <div>
                   2841:               <div>
                   2842:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  2843:                 "id2517822" id="id2517822"></a>5.2.&nbsp;Settings
1.1       grant    2844:                 for creation of binary packages</h2>
                   2845:               </div>
                   2846:             </div>
                   2847:           </div>
                   2848: 
                   2849:           <p>See <a href="#build.helpful-targets" title=
                   2850:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   2851:           &#8220;Other helpful targets&#8221;</a>.</p>
                   2852:         </div>
                   2853: 
                   2854:         <div class="sect1" lang="en" xml:lang="en">
                   2855:           <div class="titlepage">
                   2856:             <div>
                   2857:               <div>
                   2858:                 <h2 class="title" style="clear: both"><a name=
                   2859:                 "bulkbuild" id="bulkbuild"></a>5.3.&nbsp;Doing a
                   2860:                 bulk build of all packages</h2>
                   2861:               </div>
                   2862:             </div>
                   2863:           </div>
                   2864: 
                   2865:           <p>If you want to get a full set of precompiled binary
                   2866:           packages, this section describes how to get them. Beware
                   2867:           that the bulk build will remove all currently installed
                   2868:           packages from your system! Having a FTP server configured
                   2869:           either on the machine doing the bulk builds or on a
                   2870:           nearby NFS server can help to make the packages available
                   2871:           to everyone. See <a href=
                   2872:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   2873:           <span class="citerefentry"><span class=
                   2874:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   2875:           information. If you use a remote NFS server's storage, be
                   2876:           sure to not actually compile on NFS storage, as this
                   2877:           slows things down a lot.</p>
                   2878: 
                   2879:           <div class="sect2" lang="en" xml:lang="en">
                   2880:             <div class="titlepage">
                   2881:               <div>
                   2882:                 <div>
                   2883:                   <h3 class="title"><a name="binary.configuration"
                   2884:                   id=
                   2885:                   "binary.configuration"></a>5.3.1.&nbsp;Configuration</h3>
                   2886:                 </div>
                   2887:               </div>
                   2888:             </div>
                   2889: 
                   2890:             <div class="sect3" lang="en" xml:lang="en">
                   2891:               <div class="titlepage">
                   2892:                 <div>
                   2893:                   <div>
                   2894:                     <h4 class="title"><a name="binary.mk.conf" id=
                   2895:                     "binary.mk.conf"></a>5.3.1.1.&nbsp;/etc/mk.conf</h4>
                   2896:                   </div>
                   2897:                 </div>
                   2898:               </div>
                   2899: 
1.14      xtraeme  2900:               <p>You may want to set things in <code class=
                   2901:               "filename">/etc/mk.conf</code>. Look at <code class=
                   2902:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    2903:               details of the default settings. You will want to
1.14      xtraeme  2904:               ensure that <code class=
                   2905:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   2906:               policy. As used in this example, <code class=
                   2907:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    2908:               "emphasis"><em>all</em></span> licenses.</p>
                   2909:               <pre class="programlisting">
                   2910: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   2911: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   2912: BSDSRCDIR=      /usr/src
                   2913: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   2914: OBJHOSTNAME?=   yes               # use work.`hostname`
                   2915: FAILOVER_FETCH= yes               # insist on the correct checksum
                   2916: PKG_DEVELOPER?= yes
                   2917: _ACCEPTABLE=    yes
                   2918: </pre>
                   2919:             </div>
                   2920: 
                   2921:             <div class="sect3" lang="en" xml:lang="en">
                   2922:               <div class="titlepage">
                   2923:                 <div>
                   2924:                   <div>
1.14      xtraeme  2925:                     <h4 class="title"><a name="id2517886" id=
                   2926:                     "id2517886"></a>5.3.1.2.&nbsp;<code class=
                   2927:                     "filename">build.conf</code></h4>
1.1       grant    2928:                   </div>
                   2929:                 </div>
                   2930:               </div>
                   2931: 
1.14      xtraeme  2932:               <p>In <code class="filename">pkgsrc/mk/bulk</code>,
                   2933:               copy <code class="filename">build.conf-example</code>
                   2934:               to <code class="filename">build.conf</code> and edit
                   2935:               it, following the comments in that file. This is the
1.1       grant    2936:               config file that determines where log files are
                   2937:               generated after the build, where to mail the build
                   2938:               report to, where your pkgsrc tree is located and
                   2939:               which user to <a href=
                   2940:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   2941:               <span class="citerefentry"><span class=
                   2942:               "refentrytitle">su</span>(8)</span></a> to to do a
1.14      xtraeme  2943:               <span><strong class="command">cvs
                   2944:               update</strong></span>.</p>
1.1       grant    2945:             </div>
                   2946: 
                   2947:             <div class="sect3" lang="en" xml:lang="en">
                   2948:               <div class="titlepage">
                   2949:                 <div>
                   2950:                   <div>
1.14      xtraeme  2951:                     <h4 class="title"><a name="id2517923" id=
                   2952:                     "id2517923"></a>5.3.1.3.&nbsp;<code class=
                   2953:                     "filename">pre-build.local</code></h4>
1.1       grant    2954:                   </div>
                   2955:                 </div>
                   2956:               </div>
                   2957: 
                   2958:               <p>It is possible to configure the bulk build to
                   2959:               perform certain site specific tasks at the end of the
1.14      xtraeme  2960:               pre-build stage. If the file <code class=
                   2961:               "filename">pre-build.local</code> exists in
                   2962:               <code class="filename">/usr/pkgsrc/mk/bulk</code> it
                   2963:               will be executed (as a sh(1) script) at the end of
                   2964:               the usual pre-build stage. An example use of
                   2965:               <code class="filename">pre-build.local</code> is to
                   2966:               have the line:</p>
1.1       grant    2967:               <pre class="screen">
1.14      xtraeme  2968: <code class="prompt">#</code> <strong class=
                   2969: "userinput"><code>echo "I do not have enough disk space to build this pig." \
                   2970:     &gt; pkgsrc/games/crafty-book-enormous/$BROKENF</code></strong>
1.1       grant    2971: </pre>
                   2972: 
                   2973:               <p>to prevent the system from trying to build a
                   2974:               particular package which requires nearly 3 GB of disk
                   2975:               space.</p>
                   2976:             </div>
                   2977:           </div>
                   2978: 
                   2979:           <div class="sect2" lang="en" xml:lang="en">
                   2980:             <div class="titlepage">
                   2981:               <div>
                   2982:                 <div>
1.14      xtraeme  2983:                   <h3 class="title"><a name="id2517962" id=
                   2984:                   "id2517962"></a>5.3.2.&nbsp;Other environmental
1.1       grant    2985:                   considerations</h3>
                   2986:                 </div>
                   2987:               </div>
                   2988:             </div>
                   2989: 
1.14      xtraeme  2990:             <p>As <code class="filename">/usr/pkg</code> will be
1.1       grant    2991:             completely deleted at the start of bulk builds, make
                   2992:             sure your login shell is placed somewhere else. Either
1.14      xtraeme  2993:             drop it into <code class=
                   2994:             "filename">/usr/local/bin</code> (and adjust your login
                   2995:             shell in the passwd file), or (re-)install it via
                   2996:             <a href=
1.1       grant    2997:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2998:             <span class="citerefentry"><span class=
                   2999:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.14      xtraeme  3000:             <code class="filename">/etc/rc.local</code>, so you can
1.1       grant    3001:             login after a reboot (remember that your current
                   3002:             process won't die if the package is removed, you just
                   3003:             can't start any new instances of the shell any more).
                   3004:             Also, if you use NetBSD earlier than 1.5, or you still
                   3005:             want to use the pkgsrc version of ssh for some reason,
                   3006:             be sure to install ssh before starting it from
1.14      xtraeme  3007:             <code class="filename">rc.local</code>:</p>
1.1       grant    3008:             <pre class="programlisting">
                   3009: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   3010: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   3011:     /usr/pkg/etc/rc.d/sshd
                   3012: fi
                   3013: </pre>
                   3014: 
                   3015:             <p>Not doing so will result in you being not able to
                   3016:             log in via ssh after the bulk build is finished or if
                   3017:             the machine gets rebooted or crashes. You have been
                   3018:             warned! :)</p>
                   3019:           </div>
                   3020: 
                   3021:           <div class="sect2" lang="en" xml:lang="en">
                   3022:             <div class="titlepage">
                   3023:               <div>
                   3024:                 <div>
1.14      xtraeme  3025:                   <h3 class="title"><a name="id2518003" id=
                   3026:                   "id2518003"></a>5.3.3.&nbsp;Operation</h3>
1.1       grant    3027:                 </div>
                   3028:               </div>
                   3029:             </div>
                   3030: 
                   3031:             <p>Make sure you don't need any of the packages still
                   3032:             installed.</p>
                   3033: 
                   3034:             <div class="warning" style=
                   3035:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3036:               <h3 class="title">Warning</h3>
                   3037: 
                   3038:               <p>During the bulk build, <span class=
                   3039:               "emphasis"><em>all packages will be
                   3040:               removed!</em></span></p>
                   3041:             </div>
                   3042: 
                   3043:             <p>Be sure to remove all other things that might
                   3044:             interfere with builds, like some libs installed in
1.14      xtraeme  3045:             <code class="filename">/usr/local</code>, etc. then
                   3046:             become root and type:</p>
1.1       grant    3047:             <pre class="screen">
1.14      xtraeme  3048: <code class="prompt">#</code> <strong class=
                   3049: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   3050: <code class="prompt">#</code> <strong class=
                   3051: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    3052: </pre>
                   3053: 
                   3054:             <p>If for some reason your last build didn't complete
                   3055:             (power failure, system panic, ...), you can continue it
                   3056:             by running:</p>
                   3057:             <pre class="screen">
1.14      xtraeme  3058: <code class="prompt">#</code> <strong class=
                   3059: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    3060: </pre>
                   3061: 
                   3062:             <p>At the end of the bulk build, you will get a summary
                   3063:             via mail, and find build logs in the directory
1.14      xtraeme  3064:             specified by <code class="varname">FTP</code> in the
                   3065:             <code class="filename">build.conf</code> file.</p>
1.1       grant    3066:           </div>
                   3067: 
                   3068:           <div class="sect2" lang="en" xml:lang="en">
                   3069:             <div class="titlepage">
                   3070:               <div>
                   3071:                 <div>
1.14      xtraeme  3072:                   <h3 class="title"><a name="id2583267" id=
                   3073:                   "id2583267"></a>5.3.4.&nbsp;What it does</h3>
1.1       grant    3074:                 </div>
                   3075:               </div>
                   3076:             </div>
                   3077: 
                   3078:             <p>The bulk builds consist of three steps:</p>
                   3079: 
                   3080:             <div class="variablelist">
                   3081:               <dl>
                   3082:                 <dt><span class="term">1. pre-build</span></dt>
                   3083: 
                   3084:                 <dd>
                   3085:                   <p>The script updates your pkgsrc tree via
                   3086:                   (anon)cvs, then cleans out any broken distfiles,
                   3087:                   and removes all packages installed.</p>
                   3088:                 </dd>
                   3089: 
                   3090:                 <dt><span class="term">2. the bulk
                   3091:                 build</span></dt>
                   3092: 
                   3093:                 <dd>
                   3094:                   <p>This is basically &#8220;<span class=
                   3095:                   "quote">make bulk-package</span>&#8221; with an
                   3096:                   optimised order in which packages will be built.
                   3097:                   Packages that don't require other packages will
                   3098:                   be built first, and packages with many
                   3099:                   dependencies will be built later.</p>
                   3100:                 </dd>
                   3101: 
                   3102:                 <dt><span class="term">3. post-build</span></dt>
                   3103: 
                   3104:                 <dd>
                   3105:                   <p>Generates a report that's placed in the
1.14      xtraeme  3106:                   directory specified in the <code class=
                   3107:                   "filename">build.conf</code> file named
                   3108:                   <code class="filename">broken.html</code>, a
                   3109:                   short version of that report will also be mailed
                   3110:                   to the build's admin.</p>
1.1       grant    3111:                 </dd>
                   3112:               </dl>
                   3113:             </div>
                   3114: 
                   3115:             <p>During the build, a list of broken packages will be
1.14      xtraeme  3116:             compiled in <code class=
                   3117:             "filename">/usr/pkgsrc/.broken</code> (or <code class=
                   3118:             "filename">.../.broken.${MACHINE}</code> if
                   3119:             <code class="varname">OBJMACHINE</code> is set),
                   3120:             individual build logs of broken builds can be found in
                   3121:             the package's directory. These files are used by the
                   3122:             bulk-targets to mark broken builds to not waste time
                   3123:             trying to rebuild them, and they can be used to debug
                   3124:             these broken package builds later.</p>
1.1       grant    3125:           </div>
                   3126: 
                   3127:           <div class="sect2" lang="en" xml:lang="en">
                   3128:             <div class="titlepage">
                   3129:               <div>
                   3130:                 <div>
1.14      xtraeme  3131:                   <h3 class="title"><a name="id2583392" id=
                   3132:                   "id2583392"></a>5.3.5.&nbsp;Disk space
1.1       grant    3133:                   requirements</h3>
                   3134:                 </div>
                   3135:               </div>
                   3136:             </div>
                   3137: 
                   3138:             <p>Currently, roughly the following requirements are
                   3139:             valid for NetBSD 2.0/i386:</p>
                   3140: 
                   3141:             <div class="itemizedlist">
                   3142:               <ul type="disc">
                   3143:                 <li>
                   3144:                   <p>10 GB - distfiles (NFS ok)</p>
                   3145:                 </li>
                   3146: 
                   3147:                 <li>
                   3148:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   3149:                 </li>
                   3150: 
                   3151:                 <li>
                   3152:                   <p>5 GB - temp space for compiling (local disk
                   3153:                   recommended)</p>
                   3154:                 </li>
                   3155:               </ul>
                   3156:             </div>
                   3157: 
                   3158:             <p>Note that all pkgs will be de-installed as soon as
                   3159:             they are turned into a binary package, and that sources
                   3160:             are removed, so there is no excessively huge demand to
                   3161:             disk space. Afterwards, if the package is needed again,
                   3162:             it will be installed via <a href=
                   3163:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3164:             <span class="citerefentry"><span class=
                   3165:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   3166:             building again, so there are no cycles wasted by
                   3167:             recompiling.</p>
                   3168:           </div>
                   3169: 
                   3170:           <div class="sect2" lang="en" xml:lang="en">
                   3171:             <div class="titlepage">
                   3172:               <div>
                   3173:                 <div>
1.14      xtraeme  3174:                   <h3 class="title"><a name="id2583418" id=
                   3175:                   "id2583418"></a>5.3.6.&nbsp;Setting up a sandbox
1.1       grant    3176:                   for chroot'ed builds</h3>
                   3177:                 </div>
                   3178:               </div>
                   3179:             </div>
                   3180: 
1.12      agc      3181:             <p>If you don't want all the packages nuked from a
                   3182:             machine (rendering it useless for anything but pkg
                   3183:             compiling), there is the possibility of doing the pkg
                   3184:             bulk build inside a chroot environment.</p>
                   3185: 
                   3186:             <p>The first step is to set up a chroot sandbox, e.g.
1.14      xtraeme  3187:             <code class="filename">/usr/sandbox</code>. This can be
1.12      agc      3188:             done by using null mounts, or manually.</p>
                   3189: 
1.14      xtraeme  3190:             <p>There is a shell script called <code class=
                   3191:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   3192:             set up the sandbox environment using null mounts. It
                   3193:             will also create a script called <code class=
                   3194:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      3195:             environment, which will allow the null mounts to be
1.14      xtraeme  3196:             activated using the <span><strong class=
                   3197:             "command">sandbox mount</strong></span> command and
                   3198:             deactivated using the <span><strong class=
                   3199:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      3200: 
                   3201:             <p>To set up a sandbox environment by hand, after
                   3202:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  3203:             doing a <span><strong class="command">make distribution
                   3204:             DESTDIR=/usr/sandbox</strong></span> in <code class=
                   3205:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      3206:             items are present and properly configured:</p>
1.1       grant    3207: 
                   3208:             <div class="procedure">
                   3209:               <ol type="1">
                   3210:                 <li>
                   3211:                   <p>Kernel</p>
                   3212:                   <pre class="screen">
1.14      xtraeme  3213: <code class="prompt">#</code> <strong class=
                   3214: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    3215: </pre>
                   3216:                 </li>
                   3217: 
                   3218:                 <li>
1.14      xtraeme  3219:                   <p><code class="filename">/dev/*</code></p>
1.1       grant    3220:                   <pre class="screen">
1.14      xtraeme  3221: <code class="prompt">#</code> <strong class=
                   3222: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    3223: </pre>
                   3224:                 </li>
                   3225: 
                   3226:                 <li>
1.14      xtraeme  3227:                   <p><code class="filename">/etc/resolv.conf</code>
1.1       grant    3228:                   (for <a xmlns=
                   3229:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3230:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.14      xtraeme  3231:                   class="pkgname">security/smtpd</a> and mail):</p>
1.1       grant    3232:                   <pre class="screen">
1.14      xtraeme  3233: <code class="prompt">#</code> <strong class=
                   3234: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    3235: </pre>
                   3236:                 </li>
                   3237: 
                   3238:                 <li>
                   3239:                   <p>Working(!) mail config (hostname,
                   3240:                   sendmail.cf):</p>
                   3241:                   <pre class="screen">
1.14      xtraeme  3242: <code class="prompt">#</code> <strong class=
                   3243: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    3244: </pre>
                   3245:                 </li>
                   3246: 
                   3247:                 <li>
1.14      xtraeme  3248:                   <p><code class="filename">/etc/localtime</code>
                   3249:                   (for <a xmlns=
1.1       grant    3250:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3251:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.14      xtraeme  3252:                   class="pkgname">security/smtpd</a>):</p>
1.1       grant    3253:                   <pre class="screen">
1.14      xtraeme  3254: <code class="prompt">#</code> <strong class=
                   3255: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    3256: </pre>
                   3257:                 </li>
                   3258: 
                   3259:                 <li>
1.14      xtraeme  3260:                   <p><code class="filename">/usr/src</code> (system
1.1       grant    3261:                   sources, for <a xmlns=
                   3262:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3263:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.14      xtraeme  3264:                   class="pkgname">sysutils/aperture</a>, <a xmlns=
                   3265:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3266:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
                   3267:                   class="pkgname">net/ppp-mppe</a>):</p>
1.1       grant    3268:                   <pre class="screen">
1.14      xtraeme  3269: <code class="prompt">#</code> <strong class=
                   3270: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   3271: <code class="prompt">#</code> <strong class=
                   3272: "userinput"><code>ln -s cvs/src-1.6 src</code></strong>
1.1       grant    3273: </pre>
                   3274:                 </li>
                   3275: 
                   3276:                 <li>
1.14      xtraeme  3277:                   <p>Create <code class=
                   3278:                   "filename">/var/db/pkg</code> (not part of
                   3279:                   default install):</p>
1.1       grant    3280:                   <pre class="screen">
1.14      xtraeme  3281: <code class="prompt">#</code> <strong class=
                   3282: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    3283: </pre>
                   3284:                 </li>
                   3285: 
                   3286:                 <li>
1.14      xtraeme  3287:                   <p>Create <code class="filename">/usr/pkg</code>
                   3288:                   (not part of default install):</p>
1.1       grant    3289:                   <pre class="screen">
1.14      xtraeme  3290: <code class="prompt">#</code> <strong class=
                   3291: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    3292: </pre>
                   3293:                 </li>
                   3294: 
                   3295:                 <li>
1.14      xtraeme  3296:                   <p>Checkout pkgsrc via cvs into <code class=
                   3297:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    3298:                   <pre class="screen">
1.14      xtraeme  3299: <code class="prompt">#</code> <strong class=
                   3300: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   3301: <code class="prompt">#</code> <strong class=
                   3302: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    3303: </pre>
                   3304: 
                   3305:                   <p>Do not mount/link this to the copy of your
                   3306:                   pkgsrc tree you do development in, as this will
                   3307:                   likely cause problems!</p>
                   3308:                 </li>
                   3309: 
                   3310:                 <li>
1.14      xtraeme  3311:                   <p>Make <code class=
                   3312:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
                   3313:                   and <code class="filename">.../distfiles</code>
                   3314:                   point somewhere appropriate. NFS- and/or
                   3315:                   nullfs-mounts may come in handy!</p>
1.1       grant    3316:                 </li>
                   3317: 
                   3318:                 <li>
1.14      xtraeme  3319:                   <p>Edit <code class=
                   3320:                   "filename">/etc/mk.conf</code>, see <a href=
                   3321:                   "#binary.mk.conf" title=
1.1       grant    3322:                   "5.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;5.3.1.1,
                   3323:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   3324:                 </li>
                   3325: 
                   3326:                 <li>
1.14      xtraeme  3327:                   <p>Adjust <code class=
                   3328:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    3329:                   needs.</p>
                   3330:                 </li>
                   3331: 
                   3332:                 <li>
1.14      xtraeme  3333:                   <p>If you have set <code class=
                   3334:                   "varname">CVS_USER</code> in <code class=
                   3335:                   "filename">build.conf</code>, make sure that
                   3336:                   account exists and can do a <span><strong class=
                   3337:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    3338:                   properly!</p>
                   3339:                 </li>
                   3340:               </ol>
                   3341:             </div>
                   3342: 
                   3343:             <p>When the chroot sandbox is setup, you can start the
                   3344:             build with the following steps:</p>
                   3345:             <pre class="screen">
1.14      xtraeme  3346: <code class="prompt">#</code> <strong class=
                   3347: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   3348: <code class="prompt">#</code> <strong class=
                   3349: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    3350: </pre>
                   3351: 
                   3352:             <p>This will just jump inside the sandbox and start
                   3353:             building. At the end of the build, mail will be sent
                   3354:             with the results of the build. Created binary pkgs will
1.14      xtraeme  3355:             be in <code class=
                   3356:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    3357:             (wherever that points/mounts to/from).</p>
                   3358:           </div>
                   3359: 
                   3360:           <div class="sect2" lang="en" xml:lang="en">
                   3361:             <div class="titlepage">
                   3362:               <div>
                   3363:                 <div>
1.14      xtraeme  3364:                   <h3 class="title"><a name="id2583811" id=
                   3365:                   "id2583811"></a>5.3.7.&nbsp;Building a partial
1.1       grant    3366:                   set of packages</h3>
                   3367:                 </div>
                   3368:               </div>
                   3369:             </div>
                   3370: 
                   3371:             <p>In addition to building a complete set of all
1.14      xtraeme  3372:             packages in pkgsrc, the <code class=
                   3373:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   3374:             used to build a subset of the packages contained in
                   3375:             pkgsrc. By setting defining <code class=
                   3376:             "varname">SPECIFIC_PKGS</code> in <code class=
                   3377:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    3378: 
                   3379:             <div class="itemizedlist">
                   3380:               <ul type="disc">
                   3381:                 <li>
                   3382:                   <p>SITE_SPECIFIC_PKGS</p>
                   3383:                 </li>
                   3384: 
                   3385:                 <li>
                   3386:                   <p>HOST_SPECIFIC_PKGS</p>
                   3387:                 </li>
                   3388: 
                   3389:                 <li>
                   3390:                   <p>GROUP_SPECIFIC_PKGS</p>
                   3391:                 </li>
                   3392: 
                   3393:                 <li>
                   3394:                   <p>USER_SPECIFIC_PKGS</p>
                   3395:                 </li>
                   3396:               </ul>
                   3397:             </div>
                   3398: 
                   3399:             <p>will define the set of packages which should be
                   3400:             built. The bulk build code will also include any
                   3401:             packages which are needed as dependencies for the
                   3402:             explicitly listed packages.</p>
                   3403: 
                   3404:             <p>One use of this is to do a bulk build with
1.14      xtraeme  3405:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    3406:             sandbox periodically to have a complete set of the
                   3407:             binary packages needed for your site available without
                   3408:             the overhead of building extra packages that are not
                   3409:             needed.</p>
                   3410:           </div>
1.13      hubertf  3411: 
                   3412:           <div class="sect2" lang="en" xml:lang="en">
                   3413:             <div class="titlepage">
                   3414:               <div>
                   3415:                 <div>
                   3416:                   <h3 class="title"><a name="bulk-upload" id=
                   3417:                   "bulk-upload"></a>5.3.8.&nbsp;Uploading results
                   3418:                   of a bulk build</h3>
                   3419:                 </div>
                   3420:               </div>
                   3421:             </div>
                   3422: 
                   3423:             <p>This section describes how pkgsrc developers can
                   3424:             upload binary pkgs built by bulk builds to
                   3425:             ftp.NetBSD.org.</p>
                   3426: 
1.14      xtraeme  3427:             <p>First, make sure that you have <code class=
                   3428:             "varname">RSYNC_DST</code> set properly in your
                   3429:             <code class="filename">mk/bulk/build.conf</code> file,
                   3430:             i.e. adjust it to something like one of the
                   3431:             following:</p>
1.13      hubertf  3432:             <pre class="screen">
                   3433: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3434: </pre>
                   3435: 
                   3436:             <p>Please use appropviate values for "pkgsrc-200xQ4",
                   3437:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  3438:             ftp.NetBSD.org is different from <code class=
                   3439:             "varname">CVS_USER</code>, write your login directly
                   3440:             into the variable, e.g. my local account is "feyrer",
                   3441:             but for my login "hubertf", I use:</p>
1.13      hubertf  3442:             <pre class="screen">
                   3443: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3444: </pre>
                   3445: 
1.14      xtraeme  3446:             <p>A separate <code class="filename">upload</code>
1.13      hubertf  3447:             directory is used here to allow "closing" the directory
                   3448:             during upload. To do so, run the following command on
                   3449:             ftp.NetBSD.org next:</p>
                   3450:             <pre class="screen">
1.14      xtraeme  3451: nbftp% <strong class=
                   3452: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  3453: </pre>
                   3454: 
1.14      xtraeme  3455:             <p>Please note that <code class=
                   3456:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  3457:             appropriate for packages for the NetBSD operating
                   3458:             system. Binary packages for other operating systems
1.14      xtraeme  3459:             should go into <code class=
                   3460:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  3461: 
                   3462:             <p>Before uploading the binary pkgs, ssh authentication
                   3463:             needs to be setup next. This example shows how to setup
                   3464:             temporary keys for the root account <span class=
                   3465:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   3466:             that no keys should be present there usually):</p>
                   3467:             <pre class="screen">
1.14      xtraeme  3468: <code class="prompt">#</code> <strong class=
                   3469: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   3470: chroot-<code class="prompt">#</code> <strong class=
                   3471: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   3472: chroot-<code class="prompt">#</code> <strong class=
                   3473: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   3474: chroot-<code class="prompt">#</code> <strong class=
                   3475: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  3476: </pre>
                   3477: 
1.14      xtraeme  3478:             <p>Now take the output of <code class=
                   3479:             "filename">id-dsa.pub</code> and append it to your
                   3480:             <code class="filename">~/.ssh/authorized_keys</code>
                   3481:             file on ftp.netBSD.org. You can remove the key after
                   3482:             the upload is done!</p>
1.13      hubertf  3483: 
                   3484:             <p>Next, test if your ssh connection really works:</p>
                   3485:             <pre class="screen">
1.14      xtraeme  3486: chroot-<code class="prompt">#</code> <strong class=
                   3487: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  3488: </pre>
                   3489: 
                   3490:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   3491: 
                   3492:             <p>Now after all this works, you can exit the sandbox
                   3493:             and start the upload:</p>
                   3494:             <pre class="screen">
1.14      xtraeme  3495: chroot-<code class="prompt">#</code> <strong class=
                   3496: "userinput"><code>exit</code></strong>        
                   3497: <code class="prompt">#</code> <strong class=
                   3498: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   3499: <code class="prompt">#</code> <strong class=
                   3500: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  3501: </pre>
                   3502: 
                   3503:             <p>The upload process may take quite some time. Use
                   3504:             "ls" or "du" on the FTP server to monitor progress of
                   3505:             the upload.</p>
                   3506: 
                   3507:             <p>After the upload has ended, first thing is to revoke
                   3508:             ssh access:</p>
                   3509:             <pre class="screen">
1.14      xtraeme  3510: nbftp% <strong class=
                   3511: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  3512: Gdd:x! 
                   3513: </pre>
                   3514: 
                   3515:             <p>Use whatever is needed to remove the key you've
                   3516:             entered before! Last, move the uploaded packages out of
1.14      xtraeme  3517:             the <code class="filename">upload</code> directory to
                   3518:             have them accessible to everyone:</p>
1.13      hubertf  3519:             <pre class="screen">
1.14      xtraeme  3520: nbftp% <strong class=
                   3521: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   3522: nbftp% <strong class=
                   3523: "userinput"><code>mv upload/* .</code></strong>
                   3524: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   3525: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  3526: </pre>
                   3527:           </div>
1.1       grant    3528:         </div>
                   3529: 
                   3530:         <div class="sect1" lang="en" xml:lang="en">
                   3531:           <div class="titlepage">
                   3532:             <div>
                   3533:               <div>
                   3534:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  3535:                 "id2584227" id="id2584227"></a>5.4.&nbsp;Creating a
1.1       grant    3536:                 multiple CD-ROM packages collection</h2>
                   3537:               </div>
                   3538:             </div>
                   3539:           </div>
                   3540: 
                   3541:           <p>After your pkgsrc bulk-build has completed, you may
                   3542:           wish to create a CD-ROM set of the resulting binary
                   3543:           packages to assist in installing packages on other
                   3544:           machines. The <a xmlns=
                   3545:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3546:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.14      xtraeme  3547:           class="pkgname">pkgtools/cdpack</a> package provides a
                   3548:           simple tool for creating the ISO 9660 images.
                   3549:           <span><strong class="command">cdpack</strong></span>
                   3550:           arranges the packages on the CD-ROMs in a way that keeps
                   3551:           all the dependencies for given package on the same CD as
                   3552:           that package.</p>
1.1       grant    3553: 
                   3554:           <div class="sect2" lang="en" xml:lang="en">
                   3555:             <div class="titlepage">
                   3556:               <div>
                   3557:                 <div>
1.14      xtraeme  3558:                   <h3 class="title"><a name="id2584310" id=
                   3559:                   "id2584310"></a>5.4.1.&nbsp;Example of
1.1       grant    3560:                   cdpack</h3>
                   3561:                 </div>
                   3562:               </div>
                   3563:             </div>
                   3564: 
                   3565:             <p>Complete documentation for cdpack is found in the
                   3566:             cdpack(1) manpage. The following short example assumes
1.14      xtraeme  3567:             that the binary packages are left in <code class=
                   3568:             "filename">/usr/pkgsrc/packages/All</code> and that
                   3569:             sufficient disk space exists in <code class=
                   3570:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    3571:             <pre class="screen">
1.14      xtraeme  3572: <code class="prompt">#</code> <strong class=
                   3573: "userinput"><code>mkdir /u2/images</code></strong>
                   3574: <code class="prompt">#</code> <strong class=
                   3575: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   3576: <code class="prompt">#</code> <strong class=
                   3577: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3578: </pre>
                   3579: 
                   3580:             <p>If you wish to include a common set of files
1.14      xtraeme  3581:             (<code class="filename">COPYRIGHT</code>, <code class=
                   3582:             "filename">README</code>, etc.) on each CD in the
1.1       grant    3583:             collection, then you need to create a directory which
                   3584:             contains these files. e.g.</p>
                   3585:             <pre class="screen">
1.14      xtraeme  3586: <code class="prompt">#</code> <strong class=
                   3587: "userinput"><code>mkdir /tmp/common</code></strong>
                   3588: <code class="prompt">#</code> <strong class=
                   3589: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   3590: <code class="prompt">#</code> <strong class=
                   3591: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   3592: <code class="prompt">#</code> <strong class=
                   3593: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   3594: <code class="prompt">#</code> <strong class=
                   3595: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   3596: <code class="prompt">#</code> <strong class=
                   3597: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   3598: <code class="prompt">#</code> <strong class=
                   3599: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    3600: </pre>
                   3601: 
                   3602:             <p>Now create the images:</p>
                   3603:             <pre class="screen">
1.14      xtraeme  3604: <code class="prompt">#</code> <strong class=
                   3605: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3606: </pre>
                   3607: 
1.14      xtraeme  3608:             <p>Each image will contain <code class=
                   3609:             "filename">README</code>, <code class=
                   3610:             "filename">COPYING</code>, and <code class=
                   3611:             "filename">bin/myscript</code> in their root
1.1       grant    3612:             directories.</p>
                   3613:           </div>
                   3614:         </div>
                   3615:       </div>
                   3616: 
                   3617:       <div class="chapter" lang="en" xml:lang="en">
                   3618:         <div class="titlepage">
                   3619:           <div>
                   3620:             <div>
                   3621:               <h2 class="title"><a name="faq" id=
                   3622:               "faq"></a>Chapter&nbsp;6.&nbsp;Frequently Asked
                   3623:               Questions</h2>
                   3624:             </div>
                   3625:           </div>
                   3626:         </div>
                   3627: 
                   3628:         <div class="toc">
                   3629:           <p><b>Table of Contents</b></p>
                   3630: 
                   3631:           <dl>
1.14      xtraeme  3632:             <dt><span class="sect1"><a href="#id2584502">6.1. Is
1.1       grant    3633:             there a mailing list for pkg-related
                   3634:             discussion?</a></span></dt>
                   3635: 
1.14      xtraeme  3636:             <dt><span class="sect1"><a href="#id2584600">6.2.
1.1       grant    3637:             Where's the pkgviews documentation?</a></span></dt>
                   3638: 
1.5       hubertf  3639:             <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    3640:             Utilities for package management
                   3641:             (pkgtools)</a></span></dt>
                   3642: 
1.14      xtraeme  3643:             <dt><span class="sect1"><a href="#id2584853">6.4. How
1.1       grant    3644:             to use pkgsrc as non-root</a></span></dt>
                   3645: 
1.14      xtraeme  3646:             <dt><span class="sect1"><a href="#id2584865">6.5. How
1.15    ! xtraeme  3647:             to resume transfers when fetching
        !          3648:             distfiles?</a></span></dt>
1.14      xtraeme  3649: 
1.15    ! xtraeme  3650:             <dt><span class="sect1"><a href="#id2584907">6.6. How
1.1       grant    3651:             can I install/use XFree86 from pkgsrc?</a></span></dt>
                   3652: 
1.15    ! xtraeme  3653:             <dt><span class="sect1"><a href="#id2584935">6.7. How
1.1       grant    3654:             can I install/use X.org from pkgsrc?</a></span></dt>
                   3655: 
1.15    ! xtraeme  3656:             <dt><span class="sect1"><a href="#id2584963">6.8. How
1.1       grant    3657:             to fetch files from behind a firewall</a></span></dt>
                   3658: 
1.15    ! xtraeme  3659:             <dt><span class="sect1"><a href="#id2584977">6.9. How
1.14      xtraeme  3660:             do I tell <span><strong class="command">make
                   3661:             fetch</strong></span> to do passive
                   3662:             FTP?</a></span></dt>
1.1       grant    3663: 
1.15    ! xtraeme  3664:             <dt><span class="sect1"><a href="#id2585028">6.10. How
1.1       grant    3665:             to fetch all distfiles at once</a></span></dt>
                   3666: 
1.15    ! xtraeme  3667:             <dt><span class="sect1"><a href="#id2585168">6.11. What
1.14      xtraeme  3668:             does &#8220;<span class="quote">Don't know how to make
                   3669:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    3670:             mean?</a></span></dt>
                   3671: 
1.15    ! xtraeme  3672:             <dt><span class="sect1"><a href="#id2585206">6.12. What
1.14      xtraeme  3673:             does &#8220;<span class="quote">Could not find
                   3674:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    3675: 
1.15    ! xtraeme  3676:             <dt><span class="sect1"><a href="#id2585264">6.13.
1.1       grant    3677:             Using 'sudo' with pkgsrc</a></span></dt>
                   3678: 
1.14      xtraeme  3679:             <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    3680:             Configuration files handling and
                   3681:             placement</a></span></dt>
                   3682: 
1.14      xtraeme  3683:             <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1       grant    3684:             Automated security checks</a></span></dt>
                   3685:           </dl>
                   3686:         </div>
                   3687: 
                   3688:         <p>This section contains hints, tips &amp; tricks on
                   3689:         special things in pkgsrc that we didn't find a better place
                   3690:         for in the previous chapters, and it contains items for
                   3691:         both pkgsrc users and developers.</p>
                   3692: 
                   3693:         <div class="sect1" lang="en" xml:lang="en">
                   3694:           <div class="titlepage">
                   3695:             <div>
                   3696:               <div>
                   3697:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  3698:                 "id2584502" id="id2584502"></a>6.1.&nbsp;Is there a
1.1       grant    3699:                 mailing list for pkg-related discussion?</h2>
                   3700:               </div>
                   3701:             </div>
                   3702:           </div>
                   3703: 
1.14      xtraeme  3704:           <p>Yes, <code class="email">&lt;<a href=
                   3705:           "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>
1.1       grant    3706:           is the list for discussing package related issues. To
                   3707:           subscribe do:</p>
                   3708:           <pre class="programlisting">
1.14      xtraeme  3709: <code class=
                   3710: "prompt">%</code> echo subscribe tech-pkg | mail majordomo@NetBSD.org
1.1       grant    3711: </pre>
                   3712: 
                   3713:           <p>An archive of the list is available at <a href=
                   3714:           "http://mail-index.NetBSD.org/tech-pkg/" target=
                   3715:           "_top">http://mail-index.NetBSD.org/tech-pkg/</a>.</p>
                   3716:         </div>
                   3717: 
                   3718:         <div class="sect1" lang="en" xml:lang="en">
                   3719:           <div class="titlepage">
                   3720:             <div>
                   3721:               <div>
                   3722:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  3723:                 "id2584600" id="id2584600"></a>6.2.&nbsp;Where's
1.1       grant    3724:                 the pkgviews documentation?</h2>
                   3725:               </div>
                   3726:             </div>
                   3727:           </div>
                   3728: 
                   3729:           <p>Pkgviews is tightly integrated with buildlink. You can
1.14      xtraeme  3730:           find a pkgviews User's guide in <code class=
                   3731:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    3732:         </div>
                   3733: 
                   3734:         <div class="sect1" lang="en" xml:lang="en">
                   3735:           <div class="titlepage">
                   3736:             <div>
                   3737:               <div>
                   3738:                 <h2 class="title" style="clear: both"><a name=
1.5       hubertf  3739:                 "faq-pkgtools" id=
                   3740:                 "faq-pkgtools"></a>6.3.&nbsp;Utilities for package
                   3741:                 management (pkgtools)</h2>
1.1       grant    3742:               </div>
                   3743:             </div>
                   3744:           </div>
                   3745: 
1.14      xtraeme  3746:           <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1       grant    3747:           directory pkgtools contains a number of useful utilities
                   3748:           for both users and developers of pkgsrc. This section
                   3749:           attempts only to make the reader aware of the utilities
                   3750:           and when they might be useful, and not to duplicate the
                   3751:           documentation that comes with each package.</p>
                   3752: 
                   3753:           <p>Utilities used by pkgsrc (automatically installed when
                   3754:           needed):</p>
                   3755: 
                   3756:           <div class="itemizedlist">
                   3757:             <ul type="disc">
                   3758:               <li>
                   3759:                 <p><a xmlns=
                   3760:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3761:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.14      xtraeme  3762:                 class="pkgname">pkgtools/x11-links</a>: symlinks
                   3763:                 for use by buildlink</p>
1.1       grant    3764:               </li>
                   3765:             </ul>
                   3766:           </div>
                   3767: 
                   3768:           <p>OS tool augmentation (automatically installed when
                   3769:           needed):</p>
                   3770: 
                   3771:           <div class="itemizedlist">
                   3772:             <ul type="disc">
                   3773:               <li>
                   3774:                 <p><a xmlns=
                   3775:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3776:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.14      xtraeme  3777:                 class="pkgname">pkgtools/digest</a>: calculates
                   3778:                 SHA1 checksums (and other kinds)</p>
1.1       grant    3779:               </li>
                   3780: 
                   3781:               <li>
                   3782:                 <p><a xmlns=
                   3783:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3784:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.14      xtraeme  3785:                 class="pkgname">pkgtools/libnbcompat</a>: compat
                   3786:                 library for pkg tools</p>
1.1       grant    3787:               </li>
                   3788: 
                   3789:               <li>
                   3790:                 <p><a xmlns=
                   3791:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3792:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.14      xtraeme  3793:                 class="pkgname">pkgtools/mtree</a>: installed on
                   3794:                 non-BSD systems due to lack of native mtree</p>
1.1       grant    3795:               </li>
                   3796: 
                   3797:               <li>
                   3798:                 <p><a xmlns=
                   3799:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3800:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14      xtraeme  3801:                 class="pkgname">pkgtools/pkg_install</a>:
                   3802:                 up-to-date replacement for /usr/sbin/pkg_install,
                   3803:                 or for use on operating systems where pkg_install
                   3804:                 is not present</p>
1.1       grant    3805:               </li>
                   3806:             </ul>
                   3807:           </div>
                   3808: 
                   3809:           <p>Utilities used by pkgsrc (not automatically
                   3810:           installed):</p>
                   3811: 
                   3812:           <div class="itemizedlist">
                   3813:             <ul type="disc">
                   3814:               <li>
                   3815:                 <p><a xmlns=
                   3816:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3817:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.14      xtraeme  3818:                 class="pkgname">pkgtools/pkg_tarup</a>: create a
                   3819:                 binary package from an already-installed package.
                   3820:                 used by 'make replace' to save the old package</p>
1.1       grant    3821:               </li>
                   3822: 
                   3823:               <li>
                   3824:                 <p><a xmlns=
                   3825:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  3826:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.14      xtraeme  3827:                 class="pkgname">pkgtools/dfdisk</a>: adds extra
                   3828:                 functionality to pkgsrc, allowing it to fetch
                   3829:                 distfiles from multiple locations. It currently
                   3830:                 supports the following methods: multiple CD-ROMs
                   3831:                 and network FTP/HTTP connections.</p>
1.5       hubertf  3832:               </li>
                   3833: 
                   3834:               <li>
                   3835:                 <p><a xmlns=
                   3836:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    3837:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.14      xtraeme  3838:                 class="pkgname">pkgtools/xpkgwedge</a>: put X11
                   3839:                 packages someplace else (enabled by default)</p>
1.1       grant    3840:               </li>
1.5       hubertf  3841: 
                   3842:               <li>
                   3843:                 <p><a xmlns=
                   3844:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3845:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.14      xtraeme  3846:                 class="pkgname">devel/cpuflags</a>: will determine
                   3847:                 the best compiler flags to optimise code for your
                   3848:                 current CPU and compiler.</p>
1.5       hubertf  3849:               </li>
1.1       grant    3850:             </ul>
                   3851:           </div>
                   3852: 
                   3853:           <p>Utilities for keeping track of installed packages,
                   3854:           being up to date, etc:</p>
                   3855: 
                   3856:           <div class="itemizedlist">
                   3857:             <ul type="disc">
                   3858:               <li>
                   3859:                 <p><a xmlns=
                   3860:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3861:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.14      xtraeme  3862:                 class="pkgname">pkgtools/pkg_chk</a>: installs
                   3863:                 pkg_chk, which reports on packages whose installed
                   3864:                 versions do not match the latest pkgsrc entries</p>
1.1       grant    3865:               </li>
                   3866: 
                   3867:               <li>
                   3868:                 <p><a xmlns=
                   3869:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3870:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.14      xtraeme  3871:                 class="pkgname">pkgtools/pkgdep</a>: makes
                   3872:                 dependency graphs of packages, to aid in choosing a
                   3873:                 strategy for updating</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/pkgdepgraph/README.html"
1.14      xtraeme  3880:                 class="pkgname">pkgtools/pkgdepgraph</a>: make
                   3881:                 graph from above (uses graphviz)</p>
1.1       grant    3882:               </li>
                   3883: 
                   3884:               <li>
                   3885:                 <p><a xmlns=
                   3886:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3887:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14      xtraeme  3888:                 class="pkgname">pkgtools/pkglint</a>: This provides
                   3889:                 two distinct abilities: check a pkgsrc entry for
                   3890:                 correctness (pkglint) check for and remove
                   3891:                 out-of-date distfiles and binary packages
                   3892:                 (lintpkgsrc)</p>
1.1       grant    3893:               </li>
                   3894: 
                   3895:               <li>
                   3896:                 <p><a xmlns=
                   3897:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3898:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.14      xtraeme  3899:                 class="pkgname">pkgtools/pkgsurvey</a>: report what
                   3900:                 packages you have installed</p>
1.1       grant    3901:               </li>
                   3902:             </ul>
                   3903:           </div>
                   3904: 
                   3905:           <p>Utilities for people maintaining or creating
                   3906:           individual packages:</p>
                   3907: 
                   3908:           <div class="itemizedlist">
                   3909:             <ul type="disc">
                   3910:               <li>
                   3911:                 <p><a xmlns=
                   3912:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3913:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14      xtraeme  3914:                 class="pkgname">pkgtools/pkgdiff</a>: automate
                   3915:                 making and maintaining patches for a package
                   3916:                 (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1       grant    3917:               </li>
                   3918: 
                   3919:               <li>
                   3920:                 <p><a xmlns=
                   3921:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3922:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.14      xtraeme  3923:                 class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
                   3924:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3925:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
                   3926:                 class="pkgname">pkgtools/url2pkg</a>: aids in
                   3927:                 converting to pkgsrc</p>
1.1       grant    3928:               </li>
                   3929: 
                   3930:               <li>
                   3931:                 <p><a xmlns=
                   3932:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3933:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.14      xtraeme  3934:                 class="pkgname">pkgtools/gensolpkg</a>: convert
                   3935:                 pkgsrc to a Solaris package</p>
1.1       grant    3936:               </li>
                   3937:             </ul>
                   3938:           </div>
                   3939: 
                   3940:           <p>Utilities for people maintaining pkgsrc (or more
                   3941:           obscure pkg utilities)</p>
                   3942: 
                   3943:           <div class="itemizedlist">
                   3944:             <ul type="disc">
                   3945:               <li>
                   3946:                 <p><a xmlns=
                   3947:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3948:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.14      xtraeme  3949:                 class="pkgname">pkgtools/pkgconflict</a>: find
                   3950:                 packages that conflict but aren't marked as
                   3951:                 such</p>
1.1       grant    3952:               </li>
                   3953: 
                   3954:               <li>
                   3955:                 <p><a xmlns=
                   3956:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3957:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.14      xtraeme  3958:                 class="pkgname">pkgtools/pkg_comp</a>: build
                   3959:                 packages in a chrooted area</p>
1.1       grant    3960:               </li>
                   3961: 
                   3962:               <li>
                   3963:                 <p><a xmlns=
                   3964:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3965:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.14      xtraeme  3966:                 class="pkgname">pkgtools/libkver</a>: spoof kernel
                   3967:                 version for chrooted cross builds</p>
1.1       grant    3968:               </li>
                   3969:             </ul>
                   3970:           </div>
                   3971:         </div>
                   3972: 
                   3973:         <div class="sect1" lang="en" xml:lang="en">
                   3974:           <div class="titlepage">
                   3975:             <div>
                   3976:               <div>
                   3977:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  3978:                 "id2584853" id="id2584853"></a>6.4.&nbsp;How to use
1.1       grant    3979:                 pkgsrc as non-root</h2>
                   3980:               </div>
                   3981:             </div>
                   3982:           </div>
                   3983: 
                   3984:           <p>If you want to use pkgsrc as non-root user, you can
                   3985:           set some variables to make pkgsrc work under these
                   3986:           conditions. Please see <a href=
                   3987:           "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.14      xtraeme  3988:           target="_top">this message</a> for more details.</p>
                   3989:         </div>
                   3990: 
                   3991:         <div class="sect1" lang="en" xml:lang="en">
                   3992:           <div class="titlepage">
                   3993:             <div>
                   3994:               <div>
                   3995:                 <h2 class="title" style="clear: both"><a name=
                   3996:                 "id2584865" id="id2584865"></a>6.5.&nbsp;How to
1.15    ! xtraeme  3997:                 resume transfers when fetching distfiles?</h2>
1.14      xtraeme  3998:               </div>
                   3999:             </div>
                   4000:           </div>
                   4001: 
1.15    ! xtraeme  4002:           <p>By default resuming transfers in pkgsrc is disabled,
        !          4003:           but you can enable this feature by adding the option
        !          4004:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
        !          4005:           into <code class="filename">/etc/mk.conf</code>. If,
        !          4006:           during a fetch step, an incomplete distfile is found,
        !          4007:           pkgsrc will try to resume it.</p>
        !          4008: 
        !          4009:           <p>You can also use a different program than the default
        !          4010:           ftp(1) by changing the <code class=
        !          4011:           "varname">FETCH_CMD</code> variable. Don't forget to set
        !          4012:           <code class="varname">FETCH_RESUME_ARGS</code> and
        !          4013:           <code class="varname">FETCH_OUTPUT_ARGS</code> if you are
        !          4014:           not using default values.</p>
1.14      xtraeme  4015: 
                   4016:           <p>For example, if you want to use <code class=
                   4017:           "filename">wget</code> to resume downloads, you'll have
                   4018:           to use something like:</p>
                   4019:           <pre class="programlisting">
                   4020:         FETCH_CMD=wget
                   4021:         .if defined(FETCH_CMD) &amp;&amp; ${FETCH_CMD} == "wget"
                   4022:         FETCH_BEFORE_ARGS=--passive-ftp
                   4023:         FETCH_RESUME_ARGS=-c
                   4024:         FETCH_OUTPUT_ARGS=-O
                   4025:         .endif
                   4026:     
                   4027: </pre>
1.1       grant    4028:         </div>
                   4029: 
                   4030:         <div class="sect1" lang="en" xml:lang="en">
                   4031:           <div class="titlepage">
                   4032:             <div>
                   4033:               <div>
                   4034:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  4035:                 "id2584907" id="id2584907"></a>6.6.&nbsp;How can I
1.1       grant    4036:                 install/use XFree86 from pkgsrc?</h2>
                   4037:               </div>
                   4038:             </div>
                   4039:           </div>
                   4040: 
                   4041:           <p>If you want to use XFree86 from pkgsrc instead of your
1.14      xtraeme  4042:           system's own X11 (<code class=
                   4043:           "filename">/usr/X11R6</code>, <code class=
                   4044:           "filename">/usr/openwin</code>, ...), you will have to
                   4045:           add the following line into <code class=
1.15    ! xtraeme  4046:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4047:           <pre class="programlisting">
                   4048:       X11_TYPE=XFree86
                   4049:     
                   4050: </pre>
                   4051:         </div>
                   4052: 
                   4053:         <div class="sect1" lang="en" xml:lang="en">
                   4054:           <div class="titlepage">
                   4055:             <div>
                   4056:               <div>
                   4057:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  4058:                 "id2584935" id="id2584935"></a>6.7.&nbsp;How can I
1.1       grant    4059:                 install/use X.org from pkgsrc?</h2>
                   4060:               </div>
                   4061:             </div>
                   4062:           </div>
                   4063: 
                   4064:           <p>If you want to use X.org from pkgsrc instead of your
1.14      xtraeme  4065:           system's own X11 (<code class=
                   4066:           "filename">/usr/X11R6</code>, <code class=
                   4067:           "filename">/usr/openwin</code>, ...) you will have to add
                   4068:           the following line into <code class=
1.15    ! xtraeme  4069:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4070:           <pre class="programlisting">
                   4071:       X11_TYPE=xorg
                   4072:     
                   4073: </pre>
                   4074:         </div>
                   4075: 
                   4076:         <div class="sect1" lang="en" xml:lang="en">
                   4077:           <div class="titlepage">
                   4078:             <div>
                   4079:               <div>
                   4080:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  4081:                 "id2584963" id="id2584963"></a>6.8.&nbsp;How to
1.1       grant    4082:                 fetch files from behind a firewall</h2>
                   4083:               </div>
                   4084:             </div>
                   4085:           </div>
                   4086: 
                   4087:           <p>If you are sitting behind a firewall which does not
                   4088:           allow direct connections to Internet hosts (i.e.
                   4089:           non-NAT), you may specify the relevant proxy hosts. This
                   4090:           is done using an environment variable in the form of a
                   4091:           URL e.g. in Amdahl, the machine &#8220;<span class=
                   4092:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   4093:           firewalls, and it uses port 80 as the proxy port number.
                   4094:           So the proxy environment variables are:</p>
                   4095:           <pre class="programlisting">
                   4096:   ftp_proxy=ftp://orpheus.amdahl.com:80/
                   4097: http_proxy=http://orpheus.amdahl.com:80/
                   4098: </pre>
                   4099:         </div>
                   4100: 
                   4101:         <div class="sect1" lang="en" xml:lang="en">
                   4102:           <div class="titlepage">
                   4103:             <div>
                   4104:               <div>
                   4105:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  4106:                 "id2584977" id="id2584977"></a>6.9.&nbsp;How do I
1.14      xtraeme  4107:                 tell <span><strong class="command">make
                   4108:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    4109:               </div>
                   4110:             </div>
                   4111:           </div>
                   4112: 
                   4113:           <p>This depends on which utility is used to retrieve
1.14      xtraeme  4114:           distfiles. From <code class="filename">bsd.pkg.mk</code>,
                   4115:           <code class="varname">FETCH_CMD</code> is assigned the
                   4116:           first available command from the following list:</p>
1.1       grant    4117:           <pre class="programlisting">
                   4118: ${LOCALBASE}/bin/ftp
                   4119: /usr/bin/ftp
                   4120: </pre>
                   4121: 
                   4122:           <p>On a default NetBSD installation, this will be
1.14      xtraeme  4123:           <code class="filename">/usr/bin/ftp</code>, which
1.1       grant    4124:           automatically tries passive connections first, and falls
                   4125:           back to active connections if the server refuses to do
                   4126:           passive. For the other tools, add the following to your
1.14      xtraeme  4127:           <code class="filename">/etc/mk.conf</code> file:
                   4128:           <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    4129: 
1.14      xtraeme  4130:           <p>Having that option present will prevent <code class=
                   4131:           "filename">/usr/bin/ftp</code> from falling back to
                   4132:           active transfers.</p>
1.1       grant    4133:         </div>
                   4134: 
                   4135:         <div class="sect1" lang="en" xml:lang="en">
                   4136:           <div class="titlepage">
                   4137:             <div>
                   4138:               <div>
                   4139:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  4140:                 "id2585028" id="id2585028"></a>6.10.&nbsp;How to
1.1       grant    4141:                 fetch all distfiles at once</h2>
                   4142:               </div>
                   4143:             </div>
                   4144:           </div>
                   4145: 
                   4146:           <p>You would like to download all the distfiles in a
                   4147:           single batch from work or university, where you can't run
1.14      xtraeme  4148:           a <span><strong class="command">make
                   4149:           fetch</strong></span>. There is an archive of distfiles
                   4150:           on <a href=
1.1       grant    4151:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   4152:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   4153:           entire directory may not be appropriate.</p>
                   4154: 
1.14      xtraeme  4155:           <p>The answer here is to do a <span><strong class=
                   4156:           "command">make fetch-list</strong></span> in <code class=
                   4157:           "filename">/usr/pkgsrc</code> or one of it's
1.1       grant    4158:           subdirectories, carry the resulting list to your machine
                   4159:           at work/school and use it there If you don't have a
                   4160:           NetBSD-compatible ftp(1) (like lukemftp) at work, don't
1.14      xtraeme  4161:           forget to set <code class="varname">FETCH_CMD</code> to
1.1       grant    4162:           something that fetches a URL:</p>
                   4163: 
                   4164:           <p>At home:</p>
                   4165:           <pre class="screen">
1.14      xtraeme  4166: <code class="prompt">%</code> <strong class=
                   4167: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4168: <code class="prompt">%</code> <strong class=
                   4169: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   4170: <code class="prompt">%</code> <strong class=
                   4171: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    4172: </pre>
                   4173: 
                   4174:           <p>At work:</p>
                   4175:           <pre class="screen">
1.14      xtraeme  4176: <code class="prompt">%</code> <strong class=
                   4177: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    4178: </pre>
                   4179: 
1.14      xtraeme  4180:           <p>then tar up <code class=
                   4181:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    4182: 
                   4183:           <p>If you have a machine running NetBSD, and you want to
                   4184:           get <span class="emphasis"><em>all</em></span> distfiles
                   4185:           (even ones that aren't for your machine architecture),
                   4186:           you can do so by using the above-mentioned
1.14      xtraeme  4187:           <span><strong class="command">make
                   4188:           fetch-list</strong></span> approach, or fetch the
                   4189:           distfiles directly by running:</p>
1.1       grant    4190:           <pre class="screen">
1.14      xtraeme  4191: <code class="prompt">%</code> <strong class=
                   4192: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    4193: </pre>
                   4194: 
1.14      xtraeme  4195:           <p>If you even decide to ignore <code class=
                   4196:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   4197:           can get everything by running:</p>
1.1       grant    4198:           <pre class="screen">
1.14      xtraeme  4199: <code class="prompt">%</code> <strong class=
                   4200: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    4201: </pre>
                   4202:         </div>
                   4203: 
                   4204:         <div class="sect1" lang="en" xml:lang="en">
                   4205:           <div class="titlepage">
                   4206:             <div>
                   4207:               <div>
                   4208:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  4209:                 "id2585168" id="id2585168"></a>6.11.&nbsp;What does
1.1       grant    4210:                 &#8220;<span class="quote">Don't know how to make
                   4211:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   4212:               </div>
                   4213:             </div>
                   4214:           </div>
                   4215: 
                   4216:           <p>When compiling the <a xmlns=
                   4217:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4218:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14      xtraeme  4219:           class="pkgname">pkgtools/pkg_install</a> package, you get
                   4220:           the error from make that it doesn't know how to make
                   4221:           <code class="filename">/usr/share/tmac/tmac.andoc</code>?
                   4222:           This indicates that you don't have installed the
                   4223:           &#8220;<span class="quote">text</span>&#8221; set on your
                   4224:           machine (nroff, ...). It is recommended to do that to
                   4225:           format manpages.</p>
1.1       grant    4226: 
                   4227:           <p>In the case of the <a xmlns=
                   4228:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4229:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14      xtraeme  4230:           class="pkgname">pkgtools/pkg_install</a> package, you can
                   4231:           get away with setting <code class=
                   4232:           "varname">NOMAN=YES</code> either in the environment or
                   4233:           in <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    4234:         </div>
                   4235: 
                   4236:         <div class="sect1" lang="en" xml:lang="en">
                   4237:           <div class="titlepage">
                   4238:             <div>
                   4239:               <div>
                   4240:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  4241:                 "id2585206" id="id2585206"></a>6.12.&nbsp;What does
1.1       grant    4242:                 &#8220;<span class="quote">Could not find
                   4243:                 bsd.own.mk</span>&#8221; mean?</h2>
                   4244:               </div>
                   4245:             </div>
                   4246:           </div>
                   4247: 
1.14      xtraeme  4248:           <p>You didn't install the compiler set, <code class=
                   4249:           "filename">comp.tgz</code>, when you installed your
                   4250:           NetBSD machine. Please get it and install it, by
                   4251:           extracting it in <code class="filename">/</code>:</p>
1.1       grant    4252:           <pre class="screen">
1.14      xtraeme  4253: <code class="prompt">#</code> <strong class=
                   4254: "userinput"><code>cd /</code></strong>
                   4255: <code class="prompt">#</code> <strong class=
                   4256: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    4257: </pre>
                   4258: 
1.14      xtraeme  4259:           <p><code class="filename">comp.tgz</code> is part of
                   4260:           every NetBSD release. Get the one that corresponds to
                   4261:           your release (determine via <span><strong class=
                   4262:           "command">uname -r</strong></span>).</p>
1.1       grant    4263:         </div>
                   4264: 
                   4265:         <div class="sect1" lang="en" xml:lang="en">
                   4266:           <div class="titlepage">
                   4267:             <div>
                   4268:               <div>
                   4269:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  4270:                 "id2585264" id="id2585264"></a>6.13.&nbsp;Using
1.1       grant    4271:                 'sudo' with pkgsrc</h2>
                   4272:               </div>
                   4273:             </div>
                   4274:           </div>
                   4275: 
                   4276:           <p>When installing packages as non-root user and using
                   4277:           the just-in-time su(1) feature of pkgsrc, it can become
                   4278:           annoying to type in the root password for each required
                   4279:           package installed. To avoid this, the sudo package can be
                   4280:           used, which does password caching over a limited time. To
                   4281:           use it, install sudo (either as binary package or from
                   4282:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   4283:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.14      xtraeme  4284:           class="pkgname">security/sudo</a>) and then put the
                   4285:           following into your <code class=
                   4286:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4287:           <pre class="programlisting">
                   4288:         .if exists(/usr/pkg/bin/sudo)
                   4289:         SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
                   4290:         .endif
                   4291:     
                   4292: </pre>
                   4293:         </div>
                   4294: 
                   4295:         <div class="sect1" lang="en" xml:lang="en">
                   4296:           <div class="titlepage">
                   4297:             <div>
                   4298:               <div>
                   4299:                 <h2 class="title" style="clear: both"><a name=
                   4300:                 "faq.conf" id=
1.14      xtraeme  4301:                 "faq.conf"></a>6.14.&nbsp;Configuration files
1.1       grant    4302:                 handling and placement</h2>
                   4303:               </div>
                   4304:             </div>
                   4305:           </div>
                   4306: 
1.14      xtraeme  4307:           <p>The global variable <code class=
                   4308:           "varname">PKG_SYSCONFBASE</code> (and some others) can be
                   4309:           set by the system administrator in <code class=
                   4310:           "filename">/etc/mk.conf</code> to define the place where
1.1       grant    4311:           configuration files get installed. Therefore, packages
                   4312:           must be adapted to support this feature. Keep in mind
                   4313:           that you should only install files that are strictly
                   4314:           necessary in the configuration directory, files that can
1.14      xtraeme  4315:           go to <code class="filename">$PREFIX/share</code> should
                   4316:           go there.</p>
1.1       grant    4317: 
                   4318:           <p>We will take a look at available variables first
1.14      xtraeme  4319:           (<code class="filename">bsd.pkg.mk</code> contains more
                   4320:           information). <code class="varname">PKG_SYSCONFDIR</code>
                   4321:           is where the configuration files for a package may be
                   4322:           found (that is, the full path, e.g. <code class=
                   4323:           "filename">/etc</code> or <code class=
                   4324:           "filename">/usr/pkg/etc</code>). This value may be
1.1       grant    4325:           customized in various ways:</p>
                   4326: 
                   4327:           <div class="orderedlist">
                   4328:             <ol type="1">
                   4329:               <li>
1.14      xtraeme  4330:                 <p><code class="varname">PKG_SYSCONFBASE</code> is
                   4331:                 the main config directory under which all package
1.1       grant    4332:                 configuration files are to be found. Users will
1.14      xtraeme  4333:                 typically want to set it to <code class=
                   4334:                 "filename">/etc</code>, or accept the default
                   4335:                 location of <code class=
                   4336:                 "filename">$PREFIX/etc</code>.</p>
1.1       grant    4337:               </li>
                   4338: 
                   4339:               <li>
1.14      xtraeme  4340:                 <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   4341:                 is the subdirectory of <code class=
                   4342:                 "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    4343:                 configuration files for a particular package may be
1.14      xtraeme  4344:                 found. Defaults to <code class=
                   4345:                 "varname">${SYSCONFBASE}</code>.</p>
1.1       grant    4346:               </li>
                   4347: 
                   4348:               <li>
1.14      xtraeme  4349:                 <p><code class="varname">PKG_SYSCONFVAR</code> is
                   4350:                 the special suffix used to distinguish any
                   4351:                 overriding values for a particular package (see
                   4352:                 next item). It defaults to <code class=
                   4353:                 "varname">${PKGBASE}</code>, but for a collection
                   4354:                 of related packages that should all have the same
                   4355:                 <code class="varname">PKG_SYSCONFDIR</code> value,
                   4356:                 it can be set in each of the package Makefiles to a
                   4357:                 common value.</p>
1.1       grant    4358:               </li>
                   4359: 
                   4360:               <li>
1.14      xtraeme  4361:                 <p><code class=
                   4362:                 "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   4363:                 overrides the value of <code class=
                   4364:                 "varname">${PKG_SYSCONFDIR}</code> for packages
                   4365:                 with the same value for <code class=
                   4366:                 "varname">PKG_SYSCONFVAR</code>.</p>
1.1       grant    4367: 
                   4368:                 <p>As an example, all the various KDE packages may
1.14      xtraeme  4369:                 want to set <code class=
                   4370:                 "varname">PKG_SYSCONFVAR</code> to
                   4371:                 &#8220;<span class="quote">kde</span>&#8221; so
                   4372:                 admins can set <code class=
                   4373:                 "varname">PKG_SYSCONFDIR.kde</code> in <code class=
                   4374:                 "filename">/etc/mk.conf</code> to define where to
1.1       grant    4375:                 install KDE config files.</p>
                   4376:               </li>
                   4377:             </ol>
                   4378:           </div>
                   4379: 
                   4380:           <p>Programs' configuration directory should be defined
                   4381:           during the configure stage. Packages that use GNU
                   4382:           autoconf can usually do this by using the
                   4383:           &#8220;<span class="quote">--sysconfdir</span>&#8221;
                   4384:           parameter, but this brings some problems as we will see
                   4385:           now. When you change this pathname in packages, you
                   4386:           should not allow them to install files in that directory
                   4387:           directly. Instead they need to install those files under
1.14      xtraeme  4388:           <code class="filename">share/examples/${PKGNAME}</code>
                   4389:           so <code class="filename">PLIST</code> can register
                   4390:           them.</p>
1.1       grant    4391: 
                   4392:           <p>Once you have the required configuration files in
1.14      xtraeme  4393:           place (under the <code class=
                   4394:           "filename">share/examples</code> directory) the variable
                   4395:           <code class="varname">CONF_FILES</code> should be set to
                   4396:           copy them into <code class=
                   4397:           "varname">PKG_SYSCONFDIR</code>. The contents of this
                   4398:           variable is formed by pairs of filenames; the first
1.1       grant    4399:           element of the pair specifies the file inside the
1.14      xtraeme  4400:           examples directory (registered by <code class=
                   4401:           "filename">PLIST</code>) and the second element specifies
1.1       grant    4402:           the target file. This is done this way to allow binary
                   4403:           packages to place files in the right directory using
1.14      xtraeme  4404:           <code class="filename">INSTALL</code>/<code class=
                   4405:           "filename">DEINSTALL</code> scripts which are created
                   4406:           automatically. The package <code class=
                   4407:           "filename">Makefile</code> must also set <code class=
                   4408:           "varname">USE_PKGINSTALL=YES</code> to use these
1.1       grant    4409:           automatically generated scripts. The automatic copying of
                   4410:           config files can be toggled by setting the environment
1.14      xtraeme  4411:           variable <code class="varname">PKG_CONFIG</code> prior to
1.1       grant    4412:           package installation.</p>
                   4413: 
                   4414:           <p>Here is an example, taken from mail/mutt/Makefile:</p>
                   4415:           <pre class="programlisting">
                   4416:   EGDIR=            ${PREFIX}/share/doc/mutt/samples
                   4417: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   4418: </pre>
                   4419: 
                   4420:           <p>As you can see, this package installs configuration
1.14      xtraeme  4421:           files inside <code class="varname">EGDIR</code>, which
                   4422:           are registered by <code class="filename">PLIST</code>.
                   4423:           After that, the variable <code class=
                   4424:           "varname">CONF_FILES</code> lists the installed file
                   4425:           first and then the target file. Users will also get an
                   4426:           automatic message when files are installed using this
                   4427:           method.</p>
1.1       grant    4428:         </div>
                   4429: 
                   4430:         <div class="sect1" lang="en" xml:lang="en">
                   4431:           <div class="titlepage">
                   4432:             <div>
                   4433:               <div>
                   4434:                 <h2 class="title" style="clear: both"><a name=
                   4435:                 "audit-packages" id=
1.14      xtraeme  4436:                 "audit-packages"></a>6.15.&nbsp;Automated security
1.1       grant    4437:                 checks</h2>
                   4438:               </div>
                   4439:             </div>
                   4440:           </div>
                   4441: 
                   4442:           <p>Please be aware that there can often be bugs in
                   4443:           third-party software, and some of these bugs can leave a
                   4444:           machine vulnerable to exploitation by attackers. In an
                   4445:           effort to lessen the exposure, the NetBSD packages team
                   4446:           maintains a database of known-exploits to packages which
                   4447:           have at one time been included in pkgsrc. The database
                   4448:           can be downloaded automatically, and a security audit of
                   4449:           all packages installed on a system can take place. To do
                   4450:           this, install the <a xmlns=
                   4451:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4452:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.14      xtraeme  4453:           class="pkgname">security/audit-packages</a> package. It
                   4454:           has two components:</p>
1.1       grant    4455: 
                   4456:           <div class="orderedlist">
                   4457:             <ol type="1">
                   4458:               <li>
                   4459:                 <p>&#8220;<span class=
                   4460:                 "quote">download-vulnerability-list</span>&#8221;,
                   4461:                 an easy way to download a list of the security
                   4462:                 vulnerabilities information. This list is kept up
                   4463:                 to date by the NetBSD security officer and the
                   4464:                 NetBSD packages team, and is distributed from the
                   4465:                 NetBSD ftp server:</p>
                   4466: 
                   4467:                 <p><a href=
                   4468:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.14      xtraeme  4469:                 target=
                   4470:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    4471:               </li>
                   4472: 
                   4473:               <li>
                   4474:                 <p>&#8220;<span class=
                   4475:                 "quote">audit-packages</span>&#8221;, an easy way
                   4476:                 to audit the current machine, checking each
                   4477:                 vulnerability which is known. If a vulnerable
                   4478:                 package is installed, it will be shown by output to
                   4479:                 stdout, including a description of the type of
                   4480:                 vulnerability, and a URL containing more
                   4481:                 information.</p>
                   4482:               </li>
                   4483:             </ol>
                   4484:           </div>
                   4485: 
                   4486:           <p>Use of the audit-packages package is strongly
                   4487:           recommended!</p>
                   4488: 
                   4489:           <p>The following message is displayed as part of the
                   4490:           audit-packages installation procedure:</p>
                   4491:           <pre class="screen">
                   4492: ===========================================================================
1.15    ! xtraeme  4493: $NetBSD: faq.xml,v 1.4 2005/01/11 16:05:20 wiz Exp $
1.1       grant    4494: 
                   4495: You may wish to have the vulnerabilities file downloaded daily so that
                   4496: it remains current.  This may be done by adding an appropriate entry
                   4497: to the root users crontab(5) entry.  For example the entry
                   4498: 
                   4499: # download vulnerabilities file
                   4500: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list &gt;/dev/null 2&gt;&amp;1
                   4501: 
                   4502: will update the vulnerability list every day at 3AM. You may wish to do
                   4503: this more often than once a day.
                   4504: 
                   4505: In addition, you may wish to run the package audit from the daily
                   4506: security script.  This may be accomplished by adding the following
                   4507: lines to /etc/security.local
                   4508: 
                   4509: if [ -x ${PREFIX}/sbin/audit-packages ]; then
                   4510:           ${PREFIX}/sbin/audit-packages
                   4511: fi
                   4512: 
                   4513: ===========================================================================
                   4514:     
                   4515: </pre>
                   4516:         </div>
                   4517:       </div>
                   4518:     </div>
                   4519: 
                   4520:     <div class="part" lang="en" xml:lang="en">
                   4521:       <div class="titlepage">
                   4522:         <div>
                   4523:           <div>
                   4524:             <h1 class="title"><a name="developers-guide" id=
1.2       hubertf  4525:             "developers-guide"></a>The pkgsrc developer's
                   4526:             guide</h1>
1.1       grant    4527:           </div>
                   4528:         </div>
                   4529:       </div>
                   4530: 
                   4531:       <div class="toc">
                   4532:         <p><b>Table of Contents</b></p>
                   4533: 
                   4534:         <dl>
                   4535:           <dt><span class="chapter"><a href="#components">7.
                   4536:           Package components - files, directories and
                   4537:           contents</a></span></dt>
                   4538: 
                   4539:           <dd>
                   4540:             <dl>
                   4541:               <dt><span class="sect1"><a href=
1.14      xtraeme  4542:               "#components.Makefile">7.1. <code class=
                   4543:               "filename">Makefile</code></a></span></dt>
1.1       grant    4544: 
                   4545:               <dt><span class="sect1"><a href=
1.14      xtraeme  4546:               "#components.distinfo">7.2. <code class=
                   4547:               "filename">distinfo</code></a></span></dt>
1.1       grant    4548: 
                   4549:               <dt><span class="sect1"><a href=
                   4550:               "#components.patches">7.3. patches/*</a></span></dt>
                   4551: 
1.15    ! xtraeme  4552:               <dt><span class="sect1"><a href="#id2586445">7.4.
1.1       grant    4553:               Other mandatory files</a></span></dt>
                   4554: 
                   4555:               <dt><span class="sect1"><a href=
                   4556:               "#components.optional">7.5. Optional
                   4557:               files</a></span></dt>
                   4558: 
1.15    ! xtraeme  4559:               <dt><span class="sect1"><a href="#id2586640">7.6.
1.14      xtraeme  4560:               <code class="filename">work*</code></a></span></dt>
1.1       grant    4561: 
1.15    ! xtraeme  4562:               <dt><span class="sect1"><a href="#id2586727">7.7.
1.14      xtraeme  4563:               <code class="filename">files/*</code></a></span></dt>
1.1       grant    4564:             </dl>
                   4565:           </dd>
                   4566: 
                   4567:           <dt><span class="chapter"><a href="#plist">8. PLIST
                   4568:           issues</a></span></dt>
                   4569: 
                   4570:           <dd>
                   4571:             <dl>
1.15    ! xtraeme  4572:               <dt><span class="sect1"><a href="#id2586781">8.1. RCS
1.1       grant    4573:               ID</a></span></dt>
                   4574: 
1.15    ! xtraeme  4575:               <dt><span class="sect1"><a href="#id2586796">8.2.
1.14      xtraeme  4576:               Semi-automatic <code class="filename">PLIST</code>
                   4577:               generation</a></span></dt>
1.1       grant    4578: 
                   4579:               <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme  4580:               Tweaking output of <span><strong class="command">make
                   4581:               print-PLIST</strong></span></a></span></dt>
1.1       grant    4582: 
                   4583:               <dt><span class="sect1"><a href="#plist.misc">8.4.
                   4584:               Variable substitution in PLIST</a></span></dt>
                   4585: 
1.15    ! xtraeme  4586:               <dt><span class="sect1"><a href="#id2587186">8.5.
1.1       grant    4587:               Manpage-compression</a></span></dt>
                   4588: 
1.15    ! xtraeme  4589:               <dt><span class="sect1"><a href="#id2587227">8.6.
1.14      xtraeme  4590:               Changing PLIST source with <code class=
                   4591:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    4592: 
1.15    ! xtraeme  4593:               <dt><span class="sect1"><a href="#id2587244">8.7.
1.1       grant    4594:               Platform specific and differing
                   4595:               PLISTs</a></span></dt>
                   4596: 
                   4597:               <dt><span class="sect1"><a href=
                   4598:               "#faq.common-dirs">8.8. Sharing directories between
                   4599:               packages</a></span></dt>
                   4600:             </dl>
                   4601:           </dd>
                   4602: 
                   4603:           <dt><span class="chapter"><a href="#buildlink">9.
                   4604:           Buildlink methodology</a></span></dt>
                   4605: 
                   4606:           <dd>
                   4607:             <dl>
1.15    ! xtraeme  4608:               <dt><span class="sect1"><a href="#id2587653">9.1.
1.1       grant    4609:               Converting packages to use buildlink3</a></span></dt>
                   4610: 
1.15    ! xtraeme  4611:               <dt><span class="sect1"><a href="#id2587844">9.2.
1.14      xtraeme  4612:               Writing <code class="filename">buildlink3.mk</code>
                   4613:               files</a></span></dt>
1.1       grant    4614: 
                   4615:               <dd>
                   4616:                 <dl>
                   4617:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4618:                   "#id2587913">9.2.1. Anatomy of a buildlink3.mk
1.1       grant    4619:                   file</a></span></dt>
                   4620: 
                   4621:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4622:                   "#id2588354">9.2.2. Updating <code class=
1.14      xtraeme  4623:                   "varname">BUILDLINK_DEPENDS.<em class=
                   4624:                   "replaceable"><code>pkg</code></em></code> in
                   4625:                   <code class="filename">buildlink3.mk</code>
1.1       grant    4626:                   files</a></span></dt>
                   4627:                 </dl>
                   4628:               </dd>
                   4629: 
1.15    ! xtraeme  4630:               <dt><span class="sect1"><a href="#id2588433">9.3.
1.14      xtraeme  4631:               Writing <code class="filename">builtin.mk</code>
                   4632:               files</a></span></dt>
1.1       grant    4633: 
                   4634:               <dd>
                   4635:                 <dl>
                   4636:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4637:                   "#id2588582">9.3.1. Anatomy of a <code class=
1.14      xtraeme  4638:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    4639: 
                   4640:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4641:                   "#id2588877">9.3.2. Global preferences for native
1.1       grant    4642:                   or pkgsrc software</a></span></dt>
                   4643:                 </dl>
                   4644:               </dd>
                   4645:             </dl>
                   4646:           </dd>
                   4647: 
                   4648:           <dt><span class="chapter"><a href="#options">10. Options
                   4649:           handling</a></span></dt>
                   4650: 
                   4651:           <dd>
                   4652:             <dl>
1.15    ! xtraeme  4653:               <dt><span class="sect1"><a href="#id2588950">10.1.
1.1       grant    4654:               Global default options</a></span></dt>
                   4655: 
1.15    ! xtraeme  4656:               <dt><span class="sect1"><a href="#id2588965">10.2.
1.14      xtraeme  4657:               Converting packages to use <code class=
                   4658:               "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    4659:             </dl>
                   4660:           </dd>
                   4661: 
                   4662:           <dt><span class="chapter"><a href="#build">11. The build
                   4663:           process</a></span></dt>
                   4664: 
                   4665:           <dd>
                   4666:             <dl>
                   4667:               <dt><span class="sect1"><a href="#build.prefix">11.1.
                   4668:               Program location</a></span></dt>
                   4669: 
1.15    ! xtraeme  4670:               <dt><span class="sect1"><a href="#id2589573">11.2.
1.1       grant    4671:               Main targets</a></span></dt>
                   4672: 
                   4673:               <dt><span class="sect1"><a href=
                   4674:               "#build.helpful-targets">11.3. Other helpful
                   4675:               targets</a></span></dt>
                   4676:             </dl>
                   4677:           </dd>
                   4678: 
                   4679:           <dt><span class="chapter"><a href="#fixes">12. Notes on
                   4680:           fixes for packages</a></span></dt>
                   4681: 
                   4682:           <dd>
                   4683:             <dl>
1.15    ! xtraeme  4684:               <dt><span class="sect1"><a href="#id2590973">12.1.
1.1       grant    4685:               General operation</a></span></dt>
                   4686: 
                   4687:               <dd>
                   4688:                 <dl>
                   4689:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4690:                   "#id2590977">12.1.1. How to pull in variables
1.1       grant    4691:                   from /etc/mk.conf</a></span></dt>
                   4692: 
                   4693:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4694:                   "#id2591128">12.1.2. Restricted
1.1       grant    4695:                   packages</a></span></dt>
                   4696: 
                   4697:                   <dt><span class="sect2"><a href=
                   4698:                   "#dependencies">12.1.3. Handling
                   4699:                   dependencies</a></span></dt>
                   4700: 
                   4701:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4702:                   "#id2591643">12.1.4. Handling conflicts with
1.1       grant    4703:                   other packages</a></span></dt>
                   4704: 
                   4705:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4706:                   "#id2591762">12.1.5. Packages that cannot or
1.1       grant    4707:                   should not be built</a></span></dt>
                   4708: 
                   4709:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4710:                   "#id2591787">12.1.6. Packages which should not be
1.1       grant    4711:                   deleted, once installed</a></span></dt>
                   4712: 
                   4713:                   <dt><span class="sect2"><a href=
                   4714:                   "#security-handling">12.1.7. Handling packages
                   4715:                   with security problems</a></span></dt>
                   4716: 
                   4717:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4718:                   "#id2591879">12.1.8. How to handle compiler
1.1       grant    4719:                   bugs</a></span></dt>
                   4720: 
                   4721:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4722:                   "#id2591901">12.1.9. How to handle incrementing
1.1       grant    4723:                   versions when fixing an existing
                   4724:                   package</a></span></dt>
                   4725: 
                   4726:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4727:                   "#id2591950">12.1.10. Portability of
1.1       grant    4728:                   packages</a></span></dt>
                   4729:                 </dl>
                   4730:               </dd>
                   4731: 
1.15    ! xtraeme  4732:               <dt><span class="sect1"><a href="#id2591975">12.2.
1.1       grant    4733:               Possible downloading issues</a></span></dt>
                   4734: 
                   4735:               <dd>
                   4736:                 <dl>
                   4737:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4738:                   "#id2591978">12.2.1. Packages whose distfiles
1.1       grant    4739:                   aren't available for plain
                   4740:                   downloading</a></span></dt>
                   4741: 
                   4742:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4743:                   "#id2592109">12.2.2. How to handle modified
1.1       grant    4744:                   distfiles with the 'old' name</a></span></dt>
                   4745:                 </dl>
                   4746:               </dd>
                   4747: 
1.15    ! xtraeme  4748:               <dt><span class="sect1"><a href="#id2592121">12.3.
1.1       grant    4749:               Configuration gotchas</a></span></dt>
                   4750: 
                   4751:               <dd>
                   4752:                 <dl>
                   4753:                   <dt><span class="sect2"><a href=
                   4754:                   "#fixes.libtool">12.3.1. Shared libraries -
                   4755:                   libtool</a></span></dt>
                   4756: 
                   4757:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4758:                   "#id2592529">12.3.2. Using libtool on GNU
1.1       grant    4759:                   packages that already support
                   4760:                   libtool</a></span></dt>
                   4761: 
                   4762:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4763:                   "#id2592613">12.3.3. GNU
1.1       grant    4764:                   Autoconf/Automake</a></span></dt>
                   4765:                 </dl>
                   4766:               </dd>
                   4767: 
1.15    ! xtraeme  4768:               <dt><span class="sect1"><a href="#id2592726">12.4.
1.1       grant    4769:               Building considerations</a></span></dt>
                   4770: 
                   4771:               <dd>
                   4772:                 <dl>
                   4773:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4774:                   "#id2592729">12.4.1. CPP defines</a></span></dt>
1.1       grant    4775:                 </dl>
                   4776:               </dd>
                   4777: 
1.15    ! xtraeme  4778:               <dt><span class="sect1"><a href="#id2592759">12.5.
1.1       grant    4779:               Package specific actions</a></span></dt>
                   4780: 
                   4781:               <dd>
                   4782:                 <dl>
                   4783:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4784:                   "#id2592762">12.5.1. Package configuration
1.1       grant    4785:                   files</a></span></dt>
                   4786: 
                   4787:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4788:                   "#id2592933">12.5.2. User
1.2       hubertf  4789:                   interaction</a></span></dt>
1.1       grant    4790: 
                   4791:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4792:                   "#id2593046">12.5.3. Handling
1.1       grant    4793:                   licenses</a></span></dt>
                   4794: 
                   4795:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4796:                   "#id2593197">12.5.4. Creating an account from a
1.1       grant    4797:                   package</a></span></dt>
                   4798: 
                   4799:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4800:                   "#id2593328">12.5.5. Installing score
1.1       grant    4801:                   files</a></span></dt>
                   4802: 
                   4803:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4804:                   "#id2593371">12.5.6. Packages providing login
1.1       grant    4805:                   shells</a></span></dt>
                   4806: 
                   4807:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4808:                   "#id2593429">12.5.7. Packages containing perl
1.1       grant    4809:                   scripts</a></span></dt>
                   4810: 
                   4811:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4812:                   "#id2593447">12.5.8. Packages with hardcoded
1.1       grant    4813:                   paths to other interpreters</a></span></dt>
                   4814: 
                   4815:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4816:                   "#id2593468">12.5.9. Packages installing perl
1.1       grant    4817:                   modules</a></span></dt>
                   4818: 
                   4819:                   <dt><span class="sect2"><a href=
                   4820:                   "#faq.info-files">12.5.10. Packages installing
                   4821:                   info files</a></span></dt>
                   4822: 
                   4823:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4824:                   "#id2593688">12.5.11. Packages installing GConf2
1.1       grant    4825:                   data files</a></span></dt>
                   4826: 
                   4827:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4828:                   "#id2593788">12.5.12. Packages installing
1.1       grant    4829:                   scrollkeeper data files</a></span></dt>
                   4830: 
                   4831:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4832:                   "#id2593840">12.5.13. Packages installing X11
1.1       grant    4833:                   fonts</a></span></dt>
                   4834: 
                   4835:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4836:                   "#id2593886">12.5.14. Packages installing GTK2
1.1       grant    4837:                   modules</a></span></dt>
                   4838: 
                   4839:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4840:                   "#id2593956">12.5.15. Packages installing SGML or
1.1       grant    4841:                   XML data</a></span></dt>
                   4842: 
                   4843:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4844:                   "#id2594076">12.5.16. Packages installing
1.1       grant    4845:                   extensions to the MIME database</a></span></dt>
                   4846: 
                   4847:                   <dt><span class="sect2"><a href=
1.15    ! xtraeme  4848:                   "#id2594283">12.5.17. Packages using
1.1       grant    4849:                   intltool</a></span></dt>
                   4850:                 </dl>
                   4851:               </dd>
                   4852: 
1.15    ! xtraeme  4853:               <dt><span class="sect1"><a href="#id2594297">12.6.
1.1       grant    4854:               Feedback to the author</a></span></dt>
                   4855:             </dl>
                   4856:           </dd>
                   4857: 
                   4858:           <dt><span class="chapter"><a href="#debug">13.
                   4859:           Debugging</a></span></dt>
                   4860: 
                   4861:           <dt><span class="chapter"><a href="#submit">14.
                   4862:           Submitting and Committing</a></span></dt>
                   4863: 
                   4864:           <dd>
                   4865:             <dl>
1.15    ! xtraeme  4866:               <dt><span class="sect1"><a href="#id2594827">14.1.
1.1       grant    4867:               Submitting your packages</a></span></dt>
                   4868: 
1.15    ! xtraeme  4869:               <dt><span class="sect1"><a href="#id2594878">14.2.
1.1       grant    4870:               Committing: Importing a package into
                   4871:               CVS</a></span></dt>
                   4872: 
1.15    ! xtraeme  4873:               <dt><span class="sect1"><a href="#id2594941">14.3.
1.2       hubertf  4874:               Updating a package to a newer version</a></span></dt>
1.1       grant    4875: 
1.15    ! xtraeme  4876:               <dt><span class="sect1"><a href="#id2594961">14.4.
1.2       hubertf  4877:               Moving a package in pkgsrc</a></span></dt>
1.1       grant    4878:             </dl>
                   4879:           </dd>
                   4880:         </dl>
                   4881:       </div>
                   4882: 
                   4883:       <div class="chapter" lang="en" xml:lang="en">
                   4884:         <div class="titlepage">
                   4885:           <div>
                   4886:             <div>
                   4887:               <h2 class="title"><a name="components" id=
                   4888:               "components"></a>Chapter&nbsp;7.&nbsp;Package
                   4889:               components - files, directories and contents</h2>
                   4890:             </div>
                   4891:           </div>
                   4892:         </div>
                   4893: 
                   4894:         <div class="toc">
                   4895:           <p><b>Table of Contents</b></p>
                   4896: 
                   4897:           <dl>
                   4898:             <dt><span class="sect1"><a href=
1.14      xtraeme  4899:             "#components.Makefile">7.1. <code class=
                   4900:             "filename">Makefile</code></a></span></dt>
1.1       grant    4901: 
                   4902:             <dt><span class="sect1"><a href=
1.14      xtraeme  4903:             "#components.distinfo">7.2. <code class=
                   4904:             "filename">distinfo</code></a></span></dt>
1.1       grant    4905: 
                   4906:             <dt><span class="sect1"><a href=
                   4907:             "#components.patches">7.3. patches/*</a></span></dt>
                   4908: 
1.15    ! xtraeme  4909:             <dt><span class="sect1"><a href="#id2586445">7.4. Other
1.1       grant    4910:             mandatory files</a></span></dt>
                   4911: 
                   4912:             <dt><span class="sect1"><a href=
                   4913:             "#components.optional">7.5. Optional
                   4914:             files</a></span></dt>
                   4915: 
1.15    ! xtraeme  4916:             <dt><span class="sect1"><a href="#id2586640">7.6.
1.14      xtraeme  4917:             <code class="filename">work*</code></a></span></dt>
1.1       grant    4918: 
1.15    ! xtraeme  4919:             <dt><span class="sect1"><a href="#id2586727">7.7.
1.14      xtraeme  4920:             <code class="filename">files/*</code></a></span></dt>
1.1       grant    4921:           </dl>
                   4922:         </div>
                   4923: 
                   4924:         <p>Whenever you're preparing a package, there are a number
                   4925:         of files involved which are described in the following
                   4926:         sections.</p>
                   4927: 
                   4928:         <div class="sect1" lang="en" xml:lang="en">
                   4929:           <div class="titlepage">
                   4930:             <div>
                   4931:               <div>
                   4932:                 <h2 class="title" style="clear: both"><a name=
                   4933:                 "components.Makefile" id=
1.14      xtraeme  4934:                 "components.Makefile"></a>7.1.&nbsp;<code class=
                   4935:                 "filename">Makefile</code></h2>
1.1       grant    4936:               </div>
                   4937:             </div>
                   4938:           </div>
                   4939: 
                   4940:           <p>Building, installation and creation of a binary
1.14      xtraeme  4941:           package are all controlled by the package's <code class=
                   4942:           "filename">Makefile</code>.</p>
1.1       grant    4943: 
1.14      xtraeme  4944:           <p>There is a <code class="filename">Makefile</code> for
                   4945:           each package. This file includes the standard
                   4946:           <code class="filename">bsd.pkg.mk</code> file (referenced
                   4947:           as <code class="filename">../../mk/bsd.pkg.mk</code>),
                   4948:           which sets all the definitions and actions necessary for
                   4949:           the package to compile and install itself. The mandatory
                   4950:           variables are the <code class="varname">DISTNAME</code>
                   4951:           which specifies the base name of the distribution file to
                   4952:           be downloaded from the site on the Internet, <code class=
                   4953:           "varname">MASTER_SITES</code> which specifies that site,
                   4954:           <code class="varname">CATEGORIES</code> which denotes the
                   4955:           categories into which the package falls, <code class=
                   4956:           "varname">PKGNAME</code> which is the name of the
                   4957:           package, the <code class="varname">MAINTAINER</code>'s
                   4958:           name, and the <code class="varname">COMMENT</code>
                   4959:           variable, which should contain a one-line description of
                   4960:           the package (the package name should not appear, it will
                   4961:           be added automatically). The maintainer variable is there
                   4962:           so that anyone who quibbles with the (always completely
                   4963:           correct) decisions taken by the guy who maintains the
                   4964:           package can complain vigorously, or send chocolate as a
                   4965:           sign of appreciation.</p>
1.1       grant    4966: 
1.14      xtraeme  4967:           <p>The <code class="varname">MASTER_SITES</code> may be
                   4968:           set to one of the predefined sites:</p>
1.1       grant    4969:           <pre class="programlisting">
                   4970:         ${MASTER_SITE_APACHE}
                   4971:         ${MASTER_SITE_DEBIAN}
                   4972:         ${MASTER_SITE_GNOME}
                   4973:         ${MASTER_SITE_GNU}
                   4974:         ${MASTER_SITE_GNUSTEP}
1.9       dillo    4975:         ${MASTER_SITE_IFARCHIVE}
1.1       grant    4976:         ${MASTER_SITE_MOZILLA}
                   4977:         ${MASTER_SITE_PERL_CPAN}
                   4978:         ${MASTER_SITE_SOURCEFORGE}
                   4979:         ${MASTER_SITE_SUNSITE}
                   4980:         ${MASTER_SITE_R_CRAN}
                   4981:         ${MASTER_SITE_SUSE}
                   4982:         ${MASTER_SITE_TEX_CTAN}
                   4983:         ${MASTER_SITE_XCONTRIB}
                   4984:         ${MASTER_SITE_XEMACS} 
                   4985: </pre>
                   4986: 
                   4987:           <p>If one of these predefined sites is chosen, you may
                   4988:           require the ability to specify a subdirectory of that
                   4989:           site. Since these macros may expand to more than one
                   4990:           actual site, you <span class=
                   4991:           "emphasis"><em>must</em></span> use the following
                   4992:           construct to specify a subdirectory:</p>
                   4993:           <pre class="programlisting">
                   4994:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   4995:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   4996: </pre>
                   4997: 
                   4998:           <p>Note the trailing slash after the subdirectory
                   4999:           name.</p>
                   5000: 
                   5001:           <div class="note" style=
                   5002:           "margin-left: 0.5in; margin-right: 0.5in;">
                   5003:             <h3 class="title">Note</h3>
                   5004: 
1.14      xtraeme  5005:             <p><code class="varname">MASTER_SITE_SUBDIR</code> has
                   5006:             been deprecated and <span class="emphasis"><em>should
                   5007:             no longer be used</em></span>.</p>
1.1       grant    5008:           </div>
                   5009: 
1.14      xtraeme  5010:           <p>If the package has multiple <code class=
                   5011:           "varname">DISTFILES</code> or multiple <code class=
                   5012:           "varname">PATCHFILES</code> from different sites, set
                   5013:           <code class="varname">SITES_foo</code> to a list of URI's
1.1       grant    5014:           where file &#8220;<span class="quote">foo</span>&#8221;
                   5015:           may be found. &#8220;<span class=
                   5016:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   5017:           <pre class="programlisting">
                   5018: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   5019: DISTFILES+=     foo-file.tar.gz
                   5020: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   5021:         http://www.somewhereelse.com/mirror/somehow/
                   5022: </pre>
                   5023: 
1.14      xtraeme  5024:           <p>Note that the normal default setting of <code class=
                   5025:           "varname">DISTFILES</code> must be made explicit if you
1.1       grant    5026:           want to add to it (rather than replace it), as you
                   5027:           usually would.</p>
                   5028: 
                   5029:           <p>Currently the following values are available for
1.14      xtraeme  5030:           <code class="varname">CATEGORIES</code>. If more than one
                   5031:           is used, they need to be separated by spaces:</p>
1.1       grant    5032:           <pre class="programlisting">
                   5033: archivers     cross         geography     meta-pkgs     security
                   5034: audio         databases     graphics      misc          shells
                   5035: benchmarks    devel         ham           multimedia    sysutils
                   5036: biology       editors       inputmethod   net           textproc
                   5037: cad           emulators     lang          news          time
                   5038: chat          finance       mail          parallel      wm
                   5039: comms         fonts         math          pkgtools      www
                   5040: converters    games         mbone         print         x11
                   5041: </pre>
                   5042: 
                   5043:           <p>Please pay attention to the following gotchas:</p>
                   5044: 
                   5045:           <div class="itemizedlist">
                   5046:             <ul type="disc">
                   5047:               <li>
1.14      xtraeme  5048:                 <p>Add <code class="varname">MANCOMPRESSED</code>
                   5049:                 if manpages are installed in compressed form by the
                   5050:                 package; see comment in <code class=
                   5051:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    5052:               </li>
                   5053: 
                   5054:               <li>
1.14      xtraeme  5055:                 <p>Replace <code class="filename">/usr/local</code>
1.1       grant    5056:                 with &#8220;<span class=
                   5057:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   5058:                 patches, below).</p>
                   5059:               </li>
                   5060: 
                   5061:               <li>
                   5062:                 <p>If the package installs any info files, see
                   5063:                 <a href="#faq.info-files" title=
                   5064:                 "12.5.10.&nbsp;Packages installing info files">Section
                   5065:                 12.5.10, &#8220;Packages installing info
                   5066:                 files&#8221;</a>.</p>
                   5067:               </li>
                   5068: 
                   5069:               <li>
1.14      xtraeme  5070:                 <p>Set <code class="varname">MAINTAINER</code> to
                   5071:                 be yourself. If you really can't maintain the
                   5072:                 package for future updates, set it to <code class=
1.1       grant    5073:                 "email">&lt;<a href=
1.14      xtraeme  5074:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.1       grant    5075:               </li>
                   5076: 
                   5077:               <li>
                   5078:                 <p>If a home page for the software in question
1.14      xtraeme  5079:                 exists, add the variable <code class=
                   5080:                 "varname">HOMEPAGE</code> right after <code class=
                   5081:                 "varname">MAINTAINER</code>. The value of this
1.1       grant    5082:                 variable should be the URL for the home page.</p>
                   5083:               </li>
                   5084: 
                   5085:               <li>
1.14      xtraeme  5086:                 <p>Be sure to set the <code class=
                   5087:                 "varname">COMMENT</code> variable to a short
1.1       grant    5088:                 description of the package, not containing the
                   5089:                 pkg's name.</p>
                   5090:               </li>
                   5091:             </ul>
                   5092:           </div>
                   5093:         </div>
                   5094: 
                   5095:         <div class="sect1" lang="en" xml:lang="en">
                   5096:           <div class="titlepage">
                   5097:             <div>
                   5098:               <div>
                   5099:                 <h2 class="title" style="clear: both"><a name=
                   5100:                 "components.distinfo" id=
1.14      xtraeme  5101:                 "components.distinfo"></a>7.2.&nbsp;<code class=
                   5102:                 "filename">distinfo</code></h2>
1.1       grant    5103:               </div>
                   5104:             </div>
                   5105:           </div>
                   5106: 
                   5107:           <p>Most important, the mandatory message digest, or
                   5108:           checksum, of all the distfiles needed for the package to
                   5109:           compile, confirming they match the original file
                   5110:           distributed by the author. This ensures that the distfile
                   5111:           retrieved from the Internet has not been corrupted during
                   5112:           transfer or altered by a malign force to introduce a
1.14      xtraeme  5113:           security hole. It is generated using the
                   5114:           <span><strong class="command">make
                   5115:           makesum</strong></span> command. The digest algorithm
                   5116:           used was, at one stage, md5, but that was felt lacking
                   5117:           compared to sha1, and so sha1 is now the default
1.1       grant    5118:           algorithm. The distfile size is also generated and stored
                   5119:           in new distinfo files. The <a xmlns=
                   5120:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5121:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.14      xtraeme  5122:           class="pkgname">pkgtools/digest</a> utility calculates
                   5123:           all of the digests in the distinfo file, and it provides
                   5124:           various different algorithms. At the current time, the
                   5125:           algorithms provided are: <span class=
                   5126:           "emphasis"><em>md5</em></span>, <span class=
                   5127:           "emphasis"><em>rmd160</em></span>, <span class=
                   5128:           "emphasis"><em>sha1</em></span>, <span class=
                   5129:           "emphasis"><em>sha256</em></span>, <span class=
                   5130:           "emphasis"><em>sha384</em></span> and <span class=
                   5131:           "emphasis"><em>sha512</em></span>.</p>
1.1       grant    5132: 
                   5133:           <p>Some packages have different sets of distfiles on a
                   5134:           per architecture basis, for example <a xmlns=
                   5135:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5136:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.14      xtraeme  5137:           class="pkgname">www/navigator</a>). These are kept in the
                   5138:           same distinfo file and care should be taken when
                   5139:           upgrading such a package to ensure distfile information
                   5140:           is not lost.</p>
1.1       grant    5141: 
                   5142:           <p>The message digest/checksum for all the official
1.14      xtraeme  5143:           patches found in the <code class=
                   5144:           "filename">patches/</code> directory (see <a href=
                   5145:           "#components.patches" title=
1.1       grant    5146:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   5147:           &#8220;patches/*&#8221;</a>) for the package is also
1.14      xtraeme  5148:           stored in the <code class="filename">distinfo</code>
                   5149:           file. This is a message digest/checksum of all lines in
                   5150:           the patch file except the NetBSD RCS Id. This file is
                   5151:           generated by invoking <span><strong class="command">make
                   5152:           makepatchsum</strong></span> (or <span><strong class=
                   5153:           "command">make mps</strong></span> if you're in a
                   5154:           hurry).</p>
1.1       grant    5155:         </div>
                   5156: 
                   5157:         <div class="sect1" lang="en" xml:lang="en">
                   5158:           <div class="titlepage">
                   5159:             <div>
                   5160:               <div>
                   5161:                 <h2 class="title" style="clear: both"><a name=
                   5162:                 "components.patches" id=
                   5163:                 "components.patches"></a>7.3.&nbsp;patches/*</h2>
                   5164:               </div>
                   5165:             </div>
                   5166:           </div>
                   5167: 
                   5168:           <p>This directory contains files that are used by the
                   5169:           <a href=
                   5170:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   5171:           <span class="citerefentry"><span class=
                   5172:           "refentrytitle">patch</span>(1)</span></a> command to
                   5173:           modify the sources as distributed in the distribution
                   5174:           file into a form that will compile and run perfectly on
                   5175:           NetBSD. The files are applied successively in alphabetic
                   5176:           order (as returned by a shell &#8220;<span class=
                   5177:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.14      xtraeme  5178:           <code class="filename">patch-aa</code> is applied before
                   5179:           <code class="filename">patch-ab</code>, etc.</p>
1.1       grant    5180: 
1.14      xtraeme  5181:           <p>The <code class="filename">patch-*</code> files should
                   5182:           be in <span><strong class="command">diff
                   5183:           -bu</strong></span> format, and apply without a fuzz to
                   5184:           avoid problems. (To force patches to apply with fuzz you
                   5185:           can set <code class=
                   5186:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    5187:           not put changes for more than one file into a single
                   5188:           patch-file, as this will make future modifications more
                   5189:           difficult.</p>
                   5190: 
                   5191:           <p>Similar, a file should be patched at most once, not
                   5192:           several times by several different patches. If a file
                   5193:           needs several patches, they should be combined into one
                   5194:           file.</p>
                   5195: 
                   5196:           <p>One important thing to mention is to pay attention
                   5197:           that no RCS IDs get stored in the patch files, as these
                   5198:           will cause problems when later checked into the NetBSD
1.14      xtraeme  5199:           CVS tree. Use the <span><strong class=
                   5200:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    5201:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5202:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14      xtraeme  5203:           class="pkgname">pkgtools/pkgdiff</a> package to avoid
                   5204:           these problems.</p>
1.1       grant    5205: 
                   5206:           <p>For even more automation, we recommend using
1.14      xtraeme  5207:           <span><strong class="command">mkpatches</strong></span>
                   5208:           from the same package to make a whole set of patches. You
                   5209:           just have to backup files before you edit them to
                   5210:           <code class="filename">filename.orig</code>, e.g. with
                   5211:           <span><strong class="command">cp -p filename
                   5212:           filename.orig</strong></span> or, easier, by using
                   5213:           <span><strong class="command">pkgvi</strong></span> again
                   5214:           from the same package. If you upgrade a package this way,
                   5215:           you can easily compare the new set of patches with the
                   5216:           previously existing one with <span><strong class=
                   5217:           "command">patchdiff</strong></span>.</p>
1.1       grant    5218: 
                   5219:           <p>When you have finished a package, remember to generate
                   5220:           the checksums for the patch files by using the
1.14      xtraeme  5221:           <span><strong class="command">make
                   5222:           makepatchsum</strong></span> command, see <a href=
                   5223:           "#components.distinfo" title=
1.5       hubertf  5224:           "7.2.&nbsp;distinfo">Section&nbsp;7.2,
1.14      xtraeme  5225:           &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    5226: 
                   5227:           <p>Patch files that are distributed by the author or
1.14      xtraeme  5228:           other maintainers can be listed in <code class=
                   5229:           "varname">$PATCHFILES</code>.</p>
1.1       grant    5230: 
                   5231:           <p>If it is desired to store any patches that should not
                   5232:           be committed into pkgsrc, they can be kept outside the
1.14      xtraeme  5233:           pkgsrc tree in the <code class=
                   5234:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    5235:           tree there is expected to have the same
                   5236:           &#8220;<span class="quote">category/package</span>&#8221;
                   5237:           structure as pkgsrc, and patches are expected to be
1.14      xtraeme  5238:           stored inside these dirs (also known as <code class=
                   5239:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
                   5240:           you want to keep a private patch for <code class=
                   5241:           "filename">pkgsrc/graphics/png</code>, keep it in
                   5242:           <code class=
                   5243:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   5244:           files in the named directory are expected to be patch
1.1       grant    5245:           files, and <span class="emphasis"><em>they are applied
                   5246:           after pkgsrc patches are applied</em></span>.</p>
                   5247:         </div>
                   5248: 
                   5249:         <div class="sect1" lang="en" xml:lang="en">
                   5250:           <div class="titlepage">
                   5251:             <div>
                   5252:               <div>
                   5253:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  5254:                 "id2586445" id="id2586445"></a>7.4.&nbsp;Other
1.1       grant    5255:                 mandatory files</h2>
                   5256:               </div>
                   5257:             </div>
                   5258:           </div>
                   5259: 
                   5260:           <div class="variablelist">
                   5261:             <dl>
1.14      xtraeme  5262:               <dt><span class="term"><code class=
                   5263:               "filename">DESCR</code></span></dt>
1.1       grant    5264: 
                   5265:               <dd>
                   5266:                 <p>A multi-line description of the piece of
                   5267:                 software. This should include any credits where
                   5268:                 they are due. Please bear in mind that others do
                   5269:                 not share your sense of humour (or spelling
                   5270:                 idiosyncrasies), and that others will read
                   5271:                 everything that you write here.</p>
                   5272:               </dd>
                   5273: 
1.14      xtraeme  5274:               <dt><span class="term"><code class=
                   5275:               "filename">PLIST</code></span></dt>
1.1       grant    5276: 
                   5277:               <dd>
                   5278:                 <p>This file governs the files that are installed
                   5279:                 on your system: all the binaries, manual pages,
                   5280:                 etc. There are other directives which may be
                   5281:                 entered in this file, to control the creation and
                   5282:                 deletion of directories, and the location of
                   5283:                 inserted files. See <a href="#plist" title=
                   5284:                 "Chapter&nbsp;8.&nbsp;PLIST issues">Chapter&nbsp;8,
                   5285:                 <i>PLIST issues</i></a> for more information.</p>
                   5286:               </dd>
                   5287:             </dl>
                   5288:           </div>
                   5289:         </div>
                   5290: 
                   5291:         <div class="sect1" lang="en" xml:lang="en">
                   5292:           <div class="titlepage">
                   5293:             <div>
                   5294:               <div>
                   5295:                 <h2 class="title" style="clear: both"><a name=
                   5296:                 "components.optional" id=
                   5297:                 "components.optional"></a>7.5.&nbsp;Optional
                   5298:                 files</h2>
                   5299:               </div>
                   5300:             </div>
                   5301:           </div>
                   5302: 
                   5303:           <div class="variablelist">
                   5304:             <dl>
1.14      xtraeme  5305:               <dt><span class="term"><code class=
                   5306:               "filename">INSTALL</code></span></dt>
1.1       grant    5307: 
                   5308:               <dd>
                   5309:                 <p>This shell script is invoked twice by <a href=
                   5310:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5311:                 <span class="citerefentry"><span class=
                   5312:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   5313:                 time after package extraction and before files are
                   5314:                 moved in place, the second time after the files to
                   5315:                 install are moved in place. This can be used to do
                   5316:                 any custom procedures not possible with @exec
1.14      xtraeme  5317:                 commands in <code class="filename">PLIST</code>.
                   5318:                 See <a href=
1.1       grant    5319:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5320:                 <span class="citerefentry"><span class=
                   5321:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   5322:                 <a href=
                   5323:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5324:                 <span class="citerefentry"><span class=
                   5325:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5326:                 more information.</p>
                   5327:               </dd>
                   5328: 
1.14      xtraeme  5329:               <dt><span class="term"><code class=
                   5330:               "filename">DEINSTALL</code></span></dt>
1.1       grant    5331: 
                   5332:               <dd>
                   5333:                 <p>This script is executed before and after any
                   5334:                 files are removed. It is this script's
                   5335:                 responsibility to clean up any additional messy
                   5336:                 details around the package's installation, since
                   5337:                 all pkg_delete knows is how to delete the files
                   5338:                 created in the original distribution. See <a href=
                   5339:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   5340:                 <span class="citerefentry"><span class=
                   5341:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   5342:                 <a href=
                   5343:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5344:                 <span class="citerefentry"><span class=
                   5345:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5346:                 more information.</p>
                   5347:               </dd>
                   5348: 
1.14      xtraeme  5349:               <dt><span class="term"><code class=
                   5350:               "filename">MESSAGE</code></span></dt>
1.1       grant    5351: 
                   5352:               <dd>
                   5353:                 <p>Display this file after installation of the
                   5354:                 package. Useful for things like legal notices on
                   5355:                 almost-free software and hints for updating config
                   5356:                 files after installing modules for apache, PHP etc.
                   5357:                 Please note that you can modify variables in it
1.14      xtraeme  5358:                 easily by using <code class=
                   5359:                 "varname">MESSAGE_SUBST</code> in the package's
                   5360:                 <code class="filename">Makefile</code>:</p>
1.1       grant    5361:                 <pre class="programlisting">
                   5362: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   5363: </pre>
                   5364: 
                   5365:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.14      xtraeme  5366:                 "quote">somevalue</span>&#8221; in <code class=
                   5367:                 "filename">MESSAGE</code>.</p>
1.1       grant    5368:               </dd>
                   5369:             </dl>
                   5370:           </div>
                   5371:         </div>
                   5372: 
                   5373:         <div class="sect1" lang="en" xml:lang="en">
                   5374:           <div class="titlepage">
                   5375:             <div>
                   5376:               <div>
                   5377:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  5378:                 "id2586640" id=
        !          5379:                 "id2586640"></a>7.6.&nbsp;<code class=
1.14      xtraeme  5380:                 "filename">work*</code></h2>
1.1       grant    5381:               </div>
                   5382:             </div>
                   5383:           </div>
                   5384: 
1.14      xtraeme  5385:           <p>When you type <span><strong class=
                   5386:           "command">make</strong></span> the distribution files are
                   5387:           unpacked into this directory. It can be removed by
                   5388:           running <span><strong class="command">make
                   5389:           clean</strong></span>. Besides the sources, this
                   5390:           directory is also used to keep various timestamp
1.1       grant    5391:           files.</p>
                   5392: 
                   5393:           <p>If a package doesn't create a subdirectory for itself
                   5394:           (like GNU software does, for instance), but extracts
                   5395:           itself in the current directory, you should set
1.14      xtraeme  5396:           <code class="varname">WRKSRC</code> accordingly, e.g.
1.1       grant    5397:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   5398:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.14      xtraeme  5399:           class="pkgname">editors/sam</a> again, but the quick
                   5400:           answer is:</p>
1.1       grant    5401:           <pre class="programlisting">
                   5402: WRKSRC=                ${WRKDIR}
                   5403: </pre>
                   5404: 
1.14      xtraeme  5405:           <p>Please note that the old <code class=
                   5406:           "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1       grant    5407:           should not be used. Also, if your package doesn't create
1.14      xtraeme  5408:           a subdir with the name of <code class=
                   5409:           "varname">DISTNAME</code> but some different name, set
                   5410:           <code class="varname">WRKSRC</code> to point to the
                   5411:           proper name in <code class="filename">${WRKDIR}</code>.
                   5412:           See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5413:           href=
1.1       grant    5414:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.14      xtraeme  5415:           class="pkgname">lang/tcl</a> and <a xmlns=
                   5416:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5417:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   5418:           class="pkgname">x11/tk</a> for examples, and here is
                   5419:           another one:</p>
1.1       grant    5420:           <pre class="programlisting">
                   5421: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   5422: </pre>
                   5423: 
                   5424:           <p>The name of the working directory created by pkgsrc is
1.14      xtraeme  5425:           <code class="filename">work</code> by default. If the
                   5426:           same pkgsrc tree should be used on several different
                   5427:           platforms, the variable <code class=
                   5428:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1       grant    5429:           attach the platform to the directory name, e.g.
1.14      xtraeme  5430:           <code class="filename">work.i386</code> or <code class=
                   5431:           "filename">work.sparc</code>.</p>
1.1       grant    5432:         </div>
                   5433: 
                   5434:         <div class="sect1" lang="en" xml:lang="en">
                   5435:           <div class="titlepage">
                   5436:             <div>
                   5437:               <div>
                   5438:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  5439:                 "id2586727" id=
        !          5440:                 "id2586727"></a>7.7.&nbsp;<code class=
1.14      xtraeme  5441:                 "filename">files/*</code></h2>
1.1       grant    5442:               </div>
                   5443:             </div>
                   5444:           </div>
                   5445: 
                   5446:           <p>If you have any files that you wish to be placed in
                   5447:           the package prior to configuration or building, you could
                   5448:           place these files here and use a &#8220;<span class=
                   5449:           "quote">${CP}</span>&#8221; command in the
                   5450:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   5451:           target to achieve this. Alternatively, you could simply
1.14      xtraeme  5452:           diff the file against <code class=
                   5453:           "filename">/dev/null</code> and use the patch mechanism
                   5454:           to manage the creation of this file.</p>
1.1       grant    5455:         </div>
                   5456:       </div>
                   5457: 
                   5458:       <div class="chapter" lang="en" xml:lang="en">
                   5459:         <div class="titlepage">
                   5460:           <div>
                   5461:             <div>
                   5462:               <h2 class="title"><a name="plist" id=
                   5463:               "plist"></a>Chapter&nbsp;8.&nbsp;PLIST issues</h2>
                   5464:             </div>
                   5465:           </div>
                   5466:         </div>
                   5467: 
                   5468:         <div class="toc">
                   5469:           <p><b>Table of Contents</b></p>
                   5470: 
                   5471:           <dl>
1.15    ! xtraeme  5472:             <dt><span class="sect1"><a href="#id2586781">8.1. RCS
1.1       grant    5473:             ID</a></span></dt>
                   5474: 
1.15    ! xtraeme  5475:             <dt><span class="sect1"><a href="#id2586796">8.2.
1.14      xtraeme  5476:             Semi-automatic <code class="filename">PLIST</code>
                   5477:             generation</a></span></dt>
1.1       grant    5478: 
                   5479:             <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme  5480:             Tweaking output of <span><strong class="command">make
                   5481:             print-PLIST</strong></span></a></span></dt>
1.1       grant    5482: 
                   5483:             <dt><span class="sect1"><a href="#plist.misc">8.4.
                   5484:             Variable substitution in PLIST</a></span></dt>
                   5485: 
1.15    ! xtraeme  5486:             <dt><span class="sect1"><a href="#id2587186">8.5.
1.1       grant    5487:             Manpage-compression</a></span></dt>
                   5488: 
1.15    ! xtraeme  5489:             <dt><span class="sect1"><a href="#id2587227">8.6.
1.14      xtraeme  5490:             Changing PLIST source with <code class=
                   5491:             "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5492: 
1.15    ! xtraeme  5493:             <dt><span class="sect1"><a href="#id2587244">8.7.
1.1       grant    5494:             Platform specific and differing PLISTs</a></span></dt>
                   5495: 
                   5496:             <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
                   5497:             Sharing directories between packages</a></span></dt>
                   5498:           </dl>
                   5499:         </div>
                   5500: 
1.14      xtraeme  5501:         <p>The <code class="filename">PLIST</code> file contains a
1.1       grant    5502:         package's &#8220;<span class="quote">packing
                   5503:         list</span>&#8221;, i.e. a list of files that belong to the
1.14      xtraeme  5504:         package (relative to the <code class=
                   5505:         "filename">${PREFIX}</code> directory it's been installed
                   5506:         in) plus some additional statements - see the <a href=
1.1       grant    5507:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5508:         <span class="citerefentry"><span class=
                   5509:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   5510:         a full list. This chapter addresses some issues that need
1.14      xtraeme  5511:         attention when dealing with the <code class=
                   5512:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    5513: 
                   5514:         <div class="sect1" lang="en" xml:lang="en">
                   5515:           <div class="titlepage">
                   5516:             <div>
                   5517:               <div>
                   5518:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  5519:                 "id2586781" id="id2586781"></a>8.1.&nbsp;RCS
1.1       grant    5520:                 ID</h2>
                   5521:               </div>
                   5522:             </div>
                   5523:           </div>
                   5524: 
                   5525:           <p>Be sure to add a RCS ID line as the first thing in any
1.14      xtraeme  5526:           <code class="filename">PLIST</code> file you write:</p>
1.1       grant    5527:           <pre class="programlisting">
1.11      ben      5528: @comment $NetBSD$
1.1       grant    5529: </pre>
                   5530:         </div>
                   5531: 
                   5532:         <div class="sect1" lang="en" xml:lang="en">
                   5533:           <div class="titlepage">
                   5534:             <div>
                   5535:               <div>
                   5536:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  5537:                 "id2586796" id=
        !          5538:                 "id2586796"></a>8.2.&nbsp;Semi-automatic
1.14      xtraeme  5539:                 <code class="filename">PLIST</code> generation</h2>
1.1       grant    5540:               </div>
                   5541:             </div>
                   5542:           </div>
                   5543: 
1.14      xtraeme  5544:           <p>You can use the <span><strong class="command">make
                   5545:           print-PLIST</strong></span> command to output a PLIST
                   5546:           that matches any new files since the package was
                   5547:           extracted. See <a href="#build.helpful-targets" title=
1.1       grant    5548:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   5549:           &#8220;Other helpful targets&#8221;</a> for more
                   5550:           information on this target.</p>
                   5551:         </div>
                   5552: 
                   5553:         <div class="sect1" lang="en" xml:lang="en">
                   5554:           <div class="titlepage">
                   5555:             <div>
                   5556:               <div>
                   5557:                 <h2 class="title" style="clear: both"><a name=
                   5558:                 "print-PLIST" id=
                   5559:                 "print-PLIST"></a>8.3.&nbsp;Tweaking output of
1.14      xtraeme  5560:                 <span><strong class="command">make
                   5561:                 print-PLIST</strong></span></h2>
1.1       grant    5562:               </div>
                   5563:             </div>
                   5564:           </div>
                   5565: 
                   5566:           <p>If you have used any of the *-dirs packages, as
                   5567:           explained in <a href="#faq.common-dirs" title=
                   5568:           "8.8.&nbsp;Sharing directories between packages">Section&nbsp;8.8,
                   5569:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  5570:           you may have noticed that <span><strong class=
                   5571:           "command">make print-PLIST</strong></span> outputs a set
                   5572:           of <code class="varname">@comment</code>s instead of real
                   5573:           <code class="varname">@dirrm</code> lines. You can also
                   5574:           do this for specific directories and files, so that the
                   5575:           results of that command are very close to reality. This
                   5576:           helps <span class="emphasis"><em>a lot</em></span> during
                   5577:           the update of packages.</p>
                   5578: 
                   5579:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   5580:           variable takes a set of AWK patterns and actions that are
                   5581:           used to filter the output of print-PLIST. You can
                   5582:           <span class="emphasis"><em>append</em></span> any chunk
                   5583:           of AWK scripting you like to it, but be careful with
1.1       grant    5584:           quoting.</p>
                   5585: 
1.14      xtraeme  5586:           <p>For example, to get all files inside the <code class=
                   5587:           "filename">libdata/foo</code> directory removed from the
1.1       grant    5588:           resulting PLIST:</p>
                   5589:           <pre class="programlisting">
                   5590:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   5591:     
                   5592: </pre>
                   5593: 
1.14      xtraeme  5594:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    5595:           lines referring to a specific (shared) directory
1.14      xtraeme  5596:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    5597:           <pre class="programlisting">
                   5598:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   5599:     
                   5600: </pre>
                   5601:         </div>
                   5602: 
                   5603:         <div class="sect1" lang="en" xml:lang="en">
                   5604:           <div class="titlepage">
                   5605:             <div>
                   5606:               <div>
                   5607:                 <h2 class="title" style="clear: both"><a name=
                   5608:                 "plist.misc" id="plist.misc"></a>8.4.&nbsp;Variable
                   5609:                 substitution in PLIST</h2>
                   5610:               </div>
                   5611:             </div>
                   5612:           </div>
                   5613: 
                   5614:           <p>A number of variables are substituted automatically in
                   5615:           PLISTs when a package is installed on a system. This
                   5616:           includes the following variables:</p>
                   5617: 
                   5618:           <div class="variablelist">
                   5619:             <dl>
1.14      xtraeme  5620:               <dt><span class="term"><code class=
                   5621:               "varname">${MACHINE_ARCH}</code>, <code class=
                   5622:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    5623: 
                   5624:               <dd>
                   5625:                 <p>Some packages like emacs and perl embed
                   5626:                 information about which architecture they were
                   5627:                 built on into the pathnames where they install
                   5628:                 their file. To handle this case, PLIST will be
                   5629:                 preprocessed before actually used, and the symbol
1.14      xtraeme  5630:                 &#8220;<span class="quote"><code class=
                   5631:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   5632:                 be replaced by what <span><strong class=
                   5633:                 "command">uname -p</strong></span> gives. The same
                   5634:                 is done if the string <code class=
                   5635:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   5636:                 PLIST somewhere - use this on packages that have
                   5637:                 GNU autoconf created configure scripts.</p>
1.1       grant    5638: 
                   5639:                 <div class="note" style=
                   5640:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   5641:                   <h3 class="title">Legacy note</h3>
                   5642: 
                   5643:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  5644:                   "quote"><code class=
                   5645:                   "varname">$ARCH</code></span>&#8221; that was
                   5646:                   replaced by the output of <span><strong class=
                   5647:                   "command">uname -m</strong></span>, but that's no
1.1       grant    5648:                   longer supported and has been removed.</p>
                   5649:                 </div>
                   5650:               </dd>
                   5651: 
1.14      xtraeme  5652:               <dt><span class="term"><code class=
                   5653:               "varname">${OPSYS}</code>, <code class=
                   5654:               "varname">${LOWER_OPSYS}</code>, <code class=
                   5655:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    5656: 
                   5657:               <dd>
                   5658:                 <p>Some packages want to embed the OS name and
                   5659:                 version into some paths. To do this, use these
1.14      xtraeme  5660:                 variables in the <code class=
                   5661:                 "filename">PLIST</code>:</p>
1.1       grant    5662: 
                   5663:                 <div class="itemizedlist">
                   5664:                   <ul type="disc">
                   5665:                     <li>
1.14      xtraeme  5666:                       <p><code class="varname">${OPSYS}</code> -
                   5667:                       output of &#8220;<span class=
                   5668:                       "quote"><span><strong class="command">uname
                   5669:                       -s</strong></span></span>&#8221;</p>
1.1       grant    5670:                     </li>
                   5671: 
                   5672:                     <li>
1.14      xtraeme  5673:                       <p><code class=
                   5674:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   5675:                       common name (eg. &#8220;<span class=
                   5676:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    5677:                     </li>
                   5678: 
                   5679:                     <li>
1.14      xtraeme  5680:                       <p><code class="varname">${OS_VERSION}</code>
                   5681:                       - &#8220;<span class=
                   5682:                       "quote"><span><strong class="command">uname
                   5683:                       -r</strong></span></span>&#8221;</p>
1.1       grant    5684:                     </li>
                   5685:                   </ul>
                   5686:                 </div>
                   5687:               </dd>
                   5688: 
1.14      xtraeme  5689:               <dt><span class="term"><code class=
                   5690:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    5691: 
                   5692:               <dd>
                   5693:                 <p>Packages that install locale files should list
                   5694:                 them in the PLIST as &#8220;<span class=
                   5695:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   5696:                 instead of &#8220;<span class=
                   5697:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   5698:                 This properly handles the fact that different
                   5699:                 operating systems expect locale files to be either
1.14      xtraeme  5700:                 in <code class="filename">share</code> or
                   5701:                 <code class="filename">lib</code> by default.</p>
1.1       grant    5702:               </dd>
                   5703:             </dl>
                   5704:           </div>
                   5705: 
                   5706:           <p>For a complete list of values which are replaced by
1.14      xtraeme  5707:           default, please look in <code class=
                   5708:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    5709:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   5710: 
                   5711:           <p>If you want to change other variables not listed
                   5712:           above, you can add variables and their expansions to this
1.14      xtraeme  5713:           variable in the following way, similar to <code class=
                   5714:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    5715:           "#components.optional" title=
                   5716:           "7.5.&nbsp;Optional files">Section&nbsp;7.5,
                   5717:           &#8220;Optional files&#8221;</a>):</p>
                   5718:           <pre class="programlisting">
                   5719: PLIST_SUBST+=    SOMEVAR="somevalue"
                   5720: </pre>
                   5721: 
                   5722:           <p>This replaces all occurrences of &#8220;<span class=
                   5723:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   5724:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   5725:         </div>
                   5726: 
                   5727:         <div class="sect1" lang="en" xml:lang="en">
                   5728:           <div class="titlepage">
                   5729:             <div>
                   5730:               <div>
                   5731:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  5732:                 "id2587186" id=
        !          5733:                 "id2587186"></a>8.5.&nbsp;Manpage-compression</h2>
1.1       grant    5734:               </div>
                   5735:             </div>
                   5736:           </div>
                   5737: 
                   5738:           <p>Manpages should be installed in compressed form if
1.14      xtraeme  5739:           <code class="varname">MANZ</code> is set (in <code class=
                   5740:           "filename">bsd.own.mk</code>), and uncompressed
                   5741:           otherwise. To handle this in the <code class=
                   5742:           "filename">PLIST</code> file, the suffix
                   5743:           &#8220;<span class="quote">.gz</span>&#8221; is
                   5744:           appended/removed automatically for manpages according to
                   5745:           <code class="varname">MANZ</code> and <code class=
                   5746:           "varname">MANCOMPRESSED</code> being set or not, see
                   5747:           above for details. This modification of the <code class=
                   5748:           "filename">PLIST</code> file is done on a copy of it, not
                   5749:           <code class="filename">PLIST</code> itself.</p>
1.1       grant    5750:         </div>
                   5751: 
                   5752:         <div class="sect1" lang="en" xml:lang="en">
                   5753:           <div class="titlepage">
                   5754:             <div>
                   5755:               <div>
                   5756:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  5757:                 "id2587227" id="id2587227"></a>8.6.&nbsp;Changing
1.14      xtraeme  5758:                 PLIST source with <code class=
                   5759:                 "varname">PLIST_SRC</code></h2>
1.1       grant    5760:               </div>
                   5761:             </div>
                   5762:           </div>
                   5763: 
1.14      xtraeme  5764:           <p>To use one or more files as source for the
                   5765:           <code class="filename">PLIST</code> used in generating
                   5766:           the binary package, set the variable <code class=
                   5767:           "varname">PLIST_SRC</code> to the names of that file(s).
1.1       grant    5768:           The files are later concatenated using cat(1), and order
                   5769:           of things is important.</p>
                   5770:         </div>
                   5771: 
                   5772:         <div class="sect1" lang="en" xml:lang="en">
                   5773:           <div class="titlepage">
                   5774:             <div>
                   5775:               <div>
                   5776:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  5777:                 "id2587244" id="id2587244"></a>8.7.&nbsp;Platform
1.1       grant    5778:                 specific and differing PLISTs</h2>
                   5779:               </div>
                   5780:             </div>
                   5781:           </div>
                   5782: 
                   5783:           <p>Some packages decide to install a different set of
                   5784:           files based on the operating system being used. These
                   5785:           differences can be automatically handled by using the
                   5786:           following files:</p>
                   5787: 
                   5788:           <div class="itemizedlist">
                   5789:             <ul type="disc">
                   5790:               <li>
1.14      xtraeme  5791:                 <p><code class="filename">PLIST.common</code></p>
1.1       grant    5792:               </li>
                   5793: 
                   5794:               <li>
1.14      xtraeme  5795:                 <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1       grant    5796:               </li>
                   5797: 
                   5798:               <li>
1.14      xtraeme  5799:                 <p><code class=
                   5800:                 "filename">PLIST.common_end</code></p>
1.1       grant    5801:               </li>
                   5802:             </ul>
                   5803:           </div>
                   5804: 
1.14      xtraeme  5805:           <p>If <code class="filename">PLIST.${OPSYS}</code>
                   5806:           exists, these files are used instead of <code class=
                   5807:           "filename">PLIST</code>. This allows packages which
                   5808:           behave in this way to be handled gracefully. Manually
                   5809:           overriding <code class="varname">PLIST_SRC</code> for
                   5810:           other more exotic uses is also possible.</p>
1.1       grant    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=
                   5818:                 "faq.common-dirs" id=
                   5819:                 "faq.common-dirs"></a>8.8.&nbsp;Sharing directories
                   5820:                 between packages</h2>
                   5821:               </div>
                   5822:             </div>
                   5823:           </div>
                   5824: 
                   5825:           <p>A &#8220;<span class="quote">shared
                   5826:           directory</span>&#8221; is a directory where multiple
                   5827:           (and unrelated) packages install files. These directories
                   5828:           are problematic because you have to add special tricks in
                   5829:           the PLIST to conditionally remove them, or have some
                   5830:           centralized package handle them.</p>
                   5831: 
                   5832:           <p>Within pkgsrc, you'll find both approaches. If a
                   5833:           directory is shared by a few unrelated packages, it's
                   5834:           often not worth to add an extra package to remove it.
                   5835:           Therefore, one simply does:</p>
                   5836:           <pre class="programlisting">
                   5837:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   5838:     
                   5839: </pre>
                   5840: 
                   5841:           <p>in the PLISTs of all affected packages, instead of the
                   5842:           regular "@dirrm" line.</p>
                   5843: 
                   5844:           <p>However, if the directory is shared across many
                   5845:           packages, two different solutions are available:</p>
                   5846: 
                   5847:           <div class="orderedlist">
                   5848:             <ol type="1">
                   5849:               <li>
                   5850:                 <p>If the packages have a common dependency, the
                   5851:                 directory can be removed in that. For example, see
                   5852:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5853:                 href=
                   5854:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.14      xtraeme  5855:                 class="pkgname">textproc/scrollkeeper</a>, which
                   5856:                 removes the shared directory <code class=
                   5857:                 "filename">share/omf</code>.</p>
1.1       grant    5858:               </li>
                   5859: 
                   5860:               <li>
                   5861:                 <p>If the packages using the directory are not
                   5862:                 related at all (they have no common dependencies),
                   5863:                 a *-dirs package is used.</p>
                   5864:               </li>
                   5865:             </ol>
                   5866:           </div>
                   5867: 
                   5868:           <p>From now on, we'll discuss the second solution. To get
                   5869:           an idea of the *-dirs packages available, issue:</p>
                   5870:           <pre class="programlisting">
1.14      xtraeme  5871:       <code class="prompt">%</code> cd .../pkgsrc
                   5872:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    5873:     
                   5874: </pre>
                   5875: 
                   5876:           <p>Their use from other packages is very simple. The
1.14      xtraeme  5877:           <code class="varname">USE_DIRS</code> variable takes a
                   5878:           list of package names (without the &#8220;<span class=
1.1       grant    5879:           "quote">-dirs</span>&#8221; part) together with the
                   5880:           required version number (always pick the latest one when
                   5881:           writting new packages).</p>
                   5882: 
                   5883:           <p>For example, if a package installs files under
1.14      xtraeme  5884:           <code class="filename">share/applications</code>, it
                   5885:           should have the following line in it:</p>
1.1       grant    5886:           <pre class="programlisting">
                   5887:       USE_DIRS+= xdg-1.1
                   5888:     
                   5889: </pre>
                   5890: 
1.14      xtraeme  5891:           <p>After regenerating the PLIST using
                   5892:           <span><strong class="command">make
                   5893:           print-PLIST</strong></span>, you should get the right
                   5894:           (commented out) lines.</p>
1.1       grant    5895: 
1.14      xtraeme  5896:           <p>Note that, even if your package is using <code class=
                   5897:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    5898:           *-x11-dirs packages. Just specify the name without that
1.14      xtraeme  5899:           part and pkgsrc (in particular, <code class=
                   5900:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    5901:         </div>
                   5902:       </div>
                   5903: 
                   5904:       <div class="chapter" lang="en" xml:lang="en">
                   5905:         <div class="titlepage">
                   5906:           <div>
                   5907:             <div>
                   5908:               <h2 class="title"><a name="buildlink" id=
                   5909:               "buildlink"></a>Chapter&nbsp;9.&nbsp;Buildlink
                   5910:               methodology</h2>
                   5911:             </div>
                   5912:           </div>
                   5913:         </div>
                   5914: 
                   5915:         <div class="toc">
                   5916:           <p><b>Table of Contents</b></p>
                   5917: 
                   5918:           <dl>
1.15    ! xtraeme  5919:             <dt><span class="sect1"><a href="#id2587653">9.1.
1.1       grant    5920:             Converting packages to use buildlink3</a></span></dt>
                   5921: 
1.15    ! xtraeme  5922:             <dt><span class="sect1"><a href="#id2587844">9.2.
1.14      xtraeme  5923:             Writing <code class="filename">buildlink3.mk</code>
                   5924:             files</a></span></dt>
1.1       grant    5925: 
                   5926:             <dd>
                   5927:               <dl>
1.15    ! xtraeme  5928:                 <dt><span class="sect2"><a href="#id2587913">9.2.1.
1.1       grant    5929:                 Anatomy of a buildlink3.mk file</a></span></dt>
                   5930: 
1.15    ! xtraeme  5931:                 <dt><span class="sect2"><a href="#id2588354">9.2.2.
1.14      xtraeme  5932:                 Updating <code class=
                   5933:                 "varname">BUILDLINK_DEPENDS.<em class=
                   5934:                 "replaceable"><code>pkg</code></em></code> in
                   5935:                 <code class="filename">buildlink3.mk</code>
1.1       grant    5936:                 files</a></span></dt>
                   5937:               </dl>
                   5938:             </dd>
                   5939: 
1.15    ! xtraeme  5940:             <dt><span class="sect1"><a href="#id2588433">9.3.
1.14      xtraeme  5941:             Writing <code class="filename">builtin.mk</code>
                   5942:             files</a></span></dt>
1.1       grant    5943: 
                   5944:             <dd>
                   5945:               <dl>
1.15    ! xtraeme  5946:                 <dt><span class="sect2"><a href="#id2588582">9.3.1.
1.14      xtraeme  5947:                 Anatomy of a <code class=
                   5948:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    5949: 
1.15    ! xtraeme  5950:                 <dt><span class="sect2"><a href="#id2588877">9.3.2.
1.1       grant    5951:                 Global preferences for native or pkgsrc
                   5952:                 software</a></span></dt>
                   5953:               </dl>
                   5954:             </dd>
                   5955:           </dl>
                   5956:         </div>
                   5957: 
                   5958:         <p>Buildlink is a framework in pkgsrc that controls what
                   5959:         headers and libraries are seen by a package's configure and
                   5960:         build processes. This is implemented in a two step
                   5961:         process:</p>
                   5962: 
                   5963:         <div class="orderedlist">
                   5964:           <ol type="1">
                   5965:             <li>
                   5966:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  5967:               into <code class="varname">BUILDLINK_DIR</code>,
                   5968:               which by default is a subdirectory of <code class=
                   5969:               "varname">WRKDIR</code>.</p>
1.1       grant    5970:             </li>
                   5971: 
                   5972:             <li>
                   5973:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  5974:               the normal compiler tools that translate <code class=
                   5975:               "option">-I${LOCALBASE}/include</code> and
                   5976:               <code class="option">-L${LOCALBASE}/lib</code> into
                   5977:               references to <code class=
                   5978:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   5979:               also make native compiler on some operating systems
                   5980:               look like GCC, so that packages that expect GCC won't
                   5981:               require modifications to build with those native
                   5982:               compilers.</p>
1.1       grant    5983:             </li>
                   5984:           </ol>
                   5985:         </div>
                   5986: 
                   5987:         <p>This normalizes the environment in which a package is
                   5988:         built so that the package may be built consistently despite
                   5989:         what other software may be installed. Please note that the
1.14      xtraeme  5990:         normal system header and library paths, e.g. <code class=
                   5991:         "filename">/usr/include</code>, <code class=
                   5992:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    5993:         buildlink3 is designed to insulate the package build from
                   5994:         non-system-supplied software.</p>
                   5995: 
                   5996:         <div class="sect1" lang="en" xml:lang="en">
                   5997:           <div class="titlepage">
                   5998:             <div>
                   5999:               <div>
                   6000:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  6001:                 "id2587653" id="id2587653"></a>9.1.&nbsp;Converting
1.1       grant    6002:                 packages to use buildlink3</h2>
                   6003:               </div>
                   6004:             </div>
                   6005:           </div>
                   6006: 
                   6007:           <p>The process of converting packages to use the
                   6008:           buildlink3 framework (&#8220;<span class=
                   6009:           "quote">bl3ifying</span>&#8221;) is fairly
                   6010:           straightforward. The things to keep in mind are:</p>
                   6011: 
                   6012:           <div class="orderedlist">
                   6013:             <ol type="1">
                   6014:               <li>
1.14      xtraeme  6015:                 <p>Set <code class="varname">USE_BUILDLINK3</code>
                   6016:                 to &#8220;<span class=
                   6017:                 "quote">yes</span>&#8221;.</p>
1.1       grant    6018:               </li>
                   6019: 
                   6020:               <li>
                   6021:                 <p>Ensure that the build always calls the wrapper
                   6022:                 scripts instead of the actual toolchain. Some
                   6023:                 packages are tricky, and the only way to know for
1.14      xtraeme  6024:                 sure is the check <code class=
                   6025:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    6026:                 wrappers are being invoked.</p>
                   6027:               </li>
                   6028: 
                   6029:               <li>
1.14      xtraeme  6030:                 <p>Don't override <code class=
                   6031:                 "varname">PREFIX</code> from within the package
                   6032:                 Makefile, e.g. Java VMs, standalone shells, etc.,
                   6033:                 because the code to symlink files into <code class=
                   6034:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    6035:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  6036:                 <em class=
                   6037:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    6038:               </li>
                   6039: 
                   6040:               <li>
                   6041:                 <p>Remember that <span class=
1.14      xtraeme  6042:                 "emphasis"><em>only</em></span> the <code class=
                   6043:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    6044:                 in a package's Makefile are added as dependencies
                   6045:                 for that package.</p>
                   6046:               </li>
                   6047:             </ol>
                   6048:           </div>
                   6049: 
                   6050:           <p>If a dependency on a particular package is required
                   6051:           for its libraries and headers, then we replace:</p>
                   6052:           <pre class="programlisting">
                   6053: DEPENDS+=       foo&gt;=1.1.0:../../category/foo
                   6054: </pre>
                   6055: 
                   6056:           <p>with</p>
                   6057:           <pre class="programlisting">
                   6058: .include "../../category/foo/buildlink3.mk"
                   6059: </pre>
                   6060: 
1.14      xtraeme  6061:           <p>There are several <code class=
                   6062:           "filename">buildlink3.mk</code> files in <code class=
                   6063:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    6064:           issues:</p>
                   6065: 
                   6066:           <div class="itemizedlist">
                   6067:             <ul type="disc">
                   6068:               <li>
1.14      xtraeme  6069:                 <p><code class="filename">bdb.buildlink3.mk</code>
1.1       grant    6070:                 chooses either the native or a pkgsrc Berkeley DB
1.14      xtraeme  6071:                 implementation based on the values of <code class=
                   6072:                 "varname">BDB_ACCEPTED</code> and <code class=
                   6073:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    6074:               </li>
                   6075: 
                   6076:               <li>
1.14      xtraeme  6077:                 <p><code class=
                   6078:                 "filename">curses.buildlink3.mk</code> If the
                   6079:                 system comes with neither Curses nor NCurses, this
                   6080:                 will take care to install the <a xmlns=
                   6081:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    6082:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.14      xtraeme  6083:                 class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    6084:               </li>
                   6085: 
                   6086:               <li>
1.14      xtraeme  6087:                 <p><code class="filename">krb5.buildlink3.mk</code>
                   6088:                 uses the value of <code class=
                   6089:                 "varname">KRB5_ACCEPTED</code> to choose between
1.1       grant    6090:                 adding a dependency on Heimdal or MIT-krb5 for
                   6091:                 packages that require a Kerberos 5
                   6092:                 implementation.</p>
                   6093:               </li>
                   6094: 
                   6095:               <li>
1.14      xtraeme  6096:                 <p><code class=
                   6097:                 "filename">motif.buildlink3.mk</code> checks for a
                   6098:                 system-provided Motif installation or adds a
                   6099:                 dependency on <a xmlns=
1.1       grant    6100:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6101:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.14      xtraeme  6102:                 class="pkgname">x11/lesstif</a> or <a xmlns=
                   6103:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6104:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
                   6105:                 class="pkgname">x11/openmotif</a>;</p>
1.1       grant    6106:               </li>
                   6107: 
                   6108:               <li>
1.14      xtraeme  6109:                 <p><code class=
                   6110:                 "filename">ossaudio.buildlink3.mk</code> defines
                   6111:                 several variables that may be used by packages that
                   6112:                 use the Open Sound System (OSS) API;</p>
1.1       grant    6113:               </li>
                   6114: 
                   6115:               <li>
1.14      xtraeme  6116:                 <p><code class=
                   6117:                 "filename">pgsql.buildlink3.mk</code> will accept
                   6118:                 either Postgres 7.3 or 7.4, whichever is found
                   6119:                 installed. See the file for more information.</p>
1.1       grant    6120:               </li>
                   6121: 
                   6122:               <li>
1.14      xtraeme  6123:                 <p><code class=
                   6124:                 "filename">pthread.buildlink3.mk</code> uses the
                   6125:                 value of <code class="varname">PTHREAD_OPTS</code>
                   6126:                 and checks for native pthreads or adds a dependency
                   6127:                 on <a xmlns=
1.1       grant    6128:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6129:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.14      xtraeme  6130:                 class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    6131:               </li>
                   6132: 
                   6133:               <li>
1.14      xtraeme  6134:                 <p><code class="filename">xaw.buildlink3.mk</code>
                   6135:                 uses the value of <code class=
                   6136:                 "varname">XAW_TYPE</code> to choose a particular
                   6137:                 Athena widgets library.</p>
1.1       grant    6138:               </li>
                   6139:             </ul>
                   6140:           </div>
                   6141: 
1.14      xtraeme  6142:           <p>The comments in those <code class=
                   6143:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    6144:           complete description of how to use them properly.</p>
                   6145:         </div>
                   6146: 
                   6147:         <div class="sect1" lang="en" xml:lang="en">
                   6148:           <div class="titlepage">
                   6149:             <div>
                   6150:               <div>
                   6151:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  6152:                 "id2587844" id="id2587844"></a>9.2.&nbsp;Writing
1.14      xtraeme  6153:                 <code class="filename">buildlink3.mk</code>
                   6154:                 files</h2>
1.1       grant    6155:               </div>
                   6156:             </div>
                   6157:           </div>
                   6158: 
1.14      xtraeme  6159:           <p>A package's <code class=
                   6160:           "filename">buildlink3.mk</code> file is included by
                   6161:           Makefiles to indicate the need to compile and link
                   6162:           against header files and libraries provided by the
                   6163:           package. A <code class="filename">buildlink3.mk</code>
                   6164:           file should always provide enough information to add the
                   6165:           correct type of dependency relationship and include any
                   6166:           other <code class="filename">buildlink3.mk</code> files
                   6167:           that it needs to find headers and libraries that it needs
                   6168:           in turn.</p>
1.1       grant    6169: 
1.14      xtraeme  6170:           <p>To generate an initial <code class=
                   6171:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    6172:           Rene Hexel's <a xmlns=
                   6173:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6174:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.14      xtraeme  6175:           class="pkgname">pkgtools/createbuildlink</a> package is
                   6176:           highly recommended. For most packages, the following
                   6177:           command will generate a good starting point for
                   6178:           <code class="filename">buildlink3.mk</code> files:</p>
1.1       grant    6179:           <pre class="screen">
1.14      xtraeme  6180: <code class="prompt">%</code> <strong class=
                   6181: "userinput"><code>cd pkgsrc/<em class=
                   6182: "replaceable"><code>category</code></em>/<em class=
                   6183: "replaceable"><code>pkgdir</code></em>
                   6184: <code class=
                   6185: "prompt">%</code> createbuildlink -3 &gt;buildlink3.mk</code></strong>
1.1       grant    6186: </pre>
                   6187: 
                   6188:           <div class="sect2" lang="en" xml:lang="en">
                   6189:             <div class="titlepage">
                   6190:               <div>
                   6191:                 <div>
1.15    ! xtraeme  6192:                   <h3 class="title"><a name="id2587913" id=
        !          6193:                   "id2587913"></a>9.2.1. Anatomy of a buildlink3.mk
1.1       grant    6194:                   file</h3>
                   6195:                 </div>
                   6196:               </div>
                   6197:             </div>
                   6198: 
1.14      xtraeme  6199:             <p>The following real-life example <code class=
                   6200:             "filename">buildlink3.mk</code> is taken from
                   6201:             <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    6202:             <pre class="programlisting">
1.11      ben      6203: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    6204: 
                   6205: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   6206: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   6207: 
                   6208: .if !empty(BUILDLINK_DEPTH:M+)
                   6209: BUILDLINK_DEPENDS+=     tiff
                   6210: .endif
                   6211: 
                   6212: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   6213: BUILDLINK_PACKAGES+=    tiff
                   6214: 
                   6215: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   6216: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   6217: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   6218: .endif  # TIFF_BUILDLINK3_MK
                   6219: 
                   6220: .include "../../devel/zlib/buildlink3.mk"
                   6221: .include "../../graphics/jpeg/buildlink3.mk"
                   6222: 
                   6223: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   6224: </pre>
                   6225: 
1.14      xtraeme  6226:             <p>The header and footer manipulate <code class=
                   6227:             "varname">BUILDLINK_DEPTH</code>, which is common
                   6228:             across all <code class="filename">buildlink3.mk</code>
                   6229:             files and is used to track at what depth we are
                   6230:             including <code class="filename">buildlink3.mk</code>
                   6231:             files.</p>
1.1       grant    6232: 
                   6233:             <p>The first section controls if the dependency on
1.14      xtraeme  6234:             <em class="replaceable"><code>pkg</code></em> is added.
                   6235:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    6236:             global list of packages for which dependencies are
                   6237:             added by buildlink3.</p>
                   6238: 
                   6239:             <p>The second section advises pkgsrc that the
1.14      xtraeme  6240:             <code class="filename">buildlink3.mk</code> file for
                   6241:             <em class="replaceable"><code>pkg</code></em> has been
                   6242:             included at some point. <code class=
                   6243:             "varname">BUILDLINK_PACKAGES</code> is the global list
                   6244:             of packages for which <code class=
                   6245:             "filename">buildlink3.mk</code> files have been
                   6246:             included. It must <span class=
                   6247:             "emphasis"><em>always</em></span> be appended to within
                   6248:             a <code class="filename">buildlink3.mk</code> file.</p>
1.1       grant    6249: 
                   6250:             <p>The third section is protected from multiple
1.14      xtraeme  6251:             inclusion and controls how the dependency on <em class=
                   6252:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    6253:             important variables are set in the section:</p>
                   6254: 
                   6255:             <div class="itemizedlist">
                   6256:               <ul type="disc">
                   6257:                 <li>
1.14      xtraeme  6258:                   <p><code class=
                   6259:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6260:                   "replaceable"><code>pkg</code></em></code> is the
                   6261:                   actual dependency recorded in the installed
                   6262:                   package; this should always be set using
                   6263:                   <span><strong class="command">+=</strong></span>
                   6264:                   to ensure that we're appending to any
                   6265:                   pre-existing list of values. This variable should
                   6266:                   be set to the first version of the package that
                   6267:                   had the last change in the major number of a
                   6268:                   shared library or that had a major API
                   6269:                   change.</p>
1.1       grant    6270:                 </li>
                   6271: 
                   6272:                 <li>
1.14      xtraeme  6273:                   <p><code class=
                   6274:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   6275:                   "replaceable"><code>pkg</code></em></code> is the
                   6276:                   location of the <em class=
                   6277:                   "replaceable"><code>pkg</code></em> pkgsrc
1.1       grant    6278:                   directory;</p>
                   6279:                 </li>
                   6280: 
                   6281:                 <li>
1.14      xtraeme  6282:                   <p><code class=
                   6283:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6284:                   "replaceable"><code>pkg</code></em></code> (not
                   6285:                   shown above) controls whether we use <code class=
                   6286:                   "varname">BUILD_DEPENDS</code> or <code class=
                   6287:                   "varname">DEPENDS</code> to add the dependency on
                   6288:                   <em class="replaceable"><code>pkg</code></em>.
                   6289:                   The build dependency is selected by setting
                   6290:                   <code class=
                   6291:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6292:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    6293:                   &#8220;<span class="quote">build</span>&#8221;.
                   6294:                   By default, the full dependency is used.</p>
                   6295:                 </li>
                   6296: 
                   6297:                 <li>
1.14      xtraeme  6298:                   <p><code class=
                   6299:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6300:                   "replaceable"><code>pkg</code></em></code> and
                   6301:                   <code class=
                   6302:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
                   6303:                   <code>pkg</code></em></code> (not shown above)
                   6304:                   are lists of subdirectories of <code class=
                   6305:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6306:                   "replaceable"><code>pkg</code></em>}</code> to
                   6307:                   add to the header and library search paths. These
1.1       grant    6308:                   default to &#8220;<span class=
                   6309:                   "quote">include</span>&#8221; and
                   6310:                   &#8220;<span class="quote">lib</span>&#8221;
                   6311:                   respectively.</p>
                   6312:                 </li>
                   6313: 
                   6314:                 <li>
1.14      xtraeme  6315:                   <p><code class=
                   6316:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   6317:                   "replaceable"><code>pkg</code></em></code> (not
                   6318:                   shown above) is the list of preprocessor flags to
                   6319:                   add to <code class="varname">CPPFLAGS</code>,
                   6320:                   which are passed on to the configure and build
                   6321:                   phases. The &#8220;<span class=
                   6322:                   "quote">-I</span>&#8221; option should be avoided
                   6323:                   and instead be handled using <code class=
                   6324:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6325:                   "replaceable"><code>pkg</code></em></code> as
                   6326:                   above.</p>
1.1       grant    6327:                 </li>
                   6328:               </ul>
                   6329:             </div>
                   6330: 
                   6331:             <p>The following variables are all optionally defined
                   6332:             within this second section (protected against multiple
                   6333:             inclusion) and control which package files are
1.14      xtraeme  6334:             symlinked into <code class=
                   6335:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    6336:             are transformed during the symlinking:</p>
                   6337: 
                   6338:             <div class="itemizedlist">
                   6339:               <ul type="disc">
                   6340:                 <li>
1.14      xtraeme  6341:                   <p><code class=
                   6342:                   "varname">BUILDLINK_FILES.<em class=
                   6343:                   "replaceable"><code>pkg</code></em></code> (not
                   6344:                   shown above) is a shell glob pattern relative to
                   6345:                   <code class=
                   6346:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6347:                   "replaceable"><code>pkg</code></em>}</code> to be
                   6348:                   symlinked into <code class=
                   6349:                   "filename">${BUILDLINK_DIR}</code>, e.g.
                   6350:                   <code class="filename">include/*.h</code>.</p>
1.1       grant    6351:                 </li>
                   6352: 
                   6353:                 <li>
1.14      xtraeme  6354:                   <p><code class=
                   6355:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   6356:                   "replaceable"><code>pkg</code></em></code> (not
                   6357:                   shown above) is a shell pipeline that outputs to
                   6358:                   stdout a list of files relative to <code class=
                   6359:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6360:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    6361:                   resulting files are to be symlinked into
1.14      xtraeme  6362:                   <code class="filename">${BUILDLINK_DIR}</code>.
                   6363:                   By default, this takes the <code class=
                   6364:                   "filename">+CONTENTS</code> of a <em class=
                   6365:                   "replaceable"><code>pkg</code></em> and filters
                   6366:                   it through <code class=
                   6367:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   6368:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    6369:                 </li>
                   6370: 
                   6371:                 <li>
1.14      xtraeme  6372:                   <p><code class=
                   6373:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6374:                   "replaceable"><code>pkg</code></em></code> (not
                   6375:                   shown above) is a filter command that filters
                   6376:                   <code class="filename">+CONTENTS</code> input
                   6377:                   into a list of files relative to <code class=
                   6378:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6379:                   "replaceable"><code>pkg</code></em>}</code> on
                   6380:                   stdout. By default for overwrite packages,
                   6381:                   <code class=
                   6382:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6383:                   "replaceable"><code>pkg</code></em></code>
                   6384:                   outputs the contents of the <code class=
                   6385:                   "filename">include</code> and <code class=
                   6386:                   "filename">lib</code> directories in the package
                   6387:                   <code class="filename">+CONTENTS</code>, and for
                   6388:                   pkgviews packages, it outputs any libtool
                   6389:                   archives in <code class="filename">lib</code>
1.1       grant    6390:                   directories.</p>
                   6391:                 </li>
                   6392: 
                   6393:                 <li>
1.14      xtraeme  6394:                   <p><code class=
                   6395:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   6396:                   "replaceable"><code>pkg</code></em></code> (not
                   6397:                   shown above) is a list of sed arguments used to
1.1       grant    6398:                   transform the name of the source filename into a
1.14      xtraeme  6399:                   destination filename, e.g. <span><strong class=
1.1       grant    6400:                   "command">-e
1.14      xtraeme  6401:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    6402:                 </li>
                   6403:               </ul>
                   6404:             </div>
                   6405: 
1.14      xtraeme  6406:             <p>The last section includes any <code class=
                   6407:             "filename">buildlink3.mk</code> needed for <em class=
                   6408:             "replaceable"><code>pkg</code></em>'s library
                   6409:             dependencies. Including these <code class=
                   6410:             "filename">buildlink3.mk</code> files means that the
                   6411:             headers and libraries for these dependencies are also
                   6412:             symlinked into <code class=
                   6413:             "filename">${BUILDLINK_DIR}</code> whenever the
                   6414:             <em class="replaceable"><code>pkg</code></em>
                   6415:             <code class="filename">buildlink3.mk</code> file is
                   6416:             included.</p>
1.1       grant    6417:           </div>
                   6418: 
                   6419:           <div class="sect2" lang="en" xml:lang="en">
                   6420:             <div class="titlepage">
                   6421:               <div>
                   6422:                 <div>
1.15    ! xtraeme  6423:                   <h3 class="title"><a name="id2588354" id=
        !          6424:                   "id2588354"></a>9.2.2. Updating <code class=
1.14      xtraeme  6425:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6426:                   "replaceable"><code>pkg</code></em></code> in
                   6427:                   <code class="filename">buildlink3.mk</code>
                   6428:                   files</h3>
1.1       grant    6429:                 </div>
                   6430:               </div>
                   6431:             </div>
                   6432: 
                   6433:             <p>There are two situations that require increasing the
1.14      xtraeme  6434:             dependency listed in <code class=
                   6435:             "varname">BUILDLINK_DEPENDS.<em class=
                   6436:             "replaceable"><code>pkg</code></em></code> after a
                   6437:             package update:</p>
1.1       grant    6438: 
                   6439:             <div class="orderedlist">
                   6440:               <ol type="1">
                   6441:                 <li>
                   6442:                   <p>if the sonames (major number of the library
                   6443:                   version) of any installed shared libraries
                   6444:                   change;</p>
                   6445:                 </li>
                   6446: 
                   6447:                 <li>
                   6448:                   <p>if the API or interface to the header files
                   6449:                   change.</p>
                   6450:                 </li>
                   6451:               </ol>
                   6452:             </div>
                   6453: 
1.14      xtraeme  6454:             <p>In these cases, <code class=
                   6455:             "varname">BUILDLINK_DEPENDS.<em class=
                   6456:             "replaceable"><code>pkg</code></em></code> should be
                   6457:             adjusted to require at least the new package version.
                   6458:             In some cases, the packages that depend on this new
                   6459:             version may need their <code class=
                   6460:             "varname">PKGREVISION</code>s increased and, if they
                   6461:             have <code class="filename">buildlink3.mk</code> files,
                   6462:             their <code class=
                   6463:             "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
                   6464:             pkg</code></em></code> adjusted, too. This is needed so
                   6465:             that binary packages made using it will require the
                   6466:             correct package dependency and not settle for an older
                   6467:             one which will not contain the necessary shared
                   6468:             libraries.</p>
1.1       grant    6469: 
                   6470:             <p>Please take careful consideration before adjusting
1.14      xtraeme  6471:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   6472:             "replaceable"><code>pkg</code></em></code> as we don't
                   6473:             want to cause unneeded package deletions and rebuilds.
                   6474:             In many cases, new versions of packages work just fine
                   6475:             with older dependencies. See <a href="#dependencies"
                   6476:             title="12.1.3.&nbsp;Handling dependencies">Section
                   6477:             12.1.3, &#8220;Handling dependencies&#8221;</a> and
                   6478:             <a href="#buildlink" title=
1.1       grant    6479:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter 9,
                   6480:             <i>Buildlink methodology</i></a> for more information
                   6481:             about dependencies on other packages, including the
1.14      xtraeme  6482:             <code class="varname">BUILDLINK_RECOMMENDED</code> and
                   6483:             <code class="varname">RECOMMENDED</code>
                   6484:             definitions.</p>
1.1       grant    6485:           </div>
                   6486:         </div>
                   6487: 
                   6488:         <div class="sect1" lang="en" xml:lang="en">
                   6489:           <div class="titlepage">
                   6490:             <div>
                   6491:               <div>
                   6492:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  6493:                 "id2588433" id="id2588433"></a>9.3.&nbsp;Writing
1.14      xtraeme  6494:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    6495:               </div>
                   6496:             </div>
                   6497:           </div>
                   6498: 
                   6499:           <p>Some packages in pkgsrc install headers and libraries
                   6500:           that coincide with headers and libraries present in the
1.14      xtraeme  6501:           base system. Aside from a <code class=
                   6502:           "filename">buildlink3.mk</code> file, these packages
                   6503:           should also include a <code class=
                   6504:           "filename">builtin.mk</code> file that includes the
                   6505:           necessary checks to decide whether using the built-in
                   6506:           software or the pkgsrc software is appropriate.</p>
1.1       grant    6507: 
                   6508:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  6509:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    6510: 
                   6511:           <div class="orderedlist">
                   6512:             <ol type="1">
                   6513:               <li>
1.14      xtraeme  6514:                 <p>It should set <code class=
                   6515:                 "varname">USE_BUILTIN.<em class=
                   6516:                 "replaceable"><code>pkg</code></em></code> to
                   6517:                 either &#8220;<span class="quote">yes</span>&#8221;
                   6518:                 or &#8220;<span class="quote">no</span>&#8221;
                   6519:                 after it is included.</p>
1.1       grant    6520:               </li>
                   6521: 
                   6522:               <li>
                   6523:                 <p>It should <span class=
                   6524:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  6525:                 <code class="varname">USE_BUILTIN.<em class=
                   6526:                 "replaceable"><code>pkg</code></em></code> which is
                   6527:                 already set before the <code class=
                   6528:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    6529:               </li>
                   6530: 
                   6531:               <li>
                   6532:                 <p>It should be written to allow multiple
                   6533:                 inclusion. This is <span class=
                   6534:                 "emphasis"><em>very</em></span> important and takes
1.14      xtraeme  6535:                 careful attention to <code class=
                   6536:                 "filename">Makefile</code> coding.</p>
1.1       grant    6537:               </li>
                   6538:             </ol>
                   6539:           </div>
                   6540: 
                   6541:           <div class="sect2" lang="en" xml:lang="en">
                   6542:             <div class="titlepage">
                   6543:               <div>
                   6544:                 <div>
1.15    ! xtraeme  6545:                   <h3 class="title"><a name="id2588582" id=
        !          6546:                   "id2588582"></a>9.3.1.&nbsp;Anatomy of a
1.14      xtraeme  6547:                   <code class="filename">builtin.mk</code>
                   6548:                   file</h3>
1.1       grant    6549:                 </div>
                   6550:               </div>
                   6551:             </div>
                   6552: 
                   6553:             <p>The following is the recommended template for
                   6554:             builtin.mk files:</p>
                   6555:             <pre class="programlisting">
                   6556: .if !defined(IS_BUILTIN.foo)
                   6557: #
                   6558: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   6559: # genuinely exists in the system or not.
                   6560: #
                   6561: IS_BUILTIN.foo?=        no
                   6562: 
                   6563: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   6564: # version can be determined.
                   6565: #
                   6566: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   6567: BUILTIN_PKG.foo?=       foo-1.0
                   6568: .  endif
                   6569: .endif  # IS_BUILTIN.foo
                   6570: 
                   6571: .if !defined(USE_BUILTIN.foo)
                   6572: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   6573: .  if defined(BUILTIN_PKG.foo)
                   6574: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   6575: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   6576: USE_BUILTIN.foo!=                                                       \
                   6577:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   6578:               ${ECHO} "yes";                                            \
                   6579:       else                                                              \
                   6580:               ${ECHO} "no";                                             \
                   6581:       fi
                   6582: .      endif
                   6583: .    endfor
                   6584: .  endif
                   6585: .endif  # USE_BUILTIN.foo
                   6586: 
                   6587: CHECK_BUILTIN.foo?=     no
                   6588: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   6589: #
                   6590: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   6591: # "yes" or "no".
                   6592: #
                   6593: .endif  # CHECK_BUILTIN.foo
                   6594:       
                   6595: </pre>
                   6596: 
1.14      xtraeme  6597:             <p>The first section sets <code class=
                   6598:             "varname">IS_BUILTIN.<em class=
                   6599:             "replaceable"><code>pkg</code></em></code> depending on
                   6600:             if <em class="replaceable"><code>pkg</code></em> really
                   6601:             exists in the base system. This should not be a base
                   6602:             system software with similar functionality to
                   6603:             <em class="replaceable"><code>pkg</code></em>; it
                   6604:             should only be &#8220;<span class=
                   6605:             "quote">yes</span>&#8221; if the actual package is
                   6606:             included as part of the base system. This variable is
                   6607:             only used internally within the <code class=
                   6608:             "filename">builtin.mk</code> file.</p>
                   6609: 
                   6610:             <p>The second section sets <code class=
                   6611:             "varname">BUILTIN_PKG.<em class=
                   6612:             "replaceable"><code>pkg</code></em></code> to the
                   6613:             version of <em class=
                   6614:             "replaceable"><code>pkg</code></em> in the base system
                   6615:             if it exists (if <code class=
                   6616:             "varname">IS_BUILTIN.<em class=
                   6617:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6618:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  6619:             variable is only used internally within the
                   6620:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    6621: 
1.14      xtraeme  6622:             <p>The third section sets <code class=
                   6623:             "varname">USE_BUILTIN.<em class=
                   6624:             "replaceable"><code>pkg</code></em></code> and is
                   6625:             <span class="emphasis"><em>required</em></span> in all
                   6626:             <code class="filename">builtin.mk</code> files. The
                   6627:             code in this section must make the determination
                   6628:             whether the built-in software is adequate to satisfy
                   6629:             the dependencies listed in <code class=
                   6630:             "varname">BUILDLINK_DEPENDS.<em class=
                   6631:             "replaceable"><code>pkg</code></em></code>. This is
                   6632:             typically done by comparing <code class=
                   6633:             "varname">BUILTIN_PKG.<em class=
                   6634:             "replaceable"><code>pkg</code></em></code> against each
                   6635:             of the dependencies in <code class=
                   6636:             "varname">BUILDLINK_DEPENDS.<em class=
                   6637:             "replaceable"><code>pkg</code></em></code>.
                   6638:             <code class="varname">USE_BUILTIN.<em class=
                   6639:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    6640:             "emphasis"><em>must</em></span> be set to the correct
1.14      xtraeme  6641:             value by the end of the <code class=
                   6642:             "filename">builtin.mk</code> file. Note that
                   6643:             <code class="varname">USE_BUILTIN.<em class=
                   6644:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    6645:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  6646:             <code class="varname">IS_BUILTIN.<em class=
                   6647:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6648:             &#8220;<span class="quote">no</span>&#8221; because we
                   6649:             may make the determination that the built-in version of
                   6650:             the software is similar enough to be used as a
                   6651:             replacement.</p>
                   6652: 
1.14      xtraeme  6653:             <p>The last section is guarded by <code class=
                   6654:             "varname">CHECK_BUILTIN.<em class=
                   6655:             "replaceable"><code>pkg</code></em></code>, and
                   6656:             includes code that uses the value of <code class=
                   6657:             "varname">USE_BUILTIN.<em class=
                   6658:             "replaceable"><code>pkg</code></em></code> set in the
                   6659:             previous section. This typically includes, e.g., adding
1.1       grant    6660:             additional dependency restrictions and listing
1.14      xtraeme  6661:             additional files to symlink into <code class=
                   6662:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   6663:             "varname">BUILDLINK_FILES.<em class=
                   6664:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    6665:           </div>
                   6666: 
                   6667:           <div class="sect2" lang="en" xml:lang="en">
                   6668:             <div class="titlepage">
                   6669:               <div>
                   6670:                 <div>
1.15    ! xtraeme  6671:                   <h3 class="title"><a name="id2588877" id=
        !          6672:                   "id2588877"></a>9.3.2.&nbsp;Global preferences
1.1       grant    6673:                   for native or pkgsrc software</h3>
                   6674:                 </div>
                   6675:               </div>
                   6676:             </div>
                   6677: 
                   6678:             <p>When building packages, it's possible to choose
                   6679:             whether to set a global preference for using either the
                   6680:             built-in (native) version or the pkgsrc version of
                   6681:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  6682:             setting <code class="varname">PREFER_PKGSRC</code> and
                   6683:             <code class="varname">PREFER_NATIVE</code>. These
                   6684:             variables take values of either &#8220;<span class=
1.1       grant    6685:             "quote">yes</span>&#8221;, &#8220;<span class=
                   6686:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  6687:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   6688:             to use the pkgsrc versions of software, while
                   6689:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   6690:             to use the built-in versions. Preferences are
                   6691:             determined by the most specific instance of the package
                   6692:             in either <code class="varname">PREFER_PKGSRC</code> or
                   6693:             <code class="varname">PREFER_NATIVE</code>. If a
                   6694:             package is specified in neither or in both variables,
                   6695:             then <code class="varname">PREFER_PKGSRC</code> has
                   6696:             precedence over <code class=
                   6697:             "varname">PREFER_NATIVE</code>. For example, to require
                   6698:             using pkgsrc versions of software for all but the most
                   6699:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    6700:             <pre class="programlisting">
                   6701:         PREFER_PKGSRC=  yes
                   6702:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   6703:       
                   6704: </pre>
                   6705: 
                   6706:             <p>A package <span class=
1.14      xtraeme  6707:             "emphasis"><em>must</em></span> have a <code class=
                   6708:             "filename">builtin.mk</code> file to be listed in
                   6709:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   6710:             it is simply ignored in that list.</p>
1.1       grant    6711:           </div>
                   6712:         </div>
                   6713:       </div>
                   6714: 
                   6715:       <div class="chapter" lang="en" xml:lang="en">
                   6716:         <div class="titlepage">
                   6717:           <div>
                   6718:             <div>
                   6719:               <h2 class="title"><a name="options" id=
                   6720:               "options"></a>Chapter&nbsp;10.&nbsp;Options
                   6721:               handling</h2>
                   6722:             </div>
                   6723:           </div>
                   6724:         </div>
                   6725: 
                   6726:         <div class="toc">
                   6727:           <p><b>Table of Contents</b></p>
                   6728: 
                   6729:           <dl>
1.15    ! xtraeme  6730:             <dt><span class="sect1"><a href="#id2588950">10.1.
1.1       grant    6731:             Global default options</a></span></dt>
                   6732: 
1.15    ! xtraeme  6733:             <dt><span class="sect1"><a href="#id2588965">10.2.
1.14      xtraeme  6734:             Converting packages to use <code class=
                   6735:             "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    6736:           </dl>
                   6737:         </div>
                   6738: 
                   6739:         <p>Many packages have the ability to be built to support
1.14      xtraeme  6740:         different sets of features. <code class=
                   6741:         "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1       grant    6742:         that provides generic handling of those options that
                   6743:         determine different ways in which the packages can be
                   6744:         built. It's possible for the user to specify exactly which
                   6745:         sets of options will be built into a package or to allow a
                   6746:         set of global default options apply.</p>
                   6747: 
                   6748:         <div class="sect1" lang="en" xml:lang="en">
                   6749:           <div class="titlepage">
                   6750:             <div>
                   6751:               <div>
                   6752:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  6753:                 "id2588950" id="id2588950"></a>10.1.&nbsp;Global
1.1       grant    6754:                 default options</h2>
                   6755:               </div>
                   6756:             </div>
                   6757:           </div>
                   6758: 
1.14      xtraeme  6759:           <p>Global default options are listed in <code class=
                   6760:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1       grant    6761:           the options that should be built into every package if
                   6762:           that option is supported. This variable should be set in
1.14      xtraeme  6763:           <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    6764:         </div>
                   6765: 
                   6766:         <div class="sect1" lang="en" xml:lang="en">
                   6767:           <div class="titlepage">
                   6768:             <div>
                   6769:               <div>
                   6770:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  6771:                 "id2588965" id=
        !          6772:                 "id2588965"></a>10.2.&nbsp;Converting packages to
1.14      xtraeme  6773:                 use <code class=
                   6774:                 "filename">bsd.options.mk</code></h2>
1.1       grant    6775:               </div>
                   6776:             </div>
                   6777:           </div>
                   6778: 
1.14      xtraeme  6779:           <p>The following example shows how <code class=
                   6780:           "filename">bsd.options.mk</code> should be use in a
                   6781:           package <code class="filename">Makefile</code>, or in a
                   6782:           file, e.g. <code class="filename">options.mk</code>, that
                   6783:           is included by the main package <code class=
                   6784:           "filename">Makefile</code>.</p>
1.1       grant    6785:           <pre class="programlisting">
                   6786: # Global and legacy options
                   6787: .if defined(WIBBLE_USE_OPENLDAP) &amp;&amp; !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
                   6788: PKG_DEFAULT_OPTIONS+=   ldap
                   6789: .endif
                   6790: .if defined(USE_SASL2) &amp;&amp; !empty(USE_SASL2:M[yY][eE][sS])
                   6791: PKG_DEFAULT_OPTIONS+=   sasl
                   6792: .endif
                   6793: 
                   6794: PKG_OPTIONS_VAR=        PKG_OPTIONS.wibble
                   6795: PKG_SUPPORTED_OPTIONS=  ldap sasl
                   6796: #
                   6797: # Default options for "wibble" package.
                   6798: #
                   6799: .if !defined(PKG_OPTIONS.wibble)
                   6800: PKG_DEFAULT_OPTIONS+=   sasl
                   6801: endif
                   6802: .include "../../mk/bsd.options.mk"
                   6803: 
                   6804: # Package-specific option-handling
                   6805: 
                   6806: ###
                   6807: ### LDAP support
                   6808: ###
                   6809: .if !empty(PKG_OPTIONS:Mldap)
                   6810: .  include "../../databases/openldap/buildlink3.mk"
                   6811: CONFIGURE_ARGS+=      --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   6812: .endif
                   6813: 
                   6814: ###
                   6815: ### SASL authentication
                   6816: ###
                   6817: .if !empty(PKG_OPTIONS:Msasl)
                   6818: .  include "../../security/cyrus-sasl2/buildlink3.mk"
                   6819: CONFIGURE_ARGS+=        --enable-sasl=${BUILDLINK_PREFIX.sasl}
                   6820: .endif
                   6821:       
                   6822: </pre>
                   6823: 
                   6824:           <p>The first section only exists if you are converting a
                   6825:           package that had its own ad-hoc options handling to use
1.14      xtraeme  6826:           <code class="filename">bsd.options.mk</code>. It converts
1.1       grant    6827:           global or legacy options variables into an equivalent
1.14      xtraeme  6828:           <code class="varname">PKG_OPTIONS.<em class=
                   6829:           "replaceable"><code>pkg</code></em></code> value. These
                   6830:           sections will be removed over time as the old options are
                   6831:           in turn deprecated and removed.</p>
1.1       grant    6832: 
                   6833:           <p>The second section contains the information about
                   6834:           which build options are supported by the package, and any
                   6835:           default options settings if needed.</p>
                   6836: 
                   6837:           <div class="orderedlist">
                   6838:             <ol type="1">
                   6839:               <li>
1.14      xtraeme  6840:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
                   6841:                 a list of the name of the <a href=
1.1       grant    6842:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6843:                 <span class="citerefentry"><span class=
                   6844:                 "refentrytitle">make</span>(1)</span></a> variables
                   6845:                 that contain the options the user wishes to select.
                   6846:                 The recommended value is &#8220;<span class=
1.14      xtraeme  6847:                 "quote">PKG_OPTIONS.<em class=
                   6848:                 "replaceable"><code>pkg</code></em></span>&#8221;
                   6849:                 but any package-specific value may be used. This
1.1       grant    6850:                 variable should be set in a package Makefile.</p>
                   6851:               </li>
                   6852: 
                   6853:               <li>
1.14      xtraeme  6854:                 <p><code class=
                   6855:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
                   6856:                 build options supported by the package. This
                   6857:                 variable should be set in a package Makefile.</p>
1.1       grant    6858:               </li>
                   6859: 
                   6860:               <li>
1.14      xtraeme  6861:                 <p><code class="varname">${PKG_OPTIONS_VAR}</code>
                   6862:                 (the variables named in <code class=
                   6863:                 "varname">PKG_OPTIONS_VAR</code>) are variables
                   6864:                 that list the selected build options and override
                   6865:                 any default options given in <code class=
                   6866:                 "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1       grant    6867:                 options begin with a &#8220;<span class=
                   6868:                 "quote">-</span>&#8221;, then that option is always
                   6869:                 removed from the selected build options, e.g.</p>
                   6870:                 <pre class="programlisting">
                   6871:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   6872:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6873:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
                   6874:         # implies PKG_OPTIONS == "kerberos ldap"
                   6875:           
                   6876: </pre>
                   6877: 
                   6878:                 <p>or</p>
                   6879:                 <pre class="programlisting">
                   6880:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6881:         WIBBLE_OPTIONS=         kerberos -ldap ldap
                   6882:         # implies PKG_OPTIONS == "kerberos"
                   6883:           
                   6884: </pre>
                   6885: 
1.14      xtraeme  6886:                 <p>This variable should be set in <code class=
                   6887:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    6888:               </li>
                   6889:             </ol>
                   6890:           </div>
                   6891: 
                   6892:           <p>After the inclusion of bsd.options.mk, the following
                   6893:           variables are set:</p>
                   6894: 
                   6895:           <div class="itemizedlist">
                   6896:             <ul type="disc">
                   6897:               <li>
1.14      xtraeme  6898:                 <p><code class="varname">PKG_OPTIONS</code>
                   6899:                 contains the list of the selected build options,
                   6900:                 properly filtered to remove unsupported and
                   6901:                 duplicate options.</p>
1.1       grant    6902:               </li>
                   6903:             </ul>
                   6904:           </div>
                   6905: 
                   6906:           <p>The remaining sections contain the logic that is
                   6907:           specific to each option. There should be a check for
1.14      xtraeme  6908:           every option listed in <code class=
                   6909:           "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
                   6910:           be clear documentation on what turning on the option will
                   6911:           do in the comments preceding each section. The correct
                   6912:           way to check for an option is to check whether it is
                   6913:           listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1       grant    6914:         </div>
                   6915:       </div>
                   6916: 
                   6917:       <div class="chapter" lang="en" xml:lang="en">
                   6918:         <div class="titlepage">
                   6919:           <div>
                   6920:             <div>
                   6921:               <h2 class="title"><a name="build" id=
                   6922:               "build"></a>Chapter&nbsp;11.&nbsp;The build
                   6923:               process</h2>
                   6924:             </div>
                   6925:           </div>
                   6926:         </div>
                   6927: 
                   6928:         <div class="toc">
                   6929:           <p><b>Table of Contents</b></p>
                   6930: 
                   6931:           <dl>
                   6932:             <dt><span class="sect1"><a href="#build.prefix">11.1.
                   6933:             Program location</a></span></dt>
                   6934: 
1.15    ! xtraeme  6935:             <dt><span class="sect1"><a href="#id2589573">11.2. Main
1.1       grant    6936:             targets</a></span></dt>
                   6937: 
                   6938:             <dt><span class="sect1"><a href=
                   6939:             "#build.helpful-targets">11.3. Other helpful
                   6940:             targets</a></span></dt>
                   6941:           </dl>
                   6942:         </div>
                   6943: 
                   6944:         <p>The basic steps for building a program are always the
                   6945:         same. First the program's source (<span class=
                   6946:         "emphasis"><em>distfile</em></span>) must be brought to the
                   6947:         local system and then extracted. After any patches to
                   6948:         compile properly on NetBSD are applied, the software can be
                   6949:         configured, then built (usually by compiling), and finally
                   6950:         the generated binaries, etc. can be put into place on the
                   6951:         system. These are exactly the steps performed by the NetBSD
                   6952:         package system, which is implemented as a series of targets
1.14      xtraeme  6953:         in a central Makefile, <code class=
                   6954:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    6955: 
                   6956:         <div class="sect1" lang="en" xml:lang="en">
                   6957:           <div class="titlepage">
                   6958:             <div>
                   6959:               <div>
                   6960:                 <h2 class="title" style="clear: both"><a name=
                   6961:                 "build.prefix" id=
                   6962:                 "build.prefix"></a>11.1.&nbsp;Program location</h2>
                   6963:               </div>
                   6964:             </div>
                   6965:           </div>
                   6966: 
                   6967:           <p>Before outlining the process performed by the NetBSD
                   6968:           package system in the next section, here's a brief
                   6969:           discussion on where programs are installed, and which
                   6970:           variables influence this.</p>
                   6971: 
1.14      xtraeme  6972:           <p>The automatic variable <code class=
                   6973:           "varname">PREFIX</code> indicates where all files of the
                   6974:           final program shall be installed. It is usually set to
                   6975:           <code class="varname">LOCALBASE</code> (<code class=
                   6976:           "filename">/usr/pkg</code>), or <code class=
                   6977:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    6978:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  6979:           The value of <code class="varname">PREFIX</code> needs to
                   6980:           be put into the various places in the program's source
                   6981:           where paths to these files are encoded. See <a href=
1.1       grant    6982:           "#components.patches" title=
                   6983:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   6984:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   6985:           title=
                   6986:           "12.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;12.3.1,
                   6987:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   6988:           details.</p>
                   6989: 
                   6990:           <p>When choosing which of these variables to use, follow
                   6991:           the following rules:</p>
                   6992: 
                   6993:           <div class="itemizedlist">
                   6994:             <ul type="disc">
                   6995:               <li>
1.14      xtraeme  6996:                 <p><code class="varname">PREFIX</code> always
                   6997:                 points to the location where the current pkg will
                   6998:                 be installed. When referring to a pkg's own
1.1       grant    6999:                 installation path, use &#8220;<span class=
                   7000:                 "quote">${PREFIX}</span>&#8221;.</p>
                   7001:               </li>
                   7002: 
                   7003:               <li>
1.14      xtraeme  7004:                 <p><code class="varname">LOCALBASE</code> is where
                   7005:                 all non-X11 pkgs are installed. If you need to
1.1       grant    7006:                 construct a -I or -L argument to the compiler to
                   7007:                 find includes and libraries installed by another
                   7008:                 non-X11 pkg, use &#8220;<span class=
                   7009:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   7010:               </li>
                   7011: 
                   7012:               <li>
1.14      xtraeme  7013:                 <p><code class="varname">X11BASE</code> is where
                   7014:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    7015:                 installed. When looking for <span class=
                   7016:                 "emphasis"><em>standard</em></span> X11 includes
                   7017:                 (not those installed by a pkg), use
                   7018:                 &#8220;<span class=
                   7019:                 "quote">${X11BASE}</span>&#8221;.</p>
                   7020:               </li>
                   7021: 
                   7022:               <li>
                   7023:                 <p>X11 based are special in that they may be
1.14      xtraeme  7024:                 installed in either <code class=
                   7025:                 "varname">X11BASE</code> or <code class=
                   7026:                 "varname">LOCALBASE</code>.</p>
1.1       grant    7027: 
                   7028:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  7029:                 <code class="varname">LOCALBASE</code> whenever
                   7030:                 possible. Note that you will need to set
                   7031:                 <code class="varname">USE_X11</code> in them to
                   7032:                 request the presence of X11 and to get the right
                   7033:                 compilation flags.</p>
1.1       grant    7034: 
                   7035:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  7036:                 be installed under <code class=
                   7037:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    7038:                 app-defaults files. These packages are special and
1.14      xtraeme  7039:                 they must be placed under <code class=
                   7040:                 "varname">X11BASE</code>. To accomplish this, set
                   7041:                 either <code class="varname">USE_X11BASE</code> or
                   7042:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    7043:                 package.</p>
                   7044: 
1.14      xtraeme  7045:                 <p>Some notes: <code class="varname">USE_X11</code>
                   7046:                 and <code class="varname">USE_X11BASE</code> are
                   7047:                 mutually exclusive. If you need to find includes or
                   7048:                 libraries installed by a pkg that has <code class=
                   7049:                 "varname">USE_IMAKE</code> or <code class=
                   7050:                 "varname">USE_X11BASE</code> in its pkg
                   7051:                 <code class="filename">Makefile</code>, you need to
                   7052:                 use <span class="emphasis"><em>both</em></span>
                   7053:                 <code class="filename">${X11BASE}</code> and
                   7054:                 <code class="filename">${LOCALBASE}</code>. To
                   7055:                 force installation of all X11 packages in
                   7056:                 <code class="varname">LOCALBASE</code>, the
                   7057:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7058:                 href=
1.1       grant    7059:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.14      xtraeme  7060:                 class="pkgname">pkgtools/xpkgwedge</a> is enabled
                   7061:                 by default.</p>
1.1       grant    7062:               </li>
                   7063: 
                   7064:               <li>
1.14      xtraeme  7065:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    7066:                 used to refer to the installed location of an X11
1.14      xtraeme  7067:                 package. <code class="varname">X11PREFIX</code>
                   7068:                 will be set to <code class="varname">X11BASE</code>
                   7069:                 if xpkgwedge is not installed, and to <code class=
                   7070:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    7071:                 installed.</p>
                   7072:               </li>
                   7073: 
                   7074:               <li>
                   7075:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  7076:                 have some packages installed in <code class=
                   7077:                 "varname">X11BASE</code> and some in <code class=
                   7078:                 "varname">LOCALBASE</code>. To determine the prefix
                   7079:                 of an installed package, the <code class=
                   7080:                 "varname">EVAL_PREFIX</code> definition can be
                   7081:                 used. It takes pairs in the format
                   7082:                 &#8220;<span class=
1.1       grant    7083:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.14      xtraeme  7084:                 the make(1) variable <code class=
                   7085:                 "varname">DIRNAME</code> will be set to the prefix
                   7086:                 of the installed package &lt;package&gt;, or
1.1       grant    7087:                 &#8220;<span class=
                   7088:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   7089:                 is not installed.</p>
                   7090: 
                   7091:                 <p>This is best illustrated by example.</p>
                   7092: 
1.14      xtraeme  7093:                 <p>The following lines are taken from <code class=
                   7094:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    7095:                 <pre class="programlisting">
1.14      xtraeme  7096: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    7097: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   7098:                         --with-gtk-prefix="${GTKDIR}"           \
                   7099:                         --enable-multibyte
                   7100: </pre>
                   7101: 
                   7102:                 <p>Specific defaults can be defined for the
1.14      xtraeme  7103:                 packages evaluated using <code class=
                   7104:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    7105:                 of the form:</p>
                   7106:                 <pre class="programlisting">
                   7107: GTKDIR_DEFAULT= ${LOCALBASE}
                   7108: </pre>
                   7109: 
1.14      xtraeme  7110:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    7111:                 corresponds to the first definition in the
1.14      xtraeme  7112:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    7113:               </li>
                   7114: 
                   7115:               <li>
1.14      xtraeme  7116:                 <p>Within <code class="filename">${PREFIX}</code>,
1.1       grant    7117:                 packages should install files according to hier(7),
                   7118:                 with the exception that manual pages go into
1.14      xtraeme  7119:                 <code class="filename">${PREFIX}/man</code>, not
                   7120:                 <code class=
                   7121:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    7122:               </li>
                   7123:             </ul>
                   7124:           </div>
                   7125:         </div>
                   7126: 
                   7127:         <div class="sect1" lang="en" xml:lang="en">
                   7128:           <div class="titlepage">
                   7129:             <div>
                   7130:               <div>
                   7131:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  7132:                 "id2589573" id="id2589573"></a>11.2.&nbsp;Main
1.1       grant    7133:                 targets</h2>
                   7134:               </div>
                   7135:             </div>
                   7136:           </div>
                   7137: 
                   7138:           <p>The main targets used during the build process defined
1.14      xtraeme  7139:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    7140: 
                   7141:           <div class="variablelist">
                   7142:             <dl>
                   7143:               <dt><span class="term">fetch</span></dt>
                   7144: 
                   7145:               <dd>
                   7146:                 <p>This will check if the file(s) given in the
1.14      xtraeme  7147:                 variables <code class="varname">DISTFILES</code>
                   7148:                 and <code class="varname">PATCHFILES</code> (as
                   7149:                 defined in the package's Makefile) are present on
                   7150:                 the local system in <code class=
                   7151:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   7152:                 are not present, an attempt will be made to fetch
                   7153:                 them using commands of the form:</p>
1.1       grant    7154:                 <pre class="programlisting">
                   7155: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   7156: </pre>
                   7157: 
                   7158:                 <p>where ${site} varies through several
1.14      xtraeme  7159:                 possibilities in turn: first, <code class=
                   7160:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   7161:                 then the sites specified in either <code class=
                   7162:                 "varname">SITES_file</code> if defined, else
                   7163:                 <code class="varname">MASTER_SITES</code> or
                   7164:                 <code class="varname">PATCH_SITES</code>, as
                   7165:                 applies, then finally the value of <code class=
                   7166:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   7167:                 all except the first can be optionally sorted by
                   7168:                 the user, via setting either <code class=
                   7169:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   7170:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    7171:               </dd>
                   7172: 
                   7173:               <dt><span class="term">checksum</span></dt>
                   7174: 
                   7175:               <dd>
                   7176:                 <p>After the distfile(s) are fetched, their
                   7177:                 checksum is generated and compared with the
                   7178:                 checksums stored in the distinfo file. If the
                   7179:                 checksums don't match, the build is aborted. This
                   7180:                 is to ensure the same distfile is used for
                   7181:                 building, and that the distfile wasn't changed,
                   7182:                 e.g. by some malign force, deliberately changed
                   7183:                 distfiles on the master distribution site or
                   7184:                 network lossage.</p>
                   7185:               </dd>
                   7186: 
                   7187:               <dt><span class="term">extract</span></dt>
                   7188: 
                   7189:               <dd>
                   7190:                 <p>When the distfiles are present on the local
                   7191:                 system, they need to be extracted, as they are
                   7192:                 usually in the form of some compressed archive
1.14      xtraeme  7193:                 format, most commonly <code class=
                   7194:                 "filename">.tar.gz</code>.</p>
1.1       grant    7195: 
                   7196:                 <p>If only some of the distfiles need to be
                   7197:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  7198:                 be put into <code class=
                   7199:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    7200: 
1.14      xtraeme  7201:                 <p>If the distfiles are not in <code class=
                   7202:                 "filename">.tar.gz</code> format, they can be
                   7203:                 extracted by setting either <code class=
                   7204:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   7205:                 "varname">EXTRACT_CMD</code>, <code class=
                   7206:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   7207:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   7208:                 the former case, pkgsrc knows how to extract a
                   7209:                 number of suffixes (<code class=
                   7210:                 "filename">.tar.gz</code>, <code class=
                   7211:                 "filename">.tgz</code>, <code class=
                   7212:                 "filename">.tar.gz2</code>, <code class=
                   7213:                 "filename">.tbz</code>, <code class=
                   7214:                 "filename">.tar.Z</code>, <code class=
                   7215:                 "filename">.tar</code>, <code class=
                   7216:                 "filename">.shar.gz</code>, <code class=
                   7217:                 "filename">.shar.bz2</code>, <code class=
                   7218:                 "filename">.shar.Z</code>, <code class=
                   7219:                 "filename">.shar</code>, <code class=
                   7220:                 "filename">.Z</code>, <code class=
                   7221:                 "filename">.bz2</code> and <code class=
                   7222:                 "filename">.gz</code>; see the definition of the
                   7223:                 various <code class="varname">DECOMPRESS_CMD</code>
                   7224:                 variables <code class="filename">bsd.pkg.mk</code>
                   7225:                 for a complete list). Here's an example on how to
                   7226:                 use the other variables for a program that comes
                   7227:                 with a compressed shell archive whose name ends in
                   7228:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    7229:                 <pre class="programlisting">
                   7230:      EXTRACT_SUFX=   .msg.gz
                   7231:      EXTRACT_CMD=            zcat
                   7232:      EXTRACT_BEFORE_ARGS=
                   7233:      EXTRACT_AFTER_ARGS=     |sh
                   7234: </pre>
                   7235:               </dd>
                   7236: 
                   7237:               <dt><span class="term">patch</span></dt>
                   7238: 
                   7239:               <dd>
                   7240:                 <p>After extraction, all the patches named by the
1.14      xtraeme  7241:                 <code class="varname">PATCHFILES</code>, those
                   7242:                 present in the patches subdirectory of the package
                   7243:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
                   7244:                 <code class=
                   7245:                 "filename">/usr/local/patches/graphics/png</code>)
                   7246:                 are applied. Patchfiles ending in <code class=
                   7247:                 "filename">.Z</code> or <code class=
                   7248:                 "filename">.gz</code> are uncompressed before they
                   7249:                 are applied, files ending in <code class=
                   7250:                 "filename">.orig</code> or <code class=
                   7251:                 "filename">.rej</code> are ignored. Any special
                   7252:                 options to patch(1) can be handed in <code class=
                   7253:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   7254:                 "#components.patches" title=
1.1       grant    7255:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   7256:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   7257: 
                   7258:                 <p>By default patch(1) is given special args to
                   7259:                 make it fail if the patches apply with some lines
                   7260:                 of fuzz. Please fix (regen) the patches so that
                   7261:                 they apply cleanly. The rationale behind this is
                   7262:                 that patches that don't apply cleanly may end up
                   7263:                 being applied in the wrong place, and cause severe
                   7264:                 harm there.</p>
                   7265:               </dd>
                   7266: 
                   7267:               <dt><span class="term">configure</span></dt>
                   7268: 
                   7269:               <dd>
                   7270:                 <p>Most pieces of software need information on the
                   7271:                 header files, system calls, and library routines
                   7272:                 which are available in NetBSD. This is the process
                   7273:                 known as configuration, and is usually automated.
                   7274:                 In most cases, a script is supplied with the
                   7275:                 source, and its invocation results in generation of
                   7276:                 header files, Makefiles, etc.</p>
                   7277: 
                   7278:                 <p>If the program's distfile contains its own
                   7279:                 configure script, this can be invoked by setting
1.14      xtraeme  7280:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    7281:                 configure script is a GNU autoconf script,
1.14      xtraeme  7282:                 <code class="varname">GNU_CONFIGURE</code> should
                   7283:                 be specified instead. In either case, any arguments
                   7284:                 to the configure script can be specified in the
                   7285:                 <code class="varname">CONFIGURE_ARGS</code>
                   7286:                 variable, and the configure script's name can be
                   7287:                 set in <code class=
                   7288:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   7289:                 from the default &#8220;<span class=
1.1       grant    7290:                 "quote">configure</span>&#8221;. Here's an example
                   7291:                 from the <a xmlns=
                   7292:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7293:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.14      xtraeme  7294:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    7295:                 <pre class="programlisting">
                   7296: HAS_CONFIGURE=          yes
                   7297: CONFIGURE_SCRIPT=       Configure
                   7298: CONFIGURE_ARGS+=        netbsd13
                   7299: </pre>
                   7300: 
                   7301:                 <p>If the program uses an Imakefile for
                   7302:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  7303:                 by setting <code class="varname">USE_IMAKE</code>
                   7304:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   7305:                 (If you only want the package installed in
                   7306:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   7307:                 not being run, set <code class=
                   7308:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    7309:               </dd>
                   7310: 
                   7311:               <dt><span class="term">build</span></dt>
                   7312: 
                   7313:               <dd>
                   7314:                 <p>Once configuration has taken place, the software
1.14      xtraeme  7315:                 will be built by invoking <code class=
                   7316:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   7317:                 "varname">$MAKEFILE</code> with <code class=
                   7318:                 "varname">$BUILD_TARGET</code> as the target to
                   7319:                 build. The default <code class=
                   7320:                 "varname">MAKE_PROGRAM</code> is
                   7321:                 &#8220;<span class="quote">gmake</span>&#8221; if
                   7322:                 <code class="varname">USE_GNU_TOOLS</code> contains
1.7       wiz      7323:                 &#8220;<span class="quote">make</span>&#8221;,
1.1       grant    7324:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  7325:                 otherwise. <code class="varname">MAKEFILE</code> is
                   7326:                 set to &#8220;<span class=
1.1       grant    7327:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  7328:                 <code class="varname">BUILD_TARGET</code> defaults
                   7329:                 to &#8220;<span class="quote">all</span>&#8221;.
                   7330:                 Any of these variables can be set in the package's
1.1       grant    7331:                 Makefile to change the default build process.</p>
                   7332:               </dd>
                   7333: 
                   7334:               <dt><span class="term">install</span></dt>
                   7335: 
                   7336:               <dd>
                   7337:                 <p>Once the build stage has completed, the final
                   7338:                 step is to install the software in public
                   7339:                 directories, so users can access the programs and
1.14      xtraeme  7340:                 files. As in the build-target, <code class=
                   7341:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   7342:                 <code class="varname">$MAKEFILE</code> here, but
                   7343:                 with the <code class=
                   7344:                 "varname">$INSTALL_TARGET</code> instead, the
                   7345:                 latter defaulting to &#8220;<span class=
                   7346:                 "quote">install</span>&#8221; (plus
                   7347:                 &#8220;<span class=
                   7348:                 "quote">install.man</span>&#8221;, if <code class=
                   7349:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    7350:               </dd>
                   7351:             </dl>
                   7352:           </div>
                   7353: 
                   7354:           <p>If no target is specified, the default is
                   7355:           &#8220;<span class="quote">build</span>&#8221;. If a
                   7356:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  7357:           e.g. <span><strong class="command">make
                   7358:           build</strong></span> will also perform the equivalent
                   7359:           of:</p>
1.1       grant    7360:           <pre class="programlisting">
                   7361: make fetch
                   7362: make checksum
                   7363: make extract
                   7364: make patch
                   7365: make configure
                   7366: make build
                   7367: </pre>
                   7368:         </div>
                   7369: 
                   7370:         <div class="sect1" lang="en" xml:lang="en">
                   7371:           <div class="titlepage">
                   7372:             <div>
                   7373:               <div>
                   7374:                 <h2 class="title" style="clear: both"><a name=
                   7375:                 "build.helpful-targets" id=
                   7376:                 "build.helpful-targets"></a>11.3.&nbsp;Other
                   7377:                 helpful targets</h2>
                   7378:               </div>
                   7379:             </div>
                   7380:           </div>
                   7381: 
                   7382:           <div class="variablelist">
                   7383:             <dl>
                   7384:               <dt><span class="term">pre/post-*</span></dt>
                   7385: 
                   7386:               <dd>
                   7387:                 <p>For any of the main targets described in the
                   7388:                 previous section, two auxiliary targets exist with
                   7389:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   7390:                 &#8220;<span class="quote">post-</span>&#8221; used
                   7391:                 as a prefix for the main target's name. These
                   7392:                 targets are invoked before and after the main
                   7393:                 target is called, allowing extra configuration or
                   7394:                 installation steps be performed from a package's
                   7395:                 Makefile, for example, which a program's configure
                   7396:                 script or install target omitted.</p>
                   7397:               </dd>
                   7398: 
                   7399:               <dt><span class="term">do-*</span></dt>
                   7400: 
                   7401:               <dd>
                   7402:                 <p>Should one of the main targets do the wrong
                   7403:                 thing, and should there be no variable to fix this,
                   7404:                 you can redefine it with the do-* target. (Note
                   7405:                 that redefining the target itself instead of the
                   7406:                 do-* target is a bad idea, as the pre-* and post-*
                   7407:                 targets won't be called anymore, etc.) You will not
                   7408:                 usually need to do this.</p>
                   7409:               </dd>
                   7410: 
                   7411:               <dt><span class="term">reinstall</span></dt>
                   7412: 
                   7413:               <dd>
1.14      xtraeme  7414:                 <p>If you did a <span><strong class="command">make
                   7415:                 install</strong></span> and you noticed some file
                   7416:                 was not installed properly, you can repeat the
1.1       grant    7417:                 installation with this target, which will ignore
                   7418:                 the &#8220;<span class="quote">already
                   7419:                 installed</span>&#8221; flag.</p>
                   7420:               </dd>
                   7421: 
                   7422:               <dt><span class="term">deinstall</span></dt>
                   7423: 
                   7424:               <dd>
                   7425:                 <p>This target does a pkg_delete(1) in the current
                   7426:                 directory, effectively de-installing the package.
                   7427:                 The following variables can be used to tune the
                   7428:                 behaviour:</p>
                   7429: 
                   7430:                 <div class="variablelist">
                   7431:                   <dl>
1.14      xtraeme  7432:                     <dt><span class="term"><code class=
                   7433:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    7434: 
                   7435:                     <dd>
                   7436:                       <p>Add a "-v" to the <a href=
                   7437:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7438:                       <span class="citerefentry"><span class=
                   7439:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7440:                       command.</p>
                   7441:                     </dd>
                   7442: 
1.14      xtraeme  7443:                     <dt><span class="term"><code class=
                   7444:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    7445: 
                   7446:                     <dd>
                   7447:                       <p>Remove all packages that require (depend
                   7448:                       on) the given package. This can be used to
                   7449:                       remove any packages that may have been pulled
                   7450:                       in by a given package, e.g. if
1.14      xtraeme  7451:                       <span><strong class="command">make deinstall
                   7452:                       DEINSTALLDEPENDS=1</strong></span> is done in
                   7453:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    7454:                       this is likely to remove whole KDE. Works by
                   7455:                       adding &#8220;<span class=
                   7456:                       "quote">-R</span>&#8221; to the <a href=
                   7457:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7458:                       <span class="citerefentry"><span class=
                   7459:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7460:                       command line.</p>
                   7461:                     </dd>
                   7462:                   </dl>
                   7463:                 </div>
                   7464:               </dd>
                   7465: 
                   7466:               <dt><span class="term">update</span></dt>
                   7467: 
                   7468:               <dd>
                   7469:                 <p>This target causes the current package to be
                   7470:                 updated to the latest version. The package and all
                   7471:                 depending packages first get de-installed, then
                   7472:                 current versions of the corresponding packages get
                   7473:                 compiled and installed. This is similar to manually
                   7474:                 noting which packages are currently installed, then
1.14      xtraeme  7475:                 performing a series of <span><strong class=
                   7476:                 "command">make deinstall</strong></span> and
                   7477:                 <span><strong class="command">make
                   7478:                 install</strong></span> (or whatever <code class=
                   7479:                 "varname">UPDATE_TARGET</code> is set to) for these
                   7480:                 packages.</p>
1.1       grant    7481: 
                   7482:                 <p>You can use the &#8220;<span class=
                   7483:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  7484:                 package updating in case a previous
                   7485:                 <span><strong class="command">make
                   7486:                 update</strong></span> was interrupted for some
                   7487:                 reason. However, in this case, make sure you don't
                   7488:                 call <span><strong class="command">make
                   7489:                 clean</strong></span> or otherwise remove the list
                   7490:                 of dependent packages in <code class=
                   7491:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    7492:                 ability to automatically update the current package
                   7493:                 along with the dependent packages you have
                   7494:                 installed.</p>
                   7495: 
1.14      xtraeme  7496:                 <p>Resuming an interrupted <span><strong class=
                   7497:                 "command">make update</strong></span> will only
                   7498:                 work as long as the package tree remains unchanged.
                   7499:                 If the source code for one of the packages to be
                   7500:                 updated has been changed, resuming
                   7501:                 <span><strong class="command">make
                   7502:                 update</strong></span> will most certainly
                   7503:                 fail!</p>
1.1       grant    7504: 
                   7505:                 <p>The following variables can be used either on
1.14      xtraeme  7506:                 the command line or in <code class=
                   7507:                 "filename">/etc/mk.conf</code> to alter the
                   7508:                 behaviour of <span><strong class="command">make
                   7509:                 update</strong></span>:</p>
1.1       grant    7510: 
                   7511:                 <div class="variablelist">
                   7512:                   <dl>
1.14      xtraeme  7513:                     <dt><span class="term"><code class=
                   7514:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    7515: 
                   7516:                     <dd>
                   7517:                       <p>Install target to recursively use for the
                   7518:                       updated package and the dependent packages.
1.14      xtraeme  7519:                       Defaults to <code class=
                   7520:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    7521:                       &#8220;<span class=
                   7522:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  7523:                       <span><strong class="command">make
                   7524:                       update</strong></span>. e.g.
                   7525:                       <span><strong class="command">make update
                   7526:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    7527:                     </dd>
                   7528: 
1.14      xtraeme  7529:                     <dt><span class="term"><code class=
                   7530:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    7531: 
                   7532:                     <dd>
                   7533:                       <p>Don't clean up after updating. Useful if
                   7534:                       you want to leave the work sources of the
                   7535:                       updated packages around for inspection or
                   7536:                       other purposes. Be sure you eventually clean
                   7537:                       up the source tree (see the
                   7538:                       &#8220;<span class=
                   7539:                       "quote">clean-update</span>&#8221; target
                   7540:                       below) or you may run into troubles with old
                   7541:                       source code still lying around on your next
1.14      xtraeme  7542:                       <span><strong class=
                   7543:                       "command">make</strong></span> or
                   7544:                       <span><strong class="command">make
                   7545:                       update</strong></span>.</p>
1.1       grant    7546:                     </dd>
                   7547: 
1.14      xtraeme  7548:                     <dt><span class="term"><code class=
                   7549:                     "varname">REINSTALL</code></span></dt>
1.1       grant    7550: 
                   7551:                     <dd>
                   7552:                       <p>Deinstall each package before installing
1.14      xtraeme  7553:                       (making <code class=
                   7554:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    7555:                       necessary if the &#8220;<span class=
                   7556:                       "quote">clean-update</span>&#8221; target
                   7557:                       (see below) was called after interrupting a
1.14      xtraeme  7558:                       running <span><strong class="command">make
                   7559:                       update</strong></span>.</p>
1.1       grant    7560:                     </dd>
                   7561: 
1.14      xtraeme  7562:                     <dt><span class="term"><code class=
                   7563:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    7564: 
                   7565:                     <dd>
                   7566:                       <p>Allows you to disable recursion and
                   7567:                       hardcode the target for packages. The default
                   7568:                       is &#8220;<span class=
                   7569:                       "quote">update</span>&#8221; for the update
                   7570:                       target, facilitating a recursive update of
1.14      xtraeme  7571:                       prerequisite packages. Only set <code class=
                   7572:                       "varname">DEPENDS_TARGET</code> if you want
                   7573:                       to disable recursive updates. Use
                   7574:                       <code class="varname">UPDATE_TARGET</code>
                   7575:                       instead to just set a specific target for
                   7576:                       each package to be installed during
                   7577:                       <span><strong class="command">make
                   7578:                       update</strong></span> (see above).</p>
1.1       grant    7579:                     </dd>
                   7580:                   </dl>
                   7581:                 </div>
                   7582:               </dd>
                   7583: 
                   7584:               <dt><span class="term">clean-update</span></dt>
                   7585: 
                   7586:               <dd>
                   7587:                 <p>Clean the source tree for all packages that
1.14      xtraeme  7588:                 would get updated if <span><strong class=
                   7589:                 "command">make update</strong></span> was called
                   7590:                 from the current directory. This target should not
                   7591:                 be used if the current package (or any of its
                   7592:                 depending packages) have already been de-installed
                   7593:                 (e.g., after calling <span><strong class=
                   7594:                 "command">make update</strong></span>) or you may
                   7595:                 lose some packages you intended to update. As a
                   7596:                 rule of thumb: only use this target <span class=
                   7597:                 "emphasis"><em>before</em></span> the first time
                   7598:                 you run <span><strong class="command">make
                   7599:                 update</strong></span> and only if you have a dirty
                   7600:                 package tree (e.g., if you used <code class=
                   7601:                 "varname">NOCLEAN</code>).</p>
1.1       grant    7602: 
                   7603:                 <p>If you unsure about whether your tree is clean
1.14      xtraeme  7604:                 you can either perform a <span><strong class=
                   7605:                 "command">make clean</strong></span> at the top of
                   7606:                 the tree, or use the following sequence of commands
1.1       grant    7607:                 from the directory of the package you want to
                   7608:                 update (<span class=
                   7609:                 "emphasis"><em>before</em></span> running
1.14      xtraeme  7610:                 <span><strong class="command">make
                   7611:                 update</strong></span> for the first time,
                   7612:                 otherwise you lose all the packages you wanted to
                   7613:                 update!):</p>
1.1       grant    7614:                 <pre class="screen">
1.14      xtraeme  7615: <code class="prompt">#</code> <strong class=
                   7616: "userinput"><code>make clean-update</code></strong>
                   7617: <code class="prompt">#</code> <strong class=
                   7618: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   7619: <code class="prompt">#</code> <strong class=
                   7620: "userinput"><code>make update</code></strong>
1.1       grant    7621: </pre>
                   7622: 
                   7623:                 <p>The following variables can be used either on
1.14      xtraeme  7624:                 the command line or in <code class=
                   7625:                 "filename">/etc/mk.conf</code> to alter the
                   7626:                 behaviour of <span><strong class="command">make
                   7627:                 clean-update</strong></span>:</p>
1.1       grant    7628: 
                   7629:                 <div class="variablelist">
                   7630:                   <dl>
1.14      xtraeme  7631:                     <dt><span class="term"><code class=
                   7632:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    7633: 
                   7634:                     <dd>
1.14      xtraeme  7635:                       <p>After <span><strong class="command">make
                   7636:                       clean</strong></span>, do not reconstruct the
                   7637:                       list of directories to update for this
                   7638:                       package. Only use this if
                   7639:                       <span><strong class="command">make
                   7640:                       update</strong></span> successfully installed
                   7641:                       all packages you wanted to update. Normally,
                   7642:                       this is done automatically on
                   7643:                       <span><strong class="command">make
                   7644:                       update</strong></span>, but may have been
                   7645:                       suppressed by the <code class=
                   7646:                       "varname">NOCLEAN</code> variable (see
1.1       grant    7647:                       above).</p>
                   7648:                     </dd>
                   7649:                   </dl>
                   7650:                 </div>
                   7651:               </dd>
                   7652: 
                   7653:               <dt><span class="term">info</span></dt>
                   7654: 
                   7655:               <dd>
                   7656:                 <p>This target invokes <a href=
                   7657:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   7658:                 <span class="citerefentry"><span class=
                   7659:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   7660:                 the current package. You can use this to check
                   7661:                 which version of a package is installed.</p>
                   7662:               </dd>
                   7663: 
                   7664:               <dt><span class="term">readme</span></dt>
                   7665: 
                   7666:               <dd>
1.14      xtraeme  7667:                 <p>This target generates a <code class=
                   7668:                 "filename">README.html</code> file, which can be
1.1       grant    7669:                 viewed using a browser such as <a xmlns=
                   7670:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7671:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.14      xtraeme  7672:                 class="pkgname">www/mozilla</a> or <a xmlns=
                   7673:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7674:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
                   7675:                 class="pkgname">www/links</a>. The generated files
                   7676:                 contain references to any packages which are in the
                   7677:                 <code class="varname">PACKAGES</code> directory on
                   7678:                 the local host. The generated files can be made to
                   7679:                 refer to URLs based on <code class=
                   7680:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   7681:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
                   7682:                 wanted to generate <code class=
                   7683:                 "filename">README.html</code> files which pointed
                   7684:                 to binary packages on the local machine, in the
                   7685:                 directory <code class=
                   7686:                 "filename">/usr/packages</code>, set <code class=
                   7687:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   7688:                 and <code class=
                   7689:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   7690:                 <code class="varname">${PACKAGES}</code> directory
                   7691:                 and its subdirectories will be searched for all the
                   7692:                 binary packages.</p>
1.1       grant    7693:               </dd>
                   7694: 
                   7695:               <dt><span class="term">readme-all</span></dt>
                   7696: 
                   7697:               <dd>
1.14      xtraeme  7698:                 <p>Use this target to create a file <code class=
                   7699:                 "filename">README-all.html</code> which contains a
1.1       grant    7700:                 list of all packages currently available in the
                   7701:                 NetBSD Packages Collection, together with the
                   7702:                 category they belong to and a short description.
1.14      xtraeme  7703:                 This file is compiled from the <code class=
                   7704:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    7705:                 sure to run this <span class=
1.14      xtraeme  7706:                 "emphasis"><em>after</em></span> a
                   7707:                 <span><strong class="command">make
                   7708:                 readme</strong></span>.</p>
1.1       grant    7709:               </dd>
                   7710: 
                   7711:               <dt><span class="term">cdrom-readme</span></dt>
                   7712: 
                   7713:               <dd>
                   7714:                 <p>This is very much the same as the
                   7715:                 &#8220;<span class="quote">readme</span>&#8221;
                   7716:                 target (see above), but is to be used when
                   7717:                 generating a pkgsrc tree to be written to a CD-ROM.
1.14      xtraeme  7718:                 This target also produces <code class=
                   7719:                 "filename">README.html</code> files, and can be
                   7720:                 made to refer to URLs based on <code class=
                   7721:                 "varname">CDROM_PKG_URL_HOST</code> and
                   7722:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    7723:               </dd>
                   7724: 
                   7725:               <dt><span class="term">show-distfiles</span></dt>
                   7726: 
                   7727:               <dd>
                   7728:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  7729:                 are needed to build the package. (<code class=
                   7730:                 "varname">DISTFILES</code> and <code class=
                   7731:                 "varname">PATCHFILES</code>, but not <code class=
                   7732:                 "filename">patches/*</code>)</p>
1.1       grant    7733:               </dd>
                   7734: 
                   7735:               <dt><span class="term">show-downlevel</span></dt>
                   7736: 
                   7737:               <dd>
                   7738:                 <p>This target shows nothing if the package is not
                   7739:                 installed. If a version of this package is
                   7740:                 installed, but is not the version provided in this
                   7741:                 version of pkgsrc, then a warning message is
                   7742:                 displayed. This target can be used to show which of
                   7743:                 your installed packages are downlevel, and so the
                   7744:                 old versions can be deleted, and the current ones
                   7745:                 added.</p>
                   7746:               </dd>
                   7747: 
                   7748:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   7749: 
                   7750:               <dd>
                   7751:                 <p>This target shows the directory in the pkgsrc
                   7752:                 hierarchy from which the package can be built and
                   7753:                 installed. This may not be the same directory as
                   7754:                 the one from which the package was installed. This
                   7755:                 target is intended to be used by people who may
                   7756:                 wish to upgrade many packages on a single host, and
                   7757:                 can be invoked from the top-level pkgsrc Makefile
                   7758:                 by using the &#8220;<span class=
                   7759:                 "quote">show-host-specific-pkgs</span>&#8221;
                   7760:                 target.</p>
                   7761:               </dd>
                   7762: 
                   7763:               <dt><span class=
                   7764:               "term">show-installed-depends</span></dt>
                   7765: 
                   7766:               <dd>
                   7767:                 <p>This target shows which installed packages match
1.14      xtraeme  7768:                 the current package's <code class=
                   7769:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    7770:                 dependencies are causing build problems.</p>
                   7771:               </dd>
                   7772: 
                   7773:               <dt><span class="term">check-shlibs</span></dt>
                   7774: 
                   7775:               <dd>
                   7776:                 <p>After a package is installed, check all its
                   7777:                 binaries and (on ELF platforms) shared libraries to
                   7778:                 see if they find the shared libs they need. Run by
1.14      xtraeme  7779:                 default if <code class=
                   7780:                 "varname">PKG_DEVELOPER</code> is set in
                   7781:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    7782:               </dd>
                   7783: 
                   7784:               <dt><span class="term">print-PLIST</span></dt>
                   7785: 
                   7786:               <dd>
                   7787:                 <p>After a &#8220;<span class="quote">make
                   7788:                 install</span>&#8221; from a new or upgraded pkg,
                   7789:                 this prints out an attempt to generate a new
1.14      xtraeme  7790:                 <code class="filename">PLIST</code> from a
                   7791:                 <span><strong class="command">find -newer
                   7792:                 work/.extract_done</strong></span>. An attempt is
                   7793:                 made to care for shared libs etc., but it is
1.1       grant    7794:                 <span class="emphasis"><em>strongly</em></span>
                   7795:                 recommended to review the result before putting it
1.14      xtraeme  7796:                 into <code class="filename">PLIST</code>. On
                   7797:                 upgrades, it's useful to diff the output of this
                   7798:                 command against an already existing <code class=
                   7799:                 "filename">PLIST</code> file.</p>
1.1       grant    7800: 
                   7801:                 <p>If the package installs files via tar(1) or
                   7802:                 other methods that don't update file access times,
                   7803:                 be sure to add these files manually to your
1.14      xtraeme  7804:                 <code class="filename">PLIST</code>, as the
1.1       grant    7805:                 &#8220;<span class="quote">find
                   7806:                 -newer</span>&#8221; command used by this target
                   7807:                 won't catch them!</p>
                   7808: 
                   7809:                 <p>See <a href="#print-PLIST" title=
                   7810:                 "8.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;8.3,
1.14      xtraeme  7811:                 &#8220;Tweaking output of <span><strong class=
                   7812:                 "command">make
                   7813:                 print-PLIST</strong></span>&#8221;</a> for more
                   7814:                 information on this target.</p>
1.1       grant    7815:               </dd>
                   7816: 
                   7817:               <dt><span class="term">bulk-package</span></dt>
                   7818: 
                   7819:               <dd>
                   7820:                 <p>Used to do bulk builds. If an appropriate binary
                   7821:                 package already exists, no action is taken. If not,
                   7822:                 this target will compile, install and package it
1.14      xtraeme  7823:                 (and it's depends, if <code class=
                   7824:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    7825:                 <a href="#binary.configuration" title=
                   7826:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   7827:                 &#8220;Configuration&#8221;</a>. After creating the
                   7828:                 binary package, the sources, the just-installed
                   7829:                 package and it's required packages are removed,
                   7830:                 preserving free disk space.</p>
                   7831: 
                   7832:                 <p><span class="emphasis"><em>Beware that this
                   7833:                 target may deinstall all packages installed on a
                   7834:                 system!</em></span></p>
                   7835:               </dd>
                   7836: 
                   7837:               <dt><span class="term">bulk-install</span></dt>
                   7838: 
                   7839:               <dd>
                   7840:                 <p>Used during bulk-installs to install required
                   7841:                 packages. If an upto-date binary package is
                   7842:                 available, it will be installed via <a href=
                   7843:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7844:                 <span class="citerefentry"><span class=
                   7845:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  7846:                 not, <span><strong class="command">make
                   7847:                 bulk-package</strong></span> will be executed, but
                   7848:                 the installed binary not be removed.</p>
1.1       grant    7849: 
                   7850:                 <p>A binary package is considered
                   7851:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   7852:                 to be installed via <a href=
                   7853:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7854:                 <span class="citerefentry"><span class=
                   7855:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   7856:                 if:</p>
                   7857: 
                   7858:                 <div class="itemizedlist">
                   7859:                   <ul type="disc">
                   7860:                     <li>
1.14      xtraeme  7861:                       <p>None of the package's files (<code class=
                   7862:                       "filename">Makefile</code>, ...) were
                   7863:                       modified since it was built.</p>
1.1       grant    7864:                     </li>
                   7865: 
                   7866:                     <li>
                   7867:                       <p>None of the package's required (binary)
                   7868:                       packages were modified since it was
                   7869:                       built.</p>
                   7870:                     </li>
                   7871:                   </ul>
                   7872:                 </div>
                   7873: 
                   7874:                 <p><span class="emphasis"><em>Beware that this
                   7875:                 target may deinstall all packages installed on a
                   7876:                 system!</em></span></p>
                   7877:               </dd>
                   7878:             </dl>
                   7879:           </div>
                   7880:         </div>
                   7881:       </div>
                   7882: 
                   7883:       <div class="chapter" lang="en" xml:lang="en">
                   7884:         <div class="titlepage">
                   7885:           <div>
                   7886:             <div>
                   7887:               <h2 class="title"><a name="fixes" id=
                   7888:               "fixes"></a>Chapter&nbsp;12.&nbsp;Notes on fixes for
                   7889:               packages</h2>
                   7890:             </div>
                   7891:           </div>
                   7892:         </div>
                   7893: 
                   7894:         <div class="toc">
                   7895:           <p><b>Table of Contents</b></p>
                   7896: 
                   7897:           <dl>
1.15    ! xtraeme  7898:             <dt><span class="sect1"><a href="#id2590973">12.1.
1.1       grant    7899:             General operation</a></span></dt>
                   7900: 
                   7901:             <dd>
                   7902:               <dl>
                   7903:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7904:                 "#id2590977">12.1.1. How to pull in variables from
1.1       grant    7905:                 /etc/mk.conf</a></span></dt>
                   7906: 
                   7907:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7908:                 "#id2591128">12.1.2. Restricted
1.1       grant    7909:                 packages</a></span></dt>
                   7910: 
                   7911:                 <dt><span class="sect2"><a href=
                   7912:                 "#dependencies">12.1.3. Handling
                   7913:                 dependencies</a></span></dt>
                   7914: 
                   7915:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7916:                 "#id2591643">12.1.4. Handling conflicts with other
1.1       grant    7917:                 packages</a></span></dt>
                   7918: 
                   7919:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7920:                 "#id2591762">12.1.5. Packages that cannot or should
1.1       grant    7921:                 not be built</a></span></dt>
                   7922: 
                   7923:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7924:                 "#id2591787">12.1.6. Packages which should not be
1.1       grant    7925:                 deleted, once installed</a></span></dt>
                   7926: 
                   7927:                 <dt><span class="sect2"><a href=
                   7928:                 "#security-handling">12.1.7. Handling packages with
                   7929:                 security problems</a></span></dt>
                   7930: 
                   7931:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7932:                 "#id2591879">12.1.8. How to handle compiler
1.1       grant    7933:                 bugs</a></span></dt>
                   7934: 
                   7935:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7936:                 "#id2591901">12.1.9. How to handle incrementing
1.1       grant    7937:                 versions when fixing an existing
                   7938:                 package</a></span></dt>
                   7939: 
                   7940:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7941:                 "#id2591950">12.1.10. Portability of
1.1       grant    7942:                 packages</a></span></dt>
                   7943:               </dl>
                   7944:             </dd>
                   7945: 
1.15    ! xtraeme  7946:             <dt><span class="sect1"><a href="#id2591975">12.2.
1.1       grant    7947:             Possible downloading issues</a></span></dt>
                   7948: 
                   7949:             <dd>
                   7950:               <dl>
                   7951:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7952:                 "#id2591978">12.2.1. Packages whose distfiles
1.1       grant    7953:                 aren't available for plain
                   7954:                 downloading</a></span></dt>
                   7955: 
                   7956:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7957:                 "#id2592109">12.2.2. How to handle modified
1.1       grant    7958:                 distfiles with the 'old' name</a></span></dt>
                   7959:               </dl>
                   7960:             </dd>
                   7961: 
1.15    ! xtraeme  7962:             <dt><span class="sect1"><a href="#id2592121">12.3.
1.1       grant    7963:             Configuration gotchas</a></span></dt>
                   7964: 
                   7965:             <dd>
                   7966:               <dl>
                   7967:                 <dt><span class="sect2"><a href=
                   7968:                 "#fixes.libtool">12.3.1. Shared libraries -
                   7969:                 libtool</a></span></dt>
                   7970: 
                   7971:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7972:                 "#id2592529">12.3.2. Using libtool on GNU packages
1.1       grant    7973:                 that already support libtool</a></span></dt>
                   7974: 
                   7975:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7976:                 "#id2592613">12.3.3. GNU
1.1       grant    7977:                 Autoconf/Automake</a></span></dt>
                   7978:               </dl>
                   7979:             </dd>
                   7980: 
1.15    ! xtraeme  7981:             <dt><span class="sect1"><a href="#id2592726">12.4.
1.1       grant    7982:             Building considerations</a></span></dt>
                   7983: 
                   7984:             <dd>
                   7985:               <dl>
                   7986:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7987:                 "#id2592729">12.4.1. CPP defines</a></span></dt>
1.1       grant    7988:               </dl>
                   7989:             </dd>
                   7990: 
1.15    ! xtraeme  7991:             <dt><span class="sect1"><a href="#id2592759">12.5.
1.1       grant    7992:             Package specific actions</a></span></dt>
                   7993: 
                   7994:             <dd>
                   7995:               <dl>
                   7996:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  7997:                 "#id2592762">12.5.1. Package configuration
1.1       grant    7998:                 files</a></span></dt>
                   7999: 
                   8000:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8001:                 "#id2592933">12.5.2. User
1.2       hubertf  8002:                 interaction</a></span></dt>
1.1       grant    8003: 
                   8004:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8005:                 "#id2593046">12.5.3. Handling
1.1       grant    8006:                 licenses</a></span></dt>
                   8007: 
                   8008:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8009:                 "#id2593197">12.5.4. Creating an account from a
1.1       grant    8010:                 package</a></span></dt>
                   8011: 
                   8012:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8013:                 "#id2593328">12.5.5. Installing score
1.1       grant    8014:                 files</a></span></dt>
                   8015: 
                   8016:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8017:                 "#id2593371">12.5.6. Packages providing login
1.1       grant    8018:                 shells</a></span></dt>
                   8019: 
                   8020:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8021:                 "#id2593429">12.5.7. Packages containing perl
1.1       grant    8022:                 scripts</a></span></dt>
                   8023: 
                   8024:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8025:                 "#id2593447">12.5.8. Packages with hardcoded paths
1.1       grant    8026:                 to other interpreters</a></span></dt>
                   8027: 
                   8028:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8029:                 "#id2593468">12.5.9. Packages installing perl
1.1       grant    8030:                 modules</a></span></dt>
                   8031: 
                   8032:                 <dt><span class="sect2"><a href=
                   8033:                 "#faq.info-files">12.5.10. Packages installing info
                   8034:                 files</a></span></dt>
                   8035: 
                   8036:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8037:                 "#id2593688">12.5.11. Packages installing GConf2
1.1       grant    8038:                 data files</a></span></dt>
                   8039: 
                   8040:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8041:                 "#id2593788">12.5.12. Packages installing
1.1       grant    8042:                 scrollkeeper data files</a></span></dt>
                   8043: 
                   8044:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8045:                 "#id2593840">12.5.13. Packages installing X11
1.1       grant    8046:                 fonts</a></span></dt>
                   8047: 
                   8048:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8049:                 "#id2593886">12.5.14. Packages installing GTK2
1.1       grant    8050:                 modules</a></span></dt>
                   8051: 
                   8052:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8053:                 "#id2593956">12.5.15. Packages installing SGML or
1.1       grant    8054:                 XML data</a></span></dt>
                   8055: 
                   8056:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8057:                 "#id2594076">12.5.16. Packages installing
1.1       grant    8058:                 extensions to the MIME database</a></span></dt>
                   8059: 
                   8060:                 <dt><span class="sect2"><a href=
1.15    ! xtraeme  8061:                 "#id2594283">12.5.17. Packages using
1.1       grant    8062:                 intltool</a></span></dt>
                   8063:               </dl>
                   8064:             </dd>
                   8065: 
1.15    ! xtraeme  8066:             <dt><span class="sect1"><a href="#id2594297">12.6.
1.1       grant    8067:             Feedback to the author</a></span></dt>
                   8068:           </dl>
                   8069:         </div>
                   8070: 
                   8071:         <div class="sect1" lang="en" xml:lang="en">
                   8072:           <div class="titlepage">
                   8073:             <div>
                   8074:               <div>
                   8075:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  8076:                 "id2590973" id="id2590973"></a>12.1.&nbsp;General
1.1       grant    8077:                 operation</h2>
                   8078:               </div>
                   8079:             </div>
                   8080:           </div>
                   8081: 
                   8082:           <div class="sect2" lang="en" xml:lang="en">
                   8083:             <div class="titlepage">
                   8084:               <div>
                   8085:                 <div>
1.15    ! xtraeme  8086:                   <h3 class="title"><a name="id2590977" id=
        !          8087:                   "id2590977"></a>12.1.1.&nbsp;How to pull in
1.1       grant    8088:                   variables from /etc/mk.conf</h3>
                   8089:                 </div>
                   8090:               </div>
                   8091:             </div>
                   8092: 
                   8093:             <p>The problem with package-defined variables that can
1.14      xtraeme  8094:             be overridden via <code class="varname">MAKECONF</code>
                   8095:             or <code class="filename">/etc/mk.conf</code> is that
                   8096:             <a href=
1.1       grant    8097:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8098:             <span class="citerefentry"><span class=
                   8099:             "refentrytitle">make</span>(1)</span></a> expands a
                   8100:             variable as it is used, but evaluates preprocessor like
                   8101:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  8102:             So, to use any variable (which may be set in
                   8103:             <code class="filename">/etc/mk.conf</code>) in one of
                   8104:             the .if* statements, the file <code class=
                   8105:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    8106:             that .if* statement.</p>
                   8107: 
                   8108:             <p>Rather than have a number of ad-hoc ways of
1.14      xtraeme  8109:             including <code class="filename">/etc/mk.conf</code>,
                   8110:             should it exist, or <code class=
                   8111:             "varname">MAKECONF</code>, should it exist, include the
                   8112:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
                   8113:             file in the package Makefile before any
                   8114:             preprocessor-like .if, .ifdef, or .ifndef
                   8115:             statements:</p>
1.1       grant    8116:             <pre class="programlisting">
                   8117: .include "../../mk/bsd.prefs.mk"
                   8118:     
                   8119:     .if defined(USE_MENUS)
                   8120:       ...
                   8121:     .endif
                   8122: </pre>
                   8123: 
1.14      xtraeme  8124:             <p>If you wish to set the <code class=
                   8125:             "varname">CFLAGS</code> variable in <code class=
                   8126:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    8127:             use:</p>
                   8128:             <pre class="programlisting">
                   8129: CFLAGS+=  -your -flags
                   8130: </pre>
                   8131: 
1.14      xtraeme  8132:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   8133:             without the &#8220;<span class="quote">+</span>&#8221;)
                   8134:             may lead to problems with packages that need to add
                   8135:             their own flags. Also, you may want to take a look at
                   8136:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    8137:             href=
                   8138:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.14      xtraeme  8139:             class="pkgname">devel/cpuflags</a> package if you're
                   8140:             interested in optimization for the current CPU.</p>
1.1       grant    8141:           </div>
                   8142: 
                   8143:           <div class="sect2" lang="en" xml:lang="en">
                   8144:             <div class="titlepage">
                   8145:               <div>
                   8146:                 <div>
1.15    ! xtraeme  8147:                   <h3 class="title"><a name="id2591128" id=
        !          8148:                   "id2591128"></a>12.1.2.&nbsp;Restricted
1.1       grant    8149:                   packages</h3>
                   8150:                 </div>
                   8151:               </div>
                   8152:             </div>
                   8153: 
                   8154:             <p>Some licenses restrict how software may be
                   8155:             re-distributed. In order to satisfy these restrictions,
                   8156:             the package system defines five make variables that can
                   8157:             be set to note these restrictions:</p>
                   8158: 
                   8159:             <div class="itemizedlist">
                   8160:               <ul type="disc">
                   8161:                 <li>
1.14      xtraeme  8162:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    8163: 
                   8164:                   <p>This variable should be set whenever a
                   8165:                   restriction exists (regardless of its kind). Set
                   8166:                   this variable to a string containing the reason
                   8167:                   for the restriction.</p>
                   8168:                 </li>
                   8169: 
                   8170:                 <li>
1.14      xtraeme  8171:                   <p><code class=
                   8172:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    8173: 
                   8174:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  8175:                   variable to <code class=
                   8176:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8177:                   package may not be included on a CD-ROM.</p>
                   8178:                 </li>
                   8179: 
                   8180:                 <li>
1.14      xtraeme  8181:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    8182: 
                   8183:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  8184:                   Set this variable to <code class=
                   8185:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8186:                   package may not not be made available on the
                   8187:                   Internet.</p>
                   8188:                 </li>
                   8189: 
                   8190:                 <li>
1.14      xtraeme  8191:                   <p><code class=
                   8192:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    8193: 
                   8194:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  8195:                   this variable to <code class=
                   8196:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8197:                   of the source code or other distfile(s) is not
                   8198:                   allowed on CD-ROMs.</p>
                   8199:                 </li>
                   8200: 
                   8201:                 <li>
1.14      xtraeme  8202:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    8203: 
                   8204:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  8205:                   variable to <code class=
                   8206:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8207:                   of the source code or other distfile(s) via the
                   8208:                   Internet is not allowed.</p>
                   8209:                 </li>
                   8210:               </ul>
                   8211:             </div>
                   8212: 
1.14      xtraeme  8213:             <p>Please note that the use of <code class=
                   8214:             "varname">NO_PACKAGE</code>, <code class=
                   8215:             "varname">IGNORE</code>, <code class=
                   8216:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    8217:             variables to denote restrictions is deprecated, because
                   8218:             they unconditionally prevent users from generating
                   8219:             binary packages!</p>
                   8220:           </div>
                   8221: 
                   8222:           <div class="sect2" lang="en" xml:lang="en">
                   8223:             <div class="titlepage">
                   8224:               <div>
                   8225:                 <div>
                   8226:                   <h3 class="title"><a name="dependencies" id=
                   8227:                   "dependencies"></a>12.1.3.&nbsp;Handling
                   8228:                   dependencies</h3>
                   8229:                 </div>
                   8230:               </div>
                   8231:             </div>
                   8232: 
                   8233:             <p>Your package may depend on some other package being
                   8234:             present - and there are various ways of expressing this
1.14      xtraeme  8235:             dependency. pkgsrc supports the <code class=
                   8236:             "varname">BUILD_DEPENDS</code> and <code class=
                   8237:             "varname">DEPENDS</code> definitions, as well as
                   8238:             dependencies via <code class=
                   8239:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    8240:             way to handle dependencies, and which uses the
                   8241:             variables named above. See <a href="#buildlink" title=
                   8242:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8243:             <i>Buildlink methodology</i></a> for more
                   8244:             information.</p>
                   8245: 
                   8246:             <p>The basic difference between the two variables is as
1.14      xtraeme  8247:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    8248:             definition registers that pre-requisite in the binary
                   8249:             package so it will be pulled in when the binary package
1.14      xtraeme  8250:             is later installed, whilst the <code class=
                   8251:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    8252:             marking a dependency that is only needed for building
                   8253:             the package.</p>
                   8254: 
                   8255:             <p>This means that if you only need a package present
                   8256:             whilst you are building, it should be noted as a
1.14      xtraeme  8257:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    8258: 
1.14      xtraeme  8259:             <p>The format for a <code class=
                   8260:             "varname">BUILD_DEPENDS</code> and a <code class=
                   8261:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    8262:             <pre class="programlisting">
                   8263: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   8264: </pre>
                   8265: 
                   8266:             <p>Please note that the &#8220;<span class=
                   8267:             "quote">pre-req-package-name</span>&#8221; may include
                   8268:             any of the wildcard version numbers recognised by
                   8269:             <a href=
                   8270:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   8271:             <span class="citerefentry"><span class=
                   8272:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   8273: 
                   8274:             <div class="orderedlist">
                   8275:               <ol type="1">
                   8276:                 <li>
                   8277:                   <p>If your package needs another package's
                   8278:                   binaries or libraries to build or run, and if
1.14      xtraeme  8279:                   that package has a <code class=
                   8280:                   "filename">buildlink3.mk</code> file available,
                   8281:                   use it:</p>
1.1       grant    8282:                   <pre class="programlisting">
                   8283:     .include "../../graphics/jpeg/buildlink3.mk"
                   8284:     
                   8285: </pre>
                   8286:                 </li>
                   8287: 
                   8288:                 <li>
                   8289:                   <p>If your package needs to use another package
1.14      xtraeme  8290:                   to build itself and there is no <code class=
                   8291:                   "filename">buildlink3.mk</code> file available,
                   8292:                   use the <code class=
                   8293:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    8294:                   <pre class="programlisting">
                   8295: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   8296: </pre>
                   8297:                 </li>
                   8298: 
                   8299:                 <li>
                   8300:                   <p>If your package needs a library with which to
1.14      xtraeme  8301:                   link and again there is no <code class=
                   8302:                   "filename">buildlink3.mk</code> file available,
                   8303:                   this is specified using the <code class=
                   8304:                   "varname">DEPENDS</code> definition. An example
                   8305:                   of this is the <a xmlns=
1.1       grant    8306:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8307:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.14      xtraeme  8308:                   class="pkgname">print/lyx</a> package, which uses
                   8309:                   the xpm library, version 3.4j to build:</p>
1.1       grant    8310:                   <pre class="programlisting">
                   8311: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   8312: </pre>
                   8313: 
                   8314:                   <p>You can also use wildcards in package
                   8315:                   dependences:</p>
                   8316:                   <pre class="programlisting">
                   8317: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   8318: </pre>
                   8319: 
                   8320:                   <p>Note that such wildcard dependencies are
                   8321:                   retained when creating binary packages. The
                   8322:                   dependency is checked when installing the binary
                   8323:                   package and any package which matches the pattern
                   8324:                   will be used. Wildcard dependencies should be
                   8325:                   used with care.</p>
                   8326: 
                   8327:                   <p>The &#8220;<span class=
                   8328:                   "quote">-[0-9]*</span>&#8221; should be used
                   8329:                   instead of &#8220;<span class=
                   8330:                   "quote">-*</span>&#8221; to avoid potentially
                   8331:                   ambiguous matches such as &#8220;<span class=
                   8332:                   "quote">tk-postgresql</span>&#8221; matching a
                   8333:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  8334:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    8335: 
                   8336:                   <p>Wildcards can also be used to specify that a
                   8337:                   package will only build against a certain minimum
                   8338:                   version of a pre-requisite:</p>
                   8339:                   <pre class="programlisting">
                   8340: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   8341: </pre>
                   8342: 
                   8343:                   <p>This means that the package will build against
                   8344:                   version 3.5.4 of the tiff library or newer. Such
                   8345:                   a dependency may be warranted if, for example,
                   8346:                   the API of the library has changed with version
                   8347:                   3.5.4 and a package would not compile against an
                   8348:                   earlier version of tiff.</p>
                   8349: 
                   8350:                   <p>Please note that such dependencies should only
                   8351:                   be updated if a package requires a newer
                   8352:                   pre-requisite, but not to denote recommendations
                   8353:                   such as security updates or ABI changes that do
                   8354:                   not prevent a package from building correctly.
                   8355:                   Such recommendations can be expressed using
1.14      xtraeme  8356:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    8357:                   <pre class="programlisting">
                   8358: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   8359: </pre>
                   8360: 
1.14      xtraeme  8361:                   <p>In addition to the above <code class=
                   8362:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    8363:                   while a package will build against
                   8364:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  8365:                   recommended. <code class=
                   8366:                   "varname">RECOMMENDED</code> entries will be
                   8367:                   turned into dependencies unless explicitly
                   8368:                   ignored (in which case a warning will be
                   8369:                   printed). Packages that are built with
1.1       grant    8370:                   recommendations ignored may not be uploaded to
                   8371:                   ftp.NetBSD.org by developers and should not be
                   8372:                   used across different systems that may have
                   8373:                   different versions of binary packages
                   8374:                   installed.</p>
                   8375: 
                   8376:                   <p>For security fixes, please update the package
                   8377:                   vulnerabilities file as well as setting
1.14      xtraeme  8378:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    8379:                   <a href="#security-handling" title=
                   8380:                   "12.1.7.&nbsp;Handling packages with security problems">
                   8381:                   Section 12.1.7, &#8220;Handling packages with
                   8382:                   security problems&#8221;</a> for more
                   8383:                   information.</p>
                   8384:                 </li>
                   8385: 
                   8386:                 <li>
                   8387:                   <p>If your package needs some executable to be
                   8388:                   able to run correctly and if there's agail no
1.14      xtraeme  8389:                   <code class="filename">buildlink3.mk</code> file,
                   8390:                   this is specified using the <code class=
                   8391:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    8392:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8393:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.14      xtraeme  8394:                   class="pkgname">print/lyx</a> package needs to be
                   8395:                   able to execute the latex binary from the teTeX
                   8396:                   package when it runs, and that is specified:</p>
1.1       grant    8397:                   <pre class="programlisting">
                   8398: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   8399: </pre>
                   8400: 
                   8401:                   <p>The comment about wildcard dependencies from
                   8402:                   previous paragraph applies here, too.</p>
                   8403:                 </li>
                   8404:               </ol>
                   8405:             </div>
                   8406: 
                   8407:             <p>If your package needs files from another package to
                   8408:             build, see the first part of the &#8220;<span class=
                   8409:             "quote">do-configure</span>&#8221; target <a xmlns=
                   8410:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8411:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.14      xtraeme  8412:             class="pkgname">print/ghostscript5</a> package (it
                   8413:             relies on the jpeg sources being present in source form
                   8414:             during the build):</p>
1.1       grant    8415:             <pre class="programlisting">
                   8416: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   8417:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   8418:     fi
                   8419: </pre>
                   8420: 
                   8421:             <p>If you build any other packages that way, please
                   8422:             make sure the working files are deleted too when this
                   8423:             package's working files are cleaned up. The easiest way
                   8424:             to do so is by adding a pre-clean target:</p>
                   8425:             <pre class="programlisting">
                   8426: pre-clean:
                   8427:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   8428: </pre>
                   8429: 
1.14      xtraeme  8430:             <p>Please also note the <code class=
                   8431:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   8432:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   8433:             which are provided as convenience definitions. The
                   8434:             former works out whether msgfmt(1) is part of the base
                   8435:             system, and, if it isn't, installs the <a xmlns=
1.1       grant    8436:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8437:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.14      xtraeme  8438:             class="pkgname">devel/gettext</a> package. The latter
                   8439:             adds a build dependency on either an installed version
                   8440:             of an older gettext package, or if it isn't, installs
                   8441:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8442:             href=
                   8443:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
                   8444:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    8445:           </div>
                   8446: 
                   8447:           <div class="sect2" lang="en" xml:lang="en">
                   8448:             <div class="titlepage">
                   8449:               <div>
                   8450:                 <div>
1.15    ! xtraeme  8451:                   <h3 class="title"><a name="id2591643" id=
        !          8452:                   "id2591643"></a>12.1.4.&nbsp;Handling conflicts
1.1       grant    8453:                   with other packages</h3>
                   8454:                 </div>
                   8455:               </div>
                   8456:             </div>
                   8457: 
                   8458:             <p>Your package may conflict with other packages a user
                   8459:             might already have installed on his system, e.g. if
                   8460:             your package installs the same set of files like
                   8461:             another package in our pkgsrc tree.</p>
                   8462: 
1.14      xtraeme  8463:             <p>In this case you can set <code class=
                   8464:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    8465:             packages (including version string) your package
                   8466:             conflicts with.</p>
                   8467: 
                   8468:             <p>For example <a xmlns=
                   8469:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8470:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.14      xtraeme  8471:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
                   8472:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8473:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
                   8474:             class="pkgname">x11/Xaw-Xpm</a> install provide the
                   8475:             same shared library, thus you set in <code class=
                   8476:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    8477:             <pre class="programlisting">
                   8478: CONFLICTS=      Xaw-Xpm-[0-9]*
                   8479: </pre>
                   8480: 
1.14      xtraeme  8481:             <p>and in <code class=
                   8482:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    8483:             <pre class="programlisting">
                   8484: CONFLICTS=      Xaw3d-[0-9]*
                   8485: </pre>
                   8486: 
                   8487:             <p>Packages will automatically conflict with other
                   8488:             packages with the name prefix and a different version
                   8489:             string. &#8220;<span class=
                   8490:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   8491:             conflict with the older version &#8220;<span class=
                   8492:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   8493:           </div>
                   8494: 
                   8495:           <div class="sect2" lang="en" xml:lang="en">
                   8496:             <div class="titlepage">
                   8497:               <div>
                   8498:                 <div>
1.15    ! xtraeme  8499:                   <h3 class="title"><a name="id2591762" id=
        !          8500:                   "id2591762"></a>12.1.5.&nbsp;Packages that cannot
1.1       grant    8501:                   or should not be built</h3>
                   8502:                 </div>
                   8503:               </div>
                   8504:             </div>
                   8505: 
                   8506:             <p>There are several reasons why a package might be
                   8507:             instructed to not build under certain circumstances. If
                   8508:             the package builds and runs on most platforms, the
1.14      xtraeme  8509:             exceptions should be noted with <code class=
                   8510:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   8511:             builds and runs on a small handful of platforms, set
                   8512:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
                   8513:             If the package should be skipped (for example, because
                   8514:             it provides functionality already provided by the
                   8515:             system), set <code class=
                   8516:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   8517:             message. If the package should fail because some
                   8518:             preconditions are not met, set <code class=
                   8519:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    8520:             message.</p>
                   8521: 
1.14      xtraeme  8522:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    8523:             because it didn't provide enough information to
                   8524:             determine whether the build should fail.</p>
                   8525:           </div>
                   8526: 
                   8527:           <div class="sect2" lang="en" xml:lang="en">
                   8528:             <div class="titlepage">
                   8529:               <div>
                   8530:                 <div>
1.15    ! xtraeme  8531:                   <h3 class="title"><a name="id2591787" id=
        !          8532:                   "id2591787"></a>12.1.6.&nbsp;Packages which
1.1       grant    8533:                   should not be deleted, once installed</h3>
                   8534:                 </div>
                   8535:               </div>
                   8536:             </div>
                   8537: 
                   8538:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  8539:             has been installed, the <code class=
                   8540:             "varname">PKG_PRESERVE</code> definition should be set
                   8541:             in the package Makefile. This will be carried into any
1.1       grant    8542:             binary package that is made from this pkgsrc entry. A
                   8543:             &#8220;<span class="quote">preserved</span>&#8221;
                   8544:             package will not be deleted using <a href=
                   8545:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8546:             <span class="citerefentry"><span class=
                   8547:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   8548:             the &#8220;<span class="quote">-f</span>&#8221; option
                   8549:             is used.</p>
                   8550:           </div>
                   8551: 
                   8552:           <div class="sect2" lang="en" xml:lang="en">
                   8553:             <div class="titlepage">
                   8554:               <div>
                   8555:                 <div>
                   8556:                   <h3 class="title"><a name="security-handling" id=
                   8557:                   "security-handling"></a>12.1.7.&nbsp;Handling
                   8558:                   packages with security problems</h3>
                   8559:                 </div>
                   8560:               </div>
                   8561:             </div>
                   8562: 
                   8563:             <p>When a vulnerability is found, this should be noted
1.14      xtraeme  8564:             in <code class=
                   8565:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    8566:             and after the commit of that file, it should be copied
1.14      xtraeme  8567:             to both <code class=
                   8568:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
                   8569:             and <code class=
                   8570:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
                   8571:             on ftp.NetBSD.org using <code class=
                   8572:             "filename">localsrc/security/advisories/Makefile</code>.
                   8573:             In addition, if a <code class=
                   8574:             "filename">buildlink3.mk</code> file exists for an
                   8575:             affected package, bumping <code class=
                   8576:             "varname">PKGREVISION</code> and creating a
                   8577:             corresponding <code class=
                   8578:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   8579:             "replaceable"><code>pkg</code></em></code> entry should
                   8580:             be considered. See <a href="#buildlink" title=
1.1       grant    8581:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8582:             <i>Buildlink methodology</i></a> for more information
1.14      xtraeme  8583:             about writing <code class=
                   8584:             "filename">buildlink3.mk</code> files and <code class=
                   8585:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    8586: 
                   8587:             <p>Also, if the fix should be applied to the stable
                   8588:             pkgsrc branch, be sure to submit a pullup request!</p>
                   8589:           </div>
                   8590: 
                   8591:           <div class="sect2" lang="en" xml:lang="en">
                   8592:             <div class="titlepage">
                   8593:               <div>
                   8594:                 <div>
1.15    ! xtraeme  8595:                   <h3 class="title"><a name="id2591879" id=
        !          8596:                   "id2591879"></a>12.1.8.&nbsp;How to handle
1.1       grant    8597:                   compiler bugs</h3>
                   8598:                 </div>
                   8599:               </div>
                   8600:             </div>
                   8601: 
                   8602:             <p>Some source files trigger bugs in the compiler,
                   8603:             based on combinations of compiler version and
                   8604:             architecture and almost always relation to optimisation
                   8605:             being enabled. Common symptoms are gcc internal errors
                   8606:             or never finishing compiling a file.</p>
                   8607: 
                   8608:             <p>Typically a workaround involves testing the
1.14      xtraeme  8609:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    8610:             version, disabling optimisation for that
1.14      xtraeme  8611:             file/<code class="varname">MACHINE_ARCH</code>/compiler
                   8612:             combination, and documenting it in <code class=
                   8613:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    8614:             number of examples!</p>
                   8615:           </div>
                   8616: 
                   8617:           <div class="sect2" lang="en" xml:lang="en">
                   8618:             <div class="titlepage">
                   8619:               <div>
                   8620:                 <div>
1.15    ! xtraeme  8621:                   <h3 class="title"><a name="id2591901" id=
        !          8622:                   "id2591901"></a>12.1.9.&nbsp;How to handle
1.1       grant    8623:                   incrementing versions when fixing an existing
                   8624:                   package</h3>
                   8625:                 </div>
                   8626:               </div>
                   8627:             </div>
                   8628: 
                   8629:             <p>When making fixes to an existing package it can be
1.14      xtraeme  8630:             useful to change the version number in <code class=
                   8631:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    8632:             future versions by the original author, a
                   8633:             &#8220;<span class="quote">nb1</span>&#8221;,
                   8634:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   8635:             suffix can be used on package versions by setting
1.14      xtraeme  8636:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   8637:             The &#8220;<span class="quote">nb</span>&#8221; is
                   8638:             treated like a &#8220;<span class=
                   8639:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    8640:             <pre class="programlisting">
                   8641:   DISTNAME= foo-17.42
                   8642:     PKGREVISION=  9
                   8643: </pre>
                   8644: 
1.14      xtraeme  8645:             <p>will result in a <code class=
                   8646:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    8647:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   8648: 
                   8649:             <p>When a new release of the package is released, the
1.14      xtraeme  8650:             <code class="varname">PKGREVISION</code> should be
                   8651:             removed. e.g. on a new minor release of the above
                   8652:             package, things should be like:</p>
1.1       grant    8653:             <pre class="programlisting">
                   8654: DISTNAME=   foo-17.43
                   8655: </pre>
                   8656:           </div>
                   8657: 
                   8658:           <div class="sect2" lang="en" xml:lang="en">
                   8659:             <div class="titlepage">
                   8660:               <div>
                   8661:                 <div>
1.15    ! xtraeme  8662:                   <h3 class="title"><a name="id2591950" id=
        !          8663:                   "id2591950"></a>12.1.10.&nbsp;Portability of
1.1       grant    8664:                   packages</h3>
                   8665:                 </div>
                   8666:               </div>
                   8667:             </div>
                   8668: 
                   8669:             <p>One appealing feature of pkgsrc is that it runs on
                   8670:             many different platforms. As a result, it is important
                   8671:             to ensure, where possible, that packages in pkgsrc are
                   8672:             portable. There are some particular details you should
                   8673:             pay attention to while working on pkgsrc.</p>
                   8674: 
                   8675:             <div class="sect3" lang="en" xml:lang="en">
                   8676:               <div class="titlepage">
                   8677:                 <div>
                   8678:                   <div>
1.15    ! xtraeme  8679:                     <h4 class="title"><a name="id2591956" id=
        !          8680:                     "id2591956"></a>12.1.10.1.&nbsp;${INSTALL},
1.1       grant    8681:                     ${INSTALL_DATA_DIR}, ...</h4>
                   8682:                   </div>
                   8683:                 </div>
                   8684:               </div>
                   8685: 
1.14      xtraeme  8686:               <p>The BSD-compatible <span><strong class=
                   8687:               "command">install</strong></span> supplied with some
1.1       grant    8688:               operating systems will not perform more than one
                   8689:               operation at a time. As such, you should call
                   8690:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   8691:               etc. like this:</p>
                   8692:               <pre class="programlisting">
                   8693: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   8694: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   8695: </pre>
                   8696:             </div>
                   8697:           </div>
                   8698:         </div>
                   8699: 
                   8700:         <div class="sect1" lang="en" xml:lang="en">
                   8701:           <div class="titlepage">
                   8702:             <div>
                   8703:               <div>
                   8704:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  8705:                 "id2591975" id="id2591975"></a>12.2.&nbsp;Possible
1.1       grant    8706:                 downloading issues</h2>
                   8707:               </div>
                   8708:             </div>
                   8709:           </div>
                   8710: 
                   8711:           <div class="sect2" lang="en" xml:lang="en">
                   8712:             <div class="titlepage">
                   8713:               <div>
                   8714:                 <div>
1.15    ! xtraeme  8715:                   <h3 class="title"><a name="id2591978" id=
        !          8716:                   "id2591978"></a>12.2.1.&nbsp;Packages whose
1.1       grant    8717:                   distfiles aren't available for plain
                   8718:                   downloading</h3>
                   8719:                 </div>
                   8720:               </div>
                   8721:             </div>
                   8722: 
                   8723:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  8724:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   8725:             and a <span><strong class="command">make
                   8726:             fetch</strong></span> will call <code class=
                   8727:             "filename">files/getsite.sh</code> with the name of
                   8728:             each file to download as an argument, expecting it to
                   8729:             output the URL of the directory from which to download
                   8730:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8731:             href=
1.1       grant    8732:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.14      xtraeme  8733:             class="pkgname">graphics/ns-cult3d</a> is an example of
                   8734:             this usage.</p>
1.1       grant    8735: 
                   8736:             <p>If the download can't be automated, because the user
                   8737:             must submit personal information to apply for a
                   8738:             password, or must pay for the source, or whatever, you
1.14      xtraeme  8739:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   8740:             a macro which displays a message explaining the
                   8741:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   8742:             must be executable shell commands, not just a message.
                   8743:             (Generally, it executes <code class=
                   8744:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    8745:             following packages use this: <a xmlns=
                   8746:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8747:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.14      xtraeme  8748:             class="pkgname">audio/realplayer</a>, <a xmlns=
                   8749:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8750:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
                   8751:             class="pkgname">cad/simian</a>, <a xmlns=
                   8752:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8753:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
                   8754:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
                   8755:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8756:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
                   8757:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
                   8758:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8759:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
                   8760:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
                   8761:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8762:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
                   8763:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
                   8764:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8765:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
                   8766:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
                   8767:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8768:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
                   8769:             class="pkgname">www/openacs</a>. Try to be consistent
                   8770:             with them.</p>
1.1       grant    8771:           </div>
                   8772: 
                   8773:           <div class="sect2" lang="en" xml:lang="en">
                   8774:             <div class="titlepage">
                   8775:               <div>
                   8776:                 <div>
1.15    ! xtraeme  8777:                   <h3 class="title"><a name="id2592109" id=
        !          8778:                   "id2592109"></a>12.2.2.&nbsp;How to handle
1.1       grant    8779:                   modified distfiles with the 'old' name</h3>
                   8780:                 </div>
                   8781:               </div>
                   8782:             </div>
                   8783: 
                   8784:             <p>Sometimes authors of a software package make some
                   8785:             modifications after the software was released, and they
                   8786:             put up a new distfile without changing the package's
                   8787:             version number. If a package is already in pkgsrc at
                   8788:             that time, the md5 checksum will no longer match. The
                   8789:             correct way to work around this is to update the
                   8790:             package's md5 checksum to match the package on the
                   8791:             master site (beware, any mirrors may not be up to date
                   8792:             yet!), and to remove the old distfile from
1.14      xtraeme  8793:             ftp.NetBSD.org's <code class=
                   8794:             "filename">/pub/NetBSD/packages/distfiles</code>
1.1       grant    8795:             directory. Furthermore, a mail to the package's author
                   8796:             seems appropriate making sure the distfile was really
                   8797:             updated on purpose, and that no trojan horse or so
                   8798:             crept in.</p>
                   8799:           </div>
                   8800:         </div>
                   8801: 
                   8802:         <div class="sect1" lang="en" xml:lang="en">
                   8803:           <div class="titlepage">
                   8804:             <div>
                   8805:               <div>
                   8806:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  8807:                 "id2592121" id=
        !          8808:                 "id2592121"></a>12.3.&nbsp;Configuration
1.1       grant    8809:                 gotchas</h2>
                   8810:               </div>
                   8811:             </div>
                   8812:           </div>
                   8813: 
                   8814:           <div class="sect2" lang="en" xml:lang="en">
                   8815:             <div class="titlepage">
                   8816:               <div>
                   8817:                 <div>
                   8818:                   <h3 class="title"><a name="fixes.libtool" id=
                   8819:                   "fixes.libtool"></a>12.3.1.&nbsp;Shared libraries
                   8820:                   - libtool</h3>
                   8821:                 </div>
                   8822:               </div>
                   8823:             </div>
                   8824: 
                   8825:             <p>pkgsrc supports many different machines, with
                   8826:             different object formats like a.out and ELF, and
                   8827:             varying abilities to do shared library and dynamic
                   8828:             loading at all. To accompany this, varying commands and
                   8829:             options have to be passed to the compiler, linker, etc.
                   8830:             to get the Right Thing, which can be pretty annoying
                   8831:             especially if you don't have all the machines at your
                   8832:             hand to test things. The <a xmlns=
                   8833:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8834:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.14      xtraeme  8835:             class="pkgname">devel/libtool</a> pkg can help here, as
                   8836:             it just &#8220;<span class="quote">knows</span>&#8221;
                   8837:             how to build both static and dynamic libraries from a
                   8838:             set of source files, thus being platform
                   8839:             independent.</p>
1.1       grant    8840: 
                   8841:             <p>Here's how to use libtool in a pkg in seven simple
                   8842:             steps:</p>
                   8843: 
                   8844:             <div class="orderedlist">
                   8845:               <ol type="1">
                   8846:                 <li>
1.14      xtraeme  8847:                   <p>Add <code class=
                   8848:                   "varname">USE_LIBTOOL=yes</code> to the package
                   8849:                   Makefile.</p>
1.1       grant    8850:                 </li>
                   8851: 
                   8852:                 <li>
                   8853:                   <p>For library objects, use &#8220;<span class=
                   8854:                   "quote">${LIBTOOL} --mode=compile
                   8855:                   ${CC}</span>&#8221; in place of
                   8856:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   8857:                   You could even add it to the definition of
1.14      xtraeme  8858:                   <code class="varname">CC</code>, if only
                   8859:                   libraries are being built in a given Makefile.
                   8860:                   This one command will build both PIC and non-PIC
                   8861:                   library objects, so you need not have separate
                   8862:                   shared and non-shared library rules.</p>
1.1       grant    8863:                 </li>
                   8864: 
                   8865:                 <li>
                   8866:                   <p>For the linking of the library, remove any
                   8867:                   &#8220;<span class="quote">ar</span>&#8221;,
                   8868:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   8869:                   and &#8220;<span class="quote">ld
                   8870:                   -Bshareable</span>&#8221; commands, and instead
                   8871:                   use:</p>
                   8872:                   <pre class="programlisting">
                   8873: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   8874: </pre>
                   8875: 
                   8876:                   <p>Note that the library is changed to have a
1.14      xtraeme  8877:                   <code class="filename">.la</code> extension, and
                   8878:                   the objects are changed to have a <code class=
                   8879:                   "filename">.lo</code> extension. Change
                   8880:                   <code class="varname">OBJS</code> as necessary.
                   8881:                   This automatically creates all of the
                   8882:                   <code class="filename">.a</code>, <code class=
                   8883:                   "filename">.so.major.minor</code>, and ELF
                   8884:                   symlinks (if necessary) in the build directory.
                   8885:                   Be sure to include &#8220;<span class=
1.1       grant    8886:                   "quote">-version-info</span>&#8221;, especially
                   8887:                   when major and minor are zero, as libtool will
                   8888:                   otherwise strip off the shared library
                   8889:                   version.</p>
                   8890: 
                   8891:                   <p>From the libtool manual:</p>
                   8892:                   <pre class="programlisting">
                   8893:      So, libtool library versions are described by three integers:
                   8894: 
                   8895: CURRENT
                   8896:        The most recent interface number that this library implements.
                   8897: 
                   8898: REVISION
                   8899:        The implementation number of the CURRENT interface.
                   8900: 
                   8901: AGE
                   8902:        The difference between the newest and oldest interfaces that this
                   8903:        library implements.  In other words, the library implements all the
                   8904:        interface numbers in the range from number `CURRENT - AGE' to
                   8905:        `CURRENT'.
                   8906:        
                   8907:      If two libraries have identical CURRENT and AGE numbers, then the
                   8908: dynamic linker chooses the library with the greater REVISION number. 
                   8909: </pre>
                   8910: 
                   8911:                   <p>The &#8220;<span class=
                   8912:                   "quote">-release</span>&#8221; option will
                   8913:                   produce different results for a.out and ELF
                   8914:                   (excluding symlinks) in only one case. An ELF
                   8915:                   library of the form &#8220;<span class=
                   8916:                   "quote">libfoo-release.so.<span class=
                   8917:                   "emphasis"><em>x</em></span>.<span class=
                   8918:                   "emphasis"><em>y</em></span></span>&#8221; will
                   8919:                   have a symlink of &#8220;<span class=
                   8920:                   "quote">libfoo.so.<span class=
                   8921:                   "emphasis"><em>x</em></span>.<span class=
                   8922:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   8923:                   a.out platform. This is handled
                   8924:                   automatically.</p>
                   8925: 
                   8926:                   <p>The &#8220;<span class="quote">-rpath
                   8927:                   argument</span>&#8221; is the install directory
                   8928:                   of the library being built.</p>
                   8929: 
1.14      xtraeme  8930:                   <p>In the <code class="filename">PLIST</code>,
                   8931:                   include all of the <code class=
                   8932:                   "filename">.a</code>, <code class=
                   8933:                   "filename">.la</code>, and <code class=
                   8934:                   "filename">.so</code>, <code class=
                   8935:                   "filename">.so.<em class=
                   8936:                   "replaceable"><code>major</code></em></code> and
                   8937:                   <code class="filename">.so.<em class=
                   8938:                   "replaceable"><code>major</code></em>.<em class=
                   8939:                   "replaceable"><code>minor</code></em></code>
                   8940:                   files.</p>
1.1       grant    8941:                 </li>
                   8942: 
                   8943:                 <li>
1.14      xtraeme  8944:                   <p>When linking shared object (<code class=
                   8945:                   "filename">.so</code>) files, i.e. files that are
1.1       grant    8946:                   loaded via dlopen(3), NOT shared libraries, use
                   8947:                   &#8220;<span class="quote">-module
                   8948:                   -avoid-version</span>&#8221; to prevent them
                   8949:                   getting version tacked on.</p>
                   8950: 
1.14      xtraeme  8951:                   <p>The <code class="filename">PLIST</code> file
                   8952:                   gets the <code class="filename">foo.so</code>
                   8953:                   entry.</p>
1.1       grant    8954:                 </li>
                   8955: 
                   8956:                 <li>
                   8957:                   <p>When linking programs that depend on these
                   8958:                   libraries <span class=
                   8959:                   "emphasis"><em>before</em></span> they are
                   8960:                   installed, preface the <a href=
                   8961:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   8962:                   <span class="citerefentry"><span class=
                   8963:                   "refentrytitle">cc</span>(1)</span></a> or
                   8964:                   <a href=
                   8965:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   8966:                   <span class="citerefentry"><span class=
                   8967:                   "refentrytitle">ld</span>(1)</span></a> line with
                   8968:                   &#8220;<span class="quote">${LIBTOOL}
                   8969:                   --mode=link</span>&#8221;, and it will find the
                   8970:                   correct libraries (static or shared), but please
                   8971:                   be aware that libtool will not allow you to
                   8972:                   specify a relative path in -L (such as
                   8973:                   &#8220;<span class=
                   8974:                   "quote">-L../somelib</span>&#8221;), because it
                   8975:                   expects you to change that argument to be the
1.14      xtraeme  8976:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    8977:                   <pre class="programlisting">
                   8978: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   8979: </pre>
                   8980: 
                   8981:                   <p>should be changed to:</p>
                   8982:                   <pre class="programlisting">
1.14      xtraeme  8983: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   8984: "replaceable"><code>someprog</code></em> <em class=
                   8985: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    8986: </pre>
                   8987: 
                   8988:                   <p>and it will do the right thing with the
                   8989:                   libraries.</p>
                   8990:                 </li>
                   8991: 
                   8992:                 <li>
                   8993:                   <p>When installing libraries, preface the
                   8994:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   8995:                   <span class="citerefentry"><span class=
                   8996:                   "refentrytitle">install</span>(1)</span></a> or
                   8997:                   <a href=
                   8998:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   8999:                   <span class="citerefentry"><span class=
                   9000:                   "refentrytitle">cp</span>(1)</span></a> command
                   9001:                   with &#8220;<span class="quote">${LIBTOOL}
                   9002:                   --mode=install</span>&#8221;, and change the
1.14      xtraeme  9003:                   library name to <code class=
                   9004:                   "filename">.la</code>. e.g.</p>
1.1       grant    9005:                   <pre class="programlisting">
                   9006: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   9007: </pre>
                   9008: 
1.14      xtraeme  9009:                   <p>This will install the static <code class=
                   9010:                   "filename">.a</code>, shared library, any needed
1.1       grant    9011:                   symlinks, and run <a href=
                   9012:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   9013:                   <span class="citerefentry"><span class=
                   9014:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   9015:                 </li>
                   9016: 
                   9017:                 <li>
1.14      xtraeme  9018:                   <p>In your <code class="filename">PLIST</code>,
                   9019:                   include all of the <code class=
                   9020:                   "filename">.a</code>, <code class=
                   9021:                   "filename">.la</code>, and <code class=
                   9022:                   "filename">.so</code>, <code class=
                   9023:                   "filename">.so.CURRENT</code> and <code class=
                   9024:                   "filename">.so.CURRENT.REVISION</code> files
                   9025:                   (this is a change from the previous
                   9026:                   behaviour).</p>
1.1       grant    9027:                 </li>
                   9028:               </ol>
                   9029:             </div>
                   9030:           </div>
                   9031: 
                   9032:           <div class="sect2" lang="en" xml:lang="en">
                   9033:             <div class="titlepage">
                   9034:               <div>
                   9035:                 <div>
1.15    ! xtraeme  9036:                   <h3 class="title"><a name="id2592529" id=
        !          9037:                   "id2592529"></a>12.3.2.&nbsp;Using libtool on GNU
1.1       grant    9038:                   packages that already support libtool</h3>
                   9039:                 </div>
                   9040:               </div>
                   9041:             </div>
                   9042: 
1.14      xtraeme  9043:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   9044:             the package Makefile. This will override the package's
                   9045:             own libtool in most cases. For older libtool using
1.1       grant    9046:             packages, libtool is made by ltconfig script during the
                   9047:             do-configure step; you can check the libtool script
1.14      xtraeme  9048:             location by doing <span><strong class="command">make
                   9049:             configure; find work*/ -name
                   9050:             libtool</strong></span>.</p>
                   9051: 
                   9052:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   9053:             specifies which libtool scripts, relative to
                   9054:             <code class="varname">WRKSRC</code>, to override. By
                   9055:             default, it is set to &#8220;<span class=
                   9056:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   9057:             this does not match the location of the package's
                   9058:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  9059: 
1.14      xtraeme  9060:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    9061:             static libraries built and installed, then use
1.14      xtraeme  9062:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    9063:             instead.</p>
                   9064: 
                   9065:             <p>If your package makes use of the platform
                   9066:             independent library for loading dynamic shared objects,
                   9067:             that comes with libtool (libltdl), you should include
1.14      xtraeme  9068:             the libtool buildlink3.mk (and set <code class=
                   9069:             "varname">USE_BUILDLINK3=YES</code>).</p>
1.1       grant    9070: 
                   9071:             <p>Some packages use libtool incorrectly so that the
                   9072:             package may not work or build in some circumstances.
                   9073:             Some of the more common errors are:</p>
                   9074: 
                   9075:             <div class="itemizedlist">
                   9076:               <ul type="disc">
                   9077:                 <li>
                   9078:                   <p>The inclusion of a shared object (-module) as
                   9079:                   a dependent library in an executable or library.
                   9080:                   This in itself isn't a problem if one of two
                   9081:                   things has been done:</p>
                   9082: 
                   9083:                   <div class="orderedlist">
                   9084:                     <ol type="1">
                   9085:                       <li>
                   9086:                         <p>The shared object is named correctly,
1.14      xtraeme  9087:                         i.e. <code class=
                   9088:                         "filename">libfoo.la</code>, not
                   9089:                         <code class="filename">foo.la</code></p>
1.1       grant    9090:                       </li>
                   9091: 
                   9092:                       <li>
                   9093:                         <p>The -dlopen option is used when linking
                   9094:                         an executable.</p>
                   9095:                       </li>
                   9096:                     </ol>
                   9097:                   </div>
                   9098:                 </li>
                   9099: 
                   9100:                 <li>
                   9101:                   <p>The use of libltdl without the correct calls
                   9102:                   to initialisation routines. The function
                   9103:                   lt_dlinit() should be called and the macro
1.14      xtraeme  9104:                   <code class=
                   9105:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    9106:                   included in executables.</p>
                   9107:                 </li>
                   9108:               </ul>
                   9109:             </div>
                   9110:           </div>
                   9111: 
                   9112:           <div class="sect2" lang="en" xml:lang="en">
                   9113:             <div class="titlepage">
                   9114:               <div>
                   9115:                 <div>
1.15    ! xtraeme  9116:                   <h3 class="title"><a name="id2592613" id=
        !          9117:                   "id2592613"></a>12.3.3.&nbsp;GNU
1.1       grant    9118:                   Autoconf/Automake</h3>
                   9119:                 </div>
                   9120:               </div>
                   9121:             </div>
                   9122: 
                   9123:             <p>If a package needs GNU autoconf or automake to be
                   9124:             executed to regenerate the configure script and
                   9125:             Makefile.in makefile templates, then they should be
                   9126:             executed in a pre-configure target. Two Makefile
1.14      xtraeme  9127:             fragments are provided in <code class=
                   9128:             "filename">pkgsrc/mk/autoconf.mk</code> and
                   9129:             <code class="filename">pkgsrc/mk/automake.mk</code> to
                   9130:             help dealing with these tools. See comments in these
                   9131:             files for details.</p>
1.1       grant    9132: 
                   9133:             <p>For packages that need only autoconf:</p>
                   9134:             <pre class="programlisting">
                   9135: AUTOCONF_REQD=    2.50    # if default version is not good enough
                   9136: ...
                   9137: 
                   9138: pre-configure:
                   9139:           cd ${WRKSRC}; ${AUTOCONF}
                   9140: 
                   9141: ...
                   9142: .include "../../mk/autoconf.mk"
                   9143: </pre>
                   9144: 
                   9145:             <p>and for packages that need automake and
                   9146:             autoconf:</p>
                   9147:             <pre class="programlisting">
                   9148: AUTOMAKE_REQD=  1.7.1   # if default version is not good enough
                   9149: ...
                   9150: 
                   9151: pre-configure:
                   9152:           cd ${WRKSRC};                                           \
                   9153:           ${ACLOCAL};                                             \
                   9154:           ${AUTOHEADER};                                          \
                   9155:           ${AUTOMAKE} -a --foreign -i;                            \
                   9156:           ${AUTOCONF}
                   9157: 
                   9158: ...
                   9159: .include "../mk/automake.mk"
                   9160: </pre>
                   9161: 
                   9162:             <p>Packages which use GNU Automake will almost
                   9163:             certainly require GNU Make, but that's automatically
1.14      xtraeme  9164:             provided for you in <code class=
                   9165:             "filename">mk/automake.mk</code>.</p>
1.1       grant    9166: 
                   9167:             <p>There are times when the configure process makes
                   9168:             additional changes to the generated files, which then
                   9169:             causes the build process to try to re-execute the
                   9170:             automake sequence. This is prevented by touching
                   9171:             various files in the configure stage. If this causes
1.14      xtraeme  9172:             problems with your package you can set <code class=
                   9173:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    9174:             Makefile.</p>
                   9175:           </div>
                   9176:         </div>
                   9177: 
                   9178:         <div class="sect1" lang="en" xml:lang="en">
                   9179:           <div class="titlepage">
                   9180:             <div>
                   9181:               <div>
                   9182:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  9183:                 "id2592726" id="id2592726"></a>12.4.&nbsp;Building
1.1       grant    9184:                 considerations</h2>
                   9185:               </div>
                   9186:             </div>
                   9187:           </div>
                   9188: 
                   9189:           <div class="sect2" lang="en" xml:lang="en">
                   9190:             <div class="titlepage">
                   9191:               <div>
                   9192:                 <div>
1.15    ! xtraeme  9193:                   <h3 class="title"><a name="id2592729" id=
        !          9194:                   "id2592729"></a>12.4.1.&nbsp;CPP defines</h3>
1.1       grant    9195:                 </div>
                   9196:               </div>
                   9197:             </div>
                   9198: 
                   9199:             <p>To port an application to NetBSD, it's usually
                   9200:             necessary for the compiler to be able to judge the
                   9201:             system on which it's compiling, and we use definitions
                   9202:             so that the C pre-processor can do this.</p>
                   9203: 
                   9204:             <p>To test whether you are working on a 4.4 BSD-derived
                   9205:             system, you should use the BSD definition, which is
1.14      xtraeme  9206:             defined in <code class=
                   9207:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    9208:             systems.</p>
                   9209:             <pre class="programlisting">
                   9210: #include &lt;sys/param.h&gt;
                   9211: </pre>
                   9212: 
                   9213:             <p>and then you can surround the BSD-specific parts of
                   9214:             your package's C/C++ code using this conditional:</p>
                   9215:             <pre class="programlisting">
                   9216: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   9217:     ...
                   9218: #endif
                   9219: </pre>
                   9220: 
                   9221:             <p>Please use the &#8220;<span class=
                   9222:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   9223:             it should only apply to features of NetBSD that are not
                   9224:             present in other 4.4-lite derived BSDs.</p>
                   9225:           </div>
                   9226:         </div>
                   9227: 
                   9228:         <div class="sect1" lang="en" xml:lang="en">
                   9229:           <div class="titlepage">
                   9230:             <div>
                   9231:               <div>
                   9232:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  9233:                 "id2592759" id="id2592759"></a>12.5.&nbsp;Package
1.1       grant    9234:                 specific actions</h2>
                   9235:               </div>
                   9236:             </div>
                   9237:           </div>
                   9238: 
                   9239:           <div class="sect2" lang="en" xml:lang="en">
                   9240:             <div class="titlepage">
                   9241:               <div>
                   9242:                 <div>
1.15    ! xtraeme  9243:                   <h3 class="title"><a name="id2592762" id=
        !          9244:                   "id2592762"></a>12.5.1.&nbsp;Package
1.1       grant    9245:                   configuration files</h3>
                   9246:                 </div>
                   9247:               </div>
                   9248:             </div>
                   9249: 
                   9250:             <p>Packages should be taught to look for their
1.14      xtraeme  9251:             configuration files in <code class=
                   9252:             "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1       grant    9253:             through to the configure and build processes.
1.14      xtraeme  9254:             <code class="varname">PKG_SYSCONFDIR</code> may be
1.1       grant    9255:             customized in various ways by setting other make
                   9256:             variables:</p>
                   9257: 
                   9258:             <div class="itemizedlist">
                   9259:               <ul type="disc">
                   9260:                 <li>
1.14      xtraeme  9261:                   <p><code class="varname">PKG_SYSCONFBASE</code>
                   9262:                   is the main config directory under which all
                   9263:                   package configuration files are to be found. This
                   9264:                   defaults to <code class=
                   9265:                   "filename">${PREFIX}/etc</code>, but may be
                   9266:                   overridden in <code class=
                   9267:                   "filename">/etc/mk.conf</code>.</p>
1.1       grant    9268:                 </li>
                   9269: 
                   9270:                 <li>
1.14      xtraeme  9271:                   <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   9272:                   is the subdirectory of <code class=
                   9273:                   "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    9274:                   configuration files for a particular package may
                   9275:                   be found, e.g. the Apache configuration files may
1.14      xtraeme  9276:                   all be found under the <code class=
                   9277:                   "filename">httpd/</code> subdirectory of
                   9278:                   <code class="varname">${PKG_SYSCONFBASE}</code>.
                   9279:                   This should be set in the package Makefile.</p>
1.1       grant    9280:                 </li>
                   9281: 
                   9282:                 <li>
1.14      xtraeme  9283:                   <p>By default, <code class=
                   9284:                   "varname">PKG_SYSCONFDIR</code> is set to
                   9285:                   <code class=
                   9286:                   "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
                   9287:                   but this may be overridden by setting
                   9288:                   <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9289:                   for a particular package, where <code class=
                   9290:                   "varname">PKG_SYSCONFVAR</code> defaults to
                   9291:                   <code class="varname">${PKGBASE}</code>. This is
                   9292:                   not meant to be set by a package Makefile, but is
1.1       grant    9293:                   reserved for users who wish to override the
1.14      xtraeme  9294:                   <code class="varname">PKG_SYSCONFDIR</code>
                   9295:                   setting for a particular package with a special
1.1       grant    9296:                   location.</p>
                   9297:                 </li>
                   9298:               </ul>
                   9299:             </div>
                   9300: 
                   9301:             <p>The only variables that users should customize are
1.14      xtraeme  9302:             <code class="varname">PKG_SYSCONFBASE</code> and
                   9303:             <code class=
                   9304:             "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
                   9305:             Users will typically want to set <code class=
                   9306:             "varname">PKG_SYSCONFBASE</code> to <code class=
                   9307:             "filename">/etc</code>, or to accept the default
                   9308:             location of <code class=
                   9309:             "filename">${PREFIX}/etc</code>.</p>
1.1       grant    9310:           </div>
                   9311: 
                   9312:           <div class="sect2" lang="en" xml:lang="en">
                   9313:             <div class="titlepage">
                   9314:               <div>
                   9315:                 <div>
1.15    ! xtraeme  9316:                   <h3 class="title"><a name="id2592933" id=
        !          9317:                   "id2592933"></a>12.5.2.&nbsp;User
1.2       hubertf  9318:                   interaction</h3>
1.1       grant    9319:                 </div>
                   9320:               </div>
                   9321:             </div>
                   9322: 
                   9323:             <p>Occasionally, packages require interaction from the
                   9324:             user, and this can be in a number of ways:</p>
                   9325: 
                   9326:             <div class="itemizedlist">
                   9327:               <ul type="disc">
                   9328:                 <li>
                   9329:                   <p>help in fetching the distfiles</p>
                   9330:                 </li>
                   9331: 
                   9332:                 <li>
                   9333:                   <p>help to configure the package before it is
                   9334:                   built</p>
                   9335:                 </li>
                   9336: 
                   9337:                 <li>
                   9338:                   <p>help during the build process</p>
                   9339:                 </li>
                   9340: 
                   9341:                 <li>
                   9342:                   <p>help during the installation of a package</p>
                   9343:                 </li>
                   9344:               </ul>
                   9345:             </div>
                   9346: 
1.14      xtraeme  9347:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    9348:             definition is provided to notify the pkgsrc mechanism
                   9349:             of an interactive stage which will be needed, and this
1.14      xtraeme  9350:             should be set in the package's <code class=
                   9351:             "filename">Makefile</code>. e.g.</p>
1.1       grant    9352:             <pre class="programlisting">
                   9353: INTERACTIVE_STAGE= build
                   9354: </pre>
                   9355: 
                   9356:             <p>Multiple interactive stages can be specified:</p>
                   9357:             <pre class="programlisting">
                   9358: INTERACTIVE_STAGE= configure install
                   9359: </pre>
                   9360:           </div>
                   9361: 
                   9362:           <div class="sect2" lang="en" xml:lang="en">
                   9363:             <div class="titlepage">
                   9364:               <div>
                   9365:                 <div>
1.15    ! xtraeme  9366:                   <h3 class="title"><a name="id2593046" id=
        !          9367:                   "id2593046"></a>12.5.3.&nbsp;Handling
1.1       grant    9368:                   licenses</h3>
                   9369:                 </div>
                   9370:               </div>
                   9371:             </div>
                   9372: 
                   9373:             <p>A package may underly a license which the user has
                   9374:             or has not agreed to accept. Usually, packages that
                   9375:             underly well-known Open Source licenses (e.g. the GNU
                   9376:             Public License, GPL) won't have any special license
                   9377:             tags added in pkgsrc which require special action by
                   9378:             the user of such packages, but there are quite a number
                   9379:             of other licenses out there that pkgsrc users may not
                   9380:             be able to follow, for whatever reasons. For these
                   9381:             cases, pkgsrc contains a mechanism to note that a
                   9382:             package underlies a certain license, and the user has
                   9383:             to accept the license before the package can be
                   9384:             installed.</p>
                   9385: 
                   9386:             <p>Placing a certain package under a certain license
1.14      xtraeme  9387:             works by setting the <code class=
                   9388:             "varname">LICENSE</code> variable to a string
                   9389:             identifying the license, e.g. in <a xmlns=
                   9390:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9391:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.14      xtraeme  9392:             class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    9393:             <pre class="programlisting">
                   9394: LICENSE=        graphviz-license
                   9395: </pre>
                   9396: 
                   9397:             <p>When trying to build, the user will get a notice
                   9398:             that the package underlies a license which he hasn't
                   9399:             accepted (yet):</p>
                   9400:             <pre class="programlisting">
1.14      xtraeme  9401: <code class="prompt">%</code> <strong class=
                   9402: "userinput"><code>make</code></strong>
1.1       grant    9403: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   9404: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   9405: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   9406: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   9407: *** Error code 1
                   9408: </pre>
                   9409: 
1.14      xtraeme  9410:             <p>The license can be viewed with <span><strong class=
                   9411:             "command">make show-license</strong></span>, and if it
                   9412:             is considered appropriate, the line printed above can
                   9413:             be added to <code class="filename">/etc/mk.conf</code>
                   9414:             to indicate acceptance of the particular license:</p>
1.1       grant    9415:             <pre class="programlisting">
                   9416: ACCEPTABLE_LICENSES+=graphviz-license
                   9417: </pre>
                   9418: 
                   9419:             <p>When adding a package with a new license, the
1.14      xtraeme  9420:             license text should be added to <code class=
                   9421:             "filename">pkgsrc/licenses</code> for displaying. A
                   9422:             list of known licenses can be seen in this directory as
                   9423:             well as by looking at the list of (commented out)
                   9424:             <code class="varname">ACCEPTABLE_LICENSES</code>
                   9425:             variable settings in <code class=
                   9426:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    9427: 
                   9428:             <p>Is there is a <span class=
                   9429:             "emphasis"><em>really</em></span> pressing need to
                   9430:             accept all licenses at once, like when trying to
                   9431:             download or mirror all distfiles or doing a bulk build
                   9432:             to test if all packages in pkgsrc build, this can be
1.14      xtraeme  9433:             done by setting <code class=
                   9434:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    9435:           </div>
                   9436: 
                   9437:           <div class="sect2" lang="en" xml:lang="en">
                   9438:             <div class="titlepage">
                   9439:               <div>
                   9440:                 <div>
1.15    ! xtraeme  9441:                   <h3 class="title"><a name="id2593197" id=
        !          9442:                   "id2593197"></a>12.5.4.&nbsp;Creating an account
1.1       grant    9443:                   from a package</h3>
                   9444:                 </div>
                   9445:               </div>
                   9446:             </div>
                   9447: 
                   9448:             <p>There are two make variables used to control the
                   9449:             creation of package-specific groups and users at
1.14      xtraeme  9450:             pre-install time. The first is <code class=
                   9451:             "varname">PKG_GROUPS</code>, which is a list of
1.1       grant    9452:             group[:groupid] elements, where the groupid is
1.14      xtraeme  9453:             optional. The second is <code class=
                   9454:             "varname">PKG_USERS</code>, which is a list of elements
1.1       grant    9455:             of the form:</p>
                   9456:             <pre class="programlisting">
                   9457: user:group[:[userid][:[description][:[home][:shell]]]]
                   9458: </pre>
                   9459: 
                   9460:             <p>where only the user and group are required, the rest
                   9461:             being optional. A simple example is:</p>
                   9462:             <pre class="programlisting">
                   9463:   PKG_GROUPS=       foogroup
                   9464:     PKG_USERS=    foouser:foogroup
                   9465: </pre>
                   9466: 
                   9467:             <p>A more complex example is that creates two groups
                   9468:             and two users is:</p>
                   9469:             <pre class="programlisting">
                   9470:   PKG_GROUPS=       group1 group2:1005
                   9471:     PKG_USERS=    first:group1::First\\ User                      \
                   9472:                   second:group2::Second\\ User:/home/second:${SH}
                   9473: </pre>
                   9474: 
                   9475:             <p>By default, a new user will have home directory
1.14      xtraeme  9476:             <code class="filename">/nonexistent</code>, and login
                   9477:             shell <code class="filename">/sbin/nologin</code>
                   9478:             unless they are specified as part of the user
                   9479:             element.</p>
1.1       grant    9480: 
1.14      xtraeme  9481:             <p>The package <code class="filename">Makefile</code>
                   9482:             must also set <code class=
                   9483:             "varname">USE_PKGINSTALL=YES</code>. This will cause
                   9484:             the users and groups to be created at pre-install time,
                   9485:             and the admin will be prompted to remove them at
                   9486:             post-deinstall time. Automatic creation of the users
                   9487:             and groups can be toggled on and off by setting the
                   9488:             <code class="varname">PKG_CREATE_USERGROUP</code>
                   9489:             variable prior to package installation.</p>
1.1       grant    9490:           </div>
                   9491: 
                   9492:           <div class="sect2" lang="en" xml:lang="en">
                   9493:             <div class="titlepage">
                   9494:               <div>
                   9495:                 <div>
1.15    ! xtraeme  9496:                   <h3 class="title"><a name="id2593328" id=
        !          9497:                   "id2593328"></a>12.5.5.&nbsp;Installing score
1.1       grant    9498:                   files</h3>
                   9499:                 </div>
                   9500:               </div>
                   9501:             </div>
                   9502: 
                   9503:             <p>Certain packages, most of them in the games
                   9504:             category, install a score file that allows all users on
                   9505:             the system to record their highscores. In order for
                   9506:             this to work, the binaries need to be installed setgid
                   9507:             and the score files owned by the appropriate group
                   9508:             and/or owner (traditionally the "games" user/group).
                   9509:             The following variables, documented in more detail in
1.14      xtraeme  9510:             <code class="filename">mk/defaults/mk.conf</code>,
                   9511:             control this behaviour: <code class=
                   9512:             "varname">SETGIDGAME</code>, <code class=
                   9513:             "varname">GAMEDATAMODE</code>, <code class=
                   9514:             "varname">GAMEGRP</code>, <code class=
                   9515:             "varname">GAMEMODE</code>, <code class=
                   9516:             "varname">GAMEOWN</code>.</p>
1.1       grant    9517: 
                   9518:             <p>Note that per default, setgid installation of games
1.14      xtraeme  9519:             is disabled; setting <code class=
                   9520:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    9521:             variables accordingly.</p>
                   9522: 
                   9523:             <p>A package should therefor never hard code file
1.14      xtraeme  9524:             ownership or access permissions but rely on
                   9525:             <code class="varname">INSTALL_GAME</code> and
                   9526:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   9527:             these correctly.</p>
1.1       grant    9528:           </div>
                   9529: 
                   9530:           <div class="sect2" lang="en" xml:lang="en">
                   9531:             <div class="titlepage">
                   9532:               <div>
                   9533:                 <div>
1.15    ! xtraeme  9534:                   <h3 class="title"><a name="id2593371" id=
        !          9535:                   "id2593371"></a>12.5.6.&nbsp;Packages providing
1.1       grant    9536:                   login shells</h3>
                   9537:                 </div>
                   9538:               </div>
                   9539:             </div>
                   9540: 
                   9541:             <p>If the purpose of the package is to provide a login
1.14      xtraeme  9542:             shell, the variable <code class=
                   9543:             "varname">PKG_SHELL</code> should contain the full
                   9544:             pathname of the shell executable installed by this
                   9545:             package. The package <code class=
                   9546:             "filename">Makefile</code> must also set <code class=
                   9547:             "varname">USE_PKGINSTALL=YES</code> to use the
                   9548:             automatically generated <code class=
                   9549:             "filename">INSTALL</code>/<code class=
                   9550:             "filename">DEINSTALL</code> scripts.</p>
1.1       grant    9551: 
                   9552:             <p>An example taken from shells/zsh:</p>
                   9553:             <pre class="programlisting">
                   9554:   USE_PKGINSTALL=   YES
                   9555:     PKG_SHELL=    ${PREFIX}/bin/zsh
                   9556: </pre>
                   9557: 
1.14      xtraeme  9558:             <p>The shell is registered into <code class=
                   9559:             "filename">/etc/shells</code> file automatically in the
                   9560:             post-install target by the generated <code class=
                   9561:             "filename">INSTALL</code> script and removed in the
                   9562:             deinstall target by the <code class=
                   9563:             "filename">DEINSTALL</code> script.</p>
1.1       grant    9564:           </div>
                   9565: 
                   9566:           <div class="sect2" lang="en" xml:lang="en">
                   9567:             <div class="titlepage">
                   9568:               <div>
                   9569:                 <div>
1.15    ! xtraeme  9570:                   <h3 class="title"><a name="id2593429" id=
        !          9571:                   "id2593429"></a>12.5.7.&nbsp;Packages containing
1.1       grant    9572:                   perl scripts</h3>
                   9573:                 </div>
                   9574:               </div>
                   9575:             </div>
                   9576: 
                   9577:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  9578:             set <code class="varname">REPLACE_PERL</code> to ensure
                   9579:             that the proper interpreter path is set. <code class=
                   9580:             "varname">REPLACE_PERL</code> should contain a list of
                   9581:             scripts, relative to <code class=
                   9582:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    9583:           </div>
                   9584: 
                   9585:           <div class="sect2" lang="en" xml:lang="en">
                   9586:             <div class="titlepage">
                   9587:               <div>
                   9588:                 <div>
1.15    ! xtraeme  9589:                   <h3 class="title"><a name="id2593447" id=
        !          9590:                   "id2593447"></a>12.5.8.&nbsp;Packages with
1.1       grant    9591:                   hardcoded paths to other interpreters</h3>
                   9592:                 </div>
                   9593:               </div>
                   9594:             </div>
                   9595: 
                   9596:             <p>Your package may also contain scripts with hardcoded
                   9597:             paths to other interpreters besides (or as well as)
                   9598:             perl. To correct the full pathname to the script
                   9599:             interpreter, you need to set the following definitions
1.14      xtraeme  9600:             in your <code class="filename">Makefile</code> (we
                   9601:             shall use <span><strong class=
                   9602:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    9603:             <pre class="programlisting">
                   9604:   REPLACE_INTERPRETER+=     tcl
                   9605:     _REPLACE.tcl.old=     .*/bin/tclsh
                   9606:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   9607:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   9608:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   9609: </pre>
                   9610:           </div>
                   9611: 
                   9612:           <div class="sect2" lang="en" xml:lang="en">
                   9613:             <div class="titlepage">
                   9614:               <div>
                   9615:                 <div>
1.15    ! xtraeme  9616:                   <h3 class="title"><a name="id2593468" id=
        !          9617:                   "id2593468"></a>12.5.9.&nbsp;Packages installing
1.1       grant    9618:                   perl modules</h3>
                   9619:                 </div>
                   9620:               </div>
                   9621:             </div>
                   9622: 
                   9623:             <p>Makefiles of packages providing perl5 modules should
1.14      xtraeme  9624:             include the Makefile fragment <code class=
                   9625:             "filename">../../lang/perl5/module.mk</code>. It
                   9626:             provides a <span><strong class=
                   9627:             "command">do-configure</strong></span> target for the
                   9628:             standard perl configuration for such modules as well as
                   9629:             various hooks to tune this configuration. See comments
                   9630:             in this file for details.</p>
1.1       grant    9631: 
                   9632:             <p>Perl5 modules will install into different places
                   9633:             depending on the version of perl used during the build
                   9634:             process. To address this, pkgsrc will append lines to
1.14      xtraeme  9635:             the <code class="filename">PLIST</code> corresponding
                   9636:             to the files listed in the installed <code class=
                   9637:             "filename">.packlist</code> file generated by most
                   9638:             perl5 modules. This is invoked by defining <code class=
                   9639:             "varname">PERL5_PACKLIST</code> to a space-separated
                   9640:             list of paths to packlist files, e.g.:</p>
1.1       grant    9641:             <pre class="programlisting">
                   9642: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   9643: </pre>
                   9644: 
1.14      xtraeme  9645:             <p>The variables <code class=
                   9646:             "varname">PERL5_SITELIB</code>, <code class=
                   9647:             "varname">PERL5_SITEARCH</code>, and <code class=
                   9648:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    9649:             locations in which perl5 modules may be installed, and
                   9650:             may be used by perl5 packages that don't have a
                   9651:             packlist. These three variables are also substituted
1.14      xtraeme  9652:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    9653:           </div>
                   9654: 
                   9655:           <div class="sect2" lang="en" xml:lang="en">
                   9656:             <div class="titlepage">
                   9657:               <div>
                   9658:                 <div>
                   9659:                   <h3 class="title"><a name="faq.info-files" id=
                   9660:                   "faq.info-files"></a>12.5.10.&nbsp;Packages
                   9661:                   installing info files</h3>
                   9662:                 </div>
                   9663:               </div>
                   9664:             </div>
                   9665: 
                   9666:             <p>Some packages install info files or use the
                   9667:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   9668:             &#8220;<span class="quote">install-info</span>&#8221;
                   9669:             commands. Each of the info files:</p>
                   9670: 
                   9671:             <div class="itemizedlist">
                   9672:               <ul type="disc">
                   9673:                 <li>
                   9674:                   <p>is considered to be installed in the directory
1.14      xtraeme  9675:                   <code class=
                   9676:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    9677:                 </li>
                   9678: 
                   9679:                 <li>
                   9680:                   <p>is registered in the Info directory file
1.14      xtraeme  9681:                   <code class=
                   9682:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    9683:                 </li>
                   9684: 
                   9685:                 <li>
                   9686:                   <p>and must be listed as a filename in the
1.14      xtraeme  9687:                   <code class="varname">INFO_FILES</code> variable
                   9688:                   in the package Makefile.</p>
1.1       grant    9689:                 </li>
                   9690:               </ul>
                   9691:             </div>
                   9692: 
1.14      xtraeme  9693:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    9694:             &#8220;<span class="quote">info</span>&#8221; and can
1.14      xtraeme  9695:             be overridden in the package Makefile. <code class=
                   9696:             "filename">INSTALL</code> and <code class=
                   9697:             "filename">DEINSTALL</code> scripts will be generated
                   9698:             to handle registration of the info files in the Info
1.1       grant    9699:             directory file. The &#8220;<span class=
                   9700:             "quote">install-info</span>&#8221; command used for the
                   9701:             info files registration is either provided by the
                   9702:             system, or by a special purpose package automatically
                   9703:             added as dependency if needed.</p>
                   9704: 
                   9705:             <p>A package which needs the &#8220;<span class=
                   9706:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  9707:             must define the variable <code class=
                   9708:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    9709:             minimum version of the &#8220;<span class=
                   9710:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  9711:             should be noted with the <code class=
                   9712:             "varname">TEXINFO_REQD</code> variable in the package
                   9713:             <code class="filename">Makefile</code>. By default, a
1.1       grant    9714:             minimum version of 3.12 is required. If the system does
1.14      xtraeme  9715:             not provide a <span><strong class=
                   9716:             "command">makeinfo</strong></span> command or if it
                   9717:             does not match the required minimum, a build dependency
                   9718:             on the <a xmlns=
                   9719:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9720:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.14      xtraeme  9721:             class="pkgname">devel/gtexinfo</a> package will be
                   9722:             added automatically.</p>
1.1       grant    9723: 
                   9724:             <p>The build and installation process of the software
                   9725:             provided by the package should not use the
1.14      xtraeme  9726:             <span><strong class=
                   9727:             "command">install-info</strong></span> command as the
                   9728:             registration of info files is the task of the package
                   9729:             <code class="filename">INSTALL</code> script, and it
                   9730:             must use the appropriate <span><strong class=
                   9731:             "command">makeinfo</strong></span> command.</p>
1.1       grant    9732: 
                   9733:             <p>To achieve this goal the pkgsrc infrastructure
1.14      xtraeme  9734:             creates overriding scripts for the <span><strong class=
                   9735:             "command">install-info</strong></span> and
                   9736:             <span><strong class="command">makeinfo</strong></span>
                   9737:             commands in a directory listed early in <code class=
                   9738:             "varname">PATH</code>.</p>
1.1       grant    9739: 
1.14      xtraeme  9740:             <p>The script overriding <span><strong class=
                   9741:             "command">install-info</strong></span> has no effect
                   9742:             except the logging of a message. The script overriding
                   9743:             <span><strong class="command">makeinfo</strong></span>
                   9744:             logs a message and according to the value of
                   9745:             <code class="varname">USE_MAKEINFO</code> and
                   9746:             <code class="varname">TEXINFO_REQD</code> either run
                   9747:             the appropriate <span><strong class=
                   9748:             "command">makeinfo</strong></span> command or exit on
                   9749:             error.</p>
1.1       grant    9750:           </div>
                   9751: 
                   9752:           <div class="sect2" lang="en" xml:lang="en">
                   9753:             <div class="titlepage">
                   9754:               <div>
                   9755:                 <div>
1.15    ! xtraeme  9756:                   <h3 class="title"><a name="id2593688" id=
        !          9757:                   "id2593688"></a>12.5.11.&nbsp;Packages installing
1.1       grant    9758:                   GConf2 data files</h3>
                   9759:                 </div>
                   9760:               </div>
                   9761:             </div>
                   9762: 
1.14      xtraeme  9763:             <p>If a package installs <code class=
                   9764:             "filename">.schemas</code> or <code class=
                   9765:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    9766:             need to take some extra steps to make sure they get
                   9767:             registered in the database:</p>
                   9768: 
                   9769:             <div class="orderedlist">
                   9770:               <ol type="1">
                   9771:                 <li>
1.14      xtraeme  9772:                   <p>Include <code class=
                   9773:                   "filename">../../devel/GConf2/schemas.mk</code>
                   9774:                   instead of its <code class=
                   9775:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9776:                   care of rebuilding the GConf2 database at
                   9777:                   installation and deinstallation time, and tells
                   9778:                   the package where to install GConf2 data files
                   9779:                   using some standard configure arguments. It also
                   9780:                   disallows any access to the database directly
                   9781:                   from the package.</p>
                   9782:                 </li>
                   9783: 
                   9784:                 <li>
                   9785:                   <p>Ensure that the package installs its
1.14      xtraeme  9786:                   <code class="filename">.schemas</code> files
                   9787:                   under <code class=
                   9788:                   "filename">${PREFIX}/share/gconf/schemas</code>.
                   9789:                   If they get installed under <code class=
                   9790:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    9791:                   manually patch the package.</p>
                   9792:                 </li>
                   9793: 
                   9794:                 <li>
                   9795:                   <p>Check the PLIST and remove any entries under
                   9796:                   the etc/gconf directory, as they will be handled
                   9797:                   automatically. See <a href="#faq.conf" title=
1.14      xtraeme  9798:                   "6.14.&nbsp;Configuration files handling and placement">
                   9799:                   Section&nbsp;6.14, &#8220;Configuration files
1.1       grant    9800:                   handling and placement&#8221;</a> for more
                   9801:                   information.</p>
                   9802:                 </li>
                   9803: 
                   9804:                 <li>
1.14      xtraeme  9805:                   <p>Define the <code class=
                   9806:                   "varname">GCONF2_SCHEMAS</code> variable in your
                   9807:                   <code class="filename">Makefile</code> with a
                   9808:                   list of all <code class=
                   9809:                   "filename">.schemas</code> files installed by the
                   9810:                   package, if any. Names must not contain any
                   9811:                   directories in them.</p>
1.1       grant    9812:                 </li>
                   9813: 
                   9814:                 <li>
1.14      xtraeme  9815:                   <p>Define the <code class=
                   9816:                   "varname">GCONF2_ENTRIES</code> variable in your
                   9817:                   <code class="filename">Makefile</code> with a
                   9818:                   list of all <code class=
                   9819:                   "filename">.entries</code> files installed by the
                   9820:                   package, if any. Names must not contain any
                   9821:                   directories in them.</p>
1.1       grant    9822:                 </li>
                   9823:               </ol>
                   9824:             </div>
                   9825:           </div>
                   9826: 
                   9827:           <div class="sect2" lang="en" xml:lang="en">
                   9828:             <div class="titlepage">
                   9829:               <div>
                   9830:                 <div>
1.15    ! xtraeme  9831:                   <h3 class="title"><a name="id2593788" id=
        !          9832:                   "id2593788"></a>12.5.12.&nbsp;Packages installing
1.1       grant    9833:                   scrollkeeper data files</h3>
                   9834:                 </div>
                   9835:               </div>
                   9836:             </div>
                   9837: 
1.14      xtraeme  9838:             <p>If a package installs <code class=
                   9839:             "filename">.omf</code> files, used by scrollkeeper, you
                   9840:             need to take some extra steps to make sure they get
                   9841:             registered in the database:</p>
1.1       grant    9842: 
                   9843:             <div class="orderedlist">
                   9844:               <ol type="1">
                   9845:                 <li>
1.14      xtraeme  9846:                   <p>Include <code class=
                   9847:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
                   9848:                   instead of its <code class=
                   9849:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9850:                   care of rebuilding the scrollkeeper database at
                   9851:                   installation and deinstallation time, and
                   9852:                   disallows any access to it directly from the
                   9853:                   package.</p>
                   9854:                 </li>
                   9855: 
                   9856:                 <li>
                   9857:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  9858:                   the <code class=
                   9859:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    9860:                   as they will be handled automatically.</p>
                   9861:                 </li>
                   9862: 
                   9863:                 <li>
1.14      xtraeme  9864:                   <p>Remove the <code class=
                   9865:                   "filename">share/omf</code> directory from the
                   9866:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    9867:                 </li>
                   9868:               </ol>
                   9869:             </div>
                   9870:           </div>
                   9871: 
                   9872:           <div class="sect2" lang="en" xml:lang="en">
                   9873:             <div class="titlepage">
                   9874:               <div>
                   9875:                 <div>
1.15    ! xtraeme  9876:                   <h3 class="title"><a name="id2593840" id=
        !          9877:                   "id2593840"></a>12.5.13.&nbsp;Packages installing
1.1       grant    9878:                   X11 fonts</h3>
                   9879:                 </div>
                   9880:               </div>
                   9881:             </div>
                   9882: 
                   9883:             <p>If a package installs font files, you will need to
                   9884:             rebuild the fonts database in the directory where they
                   9885:             get installed at installation and deinstallation time.
1.14      xtraeme  9886:             This can be automatically done by using <code class=
                   9887:             "filename">mk/fonts.mk</code>, which you need to
                   9888:             include in your <code class=
                   9889:             "filename">Makefile</code>.</p>
1.1       grant    9890: 
                   9891:             <p>When the file is included, you can list the
1.14      xtraeme  9892:             directories where fonts are installed in the
                   9893:             <code class="varname">FONTS_<em class=
                   9894:             "replaceable"><code>type</code></em>_DIRS</code>
                   9895:             variables, where <em class=
                   9896:             "replaceable"><code>type</code></em> can be one of
                   9897:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    9898:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   9899:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.14      xtraeme  9900:             sure that the database file <code class=
                   9901:             "filename">fonts.dir</code> is not listed in the
1.1       grant    9902:             PLIST.</p>
                   9903: 
                   9904:             <p>Note that you should not create new directories for
                   9905:             fonts; instead use the standard ones to avoid that the
                   9906:             user needs to manually configure his X server to find
                   9907:             them.</p>
                   9908:           </div>
                   9909: 
                   9910:           <div class="sect2" lang="en" xml:lang="en">
                   9911:             <div class="titlepage">
                   9912:               <div>
                   9913:                 <div>
1.15    ! xtraeme  9914:                   <h3 class="title"><a name="id2593886" id=
        !          9915:                   "id2593886"></a>12.5.14.&nbsp;Packages installing
1.1       grant    9916:                   GTK2 modules</h3>
                   9917:                 </div>
                   9918:               </div>
                   9919:             </div>
                   9920: 
                   9921:             <p>If a package installs gtk2 immodules or loaders, you
                   9922:             need to take some extra steps to get them registered in
                   9923:             the GTK2 database properly:</p>
                   9924: 
                   9925:             <div class="orderedlist">
                   9926:               <ol type="1">
                   9927:                 <li>
1.14      xtraeme  9928:                   <p>Include <code class=
                   9929:                   "filename">../../x11/gtk2/modules.mk</code>
                   9930:                   instead of its <code class=
                   9931:                   "filename">buildlink3.mk</code> file. This takes
                   9932:                   care of rebuilding the database at installation
                   9933:                   and deinstallation time.</p>
1.1       grant    9934:                 </li>
                   9935: 
                   9936:                 <li>
1.14      xtraeme  9937:                   <p>Set <code class=
                   9938:                   "varname">GTK2_IMMODULES=YES</code> if your
                   9939:                   package installs GTK2 immodules.</p>
1.1       grant    9940:                 </li>
                   9941: 
                   9942:                 <li>
1.14      xtraeme  9943:                   <p>Set <code class=
                   9944:                   "varname">GTK2_LOADERS=YES</code> if your package
                   9945:                   installs GTK2 loaders.</p>
1.1       grant    9946:                 </li>
                   9947: 
                   9948:                 <li>
                   9949:                   <p>Patch the package to not touch any of the gtk2
                   9950:                   databases directly. These are:</p>
                   9951: 
                   9952:                   <div class="itemizedlist">
                   9953:                     <ul type="disc">
                   9954:                       <li>
1.14      xtraeme  9955:                         <p><code class=
                   9956:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    9957:                       </li>
                   9958: 
                   9959:                       <li>
1.14      xtraeme  9960:                         <p><code class=
                   9961:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    9962:                       </li>
                   9963:                     </ul>
                   9964:                   </div>
                   9965:                 </li>
                   9966: 
                   9967:                 <li>
                   9968:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  9969:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    9970:                   directory, as they will be handled
                   9971:                   automatically.</p>
                   9972:                 </li>
                   9973:               </ol>
                   9974:             </div>
                   9975:           </div>
                   9976: 
                   9977:           <div class="sect2" lang="en" xml:lang="en">
                   9978:             <div class="titlepage">
                   9979:               <div>
                   9980:                 <div>
1.15    ! xtraeme  9981:                   <h3 class="title"><a name="id2593956" id=
        !          9982:                   "id2593956"></a>12.5.15.&nbsp;Packages installing
1.1       grant    9983:                   SGML or XML data</h3>
                   9984:                 </div>
                   9985:               </div>
                   9986:             </div>
                   9987: 
                   9988:             <p>If a package installs SGML or XML data files that
                   9989:             need to be registered in system-wide catalogs (like
                   9990:             DTDs, sub-catalogs, etc.), you need to take some extra
                   9991:             steps:</p>
                   9992: 
                   9993:             <div class="orderedlist">
                   9994:               <ol type="1">
                   9995:                 <li>
1.14      xtraeme  9996:                   <p>Include <code class=
                   9997:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
                   9998:                   in your <code class="filename">Makefile</code>,
                   9999:                   which takes care of registering those files in
1.1       grant    10000:                   system-wide catalogs at installation and
                   10001:                   deinstallation time.</p>
                   10002:                 </li>
                   10003: 
                   10004:                 <li>
1.14      xtraeme  10005:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   10006:                   to the full path of any SGML catalogs installed
                   10007:                   by the package.</p>
1.1       grant    10008:                 </li>
                   10009: 
                   10010:                 <li>
1.14      xtraeme  10011:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   10012:                   to the full path of any XML catalogs installed by
1.1       grant    10013:                   the package.</p>
                   10014:                 </li>
                   10015: 
                   10016:                 <li>
1.14      xtraeme  10017:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   10018:                   to individual entries to be added to the SGML
1.1       grant    10019:                   catalog. These come in groups of three strings;
                   10020:                   see xmlcatmgr(1) for more information
                   10021:                   (specifically, arguments recognized by the 'add'
                   10022:                   action). Note that you will normally not use this
                   10023:                   variable.</p>
                   10024:                 </li>
                   10025: 
                   10026:                 <li>
1.14      xtraeme  10027:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   10028:                   to individual entries to be added to the XML
1.1       grant    10029:                   catalog. These come in groups of three strings;
                   10030:                   see xmlcatmgr(1) for more information
                   10031:                   (specifically, arguments recognized by the 'add'
                   10032:                   action). Note that you will normally not use this
                   10033:                   variable.</p>
                   10034:                 </li>
                   10035:               </ol>
                   10036:             </div>
                   10037:           </div>
                   10038: 
                   10039:           <div class="sect2" lang="en" xml:lang="en">
                   10040:             <div class="titlepage">
                   10041:               <div>
                   10042:                 <div>
1.15    ! xtraeme  10043:                   <h3 class="title"><a name="id2594076" id=
        !          10044:                   "id2594076"></a>12.5.16.&nbsp;Packages installing
1.1       grant    10045:                   extensions to the MIME database</h3>
                   10046:                 </div>
                   10047:               </div>
                   10048:             </div>
                   10049: 
                   10050:             <p>If a package provides extensions to the MIME
1.14      xtraeme  10051:             database by installing <code class=
                   10052:             "filename">.xml</code> files inside <code class=
                   10053:             "filename">${PREFIX}/share/mime/packages</code>, you
                   10054:             need to take some extra steps to ensure that the
                   10055:             database is kept consistent with respect to these new
                   10056:             files:</p>
1.1       grant    10057: 
                   10058:             <div class="orderedlist">
                   10059:               <ol type="1">
                   10060:                 <li>
1.14      xtraeme  10061:                   <p>Include <code class=
                   10062:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
                   10063:                   (avoid using the <code class=
                   10064:                   "filename">buildlink3.mk</code> file from this
                   10065:                   same directory, which is reserved for inclusion
                   10066:                   from other <code class=
                   10067:                   "filename">buildlink3.mk</code> files). It takes
                   10068:                   care of rebuilding the MIME database at
                   10069:                   installation and deinstallation time, and
                   10070:                   disallows any access to it directly from the
1.1       grant    10071:                   package.</p>
                   10072:                 </li>
                   10073: 
                   10074:                 <li>
                   10075:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10076:                   the <code class="filename">share/mime</code>
1.1       grant    10077:                   directory, <span class=
                   10078:                   "emphasis"><em>except</em></span> for files saved
1.14      xtraeme  10079:                   under <code class=
                   10080:                   "filename">share/mime/packages</code>. The former
1.1       grant    10081:                   are handled automatically by the
                   10082:                   update-mime-database program, but the later are
                   10083:                   package-dependent and must be removed by the
                   10084:                   package that installed them in the first
                   10085:                   place.</p>
                   10086:                 </li>
                   10087: 
                   10088:                 <li>
1.14      xtraeme  10089:                   <p>Remove any <code class=
                   10090:                   "filename">share/mime/*</code> directories from
                   10091:                   the PLIST. They will be handled by the
1.1       grant    10092:                   shared-mime-info package.</p>
                   10093:                 </li>
                   10094:               </ol>
                   10095:             </div>
                   10096:           </div>
                   10097: 
                   10098:           <div class="sect2" lang="en" xml:lang="en">
                   10099:             <div class="titlepage">
                   10100:               <div>
                   10101:                 <div>
1.15    ! xtraeme  10102:                   <h3 class="title"><a name="id2594283" id=
        !          10103:                   "id2594283"></a>12.5.17.&nbsp;Packages using
1.1       grant    10104:                   intltool</h3>
                   10105:                 </div>
                   10106:               </div>
                   10107:             </div>
                   10108: 
                   10109:             <p>If a package uses intltool during its build, include
1.14      xtraeme  10110:             the <code class=
                   10111:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    10112:             file, which forces it to use the intltool package
                   10113:             provided by pkgsrc, instead of the one bundled with the
                   10114:             distribution file.</p>
                   10115: 
                   10116:             <p>This tracks intltool's build-time dependencies and
                   10117:             uses the latest available version; this way, the
                   10118:             package benefits of any bug fixes that may have
                   10119:             appeared since it was released.</p>
                   10120:           </div>
                   10121:         </div>
                   10122: 
                   10123:         <div class="sect1" lang="en" xml:lang="en">
                   10124:           <div class="titlepage">
                   10125:             <div>
                   10126:               <div>
                   10127:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  10128:                 "id2594297" id="id2594297"></a>12.6.&nbsp;Feedback
1.1       grant    10129:                 to the author</h2>
                   10130:               </div>
                   10131:             </div>
                   10132:           </div>
                   10133: 
                   10134:           <p>If you have found any bugs in the package you make
                   10135:           available, if you had to do special steps to make it run
                   10136:           under NetBSD or if you enhanced the software in various
                   10137:           other ways, be sure to report these changes back to the
                   10138:           original author of the program! With that kind of
                   10139:           support, the next release of the program can incorporate
                   10140:           these fixes, and people not using the NetBSD packages
                   10141:           system can win from your efforts.</p>
                   10142: 
                   10143:           <p>Support the idea of free software!</p>
                   10144:         </div>
                   10145:       </div>
                   10146: 
                   10147:       <div class="chapter" lang="en" xml:lang="en">
                   10148:         <div class="titlepage">
                   10149:           <div>
                   10150:             <div>
                   10151:               <h2 class="title"><a name="debug" id=
                   10152:               "debug"></a>Chapter&nbsp;13.&nbsp;Debugging</h2>
                   10153:             </div>
                   10154:           </div>
                   10155:         </div>
                   10156: 
                   10157:         <p>To check out all the gotchas when building a package,
                   10158:         here are the steps that I do in order to get a package
                   10159:         working. Please note this is basically the same as what was
                   10160:         explained in the previous sections, only with some
                   10161:         debugging aids.</p>
                   10162: 
                   10163:         <div class="itemizedlist">
                   10164:           <ul type="disc">
                   10165:             <li>
1.14      xtraeme  10166:               <p>Be sure to set <code class=
                   10167:               "varname">PKG_DEVELOPER=1</code> in <code class=
                   10168:               "filename">/etc/mk.conf</code></p>
1.1       grant    10169:             </li>
                   10170: 
                   10171:             <li>
                   10172:               <p>Install <a xmlns=
                   10173:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10174:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.14      xtraeme  10175:               class="pkgname">pkgtools/url2pkg</a>, create a
                   10176:               directory for a new package, change into it, then run
                   10177:               <span><strong class=
                   10178:               "command">url2pkg</strong></span>:</p>
1.1       grant    10179:               <pre class="screen">
1.14      xtraeme  10180: <code class="prompt">%</code> <strong class=
                   10181: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   10182: "replaceable"><code>category</code></em>/<em class=
                   10183: "replaceable"><code>examplepkg</code></em></code></strong>
                   10184: <code class="prompt">%</code> <strong class=
                   10185: "userinput"><code>cd /usr/pkgsrc/<em class=
                   10186: "replaceable"><code>category</code></em>/<em class=
                   10187: "replaceable"><code>examplepkg</code></em></code></strong>
                   10188: <code class="prompt">%</code> <strong class=
                   10189: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    10190: </pre>
                   10191:             </li>
                   10192: 
                   10193:             <li>
1.14      xtraeme  10194:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    10195:               requested.</p>
                   10196:             </li>
                   10197: 
                   10198:             <li>
1.14      xtraeme  10199:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    10200:               file</p>
                   10201:             </li>
                   10202: 
                   10203:             <li>
1.14      xtraeme  10204:               <p>Run <span><strong class="command">make
                   10205:               configure</strong></span></p>
1.1       grant    10206:             </li>
                   10207: 
                   10208:             <li>
                   10209:               <p>Add any dependencies glimpsed from documentation
1.14      xtraeme  10210:               and the configure step to the package's <code class=
                   10211:               "filename">Makefile</code>.</p>
1.1       grant    10212:             </li>
                   10213: 
                   10214:             <li>
                   10215:               <p>Make the package compile, doing multiple rounds
                   10216:               of</p>
                   10217:               <pre class="screen">
1.14      xtraeme  10218: <code class="prompt">%</code> <strong class=
                   10219: "userinput"><code>make</code></strong>
                   10220: <code class="prompt">%</code> <strong class=
                   10221: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   10222: <code class="prompt">%</code> <strong class=
                   10223: "userinput"><code>mkpatches</code></strong>
                   10224: <code class="prompt">%</code> <strong class=
                   10225: "userinput"><code>patchdiff</code></strong>
                   10226: <code class="prompt">%</code> <strong class=
                   10227: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   10228: <code class="prompt">%</code> <strong class=
                   10229: "userinput"><code>make mps</code></strong>
                   10230: <code class="prompt">%</code> <strong class=
                   10231: "userinput"><code>make clean</code></strong>
1.1       grant    10232: </pre>
                   10233: 
                   10234:               <p>Doing as non-root user will ensure that no files
                   10235:               are modified that shouldn't be, especially during the
1.14      xtraeme  10236:               build phase. <span><strong class=
                   10237:               "command">mkpatches</strong></span>,
                   10238:               <span><strong class=
                   10239:               "command">patchdiff</strong></span> and
                   10240:               <span><strong class="command">pkgvi</strong></span>
                   10241:               are from the <a xmlns=
1.1       grant    10242:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10243:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14      xtraeme  10244:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    10245:             </li>
                   10246: 
                   10247:             <li>
1.14      xtraeme  10248:               <p>Look at the <code class=
                   10249:               "filename">Makefile</code>, fix if necessary; see
                   10250:               <a href="#components.Makefile" title=
                   10251:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
                   10252:               &#8220;<code class=
                   10253:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    10254:             </li>
                   10255: 
                   10256:             <li>
1.14      xtraeme  10257:               <p>Generate a <code class=
                   10258:               "filename">PLIST</code>:</p>
1.1       grant    10259:               <pre class="screen">
1.14      xtraeme  10260: <code class="prompt">#</code> <strong class=
                   10261: "userinput"><code>make install</code></strong>
                   10262: <code class="prompt">#</code> <strong class=
                   10263: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   10264: <code class="prompt">#</code> <strong class=
                   10265: "userinput"><code>make deinstall</code></strong>
                   10266: <code class="prompt">#</code> <strong class=
                   10267: "userinput"><code>make install</code></strong>
                   10268: <code class="prompt">#</code> <strong class=
                   10269: "userinput"><code>make deinstall</code></strong>
1.1       grant    10270: </pre>
                   10271: 
1.14      xtraeme  10272:               <p>You usually need to be <code class=
                   10273:               "username">root</code> to do this. Look if there are
1.1       grant    10274:               any files left:</p>
                   10275:               <pre class="screen">
1.14      xtraeme  10276: <code class="prompt">#</code> <strong class=
                   10277: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10278: </pre>
                   10279: 
                   10280:               <p>If this reveals any files that are missing in
1.14      xtraeme  10281:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    10282:             </li>
                   10283: 
                   10284:             <li>
1.14      xtraeme  10285:               <p>Now that the <code class="filename">PLIST</code>
                   10286:               is OK, install the package again and make a binary
1.1       grant    10287:               package:</p>
                   10288:               <pre class="screen">
1.14      xtraeme  10289: <code class="prompt">#</code> <strong class=
                   10290: "userinput"><code>make reinstall</code></strong>
                   10291: <code class="prompt">#</code> <strong class=
                   10292: "userinput"><code>make package</code></strong>
1.1       grant    10293: </pre>
                   10294:             </li>
                   10295: 
                   10296:             <li>
                   10297:               <p>Delete the installed package:</p>
                   10298:               <pre class="screen">
1.14      xtraeme  10299: <code class="prompt">#</code> <strong class=
                   10300: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    10301: </pre>
                   10302:             </li>
                   10303: 
                   10304:             <li>
1.14      xtraeme  10305:               <p>Repeat the above <span><strong class=
                   10306:               "command">make print-PLIST</strong></span> command,
                   10307:               which shouldn't find anything now:</p>
1.1       grant    10308:               <pre class="screen">
1.14      xtraeme  10309: <code class="prompt">#</code> <strong class=
                   10310: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10311: </pre>
                   10312:             </li>
                   10313: 
                   10314:             <li>
                   10315:               <p>Reinstall the binary package:</p>
                   10316:               <pre class="screen">
1.14      xtraeme  10317: <code class="prompt">#</code> <strong class=
                   10318: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    10319: </pre>
                   10320:             </li>
                   10321: 
                   10322:             <li>
                   10323:               <p>Play with it. Make sure everything works.</p>
                   10324:             </li>
                   10325: 
                   10326:             <li>
1.14      xtraeme  10327:               <p>Run <span><strong class=
                   10328:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    10329:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10330:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14      xtraeme  10331:               class="pkgname">pkgtools/pkglint</a>, and fix the
                   10332:               problems it reports:</p>
1.1       grant    10333:               <pre class="screen">
1.14      xtraeme  10334: <code class="prompt">#</code> <strong class=
                   10335: "userinput"><code>pkglint</code></strong>
1.1       grant    10336: </pre>
                   10337:             </li>
                   10338: 
                   10339:             <li>
                   10340:               <p>Submit (or commit, if you have cvs access); see
                   10341:               <a href="#submit" title=
                   10342:               "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter&nbsp;14,
                   10343:               <i>Submitting and Committing</i></a>.</p>
                   10344:             </li>
                   10345:           </ul>
                   10346:         </div>
                   10347:       </div>
                   10348: 
                   10349:       <div class="chapter" lang="en" xml:lang="en">
                   10350:         <div class="titlepage">
                   10351:           <div>
                   10352:             <div>
                   10353:               <h2 class="title"><a name="submit" id=
                   10354:               "submit"></a>Chapter&nbsp;14.&nbsp;Submitting and
                   10355:               Committing</h2>
                   10356:             </div>
                   10357:           </div>
                   10358:         </div>
                   10359: 
                   10360:         <div class="toc">
                   10361:           <p><b>Table of Contents</b></p>
                   10362: 
                   10363:           <dl>
1.15    ! xtraeme  10364:             <dt><span class="sect1"><a href="#id2594827">14.1.
1.1       grant    10365:             Submitting your packages</a></span></dt>
                   10366: 
1.15    ! xtraeme  10367:             <dt><span class="sect1"><a href="#id2594878">14.2.
1.1       grant    10368:             Committing: Importing a package into
                   10369:             CVS</a></span></dt>
                   10370: 
1.15    ! xtraeme  10371:             <dt><span class="sect1"><a href="#id2594941">14.3.
1.2       hubertf  10372:             Updating a package to a newer version</a></span></dt>
1.1       grant    10373: 
1.15    ! xtraeme  10374:             <dt><span class="sect1"><a href="#id2594961">14.4.
1.2       hubertf  10375:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    10376:           </dl>
                   10377:         </div>
                   10378: 
                   10379:         <div class="sect1" lang="en" xml:lang="en">
                   10380:           <div class="titlepage">
                   10381:             <div>
                   10382:               <div>
                   10383:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  10384:                 "id2594827" id=
        !          10385:                 "id2594827"></a>14.1.&nbsp;Submitting your
1.1       grant    10386:                 packages</h2>
                   10387:               </div>
                   10388:             </div>
                   10389:           </div>
                   10390: 
                   10391:           <p>You have to separate between binary and
                   10392:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   10393:           packages here:</p>
                   10394: 
                   10395:           <div class="itemizedlist">
                   10396:             <ul type="disc">
                   10397:               <li>
                   10398:                 <p>precompiled binary packages</p>
                   10399: 
                   10400:                 <p>Our policy is that we accept binaries only from
                   10401:                 pkgsrc developers to guarantee that the packages
                   10402:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  10403:                 annoy anyone but rather to protect our users!
1.1       grant    10404:                 You're still free to put up your home-made binary
1.13      hubertf  10405:                 packages and tell the world where to get them.
                   10406:                 NetBSD developers doing bulk builds and wanting to
                   10407:                 upload them please see <a href="#bulk-upload"
                   10408:                 title="5.3.8.&nbsp;Uploading results of a bulk build">
                   10409:                 Section&nbsp;5.3.8, &#8220;Uploading results of a
                   10410:                 bulk build&#8221;</a>.</p>
1.1       grant    10411:               </li>
                   10412: 
                   10413:               <li>
                   10414:                 <p>packages</p>
                   10415: 
                   10416:                 <p>First, check that your package is complete,
                   10417:                 compiles and runs well; see <a href="#debug" title=
                   10418:                 "Chapter&nbsp;13.&nbsp;Debugging">Chapter&nbsp;13,
                   10419:                 <i>Debugging</i></a> and the rest of this document.
                   10420:                 Next, generate an uuencoded gzipped tar(1) archive,
                   10421:                 preferably with all files in a single directory.
1.14      xtraeme  10422:                 Finally, <span><strong class=
                   10423:                 "command">send-pr</strong></span> with category
1.1       grant    10424:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   10425:                 synopsis which includes the package name and
                   10426:                 version number, a short description of your package
                   10427:                 (contents of the COMMENT variable or DESCR file are
                   10428:                 OK) and attach the archive to your PR.</p>
                   10429: 
                   10430:                 <p>If you want to submit several packages, please
                   10431:                 send a separate PR for each one, it's easier for us
                   10432:                 to track things that way.</p>
                   10433: 
                   10434:                 <p>Alternatively, you can also import new packages
                   10435:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   10436:                 work-in-progress</span>&#8221;); see the homepage
                   10437:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   10438:                 target=
                   10439:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   10440:                 details.</p>
                   10441:               </li>
                   10442:             </ul>
                   10443:           </div>
                   10444:         </div>
                   10445: 
                   10446:         <div class="sect1" lang="en" xml:lang="en">
                   10447:           <div class="titlepage">
                   10448:             <div>
                   10449:               <div>
                   10450:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  10451:                 "id2594878" id=
        !          10452:                 "id2594878"></a>14.2.&nbsp;Committing: Importing a
1.1       grant    10453:                 package into CVS</h2>
                   10454:               </div>
                   10455:             </div>
                   10456:           </div>
                   10457: 
                   10458:           <p>This section is only of interest for pkgsrc developers
                   10459:           with write access to the pkgsrc repository. Please
                   10460:           remember that cvs imports files relative to the current
                   10461:           working directory, and that the pathname that you give
1.14      xtraeme  10462:           the <span><strong class="command">cvs
                   10463:           import</strong></span> command is so that it knows where
                   10464:           to place the files in the repository. Newly created
                   10465:           packages should be imported with a vendor tag of
                   10466:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   10467:           release tag of &#8220;<span class=
                   10468:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    10469:           <pre class="programlisting">
                   10470:   % cd .../pkgsrc/category/pkgname
                   10471:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   10472: </pre>
                   10473: 
                   10474:           <p>Remember to move the directory from which you imported
                   10475:           out of the way, or cvs will complain the next time you
                   10476:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   10477:           source tree. Also don't forget to add the new package to
1.14      xtraeme  10478:           the category's <code class=
                   10479:           "filename">Makefile</code>.</p>
1.1       grant    10480: 
                   10481:           <p>The commit message of the initial import should
1.14      xtraeme  10482:           include part of the <code class="filename">DESCR</code>
                   10483:           file, so people reading the mailing lists know what the
                   10484:           package is/does.</p>
1.1       grant    10485: 
                   10486:           <p>Please note all package updates/additions in
1.14      xtraeme  10487:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
                   10488:           very important to keep this file up to date and
                   10489:           conforming to the existing format, because it will be
                   10490:           used by scripts to automatically update pages on <a href=
1.1       grant    10491:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   10492:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   10493:           file and remove the entry for the package you updated, in
                   10494:           case it was mentioned there.</p>
                   10495: 
                   10496:           <p>For new packages, &#8220;<span class="quote">cvs
                   10497:           import</span>&#8221; is preferred to &#8220;<span class=
                   10498:           "quote">cvs add</span>&#8221; because the former gets
                   10499:           everything with a single command, and provides a
                   10500:           consistent tag.</p>
                   10501:         </div>
                   10502: 
                   10503:         <div class="sect1" lang="en" xml:lang="en">
                   10504:           <div class="titlepage">
                   10505:             <div>
                   10506:               <div>
                   10507:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  10508:                 "id2594941" id="id2594941"></a>14.3.&nbsp;Updating
1.2       hubertf  10509:                 a package to a newer version</h2>
1.1       grant    10510:               </div>
                   10511:             </div>
                   10512:           </div>
                   10513: 
                   10514:           <p>Please always put a concise, appropriate and relevant
                   10515:           summary of the changes between old and new versions into
                   10516:           the commit log when updating a package. There are various
                   10517:           reasons for this:</p>
                   10518: 
                   10519:           <div class="itemizedlist">
                   10520:             <ul type="disc">
                   10521:               <li>
                   10522:                 <p>A URL is volatile, and can change over time. It
                   10523:                 may go away completely or its information may be
                   10524:                 overwritten by newer information.</p>
                   10525:               </li>
                   10526: 
                   10527:               <li>
                   10528:                 <p>Having the change information between old and
                   10529:                 new versions in our CVS repository is very useful
                   10530:                 for people who use either cvs or anoncvs.</p>
                   10531:               </li>
                   10532: 
                   10533:               <li>
                   10534:                 <p>Having the change information between old and
                   10535:                 new versions in our CVS repository is very useful
                   10536:                 for people who read the pkgsrc-changes mailing
                   10537:                 list, so that they can make tactical decisions
                   10538:                 about when to upgrade the package.</p>
                   10539:               </li>
                   10540:             </ul>
                   10541:           </div>
                   10542: 
                   10543:           <p>Please also recognise that, just because a new version
                   10544:           of a package has been released, it should not
                   10545:           automatically be upgraded in the CVS repository. We
                   10546:           prefer to be conservative in the packages that are
                   10547:           included in pkgsrc - development or beta packages are not
                   10548:           really the best thing for most places in which pkgsrc is
                   10549:           used. Please use your judgement about what should go into
                   10550:           pkgsrc, and bear in mind that stability is to be
                   10551:           preferred above new and possibly untested features.</p>
                   10552:         </div>
                   10553: 
                   10554:         <div class="sect1" lang="en" xml:lang="en">
                   10555:           <div class="titlepage">
                   10556:             <div>
                   10557:               <div>
                   10558:                 <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  10559:                 "id2594961" id="id2594961"></a>14.4.&nbsp;Moving a
1.2       hubertf  10560:                 package in pkgsrc</h2>
1.1       grant    10561:               </div>
                   10562:             </div>
                   10563:           </div>
                   10564: 
                   10565:           <div class="orderedlist">
                   10566:             <ol type="1">
                   10567:               <li>
                   10568:                 <p>Make a copy of the directory somewhere else.</p>
                   10569:               </li>
                   10570: 
                   10571:               <li>
                   10572:                 <p>Remove all CVS dirs.</p>
                   10573: 
                   10574:                 <p>Alternatively to the first two steps you can
                   10575:                 also do:</p>
                   10576:                 <pre class="screen">
1.14      xtraeme  10577: <code class="prompt">%</code> <strong class=
                   10578: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    10579: </pre>
                   10580: 
                   10581:                 <p>and use that for further work.</p>
                   10582:               </li>
                   10583: 
                   10584:               <li>
1.14      xtraeme  10585:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   10586:                 any <code class="varname">DEPENDS</code> paths that
                   10587:                 just did &#8220;<span class=
1.1       grant    10588:                 "quote">../package</span>&#8221; instead of
                   10589:                 &#8220;<span class=
                   10590:                 "quote">../../category/package</span>&#8221;.</p>
                   10591:               </li>
                   10592: 
                   10593:               <li>
1.14      xtraeme  10594:                 <p><span><strong class="command">cvs
                   10595:                 import</strong></span> the modified package in the
                   10596:                 new place.</p>
1.1       grant    10597:               </li>
                   10598: 
                   10599:               <li>
                   10600:                 <p>Check if any package depends on it:</p>
                   10601:                 <pre class="screen">
1.14      xtraeme  10602: <code class="prompt">%</code> <strong class=
                   10603: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   10604: <code class="prompt">%</code> <strong class=
                   10605: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    10606: </pre>
                   10607:               </li>
                   10608: 
                   10609:               <li>
                   10610:                 <p>Fix paths in packages from step 5 to point to
                   10611:                 new location.</p>
                   10612:               </li>
                   10613: 
                   10614:               <li>
1.14      xtraeme  10615:                 <p><span><strong class="command">cvs rm
                   10616:                 (-f)</strong></span> the package at the old
                   10617:                 location.</p>
1.1       grant    10618:               </li>
                   10619: 
                   10620:               <li>
1.14      xtraeme  10621:                 <p>Remove from <code class=
                   10622:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    10623:               </li>
                   10624: 
                   10625:               <li>
1.14      xtraeme  10626:                 <p>Add to <code class=
                   10627:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    10628:               </li>
                   10629: 
                   10630:               <li>
                   10631:                 <p>Commit the changed and removed files:</p>
                   10632:                 <pre class="screen">
1.14      xtraeme  10633: <code class="prompt">%</code> <strong class=
                   10634: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    10635: </pre>
                   10636: 
                   10637:                 <p>(and any packages from step 5, of course).</p>
                   10638:               </li>
                   10639:             </ol>
                   10640:           </div>
                   10641:         </div>
                   10642:       </div>
                   10643:     </div>
                   10644: 
                   10645:     <div class="appendix" lang="en" xml:lang="en">
                   10646:       <div class="titlepage">
                   10647:         <div>
                   10648:           <div>
                   10649:             <h2 class="title"><a name="examples" id=
                   10650:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   10651:             package: bison</h2>
                   10652:           </div>
                   10653:         </div>
                   10654:       </div>
                   10655: 
                   10656:       <div class="toc">
                   10657:         <p><b>Table of Contents</b></p>
                   10658: 
                   10659:         <dl>
1.15    ! xtraeme  10660:           <dt><span class="sect1"><a href="#id2595255">A.1.
1.1       grant    10661:           files</a></span></dt>
                   10662: 
                   10663:           <dd>
                   10664:             <dl>
1.15    ! xtraeme  10665:               <dt><span class="sect2"><a href="#id2595258">A.1.1.
1.1       grant    10666:               Makefile</a></span></dt>
                   10667: 
1.15    ! xtraeme  10668:               <dt><span class="sect2"><a href="#id2595266">A.1.2.
1.1       grant    10669:               DESCR</a></span></dt>
                   10670: 
1.15    ! xtraeme  10671:               <dt><span class="sect2"><a href="#id2595281">A.1.3.
1.1       grant    10672:               PLIST</a></span></dt>
                   10673: 
1.15    ! xtraeme  10674:               <dt><span class="sect2"><a href="#id2595288">A.1.4.
1.14      xtraeme  10675:               Checking a package with <span><strong class=
                   10676:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    10677:             </dl>
                   10678:           </dd>
                   10679: 
1.15    ! xtraeme  10680:           <dt><span class="sect1"><a href="#id2595329">A.2. Steps
1.1       grant    10681:           for building, installing, packaging</a></span></dt>
                   10682:         </dl>
                   10683:       </div>
                   10684: 
                   10685:       <p>We checked to find a piece of software that wasn't in the
                   10686:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  10687:       would want to have <span><strong class=
                   10688:       "command">bison</strong></span> when Berkeley
                   10689:       <span><strong class="command">yacc</strong></span> is already
                   10690:       present in the tree is beyond us, but it's useful for the
                   10691:       purposes of this exercise.</p>
1.1       grant    10692: 
                   10693:       <div class="sect1" lang="en" xml:lang="en">
                   10694:         <div class="titlepage">
                   10695:           <div>
                   10696:             <div>
                   10697:               <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  10698:               "id2595255" id="id2595255"></a>A.1.&nbsp;files</h2>
1.1       grant    10699:             </div>
                   10700:           </div>
                   10701:         </div>
                   10702: 
                   10703:         <div class="sect2" lang="en" xml:lang="en">
                   10704:           <div class="titlepage">
                   10705:             <div>
                   10706:               <div>
1.15    ! xtraeme  10707:                 <h3 class="title"><a name="id2595258" id=
        !          10708:                 "id2595258"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    10709:               </div>
                   10710:             </div>
                   10711:           </div>
                   10712:           <pre class="programlisting">
1.11      ben      10713: # $NetBSD$
1.1       grant    10714: #
                   10715: 
                   10716: DISTNAME=       bison-1.25
                   10717: CATEGORIES=     devel
                   10718: MASTER_SITES=   ${MASTER_SITE_GNU}
                   10719: 
                   10720: MAINTAINER=     thorpej@NetBSD.org
                   10721: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   10722: COMMENT=        GNU yacc clone
                   10723: 
                   10724: GNU_CONFIGURE=  yes
                   10725: INFO_FILES=     bison.info
                   10726: 
                   10727: .include "../../mk/bsd.pkg.mk"
                   10728: </pre>
                   10729:         </div>
                   10730: 
                   10731:         <div class="sect2" lang="en" xml:lang="en">
                   10732:           <div class="titlepage">
                   10733:             <div>
                   10734:               <div>
1.15    ! xtraeme  10735:                 <h3 class="title"><a name="id2595266" id=
        !          10736:                 "id2595266"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    10737:               </div>
                   10738:             </div>
                   10739:           </div>
                   10740:           <pre class="programlisting">
                   10741: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   10742: improvements.  Why you would want this when Berkeley <a href=
                   10743: "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
                   10744: of the NetBSD source tree is beyond me.
                   10745: </pre>
                   10746:         </div>
                   10747: 
                   10748:         <div class="sect2" lang="en" xml:lang="en">
                   10749:           <div class="titlepage">
                   10750:             <div>
                   10751:               <div>
1.15    ! xtraeme  10752:                 <h3 class="title"><a name="id2595281" id=
        !          10753:                 "id2595281"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    10754:               </div>
                   10755:             </div>
                   10756:           </div>
                   10757:           <pre class="programlisting">
1.11      ben      10758: @comment $NetBSD$
1.1       grant    10759: bin/bison
                   10760: man/man1/bison.1.gz
                   10761: share/bison.simple
                   10762: share/bison.hairy
                   10763: </pre>
                   10764:         </div>
                   10765: 
                   10766:         <div class="sect2" lang="en" xml:lang="en">
                   10767:           <div class="titlepage">
                   10768:             <div>
                   10769:               <div>
1.15    ! xtraeme  10770:                 <h3 class="title"><a name="id2595288" id=
        !          10771:                 "id2595288"></a>A.1.4.&nbsp;Checking a package with
1.14      xtraeme  10772:                 <span><strong class=
                   10773:                 "command">pkglint</strong></span></h3>
1.1       grant    10774:               </div>
                   10775:             </div>
                   10776:           </div>
                   10777: 
                   10778:           <p>The NetBSD package system comes with <a xmlns=
                   10779:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   10780:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14      xtraeme  10781:           class="pkgname">pkgtools/pkglint</a> which helps to check
                   10782:           the contents of these files. After installation it is
                   10783:           quite easy to use, just change to the directory of the
                   10784:           package you wish to examine and execute
                   10785:           <span><strong class=
                   10786:           "command">pkglint</strong></span>:</p>
1.1       grant    10787:           <pre class="screen">
1.14      xtraeme  10788: <code class="prompt">$</code> <strong class=
                   10789: "userinput"><code>pkglint</code></strong>
1.1       grant    10790: OK: checking ./DESCR.
                   10791: OK: checking Makefile.
                   10792: OK: checking distinfo.
                   10793: OK: checking patches/patch-aa.
                   10794: looks fine.
                   10795: </pre>
                   10796: 
                   10797:           <p>Depending on the supplied command line arguments (see
                   10798:           pkglint(1)) more verbose checks will be performed. Use
1.14      xtraeme  10799:           e.g. <span><strong class="command">pkglint
                   10800:           -v</strong></span> for a very verbose check.</p>
1.1       grant    10801:         </div>
                   10802:       </div>
                   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.15    ! xtraeme  10809:               "id2595329" id="id2595329"></a>A.2.&nbsp;Steps for
1.1       grant    10810:               building, installing, packaging</h2>
                   10811:             </div>
                   10812:           </div>
                   10813:         </div>
                   10814: 
                   10815:         <p>Create the directory where the package lives, plus any
                   10816:         auxiliary directories:</p>
                   10817:         <pre class="screen">
1.14      xtraeme  10818: <code class="prompt">#</code> <strong class=
                   10819: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   10820: <code class="prompt">#</code> <strong class=
                   10821: "userinput"><code>mkdir bison</code></strong>
                   10822: <code class="prompt">#</code> <strong class=
                   10823: "userinput"><code>cd bison</code></strong>
                   10824: <code class="prompt">#</code> <strong class=
                   10825: "userinput"><code>mkdir patches</code></strong>
1.1       grant    10826: </pre>
                   10827: 
1.14      xtraeme  10828:         <p>Create <code class="filename">Makefile</code>,
                   10829:         <code class="filename">DESCR</code> and <code class=
                   10830:         "filename">PLIST</code> (see <a href="#components" title=
1.1       grant    10831:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   10832:         Chapter 7, <i>Package components - files, directories and
                   10833:         contents</i></a>) then continue with fetching the
                   10834:         distfile:</p>
                   10835:         <pre class="screen">
1.14      xtraeme  10836: <code class="prompt">#</code> <strong class=
                   10837: "userinput"><code>make fetch</code></strong>
1.1       grant    10838: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   10839: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   10840: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10841: ftp: Error retrieving file: 500 Internal error
                   10842: 
                   10843: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   10844: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10845: ftp: Error retrieving file: 500 Internal error
                   10846: 
                   10847: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   10848: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10849: Successfully retrieved file.
                   10850: </pre>
                   10851: 
1.14      xtraeme  10852:         <p>Generate the checksum of the distfile into <code class=
                   10853:         "filename">distinfo</code>:</p>
1.1       grant    10854:         <pre class="screen">
1.14      xtraeme  10855: <code class="prompt">#</code> <strong class=
                   10856: "userinput"><code>make makesum</code></strong>
1.1       grant    10857: </pre>
                   10858: 
                   10859:         <p>Now compile:</p>
                   10860:         <pre class="screen">
1.14      xtraeme  10861: <code class="prompt">#</code> <strong class=
                   10862: "userinput"><code>make</code></strong>
1.1       grant    10863: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10864: ===&gt;  Extracting for bison-1.25
                   10865: ===&gt;  Patching for bison-1.25
                   10866: ===&gt;   Ignoring empty patch directory
                   10867: ===&gt;  Configuring for bison-1.25
                   10868: creating cache ./config.cache
                   10869: checking for gcc... cc
                   10870: checking whether we are using GNU C... yes
                   10871: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   10872: checking how to run the C preprocessor... cc -E
                   10873: checking for minix/config.h... no
                   10874: checking for POSIXized ISC... no
                   10875: checking whether cross-compiling... no
                   10876: checking for ANSI C header files... yes
                   10877: checking for string.h... yes
                   10878: checking for stdlib.h... yes
                   10879: checking for memory.h... yes
                   10880: checking for working const... yes
                   10881: checking for working alloca.h... no
                   10882: checking for alloca... yes
                   10883: checking for strerror... yes
                   10884: updating cache ./config.cache
                   10885: creating ./config.status
                   10886: creating Makefile
                   10887: ===&gt;  Building for bison-1.25
                   10888: 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
                   10889: 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
                   10890: 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
                   10891: 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
                   10892: 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
                   10893: 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 
                   10894: 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
                   10895: 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
                   10896: 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
                   10897: 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
                   10898: 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
                   10899: 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
                   10900: 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
                   10901: 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
                   10902: 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
                   10903: 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
                   10904: 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
                   10905: 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
                   10906: 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
                   10907: 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
                   10908: 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
                   10909: 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
                   10910: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   10911: rm -f bison.s1
                   10912: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   10913: </pre>
                   10914: 
                   10915:         <p>Everything seems OK, so install the files:</p>
                   10916:         <pre class="screen">
1.14      xtraeme  10917: <code class="prompt">#</code> <strong class=
                   10918: "userinput"><code>make install</code></strong>
1.1       grant    10919: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10920: ===&gt;  Installing for bison-1.25
                   10921: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   10922: rm -f /usr/pkg/bin/bison
                   10923: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   10924: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   10925: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   10926: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   10927: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   10928: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   10929: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   10930: ===&gt;  Registering installation for bison-1.25
                   10931: </pre>
                   10932: 
                   10933:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  10934:         remove it with <span><strong class="command">pkg_delete
                   10935:         bison</strong></span>. Should you decide that you want a
                   10936:         binary package, do this now:</p>
1.1       grant    10937:         <pre class="screen">
1.14      xtraeme  10938: <code class="prompt">#</code> <strong class=
                   10939: "userinput"><code>make package</code></strong>
1.1       grant    10940: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10941: ===&gt;  Building package for bison-1.25
                   10942: Creating package bison-1.25.tgz
                   10943: Registering depends:.
                   10944: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   10945: </pre>
                   10946: 
                   10947:         <p>Now that you don't need the source and object files any
                   10948:         more, clean up:</p>
                   10949:         <pre class="screen">
1.14      xtraeme  10950: <code class="prompt">#</code> <strong class=
                   10951: "userinput"><code>make clean</code></strong>
1.1       grant    10952: ===&gt;  Cleaning for bison-1.25
                   10953: </pre>
                   10954:       </div>
                   10955:     </div>
                   10956: 
                   10957:     <div class="appendix" lang="en" xml:lang="en">
                   10958:       <div class="titlepage">
                   10959:         <div>
                   10960:           <div>
                   10961:             <h2 class="title"><a name="logs" id=
                   10962:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   10963:           </div>
                   10964:         </div>
                   10965:       </div>
                   10966: 
                   10967:       <div class="toc">
                   10968:         <p><b>Table of Contents</b></p>
                   10969: 
                   10970:         <dl>
                   10971:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   10972:           Building figlet</a></span></dt>
                   10973: 
                   10974:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   10975:           Packaging figlet</a></span></dt>
                   10976:         </dl>
                   10977:       </div>
                   10978: 
                   10979:       <div class="sect1" lang="en" xml:lang="en">
                   10980:         <div class="titlepage">
                   10981:           <div>
                   10982:             <div>
                   10983:               <h2 class="title" style="clear: both"><a name=
                   10984:               "logs.building" id=
                   10985:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   10986:             </div>
                   10987:           </div>
                   10988:         </div>
                   10989:         <pre class="screen">
1.14      xtraeme  10990: <code class="prompt">#</code> <strong class=
                   10991: "userinput"><code>make</code></strong>
1.1       grant    10992: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10993: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   10994: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   10995: =&gt; [172219 bytes]
                   10996: Connected to ftp.plig.net.
                   10997: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   10998: 331 Guest login ok, send your complete e-mail address as password.
                   10999: 230-You are user #5 of 500 simultaneous users allowed.
                   11000: 230-
                   11001: 230-  ___ _             _ _                   
                   11002: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   11003: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   11004: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   11005: 230-         |_|   |_|     |___|         |___|
                   11006: 230-
                   11007: 230-** Welcome to ftp.plig.org **
                   11008: 230-
                   11009: 230-Please note that all transfers from this FTP site are logged. If you
                   11010: 230-do not like this, please disconnect now.
                   11011: 230-
                   11012: 230-This arhive is available via
                   11013: 230-
                   11014: 230-HTTP:  http://ftp.plig.org/
                   11015: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   11016: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   11017: 230-
                   11018: 230-Please email comments, bug reports and requests for packages to be
                   11019: 230-mirrored to ftp-admin@plig.org.   
                   11020: 230-
                   11021: 230-
                   11022: 230 Logged in anonymously.
                   11023: Remote system type is UNIX.
                   11024: Using binary mode to transfer files.
                   11025: 200 Type okay.
                   11026: 250 "/pub" is new cwd.
                   11027: 250-"/pub/figlet" is new cwd.
                   11028: 250-
                   11029: 250-Welcome to the figlet archive at ftp.figlet.org
                   11030: 250-    
                   11031: 250-    ftp://ftp.figlet.org/pub/figlet/
                   11032: 250-
                   11033: 250-The official FIGlet web page is:
                   11034: 250-    http://www.figlet.org/
                   11035: 250-
                   11036: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   11037: 250-contribute a font or something else, you can email us.
                   11038: 250 
                   11039: 250 "/pub/figlet/program" is new cwd.
                   11040: 250 "/pub/figlet/program/unix" is new cwd.
                   11041: local: figlet221.tar.gz remote: figlet221.tar.gz
                   11042: 502 Unimplemented command.
                   11043: 227 Entering Passive Mode (195,40,6,41,246,104)
                   11044: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   11045: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   11046: 226 Transfer completed.
                   11047: 172219 bytes received in 00:02 (75.99 KB/s)
                   11048: 221 Goodbye.
                   11049: =&gt; Checksum OK for figlet221.tar.gz.
                   11050: ===&gt; Extracting for figlet-2.2.1nb2
                   11051: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   11052: ===&gt; Patching for figlet-2.2.1nb2
                   11053: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   11054: ===&gt; Overriding tools for figlet-2.2.1nb2
                   11055: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   11056: ===&gt; Configuring for figlet-2.2.1nb2
                   11057: ===&gt; Building for figlet-2.2.1nb2
                   11058: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   11059: chmod a+x figlet
                   11060: gcc -O2 -o chkfont chkfont.c
                   11061: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  11062: <code class="prompt">#</code>
                   11063: <code class="prompt">#</code> <strong class=
                   11064: "userinput"><code>make install</code></strong>
1.1       grant    11065: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11066: ===&gt; Installing for figlet-2.2.1nb2
                   11067: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   11068: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   11069: mkdir -p /usr/pkg/share/figlet
                   11070: cp figlet /usr/pkg/bin
                   11071: cp chkfont /usr/pkg/bin
                   11072: chmod 555 figlist showfigfonts
                   11073: cp figlist /usr/pkg/bin
                   11074: cp showfigfonts /usr/pkg/bin
                   11075: cp fonts/*.flf /usr/pkg/share/figlet
                   11076: cp fonts/*.flc /usr/pkg/share/figlet
                   11077: cp figlet.6 /usr/pkg/man/man6
                   11078: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  11079: <code class="prompt">#</code>
1.1       grant    11080: </pre>
                   11081:       </div>
                   11082: 
                   11083:       <div class="sect1" lang="en" xml:lang="en">
                   11084:         <div class="titlepage">
                   11085:           <div>
                   11086:             <div>
                   11087:               <h2 class="title" style="clear: both"><a name=
                   11088:               "logs.package" id=
                   11089:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   11090:             </div>
                   11091:           </div>
                   11092:         </div>
                   11093:         <pre class="screen">
1.14      xtraeme  11094: <code class="prompt">#</code> <strong class=
                   11095: "userinput"><code>make package</code></strong>
1.1       grant    11096: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11097: ===&gt; Packaging figlet-2.2.1nb2
                   11098: ===&gt; Building binary package for figlet-2.2.1nb2
                   11099: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   11100: Using SrcDir value of /usr/pkg
                   11101: Registering depends:.  
1.14      xtraeme  11102: <code class="prompt">#</code>
1.1       grant    11103: </pre>
                   11104:       </div>
                   11105:     </div>
                   11106: 
                   11107:     <div class="appendix" lang="en" xml:lang="en">
                   11108:       <div class="titlepage">
                   11109:         <div>
                   11110:           <div>
                   11111:             <h2 class="title"><a name="ftp-layout" id=
                   11112:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   11113:             FTP server's package archive</h2>
                   11114:           </div>
                   11115:         </div>
                   11116:       </div>
                   11117: 
                   11118:       <p>Layout for precompiled binary packages on
                   11119:       ftp.NetBSD.org:</p>
                   11120:       <pre class="programlisting">
                   11121: /pub/NetBSD/packages/
                   11122:                 distfiles/
                   11123: 
                   11124:                 # Unpacked pkgsrc trees
                   11125:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   11126:                 pkgsrc-2003Q4 -&gt; N/A
                   11127:                 pkgsrc-2004Q1/pkgsrc
                   11128: 
                   11129:                 # pkgsrc archives
                   11130:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   11131:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   11132:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   11133: 
                   11134:                 # Per pkgsrc-release/OS-release/arch package archives
                   11135:                 pkgsrc-2003Q4/
                   11136:                         NetBSD-1.6.2/
                   11137:                                 i386/
                   11138:                                         All/
                   11139:                                         archivers/
                   11140:                                                 foo -&gt; ../All/foo
                   11141:                                         ...
                   11142:                 pkgsrc-2004Q1/
                   11143:                         NetBSD-1.6.2/
                   11144:                                 i386/
                   11145:                                         All/
                   11146:                                         ...
                   11147:                         NetBSD-2.0/
                   11148:                                 i386/
                   11149:                                         All/
                   11150:                                         ...
                   11151:                         SunOS-5.9/
                   11152:                                 sparc/
                   11153:                                         All/
                   11154:                                         ...
                   11155:                                 x86/
                   11156:                                         All/
                   11157:                                         ...
                   11158: 
                   11159:                 # Per os-release package archive convenience links
                   11160:                 NetBSD-1.6.2 -&gt; 1.6.2
                   11161:                 1.6.2/
                   11162:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   11163:                         m68k/
                   11164:                                 All/
                   11165:                                 archivers/
                   11166:                                         foo -&gt; ../All/foo
                   11167:                                 ...
                   11168:                         amiga -&gt; m68k
                   11169:                         atari -&gt; m68k
                   11170:                         ...
                   11171: 
                   11172:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   11173:                 NetBSD-2.0/
                   11174:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   11175:                 SunOS-5.9/
                   11176:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   11177:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   11178:                         
                   11179: </pre>
                   11180: 
                   11181:       <p>To create:</p>
                   11182: 
                   11183:       <div class="orderedlist">
                   11184:         <ol type="1">
                   11185:           <li>
                   11186:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   11187:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   11188:             5.3, &#8220;Doing a bulk build of all
                   11189:             packages&#8221;</a></p>
                   11190:           </li>
                   11191: 
                   11192:           <li>
                   11193:             <p>Upload /usr/pkgsrc/packages to</p>
                   11194:             <pre class="programlisting">
                   11195:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  11196:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    11197:         `uname -s`-`uname -r`/                  # OS &amp; version
                   11198:         `uname -p`                              # architecture
                   11199:        
                   11200: </pre>
                   11201:           </li>
                   11202: 
                   11203:           <li>
1.14      xtraeme  11204:             <p>If necessary, create a symlink <span><strong class=
                   11205:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   11206:             (amiga -&gt; m68k, ...)</p>
1.1       grant    11207:           </li>
                   11208:         </ol>
                   11209:       </div>
                   11210:     </div>
1.2       hubertf  11211: 
                   11212:     <div class="appendix" lang="en" xml:lang="en">
                   11213:       <div class="titlepage">
                   11214:         <div>
                   11215:           <div>
                   11216:             <h2 class="title"><a name="editing" id=
                   11217:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   11218:             for the pkgsrc guide</h2>
                   11219:           </div>
                   11220:         </div>
                   11221:       </div>
                   11222: 
                   11223:       <div class="toc">
                   11224:         <p><b>Table of Contents</b></p>
                   11225: 
                   11226:         <dl>
1.15    ! xtraeme  11227:           <dt><span class="sect1"><a href="#id2595975">D.1.
1.2       hubertf  11228:           Targets</a></span></dt>
                   11229: 
1.15    ! xtraeme  11230:           <dt><span class="sect1"><a href="#id2596387">D.2.
1.2       hubertf  11231:           Procedure</a></span></dt>
                   11232:         </dl>
                   11233:       </div>
                   11234: 
                   11235:       <p>This section contains information on editing the pkgsrc
                   11236:       guide itself.</p>
                   11237: 
                   11238:       <div class="sect1" lang="en" xml:lang="en">
                   11239:         <div class="titlepage">
                   11240:           <div>
                   11241:             <div>
                   11242:               <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  11243:               "id2595975" id="id2595975"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  11244:             </div>
                   11245:           </div>
                   11246:         </div>
                   11247: 
1.14      xtraeme  11248:         <p>The pkgsrc guide's source code is stored in <code class=
                   11249:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  11250:         are created from it:</p>
                   11251: 
                   11252:         <div class="itemizedlist">
                   11253:           <ul type="disc">
                   11254:             <li>
1.14      xtraeme  11255:               <p><code class=
                   11256:               "filename">pkgsrc/doc/pkgsrc.txt</code>, which
                   11257:               replaces <code class=
                   11258:               "filename">pkgsrc/Packages.txt</code></p>
1.2       hubertf  11259:             </li>
                   11260: 
                   11261:             <li>
1.14      xtraeme  11262:               <p><code class=
                   11263:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  11264:             </li>
                   11265: 
                   11266:             <li>
1.14      xtraeme  11267:               <p><code class=
                   11268:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  11269:               the documentation on the NetBSD website will be built
                   11270:               from pkgsrc and kept up to date on the web server
                   11271:               itself. This means you <span class=
                   11272:               "emphasis"><em>must</em></span> make sure that your
                   11273:               changes haven't broken the build!</p>
                   11274:             </li>
1.6       hubertf  11275: 
                   11276:             <li>
1.14      xtraeme  11277:               <p><code class=
                   11278:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  11279:               PDF version of the pkgsrc guide.</p>
                   11280:             </li>
                   11281: 
                   11282:             <li>
1.14      xtraeme  11283:               <p><code class=
                   11284:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  11285:               PostScript version of the pkgsrc guide.</p>
                   11286:             </li>
1.2       hubertf  11287:           </ul>
                   11288:         </div>
                   11289:       </div>
                   11290: 
                   11291:       <div class="sect1" lang="en" xml:lang="en">
                   11292:         <div class="titlepage">
                   11293:           <div>
                   11294:             <div>
                   11295:               <h2 class="title" style="clear: both"><a name=
1.15    ! xtraeme  11296:               "id2596387" id=
        !          11297:               "id2596387"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  11298:             </div>
                   11299:           </div>
                   11300:         </div>
                   11301: 
                   11302:         <p>The procedure to edit the pkgsrc guide is:</p>
                   11303: 
                   11304:         <div class="itemizedlist">
                   11305:           <ul type="disc">
                   11306:             <li>
1.6       hubertf  11307:               <p>Make sure you have the packages needed to
                   11308:               re-generate the pkgsrc guide (and other XML-based
                   11309:               NetBSD documentation) installed. These are
1.11      ben      11310:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  11311:               for creating the ASCII- and HTML-version, and
                   11312:               &#8220;<span class=
1.11      ben      11313:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  11314:               PostScript- and PDF version. You will need both
                   11315:               packages installed, to make sure documentation is
                   11316:               consistent across all formats. The packages can be
1.14      xtraeme  11317:               found in <code class=
                   11318:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
                   11319:               <code class=
                   11320:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  11321:             </li>
                   11322: 
                   11323:             <li>
1.14      xtraeme  11324:               <p>Edit the XML file(s) in <code class=
                   11325:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  11326:             </li>
                   11327: 
                   11328:             <li>
1.14      xtraeme  11329:               <p>Run <span><strong class="command">make extract
                   11330:               &amp;&amp; make do-lint</strong></span> in
                   11331:               <code class="filename">pkgsrc/doc/guide</code> to
                   11332:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  11333:             </li>
                   11334: 
                   11335:             <li>
1.14      xtraeme  11336:               <p>Run <span><strong class=
                   11337:               "command">make</strong></span> in <code class=
                   11338:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   11339:               and ASCII version.</p>
1.2       hubertf  11340:             </li>
                   11341: 
                   11342:             <li>
1.14      xtraeme  11343:               <p>If all is well, run <span><strong class=
                   11344:               "command">make install-doc</strong></span> to put the
                   11345:               generated files into <code class=
                   11346:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  11347:             </li>
                   11348: 
                   11349:             <li>
1.14      xtraeme  11350:               <p><span><strong class="command">cvs commit
                   11351:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  11352:             </li>
                   11353: 
                   11354:             <li>
1.14      xtraeme  11355:               <p><span><strong class="command">cvs commit -m
                   11356:               re-generate
                   11357:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  11358:             </li>
1.4       hubertf  11359: 
                   11360:             <li>
                   11361:               <p>Until the webserver on www.NetBSD.org is really
                   11362:               updated automatically to pick up changes to the
1.14      xtraeme  11363:               pkgsrc guide automatically, also run
                   11364:               <span><strong class="command">make install-htdoc
                   11365:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   11366:               similar, adjust <code class=
                   11367:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  11368:             </li>
                   11369: 
                   11370:             <li>
1.14      xtraeme  11371:               <p><span><strong class="command">cvs commit
                   11372:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  11373:             </li>
1.2       hubertf  11374:           </ul>
                   11375:         </div>
                   11376:       </div>
                   11377:     </div>
1.1       grant    11378:   </div>
                   11379: </body>
                   11380: </html>

CVSweb <webmaster@jp.NetBSD.org>