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

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>
1.16    ! grant     923: 
        !           924:             <li>
        !           925:               <p><a href="http://h30097.www3.hp.com/" target=
        !           926:               "_top">Tru64</a> (Digital UNIX/OSF1)</p>
        !           927:             </li>
1.1       grant     928:           </ul>
                    929:         </div>
                    930:       </div>
                    931: 
                    932:       <div class="sect1" lang="en" xml:lang="en">
                    933:         <div class="titlepage">
                    934:           <div>
                    935:             <div>
                    936:               <h2 class="title" style="clear: both"><a name=
                    937:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
                    938:             </div>
                    939:           </div>
                    940:         </div>
                    941: 
                    942:         <p>This document is divided into two parts. The first,
                    943:         <a href="#users-guide" title=
1.2       hubertf   944:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
                    945:         user's guide</a>, describes how one can use one of the
                    946:         packages in the Package Collection, either by installing a
                    947:         precompiled binary package, or by building one's own copy
                    948:         using the NetBSD package system. The second part, <a href=
1.1       grant     949:         "#developers-guide" title=
1.2       hubertf   950:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                    951:         pkgsrc developer's guide</a>, explains how to prepare a
                    952:         package so it can be easily built by other NetBSD users
                    953:         without knowing about the package's building details.</p>
1.1       grant     954: 
                    955:         <p>This document is available in various formats:</p>
                    956: 
                    957:         <div class="itemizedlist">
                    958:           <ul type="disc">
                    959:             <li>
                    960:               <p><a href="index.html" target="_top">HTML</a></p>
                    961:             </li>
                    962: 
                    963:             <li>
                    964:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                    965:             </li>
                    966: 
                    967:             <li>
                    968:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                    969:             </li>
                    970: 
                    971:             <li>
                    972:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                    973:             </li>
                    974:           </ul>
                    975:         </div>
                    976:       </div>
                    977: 
                    978:       <div class="sect1" lang="en" xml:lang="en">
                    979:         <div class="titlepage">
                    980:           <div>
                    981:             <div>
                    982:               <h2 class="title" style="clear: both"><a name=
                    983:               "terminology" id=
                    984:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                    985:             </div>
                    986:           </div>
                    987:         </div>
                    988: 
                    989:         <p>There has been a lot of talk about &#8220;<span class=
                    990:         "quote">ports</span>&#8221;, &#8220;<span class=
                    991:         "quote">packages</span>&#8221;, etc. so far. Here is a
                    992:         description of all the terminology used within this
                    993:         document.</p>
                    994: 
                    995:         <div class="variablelist">
                    996:           <dl>
                    997:             <dt><span class="term">Package</span></dt>
                    998: 
                    999:             <dd>
                   1000:               <p>A set of files and building instructions that
                   1001:               describe what's necessary to build a certain piece of
                   1002:               software using pkgsrc. Packages are traditionally
1.14      xtraeme  1003:               stored under <code class=
                   1004:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1005:             </dd>
                   1006: 
                   1007:             <dt><span class="term">The NetBSD package
                   1008:             system</span></dt>
                   1009: 
                   1010:             <dd>
                   1011:               <p>This is the former name of &#8220;<span class=
                   1012:               "quote">pkgsrc</span>&#8221;. It is part of the
                   1013:               NetBSD operating system and can be bootstrap to run
                   1014:               on non-NetBSD operating systems as well. It handles
                   1015:               building (compiling), installing, and removing of
                   1016:               packages.</p>
                   1017:             </dd>
                   1018: 
                   1019:             <dt><span class="term">Distfile</span></dt>
                   1020: 
                   1021:             <dd>
                   1022:               <p>This term describes the file or files that are
                   1023:               provided by the author of the piece of software to
                   1024:               distribute his work. All the changes necessary to
                   1025:               build on NetBSD are reflected in the corresponding
                   1026:               package. Usually the distfile is in the form of a
                   1027:               compressed tar-archive, but other types are possible,
1.14      xtraeme  1028:               too. Distfiles are usually stored below <code class=
                   1029:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1030:             </dd>
                   1031: 
                   1032:             <dt><span class="term">Port</span></dt>
                   1033: 
                   1034:             <dd>
                   1035:               <p>This is the term used by FreeBSD and OpenBSD
                   1036:               people for what we call a package. In NetBSD
                   1037:               terminology, &#8220;<span class=
                   1038:               "quote">port</span>&#8221; refers to a different
                   1039:               architecture.</p>
                   1040:             </dd>
                   1041: 
                   1042:             <dt><span class="term">Precompiled/binary
                   1043:             package</span></dt>
                   1044: 
                   1045:             <dd>
                   1046:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1047:               distfile and stuffed together in a single
                   1048:               <code class="filename">.tgz</code> file so it can be
                   1049:               installed on machines of the same machine
                   1050:               architecture without the need to recompile. Packages
                   1051:               are usually generated in <code class=
                   1052:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1053:               an archive on <a href=
1.1       grant    1054:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1055:               "_top">ftp.NetBSD.org</a>.</p>
                   1056: 
                   1057:               <p>Sometimes, this is referred to by the term
                   1058:               &#8220;<span class="quote">package</span>&#8221; too,
                   1059:               especially in the context of precompiled
                   1060:               packages.</p>
                   1061:             </dd>
                   1062: 
                   1063:             <dt><span class="term">Program</span></dt>
                   1064: 
                   1065:             <dd>
                   1066:               <p>The piece of software to be installed which will
                   1067:               be constructed from all the files in the Distfile by
                   1068:               the actions defined in the corresponding package.</p>
                   1069:             </dd>
                   1070:           </dl>
                   1071:         </div>
                   1072:       </div>
                   1073: 
                   1074:       <div class="sect1" lang="en" xml:lang="en">
                   1075:         <div class="titlepage">
                   1076:           <div>
                   1077:             <div>
                   1078:               <h2 class="title" style="clear: both"><a name=
                   1079:               "typography" id=
                   1080:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1081:             </div>
                   1082:           </div>
                   1083:         </div>
                   1084: 
                   1085:         <p>When giving examples for commands, shell prompts are
                   1086:         used to show if the command should/can be issued as root,
                   1087:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1088:         privileges are sufficient. We use a <code class=
                   1089:         "prompt">#</code> for root's shell prompt, and a
                   1090:         <code class="prompt">$</code> for users' shell prompt,
                   1091:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1092:       </div>
                   1093:     </div>
                   1094: 
                   1095:     <div class="part" lang="en" xml:lang="en">
                   1096:       <div class="titlepage">
                   1097:         <div>
                   1098:           <div>
                   1099:             <h1 class="title"><a name="users-guide" id=
1.2       hubertf  1100:             "users-guide"></a>The pkgsrc user's guide</h1>
1.1       grant    1101:           </div>
                   1102:         </div>
                   1103:       </div>
                   1104: 
                   1105:       <div class="toc">
                   1106:         <p><b>Table of Contents</b></p>
                   1107: 
                   1108:         <dl>
                   1109:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1110:           get pkgsrc</a></span></dt>
                   1111: 
                   1112:           <dd>
                   1113:             <dl>
1.14      xtraeme  1114:               <dt><span class="sect1"><a href="#id2514852">2.1. As
1.1       grant    1115:               tar file</a></span></dt>
                   1116: 
1.14      xtraeme  1117:               <dt><span class="sect1"><a href="#id2514868">2.2. Via
1.1       grant    1118:               SUP</a></span></dt>
                   1119: 
1.14      xtraeme  1120:               <dt><span class="sect1"><a href="#id2514968">2.3. Via
1.1       grant    1121:               CVS</a></span></dt>
                   1122:             </dl>
                   1123:           </dd>
                   1124: 
                   1125:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1126:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1127: 
                   1128:           <dd>
                   1129:             <dl>
1.14      xtraeme  1130:               <dt><span class="sect1"><a href="#id2515078">3.1.
1.1       grant    1131:               Bootstrapping pkgsrc</a></span></dt>
                   1132: 
1.14      xtraeme  1133:               <dt><span class="sect1"><a href="#id2515253">3.2.
1.1       grant    1134:               Platform specific notes</a></span></dt>
                   1135: 
                   1136:               <dd>
                   1137:                 <dl>
                   1138:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1139:                   "#id2515259">3.2.1. Darwin (Mac OS
1.1       grant    1140:                   X)</a></span></dt>
                   1141: 
                   1142:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1143:                   "#id2515558">3.2.2. FreeBSD</a></span></dt>
1.1       grant    1144: 
                   1145:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1146:                   "#id2515660">3.2.3. Interix</a></span></dt>
1.1       grant    1147: 
                   1148:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1149:                   "#id2515751">3.2.4. IRIX</a></span></dt>
1.1       grant    1150: 
                   1151:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1152:                   "#id2516278">3.2.5. OpenBSD</a></span></dt>
1.1       grant    1153: 
                   1154:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1155:                   "#id2516390">3.2.6. Solaris</a></span></dt>
1.1       grant    1156:                 </dl>
                   1157:               </dd>
                   1158:             </dl>
                   1159:           </dd>
                   1160: 
                   1161:           <dt><span class="chapter"><a href="#using">4. Using
                   1162:           pkgsrc</a></span></dt>
                   1163: 
                   1164:           <dd>
                   1165:             <dl>
                   1166:               <dt><span class="sect1"><a href=
                   1167:               "#getting-started">4.1. Working with binary
                   1168:               packages</a></span></dt>
                   1169: 
                   1170:               <dd>
                   1171:                 <dl>
                   1172:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1173:                   "#id2516526">4.1.1. Where to get binary
1.1       grant    1174:                   packages</a></span></dt>
                   1175: 
                   1176:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1177:                   "#id2516567">4.1.2. How to use binary
1.1       grant    1178:                   packages</a></span></dt>
                   1179: 
                   1180:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1181:                   "#id2516633">4.1.3. A word of
1.1       grant    1182:                   warning</a></span></dt>
                   1183:                 </dl>
                   1184:               </dd>
                   1185: 
1.14      xtraeme  1186:               <dt><span class="sect1"><a href="#id2516645">4.2.
1.1       grant    1187:               Building packages from source</a></span></dt>
                   1188: 
                   1189:               <dd>
                   1190:                 <dl>
                   1191:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1192:                   "#id2516723">4.2.1. Requirements</a></span></dt>
1.1       grant    1193: 
                   1194:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1195:                   "#id2516743">4.2.2. Fetching
1.1       grant    1196:                   distfiles</a></span></dt>
                   1197: 
                   1198:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1199:                   "#id2516864">4.2.3. How to build and
1.1       grant    1200:                   install</a></span></dt>
                   1201: 
                   1202:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1203:                   "#id2517180">4.2.4. Selecting the
1.1       grant    1204:                   compiler</a></span></dt>
                   1205:                 </dl>
                   1206:               </dd>
                   1207:             </dl>
                   1208:           </dd>
                   1209: 
                   1210:           <dt><span class="chapter"><a href="#binary">5. Creating
                   1211:           binary packages</a></span></dt>
                   1212: 
                   1213:           <dd>
                   1214:             <dl>
1.14      xtraeme  1215:               <dt><span class="sect1"><a href="#id2517335">5.1.
1.1       grant    1216:               Building a single binary package</a></span></dt>
                   1217: 
1.14      xtraeme  1218:               <dt><span class="sect1"><a href="#id2517822">5.2.
1.1       grant    1219:               Settings for creation of binary
                   1220:               packages</a></span></dt>
                   1221: 
                   1222:               <dt><span class="sect1"><a href="#bulkbuild">5.3.
                   1223:               Doing a bulk build of all packages</a></span></dt>
                   1224: 
                   1225:               <dd>
                   1226:                 <dl>
                   1227:                   <dt><span class="sect2"><a href=
                   1228:                   "#binary.configuration">5.3.1.
                   1229:                   Configuration</a></span></dt>
                   1230: 
                   1231:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1232:                   "#id2517962">5.3.2. Other environmental
1.1       grant    1233:                   considerations</a></span></dt>
                   1234: 
                   1235:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1236:                   "#id2518003">5.3.3. Operation</a></span></dt>
1.1       grant    1237: 
                   1238:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1239:                   "#id2583267">5.3.4. What it does</a></span></dt>
1.1       grant    1240: 
                   1241:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1242:                   "#id2583392">5.3.5. Disk space
1.1       grant    1243:                   requirements</a></span></dt>
                   1244: 
                   1245:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1246:                   "#id2583418">5.3.6. Setting up a sandbox for
1.1       grant    1247:                   chroot'ed builds</a></span></dt>
                   1248: 
                   1249:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1250:                   "#id2583811">5.3.7. Building a partial set of
1.1       grant    1251:                   packages</a></span></dt>
1.13      hubertf  1252: 
                   1253:                   <dt><span class="sect2"><a href=
                   1254:                   "#bulk-upload">5.3.8. Uploading results of a bulk
                   1255:                   build</a></span></dt>
1.1       grant    1256:                 </dl>
                   1257:               </dd>
                   1258: 
1.14      xtraeme  1259:               <dt><span class="sect1"><a href="#id2584227">5.4.
1.1       grant    1260:               Creating a multiple CD-ROM packages
                   1261:               collection</a></span></dt>
                   1262: 
                   1263:               <dd>
                   1264:                 <dl>
                   1265:                   <dt><span class="sect2"><a href=
1.14      xtraeme  1266:                   "#id2584310">5.4.1. Example of
1.1       grant    1267:                   cdpack</a></span></dt>
                   1268:                 </dl>
                   1269:               </dd>
                   1270:             </dl>
                   1271:           </dd>
                   1272: 
                   1273:           <dt><span class="chapter"><a href="#faq">6. Frequently
                   1274:           Asked Questions</a></span></dt>
                   1275: 
                   1276:           <dd>
                   1277:             <dl>
1.14      xtraeme  1278:               <dt><span class="sect1"><a href="#id2584502">6.1. Is
1.1       grant    1279:               there a mailing list for pkg-related
                   1280:               discussion?</a></span></dt>
                   1281: 
1.14      xtraeme  1282:               <dt><span class="sect1"><a href="#id2584600">6.2.
1.1       grant    1283:               Where's the pkgviews documentation?</a></span></dt>
                   1284: 
1.5       hubertf  1285:               <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    1286:               Utilities for package management
                   1287:               (pkgtools)</a></span></dt>
                   1288: 
1.14      xtraeme  1289:               <dt><span class="sect1"><a href="#id2584853">6.4. How
1.1       grant    1290:               to use pkgsrc as non-root</a></span></dt>
                   1291: 
1.14      xtraeme  1292:               <dt><span class="sect1"><a href="#id2584865">6.5. How
1.15      xtraeme  1293:               to resume transfers when fetching
                   1294:               distfiles?</a></span></dt>
1.14      xtraeme  1295: 
1.15      xtraeme  1296:               <dt><span class="sect1"><a href="#id2584907">6.6. How
1.1       grant    1297:               can I install/use XFree86 from
                   1298:               pkgsrc?</a></span></dt>
                   1299: 
1.15      xtraeme  1300:               <dt><span class="sect1"><a href="#id2584935">6.7. How
1.1       grant    1301:               can I install/use X.org from pkgsrc?</a></span></dt>
                   1302: 
1.15      xtraeme  1303:               <dt><span class="sect1"><a href="#id2584963">6.8. How
1.1       grant    1304:               to fetch files from behind a firewall</a></span></dt>
                   1305: 
1.15      xtraeme  1306:               <dt><span class="sect1"><a href="#id2584977">6.9. How
1.14      xtraeme  1307:               do I tell <span><strong class="command">make
                   1308:               fetch</strong></span> to do passive
1.1       grant    1309:               FTP?</a></span></dt>
                   1310: 
1.15      xtraeme  1311:               <dt><span class="sect1"><a href="#id2585028">6.10.
1.14      xtraeme  1312:               How to fetch all distfiles at once</a></span></dt>
1.1       grant    1313: 
1.15      xtraeme  1314:               <dt><span class="sect1"><a href="#id2585168">6.11.
1.14      xtraeme  1315:               What does &#8220;<span class="quote">Don't know how
                   1316:               to make /usr/share/tmac/tmac.andoc</span>&#8221;
                   1317:               mean?</a></span></dt>
1.13      hubertf  1318: 
1.15      xtraeme  1319:               <dt><span class="sect1"><a href="#id2585206">6.12.
1.14      xtraeme  1320:               What does &#8220;<span class="quote">Could not find
                   1321:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1322: 
1.15      xtraeme  1323:               <dt><span class="sect1"><a href="#id2585264">6.13.
1.1       grant    1324:               Using 'sudo' with pkgsrc</a></span></dt>
                   1325: 
1.14      xtraeme  1326:               <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    1327:               Configuration files handling and
                   1328:               placement</a></span></dt>
                   1329: 
                   1330:               <dt><span class="sect1"><a href=
1.14      xtraeme  1331:               "#audit-packages">6.15. Automated security
1.1       grant    1332:               checks</a></span></dt>
                   1333:             </dl>
                   1334:           </dd>
                   1335:         </dl>
                   1336:       </div>
                   1337: 
                   1338:       <div class="chapter" lang="en" xml:lang="en">
                   1339:         <div class="titlepage">
                   1340:           <div>
                   1341:             <div>
                   1342:               <h2 class="title"><a name="getting" id=
                   1343:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1344:               pkgsrc</h2>
                   1345:             </div>
                   1346:           </div>
                   1347:         </div>
                   1348: 
                   1349:         <div class="toc">
                   1350:           <p><b>Table of Contents</b></p>
                   1351: 
                   1352:           <dl>
1.14      xtraeme  1353:             <dt><span class="sect1"><a href="#id2514852">2.1. As
1.1       grant    1354:             tar file</a></span></dt>
                   1355: 
1.14      xtraeme  1356:             <dt><span class="sect1"><a href="#id2514868">2.2. Via
1.1       grant    1357:             SUP</a></span></dt>
                   1358: 
1.14      xtraeme  1359:             <dt><span class="sect1"><a href="#id2514968">2.3. Via
1.1       grant    1360:             CVS</a></span></dt>
                   1361:           </dl>
                   1362:         </div>
                   1363: 
                   1364:         <p>There are three ways to get pkgsrc. Either as a tar
                   1365:         file, via SUP, or via CVS. All three ways are described
                   1366:         here.</p>
                   1367: 
                   1368:         <div class="sect1" lang="en" xml:lang="en">
                   1369:           <div class="titlepage">
                   1370:             <div>
                   1371:               <div>
                   1372:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  1373:                 "id2514852" id="id2514852"></a>2.1.&nbsp;As tar
1.1       grant    1374:                 file</h2>
                   1375:               </div>
                   1376:             </div>
                   1377:           </div>
                   1378: 
                   1379:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1380:           file from <a href=
1.11      ben      1381:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.14      xtraeme  1382:           target="_top">ftp.NetBSD.org</a> and unpack it into
                   1383:           <code class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1384:         </div>
                   1385: 
                   1386:         <div class="sect1" lang="en" xml:lang="en">
                   1387:           <div class="titlepage">
                   1388:             <div>
                   1389:               <div>
                   1390:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  1391:                 "id2514868" id="id2514868"></a>2.2.&nbsp;Via
1.1       grant    1392:                 SUP</h2>
                   1393:               </div>
                   1394:             </div>
                   1395:           </div>
                   1396: 
                   1397:           <p>As an alternative to the tar file, you can get pkgsrc
                   1398:           via the Software Update Protocol, SUP. To do so, make
                   1399:           sure your supfile has a line</p>
                   1400:           <pre class="programlisting">
                   1401: release=pkgsrc
                   1402: </pre>
                   1403: 
1.14      xtraeme  1404:           <p>in it, see the examples in <code class=
                   1405:           "filename">/usr/share/examples/supfiles</code>, and that
                   1406:           the <code class="filename">/usr/pkgsrc</code> directory
                   1407:           exists. Then, simply run <span><strong class=
                   1408:           "command">sup -v <em class=
                   1409:           "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1410:         </div>
                   1411: 
                   1412:         <div class="sect1" lang="en" xml:lang="en">
                   1413:           <div class="titlepage">
                   1414:             <div>
                   1415:               <div>
                   1416:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  1417:                 "id2514968" id="id2514968"></a>2.3.&nbsp;Via
1.1       grant    1418:                 CVS</h2>
                   1419:               </div>
                   1420:             </div>
                   1421:           </div>
                   1422: 
                   1423:           <p>To get pkgsrc via CVS, make sure you have
                   1424:           &#8220;<span class="quote">cvs</span>&#8221; installed.
                   1425:           If not present on your system, it can be found as
                   1426:           precompiled binary on ftp.NetBSD.org. To do an initial
                   1427:           (full) checkout of pkgsrc, do the following steps:</p>
                   1428:           <pre class="screen">
1.14      xtraeme  1429: <code class="prompt">%</code> <strong class=
                   1430: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1431: <code class="prompt">%</code> <strong class=
                   1432: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1433: <code class="prompt">%</code> <strong class=
                   1434: "userinput"><code>cd /usr</code></strong>
                   1435: <code class="prompt">%</code> <strong class=
                   1436: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1437: </pre>
                   1438: 
                   1439:           <p>This will create the <code class=
                   1440:           "filename">pkgsrc</code> directory in your <code class=
                   1441:           "filename">/usr</code>, and all the package source will
                   1442:           be stored under <code class=
                   1443:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1444:           initial checkout, make sure you have <code class=
                   1445:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1446:           <pre class="screen">
1.14      xtraeme  1447: <code class="prompt">%</code> <strong class=
                   1448: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1449: <code class="prompt">%</code> <strong class=
                   1450: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1451: </pre>
                   1452: 
                   1453:           <p>Please also note that it is possible to have multiple
                   1454:           copies of the pkgsrc hierarchy in use at any one time -
                   1455:           all work is done relatively within the pkgsrc tree.</p>
                   1456:         </div>
                   1457:       </div>
                   1458: 
                   1459:       <div class="chapter" lang="en" xml:lang="en">
                   1460:         <div class="titlepage">
                   1461:           <div>
                   1462:             <div>
                   1463:               <h2 class="title"><a name="platforms" id=
                   1464:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1465:               systems other than NetBSD</h2>
                   1466:             </div>
                   1467:           </div>
                   1468:         </div>
                   1469: 
                   1470:         <div class="toc">
                   1471:           <p><b>Table of Contents</b></p>
                   1472: 
                   1473:           <dl>
1.14      xtraeme  1474:             <dt><span class="sect1"><a href="#id2515078">3.1.
1.1       grant    1475:             Bootstrapping pkgsrc</a></span></dt>
                   1476: 
1.14      xtraeme  1477:             <dt><span class="sect1"><a href="#id2515253">3.2.
1.1       grant    1478:             Platform specific notes</a></span></dt>
                   1479: 
                   1480:             <dd>
                   1481:               <dl>
1.14      xtraeme  1482:                 <dt><span class="sect2"><a href="#id2515259">3.2.1.
1.1       grant    1483:                 Darwin (Mac OS X)</a></span></dt>
                   1484: 
1.14      xtraeme  1485:                 <dt><span class="sect2"><a href="#id2515558">3.2.2.
1.1       grant    1486:                 FreeBSD</a></span></dt>
                   1487: 
1.14      xtraeme  1488:                 <dt><span class="sect2"><a href="#id2515660">3.2.3.
1.1       grant    1489:                 Interix</a></span></dt>
                   1490: 
1.14      xtraeme  1491:                 <dt><span class="sect2"><a href="#id2515751">3.2.4.
1.1       grant    1492:                 IRIX</a></span></dt>
                   1493: 
1.14      xtraeme  1494:                 <dt><span class="sect2"><a href="#id2516278">3.2.5.
1.1       grant    1495:                 OpenBSD</a></span></dt>
                   1496: 
1.14      xtraeme  1497:                 <dt><span class="sect2"><a href="#id2516390">3.2.6.
1.1       grant    1498:                 Solaris</a></span></dt>
                   1499:               </dl>
                   1500:             </dd>
                   1501:           </dl>
                   1502:         </div>
                   1503: 
                   1504:         <div class="sect1" lang="en" xml:lang="en">
                   1505:           <div class="titlepage">
                   1506:             <div>
                   1507:               <div>
                   1508:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  1509:                 "id2515078" id=
                   1510:                 "id2515078"></a>3.1.&nbsp;Bootstrapping pkgsrc</h2>
1.1       grant    1511:               </div>
                   1512:             </div>
                   1513:           </div>
                   1514: 
                   1515:           <p>For Operating Systems other than NetBSD, we provide a
                   1516:           bootstrap kit to build the required tools to use pkgsrc
                   1517:           on your platform. Besides support for native NetBSD,
                   1518:           pkgsrc and the bootstrap kit have support for the
                   1519:           following operating systems:</p>
                   1520: 
                   1521:           <div class="itemizedlist">
                   1522:             <ul type="disc">
                   1523:               <li>
                   1524:                 <p>Darwin (Mac OS X)</p>
                   1525:               </li>
                   1526: 
                   1527:               <li>
1.16    ! grant    1528:                 <p>DragonFlyBSD</p>
        !          1529:               </li>
        !          1530: 
        !          1531:               <li>
1.1       grant    1532:                 <p>FreeBSD</p>
                   1533:               </li>
                   1534: 
                   1535:               <li>
                   1536:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1537:               </li>
                   1538: 
                   1539:               <li>
                   1540:                 <p>IRIX</p>
                   1541:               </li>
                   1542: 
                   1543:               <li>
                   1544:                 <p>Linux</p>
                   1545:               </li>
                   1546: 
                   1547:               <li>
                   1548:                 <p>OpenBSD</p>
                   1549:               </li>
                   1550: 
                   1551:               <li>
                   1552:                 <p>Solaris</p>
                   1553:               </li>
1.16    ! grant    1554: 
        !          1555:               <li>
        !          1556:                 <p>Tru64 (Digital UNIX/OSF1)</p>
        !          1557:               </li>
1.1       grant    1558:             </ul>
                   1559:           </div>
                   1560: 
                   1561:           <p>Support for other platforms is under development.</p>
                   1562: 
                   1563:           <p>Installing the bootstrap kit should be as simple
                   1564:           as:</p>
                   1565:           <pre class="screen">
1.14      xtraeme  1566: <code class="prompt">#</code> <strong class=
                   1567: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1568: <code class="prompt">#</code> <strong class=
                   1569: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1570: <code class="prompt">#</code> <strong class=
                   1571: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1572: </pre>
                   1573: 
                   1574:           <p>See <a href="#getting" title=
                   1575:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter 2,
                   1576:           <i>Where to get pkgsrc</i></a> for other ways to get
1.14      xtraeme  1577:           pkgsrc before bootstrapping. The given
                   1578:           <span><strong class="command">bootstrap</strong></span>
                   1579:           command will use the defaults of <code class=
                   1580:           "filename">/usr/pkg</code> for the <span class=
                   1581:           "emphasis"><em>prefix</em></span> where programs will be
                   1582:           installed in, and <code class=
                   1583:           "filename">/var/db/pkg</code> for the package database
1.1       grant    1584:           directory where pkgsrc will do it's internal bookkeeping.
                   1585:           However, these can also be set using command-line
                   1586:           parameters.</p>
                   1587: 
                   1588:           <p>Binary packages for the pkgsrc tools and an initial
                   1589:           set of packages is available for supported platforms. An
                   1590:           up-to-date list of these can be found on <a href=
                   1591:           "http://www.pkgsrc.org/" target=
                   1592:           "_top">www.pkgsrc.org</a>.</p>
                   1593:         </div>
                   1594: 
                   1595:         <div class="sect1" lang="en" xml:lang="en">
                   1596:           <div class="titlepage">
                   1597:             <div>
                   1598:               <div>
                   1599:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  1600:                 "id2515253" id="id2515253"></a>3.2.&nbsp;Platform
1.1       grant    1601:                 specific notes</h2>
                   1602:               </div>
                   1603:             </div>
                   1604:           </div>
                   1605: 
                   1606:           <p>Here are some platform-specific notes you should be
                   1607:           aware of.</p>
                   1608: 
                   1609:           <div class="sect2" lang="en" xml:lang="en">
                   1610:             <div class="titlepage">
                   1611:               <div>
                   1612:                 <div>
1.14      xtraeme  1613:                   <h3 class="title"><a name="id2515259" id=
                   1614:                   "id2515259"></a>3.2.1.&nbsp;Darwin (Mac OS
1.1       grant    1615:                   X)</h3>
                   1616:                 </div>
                   1617:               </div>
                   1618:             </div>
                   1619: 
                   1620:             <p>Darwin 5.x and 6.x are supported. There are two
                   1621:             methods of using pkgsrc on Mac OS X, by using a
                   1622:             <a href="#platform.osx-image" title=
                   1623:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1624:             <a href="#platform.osx-ufs" title=
                   1625:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1626:             partition</a>.</p>
                   1627: 
                   1628:             <p>Before you start, you will need to download and
                   1629:             install the Mac OS X Developer Tools from Apple's
                   1630:             Developer Connection. See <a href=
                   1631:             "http://developer.apple.com/macosx/" target=
                   1632:             "_top">http://developer.apple.com/macosx/</a> for
                   1633:             details. Also, make sure you install X11 for Mac OS X
                   1634:             and the X11 SDK from <a href=
                   1635:             "http://www.apple.com/macosx/x11/download/" target=
                   1636:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1637:             you intend to build packages that use the X11 Window
                   1638:             System.</p>
                   1639: 
                   1640:             <p>If you already have a UFS partition, or have a spare
                   1641:             partition that you can format as UFS, it is recommended
                   1642:             to use that instead of the disk image. It'll be
                   1643:             somewhat faster and will mount automatically at boot
                   1644:             time, where you must manually mount a disk image.</p>
                   1645: 
                   1646:             <div class="note" style=
                   1647:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1648:               <h3 class="title">Note</h3>
                   1649: 
                   1650:               <p>You cannot use a HFS+ file system for pkgsrc,
                   1651:               because pkgsrc currently requires the filesystem to
                   1652:               be case-sensitive, and HFS+ is not.</p>
                   1653:             </div>
                   1654: 
                   1655:             <div class="sect3" lang="en" xml:lang="en">
                   1656:               <div class="titlepage">
                   1657:                 <div>
                   1658:                   <div>
                   1659:                     <h4 class="title"><a name="platform.osx-image"
                   1660:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
                   1661:                     a disk image</h4>
                   1662:                   </div>
                   1663:                 </div>
                   1664:               </div>
                   1665: 
                   1666:               <p>Create the disk image:</p>
                   1667:               <pre class="screen">
1.14      xtraeme  1668: <code class="prompt">#</code> <strong class=
                   1669: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1670: <code class="prompt">#</code> <strong class=
                   1671: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   1672: <code class="prompt">#</code> <strong class=
                   1673: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   1674: <code class="prompt">#</code> <strong class=
                   1675: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    1676: </pre>
                   1677: 
                   1678:               <p>That's it!</p>
                   1679:             </div>
                   1680: 
                   1681:             <div class="sect3" lang="en" xml:lang="en">
                   1682:               <div class="titlepage">
                   1683:                 <div>
                   1684:                   <div>
                   1685:                     <h4 class="title"><a name="platform.osx-ufs"
                   1686:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
                   1687:                     UFS partition</h4>
                   1688:                   </div>
                   1689:                 </div>
                   1690:               </div>
                   1691: 
1.14      xtraeme  1692:               <p>By default, <code class="filename">/usr</code>
                   1693:               will be on your root file system, normally HFS+. It
                   1694:               is possible to use the default <span class=
                   1695:               "emphasis"><em>prefix</em></span> of <code class=
                   1696:               "filename">/usr/pkg</code> by symlinking <code class=
                   1697:               "filename">/usr/pkg</code> to a directory on a UFS
                   1698:               file system. Obviously, another symlink is required
                   1699:               if you want to place the package database directory
                   1700:               outside the <span class=
                   1701:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    1702:               <pre class="screen">
1.14      xtraeme  1703: <code class="prompt">#</code> <strong class=
                   1704: "userinput"><code>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</code></strong>
1.1       grant    1705: </pre>
                   1706: 
                   1707:               <p>If you created your partitions at the time of
                   1708:               installing Mac OS X and formatted the target
                   1709:               partition as UFS, it should automatically mount on
1.14      xtraeme  1710:               <code class="filename">/Volumes/&lt;volume
                   1711:               name&gt;</code> when the machine boots. If you are
1.1       grant    1712:               (re)formatting a partition as UFS, you need to ensure
                   1713:               that the partition map correctly reflects
                   1714:               &#8220;<span class="quote">Apple_UFS</span>&#8221;
                   1715:               and not &#8220;<span class=
                   1716:               "quote">Apple_HFS</span>&#8221;.</p>
                   1717: 
                   1718:               <p>The problem is that none of the disk tools will
                   1719:               let you touch a disk that is booted from. You can
                   1720:               unmount the partition, but even if you newfs it, the
                   1721:               partition type will be incorrect and the automounter
                   1722:               won't mount it. It can be mounted manually, but it
                   1723:               won't appear in Finder.</p>
                   1724: 
                   1725:               <p>You'll need to boot off of the OS X Installation
                   1726:               (User) CD. When the Installation program starts, go
                   1727:               up to the menu and select Disk Utility. Now, you will
                   1728:               be able to select the partition you want to be UFS,
                   1729:               and Format it Apple UFS. Quit the Disk Utility, quit
                   1730:               the installer which will reboot your machine. The new
                   1731:               UFS file system will appear in Finder.</p>
                   1732: 
                   1733:               <p>Be aware that the permissions on the new file
                   1734:               system will be writable by root only.</p>
                   1735: 
                   1736:               <p>This note is as of 10.2 (Jaguar) and applies to
                   1737:               earlier versions. Hopefully Apple will fix Disk
                   1738:               Utility in 10.3 (Panther).</p>
                   1739:             </div>
                   1740:           </div>
                   1741: 
                   1742:           <div class="sect2" lang="en" xml:lang="en">
                   1743:             <div class="titlepage">
                   1744:               <div>
                   1745:                 <div>
1.14      xtraeme  1746:                   <h3 class="title"><a name="id2515558" id=
                   1747:                   "id2515558"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    1748:                 </div>
                   1749:               </div>
                   1750:             </div>
                   1751: 
                   1752:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   1753:             supported, other versions may work.</p>
                   1754: 
                   1755:             <p>Care should be taken so that the tools that this kit
                   1756:             installs do not conflict with the FreeBSD userland
                   1757:             tools. There are several steps:</p>
                   1758: 
                   1759:             <div class="orderedlist">
                   1760:               <ol type="1">
                   1761:                 <li>
                   1762:                   <p>FreeBSD stores its ports pkg database in
1.14      xtraeme  1763:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    1764:                   therefore recommended that you choose a different
1.14      xtraeme  1765:                   location (e.g. <code class=
                   1766:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    1767:                   --pkgdbdir option to the bootstrap script.</p>
                   1768:                 </li>
                   1769: 
                   1770:                 <li>
                   1771:                   <p>If you do not intend to use the FreeBSD ports
                   1772:                   tools, it's probably a good idea to move them out
                   1773:                   of the way to avoid confusion, e.g.</p>
                   1774:                   <pre class="screen">
1.14      xtraeme  1775: <code class="prompt">#</code> <strong class=
                   1776: "userinput"><code>cd /usr/sbin</code></strong>
                   1777: <code class="prompt">#</code> <strong class=
                   1778: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   1779: <code class="prompt">#</code> <strong class=
                   1780: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   1781: <code class="prompt">#</code> <strong class=
                   1782: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   1783: <code class="prompt">#</code> <strong class=
                   1784: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    1785: </pre>
                   1786:                 </li>
                   1787: 
                   1788:                 <li>
1.14      xtraeme  1789:                   <p>An example <code class=
                   1790:                   "filename">/etc/mk.conf</code> file will be
                   1791:                   placed in <code class=
                   1792:                   "filename">/etc/mk.conf.example</code> file when
                   1793:                   you use the bootstrap script.</p>
1.1       grant    1794:                 </li>
                   1795:               </ol>
                   1796:             </div>
                   1797:           </div>
                   1798: 
                   1799:           <div class="sect2" lang="en" xml:lang="en">
                   1800:             <div class="titlepage">
                   1801:               <div>
                   1802:                 <div>
1.14      xtraeme  1803:                   <h3 class="title"><a name="id2515660" id=
                   1804:                   "id2515660"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    1805:                 </div>
                   1806:               </div>
                   1807:             </div>
                   1808: 
                   1809:             <p>Interix is a POSIX compatible subsystem for the
                   1810:             Windows NT kernel, providing a Unix-like environment
                   1811:             with a tighter kernel integration than available with
                   1812:             Cygwin. It is part of the Windows Services for Unix
                   1813:             package, available for free for any licensed copy of
                   1814:             Windows 2000, XP, or 2003. SFU can be downloaded from
                   1815:             <a href="http://www.microsoft.com/windows/sfu/" target=
                   1816:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   1817: 
                   1818:             <p>Services for Unix 3.5, current as of this writing,
                   1819:             has been tested. 3.0 or 3.1 may work, but are not
                   1820:             officially supported. (The main difference in 3.0/3.1
                   1821:             is lack of pthreads.)</p>
                   1822: 
                   1823:             <div class="sect3" lang="en" xml:lang="en">
                   1824:               <div class="titlepage">
                   1825:                 <div>
                   1826:                   <div>
                   1827:                     <h4 class="title"><a name=
                   1828:                     "platform.interix-sfu-install" id=
                   1829:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  1830:                     installing Interix/SFU</h4>
1.1       grant    1831:                   </div>
                   1832:                 </div>
                   1833:               </div>
                   1834: 
                   1835:               <p>At an absolute minimum, the following packages
                   1836:               must be installed from the Windows Services for Unix
                   1837:               3.5 distribution in order to use pkgsrc:</p>
                   1838: 
                   1839:               <div class="itemizedlist">
                   1840:                 <ul type="disc">
                   1841:                   <li>
                   1842:                     <p>Utilities -&gt; Base Utilities</p>
                   1843:                   </li>
                   1844: 
                   1845:                   <li>
                   1846:                     <p>Interix GNU Components -&gt; (all)</p>
                   1847:                   </li>
                   1848: 
                   1849:                   <li>
                   1850:                     <p>Remote Connectivity</p>
                   1851:                   </li>
                   1852: 
                   1853:                   <li>
                   1854:                     <p>Interix SDK</p>
                   1855:                   </li>
                   1856:                 </ul>
                   1857:               </div>
                   1858: 
                   1859:               <p>When using pkgsrc on Interix, DO NOT install the
                   1860:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   1861:               without shared module support, installed to
                   1862:               /usr/local, and will only cause confusion. Instead,
                   1863:               install Perl 5.8 from pkgsrc (or from a binary
                   1864:               package).</p>
                   1865: 
                   1866:               <p>The Remote Connectivity subcomponent "Windows
                   1867:               Remote Shell Service" does not need to be installed,
                   1868:               but Remote Connectivity itself should be installed in
                   1869:               order to have a working inetd.</p>
                   1870: 
                   1871:               <p>Finally, during installation you may be asked
                   1872:               whether to enable setuid behavior for Interix
                   1873:               programs, and whether to make pathnames default to
                   1874:               case-sensitive. Setuid should be enabled, and
                   1875:               case-sensitivity MUST be enabled. (Without
                   1876:               case-sensitivity, a large number of packages
                   1877:               including perl will not build.)</p>
                   1878:             </div>
                   1879: 
                   1880:             <div class="sect3" lang="en" xml:lang="en">
                   1881:               <div class="titlepage">
                   1882:                 <div>
                   1883:                   <div>
                   1884:                     <h4 class="title"><a name=
                   1885:                     "platform.interix-sfu-postinstall" id=
                   1886:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   1887:                     to do if Interix/SFU is already installed</h4>
                   1888:                   </div>
                   1889:                 </div>
                   1890:               </div>
                   1891: 
                   1892:               <p>If SFU is already installed and you wish to alter
                   1893:               these settings to work with pkgsrc, note the
                   1894:               following things.</p>
                   1895: 
                   1896:               <div class="itemizedlist">
                   1897:                 <ul type="disc">
                   1898:                   <li>
                   1899:                     <p>To uninstall UNIX Perl, use Add/Remove
                   1900:                     Programs, select Microsoft Windows Services for
                   1901:                     UNIX, then click Change. In the installer,
                   1902:                     choose Add or Remove, then uncheck
                   1903:                     Utilities-&gt;UNIX Perl.</p>
                   1904:                   </li>
                   1905: 
                   1906:                   <li>
                   1907:                     <p>To enable case-sensitivity for the
                   1908:                     filesystem, run REGEDIT.EXE, and change the
                   1909:                     following registry key:</p>
                   1910: 
                   1911:                     <p>
                   1912:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   1913:                     Manager\kernel</p>
                   1914: 
                   1915:                     <p>Set the DWORD value "obcaseinsensitive" to
                   1916:                     0; then reboot.</p>
                   1917:                   </li>
                   1918: 
                   1919:                   <li>
                   1920:                     <p>To enable setuid binaries (optional), run
                   1921:                     REGEDIT.EXE, and change the following registry
                   1922:                     key:</p>
                   1923: 
                   1924:                     <p>
                   1925:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   1926:                     for UNIX</p>
                   1927: 
                   1928:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   1929:                     to 1; then reboot.</p>
                   1930:                   </li>
                   1931:                 </ul>
                   1932:               </div>
                   1933:             </div>
                   1934: 
                   1935:             <div class="sect3" lang="en" xml:lang="en">
                   1936:               <div class="titlepage">
                   1937:                 <div>
                   1938:                   <div>
                   1939:                     <h4 class="title"><a name=
                   1940:                     "platform.interix-notes" id=
                   1941:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   1942:                     notes for using pkgsrc</h4>
                   1943:                   </div>
                   1944:                 </div>
                   1945:               </div>
                   1946: 
                   1947:               <p>The package imanager (either the pkgsrc "su" user,
                   1948:               or the user running "pkg_add") must be a member of
                   1949:               the local Administrators group. Such a user must also
                   1950:               be used to run the bootstrap. This is slightly
                   1951:               relaxed from the normal pkgsrc requirement of
                   1952:               "root".</p>
                   1953: 
                   1954:               <p>The package manager should use a umask of 002.
                   1955:               "make install" will automatically complain if this is
                   1956:               not the case. This ensures that directories written
                   1957:               in /var/db/pkg are Administrators-group
                   1958:               writeable.</p>
                   1959: 
                   1960:               <p>The popular Interix binary packages from
                   1961:               http://www.interopsystems.com/ use an older version
                   1962:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   1963:               used in conjunction with pkgsrc. If you choose to use
                   1964:               them at the same time as the pkgsrc packages, ensure
                   1965:               that you use the proper pkg_* tools for each type of
                   1966:               binary package.</p>
                   1967:             </div>
                   1968:           </div>
                   1969: 
                   1970:           <div class="sect2" lang="en" xml:lang="en">
                   1971:             <div class="titlepage">
                   1972:               <div>
                   1973:                 <div>
1.14      xtraeme  1974:                   <h3 class="title"><a name="id2515751" id=
                   1975:                   "id2515751"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    1976:                 </div>
                   1977:               </div>
                   1978:             </div>
                   1979: 
                   1980:             <p>You will need a working C compiler, either gcc or
                   1981:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  1982:             the <code class="varname">CC</code> environment
                   1983:             variable according to your preference. If you do not
                   1984:             have a license for the MIPSpro compiler suite, you can
1.1       grant    1985:             download a gcc tardist file from <a href=
                   1986:             "http://freeware.sgi.com/" target=
                   1987:             "_top">http://freeware.sgi.com/</a>.</p>
                   1988: 
                   1989:             <p>Please note that you will need IRIX 6.5.17 or
                   1990:             higher, as this is the earliest version of IRIX
                   1991:             providing support for if_indextoname(3),
                   1992:             if_nametoindex(3), etc.</p>
                   1993: 
                   1994:             <p>At this point in time, pkgsrc only supports one ABI.
                   1995:             That is, you can not switch between the old 32-bit ABI,
                   1996:             the new 32-bit ABI and the 64-bit ABI. If you start out
                   1997:             using "abi=n32", that's what all your packages will be
                   1998:             built with.</p>
                   1999: 
                   2000:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2001:             conflicting <code class="varname">CFLAGS</code> in your
                   2002:             environment or the <code class=
                   2003:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2004:             that you do not try to link n32 object files with lib64
1.14      xtraeme  2005:             or vice versa. Check your <code class=
                   2006:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2007: 
                   2008:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2009:             from a different host, please make sure to set
1.14      xtraeme  2010:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2011:             directory, as it appears that IRIX linker occasionally
                   2012:             runs into issues when trying to link over a network
                   2013:             mounted filesystem.</p>
                   2014: 
                   2015:             <p>The bootstrapping process should set all the right
                   2016:             options for programs such as imake(1), but you may want
                   2017:             to set some options depending on your local setup.
1.14      xtraeme  2018:             Please see <code class=
                   2019:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.1       grant    2020:             course, your compilers man pages for details.</p>
                   2021:           </div>
                   2022: 
                   2023:           <div class="sect2" lang="en" xml:lang="en">
                   2024:             <div class="titlepage">
                   2025:               <div>
                   2026:                 <div>
1.14      xtraeme  2027:                   <h3 class="title"><a name="id2516278" id=
                   2028:                   "id2516278"></a>3.2.5.&nbsp;OpenBSD</h3>
1.1       grant    2029:                 </div>
                   2030:               </div>
                   2031:             </div>
                   2032: 
                   2033:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2034: 
                   2035:             <p>Care should be taken so that the tools that this kit
                   2036:             installs do not conflict with the OpenBSD userland
                   2037:             tools. There are several steps:</p>
                   2038: 
                   2039:             <div class="orderedlist">
                   2040:               <ol type="1">
                   2041:                 <li>
                   2042:                   <p>OpenBSD stores its ports pkg database in
1.14      xtraeme  2043:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    2044:                   therefore recommended that you choose a different
1.14      xtraeme  2045:                   location (e.g. <code class=
                   2046:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2047:                   --pkgdbdir option to the bootstrap script.</p>
                   2048:                 </li>
                   2049: 
                   2050:                 <li>
                   2051:                   <p>If you do not intend to use the OpenBSD ports
                   2052:                   tools, it's probably a good idea to move them out
                   2053:                   of the way to avoid confusion, e.g.</p>
                   2054:                   <pre class="screen">
1.14      xtraeme  2055: <code class="prompt">#</code> <strong class=
                   2056: "userinput"><code>cd /usr/sbin</code></strong>
                   2057: <code class="prompt">#</code> <strong class=
                   2058: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2059: <code class="prompt">#</code> <strong class=
                   2060: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2061: <code class="prompt">#</code> <strong class=
                   2062: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2063: <code class="prompt">#</code> <strong class=
                   2064: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2065: </pre>
                   2066:                 </li>
                   2067: 
                   2068:                 <li>
1.14      xtraeme  2069:                   <p>An example <code class=
                   2070:                   "filename">/etc/mk.conf</code> file will be
                   2071:                   placed in <code class=
                   2072:                   "filename">/etc/mk.conf.example</code> file when
                   2073:                   you use the bootstrap script. OpenBSD's make
                   2074:                   program uses <code class=
                   2075:                   "filename">/etc/mk.conf</code> as well. You can
1.1       grant    2076:                   work around this by enclosing all the pkgsrc
                   2077:                   specific parts of the file with:</p>
                   2078:                   <pre class="programlisting">
                   2079: .ifdef BSD_PKG_MK
1.11      ben      2080: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1       grant    2081: .else
                   2082: # OpenBSD stuff
                   2083: .endif
                   2084: </pre>
                   2085:                 </li>
                   2086:               </ol>
                   2087:             </div>
                   2088:           </div>
                   2089: 
                   2090:           <div class="sect2" lang="en" xml:lang="en">
                   2091:             <div class="titlepage">
                   2092:               <div>
                   2093:                 <div>
1.14      xtraeme  2094:                   <h3 class="title"><a name="id2516390" id=
                   2095:                   "id2516390"></a>3.2.6.&nbsp;Solaris</h3>
1.1       grant    2096:                 </div>
                   2097:               </div>
                   2098:             </div>
                   2099: 
                   2100:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2101:             sparc. You will need a working C compiler. Both gcc
                   2102:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2103: 
                   2104:             <p>The following packages are required on Solaris 8 for
                   2105:             the bootstrap process and to build packages.</p>
                   2106: 
                   2107:             <div class="itemizedlist">
                   2108:               <ul type="disc">
                   2109:                 <li>
                   2110:                   <p>SUNWsprot</p>
                   2111:                 </li>
                   2112: 
                   2113:                 <li>
                   2114:                   <p>SUNWarc</p>
                   2115:                 </li>
                   2116: 
                   2117:                 <li>
                   2118:                   <p>SUNWbtool</p>
                   2119:                 </li>
                   2120: 
                   2121:                 <li>
                   2122:                   <p>SUNWtoo</p>
                   2123:                 </li>
                   2124: 
                   2125:                 <li>
                   2126:                   <p>SUNWlibm</p>
                   2127:                 </li>
                   2128:               </ul>
                   2129:             </div>
                   2130: 
                   2131:             <p>Please note the use of GNU binutils on Solaris is
                   2132:             <span class="emphasis"><em>not</em></span>
                   2133:             supported.</p>
                   2134: 
                   2135:             <div class="sect3" lang="en" xml:lang="en">
                   2136:               <div class="titlepage">
                   2137:                 <div>
                   2138:                   <div>
1.14      xtraeme  2139:                     <h4 class="title"><a name="id2516421" id=
                   2140:                     "id2516421"></a>3.2.6.1.&nbsp;If you are using
1.1       grant    2141:                     gcc</h4>
                   2142:                   </div>
                   2143:                 </div>
                   2144:               </div>
                   2145: 
                   2146:               <p>It makes life much simpler if you only use the
                   2147:               same gcc consistently for building all packages.</p>
                   2148: 
                   2149:               <p>It is recommended that an external gcc be used
                   2150:               only for bootstrapping, then either build gcc from
                   2151:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2152:               href=
                   2153:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.14      xtraeme  2154:               class="pkgname">lang/gcc</a> or install a binary gcc
                   2155:               package, then remove gcc used during
                   2156:               bootstrapping.</p>
1.1       grant    2157: 
                   2158:               <p>Binary packages of gcc can be found through
                   2159:               <a href=
                   2160:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.14      xtraeme  2161:               target=
                   2162:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2163:             </div>
                   2164: 
                   2165:             <div class="sect3" lang="en" xml:lang="en">
                   2166:               <div class="titlepage">
                   2167:                 <div>
                   2168:                   <div>
1.14      xtraeme  2169:                     <h4 class="title"><a name="id2516442" id=
                   2170:                     "id2516442"></a>3.2.6.2.&nbsp;If you are using
1.1       grant    2171:                     Sun WorkShop</h4>
                   2172:                   </div>
                   2173:                 </div>
                   2174:               </div>
                   2175: 
                   2176:               <p>You will need at least the following packages
                   2177:               installed (from WorkShop 5.0)</p>
                   2178: 
                   2179:               <div class="itemizedlist">
                   2180:                 <ul type="disc">
                   2181:                   <li>
                   2182:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2183:                   </li>
                   2184: 
                   2185:                   <li>
                   2186:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2187:                   </li>
                   2188: 
                   2189:                   <li>
                   2190:                     <p>SPROild - Sun WorkShop Incremental
                   2191:                     Linker</p>
                   2192:                   </li>
                   2193: 
                   2194:                   <li>
                   2195:                     <p>SPROlang - Sun WorkShop Compilers common
                   2196:                     components</p>
                   2197:                   </li>
                   2198:                 </ul>
                   2199:               </div>
                   2200: 
1.14      xtraeme  2201:               <p>You should set <code class="varname">CC</code>,
                   2202:               <code class="varname">CXX</code> and optionally,
                   2203:               <code class="varname">CPP</code> in <code class=
                   2204:               "filename">/etc/mk.conf</code>, eg.</p>
1.1       grant    2205:               <pre class="programlisting">
                   2206: CC=        cc
                   2207: CXX=    CC
                   2208: CPP=    /usr/ccs/lib/cpp
                   2209: </pre>
                   2210: 
                   2211:               <p>You may also want to build 64-bit binaries,
                   2212:               eg.</p>
                   2213:               <pre class="programlisting">
                   2214: CFLAGS= -xtarget=ultra -xarch=v9
                   2215: </pre>
                   2216: 
                   2217:               <p>Whichever compiler you use, please ensure the
                   2218:               compiler tools and your $prefix are in your
1.14      xtraeme  2219:               <code class="varname">PATH</code>. This includes
                   2220:               <code class="filename">/usr/ccs/{bin,lib}</code> and
                   2221:               eg. <code class=
                   2222:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2223:             </div>
                   2224:           </div>
                   2225:         </div>
                   2226:       </div>
                   2227: 
                   2228:       <div class="chapter" lang="en" xml:lang="en">
                   2229:         <div class="titlepage">
                   2230:           <div>
                   2231:             <div>
                   2232:               <h2 class="title"><a name="using" id=
                   2233:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2234:             </div>
                   2235:           </div>
                   2236:         </div>
                   2237: 
                   2238:         <div class="toc">
                   2239:           <p><b>Table of Contents</b></p>
                   2240: 
                   2241:           <dl>
                   2242:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2243:             Working with binary packages</a></span></dt>
                   2244: 
                   2245:             <dd>
                   2246:               <dl>
1.14      xtraeme  2247:                 <dt><span class="sect2"><a href="#id2516526">4.1.1.
1.1       grant    2248:                 Where to get binary packages</a></span></dt>
                   2249: 
1.14      xtraeme  2250:                 <dt><span class="sect2"><a href="#id2516567">4.1.2.
1.1       grant    2251:                 How to use binary packages</a></span></dt>
                   2252: 
1.14      xtraeme  2253:                 <dt><span class="sect2"><a href="#id2516633">4.1.3.
1.1       grant    2254:                 A word of warning</a></span></dt>
                   2255:               </dl>
                   2256:             </dd>
                   2257: 
1.14      xtraeme  2258:             <dt><span class="sect1"><a href="#id2516645">4.2.
1.1       grant    2259:             Building packages from source</a></span></dt>
                   2260: 
                   2261:             <dd>
                   2262:               <dl>
1.14      xtraeme  2263:                 <dt><span class="sect2"><a href="#id2516723">4.2.1.
1.1       grant    2264:                 Requirements</a></span></dt>
                   2265: 
1.14      xtraeme  2266:                 <dt><span class="sect2"><a href="#id2516743">4.2.2.
1.1       grant    2267:                 Fetching distfiles</a></span></dt>
                   2268: 
1.14      xtraeme  2269:                 <dt><span class="sect2"><a href="#id2516864">4.2.3.
1.1       grant    2270:                 How to build and install</a></span></dt>
                   2271: 
1.14      xtraeme  2272:                 <dt><span class="sect2"><a href="#id2517180">4.2.4.
1.1       grant    2273:                 Selecting the compiler</a></span></dt>
                   2274:               </dl>
                   2275:             </dd>
                   2276:           </dl>
                   2277:         </div>
                   2278: 
                   2279:         <div class="sect1" lang="en" xml:lang="en">
                   2280:           <div class="titlepage">
                   2281:             <div>
                   2282:               <div>
                   2283:                 <h2 class="title" style="clear: both"><a name=
                   2284:                 "getting-started" id=
                   2285:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2286:                 packages</h2>
                   2287:               </div>
                   2288:             </div>
                   2289:           </div>
                   2290: 
                   2291:           <p>This section describes how to find, retrieve and
                   2292:           install a precompiled binary package that someone else
                   2293:           already prepared for your type of machine.</p>
                   2294: 
                   2295:           <div class="sect2" lang="en" xml:lang="en">
                   2296:             <div class="titlepage">
                   2297:               <div>
                   2298:                 <div>
1.14      xtraeme  2299:                   <h3 class="title"><a name="id2516526" id=
                   2300:                   "id2516526"></a>4.1.1.&nbsp;Where to get binary
1.1       grant    2301:                   packages</h3>
                   2302:                 </div>
                   2303:               </div>
                   2304:             </div>
                   2305: 
                   2306:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.14      xtraeme  2307:             and its mirrors in the directory <code class=
                   2308:             "filename">/pub/NetBSD/packages</code> for anonymous
                   2309:             FTP access. Please pick the right subdirectory there as
                   2310:             indicated by <span><strong class="command">uname
                   2311:             -p</strong></span>. In that directory, there is a
1.1       grant    2312:             subdirectory for each category plus a subdirectory
1.14      xtraeme  2313:             <code class="filename">All</code> which includes the
                   2314:             actual binaries in <code class="filename">.tgz</code>
                   2315:             files. The category subdirectories use symbolic links
                   2316:             to those files (this is the same directory layout as in
                   2317:             <code class=
                   2318:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2319: 
                   2320:             <p>This same directory layout applies for CDROM
                   2321:             distributions, only that the directory may be rooted
1.14      xtraeme  2322:             somewhere else, probably somewhere below <code class=
                   2323:             "filename">/cdrom</code>. Please consult your CDROMs
1.1       grant    2324:             documentation for the exact location.</p>
                   2325:           </div>
                   2326: 
                   2327:           <div class="sect2" lang="en" xml:lang="en">
                   2328:             <div class="titlepage">
                   2329:               <div>
                   2330:                 <div>
1.14      xtraeme  2331:                   <h3 class="title"><a name="id2516567" id=
                   2332:                   "id2516567"></a>4.1.2.&nbsp;How to use binary
1.1       grant    2333:                   packages</h3>
                   2334:                 </div>
                   2335:               </div>
                   2336:             </div>
                   2337: 
                   2338:             <p>If you have the files on a CDROM or downloaded them
                   2339:             to your hard disk, youcan install them with the
1.14      xtraeme  2340:             following command (be sure to<span><strong class=
                   2341:             "command">su</strong></span> to root first):</p>
1.1       grant    2342:             <pre class="screen">
1.14      xtraeme  2343: <code class="prompt">#</code> <strong class=
                   2344: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    2345: </pre>
                   2346: 
                   2347:             <p>If you have FTP access and you don't want to
                   2348:             download the packages via FTP prior to installation,
1.14      xtraeme  2349:             you can do this automatically by giving
                   2350:             <span><strong class="command">pkg_add</strong></span>
                   2351:             an FTP URL:</p>
1.1       grant    2352:             <pre class="screen">
1.14      xtraeme  2353: <code class="prompt">#</code> <strong class=
                   2354: "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    2355: </pre>
                   2356: 
                   2357:             <p>If there is any doubt, the uname utility can be used
                   2358:             to determine the &lt;OSvers&gt;, and &lt;arch&gt; by
1.14      xtraeme  2359:             running <span><strong class="command">uname
                   2360:             -rp</strong></span>.</p>
1.1       grant    2361: 
                   2362:             <p>Also note that any prerequisite packages needed to
                   2363:             run the package in question will be installed, too,
                   2364:             assuming they are present where you install from.</p>
                   2365: 
                   2366:             <p>After you've installed packages, be sure to have
1.14      xtraeme  2367:             <code class="filename">/usr/pkg/bin</code> in your
                   2368:             <code class="varname">PATH</code> so you can actually
                   2369:             start the just installed program.</p>
1.1       grant    2370:           </div>
                   2371: 
                   2372:           <div class="sect2" lang="en" xml:lang="en">
                   2373:             <div class="titlepage">
                   2374:               <div>
                   2375:                 <div>
1.14      xtraeme  2376:                   <h3 class="title"><a name="id2516633" id=
                   2377:                   "id2516633"></a>4.1.3.&nbsp;A word of
1.1       grant    2378:                   warning</h3>
                   2379:                 </div>
                   2380:               </div>
                   2381:             </div>
                   2382: 
                   2383:             <p>Please pay very careful attention to the warnings
                   2384:             expressed in the <a href=
                   2385:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2386:             <span class="citerefentry"><span class=
                   2387:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2388:             page about the inherent dangers of installing binary
                   2389:             packages which you did not create yourself, and the
                   2390:             security holes that can be introduced onto your system
                   2391:             by indiscriminate adding of such files.</p>
                   2392:           </div>
                   2393:         </div>
                   2394: 
                   2395:         <div class="sect1" lang="en" xml:lang="en">
                   2396:           <div class="titlepage">
                   2397:             <div>
                   2398:               <div>
                   2399:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  2400:                 "id2516645" id="id2516645"></a>4.2.&nbsp;Building
1.1       grant    2401:                 packages from source</h2>
                   2402:               </div>
                   2403:             </div>
                   2404:           </div>
                   2405: 
                   2406:           <p>This assumes that the package is already in pkgsrc. If
                   2407:           it is not, see <a href="#developers-guide" title=
1.2       hubertf  2408:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
                   2409:           &#8220;The pkgsrc developer's guide&#8221;</a>.</p>
1.1       grant    2410: 
                   2411:           <div class="sect2" lang="en" xml:lang="en">
                   2412:             <div class="titlepage">
                   2413:               <div>
                   2414:                 <div>
1.14      xtraeme  2415:                   <h3 class="title"><a name="id2516723" id=
                   2416:                   "id2516723"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2417:                 </div>
                   2418:               </div>
                   2419:             </div>
                   2420: 
                   2421:             <p>To build packages from source on a NetBSD system the
                   2422:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2423:             &#8220;<span class="quote">text</span>&#8221;
                   2424:             distribution sets must be installed. If you want to
                   2425:             build X11 related packages the &#8220;<span class=
                   2426:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2427:             "quote">xcomp</span>&#8221; distribution sets are
                   2428:             required, too.</p>
                   2429:           </div>
                   2430: 
                   2431:           <div class="sect2" lang="en" xml:lang="en">
                   2432:             <div class="titlepage">
                   2433:               <div>
                   2434:                 <div>
1.14      xtraeme  2435:                   <h3 class="title"><a name="id2516743" id=
                   2436:                   "id2516743"></a>4.2.2.&nbsp;Fetching
1.1       grant    2437:                   distfiles</h3>
                   2438:                 </div>
                   2439:               </div>
                   2440:             </div>
                   2441: 
                   2442:             <p>The distfile (i.e. the unmodified source) must exist
                   2443:             on your system for the packages system to be able to
                   2444:             build it. If it does not exist, pkgsrc will use
                   2445:             <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   2446:             <span class="citerefentry"><span class=
                   2447:             "refentrytitle">ftp</span>(1)</span></a> to fetch it
                   2448:             automatically.</p>
                   2449: 
                   2450:             <p>You can overwrite some of the major distribution
                   2451:             sites to fit to sites that are close to your own. Have
1.14      xtraeme  2452:             a look at <code class=
                   2453:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
                   2454:             some examples - in particular, look for the
                   2455:             <code class="varname">MASTER_SORT</code>, <code class=
                   2456:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   2457:             "varname">INET_COUNTRY</code> definitions. This may
                   2458:             save some of your bandwidth and time.</p>
1.1       grant    2459: 
                   2460:             <p>You can change these settings either in your shell's
                   2461:             environment, or, if you want to keep the settings, by
1.14      xtraeme  2462:             editing the <code class="filename">/etc/mk.conf</code>
1.1       grant    2463:             file, and adding the definitions there.</p>
                   2464: 
                   2465:             <p>If you don't have a permanent Internet connection
                   2466:             and you want to know which files to download,
1.14      xtraeme  2467:             <span><strong class="command">make
                   2468:             fetch-list</strong></span> will tell you what you'll
                   2469:             need. Put these distfiles into <code class=
                   2470:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    2471:           </div>
                   2472: 
                   2473:           <div class="sect2" lang="en" xml:lang="en">
                   2474:             <div class="titlepage">
                   2475:               <div>
                   2476:                 <div>
1.14      xtraeme  2477:                   <h3 class="title"><a name="id2516864" id=
                   2478:                   "id2516864"></a>4.2.3.&nbsp;How to build and
1.1       grant    2479:                   install</h3>
                   2480:                 </div>
                   2481:               </div>
                   2482:             </div>
                   2483: 
                   2484:             <p>Assuming that the distfile has been fetched (see
                   2485:             previous section), become root and change into the
1.14      xtraeme  2486:             relevant directory and running <span><strong class=
                   2487:             "command">make</strong></span>. For example, type</p>
1.1       grant    2488:             <pre class="screen">
1.14      xtraeme  2489: <code class="prompt">%</code> <strong class=
                   2490: "userinput"><code>cd misc/figlet</code></strong>
                   2491: <code class="prompt">%</code> <strong class=
                   2492: "userinput"><code>make</code></strong>
1.1       grant    2493: </pre>
                   2494: 
                   2495:             <p>at the shell prompt to build the various components
                   2496:             of the package, and</p>
                   2497:             <pre class="screen">
1.14      xtraeme  2498: <code class="prompt">#</code> <strong class=
                   2499: "userinput"><code>make install</code></strong>
1.1       grant    2500: </pre>
                   2501: 
                   2502:             <p>to install the various components into the correct
                   2503:             places on your system. Installing the package on your
                   2504:             system requires you to be root. However, pkgsrc has a
                   2505:             <span class="emphasis"><em>just-in-time-su</em></span>
                   2506:             feature, which allows you to only become root for the
                   2507:             actual installation step</p>
                   2508: 
                   2509:             <p>Taking the figlet utility as an example, we can
                   2510:             install it on our system by building as shown in
                   2511:             <a href="#logs" title=
                   2512:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
                   2513:             logs</i></a>.</p>
                   2514: 
                   2515:             <p>The program is installed under the default root of
1.14      xtraeme  2516:             the packages tree - <code class=
                   2517:             "filename">/usr/pkg</code>. Should this not conform to
                   2518:             your tastes, set the <code class=
                   2519:             "varname">LOCALBASE</code> variable in your
1.1       grant    2520:             environment, and it will use that value as the root of
1.14      xtraeme  2521:             your packages tree. So, to use <code class=
                   2522:             "filename">/usr/local</code>, set <code class=
                   2523:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    2524:             environment. Please note that you should use a
                   2525:             directory which is dedicated to packages and not shared
1.14      xtraeme  2526:             with other programs (ie, do not try and use
                   2527:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   2528:             should not try to add any of your own files or
                   2529:             directories (such as <code class=
                   2530:             "filename">src/</code>, <code class=
                   2531:             "filename">obj/</code>, or <code class=
                   2532:             "filename">pkgsrc/</code>) below the <code class=
                   2533:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    2534:             possible conflicts between programs and other files
                   2535:             installed by the package system and whatever else may
                   2536:             have been installed there.</p>
                   2537: 
1.14      xtraeme  2538:             <p>Some packages look in <code class=
                   2539:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    2540:             configuration options at build time. Have a look at
1.14      xtraeme  2541:             <code class=
                   2542:             "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
                   2543:             overview of what will be set there by default.
                   2544:             Environment variables such as <code class=
                   2545:             "varname">LOCALBASE</code> can be set in <code class=
                   2546:             "filename">/etc/mk.conf</code> to save having to
                   2547:             remember to set them each time you want to use
                   2548:             pkgsrc.</p>
1.1       grant    2549: 
                   2550:             <p>Occasionally, people want to &#8220;<span class=
                   2551:             "quote">look under the covers</span>&#8221; to see what
                   2552:             is going on when a package is building or being
                   2553:             installed. This may be for debugging purposes, or out
                   2554:             of simple curiosity. A number of utility values have
                   2555:             been added to help with this.</p>
                   2556: 
                   2557:             <div class="orderedlist">
                   2558:               <ol type="1">
                   2559:                 <li>
                   2560:                   <p>If you invoke the <a href=
                   2561:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2562:                   <span class="citerefentry"><span class=
                   2563:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  2564:                   with <code class=
                   2565:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   2566:                   amount of information will be displayed. For
                   2567:                   example,</p>
1.1       grant    2568:                   <pre class="screen">
1.14      xtraeme  2569: <strong class=
                   2570: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    2571: </pre>
                   2572: 
                   2573:                   <p>will show all the commands that are invoked,
                   2574:                   up to and including the &#8220;<span class=
                   2575:                   "quote">patch</span>&#8221; stage.</p>
                   2576:                 </li>
                   2577: 
                   2578:                 <li>
                   2579:                   <p>If you want to know the value of a certain
1.14      xtraeme  2580:                   make(1) definition, then the <code class=
                   2581:                   "varname">VARNAME</code> definition should be
                   2582:                   used, in conjunction with the show-var target.
                   2583:                   e.g. to show the expansion of the <a href=
1.1       grant    2584:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2585:                   <span class="citerefentry"><span class=
                   2586:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  2587:                   variable <code class=
                   2588:                   "varname">DISTFILES</code>:</p>
1.1       grant    2589:                   <pre class="screen">
1.14      xtraeme  2590: <code class="prompt">%</code> <strong class=
                   2591: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    2592: /usr/pkg
1.14      xtraeme  2593: <code class="prompt">%</code>
1.1       grant    2594:           
                   2595: </pre>
                   2596:                 </li>
                   2597:               </ol>
                   2598:             </div>
                   2599: 
                   2600:             <p>If you want to install a binary package that you've
                   2601:             either created yourself (see next section), that you
                   2602:             put into pkgsrc/packages manually or that is located on
1.8       wiz      2603:             a remote FTP server, you can use the "bin-install"
1.1       grant    2604:             target. This target will install a binary package - if
                   2605:             available - via <a href=
                   2606:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2607:             <span class="citerefentry"><span class=
                   2608:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  2609:             <span><strong class="command">make
                   2610:             package</strong></span>. The list of remote FTP sites
                   2611:             searched is kept in the variable <code class=
                   2612:             "varname">BINPKG_SITES</code>, which defaults to
                   2613:             ftp.NetBSD.org. Any flags that should be added to
                   2614:             <a href=
1.1       grant    2615:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2616:             <span class="citerefentry"><span class=
                   2617:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  2618:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
                   2619:             See <code class=
                   2620:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   2621:             details.</p>
1.1       grant    2622: 
                   2623:             <p>A final word of warning: If you setup a system that
1.14      xtraeme  2624:             has a non-standard setting for <code class=
                   2625:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    2626:             any packages are installed, as you can not use several
                   2627:             directories for the same purpose. Doing so will result
                   2628:             in pkgsrc not being able to properly detect your
                   2629:             installed packages, and fail miserably. Note also that
                   2630:             precompiled binary packages are usually built with the
1.14      xtraeme  2631:             default <code class="varname">LOCALBASE</code> of
                   2632:             <code class="filename">/usr/pkg</code>, and that you
                   2633:             should <span class="emphasis"><em>not</em></span>
                   2634:             install any if you use a non-standard <code class=
                   2635:             "varname">LOCALBASE</code>.</p>
1.1       grant    2636:           </div>
                   2637: 
                   2638:           <div class="sect2" lang="en" xml:lang="en">
                   2639:             <div class="titlepage">
                   2640:               <div>
                   2641:                 <div>
1.14      xtraeme  2642:                   <h3 class="title"><a name="id2517180" id=
                   2643:                   "id2517180"></a>4.2.4.&nbsp;Selecting the
1.1       grant    2644:                   compiler</h3>
                   2645:                 </div>
                   2646:               </div>
                   2647:             </div>
                   2648: 
                   2649:             <p>By default, pkgsrc will use GCC to build packages.
                   2650:             This may be overridden by setting the following
                   2651:             variables in /etc/mk.conf:</p>
                   2652: 
                   2653:             <div class="variablelist">
                   2654:               <dl>
1.14      xtraeme  2655:                 <dt><span class="term"><code class=
                   2656:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    2657: 
                   2658:                 <dd>
                   2659:                   <p>This is a list of values specifying the chain
                   2660:                   of compilers to invoke when building packages.
                   2661:                   Valid values are:</p>
                   2662: 
                   2663:                   <div class="itemizedlist">
                   2664:                     <ul type="disc">
                   2665:                       <li>
1.14      xtraeme  2666:                         <p><code class="varname">distcc</code>:
1.1       grant    2667:                         distributed C/C++ (chainable)</p>
                   2668:                       </li>
                   2669: 
                   2670:                       <li>
1.14      xtraeme  2671:                         <p><code class="varname">ccache</code>:
1.1       grant    2672:                         compiler cache (chainable)</p>
                   2673:                       </li>
                   2674: 
                   2675:                       <li>
1.14      xtraeme  2676:                         <p><code class="varname">gcc</code>: GNU
                   2677:                         C/C++ Compiler</p>
1.1       grant    2678:                       </li>
                   2679: 
                   2680:                       <li>
1.14      xtraeme  2681:                         <p><code class="varname">mipspro</code>:
1.1       grant    2682:                         Silicon Graphics, Inc. MIPSpro
                   2683:                         (n32/n64)</p>
                   2684:                       </li>
                   2685: 
                   2686:                       <li>
1.14      xtraeme  2687:                         <p><code class="varname">mipspro</code>:
1.1       grant    2688:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   2689:                       </li>
                   2690: 
                   2691:                       <li>
1.14      xtraeme  2692:                         <p><code class="varname">sunpro</code>:
1.1       grant    2693:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   2694:                         Studio</p>
                   2695:                       </li>
                   2696:                     </ul>
                   2697:                   </div>
                   2698: 
                   2699:                   <p>The default is &#8220;<span class=
1.14      xtraeme  2700:                   "quote"><code class=
                   2701:                   "varname">gcc</code></span>&#8221;. You can use
                   2702:                   <code class="varname">ccache</code> and/or
                   2703:                   <code class="varname">distcc</code> with an
                   2704:                   appropriate <code class=
                   2705:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   2706:                   &#8220;<span class="quote"><code class=
                   2707:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    2708:                   variable should always be terminated with a value
                   2709:                   for a real compiler.</p>
                   2710:                 </dd>
                   2711: 
1.14      xtraeme  2712:                 <dt><span class="term"><code class=
                   2713:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    2714: 
                   2715:                 <dd>
                   2716:                   <p>This specifies the minimum version of GCC to
                   2717:                   use when building packages. If the system GCC
                   2718:                   doesn't satisfy this requirement, then pkgsrc
                   2719:                   will build and install one of the GCC packages to
                   2720:                   use instead.</p>
                   2721:                 </dd>
                   2722:               </dl>
                   2723:             </div>
                   2724:           </div>
                   2725:         </div>
                   2726:       </div>
                   2727: 
                   2728:       <div class="chapter" lang="en" xml:lang="en">
                   2729:         <div class="titlepage">
                   2730:           <div>
                   2731:             <div>
                   2732:               <h2 class="title"><a name="binary" id=
                   2733:               "binary"></a>Chapter&nbsp;5.&nbsp;Creating binary
                   2734:               packages</h2>
                   2735:             </div>
                   2736:           </div>
                   2737:         </div>
                   2738: 
                   2739:         <div class="toc">
                   2740:           <p><b>Table of Contents</b></p>
                   2741: 
                   2742:           <dl>
1.14      xtraeme  2743:             <dt><span class="sect1"><a href="#id2517335">5.1.
1.1       grant    2744:             Building a single binary package</a></span></dt>
                   2745: 
1.14      xtraeme  2746:             <dt><span class="sect1"><a href="#id2517822">5.2.
1.1       grant    2747:             Settings for creation of binary
                   2748:             packages</a></span></dt>
                   2749: 
                   2750:             <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
                   2751:             a bulk build of all packages</a></span></dt>
                   2752: 
                   2753:             <dd>
                   2754:               <dl>
                   2755:                 <dt><span class="sect2"><a href=
                   2756:                 "#binary.configuration">5.3.1.
                   2757:                 Configuration</a></span></dt>
                   2758: 
1.14      xtraeme  2759:                 <dt><span class="sect2"><a href="#id2517962">5.3.2.
1.1       grant    2760:                 Other environmental considerations</a></span></dt>
                   2761: 
1.14      xtraeme  2762:                 <dt><span class="sect2"><a href="#id2518003">5.3.3.
1.1       grant    2763:                 Operation</a></span></dt>
                   2764: 
1.14      xtraeme  2765:                 <dt><span class="sect2"><a href="#id2583267">5.3.4.
1.1       grant    2766:                 What it does</a></span></dt>
                   2767: 
1.14      xtraeme  2768:                 <dt><span class="sect2"><a href="#id2583392">5.3.5.
1.1       grant    2769:                 Disk space requirements</a></span></dt>
                   2770: 
1.14      xtraeme  2771:                 <dt><span class="sect2"><a href="#id2583418">5.3.6.
1.1       grant    2772:                 Setting up a sandbox for chroot'ed
                   2773:                 builds</a></span></dt>
                   2774: 
1.14      xtraeme  2775:                 <dt><span class="sect2"><a href="#id2583811">5.3.7.
1.1       grant    2776:                 Building a partial set of packages</a></span></dt>
1.13      hubertf  2777: 
                   2778:                 <dt><span class="sect2"><a href=
                   2779:                 "#bulk-upload">5.3.8. Uploading results of a bulk
                   2780:                 build</a></span></dt>
1.1       grant    2781:               </dl>
                   2782:             </dd>
                   2783: 
1.14      xtraeme  2784:             <dt><span class="sect1"><a href="#id2584227">5.4.
1.1       grant    2785:             Creating a multiple CD-ROM packages
                   2786:             collection</a></span></dt>
                   2787: 
                   2788:             <dd>
                   2789:               <dl>
1.14      xtraeme  2790:                 <dt><span class="sect2"><a href="#id2584310">5.4.1.
1.1       grant    2791:                 Example of cdpack</a></span></dt>
                   2792:               </dl>
                   2793:             </dd>
                   2794:           </dl>
                   2795:         </div>
                   2796: 
                   2797:         <div class="sect1" lang="en" xml:lang="en">
                   2798:           <div class="titlepage">
                   2799:             <div>
                   2800:               <div>
                   2801:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  2802:                 "id2517335" id="id2517335"></a>5.1.&nbsp;Building a
1.1       grant    2803:                 single binary package</h2>
                   2804:               </div>
                   2805:             </div>
                   2806:           </div>
                   2807: 
                   2808:           <p>Once you have built and installed a package, you can
                   2809:           create a <span class="emphasis"><em>binary
                   2810:           package</em></span> which can be installed on another
                   2811:           system with <a href=
                   2812:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2813:           <span class="citerefentry"><span class=
                   2814:           "refentrytitle">pkg_add</span>(1)</span></a> This saves
                   2815:           having to build the same package on a group of hosts and
                   2816:           wasting CPU time. It also provides a simple means for
                   2817:           others to install your package, should you distribute
                   2818:           it.</p>
                   2819: 
                   2820:           <p>To create a binary package, change into the
1.14      xtraeme  2821:           appropriate directory in pkgsrc, and run
                   2822:           <span><strong class="command">make
                   2823:           package</strong></span>:</p>
1.1       grant    2824:           <pre class="screen">
1.14      xtraeme  2825: <code class="prompt">#</code> <strong class=
                   2826: "userinput"><code>cd misc/figlet</code></strong>
                   2827: <code class="prompt">#</code> <strong class=
                   2828: "userinput"><code>make package</code></strong>
1.1       grant    2829: </pre>
                   2830: 
                   2831:           <p>This will build and install your package (if not
                   2832:           already done), and then build a binary package from what
1.14      xtraeme  2833:           was installed. You can then use the <span><strong class=
                   2834:           "command">pkg_*</strong></span> tools to manipulate it.
                   2835:           Binary packages are created by default in <code class=
                   2836:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    2837:           gzipped tar file. See <a href="#logs.package" title=
                   2838:           "B.2.&nbsp;Packaging figlet">Section B.2,
                   2839:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   2840:           the above <a xmlns=
                   2841:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   2842:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.14      xtraeme  2843:           class="pkgname">misc/figlet</a> example.</p>
1.1       grant    2844: 
                   2845:           <p>See <a href="#submit" title=
                   2846:           "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter
                   2847:           14, <i>Submitting and Committing</i></a> for information
                   2848:           on how to submit such a binary package.</p>
                   2849:         </div>
                   2850: 
                   2851:         <div class="sect1" lang="en" xml:lang="en">
                   2852:           <div class="titlepage">
                   2853:             <div>
                   2854:               <div>
                   2855:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  2856:                 "id2517822" id="id2517822"></a>5.2.&nbsp;Settings
1.1       grant    2857:                 for creation of binary packages</h2>
                   2858:               </div>
                   2859:             </div>
                   2860:           </div>
                   2861: 
                   2862:           <p>See <a href="#build.helpful-targets" title=
                   2863:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   2864:           &#8220;Other helpful targets&#8221;</a>.</p>
                   2865:         </div>
                   2866: 
                   2867:         <div class="sect1" lang="en" xml:lang="en">
                   2868:           <div class="titlepage">
                   2869:             <div>
                   2870:               <div>
                   2871:                 <h2 class="title" style="clear: both"><a name=
                   2872:                 "bulkbuild" id="bulkbuild"></a>5.3.&nbsp;Doing a
                   2873:                 bulk build of all packages</h2>
                   2874:               </div>
                   2875:             </div>
                   2876:           </div>
                   2877: 
                   2878:           <p>If you want to get a full set of precompiled binary
                   2879:           packages, this section describes how to get them. Beware
                   2880:           that the bulk build will remove all currently installed
                   2881:           packages from your system! Having a FTP server configured
                   2882:           either on the machine doing the bulk builds or on a
                   2883:           nearby NFS server can help to make the packages available
                   2884:           to everyone. See <a href=
                   2885:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   2886:           <span class="citerefentry"><span class=
                   2887:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   2888:           information. If you use a remote NFS server's storage, be
                   2889:           sure to not actually compile on NFS storage, as this
                   2890:           slows things down a lot.</p>
                   2891: 
                   2892:           <div class="sect2" lang="en" xml:lang="en">
                   2893:             <div class="titlepage">
                   2894:               <div>
                   2895:                 <div>
                   2896:                   <h3 class="title"><a name="binary.configuration"
                   2897:                   id=
                   2898:                   "binary.configuration"></a>5.3.1.&nbsp;Configuration</h3>
                   2899:                 </div>
                   2900:               </div>
                   2901:             </div>
                   2902: 
                   2903:             <div class="sect3" lang="en" xml:lang="en">
                   2904:               <div class="titlepage">
                   2905:                 <div>
                   2906:                   <div>
                   2907:                     <h4 class="title"><a name="binary.mk.conf" id=
                   2908:                     "binary.mk.conf"></a>5.3.1.1.&nbsp;/etc/mk.conf</h4>
                   2909:                   </div>
                   2910:                 </div>
                   2911:               </div>
                   2912: 
1.14      xtraeme  2913:               <p>You may want to set things in <code class=
                   2914:               "filename">/etc/mk.conf</code>. Look at <code class=
                   2915:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    2916:               details of the default settings. You will want to
1.14      xtraeme  2917:               ensure that <code class=
                   2918:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   2919:               policy. As used in this example, <code class=
                   2920:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    2921:               "emphasis"><em>all</em></span> licenses.</p>
                   2922:               <pre class="programlisting">
                   2923: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   2924: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   2925: BSDSRCDIR=      /usr/src
                   2926: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   2927: OBJHOSTNAME?=   yes               # use work.`hostname`
                   2928: FAILOVER_FETCH= yes               # insist on the correct checksum
                   2929: PKG_DEVELOPER?= yes
                   2930: _ACCEPTABLE=    yes
                   2931: </pre>
                   2932:             </div>
                   2933: 
                   2934:             <div class="sect3" lang="en" xml:lang="en">
                   2935:               <div class="titlepage">
                   2936:                 <div>
                   2937:                   <div>
1.14      xtraeme  2938:                     <h4 class="title"><a name="id2517886" id=
                   2939:                     "id2517886"></a>5.3.1.2.&nbsp;<code class=
                   2940:                     "filename">build.conf</code></h4>
1.1       grant    2941:                   </div>
                   2942:                 </div>
                   2943:               </div>
                   2944: 
1.14      xtraeme  2945:               <p>In <code class="filename">pkgsrc/mk/bulk</code>,
                   2946:               copy <code class="filename">build.conf-example</code>
                   2947:               to <code class="filename">build.conf</code> and edit
                   2948:               it, following the comments in that file. This is the
1.1       grant    2949:               config file that determines where log files are
                   2950:               generated after the build, where to mail the build
                   2951:               report to, where your pkgsrc tree is located and
                   2952:               which user to <a href=
                   2953:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   2954:               <span class="citerefentry"><span class=
                   2955:               "refentrytitle">su</span>(8)</span></a> to to do a
1.14      xtraeme  2956:               <span><strong class="command">cvs
                   2957:               update</strong></span>.</p>
1.1       grant    2958:             </div>
                   2959: 
                   2960:             <div class="sect3" lang="en" xml:lang="en">
                   2961:               <div class="titlepage">
                   2962:                 <div>
                   2963:                   <div>
1.14      xtraeme  2964:                     <h4 class="title"><a name="id2517923" id=
                   2965:                     "id2517923"></a>5.3.1.3.&nbsp;<code class=
                   2966:                     "filename">pre-build.local</code></h4>
1.1       grant    2967:                   </div>
                   2968:                 </div>
                   2969:               </div>
                   2970: 
                   2971:               <p>It is possible to configure the bulk build to
                   2972:               perform certain site specific tasks at the end of the
1.14      xtraeme  2973:               pre-build stage. If the file <code class=
                   2974:               "filename">pre-build.local</code> exists in
                   2975:               <code class="filename">/usr/pkgsrc/mk/bulk</code> it
                   2976:               will be executed (as a sh(1) script) at the end of
                   2977:               the usual pre-build stage. An example use of
                   2978:               <code class="filename">pre-build.local</code> is to
                   2979:               have the line:</p>
1.1       grant    2980:               <pre class="screen">
1.14      xtraeme  2981: <code class="prompt">#</code> <strong class=
                   2982: "userinput"><code>echo "I do not have enough disk space to build this pig." \
                   2983:     &gt; pkgsrc/games/crafty-book-enormous/$BROKENF</code></strong>
1.1       grant    2984: </pre>
                   2985: 
                   2986:               <p>to prevent the system from trying to build a
                   2987:               particular package which requires nearly 3 GB of disk
                   2988:               space.</p>
                   2989:             </div>
                   2990:           </div>
                   2991: 
                   2992:           <div class="sect2" lang="en" xml:lang="en">
                   2993:             <div class="titlepage">
                   2994:               <div>
                   2995:                 <div>
1.14      xtraeme  2996:                   <h3 class="title"><a name="id2517962" id=
                   2997:                   "id2517962"></a>5.3.2.&nbsp;Other environmental
1.1       grant    2998:                   considerations</h3>
                   2999:                 </div>
                   3000:               </div>
                   3001:             </div>
                   3002: 
1.14      xtraeme  3003:             <p>As <code class="filename">/usr/pkg</code> will be
1.1       grant    3004:             completely deleted at the start of bulk builds, make
                   3005:             sure your login shell is placed somewhere else. Either
1.14      xtraeme  3006:             drop it into <code class=
                   3007:             "filename">/usr/local/bin</code> (and adjust your login
                   3008:             shell in the passwd file), or (re-)install it via
                   3009:             <a href=
1.1       grant    3010:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3011:             <span class="citerefentry"><span class=
                   3012:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.14      xtraeme  3013:             <code class="filename">/etc/rc.local</code>, so you can
1.1       grant    3014:             login after a reboot (remember that your current
                   3015:             process won't die if the package is removed, you just
                   3016:             can't start any new instances of the shell any more).
                   3017:             Also, if you use NetBSD earlier than 1.5, or you still
                   3018:             want to use the pkgsrc version of ssh for some reason,
                   3019:             be sure to install ssh before starting it from
1.14      xtraeme  3020:             <code class="filename">rc.local</code>:</p>
1.1       grant    3021:             <pre class="programlisting">
                   3022: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   3023: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   3024:     /usr/pkg/etc/rc.d/sshd
                   3025: fi
                   3026: </pre>
                   3027: 
                   3028:             <p>Not doing so will result in you being not able to
                   3029:             log in via ssh after the bulk build is finished or if
                   3030:             the machine gets rebooted or crashes. You have been
                   3031:             warned! :)</p>
                   3032:           </div>
                   3033: 
                   3034:           <div class="sect2" lang="en" xml:lang="en">
                   3035:             <div class="titlepage">
                   3036:               <div>
                   3037:                 <div>
1.14      xtraeme  3038:                   <h3 class="title"><a name="id2518003" id=
                   3039:                   "id2518003"></a>5.3.3.&nbsp;Operation</h3>
1.1       grant    3040:                 </div>
                   3041:               </div>
                   3042:             </div>
                   3043: 
                   3044:             <p>Make sure you don't need any of the packages still
                   3045:             installed.</p>
                   3046: 
                   3047:             <div class="warning" style=
                   3048:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3049:               <h3 class="title">Warning</h3>
                   3050: 
                   3051:               <p>During the bulk build, <span class=
                   3052:               "emphasis"><em>all packages will be
                   3053:               removed!</em></span></p>
                   3054:             </div>
                   3055: 
                   3056:             <p>Be sure to remove all other things that might
                   3057:             interfere with builds, like some libs installed in
1.14      xtraeme  3058:             <code class="filename">/usr/local</code>, etc. then
                   3059:             become root and type:</p>
1.1       grant    3060:             <pre class="screen">
1.14      xtraeme  3061: <code class="prompt">#</code> <strong class=
                   3062: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   3063: <code class="prompt">#</code> <strong class=
                   3064: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    3065: </pre>
                   3066: 
                   3067:             <p>If for some reason your last build didn't complete
                   3068:             (power failure, system panic, ...), you can continue it
                   3069:             by running:</p>
                   3070:             <pre class="screen">
1.14      xtraeme  3071: <code class="prompt">#</code> <strong class=
                   3072: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    3073: </pre>
                   3074: 
                   3075:             <p>At the end of the bulk build, you will get a summary
                   3076:             via mail, and find build logs in the directory
1.14      xtraeme  3077:             specified by <code class="varname">FTP</code> in the
                   3078:             <code class="filename">build.conf</code> file.</p>
1.1       grant    3079:           </div>
                   3080: 
                   3081:           <div class="sect2" lang="en" xml:lang="en">
                   3082:             <div class="titlepage">
                   3083:               <div>
                   3084:                 <div>
1.14      xtraeme  3085:                   <h3 class="title"><a name="id2583267" id=
                   3086:                   "id2583267"></a>5.3.4.&nbsp;What it does</h3>
1.1       grant    3087:                 </div>
                   3088:               </div>
                   3089:             </div>
                   3090: 
                   3091:             <p>The bulk builds consist of three steps:</p>
                   3092: 
                   3093:             <div class="variablelist">
                   3094:               <dl>
                   3095:                 <dt><span class="term">1. pre-build</span></dt>
                   3096: 
                   3097:                 <dd>
                   3098:                   <p>The script updates your pkgsrc tree via
                   3099:                   (anon)cvs, then cleans out any broken distfiles,
                   3100:                   and removes all packages installed.</p>
                   3101:                 </dd>
                   3102: 
                   3103:                 <dt><span class="term">2. the bulk
                   3104:                 build</span></dt>
                   3105: 
                   3106:                 <dd>
                   3107:                   <p>This is basically &#8220;<span class=
                   3108:                   "quote">make bulk-package</span>&#8221; with an
                   3109:                   optimised order in which packages will be built.
                   3110:                   Packages that don't require other packages will
                   3111:                   be built first, and packages with many
                   3112:                   dependencies will be built later.</p>
                   3113:                 </dd>
                   3114: 
                   3115:                 <dt><span class="term">3. post-build</span></dt>
                   3116: 
                   3117:                 <dd>
                   3118:                   <p>Generates a report that's placed in the
1.14      xtraeme  3119:                   directory specified in the <code class=
                   3120:                   "filename">build.conf</code> file named
                   3121:                   <code class="filename">broken.html</code>, a
                   3122:                   short version of that report will also be mailed
                   3123:                   to the build's admin.</p>
1.1       grant    3124:                 </dd>
                   3125:               </dl>
                   3126:             </div>
                   3127: 
                   3128:             <p>During the build, a list of broken packages will be
1.14      xtraeme  3129:             compiled in <code class=
                   3130:             "filename">/usr/pkgsrc/.broken</code> (or <code class=
                   3131:             "filename">.../.broken.${MACHINE}</code> if
                   3132:             <code class="varname">OBJMACHINE</code> is set),
                   3133:             individual build logs of broken builds can be found in
                   3134:             the package's directory. These files are used by the
                   3135:             bulk-targets to mark broken builds to not waste time
                   3136:             trying to rebuild them, and they can be used to debug
                   3137:             these broken package builds later.</p>
1.1       grant    3138:           </div>
                   3139: 
                   3140:           <div class="sect2" lang="en" xml:lang="en">
                   3141:             <div class="titlepage">
                   3142:               <div>
                   3143:                 <div>
1.14      xtraeme  3144:                   <h3 class="title"><a name="id2583392" id=
                   3145:                   "id2583392"></a>5.3.5.&nbsp;Disk space
1.1       grant    3146:                   requirements</h3>
                   3147:                 </div>
                   3148:               </div>
                   3149:             </div>
                   3150: 
                   3151:             <p>Currently, roughly the following requirements are
                   3152:             valid for NetBSD 2.0/i386:</p>
                   3153: 
                   3154:             <div class="itemizedlist">
                   3155:               <ul type="disc">
                   3156:                 <li>
                   3157:                   <p>10 GB - distfiles (NFS ok)</p>
                   3158:                 </li>
                   3159: 
                   3160:                 <li>
                   3161:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   3162:                 </li>
                   3163: 
                   3164:                 <li>
                   3165:                   <p>5 GB - temp space for compiling (local disk
                   3166:                   recommended)</p>
                   3167:                 </li>
                   3168:               </ul>
                   3169:             </div>
                   3170: 
                   3171:             <p>Note that all pkgs will be de-installed as soon as
                   3172:             they are turned into a binary package, and that sources
                   3173:             are removed, so there is no excessively huge demand to
                   3174:             disk space. Afterwards, if the package is needed again,
                   3175:             it will be installed via <a href=
                   3176:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3177:             <span class="citerefentry"><span class=
                   3178:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   3179:             building again, so there are no cycles wasted by
                   3180:             recompiling.</p>
                   3181:           </div>
                   3182: 
                   3183:           <div class="sect2" lang="en" xml:lang="en">
                   3184:             <div class="titlepage">
                   3185:               <div>
                   3186:                 <div>
1.14      xtraeme  3187:                   <h3 class="title"><a name="id2583418" id=
                   3188:                   "id2583418"></a>5.3.6.&nbsp;Setting up a sandbox
1.1       grant    3189:                   for chroot'ed builds</h3>
                   3190:                 </div>
                   3191:               </div>
                   3192:             </div>
                   3193: 
1.12      agc      3194:             <p>If you don't want all the packages nuked from a
                   3195:             machine (rendering it useless for anything but pkg
                   3196:             compiling), there is the possibility of doing the pkg
                   3197:             bulk build inside a chroot environment.</p>
                   3198: 
                   3199:             <p>The first step is to set up a chroot sandbox, e.g.
1.14      xtraeme  3200:             <code class="filename">/usr/sandbox</code>. This can be
1.12      agc      3201:             done by using null mounts, or manually.</p>
                   3202: 
1.14      xtraeme  3203:             <p>There is a shell script called <code class=
                   3204:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   3205:             set up the sandbox environment using null mounts. It
                   3206:             will also create a script called <code class=
                   3207:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      3208:             environment, which will allow the null mounts to be
1.14      xtraeme  3209:             activated using the <span><strong class=
                   3210:             "command">sandbox mount</strong></span> command and
                   3211:             deactivated using the <span><strong class=
                   3212:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      3213: 
                   3214:             <p>To set up a sandbox environment by hand, after
                   3215:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  3216:             doing a <span><strong class="command">make distribution
                   3217:             DESTDIR=/usr/sandbox</strong></span> in <code class=
                   3218:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      3219:             items are present and properly configured:</p>
1.1       grant    3220: 
                   3221:             <div class="procedure">
                   3222:               <ol type="1">
                   3223:                 <li>
                   3224:                   <p>Kernel</p>
                   3225:                   <pre class="screen">
1.14      xtraeme  3226: <code class="prompt">#</code> <strong class=
                   3227: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    3228: </pre>
                   3229:                 </li>
                   3230: 
                   3231:                 <li>
1.14      xtraeme  3232:                   <p><code class="filename">/dev/*</code></p>
1.1       grant    3233:                   <pre class="screen">
1.14      xtraeme  3234: <code class="prompt">#</code> <strong class=
                   3235: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    3236: </pre>
                   3237:                 </li>
                   3238: 
                   3239:                 <li>
1.14      xtraeme  3240:                   <p><code class="filename">/etc/resolv.conf</code>
1.1       grant    3241:                   (for <a xmlns=
                   3242:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3243:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.14      xtraeme  3244:                   class="pkgname">security/smtpd</a> and mail):</p>
1.1       grant    3245:                   <pre class="screen">
1.14      xtraeme  3246: <code class="prompt">#</code> <strong class=
                   3247: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    3248: </pre>
                   3249:                 </li>
                   3250: 
                   3251:                 <li>
                   3252:                   <p>Working(!) mail config (hostname,
                   3253:                   sendmail.cf):</p>
                   3254:                   <pre class="screen">
1.14      xtraeme  3255: <code class="prompt">#</code> <strong class=
                   3256: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    3257: </pre>
                   3258:                 </li>
                   3259: 
                   3260:                 <li>
1.14      xtraeme  3261:                   <p><code class="filename">/etc/localtime</code>
                   3262:                   (for <a xmlns=
1.1       grant    3263:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3264:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.14      xtraeme  3265:                   class="pkgname">security/smtpd</a>):</p>
1.1       grant    3266:                   <pre class="screen">
1.14      xtraeme  3267: <code class="prompt">#</code> <strong class=
                   3268: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    3269: </pre>
                   3270:                 </li>
                   3271: 
                   3272:                 <li>
1.14      xtraeme  3273:                   <p><code class="filename">/usr/src</code> (system
1.1       grant    3274:                   sources, for <a xmlns=
                   3275:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3276:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.14      xtraeme  3277:                   class="pkgname">sysutils/aperture</a>, <a xmlns=
                   3278:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3279:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
                   3280:                   class="pkgname">net/ppp-mppe</a>):</p>
1.1       grant    3281:                   <pre class="screen">
1.14      xtraeme  3282: <code class="prompt">#</code> <strong class=
                   3283: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   3284: <code class="prompt">#</code> <strong class=
                   3285: "userinput"><code>ln -s cvs/src-1.6 src</code></strong>
1.1       grant    3286: </pre>
                   3287:                 </li>
                   3288: 
                   3289:                 <li>
1.14      xtraeme  3290:                   <p>Create <code class=
                   3291:                   "filename">/var/db/pkg</code> (not part of
                   3292:                   default install):</p>
1.1       grant    3293:                   <pre class="screen">
1.14      xtraeme  3294: <code class="prompt">#</code> <strong class=
                   3295: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    3296: </pre>
                   3297:                 </li>
                   3298: 
                   3299:                 <li>
1.14      xtraeme  3300:                   <p>Create <code class="filename">/usr/pkg</code>
                   3301:                   (not part of default install):</p>
1.1       grant    3302:                   <pre class="screen">
1.14      xtraeme  3303: <code class="prompt">#</code> <strong class=
                   3304: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    3305: </pre>
                   3306:                 </li>
                   3307: 
                   3308:                 <li>
1.14      xtraeme  3309:                   <p>Checkout pkgsrc via cvs into <code class=
                   3310:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    3311:                   <pre class="screen">
1.14      xtraeme  3312: <code class="prompt">#</code> <strong class=
                   3313: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   3314: <code class="prompt">#</code> <strong class=
                   3315: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    3316: </pre>
                   3317: 
                   3318:                   <p>Do not mount/link this to the copy of your
                   3319:                   pkgsrc tree you do development in, as this will
                   3320:                   likely cause problems!</p>
                   3321:                 </li>
                   3322: 
                   3323:                 <li>
1.14      xtraeme  3324:                   <p>Make <code class=
                   3325:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
                   3326:                   and <code class="filename">.../distfiles</code>
                   3327:                   point somewhere appropriate. NFS- and/or
                   3328:                   nullfs-mounts may come in handy!</p>
1.1       grant    3329:                 </li>
                   3330: 
                   3331:                 <li>
1.14      xtraeme  3332:                   <p>Edit <code class=
                   3333:                   "filename">/etc/mk.conf</code>, see <a href=
                   3334:                   "#binary.mk.conf" title=
1.1       grant    3335:                   "5.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;5.3.1.1,
                   3336:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   3337:                 </li>
                   3338: 
                   3339:                 <li>
1.14      xtraeme  3340:                   <p>Adjust <code class=
                   3341:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    3342:                   needs.</p>
                   3343:                 </li>
                   3344: 
                   3345:                 <li>
1.14      xtraeme  3346:                   <p>If you have set <code class=
                   3347:                   "varname">CVS_USER</code> in <code class=
                   3348:                   "filename">build.conf</code>, make sure that
                   3349:                   account exists and can do a <span><strong class=
                   3350:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    3351:                   properly!</p>
                   3352:                 </li>
                   3353:               </ol>
                   3354:             </div>
                   3355: 
                   3356:             <p>When the chroot sandbox is setup, you can start the
                   3357:             build with the following steps:</p>
                   3358:             <pre class="screen">
1.14      xtraeme  3359: <code class="prompt">#</code> <strong class=
                   3360: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   3361: <code class="prompt">#</code> <strong class=
                   3362: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    3363: </pre>
                   3364: 
                   3365:             <p>This will just jump inside the sandbox and start
                   3366:             building. At the end of the build, mail will be sent
                   3367:             with the results of the build. Created binary pkgs will
1.14      xtraeme  3368:             be in <code class=
                   3369:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    3370:             (wherever that points/mounts to/from).</p>
                   3371:           </div>
                   3372: 
                   3373:           <div class="sect2" lang="en" xml:lang="en">
                   3374:             <div class="titlepage">
                   3375:               <div>
                   3376:                 <div>
1.14      xtraeme  3377:                   <h3 class="title"><a name="id2583811" id=
                   3378:                   "id2583811"></a>5.3.7.&nbsp;Building a partial
1.1       grant    3379:                   set of packages</h3>
                   3380:                 </div>
                   3381:               </div>
                   3382:             </div>
                   3383: 
                   3384:             <p>In addition to building a complete set of all
1.14      xtraeme  3385:             packages in pkgsrc, the <code class=
                   3386:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   3387:             used to build a subset of the packages contained in
                   3388:             pkgsrc. By setting defining <code class=
                   3389:             "varname">SPECIFIC_PKGS</code> in <code class=
                   3390:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    3391: 
                   3392:             <div class="itemizedlist">
                   3393:               <ul type="disc">
                   3394:                 <li>
                   3395:                   <p>SITE_SPECIFIC_PKGS</p>
                   3396:                 </li>
                   3397: 
                   3398:                 <li>
                   3399:                   <p>HOST_SPECIFIC_PKGS</p>
                   3400:                 </li>
                   3401: 
                   3402:                 <li>
                   3403:                   <p>GROUP_SPECIFIC_PKGS</p>
                   3404:                 </li>
                   3405: 
                   3406:                 <li>
                   3407:                   <p>USER_SPECIFIC_PKGS</p>
                   3408:                 </li>
                   3409:               </ul>
                   3410:             </div>
                   3411: 
                   3412:             <p>will define the set of packages which should be
                   3413:             built. The bulk build code will also include any
                   3414:             packages which are needed as dependencies for the
                   3415:             explicitly listed packages.</p>
                   3416: 
                   3417:             <p>One use of this is to do a bulk build with
1.14      xtraeme  3418:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    3419:             sandbox periodically to have a complete set of the
                   3420:             binary packages needed for your site available without
                   3421:             the overhead of building extra packages that are not
                   3422:             needed.</p>
                   3423:           </div>
1.13      hubertf  3424: 
                   3425:           <div class="sect2" lang="en" xml:lang="en">
                   3426:             <div class="titlepage">
                   3427:               <div>
                   3428:                 <div>
                   3429:                   <h3 class="title"><a name="bulk-upload" id=
                   3430:                   "bulk-upload"></a>5.3.8.&nbsp;Uploading results
                   3431:                   of a bulk build</h3>
                   3432:                 </div>
                   3433:               </div>
                   3434:             </div>
                   3435: 
                   3436:             <p>This section describes how pkgsrc developers can
                   3437:             upload binary pkgs built by bulk builds to
                   3438:             ftp.NetBSD.org.</p>
                   3439: 
1.14      xtraeme  3440:             <p>First, make sure that you have <code class=
                   3441:             "varname">RSYNC_DST</code> set properly in your
                   3442:             <code class="filename">mk/bulk/build.conf</code> file,
                   3443:             i.e. adjust it to something like one of the
                   3444:             following:</p>
1.13      hubertf  3445:             <pre class="screen">
                   3446: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3447: </pre>
                   3448: 
                   3449:             <p>Please use appropviate values for "pkgsrc-200xQ4",
                   3450:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  3451:             ftp.NetBSD.org is different from <code class=
                   3452:             "varname">CVS_USER</code>, write your login directly
                   3453:             into the variable, e.g. my local account is "feyrer",
                   3454:             but for my login "hubertf", I use:</p>
1.13      hubertf  3455:             <pre class="screen">
                   3456: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3457: </pre>
                   3458: 
1.14      xtraeme  3459:             <p>A separate <code class="filename">upload</code>
1.13      hubertf  3460:             directory is used here to allow "closing" the directory
                   3461:             during upload. To do so, run the following command on
                   3462:             ftp.NetBSD.org next:</p>
                   3463:             <pre class="screen">
1.14      xtraeme  3464: nbftp% <strong class=
                   3465: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  3466: </pre>
                   3467: 
1.14      xtraeme  3468:             <p>Please note that <code class=
                   3469:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  3470:             appropriate for packages for the NetBSD operating
                   3471:             system. Binary packages for other operating systems
1.14      xtraeme  3472:             should go into <code class=
                   3473:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  3474: 
                   3475:             <p>Before uploading the binary pkgs, ssh authentication
                   3476:             needs to be setup next. This example shows how to setup
                   3477:             temporary keys for the root account <span class=
                   3478:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   3479:             that no keys should be present there usually):</p>
                   3480:             <pre class="screen">
1.14      xtraeme  3481: <code class="prompt">#</code> <strong class=
                   3482: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   3483: chroot-<code class="prompt">#</code> <strong class=
                   3484: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   3485: chroot-<code class="prompt">#</code> <strong class=
                   3486: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   3487: chroot-<code class="prompt">#</code> <strong class=
                   3488: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  3489: </pre>
                   3490: 
1.14      xtraeme  3491:             <p>Now take the output of <code class=
                   3492:             "filename">id-dsa.pub</code> and append it to your
                   3493:             <code class="filename">~/.ssh/authorized_keys</code>
                   3494:             file on ftp.netBSD.org. You can remove the key after
                   3495:             the upload is done!</p>
1.13      hubertf  3496: 
                   3497:             <p>Next, test if your ssh connection really works:</p>
                   3498:             <pre class="screen">
1.14      xtraeme  3499: chroot-<code class="prompt">#</code> <strong class=
                   3500: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  3501: </pre>
                   3502: 
                   3503:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   3504: 
                   3505:             <p>Now after all this works, you can exit the sandbox
                   3506:             and start the upload:</p>
                   3507:             <pre class="screen">
1.14      xtraeme  3508: chroot-<code class="prompt">#</code> <strong class=
                   3509: "userinput"><code>exit</code></strong>        
                   3510: <code class="prompt">#</code> <strong class=
                   3511: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   3512: <code class="prompt">#</code> <strong class=
                   3513: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  3514: </pre>
                   3515: 
                   3516:             <p>The upload process may take quite some time. Use
                   3517:             "ls" or "du" on the FTP server to monitor progress of
                   3518:             the upload.</p>
                   3519: 
                   3520:             <p>After the upload has ended, first thing is to revoke
                   3521:             ssh access:</p>
                   3522:             <pre class="screen">
1.14      xtraeme  3523: nbftp% <strong class=
                   3524: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  3525: Gdd:x! 
                   3526: </pre>
                   3527: 
                   3528:             <p>Use whatever is needed to remove the key you've
                   3529:             entered before! Last, move the uploaded packages out of
1.14      xtraeme  3530:             the <code class="filename">upload</code> directory to
                   3531:             have them accessible to everyone:</p>
1.13      hubertf  3532:             <pre class="screen">
1.14      xtraeme  3533: nbftp% <strong class=
                   3534: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   3535: nbftp% <strong class=
                   3536: "userinput"><code>mv upload/* .</code></strong>
                   3537: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   3538: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  3539: </pre>
                   3540:           </div>
1.1       grant    3541:         </div>
                   3542: 
                   3543:         <div class="sect1" lang="en" xml:lang="en">
                   3544:           <div class="titlepage">
                   3545:             <div>
                   3546:               <div>
                   3547:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  3548:                 "id2584227" id="id2584227"></a>5.4.&nbsp;Creating a
1.1       grant    3549:                 multiple CD-ROM packages collection</h2>
                   3550:               </div>
                   3551:             </div>
                   3552:           </div>
                   3553: 
                   3554:           <p>After your pkgsrc bulk-build has completed, you may
                   3555:           wish to create a CD-ROM set of the resulting binary
                   3556:           packages to assist in installing packages on other
                   3557:           machines. The <a xmlns=
                   3558:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3559:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.14      xtraeme  3560:           class="pkgname">pkgtools/cdpack</a> package provides a
                   3561:           simple tool for creating the ISO 9660 images.
                   3562:           <span><strong class="command">cdpack</strong></span>
                   3563:           arranges the packages on the CD-ROMs in a way that keeps
                   3564:           all the dependencies for given package on the same CD as
                   3565:           that package.</p>
1.1       grant    3566: 
                   3567:           <div class="sect2" lang="en" xml:lang="en">
                   3568:             <div class="titlepage">
                   3569:               <div>
                   3570:                 <div>
1.14      xtraeme  3571:                   <h3 class="title"><a name="id2584310" id=
                   3572:                   "id2584310"></a>5.4.1.&nbsp;Example of
1.1       grant    3573:                   cdpack</h3>
                   3574:                 </div>
                   3575:               </div>
                   3576:             </div>
                   3577: 
                   3578:             <p>Complete documentation for cdpack is found in the
                   3579:             cdpack(1) manpage. The following short example assumes
1.14      xtraeme  3580:             that the binary packages are left in <code class=
                   3581:             "filename">/usr/pkgsrc/packages/All</code> and that
                   3582:             sufficient disk space exists in <code class=
                   3583:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    3584:             <pre class="screen">
1.14      xtraeme  3585: <code class="prompt">#</code> <strong class=
                   3586: "userinput"><code>mkdir /u2/images</code></strong>
                   3587: <code class="prompt">#</code> <strong class=
                   3588: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   3589: <code class="prompt">#</code> <strong class=
                   3590: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3591: </pre>
                   3592: 
                   3593:             <p>If you wish to include a common set of files
1.14      xtraeme  3594:             (<code class="filename">COPYRIGHT</code>, <code class=
                   3595:             "filename">README</code>, etc.) on each CD in the
1.1       grant    3596:             collection, then you need to create a directory which
                   3597:             contains these files. e.g.</p>
                   3598:             <pre class="screen">
1.14      xtraeme  3599: <code class="prompt">#</code> <strong class=
                   3600: "userinput"><code>mkdir /tmp/common</code></strong>
                   3601: <code class="prompt">#</code> <strong class=
                   3602: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   3603: <code class="prompt">#</code> <strong class=
                   3604: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   3605: <code class="prompt">#</code> <strong class=
                   3606: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   3607: <code class="prompt">#</code> <strong class=
                   3608: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   3609: <code class="prompt">#</code> <strong class=
                   3610: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   3611: <code class="prompt">#</code> <strong class=
                   3612: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    3613: </pre>
                   3614: 
                   3615:             <p>Now create the images:</p>
                   3616:             <pre class="screen">
1.14      xtraeme  3617: <code class="prompt">#</code> <strong class=
                   3618: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3619: </pre>
                   3620: 
1.14      xtraeme  3621:             <p>Each image will contain <code class=
                   3622:             "filename">README</code>, <code class=
                   3623:             "filename">COPYING</code>, and <code class=
                   3624:             "filename">bin/myscript</code> in their root
1.1       grant    3625:             directories.</p>
                   3626:           </div>
                   3627:         </div>
                   3628:       </div>
                   3629: 
                   3630:       <div class="chapter" lang="en" xml:lang="en">
                   3631:         <div class="titlepage">
                   3632:           <div>
                   3633:             <div>
                   3634:               <h2 class="title"><a name="faq" id=
                   3635:               "faq"></a>Chapter&nbsp;6.&nbsp;Frequently Asked
                   3636:               Questions</h2>
                   3637:             </div>
                   3638:           </div>
                   3639:         </div>
                   3640: 
                   3641:         <div class="toc">
                   3642:           <p><b>Table of Contents</b></p>
                   3643: 
                   3644:           <dl>
1.14      xtraeme  3645:             <dt><span class="sect1"><a href="#id2584502">6.1. Is
1.1       grant    3646:             there a mailing list for pkg-related
                   3647:             discussion?</a></span></dt>
                   3648: 
1.14      xtraeme  3649:             <dt><span class="sect1"><a href="#id2584600">6.2.
1.1       grant    3650:             Where's the pkgviews documentation?</a></span></dt>
                   3651: 
1.5       hubertf  3652:             <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    3653:             Utilities for package management
                   3654:             (pkgtools)</a></span></dt>
                   3655: 
1.14      xtraeme  3656:             <dt><span class="sect1"><a href="#id2584853">6.4. How
1.1       grant    3657:             to use pkgsrc as non-root</a></span></dt>
                   3658: 
1.14      xtraeme  3659:             <dt><span class="sect1"><a href="#id2584865">6.5. How
1.15      xtraeme  3660:             to resume transfers when fetching
                   3661:             distfiles?</a></span></dt>
1.14      xtraeme  3662: 
1.15      xtraeme  3663:             <dt><span class="sect1"><a href="#id2584907">6.6. How
1.1       grant    3664:             can I install/use XFree86 from pkgsrc?</a></span></dt>
                   3665: 
1.15      xtraeme  3666:             <dt><span class="sect1"><a href="#id2584935">6.7. How
1.1       grant    3667:             can I install/use X.org from pkgsrc?</a></span></dt>
                   3668: 
1.15      xtraeme  3669:             <dt><span class="sect1"><a href="#id2584963">6.8. How
1.1       grant    3670:             to fetch files from behind a firewall</a></span></dt>
                   3671: 
1.15      xtraeme  3672:             <dt><span class="sect1"><a href="#id2584977">6.9. How
1.14      xtraeme  3673:             do I tell <span><strong class="command">make
                   3674:             fetch</strong></span> to do passive
                   3675:             FTP?</a></span></dt>
1.1       grant    3676: 
1.15      xtraeme  3677:             <dt><span class="sect1"><a href="#id2585028">6.10. How
1.1       grant    3678:             to fetch all distfiles at once</a></span></dt>
                   3679: 
1.15      xtraeme  3680:             <dt><span class="sect1"><a href="#id2585168">6.11. What
1.14      xtraeme  3681:             does &#8220;<span class="quote">Don't know how to make
                   3682:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    3683:             mean?</a></span></dt>
                   3684: 
1.15      xtraeme  3685:             <dt><span class="sect1"><a href="#id2585206">6.12. What
1.14      xtraeme  3686:             does &#8220;<span class="quote">Could not find
                   3687:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    3688: 
1.15      xtraeme  3689:             <dt><span class="sect1"><a href="#id2585264">6.13.
1.1       grant    3690:             Using 'sudo' with pkgsrc</a></span></dt>
                   3691: 
1.14      xtraeme  3692:             <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    3693:             Configuration files handling and
                   3694:             placement</a></span></dt>
                   3695: 
1.14      xtraeme  3696:             <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1       grant    3697:             Automated security checks</a></span></dt>
                   3698:           </dl>
                   3699:         </div>
                   3700: 
                   3701:         <p>This section contains hints, tips &amp; tricks on
                   3702:         special things in pkgsrc that we didn't find a better place
                   3703:         for in the previous chapters, and it contains items for
                   3704:         both pkgsrc users and developers.</p>
                   3705: 
                   3706:         <div class="sect1" lang="en" xml:lang="en">
                   3707:           <div class="titlepage">
                   3708:             <div>
                   3709:               <div>
                   3710:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  3711:                 "id2584502" id="id2584502"></a>6.1.&nbsp;Is there a
1.1       grant    3712:                 mailing list for pkg-related discussion?</h2>
                   3713:               </div>
                   3714:             </div>
                   3715:           </div>
                   3716: 
1.14      xtraeme  3717:           <p>Yes, <code class="email">&lt;<a href=
                   3718:           "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>
1.1       grant    3719:           is the list for discussing package related issues. To
                   3720:           subscribe do:</p>
                   3721:           <pre class="programlisting">
1.14      xtraeme  3722: <code class=
                   3723: "prompt">%</code> echo subscribe tech-pkg | mail majordomo@NetBSD.org
1.1       grant    3724: </pre>
                   3725: 
                   3726:           <p>An archive of the list is available at <a href=
                   3727:           "http://mail-index.NetBSD.org/tech-pkg/" target=
                   3728:           "_top">http://mail-index.NetBSD.org/tech-pkg/</a>.</p>
                   3729:         </div>
                   3730: 
                   3731:         <div class="sect1" lang="en" xml:lang="en">
                   3732:           <div class="titlepage">
                   3733:             <div>
                   3734:               <div>
                   3735:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  3736:                 "id2584600" id="id2584600"></a>6.2.&nbsp;Where's
1.1       grant    3737:                 the pkgviews documentation?</h2>
                   3738:               </div>
                   3739:             </div>
                   3740:           </div>
                   3741: 
                   3742:           <p>Pkgviews is tightly integrated with buildlink. You can
1.14      xtraeme  3743:           find a pkgviews User's guide in <code class=
                   3744:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    3745:         </div>
                   3746: 
                   3747:         <div class="sect1" lang="en" xml:lang="en">
                   3748:           <div class="titlepage">
                   3749:             <div>
                   3750:               <div>
                   3751:                 <h2 class="title" style="clear: both"><a name=
1.5       hubertf  3752:                 "faq-pkgtools" id=
                   3753:                 "faq-pkgtools"></a>6.3.&nbsp;Utilities for package
                   3754:                 management (pkgtools)</h2>
1.1       grant    3755:               </div>
                   3756:             </div>
                   3757:           </div>
                   3758: 
1.14      xtraeme  3759:           <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1       grant    3760:           directory pkgtools contains a number of useful utilities
                   3761:           for both users and developers of pkgsrc. This section
                   3762:           attempts only to make the reader aware of the utilities
                   3763:           and when they might be useful, and not to duplicate the
                   3764:           documentation that comes with each package.</p>
                   3765: 
                   3766:           <p>Utilities used by pkgsrc (automatically installed when
                   3767:           needed):</p>
                   3768: 
                   3769:           <div class="itemizedlist">
                   3770:             <ul type="disc">
                   3771:               <li>
                   3772:                 <p><a xmlns=
                   3773:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3774:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.14      xtraeme  3775:                 class="pkgname">pkgtools/x11-links</a>: symlinks
                   3776:                 for use by buildlink</p>
1.1       grant    3777:               </li>
                   3778:             </ul>
                   3779:           </div>
                   3780: 
                   3781:           <p>OS tool augmentation (automatically installed when
                   3782:           needed):</p>
                   3783: 
                   3784:           <div class="itemizedlist">
                   3785:             <ul type="disc">
                   3786:               <li>
                   3787:                 <p><a xmlns=
                   3788:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3789:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.14      xtraeme  3790:                 class="pkgname">pkgtools/digest</a>: calculates
                   3791:                 SHA1 checksums (and other kinds)</p>
1.1       grant    3792:               </li>
                   3793: 
                   3794:               <li>
                   3795:                 <p><a xmlns=
                   3796:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3797:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.14      xtraeme  3798:                 class="pkgname">pkgtools/libnbcompat</a>: compat
                   3799:                 library for pkg tools</p>
1.1       grant    3800:               </li>
                   3801: 
                   3802:               <li>
                   3803:                 <p><a xmlns=
                   3804:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3805:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.14      xtraeme  3806:                 class="pkgname">pkgtools/mtree</a>: installed on
                   3807:                 non-BSD systems due to lack of native mtree</p>
1.1       grant    3808:               </li>
                   3809: 
                   3810:               <li>
                   3811:                 <p><a xmlns=
                   3812:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3813:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14      xtraeme  3814:                 class="pkgname">pkgtools/pkg_install</a>:
                   3815:                 up-to-date replacement for /usr/sbin/pkg_install,
                   3816:                 or for use on operating systems where pkg_install
                   3817:                 is not present</p>
1.1       grant    3818:               </li>
                   3819:             </ul>
                   3820:           </div>
                   3821: 
                   3822:           <p>Utilities used by pkgsrc (not automatically
                   3823:           installed):</p>
                   3824: 
                   3825:           <div class="itemizedlist">
                   3826:             <ul type="disc">
                   3827:               <li>
                   3828:                 <p><a xmlns=
                   3829:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3830:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.14      xtraeme  3831:                 class="pkgname">pkgtools/pkg_tarup</a>: create a
                   3832:                 binary package from an already-installed package.
                   3833:                 used by 'make replace' to save the old package</p>
1.1       grant    3834:               </li>
                   3835: 
                   3836:               <li>
                   3837:                 <p><a xmlns=
                   3838:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  3839:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.14      xtraeme  3840:                 class="pkgname">pkgtools/dfdisk</a>: adds extra
                   3841:                 functionality to pkgsrc, allowing it to fetch
                   3842:                 distfiles from multiple locations. It currently
                   3843:                 supports the following methods: multiple CD-ROMs
                   3844:                 and network FTP/HTTP connections.</p>
1.5       hubertf  3845:               </li>
                   3846: 
                   3847:               <li>
                   3848:                 <p><a xmlns=
                   3849:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    3850:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.14      xtraeme  3851:                 class="pkgname">pkgtools/xpkgwedge</a>: put X11
                   3852:                 packages someplace else (enabled by default)</p>
1.1       grant    3853:               </li>
1.5       hubertf  3854: 
                   3855:               <li>
                   3856:                 <p><a xmlns=
                   3857:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3858:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.14      xtraeme  3859:                 class="pkgname">devel/cpuflags</a>: will determine
                   3860:                 the best compiler flags to optimise code for your
                   3861:                 current CPU and compiler.</p>
1.5       hubertf  3862:               </li>
1.1       grant    3863:             </ul>
                   3864:           </div>
                   3865: 
                   3866:           <p>Utilities for keeping track of installed packages,
                   3867:           being up to date, etc:</p>
                   3868: 
                   3869:           <div class="itemizedlist">
                   3870:             <ul type="disc">
                   3871:               <li>
                   3872:                 <p><a xmlns=
                   3873:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3874:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.14      xtraeme  3875:                 class="pkgname">pkgtools/pkg_chk</a>: installs
                   3876:                 pkg_chk, which reports on packages whose installed
                   3877:                 versions do not match the latest pkgsrc entries</p>
1.1       grant    3878:               </li>
                   3879: 
                   3880:               <li>
                   3881:                 <p><a xmlns=
                   3882:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3883:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.14      xtraeme  3884:                 class="pkgname">pkgtools/pkgdep</a>: makes
                   3885:                 dependency graphs of packages, to aid in choosing a
                   3886:                 strategy for updating</p>
1.1       grant    3887:               </li>
                   3888: 
                   3889:               <li>
                   3890:                 <p><a xmlns=
                   3891:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3892:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.14      xtraeme  3893:                 class="pkgname">pkgtools/pkgdepgraph</a>: make
                   3894:                 graph from above (uses graphviz)</p>
1.1       grant    3895:               </li>
                   3896: 
                   3897:               <li>
                   3898:                 <p><a xmlns=
                   3899:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3900:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14      xtraeme  3901:                 class="pkgname">pkgtools/pkglint</a>: This provides
                   3902:                 two distinct abilities: check a pkgsrc entry for
                   3903:                 correctness (pkglint) check for and remove
                   3904:                 out-of-date distfiles and binary packages
                   3905:                 (lintpkgsrc)</p>
1.1       grant    3906:               </li>
                   3907: 
                   3908:               <li>
                   3909:                 <p><a xmlns=
                   3910:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3911:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.14      xtraeme  3912:                 class="pkgname">pkgtools/pkgsurvey</a>: report what
                   3913:                 packages you have installed</p>
1.1       grant    3914:               </li>
                   3915:             </ul>
                   3916:           </div>
                   3917: 
                   3918:           <p>Utilities for people maintaining or creating
                   3919:           individual packages:</p>
                   3920: 
                   3921:           <div class="itemizedlist">
                   3922:             <ul type="disc">
                   3923:               <li>
                   3924:                 <p><a xmlns=
                   3925:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3926:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14      xtraeme  3927:                 class="pkgname">pkgtools/pkgdiff</a>: automate
                   3928:                 making and maintaining patches for a package
                   3929:                 (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1       grant    3930:               </li>
                   3931: 
                   3932:               <li>
                   3933:                 <p><a xmlns=
                   3934:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3935:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.14      xtraeme  3936:                 class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
                   3937:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3938:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
                   3939:                 class="pkgname">pkgtools/url2pkg</a>: aids in
                   3940:                 converting to pkgsrc</p>
1.1       grant    3941:               </li>
                   3942: 
                   3943:               <li>
                   3944:                 <p><a xmlns=
                   3945:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3946:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.14      xtraeme  3947:                 class="pkgname">pkgtools/gensolpkg</a>: convert
                   3948:                 pkgsrc to a Solaris package</p>
1.1       grant    3949:               </li>
                   3950:             </ul>
                   3951:           </div>
                   3952: 
                   3953:           <p>Utilities for people maintaining pkgsrc (or more
                   3954:           obscure pkg utilities)</p>
                   3955: 
                   3956:           <div class="itemizedlist">
                   3957:             <ul type="disc">
                   3958:               <li>
                   3959:                 <p><a xmlns=
                   3960:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3961:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.14      xtraeme  3962:                 class="pkgname">pkgtools/pkgconflict</a>: find
                   3963:                 packages that conflict but aren't marked as
                   3964:                 such</p>
1.1       grant    3965:               </li>
                   3966: 
                   3967:               <li>
                   3968:                 <p><a xmlns=
                   3969:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3970:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.14      xtraeme  3971:                 class="pkgname">pkgtools/pkg_comp</a>: build
                   3972:                 packages in a chrooted area</p>
1.1       grant    3973:               </li>
                   3974: 
                   3975:               <li>
                   3976:                 <p><a xmlns=
                   3977:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3978:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.14      xtraeme  3979:                 class="pkgname">pkgtools/libkver</a>: spoof kernel
                   3980:                 version for chrooted cross builds</p>
1.1       grant    3981:               </li>
                   3982:             </ul>
                   3983:           </div>
                   3984:         </div>
                   3985: 
                   3986:         <div class="sect1" lang="en" xml:lang="en">
                   3987:           <div class="titlepage">
                   3988:             <div>
                   3989:               <div>
                   3990:                 <h2 class="title" style="clear: both"><a name=
1.14      xtraeme  3991:                 "id2584853" id="id2584853"></a>6.4.&nbsp;How to use
1.1       grant    3992:                 pkgsrc as non-root</h2>
                   3993:               </div>
                   3994:             </div>
                   3995:           </div>
                   3996: 
                   3997:           <p>If you want to use pkgsrc as non-root user, you can
                   3998:           set some variables to make pkgsrc work under these
                   3999:           conditions. Please see <a href=
                   4000:           "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.14      xtraeme  4001:           target="_top">this message</a> for more details.</p>
                   4002:         </div>
                   4003: 
                   4004:         <div class="sect1" lang="en" xml:lang="en">
                   4005:           <div class="titlepage">
                   4006:             <div>
                   4007:               <div>
                   4008:                 <h2 class="title" style="clear: both"><a name=
                   4009:                 "id2584865" id="id2584865"></a>6.5.&nbsp;How to
1.15      xtraeme  4010:                 resume transfers when fetching distfiles?</h2>
1.14      xtraeme  4011:               </div>
                   4012:             </div>
                   4013:           </div>
                   4014: 
1.15      xtraeme  4015:           <p>By default resuming transfers in pkgsrc is disabled,
                   4016:           but you can enable this feature by adding the option
                   4017:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
                   4018:           into <code class="filename">/etc/mk.conf</code>. If,
                   4019:           during a fetch step, an incomplete distfile is found,
                   4020:           pkgsrc will try to resume it.</p>
                   4021: 
                   4022:           <p>You can also use a different program than the default
                   4023:           ftp(1) by changing the <code class=
                   4024:           "varname">FETCH_CMD</code> variable. Don't forget to set
                   4025:           <code class="varname">FETCH_RESUME_ARGS</code> and
                   4026:           <code class="varname">FETCH_OUTPUT_ARGS</code> if you are
                   4027:           not using default values.</p>
1.14      xtraeme  4028: 
                   4029:           <p>For example, if you want to use <code class=
                   4030:           "filename">wget</code> to resume downloads, you'll have
                   4031:           to use something like:</p>
                   4032:           <pre class="programlisting">
                   4033:         FETCH_CMD=wget
                   4034:         .if defined(FETCH_CMD) &amp;&amp; ${FETCH_CMD} == "wget"
                   4035:         FETCH_BEFORE_ARGS=--passive-ftp
                   4036:         FETCH_RESUME_ARGS=-c
                   4037:         FETCH_OUTPUT_ARGS=-O
                   4038:         .endif
                   4039:     
                   4040: </pre>
1.1       grant    4041:         </div>
                   4042: 
                   4043:         <div class="sect1" lang="en" xml:lang="en">
                   4044:           <div class="titlepage">
                   4045:             <div>
                   4046:               <div>
                   4047:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  4048:                 "id2584907" id="id2584907"></a>6.6.&nbsp;How can I
1.1       grant    4049:                 install/use XFree86 from pkgsrc?</h2>
                   4050:               </div>
                   4051:             </div>
                   4052:           </div>
                   4053: 
                   4054:           <p>If you want to use XFree86 from pkgsrc instead of your
1.14      xtraeme  4055:           system's own X11 (<code class=
                   4056:           "filename">/usr/X11R6</code>, <code class=
                   4057:           "filename">/usr/openwin</code>, ...), you will have to
                   4058:           add the following line into <code class=
1.15      xtraeme  4059:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4060:           <pre class="programlisting">
                   4061:       X11_TYPE=XFree86
                   4062:     
                   4063: </pre>
                   4064:         </div>
                   4065: 
                   4066:         <div class="sect1" lang="en" xml:lang="en">
                   4067:           <div class="titlepage">
                   4068:             <div>
                   4069:               <div>
                   4070:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  4071:                 "id2584935" id="id2584935"></a>6.7.&nbsp;How can I
1.1       grant    4072:                 install/use X.org from pkgsrc?</h2>
                   4073:               </div>
                   4074:             </div>
                   4075:           </div>
                   4076: 
                   4077:           <p>If you want to use X.org from pkgsrc instead of your
1.14      xtraeme  4078:           system's own X11 (<code class=
                   4079:           "filename">/usr/X11R6</code>, <code class=
                   4080:           "filename">/usr/openwin</code>, ...) you will have to add
                   4081:           the following line into <code class=
1.15      xtraeme  4082:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4083:           <pre class="programlisting">
                   4084:       X11_TYPE=xorg
                   4085:     
                   4086: </pre>
                   4087:         </div>
                   4088: 
                   4089:         <div class="sect1" lang="en" xml:lang="en">
                   4090:           <div class="titlepage">
                   4091:             <div>
                   4092:               <div>
                   4093:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  4094:                 "id2584963" id="id2584963"></a>6.8.&nbsp;How to
1.1       grant    4095:                 fetch files from behind a firewall</h2>
                   4096:               </div>
                   4097:             </div>
                   4098:           </div>
                   4099: 
                   4100:           <p>If you are sitting behind a firewall which does not
                   4101:           allow direct connections to Internet hosts (i.e.
                   4102:           non-NAT), you may specify the relevant proxy hosts. This
                   4103:           is done using an environment variable in the form of a
                   4104:           URL e.g. in Amdahl, the machine &#8220;<span class=
                   4105:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   4106:           firewalls, and it uses port 80 as the proxy port number.
                   4107:           So the proxy environment variables are:</p>
                   4108:           <pre class="programlisting">
                   4109:   ftp_proxy=ftp://orpheus.amdahl.com:80/
                   4110: http_proxy=http://orpheus.amdahl.com:80/
                   4111: </pre>
                   4112:         </div>
                   4113: 
                   4114:         <div class="sect1" lang="en" xml:lang="en">
                   4115:           <div class="titlepage">
                   4116:             <div>
                   4117:               <div>
                   4118:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  4119:                 "id2584977" id="id2584977"></a>6.9.&nbsp;How do I
1.14      xtraeme  4120:                 tell <span><strong class="command">make
                   4121:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    4122:               </div>
                   4123:             </div>
                   4124:           </div>
                   4125: 
                   4126:           <p>This depends on which utility is used to retrieve
1.14      xtraeme  4127:           distfiles. From <code class="filename">bsd.pkg.mk</code>,
                   4128:           <code class="varname">FETCH_CMD</code> is assigned the
                   4129:           first available command from the following list:</p>
1.1       grant    4130:           <pre class="programlisting">
                   4131: ${LOCALBASE}/bin/ftp
                   4132: /usr/bin/ftp
                   4133: </pre>
                   4134: 
                   4135:           <p>On a default NetBSD installation, this will be
1.14      xtraeme  4136:           <code class="filename">/usr/bin/ftp</code>, which
1.1       grant    4137:           automatically tries passive connections first, and falls
                   4138:           back to active connections if the server refuses to do
                   4139:           passive. For the other tools, add the following to your
1.14      xtraeme  4140:           <code class="filename">/etc/mk.conf</code> file:
                   4141:           <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    4142: 
1.14      xtraeme  4143:           <p>Having that option present will prevent <code class=
                   4144:           "filename">/usr/bin/ftp</code> from falling back to
                   4145:           active transfers.</p>
1.1       grant    4146:         </div>
                   4147: 
                   4148:         <div class="sect1" lang="en" xml:lang="en">
                   4149:           <div class="titlepage">
                   4150:             <div>
                   4151:               <div>
                   4152:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  4153:                 "id2585028" id="id2585028"></a>6.10.&nbsp;How to
1.1       grant    4154:                 fetch all distfiles at once</h2>
                   4155:               </div>
                   4156:             </div>
                   4157:           </div>
                   4158: 
                   4159:           <p>You would like to download all the distfiles in a
                   4160:           single batch from work or university, where you can't run
1.14      xtraeme  4161:           a <span><strong class="command">make
                   4162:           fetch</strong></span>. There is an archive of distfiles
                   4163:           on <a href=
1.1       grant    4164:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   4165:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   4166:           entire directory may not be appropriate.</p>
                   4167: 
1.14      xtraeme  4168:           <p>The answer here is to do a <span><strong class=
                   4169:           "command">make fetch-list</strong></span> in <code class=
                   4170:           "filename">/usr/pkgsrc</code> or one of it's
1.1       grant    4171:           subdirectories, carry the resulting list to your machine
                   4172:           at work/school and use it there If you don't have a
                   4173:           NetBSD-compatible ftp(1) (like lukemftp) at work, don't
1.14      xtraeme  4174:           forget to set <code class="varname">FETCH_CMD</code> to
1.1       grant    4175:           something that fetches a URL:</p>
                   4176: 
                   4177:           <p>At home:</p>
                   4178:           <pre class="screen">
1.14      xtraeme  4179: <code class="prompt">%</code> <strong class=
                   4180: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4181: <code class="prompt">%</code> <strong class=
                   4182: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   4183: <code class="prompt">%</code> <strong class=
                   4184: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    4185: </pre>
                   4186: 
                   4187:           <p>At work:</p>
                   4188:           <pre class="screen">
1.14      xtraeme  4189: <code class="prompt">%</code> <strong class=
                   4190: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    4191: </pre>
                   4192: 
1.14      xtraeme  4193:           <p>then tar up <code class=
                   4194:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    4195: 
                   4196:           <p>If you have a machine running NetBSD, and you want to
                   4197:           get <span class="emphasis"><em>all</em></span> distfiles
                   4198:           (even ones that aren't for your machine architecture),
                   4199:           you can do so by using the above-mentioned
1.14      xtraeme  4200:           <span><strong class="command">make
                   4201:           fetch-list</strong></span> approach, or fetch the
                   4202:           distfiles directly by running:</p>
1.1       grant    4203:           <pre class="screen">
1.14      xtraeme  4204: <code class="prompt">%</code> <strong class=
                   4205: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    4206: </pre>
                   4207: 
1.14      xtraeme  4208:           <p>If you even decide to ignore <code class=
                   4209:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   4210:           can get everything by running:</p>
1.1       grant    4211:           <pre class="screen">
1.14      xtraeme  4212: <code class="prompt">%</code> <strong class=
                   4213: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    4214: </pre>
                   4215:         </div>
                   4216: 
                   4217:         <div class="sect1" lang="en" xml:lang="en">
                   4218:           <div class="titlepage">
                   4219:             <div>
                   4220:               <div>
                   4221:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  4222:                 "id2585168" id="id2585168"></a>6.11.&nbsp;What does
1.1       grant    4223:                 &#8220;<span class="quote">Don't know how to make
                   4224:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   4225:               </div>
                   4226:             </div>
                   4227:           </div>
                   4228: 
                   4229:           <p>When compiling the <a xmlns=
                   4230:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4231:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14      xtraeme  4232:           class="pkgname">pkgtools/pkg_install</a> package, you get
                   4233:           the error from make that it doesn't know how to make
                   4234:           <code class="filename">/usr/share/tmac/tmac.andoc</code>?
                   4235:           This indicates that you don't have installed the
                   4236:           &#8220;<span class="quote">text</span>&#8221; set on your
                   4237:           machine (nroff, ...). It is recommended to do that to
                   4238:           format manpages.</p>
1.1       grant    4239: 
                   4240:           <p>In the case of the <a xmlns=
                   4241:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4242:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14      xtraeme  4243:           class="pkgname">pkgtools/pkg_install</a> package, you can
                   4244:           get away with setting <code class=
                   4245:           "varname">NOMAN=YES</code> either in the environment or
                   4246:           in <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    4247:         </div>
                   4248: 
                   4249:         <div class="sect1" lang="en" xml:lang="en">
                   4250:           <div class="titlepage">
                   4251:             <div>
                   4252:               <div>
                   4253:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  4254:                 "id2585206" id="id2585206"></a>6.12.&nbsp;What does
1.1       grant    4255:                 &#8220;<span class="quote">Could not find
                   4256:                 bsd.own.mk</span>&#8221; mean?</h2>
                   4257:               </div>
                   4258:             </div>
                   4259:           </div>
                   4260: 
1.14      xtraeme  4261:           <p>You didn't install the compiler set, <code class=
                   4262:           "filename">comp.tgz</code>, when you installed your
                   4263:           NetBSD machine. Please get it and install it, by
                   4264:           extracting it in <code class="filename">/</code>:</p>
1.1       grant    4265:           <pre class="screen">
1.14      xtraeme  4266: <code class="prompt">#</code> <strong class=
                   4267: "userinput"><code>cd /</code></strong>
                   4268: <code class="prompt">#</code> <strong class=
                   4269: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    4270: </pre>
                   4271: 
1.14      xtraeme  4272:           <p><code class="filename">comp.tgz</code> is part of
                   4273:           every NetBSD release. Get the one that corresponds to
                   4274:           your release (determine via <span><strong class=
                   4275:           "command">uname -r</strong></span>).</p>
1.1       grant    4276:         </div>
                   4277: 
                   4278:         <div class="sect1" lang="en" xml:lang="en">
                   4279:           <div class="titlepage">
                   4280:             <div>
                   4281:               <div>
                   4282:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  4283:                 "id2585264" id="id2585264"></a>6.13.&nbsp;Using
1.1       grant    4284:                 'sudo' with pkgsrc</h2>
                   4285:               </div>
                   4286:             </div>
                   4287:           </div>
                   4288: 
                   4289:           <p>When installing packages as non-root user and using
                   4290:           the just-in-time su(1) feature of pkgsrc, it can become
                   4291:           annoying to type in the root password for each required
                   4292:           package installed. To avoid this, the sudo package can be
                   4293:           used, which does password caching over a limited time. To
                   4294:           use it, install sudo (either as binary package or from
                   4295:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   4296:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.14      xtraeme  4297:           class="pkgname">security/sudo</a>) and then put the
                   4298:           following into your <code class=
                   4299:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4300:           <pre class="programlisting">
                   4301:         .if exists(/usr/pkg/bin/sudo)
                   4302:         SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
                   4303:         .endif
                   4304:     
                   4305: </pre>
                   4306:         </div>
                   4307: 
                   4308:         <div class="sect1" lang="en" xml:lang="en">
                   4309:           <div class="titlepage">
                   4310:             <div>
                   4311:               <div>
                   4312:                 <h2 class="title" style="clear: both"><a name=
                   4313:                 "faq.conf" id=
1.14      xtraeme  4314:                 "faq.conf"></a>6.14.&nbsp;Configuration files
1.1       grant    4315:                 handling and placement</h2>
                   4316:               </div>
                   4317:             </div>
                   4318:           </div>
                   4319: 
1.14      xtraeme  4320:           <p>The global variable <code class=
                   4321:           "varname">PKG_SYSCONFBASE</code> (and some others) can be
                   4322:           set by the system administrator in <code class=
                   4323:           "filename">/etc/mk.conf</code> to define the place where
1.1       grant    4324:           configuration files get installed. Therefore, packages
                   4325:           must be adapted to support this feature. Keep in mind
                   4326:           that you should only install files that are strictly
                   4327:           necessary in the configuration directory, files that can
1.14      xtraeme  4328:           go to <code class="filename">$PREFIX/share</code> should
                   4329:           go there.</p>
1.1       grant    4330: 
                   4331:           <p>We will take a look at available variables first
1.14      xtraeme  4332:           (<code class="filename">bsd.pkg.mk</code> contains more
                   4333:           information). <code class="varname">PKG_SYSCONFDIR</code>
                   4334:           is where the configuration files for a package may be
                   4335:           found (that is, the full path, e.g. <code class=
                   4336:           "filename">/etc</code> or <code class=
                   4337:           "filename">/usr/pkg/etc</code>). This value may be
1.1       grant    4338:           customized in various ways:</p>
                   4339: 
                   4340:           <div class="orderedlist">
                   4341:             <ol type="1">
                   4342:               <li>
1.14      xtraeme  4343:                 <p><code class="varname">PKG_SYSCONFBASE</code> is
                   4344:                 the main config directory under which all package
1.1       grant    4345:                 configuration files are to be found. Users will
1.14      xtraeme  4346:                 typically want to set it to <code class=
                   4347:                 "filename">/etc</code>, or accept the default
                   4348:                 location of <code class=
                   4349:                 "filename">$PREFIX/etc</code>.</p>
1.1       grant    4350:               </li>
                   4351: 
                   4352:               <li>
1.14      xtraeme  4353:                 <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   4354:                 is the subdirectory of <code class=
                   4355:                 "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    4356:                 configuration files for a particular package may be
1.14      xtraeme  4357:                 found. Defaults to <code class=
                   4358:                 "varname">${SYSCONFBASE}</code>.</p>
1.1       grant    4359:               </li>
                   4360: 
                   4361:               <li>
1.14      xtraeme  4362:                 <p><code class="varname">PKG_SYSCONFVAR</code> is
                   4363:                 the special suffix used to distinguish any
                   4364:                 overriding values for a particular package (see
                   4365:                 next item). It defaults to <code class=
                   4366:                 "varname">${PKGBASE}</code>, but for a collection
                   4367:                 of related packages that should all have the same
                   4368:                 <code class="varname">PKG_SYSCONFDIR</code> value,
                   4369:                 it can be set in each of the package Makefiles to a
                   4370:                 common value.</p>
1.1       grant    4371:               </li>
                   4372: 
                   4373:               <li>
1.14      xtraeme  4374:                 <p><code class=
                   4375:                 "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   4376:                 overrides the value of <code class=
                   4377:                 "varname">${PKG_SYSCONFDIR}</code> for packages
                   4378:                 with the same value for <code class=
                   4379:                 "varname">PKG_SYSCONFVAR</code>.</p>
1.1       grant    4380: 
                   4381:                 <p>As an example, all the various KDE packages may
1.14      xtraeme  4382:                 want to set <code class=
                   4383:                 "varname">PKG_SYSCONFVAR</code> to
                   4384:                 &#8220;<span class="quote">kde</span>&#8221; so
                   4385:                 admins can set <code class=
                   4386:                 "varname">PKG_SYSCONFDIR.kde</code> in <code class=
                   4387:                 "filename">/etc/mk.conf</code> to define where to
1.1       grant    4388:                 install KDE config files.</p>
                   4389:               </li>
                   4390:             </ol>
                   4391:           </div>
                   4392: 
                   4393:           <p>Programs' configuration directory should be defined
                   4394:           during the configure stage. Packages that use GNU
                   4395:           autoconf can usually do this by using the
                   4396:           &#8220;<span class="quote">--sysconfdir</span>&#8221;
                   4397:           parameter, but this brings some problems as we will see
                   4398:           now. When you change this pathname in packages, you
                   4399:           should not allow them to install files in that directory
                   4400:           directly. Instead they need to install those files under
1.14      xtraeme  4401:           <code class="filename">share/examples/${PKGNAME}</code>
                   4402:           so <code class="filename">PLIST</code> can register
                   4403:           them.</p>
1.1       grant    4404: 
                   4405:           <p>Once you have the required configuration files in
1.14      xtraeme  4406:           place (under the <code class=
                   4407:           "filename">share/examples</code> directory) the variable
                   4408:           <code class="varname">CONF_FILES</code> should be set to
                   4409:           copy them into <code class=
                   4410:           "varname">PKG_SYSCONFDIR</code>. The contents of this
                   4411:           variable is formed by pairs of filenames; the first
1.1       grant    4412:           element of the pair specifies the file inside the
1.14      xtraeme  4413:           examples directory (registered by <code class=
                   4414:           "filename">PLIST</code>) and the second element specifies
1.1       grant    4415:           the target file. This is done this way to allow binary
                   4416:           packages to place files in the right directory using
1.14      xtraeme  4417:           <code class="filename">INSTALL</code>/<code class=
                   4418:           "filename">DEINSTALL</code> scripts which are created
                   4419:           automatically. The package <code class=
                   4420:           "filename">Makefile</code> must also set <code class=
                   4421:           "varname">USE_PKGINSTALL=YES</code> to use these
1.1       grant    4422:           automatically generated scripts. The automatic copying of
                   4423:           config files can be toggled by setting the environment
1.14      xtraeme  4424:           variable <code class="varname">PKG_CONFIG</code> prior to
1.1       grant    4425:           package installation.</p>
                   4426: 
                   4427:           <p>Here is an example, taken from mail/mutt/Makefile:</p>
                   4428:           <pre class="programlisting">
                   4429:   EGDIR=            ${PREFIX}/share/doc/mutt/samples
                   4430: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   4431: </pre>
                   4432: 
                   4433:           <p>As you can see, this package installs configuration
1.14      xtraeme  4434:           files inside <code class="varname">EGDIR</code>, which
                   4435:           are registered by <code class="filename">PLIST</code>.
                   4436:           After that, the variable <code class=
                   4437:           "varname">CONF_FILES</code> lists the installed file
                   4438:           first and then the target file. Users will also get an
                   4439:           automatic message when files are installed using this
                   4440:           method.</p>
1.1       grant    4441:         </div>
                   4442: 
                   4443:         <div class="sect1" lang="en" xml:lang="en">
                   4444:           <div class="titlepage">
                   4445:             <div>
                   4446:               <div>
                   4447:                 <h2 class="title" style="clear: both"><a name=
                   4448:                 "audit-packages" id=
1.14      xtraeme  4449:                 "audit-packages"></a>6.15.&nbsp;Automated security
1.1       grant    4450:                 checks</h2>
                   4451:               </div>
                   4452:             </div>
                   4453:           </div>
                   4454: 
                   4455:           <p>Please be aware that there can often be bugs in
                   4456:           third-party software, and some of these bugs can leave a
                   4457:           machine vulnerable to exploitation by attackers. In an
                   4458:           effort to lessen the exposure, the NetBSD packages team
                   4459:           maintains a database of known-exploits to packages which
                   4460:           have at one time been included in pkgsrc. The database
                   4461:           can be downloaded automatically, and a security audit of
                   4462:           all packages installed on a system can take place. To do
                   4463:           this, install the <a xmlns=
                   4464:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4465:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.14      xtraeme  4466:           class="pkgname">security/audit-packages</a> package. It
                   4467:           has two components:</p>
1.1       grant    4468: 
                   4469:           <div class="orderedlist">
                   4470:             <ol type="1">
                   4471:               <li>
                   4472:                 <p>&#8220;<span class=
                   4473:                 "quote">download-vulnerability-list</span>&#8221;,
                   4474:                 an easy way to download a list of the security
                   4475:                 vulnerabilities information. This list is kept up
                   4476:                 to date by the NetBSD security officer and the
                   4477:                 NetBSD packages team, and is distributed from the
                   4478:                 NetBSD ftp server:</p>
                   4479: 
                   4480:                 <p><a href=
                   4481:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.14      xtraeme  4482:                 target=
                   4483:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    4484:               </li>
                   4485: 
                   4486:               <li>
                   4487:                 <p>&#8220;<span class=
                   4488:                 "quote">audit-packages</span>&#8221;, an easy way
                   4489:                 to audit the current machine, checking each
                   4490:                 vulnerability which is known. If a vulnerable
                   4491:                 package is installed, it will be shown by output to
                   4492:                 stdout, including a description of the type of
                   4493:                 vulnerability, and a URL containing more
                   4494:                 information.</p>
                   4495:               </li>
                   4496:             </ol>
                   4497:           </div>
                   4498: 
                   4499:           <p>Use of the audit-packages package is strongly
                   4500:           recommended!</p>
                   4501: 
                   4502:           <p>The following message is displayed as part of the
                   4503:           audit-packages installation procedure:</p>
                   4504:           <pre class="screen">
                   4505: ===========================================================================
1.16    ! grant    4506: $NetBSD: pkgsrc.html,v 1.15 2005/01/11 16:34:44 xtraeme Exp $
1.1       grant    4507: 
                   4508: You may wish to have the vulnerabilities file downloaded daily so that
                   4509: it remains current.  This may be done by adding an appropriate entry
                   4510: to the root users crontab(5) entry.  For example the entry
                   4511: 
                   4512: # download vulnerabilities file
                   4513: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list &gt;/dev/null 2&gt;&amp;1
                   4514: 
                   4515: will update the vulnerability list every day at 3AM. You may wish to do
                   4516: this more often than once a day.
                   4517: 
                   4518: In addition, you may wish to run the package audit from the daily
                   4519: security script.  This may be accomplished by adding the following
                   4520: lines to /etc/security.local
                   4521: 
                   4522: if [ -x ${PREFIX}/sbin/audit-packages ]; then
                   4523:           ${PREFIX}/sbin/audit-packages
                   4524: fi
                   4525: 
                   4526: ===========================================================================
                   4527:     
                   4528: </pre>
                   4529:         </div>
                   4530:       </div>
                   4531:     </div>
                   4532: 
                   4533:     <div class="part" lang="en" xml:lang="en">
                   4534:       <div class="titlepage">
                   4535:         <div>
                   4536:           <div>
                   4537:             <h1 class="title"><a name="developers-guide" id=
1.2       hubertf  4538:             "developers-guide"></a>The pkgsrc developer's
                   4539:             guide</h1>
1.1       grant    4540:           </div>
                   4541:         </div>
                   4542:       </div>
                   4543: 
                   4544:       <div class="toc">
                   4545:         <p><b>Table of Contents</b></p>
                   4546: 
                   4547:         <dl>
                   4548:           <dt><span class="chapter"><a href="#components">7.
                   4549:           Package components - files, directories and
                   4550:           contents</a></span></dt>
                   4551: 
                   4552:           <dd>
                   4553:             <dl>
                   4554:               <dt><span class="sect1"><a href=
1.14      xtraeme  4555:               "#components.Makefile">7.1. <code class=
                   4556:               "filename">Makefile</code></a></span></dt>
1.1       grant    4557: 
                   4558:               <dt><span class="sect1"><a href=
1.14      xtraeme  4559:               "#components.distinfo">7.2. <code class=
                   4560:               "filename">distinfo</code></a></span></dt>
1.1       grant    4561: 
                   4562:               <dt><span class="sect1"><a href=
                   4563:               "#components.patches">7.3. patches/*</a></span></dt>
                   4564: 
1.15      xtraeme  4565:               <dt><span class="sect1"><a href="#id2586445">7.4.
1.1       grant    4566:               Other mandatory files</a></span></dt>
                   4567: 
                   4568:               <dt><span class="sect1"><a href=
                   4569:               "#components.optional">7.5. Optional
                   4570:               files</a></span></dt>
                   4571: 
1.15      xtraeme  4572:               <dt><span class="sect1"><a href="#id2586640">7.6.
1.14      xtraeme  4573:               <code class="filename">work*</code></a></span></dt>
1.1       grant    4574: 
1.15      xtraeme  4575:               <dt><span class="sect1"><a href="#id2586727">7.7.
1.14      xtraeme  4576:               <code class="filename">files/*</code></a></span></dt>
1.1       grant    4577:             </dl>
                   4578:           </dd>
                   4579: 
                   4580:           <dt><span class="chapter"><a href="#plist">8. PLIST
                   4581:           issues</a></span></dt>
                   4582: 
                   4583:           <dd>
                   4584:             <dl>
1.15      xtraeme  4585:               <dt><span class="sect1"><a href="#id2586781">8.1. RCS
1.1       grant    4586:               ID</a></span></dt>
                   4587: 
1.15      xtraeme  4588:               <dt><span class="sect1"><a href="#id2586796">8.2.
1.14      xtraeme  4589:               Semi-automatic <code class="filename">PLIST</code>
                   4590:               generation</a></span></dt>
1.1       grant    4591: 
                   4592:               <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme  4593:               Tweaking output of <span><strong class="command">make
                   4594:               print-PLIST</strong></span></a></span></dt>
1.1       grant    4595: 
                   4596:               <dt><span class="sect1"><a href="#plist.misc">8.4.
                   4597:               Variable substitution in PLIST</a></span></dt>
                   4598: 
1.15      xtraeme  4599:               <dt><span class="sect1"><a href="#id2587186">8.5.
1.1       grant    4600:               Manpage-compression</a></span></dt>
                   4601: 
1.15      xtraeme  4602:               <dt><span class="sect1"><a href="#id2587227">8.6.
1.14      xtraeme  4603:               Changing PLIST source with <code class=
                   4604:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    4605: 
1.15      xtraeme  4606:               <dt><span class="sect1"><a href="#id2587244">8.7.
1.1       grant    4607:               Platform specific and differing
                   4608:               PLISTs</a></span></dt>
                   4609: 
                   4610:               <dt><span class="sect1"><a href=
                   4611:               "#faq.common-dirs">8.8. Sharing directories between
                   4612:               packages</a></span></dt>
                   4613:             </dl>
                   4614:           </dd>
                   4615: 
                   4616:           <dt><span class="chapter"><a href="#buildlink">9.
                   4617:           Buildlink methodology</a></span></dt>
                   4618: 
                   4619:           <dd>
                   4620:             <dl>
1.15      xtraeme  4621:               <dt><span class="sect1"><a href="#id2587653">9.1.
1.1       grant    4622:               Converting packages to use buildlink3</a></span></dt>
                   4623: 
1.15      xtraeme  4624:               <dt><span class="sect1"><a href="#id2587844">9.2.
1.14      xtraeme  4625:               Writing <code class="filename">buildlink3.mk</code>
                   4626:               files</a></span></dt>
1.1       grant    4627: 
                   4628:               <dd>
                   4629:                 <dl>
                   4630:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4631:                   "#id2587913">9.2.1. Anatomy of a buildlink3.mk
1.1       grant    4632:                   file</a></span></dt>
                   4633: 
                   4634:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4635:                   "#id2588354">9.2.2. Updating <code class=
1.14      xtraeme  4636:                   "varname">BUILDLINK_DEPENDS.<em class=
                   4637:                   "replaceable"><code>pkg</code></em></code> in
                   4638:                   <code class="filename">buildlink3.mk</code>
1.1       grant    4639:                   files</a></span></dt>
                   4640:                 </dl>
                   4641:               </dd>
                   4642: 
1.15      xtraeme  4643:               <dt><span class="sect1"><a href="#id2588433">9.3.
1.14      xtraeme  4644:               Writing <code class="filename">builtin.mk</code>
                   4645:               files</a></span></dt>
1.1       grant    4646: 
                   4647:               <dd>
                   4648:                 <dl>
                   4649:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4650:                   "#id2588582">9.3.1. Anatomy of a <code class=
1.14      xtraeme  4651:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    4652: 
                   4653:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4654:                   "#id2588877">9.3.2. Global preferences for native
1.1       grant    4655:                   or pkgsrc software</a></span></dt>
                   4656:                 </dl>
                   4657:               </dd>
                   4658:             </dl>
                   4659:           </dd>
                   4660: 
                   4661:           <dt><span class="chapter"><a href="#options">10. Options
                   4662:           handling</a></span></dt>
                   4663: 
                   4664:           <dd>
                   4665:             <dl>
1.15      xtraeme  4666:               <dt><span class="sect1"><a href="#id2588950">10.1.
1.1       grant    4667:               Global default options</a></span></dt>
                   4668: 
1.15      xtraeme  4669:               <dt><span class="sect1"><a href="#id2588965">10.2.
1.14      xtraeme  4670:               Converting packages to use <code class=
                   4671:               "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    4672:             </dl>
                   4673:           </dd>
                   4674: 
                   4675:           <dt><span class="chapter"><a href="#build">11. The build
                   4676:           process</a></span></dt>
                   4677: 
                   4678:           <dd>
                   4679:             <dl>
                   4680:               <dt><span class="sect1"><a href="#build.prefix">11.1.
                   4681:               Program location</a></span></dt>
                   4682: 
1.15      xtraeme  4683:               <dt><span class="sect1"><a href="#id2589573">11.2.
1.1       grant    4684:               Main targets</a></span></dt>
                   4685: 
                   4686:               <dt><span class="sect1"><a href=
                   4687:               "#build.helpful-targets">11.3. Other helpful
                   4688:               targets</a></span></dt>
                   4689:             </dl>
                   4690:           </dd>
                   4691: 
                   4692:           <dt><span class="chapter"><a href="#fixes">12. Notes on
                   4693:           fixes for packages</a></span></dt>
                   4694: 
                   4695:           <dd>
                   4696:             <dl>
1.15      xtraeme  4697:               <dt><span class="sect1"><a href="#id2590973">12.1.
1.1       grant    4698:               General operation</a></span></dt>
                   4699: 
                   4700:               <dd>
                   4701:                 <dl>
                   4702:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4703:                   "#id2590977">12.1.1. How to pull in variables
1.1       grant    4704:                   from /etc/mk.conf</a></span></dt>
                   4705: 
                   4706:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4707:                   "#id2591128">12.1.2. Restricted
1.1       grant    4708:                   packages</a></span></dt>
                   4709: 
                   4710:                   <dt><span class="sect2"><a href=
                   4711:                   "#dependencies">12.1.3. Handling
                   4712:                   dependencies</a></span></dt>
                   4713: 
                   4714:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4715:                   "#id2591643">12.1.4. Handling conflicts with
1.1       grant    4716:                   other packages</a></span></dt>
                   4717: 
                   4718:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4719:                   "#id2591762">12.1.5. Packages that cannot or
1.1       grant    4720:                   should not be built</a></span></dt>
                   4721: 
                   4722:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4723:                   "#id2591787">12.1.6. Packages which should not be
1.1       grant    4724:                   deleted, once installed</a></span></dt>
                   4725: 
                   4726:                   <dt><span class="sect2"><a href=
                   4727:                   "#security-handling">12.1.7. Handling packages
                   4728:                   with security problems</a></span></dt>
                   4729: 
                   4730:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4731:                   "#id2591879">12.1.8. How to handle compiler
1.1       grant    4732:                   bugs</a></span></dt>
                   4733: 
                   4734:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4735:                   "#id2591901">12.1.9. How to handle incrementing
1.1       grant    4736:                   versions when fixing an existing
                   4737:                   package</a></span></dt>
                   4738: 
                   4739:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4740:                   "#id2591950">12.1.10. Portability of
1.1       grant    4741:                   packages</a></span></dt>
                   4742:                 </dl>
                   4743:               </dd>
                   4744: 
1.15      xtraeme  4745:               <dt><span class="sect1"><a href="#id2591975">12.2.
1.1       grant    4746:               Possible downloading issues</a></span></dt>
                   4747: 
                   4748:               <dd>
                   4749:                 <dl>
                   4750:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4751:                   "#id2591978">12.2.1. Packages whose distfiles
1.1       grant    4752:                   aren't available for plain
                   4753:                   downloading</a></span></dt>
                   4754: 
                   4755:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4756:                   "#id2592109">12.2.2. How to handle modified
1.1       grant    4757:                   distfiles with the 'old' name</a></span></dt>
                   4758:                 </dl>
                   4759:               </dd>
                   4760: 
1.15      xtraeme  4761:               <dt><span class="sect1"><a href="#id2592121">12.3.
1.1       grant    4762:               Configuration gotchas</a></span></dt>
                   4763: 
                   4764:               <dd>
                   4765:                 <dl>
                   4766:                   <dt><span class="sect2"><a href=
                   4767:                   "#fixes.libtool">12.3.1. Shared libraries -
                   4768:                   libtool</a></span></dt>
                   4769: 
                   4770:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4771:                   "#id2592529">12.3.2. Using libtool on GNU
1.1       grant    4772:                   packages that already support
                   4773:                   libtool</a></span></dt>
                   4774: 
                   4775:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4776:                   "#id2592613">12.3.3. GNU
1.1       grant    4777:                   Autoconf/Automake</a></span></dt>
                   4778:                 </dl>
                   4779:               </dd>
                   4780: 
1.15      xtraeme  4781:               <dt><span class="sect1"><a href="#id2592726">12.4.
1.1       grant    4782:               Building considerations</a></span></dt>
                   4783: 
                   4784:               <dd>
                   4785:                 <dl>
                   4786:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4787:                   "#id2592729">12.4.1. CPP defines</a></span></dt>
1.1       grant    4788:                 </dl>
                   4789:               </dd>
                   4790: 
1.15      xtraeme  4791:               <dt><span class="sect1"><a href="#id2592759">12.5.
1.1       grant    4792:               Package specific actions</a></span></dt>
                   4793: 
                   4794:               <dd>
                   4795:                 <dl>
                   4796:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4797:                   "#id2592762">12.5.1. Package configuration
1.1       grant    4798:                   files</a></span></dt>
                   4799: 
                   4800:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4801:                   "#id2592933">12.5.2. User
1.2       hubertf  4802:                   interaction</a></span></dt>
1.1       grant    4803: 
                   4804:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4805:                   "#id2593046">12.5.3. Handling
1.1       grant    4806:                   licenses</a></span></dt>
                   4807: 
                   4808:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4809:                   "#id2593197">12.5.4. Creating an account from a
1.1       grant    4810:                   package</a></span></dt>
                   4811: 
                   4812:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4813:                   "#id2593328">12.5.5. Installing score
1.1       grant    4814:                   files</a></span></dt>
                   4815: 
                   4816:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4817:                   "#id2593371">12.5.6. Packages providing login
1.1       grant    4818:                   shells</a></span></dt>
                   4819: 
                   4820:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4821:                   "#id2593429">12.5.7. Packages containing perl
1.1       grant    4822:                   scripts</a></span></dt>
                   4823: 
                   4824:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4825:                   "#id2593447">12.5.8. Packages with hardcoded
1.1       grant    4826:                   paths to other interpreters</a></span></dt>
                   4827: 
                   4828:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4829:                   "#id2593468">12.5.9. Packages installing perl
1.1       grant    4830:                   modules</a></span></dt>
                   4831: 
                   4832:                   <dt><span class="sect2"><a href=
                   4833:                   "#faq.info-files">12.5.10. Packages installing
                   4834:                   info files</a></span></dt>
                   4835: 
                   4836:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4837:                   "#id2593688">12.5.11. Packages installing GConf2
1.1       grant    4838:                   data files</a></span></dt>
                   4839: 
                   4840:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4841:                   "#id2593788">12.5.12. Packages installing
1.1       grant    4842:                   scrollkeeper data files</a></span></dt>
                   4843: 
                   4844:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4845:                   "#id2593840">12.5.13. Packages installing X11
1.1       grant    4846:                   fonts</a></span></dt>
                   4847: 
                   4848:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4849:                   "#id2593886">12.5.14. Packages installing GTK2
1.1       grant    4850:                   modules</a></span></dt>
                   4851: 
                   4852:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4853:                   "#id2593956">12.5.15. Packages installing SGML or
1.1       grant    4854:                   XML data</a></span></dt>
                   4855: 
                   4856:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4857:                   "#id2594076">12.5.16. Packages installing
1.1       grant    4858:                   extensions to the MIME database</a></span></dt>
                   4859: 
                   4860:                   <dt><span class="sect2"><a href=
1.15      xtraeme  4861:                   "#id2594283">12.5.17. Packages using
1.1       grant    4862:                   intltool</a></span></dt>
                   4863:                 </dl>
                   4864:               </dd>
                   4865: 
1.15      xtraeme  4866:               <dt><span class="sect1"><a href="#id2594297">12.6.
1.1       grant    4867:               Feedback to the author</a></span></dt>
                   4868:             </dl>
                   4869:           </dd>
                   4870: 
                   4871:           <dt><span class="chapter"><a href="#debug">13.
                   4872:           Debugging</a></span></dt>
                   4873: 
                   4874:           <dt><span class="chapter"><a href="#submit">14.
                   4875:           Submitting and Committing</a></span></dt>
                   4876: 
                   4877:           <dd>
                   4878:             <dl>
1.15      xtraeme  4879:               <dt><span class="sect1"><a href="#id2594827">14.1.
1.1       grant    4880:               Submitting your packages</a></span></dt>
                   4881: 
1.15      xtraeme  4882:               <dt><span class="sect1"><a href="#id2594878">14.2.
1.1       grant    4883:               Committing: Importing a package into
                   4884:               CVS</a></span></dt>
                   4885: 
1.15      xtraeme  4886:               <dt><span class="sect1"><a href="#id2594941">14.3.
1.2       hubertf  4887:               Updating a package to a newer version</a></span></dt>
1.1       grant    4888: 
1.15      xtraeme  4889:               <dt><span class="sect1"><a href="#id2594961">14.4.
1.2       hubertf  4890:               Moving a package in pkgsrc</a></span></dt>
1.1       grant    4891:             </dl>
                   4892:           </dd>
                   4893:         </dl>
                   4894:       </div>
                   4895: 
                   4896:       <div class="chapter" lang="en" xml:lang="en">
                   4897:         <div class="titlepage">
                   4898:           <div>
                   4899:             <div>
                   4900:               <h2 class="title"><a name="components" id=
                   4901:               "components"></a>Chapter&nbsp;7.&nbsp;Package
                   4902:               components - files, directories and contents</h2>
                   4903:             </div>
                   4904:           </div>
                   4905:         </div>
                   4906: 
                   4907:         <div class="toc">
                   4908:           <p><b>Table of Contents</b></p>
                   4909: 
                   4910:           <dl>
                   4911:             <dt><span class="sect1"><a href=
1.14      xtraeme  4912:             "#components.Makefile">7.1. <code class=
                   4913:             "filename">Makefile</code></a></span></dt>
1.1       grant    4914: 
                   4915:             <dt><span class="sect1"><a href=
1.14      xtraeme  4916:             "#components.distinfo">7.2. <code class=
                   4917:             "filename">distinfo</code></a></span></dt>
1.1       grant    4918: 
                   4919:             <dt><span class="sect1"><a href=
                   4920:             "#components.patches">7.3. patches/*</a></span></dt>
                   4921: 
1.15      xtraeme  4922:             <dt><span class="sect1"><a href="#id2586445">7.4. Other
1.1       grant    4923:             mandatory files</a></span></dt>
                   4924: 
                   4925:             <dt><span class="sect1"><a href=
                   4926:             "#components.optional">7.5. Optional
                   4927:             files</a></span></dt>
                   4928: 
1.15      xtraeme  4929:             <dt><span class="sect1"><a href="#id2586640">7.6.
1.14      xtraeme  4930:             <code class="filename">work*</code></a></span></dt>
1.1       grant    4931: 
1.15      xtraeme  4932:             <dt><span class="sect1"><a href="#id2586727">7.7.
1.14      xtraeme  4933:             <code class="filename">files/*</code></a></span></dt>
1.1       grant    4934:           </dl>
                   4935:         </div>
                   4936: 
                   4937:         <p>Whenever you're preparing a package, there are a number
                   4938:         of files involved which are described in the following
                   4939:         sections.</p>
                   4940: 
                   4941:         <div class="sect1" lang="en" xml:lang="en">
                   4942:           <div class="titlepage">
                   4943:             <div>
                   4944:               <div>
                   4945:                 <h2 class="title" style="clear: both"><a name=
                   4946:                 "components.Makefile" id=
1.14      xtraeme  4947:                 "components.Makefile"></a>7.1.&nbsp;<code class=
                   4948:                 "filename">Makefile</code></h2>
1.1       grant    4949:               </div>
                   4950:             </div>
                   4951:           </div>
                   4952: 
                   4953:           <p>Building, installation and creation of a binary
1.14      xtraeme  4954:           package are all controlled by the package's <code class=
                   4955:           "filename">Makefile</code>.</p>
1.1       grant    4956: 
1.14      xtraeme  4957:           <p>There is a <code class="filename">Makefile</code> for
                   4958:           each package. This file includes the standard
                   4959:           <code class="filename">bsd.pkg.mk</code> file (referenced
                   4960:           as <code class="filename">../../mk/bsd.pkg.mk</code>),
                   4961:           which sets all the definitions and actions necessary for
                   4962:           the package to compile and install itself. The mandatory
                   4963:           variables are the <code class="varname">DISTNAME</code>
                   4964:           which specifies the base name of the distribution file to
                   4965:           be downloaded from the site on the Internet, <code class=
                   4966:           "varname">MASTER_SITES</code> which specifies that site,
                   4967:           <code class="varname">CATEGORIES</code> which denotes the
                   4968:           categories into which the package falls, <code class=
                   4969:           "varname">PKGNAME</code> which is the name of the
                   4970:           package, the <code class="varname">MAINTAINER</code>'s
                   4971:           name, and the <code class="varname">COMMENT</code>
                   4972:           variable, which should contain a one-line description of
                   4973:           the package (the package name should not appear, it will
                   4974:           be added automatically). The maintainer variable is there
                   4975:           so that anyone who quibbles with the (always completely
                   4976:           correct) decisions taken by the guy who maintains the
                   4977:           package can complain vigorously, or send chocolate as a
                   4978:           sign of appreciation.</p>
1.1       grant    4979: 
1.14      xtraeme  4980:           <p>The <code class="varname">MASTER_SITES</code> may be
                   4981:           set to one of the predefined sites:</p>
1.1       grant    4982:           <pre class="programlisting">
                   4983:         ${MASTER_SITE_APACHE}
                   4984:         ${MASTER_SITE_DEBIAN}
                   4985:         ${MASTER_SITE_GNOME}
                   4986:         ${MASTER_SITE_GNU}
                   4987:         ${MASTER_SITE_GNUSTEP}
1.9       dillo    4988:         ${MASTER_SITE_IFARCHIVE}
1.1       grant    4989:         ${MASTER_SITE_MOZILLA}
                   4990:         ${MASTER_SITE_PERL_CPAN}
                   4991:         ${MASTER_SITE_SOURCEFORGE}
                   4992:         ${MASTER_SITE_SUNSITE}
                   4993:         ${MASTER_SITE_R_CRAN}
                   4994:         ${MASTER_SITE_SUSE}
                   4995:         ${MASTER_SITE_TEX_CTAN}
                   4996:         ${MASTER_SITE_XCONTRIB}
                   4997:         ${MASTER_SITE_XEMACS} 
                   4998: </pre>
                   4999: 
                   5000:           <p>If one of these predefined sites is chosen, you may
                   5001:           require the ability to specify a subdirectory of that
                   5002:           site. Since these macros may expand to more than one
                   5003:           actual site, you <span class=
                   5004:           "emphasis"><em>must</em></span> use the following
                   5005:           construct to specify a subdirectory:</p>
                   5006:           <pre class="programlisting">
                   5007:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   5008:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   5009: </pre>
                   5010: 
                   5011:           <p>Note the trailing slash after the subdirectory
                   5012:           name.</p>
                   5013: 
                   5014:           <div class="note" style=
                   5015:           "margin-left: 0.5in; margin-right: 0.5in;">
                   5016:             <h3 class="title">Note</h3>
                   5017: 
1.14      xtraeme  5018:             <p><code class="varname">MASTER_SITE_SUBDIR</code> has
                   5019:             been deprecated and <span class="emphasis"><em>should
                   5020:             no longer be used</em></span>.</p>
1.1       grant    5021:           </div>
                   5022: 
1.14      xtraeme  5023:           <p>If the package has multiple <code class=
                   5024:           "varname">DISTFILES</code> or multiple <code class=
                   5025:           "varname">PATCHFILES</code> from different sites, set
                   5026:           <code class="varname">SITES_foo</code> to a list of URI's
1.1       grant    5027:           where file &#8220;<span class="quote">foo</span>&#8221;
                   5028:           may be found. &#8220;<span class=
                   5029:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   5030:           <pre class="programlisting">
                   5031: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   5032: DISTFILES+=     foo-file.tar.gz
                   5033: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   5034:         http://www.somewhereelse.com/mirror/somehow/
                   5035: </pre>
                   5036: 
1.14      xtraeme  5037:           <p>Note that the normal default setting of <code class=
                   5038:           "varname">DISTFILES</code> must be made explicit if you
1.1       grant    5039:           want to add to it (rather than replace it), as you
                   5040:           usually would.</p>
                   5041: 
                   5042:           <p>Currently the following values are available for
1.14      xtraeme  5043:           <code class="varname">CATEGORIES</code>. If more than one
                   5044:           is used, they need to be separated by spaces:</p>
1.1       grant    5045:           <pre class="programlisting">
                   5046: archivers     cross         geography     meta-pkgs     security
                   5047: audio         databases     graphics      misc          shells
                   5048: benchmarks    devel         ham           multimedia    sysutils
                   5049: biology       editors       inputmethod   net           textproc
                   5050: cad           emulators     lang          news          time
                   5051: chat          finance       mail          parallel      wm
                   5052: comms         fonts         math          pkgtools      www
                   5053: converters    games         mbone         print         x11
                   5054: </pre>
                   5055: 
                   5056:           <p>Please pay attention to the following gotchas:</p>
                   5057: 
                   5058:           <div class="itemizedlist">
                   5059:             <ul type="disc">
                   5060:               <li>
1.14      xtraeme  5061:                 <p>Add <code class="varname">MANCOMPRESSED</code>
                   5062:                 if manpages are installed in compressed form by the
                   5063:                 package; see comment in <code class=
                   5064:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    5065:               </li>
                   5066: 
                   5067:               <li>
1.14      xtraeme  5068:                 <p>Replace <code class="filename">/usr/local</code>
1.1       grant    5069:                 with &#8220;<span class=
                   5070:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   5071:                 patches, below).</p>
                   5072:               </li>
                   5073: 
                   5074:               <li>
                   5075:                 <p>If the package installs any info files, see
                   5076:                 <a href="#faq.info-files" title=
                   5077:                 "12.5.10.&nbsp;Packages installing info files">Section
                   5078:                 12.5.10, &#8220;Packages installing info
                   5079:                 files&#8221;</a>.</p>
                   5080:               </li>
                   5081: 
                   5082:               <li>
1.14      xtraeme  5083:                 <p>Set <code class="varname">MAINTAINER</code> to
                   5084:                 be yourself. If you really can't maintain the
                   5085:                 package for future updates, set it to <code class=
1.1       grant    5086:                 "email">&lt;<a href=
1.14      xtraeme  5087:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.1       grant    5088:               </li>
                   5089: 
                   5090:               <li>
                   5091:                 <p>If a home page for the software in question
1.14      xtraeme  5092:                 exists, add the variable <code class=
                   5093:                 "varname">HOMEPAGE</code> right after <code class=
                   5094:                 "varname">MAINTAINER</code>. The value of this
1.1       grant    5095:                 variable should be the URL for the home page.</p>
                   5096:               </li>
                   5097: 
                   5098:               <li>
1.14      xtraeme  5099:                 <p>Be sure to set the <code class=
                   5100:                 "varname">COMMENT</code> variable to a short
1.1       grant    5101:                 description of the package, not containing the
                   5102:                 pkg's name.</p>
                   5103:               </li>
                   5104:             </ul>
                   5105:           </div>
                   5106:         </div>
                   5107: 
                   5108:         <div class="sect1" lang="en" xml:lang="en">
                   5109:           <div class="titlepage">
                   5110:             <div>
                   5111:               <div>
                   5112:                 <h2 class="title" style="clear: both"><a name=
                   5113:                 "components.distinfo" id=
1.14      xtraeme  5114:                 "components.distinfo"></a>7.2.&nbsp;<code class=
                   5115:                 "filename">distinfo</code></h2>
1.1       grant    5116:               </div>
                   5117:             </div>
                   5118:           </div>
                   5119: 
                   5120:           <p>Most important, the mandatory message digest, or
                   5121:           checksum, of all the distfiles needed for the package to
                   5122:           compile, confirming they match the original file
                   5123:           distributed by the author. This ensures that the distfile
                   5124:           retrieved from the Internet has not been corrupted during
                   5125:           transfer or altered by a malign force to introduce a
1.14      xtraeme  5126:           security hole. It is generated using the
                   5127:           <span><strong class="command">make
                   5128:           makesum</strong></span> command. The digest algorithm
                   5129:           used was, at one stage, md5, but that was felt lacking
                   5130:           compared to sha1, and so sha1 is now the default
1.1       grant    5131:           algorithm. The distfile size is also generated and stored
                   5132:           in new distinfo files. The <a xmlns=
                   5133:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5134:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.14      xtraeme  5135:           class="pkgname">pkgtools/digest</a> utility calculates
                   5136:           all of the digests in the distinfo file, and it provides
                   5137:           various different algorithms. At the current time, the
                   5138:           algorithms provided are: <span class=
                   5139:           "emphasis"><em>md5</em></span>, <span class=
                   5140:           "emphasis"><em>rmd160</em></span>, <span class=
                   5141:           "emphasis"><em>sha1</em></span>, <span class=
                   5142:           "emphasis"><em>sha256</em></span>, <span class=
                   5143:           "emphasis"><em>sha384</em></span> and <span class=
                   5144:           "emphasis"><em>sha512</em></span>.</p>
1.1       grant    5145: 
                   5146:           <p>Some packages have different sets of distfiles on a
                   5147:           per architecture basis, for example <a xmlns=
                   5148:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5149:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.14      xtraeme  5150:           class="pkgname">www/navigator</a>). These are kept in the
                   5151:           same distinfo file and care should be taken when
                   5152:           upgrading such a package to ensure distfile information
                   5153:           is not lost.</p>
1.1       grant    5154: 
                   5155:           <p>The message digest/checksum for all the official
1.14      xtraeme  5156:           patches found in the <code class=
                   5157:           "filename">patches/</code> directory (see <a href=
                   5158:           "#components.patches" title=
1.1       grant    5159:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   5160:           &#8220;patches/*&#8221;</a>) for the package is also
1.14      xtraeme  5161:           stored in the <code class="filename">distinfo</code>
                   5162:           file. This is a message digest/checksum of all lines in
                   5163:           the patch file except the NetBSD RCS Id. This file is
                   5164:           generated by invoking <span><strong class="command">make
                   5165:           makepatchsum</strong></span> (or <span><strong class=
                   5166:           "command">make mps</strong></span> if you're in a
                   5167:           hurry).</p>
1.1       grant    5168:         </div>
                   5169: 
                   5170:         <div class="sect1" lang="en" xml:lang="en">
                   5171:           <div class="titlepage">
                   5172:             <div>
                   5173:               <div>
                   5174:                 <h2 class="title" style="clear: both"><a name=
                   5175:                 "components.patches" id=
                   5176:                 "components.patches"></a>7.3.&nbsp;patches/*</h2>
                   5177:               </div>
                   5178:             </div>
                   5179:           </div>
                   5180: 
                   5181:           <p>This directory contains files that are used by the
                   5182:           <a href=
                   5183:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   5184:           <span class="citerefentry"><span class=
                   5185:           "refentrytitle">patch</span>(1)</span></a> command to
                   5186:           modify the sources as distributed in the distribution
                   5187:           file into a form that will compile and run perfectly on
                   5188:           NetBSD. The files are applied successively in alphabetic
                   5189:           order (as returned by a shell &#8220;<span class=
                   5190:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.14      xtraeme  5191:           <code class="filename">patch-aa</code> is applied before
                   5192:           <code class="filename">patch-ab</code>, etc.</p>
1.1       grant    5193: 
1.14      xtraeme  5194:           <p>The <code class="filename">patch-*</code> files should
                   5195:           be in <span><strong class="command">diff
                   5196:           -bu</strong></span> format, and apply without a fuzz to
                   5197:           avoid problems. (To force patches to apply with fuzz you
                   5198:           can set <code class=
                   5199:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    5200:           not put changes for more than one file into a single
                   5201:           patch-file, as this will make future modifications more
                   5202:           difficult.</p>
                   5203: 
                   5204:           <p>Similar, a file should be patched at most once, not
                   5205:           several times by several different patches. If a file
                   5206:           needs several patches, they should be combined into one
                   5207:           file.</p>
                   5208: 
                   5209:           <p>One important thing to mention is to pay attention
                   5210:           that no RCS IDs get stored in the patch files, as these
                   5211:           will cause problems when later checked into the NetBSD
1.14      xtraeme  5212:           CVS tree. Use the <span><strong class=
                   5213:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    5214:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5215:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14      xtraeme  5216:           class="pkgname">pkgtools/pkgdiff</a> package to avoid
                   5217:           these problems.</p>
1.1       grant    5218: 
                   5219:           <p>For even more automation, we recommend using
1.14      xtraeme  5220:           <span><strong class="command">mkpatches</strong></span>
                   5221:           from the same package to make a whole set of patches. You
                   5222:           just have to backup files before you edit them to
                   5223:           <code class="filename">filename.orig</code>, e.g. with
                   5224:           <span><strong class="command">cp -p filename
                   5225:           filename.orig</strong></span> or, easier, by using
                   5226:           <span><strong class="command">pkgvi</strong></span> again
                   5227:           from the same package. If you upgrade a package this way,
                   5228:           you can easily compare the new set of patches with the
                   5229:           previously existing one with <span><strong class=
                   5230:           "command">patchdiff</strong></span>.</p>
1.1       grant    5231: 
                   5232:           <p>When you have finished a package, remember to generate
                   5233:           the checksums for the patch files by using the
1.14      xtraeme  5234:           <span><strong class="command">make
                   5235:           makepatchsum</strong></span> command, see <a href=
                   5236:           "#components.distinfo" title=
1.5       hubertf  5237:           "7.2.&nbsp;distinfo">Section&nbsp;7.2,
1.14      xtraeme  5238:           &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    5239: 
                   5240:           <p>Patch files that are distributed by the author or
1.14      xtraeme  5241:           other maintainers can be listed in <code class=
                   5242:           "varname">$PATCHFILES</code>.</p>
1.1       grant    5243: 
                   5244:           <p>If it is desired to store any patches that should not
                   5245:           be committed into pkgsrc, they can be kept outside the
1.14      xtraeme  5246:           pkgsrc tree in the <code class=
                   5247:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    5248:           tree there is expected to have the same
                   5249:           &#8220;<span class="quote">category/package</span>&#8221;
                   5250:           structure as pkgsrc, and patches are expected to be
1.14      xtraeme  5251:           stored inside these dirs (also known as <code class=
                   5252:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
                   5253:           you want to keep a private patch for <code class=
                   5254:           "filename">pkgsrc/graphics/png</code>, keep it in
                   5255:           <code class=
                   5256:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   5257:           files in the named directory are expected to be patch
1.1       grant    5258:           files, and <span class="emphasis"><em>they are applied
                   5259:           after pkgsrc patches are applied</em></span>.</p>
                   5260:         </div>
                   5261: 
                   5262:         <div class="sect1" lang="en" xml:lang="en">
                   5263:           <div class="titlepage">
                   5264:             <div>
                   5265:               <div>
                   5266:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  5267:                 "id2586445" id="id2586445"></a>7.4.&nbsp;Other
1.1       grant    5268:                 mandatory files</h2>
                   5269:               </div>
                   5270:             </div>
                   5271:           </div>
                   5272: 
                   5273:           <div class="variablelist">
                   5274:             <dl>
1.14      xtraeme  5275:               <dt><span class="term"><code class=
                   5276:               "filename">DESCR</code></span></dt>
1.1       grant    5277: 
                   5278:               <dd>
                   5279:                 <p>A multi-line description of the piece of
                   5280:                 software. This should include any credits where
                   5281:                 they are due. Please bear in mind that others do
                   5282:                 not share your sense of humour (or spelling
                   5283:                 idiosyncrasies), and that others will read
                   5284:                 everything that you write here.</p>
                   5285:               </dd>
                   5286: 
1.14      xtraeme  5287:               <dt><span class="term"><code class=
                   5288:               "filename">PLIST</code></span></dt>
1.1       grant    5289: 
                   5290:               <dd>
                   5291:                 <p>This file governs the files that are installed
                   5292:                 on your system: all the binaries, manual pages,
                   5293:                 etc. There are other directives which may be
                   5294:                 entered in this file, to control the creation and
                   5295:                 deletion of directories, and the location of
                   5296:                 inserted files. See <a href="#plist" title=
                   5297:                 "Chapter&nbsp;8.&nbsp;PLIST issues">Chapter&nbsp;8,
                   5298:                 <i>PLIST issues</i></a> for more information.</p>
                   5299:               </dd>
                   5300:             </dl>
                   5301:           </div>
                   5302:         </div>
                   5303: 
                   5304:         <div class="sect1" lang="en" xml:lang="en">
                   5305:           <div class="titlepage">
                   5306:             <div>
                   5307:               <div>
                   5308:                 <h2 class="title" style="clear: both"><a name=
                   5309:                 "components.optional" id=
                   5310:                 "components.optional"></a>7.5.&nbsp;Optional
                   5311:                 files</h2>
                   5312:               </div>
                   5313:             </div>
                   5314:           </div>
                   5315: 
                   5316:           <div class="variablelist">
                   5317:             <dl>
1.14      xtraeme  5318:               <dt><span class="term"><code class=
                   5319:               "filename">INSTALL</code></span></dt>
1.1       grant    5320: 
                   5321:               <dd>
                   5322:                 <p>This shell script is invoked twice by <a href=
                   5323:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5324:                 <span class="citerefentry"><span class=
                   5325:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   5326:                 time after package extraction and before files are
                   5327:                 moved in place, the second time after the files to
                   5328:                 install are moved in place. This can be used to do
                   5329:                 any custom procedures not possible with @exec
1.14      xtraeme  5330:                 commands in <code class="filename">PLIST</code>.
                   5331:                 See <a href=
1.1       grant    5332:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5333:                 <span class="citerefentry"><span class=
                   5334:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   5335:                 <a href=
                   5336:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5337:                 <span class="citerefentry"><span class=
                   5338:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5339:                 more information.</p>
                   5340:               </dd>
                   5341: 
1.14      xtraeme  5342:               <dt><span class="term"><code class=
                   5343:               "filename">DEINSTALL</code></span></dt>
1.1       grant    5344: 
                   5345:               <dd>
                   5346:                 <p>This script is executed before and after any
                   5347:                 files are removed. It is this script's
                   5348:                 responsibility to clean up any additional messy
                   5349:                 details around the package's installation, since
                   5350:                 all pkg_delete knows is how to delete the files
                   5351:                 created in the original distribution. See <a href=
                   5352:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   5353:                 <span class="citerefentry"><span class=
                   5354:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   5355:                 <a href=
                   5356:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5357:                 <span class="citerefentry"><span class=
                   5358:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5359:                 more information.</p>
                   5360:               </dd>
                   5361: 
1.14      xtraeme  5362:               <dt><span class="term"><code class=
                   5363:               "filename">MESSAGE</code></span></dt>
1.1       grant    5364: 
                   5365:               <dd>
                   5366:                 <p>Display this file after installation of the
                   5367:                 package. Useful for things like legal notices on
                   5368:                 almost-free software and hints for updating config
                   5369:                 files after installing modules for apache, PHP etc.
                   5370:                 Please note that you can modify variables in it
1.14      xtraeme  5371:                 easily by using <code class=
                   5372:                 "varname">MESSAGE_SUBST</code> in the package's
                   5373:                 <code class="filename">Makefile</code>:</p>
1.1       grant    5374:                 <pre class="programlisting">
                   5375: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   5376: </pre>
                   5377: 
                   5378:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.14      xtraeme  5379:                 "quote">somevalue</span>&#8221; in <code class=
                   5380:                 "filename">MESSAGE</code>.</p>
1.1       grant    5381:               </dd>
                   5382:             </dl>
                   5383:           </div>
                   5384:         </div>
                   5385: 
                   5386:         <div class="sect1" lang="en" xml:lang="en">
                   5387:           <div class="titlepage">
                   5388:             <div>
                   5389:               <div>
                   5390:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  5391:                 "id2586640" id=
                   5392:                 "id2586640"></a>7.6.&nbsp;<code class=
1.14      xtraeme  5393:                 "filename">work*</code></h2>
1.1       grant    5394:               </div>
                   5395:             </div>
                   5396:           </div>
                   5397: 
1.14      xtraeme  5398:           <p>When you type <span><strong class=
                   5399:           "command">make</strong></span> the distribution files are
                   5400:           unpacked into this directory. It can be removed by
                   5401:           running <span><strong class="command">make
                   5402:           clean</strong></span>. Besides the sources, this
                   5403:           directory is also used to keep various timestamp
1.1       grant    5404:           files.</p>
                   5405: 
                   5406:           <p>If a package doesn't create a subdirectory for itself
                   5407:           (like GNU software does, for instance), but extracts
                   5408:           itself in the current directory, you should set
1.14      xtraeme  5409:           <code class="varname">WRKSRC</code> accordingly, e.g.
1.1       grant    5410:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   5411:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.14      xtraeme  5412:           class="pkgname">editors/sam</a> again, but the quick
                   5413:           answer is:</p>
1.1       grant    5414:           <pre class="programlisting">
                   5415: WRKSRC=                ${WRKDIR}
                   5416: </pre>
                   5417: 
1.14      xtraeme  5418:           <p>Please note that the old <code class=
                   5419:           "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1       grant    5420:           should not be used. Also, if your package doesn't create
1.14      xtraeme  5421:           a subdir with the name of <code class=
                   5422:           "varname">DISTNAME</code> but some different name, set
                   5423:           <code class="varname">WRKSRC</code> to point to the
                   5424:           proper name in <code class="filename">${WRKDIR}</code>.
                   5425:           See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5426:           href=
1.1       grant    5427:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.14      xtraeme  5428:           class="pkgname">lang/tcl</a> and <a xmlns=
                   5429:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5430:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   5431:           class="pkgname">x11/tk</a> for examples, and here is
                   5432:           another one:</p>
1.1       grant    5433:           <pre class="programlisting">
                   5434: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   5435: </pre>
                   5436: 
                   5437:           <p>The name of the working directory created by pkgsrc is
1.14      xtraeme  5438:           <code class="filename">work</code> by default. If the
                   5439:           same pkgsrc tree should be used on several different
                   5440:           platforms, the variable <code class=
                   5441:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1       grant    5442:           attach the platform to the directory name, e.g.
1.14      xtraeme  5443:           <code class="filename">work.i386</code> or <code class=
                   5444:           "filename">work.sparc</code>.</p>
1.1       grant    5445:         </div>
                   5446: 
                   5447:         <div class="sect1" lang="en" xml:lang="en">
                   5448:           <div class="titlepage">
                   5449:             <div>
                   5450:               <div>
                   5451:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  5452:                 "id2586727" id=
                   5453:                 "id2586727"></a>7.7.&nbsp;<code class=
1.14      xtraeme  5454:                 "filename">files/*</code></h2>
1.1       grant    5455:               </div>
                   5456:             </div>
                   5457:           </div>
                   5458: 
                   5459:           <p>If you have any files that you wish to be placed in
                   5460:           the package prior to configuration or building, you could
                   5461:           place these files here and use a &#8220;<span class=
                   5462:           "quote">${CP}</span>&#8221; command in the
                   5463:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   5464:           target to achieve this. Alternatively, you could simply
1.14      xtraeme  5465:           diff the file against <code class=
                   5466:           "filename">/dev/null</code> and use the patch mechanism
                   5467:           to manage the creation of this file.</p>
1.1       grant    5468:         </div>
                   5469:       </div>
                   5470: 
                   5471:       <div class="chapter" lang="en" xml:lang="en">
                   5472:         <div class="titlepage">
                   5473:           <div>
                   5474:             <div>
                   5475:               <h2 class="title"><a name="plist" id=
                   5476:               "plist"></a>Chapter&nbsp;8.&nbsp;PLIST issues</h2>
                   5477:             </div>
                   5478:           </div>
                   5479:         </div>
                   5480: 
                   5481:         <div class="toc">
                   5482:           <p><b>Table of Contents</b></p>
                   5483: 
                   5484:           <dl>
1.15      xtraeme  5485:             <dt><span class="sect1"><a href="#id2586781">8.1. RCS
1.1       grant    5486:             ID</a></span></dt>
                   5487: 
1.15      xtraeme  5488:             <dt><span class="sect1"><a href="#id2586796">8.2.
1.14      xtraeme  5489:             Semi-automatic <code class="filename">PLIST</code>
                   5490:             generation</a></span></dt>
1.1       grant    5491: 
                   5492:             <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme  5493:             Tweaking output of <span><strong class="command">make
                   5494:             print-PLIST</strong></span></a></span></dt>
1.1       grant    5495: 
                   5496:             <dt><span class="sect1"><a href="#plist.misc">8.4.
                   5497:             Variable substitution in PLIST</a></span></dt>
                   5498: 
1.15      xtraeme  5499:             <dt><span class="sect1"><a href="#id2587186">8.5.
1.1       grant    5500:             Manpage-compression</a></span></dt>
                   5501: 
1.15      xtraeme  5502:             <dt><span class="sect1"><a href="#id2587227">8.6.
1.14      xtraeme  5503:             Changing PLIST source with <code class=
                   5504:             "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5505: 
1.15      xtraeme  5506:             <dt><span class="sect1"><a href="#id2587244">8.7.
1.1       grant    5507:             Platform specific and differing PLISTs</a></span></dt>
                   5508: 
                   5509:             <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
                   5510:             Sharing directories between packages</a></span></dt>
                   5511:           </dl>
                   5512:         </div>
                   5513: 
1.14      xtraeme  5514:         <p>The <code class="filename">PLIST</code> file contains a
1.1       grant    5515:         package's &#8220;<span class="quote">packing
                   5516:         list</span>&#8221;, i.e. a list of files that belong to the
1.14      xtraeme  5517:         package (relative to the <code class=
                   5518:         "filename">${PREFIX}</code> directory it's been installed
                   5519:         in) plus some additional statements - see the <a href=
1.1       grant    5520:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5521:         <span class="citerefentry"><span class=
                   5522:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   5523:         a full list. This chapter addresses some issues that need
1.14      xtraeme  5524:         attention when dealing with the <code class=
                   5525:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    5526: 
                   5527:         <div class="sect1" lang="en" xml:lang="en">
                   5528:           <div class="titlepage">
                   5529:             <div>
                   5530:               <div>
                   5531:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  5532:                 "id2586781" id="id2586781"></a>8.1.&nbsp;RCS
1.1       grant    5533:                 ID</h2>
                   5534:               </div>
                   5535:             </div>
                   5536:           </div>
                   5537: 
                   5538:           <p>Be sure to add a RCS ID line as the first thing in any
1.14      xtraeme  5539:           <code class="filename">PLIST</code> file you write:</p>
1.1       grant    5540:           <pre class="programlisting">
1.16    ! grant    5541: @comment $NetBSD: pkgsrc.html,v 1.15 2005/01/11 16:34:44 xtraeme Exp $
1.1       grant    5542: </pre>
                   5543:         </div>
                   5544: 
                   5545:         <div class="sect1" lang="en" xml:lang="en">
                   5546:           <div class="titlepage">
                   5547:             <div>
                   5548:               <div>
                   5549:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  5550:                 "id2586796" id=
                   5551:                 "id2586796"></a>8.2.&nbsp;Semi-automatic
1.14      xtraeme  5552:                 <code class="filename">PLIST</code> generation</h2>
1.1       grant    5553:               </div>
                   5554:             </div>
                   5555:           </div>
                   5556: 
1.14      xtraeme  5557:           <p>You can use the <span><strong class="command">make
                   5558:           print-PLIST</strong></span> command to output a PLIST
                   5559:           that matches any new files since the package was
                   5560:           extracted. See <a href="#build.helpful-targets" title=
1.1       grant    5561:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   5562:           &#8220;Other helpful targets&#8221;</a> for more
                   5563:           information on this target.</p>
                   5564:         </div>
                   5565: 
                   5566:         <div class="sect1" lang="en" xml:lang="en">
                   5567:           <div class="titlepage">
                   5568:             <div>
                   5569:               <div>
                   5570:                 <h2 class="title" style="clear: both"><a name=
                   5571:                 "print-PLIST" id=
                   5572:                 "print-PLIST"></a>8.3.&nbsp;Tweaking output of
1.14      xtraeme  5573:                 <span><strong class="command">make
                   5574:                 print-PLIST</strong></span></h2>
1.1       grant    5575:               </div>
                   5576:             </div>
                   5577:           </div>
                   5578: 
                   5579:           <p>If you have used any of the *-dirs packages, as
                   5580:           explained in <a href="#faq.common-dirs" title=
                   5581:           "8.8.&nbsp;Sharing directories between packages">Section&nbsp;8.8,
                   5582:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  5583:           you may have noticed that <span><strong class=
                   5584:           "command">make print-PLIST</strong></span> outputs a set
                   5585:           of <code class="varname">@comment</code>s instead of real
                   5586:           <code class="varname">@dirrm</code> lines. You can also
                   5587:           do this for specific directories and files, so that the
                   5588:           results of that command are very close to reality. This
                   5589:           helps <span class="emphasis"><em>a lot</em></span> during
                   5590:           the update of packages.</p>
                   5591: 
                   5592:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   5593:           variable takes a set of AWK patterns and actions that are
                   5594:           used to filter the output of print-PLIST. You can
                   5595:           <span class="emphasis"><em>append</em></span> any chunk
                   5596:           of AWK scripting you like to it, but be careful with
1.1       grant    5597:           quoting.</p>
                   5598: 
1.14      xtraeme  5599:           <p>For example, to get all files inside the <code class=
                   5600:           "filename">libdata/foo</code> directory removed from the
1.1       grant    5601:           resulting PLIST:</p>
                   5602:           <pre class="programlisting">
                   5603:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   5604:     
                   5605: </pre>
                   5606: 
1.14      xtraeme  5607:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    5608:           lines referring to a specific (shared) directory
1.14      xtraeme  5609:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    5610:           <pre class="programlisting">
                   5611:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   5612:     
                   5613: </pre>
                   5614:         </div>
                   5615: 
                   5616:         <div class="sect1" lang="en" xml:lang="en">
                   5617:           <div class="titlepage">
                   5618:             <div>
                   5619:               <div>
                   5620:                 <h2 class="title" style="clear: both"><a name=
                   5621:                 "plist.misc" id="plist.misc"></a>8.4.&nbsp;Variable
                   5622:                 substitution in PLIST</h2>
                   5623:               </div>
                   5624:             </div>
                   5625:           </div>
                   5626: 
                   5627:           <p>A number of variables are substituted automatically in
                   5628:           PLISTs when a package is installed on a system. This
                   5629:           includes the following variables:</p>
                   5630: 
                   5631:           <div class="variablelist">
                   5632:             <dl>
1.14      xtraeme  5633:               <dt><span class="term"><code class=
                   5634:               "varname">${MACHINE_ARCH}</code>, <code class=
                   5635:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    5636: 
                   5637:               <dd>
                   5638:                 <p>Some packages like emacs and perl embed
                   5639:                 information about which architecture they were
                   5640:                 built on into the pathnames where they install
                   5641:                 their file. To handle this case, PLIST will be
                   5642:                 preprocessed before actually used, and the symbol
1.14      xtraeme  5643:                 &#8220;<span class="quote"><code class=
                   5644:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   5645:                 be replaced by what <span><strong class=
                   5646:                 "command">uname -p</strong></span> gives. The same
                   5647:                 is done if the string <code class=
                   5648:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   5649:                 PLIST somewhere - use this on packages that have
                   5650:                 GNU autoconf created configure scripts.</p>
1.1       grant    5651: 
                   5652:                 <div class="note" style=
                   5653:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   5654:                   <h3 class="title">Legacy note</h3>
                   5655: 
                   5656:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  5657:                   "quote"><code class=
                   5658:                   "varname">$ARCH</code></span>&#8221; that was
                   5659:                   replaced by the output of <span><strong class=
                   5660:                   "command">uname -m</strong></span>, but that's no
1.1       grant    5661:                   longer supported and has been removed.</p>
                   5662:                 </div>
                   5663:               </dd>
                   5664: 
1.14      xtraeme  5665:               <dt><span class="term"><code class=
                   5666:               "varname">${OPSYS}</code>, <code class=
                   5667:               "varname">${LOWER_OPSYS}</code>, <code class=
                   5668:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    5669: 
                   5670:               <dd>
                   5671:                 <p>Some packages want to embed the OS name and
                   5672:                 version into some paths. To do this, use these
1.14      xtraeme  5673:                 variables in the <code class=
                   5674:                 "filename">PLIST</code>:</p>
1.1       grant    5675: 
                   5676:                 <div class="itemizedlist">
                   5677:                   <ul type="disc">
                   5678:                     <li>
1.14      xtraeme  5679:                       <p><code class="varname">${OPSYS}</code> -
                   5680:                       output of &#8220;<span class=
                   5681:                       "quote"><span><strong class="command">uname
                   5682:                       -s</strong></span></span>&#8221;</p>
1.1       grant    5683:                     </li>
                   5684: 
                   5685:                     <li>
1.14      xtraeme  5686:                       <p><code class=
                   5687:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   5688:                       common name (eg. &#8220;<span class=
                   5689:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    5690:                     </li>
                   5691: 
                   5692:                     <li>
1.14      xtraeme  5693:                       <p><code class="varname">${OS_VERSION}</code>
                   5694:                       - &#8220;<span class=
                   5695:                       "quote"><span><strong class="command">uname
                   5696:                       -r</strong></span></span>&#8221;</p>
1.1       grant    5697:                     </li>
                   5698:                   </ul>
                   5699:                 </div>
                   5700:               </dd>
                   5701: 
1.14      xtraeme  5702:               <dt><span class="term"><code class=
                   5703:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    5704: 
                   5705:               <dd>
                   5706:                 <p>Packages that install locale files should list
                   5707:                 them in the PLIST as &#8220;<span class=
                   5708:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   5709:                 instead of &#8220;<span class=
                   5710:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   5711:                 This properly handles the fact that different
                   5712:                 operating systems expect locale files to be either
1.14      xtraeme  5713:                 in <code class="filename">share</code> or
                   5714:                 <code class="filename">lib</code> by default.</p>
1.1       grant    5715:               </dd>
                   5716:             </dl>
                   5717:           </div>
                   5718: 
                   5719:           <p>For a complete list of values which are replaced by
1.14      xtraeme  5720:           default, please look in <code class=
                   5721:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    5722:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   5723: 
                   5724:           <p>If you want to change other variables not listed
                   5725:           above, you can add variables and their expansions to this
1.14      xtraeme  5726:           variable in the following way, similar to <code class=
                   5727:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    5728:           "#components.optional" title=
                   5729:           "7.5.&nbsp;Optional files">Section&nbsp;7.5,
                   5730:           &#8220;Optional files&#8221;</a>):</p>
                   5731:           <pre class="programlisting">
                   5732: PLIST_SUBST+=    SOMEVAR="somevalue"
                   5733: </pre>
                   5734: 
                   5735:           <p>This replaces all occurrences of &#8220;<span class=
                   5736:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   5737:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   5738:         </div>
                   5739: 
                   5740:         <div class="sect1" lang="en" xml:lang="en">
                   5741:           <div class="titlepage">
                   5742:             <div>
                   5743:               <div>
                   5744:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  5745:                 "id2587186" id=
                   5746:                 "id2587186"></a>8.5.&nbsp;Manpage-compression</h2>
1.1       grant    5747:               </div>
                   5748:             </div>
                   5749:           </div>
                   5750: 
                   5751:           <p>Manpages should be installed in compressed form if
1.14      xtraeme  5752:           <code class="varname">MANZ</code> is set (in <code class=
                   5753:           "filename">bsd.own.mk</code>), and uncompressed
                   5754:           otherwise. To handle this in the <code class=
                   5755:           "filename">PLIST</code> file, the suffix
                   5756:           &#8220;<span class="quote">.gz</span>&#8221; is
                   5757:           appended/removed automatically for manpages according to
                   5758:           <code class="varname">MANZ</code> and <code class=
                   5759:           "varname">MANCOMPRESSED</code> being set or not, see
                   5760:           above for details. This modification of the <code class=
                   5761:           "filename">PLIST</code> file is done on a copy of it, not
                   5762:           <code class="filename">PLIST</code> itself.</p>
1.1       grant    5763:         </div>
                   5764: 
                   5765:         <div class="sect1" lang="en" xml:lang="en">
                   5766:           <div class="titlepage">
                   5767:             <div>
                   5768:               <div>
                   5769:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  5770:                 "id2587227" id="id2587227"></a>8.6.&nbsp;Changing
1.14      xtraeme  5771:                 PLIST source with <code class=
                   5772:                 "varname">PLIST_SRC</code></h2>
1.1       grant    5773:               </div>
                   5774:             </div>
                   5775:           </div>
                   5776: 
1.14      xtraeme  5777:           <p>To use one or more files as source for the
                   5778:           <code class="filename">PLIST</code> used in generating
                   5779:           the binary package, set the variable <code class=
                   5780:           "varname">PLIST_SRC</code> to the names of that file(s).
1.1       grant    5781:           The files are later concatenated using cat(1), and order
                   5782:           of things is important.</p>
                   5783:         </div>
                   5784: 
                   5785:         <div class="sect1" lang="en" xml:lang="en">
                   5786:           <div class="titlepage">
                   5787:             <div>
                   5788:               <div>
                   5789:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  5790:                 "id2587244" id="id2587244"></a>8.7.&nbsp;Platform
1.1       grant    5791:                 specific and differing PLISTs</h2>
                   5792:               </div>
                   5793:             </div>
                   5794:           </div>
                   5795: 
                   5796:           <p>Some packages decide to install a different set of
                   5797:           files based on the operating system being used. These
                   5798:           differences can be automatically handled by using the
                   5799:           following files:</p>
                   5800: 
                   5801:           <div class="itemizedlist">
                   5802:             <ul type="disc">
                   5803:               <li>
1.14      xtraeme  5804:                 <p><code class="filename">PLIST.common</code></p>
1.1       grant    5805:               </li>
                   5806: 
                   5807:               <li>
1.14      xtraeme  5808:                 <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1       grant    5809:               </li>
                   5810: 
                   5811:               <li>
1.14      xtraeme  5812:                 <p><code class=
                   5813:                 "filename">PLIST.common_end</code></p>
1.1       grant    5814:               </li>
                   5815:             </ul>
                   5816:           </div>
                   5817: 
1.14      xtraeme  5818:           <p>If <code class="filename">PLIST.${OPSYS}</code>
                   5819:           exists, these files are used instead of <code class=
                   5820:           "filename">PLIST</code>. This allows packages which
                   5821:           behave in this way to be handled gracefully. Manually
                   5822:           overriding <code class="varname">PLIST_SRC</code> for
                   5823:           other more exotic uses is also possible.</p>
1.1       grant    5824:         </div>
                   5825: 
                   5826:         <div class="sect1" lang="en" xml:lang="en">
                   5827:           <div class="titlepage">
                   5828:             <div>
                   5829:               <div>
                   5830:                 <h2 class="title" style="clear: both"><a name=
                   5831:                 "faq.common-dirs" id=
                   5832:                 "faq.common-dirs"></a>8.8.&nbsp;Sharing directories
                   5833:                 between packages</h2>
                   5834:               </div>
                   5835:             </div>
                   5836:           </div>
                   5837: 
                   5838:           <p>A &#8220;<span class="quote">shared
                   5839:           directory</span>&#8221; is a directory where multiple
                   5840:           (and unrelated) packages install files. These directories
                   5841:           are problematic because you have to add special tricks in
                   5842:           the PLIST to conditionally remove them, or have some
                   5843:           centralized package handle them.</p>
                   5844: 
                   5845:           <p>Within pkgsrc, you'll find both approaches. If a
                   5846:           directory is shared by a few unrelated packages, it's
                   5847:           often not worth to add an extra package to remove it.
                   5848:           Therefore, one simply does:</p>
                   5849:           <pre class="programlisting">
                   5850:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   5851:     
                   5852: </pre>
                   5853: 
                   5854:           <p>in the PLISTs of all affected packages, instead of the
                   5855:           regular "@dirrm" line.</p>
                   5856: 
                   5857:           <p>However, if the directory is shared across many
                   5858:           packages, two different solutions are available:</p>
                   5859: 
                   5860:           <div class="orderedlist">
                   5861:             <ol type="1">
                   5862:               <li>
                   5863:                 <p>If the packages have a common dependency, the
                   5864:                 directory can be removed in that. For example, see
                   5865:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5866:                 href=
                   5867:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.14      xtraeme  5868:                 class="pkgname">textproc/scrollkeeper</a>, which
                   5869:                 removes the shared directory <code class=
                   5870:                 "filename">share/omf</code>.</p>
1.1       grant    5871:               </li>
                   5872: 
                   5873:               <li>
                   5874:                 <p>If the packages using the directory are not
                   5875:                 related at all (they have no common dependencies),
                   5876:                 a *-dirs package is used.</p>
                   5877:               </li>
                   5878:             </ol>
                   5879:           </div>
                   5880: 
                   5881:           <p>From now on, we'll discuss the second solution. To get
                   5882:           an idea of the *-dirs packages available, issue:</p>
                   5883:           <pre class="programlisting">
1.14      xtraeme  5884:       <code class="prompt">%</code> cd .../pkgsrc
                   5885:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    5886:     
                   5887: </pre>
                   5888: 
                   5889:           <p>Their use from other packages is very simple. The
1.14      xtraeme  5890:           <code class="varname">USE_DIRS</code> variable takes a
                   5891:           list of package names (without the &#8220;<span class=
1.1       grant    5892:           "quote">-dirs</span>&#8221; part) together with the
                   5893:           required version number (always pick the latest one when
                   5894:           writting new packages).</p>
                   5895: 
                   5896:           <p>For example, if a package installs files under
1.14      xtraeme  5897:           <code class="filename">share/applications</code>, it
                   5898:           should have the following line in it:</p>
1.1       grant    5899:           <pre class="programlisting">
                   5900:       USE_DIRS+= xdg-1.1
                   5901:     
                   5902: </pre>
                   5903: 
1.14      xtraeme  5904:           <p>After regenerating the PLIST using
                   5905:           <span><strong class="command">make
                   5906:           print-PLIST</strong></span>, you should get the right
                   5907:           (commented out) lines.</p>
1.1       grant    5908: 
1.14      xtraeme  5909:           <p>Note that, even if your package is using <code class=
                   5910:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    5911:           *-x11-dirs packages. Just specify the name without that
1.14      xtraeme  5912:           part and pkgsrc (in particular, <code class=
                   5913:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    5914:         </div>
                   5915:       </div>
                   5916: 
                   5917:       <div class="chapter" lang="en" xml:lang="en">
                   5918:         <div class="titlepage">
                   5919:           <div>
                   5920:             <div>
                   5921:               <h2 class="title"><a name="buildlink" id=
                   5922:               "buildlink"></a>Chapter&nbsp;9.&nbsp;Buildlink
                   5923:               methodology</h2>
                   5924:             </div>
                   5925:           </div>
                   5926:         </div>
                   5927: 
                   5928:         <div class="toc">
                   5929:           <p><b>Table of Contents</b></p>
                   5930: 
                   5931:           <dl>
1.15      xtraeme  5932:             <dt><span class="sect1"><a href="#id2587653">9.1.
1.1       grant    5933:             Converting packages to use buildlink3</a></span></dt>
                   5934: 
1.15      xtraeme  5935:             <dt><span class="sect1"><a href="#id2587844">9.2.
1.14      xtraeme  5936:             Writing <code class="filename">buildlink3.mk</code>
                   5937:             files</a></span></dt>
1.1       grant    5938: 
                   5939:             <dd>
                   5940:               <dl>
1.15      xtraeme  5941:                 <dt><span class="sect2"><a href="#id2587913">9.2.1.
1.1       grant    5942:                 Anatomy of a buildlink3.mk file</a></span></dt>
                   5943: 
1.15      xtraeme  5944:                 <dt><span class="sect2"><a href="#id2588354">9.2.2.
1.14      xtraeme  5945:                 Updating <code class=
                   5946:                 "varname">BUILDLINK_DEPENDS.<em class=
                   5947:                 "replaceable"><code>pkg</code></em></code> in
                   5948:                 <code class="filename">buildlink3.mk</code>
1.1       grant    5949:                 files</a></span></dt>
                   5950:               </dl>
                   5951:             </dd>
                   5952: 
1.15      xtraeme  5953:             <dt><span class="sect1"><a href="#id2588433">9.3.
1.14      xtraeme  5954:             Writing <code class="filename">builtin.mk</code>
                   5955:             files</a></span></dt>
1.1       grant    5956: 
                   5957:             <dd>
                   5958:               <dl>
1.15      xtraeme  5959:                 <dt><span class="sect2"><a href="#id2588582">9.3.1.
1.14      xtraeme  5960:                 Anatomy of a <code class=
                   5961:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    5962: 
1.15      xtraeme  5963:                 <dt><span class="sect2"><a href="#id2588877">9.3.2.
1.1       grant    5964:                 Global preferences for native or pkgsrc
                   5965:                 software</a></span></dt>
                   5966:               </dl>
                   5967:             </dd>
                   5968:           </dl>
                   5969:         </div>
                   5970: 
                   5971:         <p>Buildlink is a framework in pkgsrc that controls what
                   5972:         headers and libraries are seen by a package's configure and
                   5973:         build processes. This is implemented in a two step
                   5974:         process:</p>
                   5975: 
                   5976:         <div class="orderedlist">
                   5977:           <ol type="1">
                   5978:             <li>
                   5979:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  5980:               into <code class="varname">BUILDLINK_DIR</code>,
                   5981:               which by default is a subdirectory of <code class=
                   5982:               "varname">WRKDIR</code>.</p>
1.1       grant    5983:             </li>
                   5984: 
                   5985:             <li>
                   5986:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  5987:               the normal compiler tools that translate <code class=
                   5988:               "option">-I${LOCALBASE}/include</code> and
                   5989:               <code class="option">-L${LOCALBASE}/lib</code> into
                   5990:               references to <code class=
                   5991:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   5992:               also make native compiler on some operating systems
                   5993:               look like GCC, so that packages that expect GCC won't
                   5994:               require modifications to build with those native
                   5995:               compilers.</p>
1.1       grant    5996:             </li>
                   5997:           </ol>
                   5998:         </div>
                   5999: 
                   6000:         <p>This normalizes the environment in which a package is
                   6001:         built so that the package may be built consistently despite
                   6002:         what other software may be installed. Please note that the
1.14      xtraeme  6003:         normal system header and library paths, e.g. <code class=
                   6004:         "filename">/usr/include</code>, <code class=
                   6005:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    6006:         buildlink3 is designed to insulate the package build from
                   6007:         non-system-supplied software.</p>
                   6008: 
                   6009:         <div class="sect1" lang="en" xml:lang="en">
                   6010:           <div class="titlepage">
                   6011:             <div>
                   6012:               <div>
                   6013:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  6014:                 "id2587653" id="id2587653"></a>9.1.&nbsp;Converting
1.1       grant    6015:                 packages to use buildlink3</h2>
                   6016:               </div>
                   6017:             </div>
                   6018:           </div>
                   6019: 
                   6020:           <p>The process of converting packages to use the
                   6021:           buildlink3 framework (&#8220;<span class=
                   6022:           "quote">bl3ifying</span>&#8221;) is fairly
                   6023:           straightforward. The things to keep in mind are:</p>
                   6024: 
                   6025:           <div class="orderedlist">
                   6026:             <ol type="1">
                   6027:               <li>
1.14      xtraeme  6028:                 <p>Set <code class="varname">USE_BUILDLINK3</code>
                   6029:                 to &#8220;<span class=
                   6030:                 "quote">yes</span>&#8221;.</p>
1.1       grant    6031:               </li>
                   6032: 
                   6033:               <li>
                   6034:                 <p>Ensure that the build always calls the wrapper
                   6035:                 scripts instead of the actual toolchain. Some
                   6036:                 packages are tricky, and the only way to know for
1.14      xtraeme  6037:                 sure is the check <code class=
                   6038:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    6039:                 wrappers are being invoked.</p>
                   6040:               </li>
                   6041: 
                   6042:               <li>
1.14      xtraeme  6043:                 <p>Don't override <code class=
                   6044:                 "varname">PREFIX</code> from within the package
                   6045:                 Makefile, e.g. Java VMs, standalone shells, etc.,
                   6046:                 because the code to symlink files into <code class=
                   6047:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    6048:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  6049:                 <em class=
                   6050:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    6051:               </li>
                   6052: 
                   6053:               <li>
                   6054:                 <p>Remember that <span class=
1.14      xtraeme  6055:                 "emphasis"><em>only</em></span> the <code class=
                   6056:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    6057:                 in a package's Makefile are added as dependencies
                   6058:                 for that package.</p>
                   6059:               </li>
                   6060:             </ol>
                   6061:           </div>
                   6062: 
                   6063:           <p>If a dependency on a particular package is required
                   6064:           for its libraries and headers, then we replace:</p>
                   6065:           <pre class="programlisting">
                   6066: DEPENDS+=       foo&gt;=1.1.0:../../category/foo
                   6067: </pre>
                   6068: 
                   6069:           <p>with</p>
                   6070:           <pre class="programlisting">
                   6071: .include "../../category/foo/buildlink3.mk"
                   6072: </pre>
                   6073: 
1.14      xtraeme  6074:           <p>There are several <code class=
                   6075:           "filename">buildlink3.mk</code> files in <code class=
                   6076:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    6077:           issues:</p>
                   6078: 
                   6079:           <div class="itemizedlist">
                   6080:             <ul type="disc">
                   6081:               <li>
1.14      xtraeme  6082:                 <p><code class="filename">bdb.buildlink3.mk</code>
1.1       grant    6083:                 chooses either the native or a pkgsrc Berkeley DB
1.14      xtraeme  6084:                 implementation based on the values of <code class=
                   6085:                 "varname">BDB_ACCEPTED</code> and <code class=
                   6086:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    6087:               </li>
                   6088: 
                   6089:               <li>
1.14      xtraeme  6090:                 <p><code class=
                   6091:                 "filename">curses.buildlink3.mk</code> If the
                   6092:                 system comes with neither Curses nor NCurses, this
                   6093:                 will take care to install the <a xmlns=
                   6094:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    6095:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.14      xtraeme  6096:                 class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    6097:               </li>
                   6098: 
                   6099:               <li>
1.14      xtraeme  6100:                 <p><code class="filename">krb5.buildlink3.mk</code>
                   6101:                 uses the value of <code class=
                   6102:                 "varname">KRB5_ACCEPTED</code> to choose between
1.1       grant    6103:                 adding a dependency on Heimdal or MIT-krb5 for
                   6104:                 packages that require a Kerberos 5
                   6105:                 implementation.</p>
                   6106:               </li>
                   6107: 
                   6108:               <li>
1.14      xtraeme  6109:                 <p><code class=
                   6110:                 "filename">motif.buildlink3.mk</code> checks for a
                   6111:                 system-provided Motif installation or adds a
                   6112:                 dependency on <a xmlns=
1.1       grant    6113:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6114:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.14      xtraeme  6115:                 class="pkgname">x11/lesstif</a> or <a xmlns=
                   6116:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6117:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
                   6118:                 class="pkgname">x11/openmotif</a>;</p>
1.1       grant    6119:               </li>
                   6120: 
                   6121:               <li>
1.14      xtraeme  6122:                 <p><code class=
                   6123:                 "filename">ossaudio.buildlink3.mk</code> defines
                   6124:                 several variables that may be used by packages that
                   6125:                 use the Open Sound System (OSS) API;</p>
1.1       grant    6126:               </li>
                   6127: 
                   6128:               <li>
1.14      xtraeme  6129:                 <p><code class=
                   6130:                 "filename">pgsql.buildlink3.mk</code> will accept
                   6131:                 either Postgres 7.3 or 7.4, whichever is found
                   6132:                 installed. See the file for more information.</p>
1.1       grant    6133:               </li>
                   6134: 
                   6135:               <li>
1.14      xtraeme  6136:                 <p><code class=
                   6137:                 "filename">pthread.buildlink3.mk</code> uses the
                   6138:                 value of <code class="varname">PTHREAD_OPTS</code>
                   6139:                 and checks for native pthreads or adds a dependency
                   6140:                 on <a xmlns=
1.1       grant    6141:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6142:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.14      xtraeme  6143:                 class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    6144:               </li>
                   6145: 
                   6146:               <li>
1.14      xtraeme  6147:                 <p><code class="filename">xaw.buildlink3.mk</code>
                   6148:                 uses the value of <code class=
                   6149:                 "varname">XAW_TYPE</code> to choose a particular
                   6150:                 Athena widgets library.</p>
1.1       grant    6151:               </li>
                   6152:             </ul>
                   6153:           </div>
                   6154: 
1.14      xtraeme  6155:           <p>The comments in those <code class=
                   6156:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    6157:           complete description of how to use them properly.</p>
                   6158:         </div>
                   6159: 
                   6160:         <div class="sect1" lang="en" xml:lang="en">
                   6161:           <div class="titlepage">
                   6162:             <div>
                   6163:               <div>
                   6164:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  6165:                 "id2587844" id="id2587844"></a>9.2.&nbsp;Writing
1.14      xtraeme  6166:                 <code class="filename">buildlink3.mk</code>
                   6167:                 files</h2>
1.1       grant    6168:               </div>
                   6169:             </div>
                   6170:           </div>
                   6171: 
1.14      xtraeme  6172:           <p>A package's <code class=
                   6173:           "filename">buildlink3.mk</code> file is included by
                   6174:           Makefiles to indicate the need to compile and link
                   6175:           against header files and libraries provided by the
                   6176:           package. A <code class="filename">buildlink3.mk</code>
                   6177:           file should always provide enough information to add the
                   6178:           correct type of dependency relationship and include any
                   6179:           other <code class="filename">buildlink3.mk</code> files
                   6180:           that it needs to find headers and libraries that it needs
                   6181:           in turn.</p>
1.1       grant    6182: 
1.14      xtraeme  6183:           <p>To generate an initial <code class=
                   6184:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    6185:           Rene Hexel's <a xmlns=
                   6186:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6187:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.14      xtraeme  6188:           class="pkgname">pkgtools/createbuildlink</a> package is
                   6189:           highly recommended. For most packages, the following
                   6190:           command will generate a good starting point for
                   6191:           <code class="filename">buildlink3.mk</code> files:</p>
1.1       grant    6192:           <pre class="screen">
1.14      xtraeme  6193: <code class="prompt">%</code> <strong class=
                   6194: "userinput"><code>cd pkgsrc/<em class=
                   6195: "replaceable"><code>category</code></em>/<em class=
                   6196: "replaceable"><code>pkgdir</code></em>
                   6197: <code class=
                   6198: "prompt">%</code> createbuildlink -3 &gt;buildlink3.mk</code></strong>
1.1       grant    6199: </pre>
                   6200: 
                   6201:           <div class="sect2" lang="en" xml:lang="en">
                   6202:             <div class="titlepage">
                   6203:               <div>
                   6204:                 <div>
1.15      xtraeme  6205:                   <h3 class="title"><a name="id2587913" id=
                   6206:                   "id2587913"></a>9.2.1. Anatomy of a buildlink3.mk
1.1       grant    6207:                   file</h3>
                   6208:                 </div>
                   6209:               </div>
                   6210:             </div>
                   6211: 
1.14      xtraeme  6212:             <p>The following real-life example <code class=
                   6213:             "filename">buildlink3.mk</code> is taken from
                   6214:             <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    6215:             <pre class="programlisting">
1.16    ! grant    6216: # $NetBSD: pkgsrc.html,v 1.15 2005/01/11 16:34:44 xtraeme Exp $
1.1       grant    6217: 
                   6218: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   6219: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   6220: 
                   6221: .if !empty(BUILDLINK_DEPTH:M+)
                   6222: BUILDLINK_DEPENDS+=     tiff
                   6223: .endif
                   6224: 
                   6225: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   6226: BUILDLINK_PACKAGES+=    tiff
                   6227: 
                   6228: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   6229: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   6230: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   6231: .endif  # TIFF_BUILDLINK3_MK
                   6232: 
                   6233: .include "../../devel/zlib/buildlink3.mk"
                   6234: .include "../../graphics/jpeg/buildlink3.mk"
                   6235: 
                   6236: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   6237: </pre>
                   6238: 
1.14      xtraeme  6239:             <p>The header and footer manipulate <code class=
                   6240:             "varname">BUILDLINK_DEPTH</code>, which is common
                   6241:             across all <code class="filename">buildlink3.mk</code>
                   6242:             files and is used to track at what depth we are
                   6243:             including <code class="filename">buildlink3.mk</code>
                   6244:             files.</p>
1.1       grant    6245: 
                   6246:             <p>The first section controls if the dependency on
1.14      xtraeme  6247:             <em class="replaceable"><code>pkg</code></em> is added.
                   6248:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    6249:             global list of packages for which dependencies are
                   6250:             added by buildlink3.</p>
                   6251: 
                   6252:             <p>The second section advises pkgsrc that the
1.14      xtraeme  6253:             <code class="filename">buildlink3.mk</code> file for
                   6254:             <em class="replaceable"><code>pkg</code></em> has been
                   6255:             included at some point. <code class=
                   6256:             "varname">BUILDLINK_PACKAGES</code> is the global list
                   6257:             of packages for which <code class=
                   6258:             "filename">buildlink3.mk</code> files have been
                   6259:             included. It must <span class=
                   6260:             "emphasis"><em>always</em></span> be appended to within
                   6261:             a <code class="filename">buildlink3.mk</code> file.</p>
1.1       grant    6262: 
                   6263:             <p>The third section is protected from multiple
1.14      xtraeme  6264:             inclusion and controls how the dependency on <em class=
                   6265:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    6266:             important variables are set in the section:</p>
                   6267: 
                   6268:             <div class="itemizedlist">
                   6269:               <ul type="disc">
                   6270:                 <li>
1.14      xtraeme  6271:                   <p><code class=
                   6272:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6273:                   "replaceable"><code>pkg</code></em></code> is the
                   6274:                   actual dependency recorded in the installed
                   6275:                   package; this should always be set using
                   6276:                   <span><strong class="command">+=</strong></span>
                   6277:                   to ensure that we're appending to any
                   6278:                   pre-existing list of values. This variable should
                   6279:                   be set to the first version of the package that
                   6280:                   had the last change in the major number of a
                   6281:                   shared library or that had a major API
                   6282:                   change.</p>
1.1       grant    6283:                 </li>
                   6284: 
                   6285:                 <li>
1.14      xtraeme  6286:                   <p><code class=
                   6287:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   6288:                   "replaceable"><code>pkg</code></em></code> is the
                   6289:                   location of the <em class=
                   6290:                   "replaceable"><code>pkg</code></em> pkgsrc
1.1       grant    6291:                   directory;</p>
                   6292:                 </li>
                   6293: 
                   6294:                 <li>
1.14      xtraeme  6295:                   <p><code class=
                   6296:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6297:                   "replaceable"><code>pkg</code></em></code> (not
                   6298:                   shown above) controls whether we use <code class=
                   6299:                   "varname">BUILD_DEPENDS</code> or <code class=
                   6300:                   "varname">DEPENDS</code> to add the dependency on
                   6301:                   <em class="replaceable"><code>pkg</code></em>.
                   6302:                   The build dependency is selected by setting
                   6303:                   <code class=
                   6304:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6305:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    6306:                   &#8220;<span class="quote">build</span>&#8221;.
                   6307:                   By default, the full dependency is used.</p>
                   6308:                 </li>
                   6309: 
                   6310:                 <li>
1.14      xtraeme  6311:                   <p><code class=
                   6312:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6313:                   "replaceable"><code>pkg</code></em></code> and
                   6314:                   <code class=
                   6315:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
                   6316:                   <code>pkg</code></em></code> (not shown above)
                   6317:                   are lists of subdirectories of <code class=
                   6318:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6319:                   "replaceable"><code>pkg</code></em>}</code> to
                   6320:                   add to the header and library search paths. These
1.1       grant    6321:                   default to &#8220;<span class=
                   6322:                   "quote">include</span>&#8221; and
                   6323:                   &#8220;<span class="quote">lib</span>&#8221;
                   6324:                   respectively.</p>
                   6325:                 </li>
                   6326: 
                   6327:                 <li>
1.14      xtraeme  6328:                   <p><code class=
                   6329:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   6330:                   "replaceable"><code>pkg</code></em></code> (not
                   6331:                   shown above) is the list of preprocessor flags to
                   6332:                   add to <code class="varname">CPPFLAGS</code>,
                   6333:                   which are passed on to the configure and build
                   6334:                   phases. The &#8220;<span class=
                   6335:                   "quote">-I</span>&#8221; option should be avoided
                   6336:                   and instead be handled using <code class=
                   6337:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6338:                   "replaceable"><code>pkg</code></em></code> as
                   6339:                   above.</p>
1.1       grant    6340:                 </li>
                   6341:               </ul>
                   6342:             </div>
                   6343: 
                   6344:             <p>The following variables are all optionally defined
                   6345:             within this second section (protected against multiple
                   6346:             inclusion) and control which package files are
1.14      xtraeme  6347:             symlinked into <code class=
                   6348:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    6349:             are transformed during the symlinking:</p>
                   6350: 
                   6351:             <div class="itemizedlist">
                   6352:               <ul type="disc">
                   6353:                 <li>
1.14      xtraeme  6354:                   <p><code class=
                   6355:                   "varname">BUILDLINK_FILES.<em class=
                   6356:                   "replaceable"><code>pkg</code></em></code> (not
                   6357:                   shown above) is a shell glob pattern relative to
                   6358:                   <code class=
                   6359:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6360:                   "replaceable"><code>pkg</code></em>}</code> to be
                   6361:                   symlinked into <code class=
                   6362:                   "filename">${BUILDLINK_DIR}</code>, e.g.
                   6363:                   <code class="filename">include/*.h</code>.</p>
1.1       grant    6364:                 </li>
                   6365: 
                   6366:                 <li>
1.14      xtraeme  6367:                   <p><code class=
                   6368:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   6369:                   "replaceable"><code>pkg</code></em></code> (not
                   6370:                   shown above) is a shell pipeline that outputs to
                   6371:                   stdout a list of files relative to <code class=
                   6372:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6373:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    6374:                   resulting files are to be symlinked into
1.14      xtraeme  6375:                   <code class="filename">${BUILDLINK_DIR}</code>.
                   6376:                   By default, this takes the <code class=
                   6377:                   "filename">+CONTENTS</code> of a <em class=
                   6378:                   "replaceable"><code>pkg</code></em> and filters
                   6379:                   it through <code class=
                   6380:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   6381:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    6382:                 </li>
                   6383: 
                   6384:                 <li>
1.14      xtraeme  6385:                   <p><code class=
                   6386:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6387:                   "replaceable"><code>pkg</code></em></code> (not
                   6388:                   shown above) is a filter command that filters
                   6389:                   <code class="filename">+CONTENTS</code> input
                   6390:                   into a list of files relative to <code class=
                   6391:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6392:                   "replaceable"><code>pkg</code></em>}</code> on
                   6393:                   stdout. By default for overwrite packages,
                   6394:                   <code class=
                   6395:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6396:                   "replaceable"><code>pkg</code></em></code>
                   6397:                   outputs the contents of the <code class=
                   6398:                   "filename">include</code> and <code class=
                   6399:                   "filename">lib</code> directories in the package
                   6400:                   <code class="filename">+CONTENTS</code>, and for
                   6401:                   pkgviews packages, it outputs any libtool
                   6402:                   archives in <code class="filename">lib</code>
1.1       grant    6403:                   directories.</p>
                   6404:                 </li>
                   6405: 
                   6406:                 <li>
1.14      xtraeme  6407:                   <p><code class=
                   6408:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   6409:                   "replaceable"><code>pkg</code></em></code> (not
                   6410:                   shown above) is a list of sed arguments used to
1.1       grant    6411:                   transform the name of the source filename into a
1.14      xtraeme  6412:                   destination filename, e.g. <span><strong class=
1.1       grant    6413:                   "command">-e
1.14      xtraeme  6414:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    6415:                 </li>
                   6416:               </ul>
                   6417:             </div>
                   6418: 
1.14      xtraeme  6419:             <p>The last section includes any <code class=
                   6420:             "filename">buildlink3.mk</code> needed for <em class=
                   6421:             "replaceable"><code>pkg</code></em>'s library
                   6422:             dependencies. Including these <code class=
                   6423:             "filename">buildlink3.mk</code> files means that the
                   6424:             headers and libraries for these dependencies are also
                   6425:             symlinked into <code class=
                   6426:             "filename">${BUILDLINK_DIR}</code> whenever the
                   6427:             <em class="replaceable"><code>pkg</code></em>
                   6428:             <code class="filename">buildlink3.mk</code> file is
                   6429:             included.</p>
1.1       grant    6430:           </div>
                   6431: 
                   6432:           <div class="sect2" lang="en" xml:lang="en">
                   6433:             <div class="titlepage">
                   6434:               <div>
                   6435:                 <div>
1.15      xtraeme  6436:                   <h3 class="title"><a name="id2588354" id=
                   6437:                   "id2588354"></a>9.2.2. Updating <code class=
1.14      xtraeme  6438:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6439:                   "replaceable"><code>pkg</code></em></code> in
                   6440:                   <code class="filename">buildlink3.mk</code>
                   6441:                   files</h3>
1.1       grant    6442:                 </div>
                   6443:               </div>
                   6444:             </div>
                   6445: 
                   6446:             <p>There are two situations that require increasing the
1.14      xtraeme  6447:             dependency listed in <code class=
                   6448:             "varname">BUILDLINK_DEPENDS.<em class=
                   6449:             "replaceable"><code>pkg</code></em></code> after a
                   6450:             package update:</p>
1.1       grant    6451: 
                   6452:             <div class="orderedlist">
                   6453:               <ol type="1">
                   6454:                 <li>
                   6455:                   <p>if the sonames (major number of the library
                   6456:                   version) of any installed shared libraries
                   6457:                   change;</p>
                   6458:                 </li>
                   6459: 
                   6460:                 <li>
                   6461:                   <p>if the API or interface to the header files
                   6462:                   change.</p>
                   6463:                 </li>
                   6464:               </ol>
                   6465:             </div>
                   6466: 
1.14      xtraeme  6467:             <p>In these cases, <code class=
                   6468:             "varname">BUILDLINK_DEPENDS.<em class=
                   6469:             "replaceable"><code>pkg</code></em></code> should be
                   6470:             adjusted to require at least the new package version.
                   6471:             In some cases, the packages that depend on this new
                   6472:             version may need their <code class=
                   6473:             "varname">PKGREVISION</code>s increased and, if they
                   6474:             have <code class="filename">buildlink3.mk</code> files,
                   6475:             their <code class=
                   6476:             "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
                   6477:             pkg</code></em></code> adjusted, too. This is needed so
                   6478:             that binary packages made using it will require the
                   6479:             correct package dependency and not settle for an older
                   6480:             one which will not contain the necessary shared
                   6481:             libraries.</p>
1.1       grant    6482: 
                   6483:             <p>Please take careful consideration before adjusting
1.14      xtraeme  6484:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   6485:             "replaceable"><code>pkg</code></em></code> as we don't
                   6486:             want to cause unneeded package deletions and rebuilds.
                   6487:             In many cases, new versions of packages work just fine
                   6488:             with older dependencies. See <a href="#dependencies"
                   6489:             title="12.1.3.&nbsp;Handling dependencies">Section
                   6490:             12.1.3, &#8220;Handling dependencies&#8221;</a> and
                   6491:             <a href="#buildlink" title=
1.1       grant    6492:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter 9,
                   6493:             <i>Buildlink methodology</i></a> for more information
                   6494:             about dependencies on other packages, including the
1.14      xtraeme  6495:             <code class="varname">BUILDLINK_RECOMMENDED</code> and
                   6496:             <code class="varname">RECOMMENDED</code>
                   6497:             definitions.</p>
1.1       grant    6498:           </div>
                   6499:         </div>
                   6500: 
                   6501:         <div class="sect1" lang="en" xml:lang="en">
                   6502:           <div class="titlepage">
                   6503:             <div>
                   6504:               <div>
                   6505:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  6506:                 "id2588433" id="id2588433"></a>9.3.&nbsp;Writing
1.14      xtraeme  6507:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    6508:               </div>
                   6509:             </div>
                   6510:           </div>
                   6511: 
                   6512:           <p>Some packages in pkgsrc install headers and libraries
                   6513:           that coincide with headers and libraries present in the
1.14      xtraeme  6514:           base system. Aside from a <code class=
                   6515:           "filename">buildlink3.mk</code> file, these packages
                   6516:           should also include a <code class=
                   6517:           "filename">builtin.mk</code> file that includes the
                   6518:           necessary checks to decide whether using the built-in
                   6519:           software or the pkgsrc software is appropriate.</p>
1.1       grant    6520: 
                   6521:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  6522:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    6523: 
                   6524:           <div class="orderedlist">
                   6525:             <ol type="1">
                   6526:               <li>
1.14      xtraeme  6527:                 <p>It should set <code class=
                   6528:                 "varname">USE_BUILTIN.<em class=
                   6529:                 "replaceable"><code>pkg</code></em></code> to
                   6530:                 either &#8220;<span class="quote">yes</span>&#8221;
                   6531:                 or &#8220;<span class="quote">no</span>&#8221;
                   6532:                 after it is included.</p>
1.1       grant    6533:               </li>
                   6534: 
                   6535:               <li>
                   6536:                 <p>It should <span class=
                   6537:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  6538:                 <code class="varname">USE_BUILTIN.<em class=
                   6539:                 "replaceable"><code>pkg</code></em></code> which is
                   6540:                 already set before the <code class=
                   6541:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    6542:               </li>
                   6543: 
                   6544:               <li>
                   6545:                 <p>It should be written to allow multiple
                   6546:                 inclusion. This is <span class=
                   6547:                 "emphasis"><em>very</em></span> important and takes
1.14      xtraeme  6548:                 careful attention to <code class=
                   6549:                 "filename">Makefile</code> coding.</p>
1.1       grant    6550:               </li>
                   6551:             </ol>
                   6552:           </div>
                   6553: 
                   6554:           <div class="sect2" lang="en" xml:lang="en">
                   6555:             <div class="titlepage">
                   6556:               <div>
                   6557:                 <div>
1.15      xtraeme  6558:                   <h3 class="title"><a name="id2588582" id=
                   6559:                   "id2588582"></a>9.3.1.&nbsp;Anatomy of a
1.14      xtraeme  6560:                   <code class="filename">builtin.mk</code>
                   6561:                   file</h3>
1.1       grant    6562:                 </div>
                   6563:               </div>
                   6564:             </div>
                   6565: 
                   6566:             <p>The following is the recommended template for
                   6567:             builtin.mk files:</p>
                   6568:             <pre class="programlisting">
                   6569: .if !defined(IS_BUILTIN.foo)
                   6570: #
                   6571: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   6572: # genuinely exists in the system or not.
                   6573: #
                   6574: IS_BUILTIN.foo?=        no
                   6575: 
                   6576: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   6577: # version can be determined.
                   6578: #
                   6579: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   6580: BUILTIN_PKG.foo?=       foo-1.0
                   6581: .  endif
                   6582: .endif  # IS_BUILTIN.foo
                   6583: 
                   6584: .if !defined(USE_BUILTIN.foo)
                   6585: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   6586: .  if defined(BUILTIN_PKG.foo)
                   6587: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   6588: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   6589: USE_BUILTIN.foo!=                                                       \
                   6590:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   6591:               ${ECHO} "yes";                                            \
                   6592:       else                                                              \
                   6593:               ${ECHO} "no";                                             \
                   6594:       fi
                   6595: .      endif
                   6596: .    endfor
                   6597: .  endif
                   6598: .endif  # USE_BUILTIN.foo
                   6599: 
                   6600: CHECK_BUILTIN.foo?=     no
                   6601: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   6602: #
                   6603: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   6604: # "yes" or "no".
                   6605: #
                   6606: .endif  # CHECK_BUILTIN.foo
                   6607:       
                   6608: </pre>
                   6609: 
1.14      xtraeme  6610:             <p>The first section sets <code class=
                   6611:             "varname">IS_BUILTIN.<em class=
                   6612:             "replaceable"><code>pkg</code></em></code> depending on
                   6613:             if <em class="replaceable"><code>pkg</code></em> really
                   6614:             exists in the base system. This should not be a base
                   6615:             system software with similar functionality to
                   6616:             <em class="replaceable"><code>pkg</code></em>; it
                   6617:             should only be &#8220;<span class=
                   6618:             "quote">yes</span>&#8221; if the actual package is
                   6619:             included as part of the base system. This variable is
                   6620:             only used internally within the <code class=
                   6621:             "filename">builtin.mk</code> file.</p>
                   6622: 
                   6623:             <p>The second section sets <code class=
                   6624:             "varname">BUILTIN_PKG.<em class=
                   6625:             "replaceable"><code>pkg</code></em></code> to the
                   6626:             version of <em class=
                   6627:             "replaceable"><code>pkg</code></em> in the base system
                   6628:             if it exists (if <code class=
                   6629:             "varname">IS_BUILTIN.<em class=
                   6630:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6631:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  6632:             variable is only used internally within the
                   6633:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    6634: 
1.14      xtraeme  6635:             <p>The third section sets <code class=
                   6636:             "varname">USE_BUILTIN.<em class=
                   6637:             "replaceable"><code>pkg</code></em></code> and is
                   6638:             <span class="emphasis"><em>required</em></span> in all
                   6639:             <code class="filename">builtin.mk</code> files. The
                   6640:             code in this section must make the determination
                   6641:             whether the built-in software is adequate to satisfy
                   6642:             the dependencies listed in <code class=
                   6643:             "varname">BUILDLINK_DEPENDS.<em class=
                   6644:             "replaceable"><code>pkg</code></em></code>. This is
                   6645:             typically done by comparing <code class=
                   6646:             "varname">BUILTIN_PKG.<em class=
                   6647:             "replaceable"><code>pkg</code></em></code> against each
                   6648:             of the dependencies in <code class=
                   6649:             "varname">BUILDLINK_DEPENDS.<em class=
                   6650:             "replaceable"><code>pkg</code></em></code>.
                   6651:             <code class="varname">USE_BUILTIN.<em class=
                   6652:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    6653:             "emphasis"><em>must</em></span> be set to the correct
1.14      xtraeme  6654:             value by the end of the <code class=
                   6655:             "filename">builtin.mk</code> file. Note that
                   6656:             <code class="varname">USE_BUILTIN.<em class=
                   6657:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    6658:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  6659:             <code class="varname">IS_BUILTIN.<em class=
                   6660:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6661:             &#8220;<span class="quote">no</span>&#8221; because we
                   6662:             may make the determination that the built-in version of
                   6663:             the software is similar enough to be used as a
                   6664:             replacement.</p>
                   6665: 
1.14      xtraeme  6666:             <p>The last section is guarded by <code class=
                   6667:             "varname">CHECK_BUILTIN.<em class=
                   6668:             "replaceable"><code>pkg</code></em></code>, and
                   6669:             includes code that uses the value of <code class=
                   6670:             "varname">USE_BUILTIN.<em class=
                   6671:             "replaceable"><code>pkg</code></em></code> set in the
                   6672:             previous section. This typically includes, e.g., adding
1.1       grant    6673:             additional dependency restrictions and listing
1.14      xtraeme  6674:             additional files to symlink into <code class=
                   6675:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   6676:             "varname">BUILDLINK_FILES.<em class=
                   6677:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    6678:           </div>
                   6679: 
                   6680:           <div class="sect2" lang="en" xml:lang="en">
                   6681:             <div class="titlepage">
                   6682:               <div>
                   6683:                 <div>
1.15      xtraeme  6684:                   <h3 class="title"><a name="id2588877" id=
                   6685:                   "id2588877"></a>9.3.2.&nbsp;Global preferences
1.1       grant    6686:                   for native or pkgsrc software</h3>
                   6687:                 </div>
                   6688:               </div>
                   6689:             </div>
                   6690: 
                   6691:             <p>When building packages, it's possible to choose
                   6692:             whether to set a global preference for using either the
                   6693:             built-in (native) version or the pkgsrc version of
                   6694:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  6695:             setting <code class="varname">PREFER_PKGSRC</code> and
                   6696:             <code class="varname">PREFER_NATIVE</code>. These
                   6697:             variables take values of either &#8220;<span class=
1.1       grant    6698:             "quote">yes</span>&#8221;, &#8220;<span class=
                   6699:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  6700:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   6701:             to use the pkgsrc versions of software, while
                   6702:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   6703:             to use the built-in versions. Preferences are
                   6704:             determined by the most specific instance of the package
                   6705:             in either <code class="varname">PREFER_PKGSRC</code> or
                   6706:             <code class="varname">PREFER_NATIVE</code>. If a
                   6707:             package is specified in neither or in both variables,
                   6708:             then <code class="varname">PREFER_PKGSRC</code> has
                   6709:             precedence over <code class=
                   6710:             "varname">PREFER_NATIVE</code>. For example, to require
                   6711:             using pkgsrc versions of software for all but the most
                   6712:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    6713:             <pre class="programlisting">
                   6714:         PREFER_PKGSRC=  yes
                   6715:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   6716:       
                   6717: </pre>
                   6718: 
                   6719:             <p>A package <span class=
1.14      xtraeme  6720:             "emphasis"><em>must</em></span> have a <code class=
                   6721:             "filename">builtin.mk</code> file to be listed in
                   6722:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   6723:             it is simply ignored in that list.</p>
1.1       grant    6724:           </div>
                   6725:         </div>
                   6726:       </div>
                   6727: 
                   6728:       <div class="chapter" lang="en" xml:lang="en">
                   6729:         <div class="titlepage">
                   6730:           <div>
                   6731:             <div>
                   6732:               <h2 class="title"><a name="options" id=
                   6733:               "options"></a>Chapter&nbsp;10.&nbsp;Options
                   6734:               handling</h2>
                   6735:             </div>
                   6736:           </div>
                   6737:         </div>
                   6738: 
                   6739:         <div class="toc">
                   6740:           <p><b>Table of Contents</b></p>
                   6741: 
                   6742:           <dl>
1.15      xtraeme  6743:             <dt><span class="sect1"><a href="#id2588950">10.1.
1.1       grant    6744:             Global default options</a></span></dt>
                   6745: 
1.15      xtraeme  6746:             <dt><span class="sect1"><a href="#id2588965">10.2.
1.14      xtraeme  6747:             Converting packages to use <code class=
                   6748:             "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    6749:           </dl>
                   6750:         </div>
                   6751: 
                   6752:         <p>Many packages have the ability to be built to support
1.14      xtraeme  6753:         different sets of features. <code class=
                   6754:         "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1       grant    6755:         that provides generic handling of those options that
                   6756:         determine different ways in which the packages can be
                   6757:         built. It's possible for the user to specify exactly which
                   6758:         sets of options will be built into a package or to allow a
                   6759:         set of global default options apply.</p>
                   6760: 
                   6761:         <div class="sect1" lang="en" xml:lang="en">
                   6762:           <div class="titlepage">
                   6763:             <div>
                   6764:               <div>
                   6765:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  6766:                 "id2588950" id="id2588950"></a>10.1.&nbsp;Global
1.1       grant    6767:                 default options</h2>
                   6768:               </div>
                   6769:             </div>
                   6770:           </div>
                   6771: 
1.14      xtraeme  6772:           <p>Global default options are listed in <code class=
                   6773:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1       grant    6774:           the options that should be built into every package if
                   6775:           that option is supported. This variable should be set in
1.14      xtraeme  6776:           <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    6777:         </div>
                   6778: 
                   6779:         <div class="sect1" lang="en" xml:lang="en">
                   6780:           <div class="titlepage">
                   6781:             <div>
                   6782:               <div>
                   6783:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  6784:                 "id2588965" id=
                   6785:                 "id2588965"></a>10.2.&nbsp;Converting packages to
1.14      xtraeme  6786:                 use <code class=
                   6787:                 "filename">bsd.options.mk</code></h2>
1.1       grant    6788:               </div>
                   6789:             </div>
                   6790:           </div>
                   6791: 
1.14      xtraeme  6792:           <p>The following example shows how <code class=
                   6793:           "filename">bsd.options.mk</code> should be use in a
                   6794:           package <code class="filename">Makefile</code>, or in a
                   6795:           file, e.g. <code class="filename">options.mk</code>, that
                   6796:           is included by the main package <code class=
                   6797:           "filename">Makefile</code>.</p>
1.1       grant    6798:           <pre class="programlisting">
                   6799: # Global and legacy options
                   6800: .if defined(WIBBLE_USE_OPENLDAP) &amp;&amp; !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
                   6801: PKG_DEFAULT_OPTIONS+=   ldap
                   6802: .endif
                   6803: .if defined(USE_SASL2) &amp;&amp; !empty(USE_SASL2:M[yY][eE][sS])
                   6804: PKG_DEFAULT_OPTIONS+=   sasl
                   6805: .endif
                   6806: 
                   6807: PKG_OPTIONS_VAR=        PKG_OPTIONS.wibble
                   6808: PKG_SUPPORTED_OPTIONS=  ldap sasl
                   6809: #
                   6810: # Default options for "wibble" package.
                   6811: #
                   6812: .if !defined(PKG_OPTIONS.wibble)
                   6813: PKG_DEFAULT_OPTIONS+=   sasl
                   6814: endif
                   6815: .include "../../mk/bsd.options.mk"
                   6816: 
                   6817: # Package-specific option-handling
                   6818: 
                   6819: ###
                   6820: ### LDAP support
                   6821: ###
                   6822: .if !empty(PKG_OPTIONS:Mldap)
                   6823: .  include "../../databases/openldap/buildlink3.mk"
                   6824: CONFIGURE_ARGS+=      --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   6825: .endif
                   6826: 
                   6827: ###
                   6828: ### SASL authentication
                   6829: ###
                   6830: .if !empty(PKG_OPTIONS:Msasl)
                   6831: .  include "../../security/cyrus-sasl2/buildlink3.mk"
                   6832: CONFIGURE_ARGS+=        --enable-sasl=${BUILDLINK_PREFIX.sasl}
                   6833: .endif
                   6834:       
                   6835: </pre>
                   6836: 
                   6837:           <p>The first section only exists if you are converting a
                   6838:           package that had its own ad-hoc options handling to use
1.14      xtraeme  6839:           <code class="filename">bsd.options.mk</code>. It converts
1.1       grant    6840:           global or legacy options variables into an equivalent
1.14      xtraeme  6841:           <code class="varname">PKG_OPTIONS.<em class=
                   6842:           "replaceable"><code>pkg</code></em></code> value. These
                   6843:           sections will be removed over time as the old options are
                   6844:           in turn deprecated and removed.</p>
1.1       grant    6845: 
                   6846:           <p>The second section contains the information about
                   6847:           which build options are supported by the package, and any
                   6848:           default options settings if needed.</p>
                   6849: 
                   6850:           <div class="orderedlist">
                   6851:             <ol type="1">
                   6852:               <li>
1.14      xtraeme  6853:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
                   6854:                 a list of the name of the <a href=
1.1       grant    6855:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6856:                 <span class="citerefentry"><span class=
                   6857:                 "refentrytitle">make</span>(1)</span></a> variables
                   6858:                 that contain the options the user wishes to select.
                   6859:                 The recommended value is &#8220;<span class=
1.14      xtraeme  6860:                 "quote">PKG_OPTIONS.<em class=
                   6861:                 "replaceable"><code>pkg</code></em></span>&#8221;
                   6862:                 but any package-specific value may be used. This
1.1       grant    6863:                 variable should be set in a package Makefile.</p>
                   6864:               </li>
                   6865: 
                   6866:               <li>
1.14      xtraeme  6867:                 <p><code class=
                   6868:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
                   6869:                 build options supported by the package. This
                   6870:                 variable should be set in a package Makefile.</p>
1.1       grant    6871:               </li>
                   6872: 
                   6873:               <li>
1.14      xtraeme  6874:                 <p><code class="varname">${PKG_OPTIONS_VAR}</code>
                   6875:                 (the variables named in <code class=
                   6876:                 "varname">PKG_OPTIONS_VAR</code>) are variables
                   6877:                 that list the selected build options and override
                   6878:                 any default options given in <code class=
                   6879:                 "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1       grant    6880:                 options begin with a &#8220;<span class=
                   6881:                 "quote">-</span>&#8221;, then that option is always
                   6882:                 removed from the selected build options, e.g.</p>
                   6883:                 <pre class="programlisting">
                   6884:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   6885:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6886:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
                   6887:         # implies PKG_OPTIONS == "kerberos ldap"
                   6888:           
                   6889: </pre>
                   6890: 
                   6891:                 <p>or</p>
                   6892:                 <pre class="programlisting">
                   6893:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6894:         WIBBLE_OPTIONS=         kerberos -ldap ldap
                   6895:         # implies PKG_OPTIONS == "kerberos"
                   6896:           
                   6897: </pre>
                   6898: 
1.14      xtraeme  6899:                 <p>This variable should be set in <code class=
                   6900:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    6901:               </li>
                   6902:             </ol>
                   6903:           </div>
                   6904: 
                   6905:           <p>After the inclusion of bsd.options.mk, the following
                   6906:           variables are set:</p>
                   6907: 
                   6908:           <div class="itemizedlist">
                   6909:             <ul type="disc">
                   6910:               <li>
1.14      xtraeme  6911:                 <p><code class="varname">PKG_OPTIONS</code>
                   6912:                 contains the list of the selected build options,
                   6913:                 properly filtered to remove unsupported and
                   6914:                 duplicate options.</p>
1.1       grant    6915:               </li>
                   6916:             </ul>
                   6917:           </div>
                   6918: 
                   6919:           <p>The remaining sections contain the logic that is
                   6920:           specific to each option. There should be a check for
1.14      xtraeme  6921:           every option listed in <code class=
                   6922:           "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
                   6923:           be clear documentation on what turning on the option will
                   6924:           do in the comments preceding each section. The correct
                   6925:           way to check for an option is to check whether it is
                   6926:           listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1       grant    6927:         </div>
                   6928:       </div>
                   6929: 
                   6930:       <div class="chapter" lang="en" xml:lang="en">
                   6931:         <div class="titlepage">
                   6932:           <div>
                   6933:             <div>
                   6934:               <h2 class="title"><a name="build" id=
                   6935:               "build"></a>Chapter&nbsp;11.&nbsp;The build
                   6936:               process</h2>
                   6937:             </div>
                   6938:           </div>
                   6939:         </div>
                   6940: 
                   6941:         <div class="toc">
                   6942:           <p><b>Table of Contents</b></p>
                   6943: 
                   6944:           <dl>
                   6945:             <dt><span class="sect1"><a href="#build.prefix">11.1.
                   6946:             Program location</a></span></dt>
                   6947: 
1.15      xtraeme  6948:             <dt><span class="sect1"><a href="#id2589573">11.2. Main
1.1       grant    6949:             targets</a></span></dt>
                   6950: 
                   6951:             <dt><span class="sect1"><a href=
                   6952:             "#build.helpful-targets">11.3. Other helpful
                   6953:             targets</a></span></dt>
                   6954:           </dl>
                   6955:         </div>
                   6956: 
                   6957:         <p>The basic steps for building a program are always the
                   6958:         same. First the program's source (<span class=
                   6959:         "emphasis"><em>distfile</em></span>) must be brought to the
                   6960:         local system and then extracted. After any patches to
                   6961:         compile properly on NetBSD are applied, the software can be
                   6962:         configured, then built (usually by compiling), and finally
                   6963:         the generated binaries, etc. can be put into place on the
                   6964:         system. These are exactly the steps performed by the NetBSD
                   6965:         package system, which is implemented as a series of targets
1.14      xtraeme  6966:         in a central Makefile, <code class=
                   6967:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    6968: 
                   6969:         <div class="sect1" lang="en" xml:lang="en">
                   6970:           <div class="titlepage">
                   6971:             <div>
                   6972:               <div>
                   6973:                 <h2 class="title" style="clear: both"><a name=
                   6974:                 "build.prefix" id=
                   6975:                 "build.prefix"></a>11.1.&nbsp;Program location</h2>
                   6976:               </div>
                   6977:             </div>
                   6978:           </div>
                   6979: 
                   6980:           <p>Before outlining the process performed by the NetBSD
                   6981:           package system in the next section, here's a brief
                   6982:           discussion on where programs are installed, and which
                   6983:           variables influence this.</p>
                   6984: 
1.14      xtraeme  6985:           <p>The automatic variable <code class=
                   6986:           "varname">PREFIX</code> indicates where all files of the
                   6987:           final program shall be installed. It is usually set to
                   6988:           <code class="varname">LOCALBASE</code> (<code class=
                   6989:           "filename">/usr/pkg</code>), or <code class=
                   6990:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    6991:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  6992:           The value of <code class="varname">PREFIX</code> needs to
                   6993:           be put into the various places in the program's source
                   6994:           where paths to these files are encoded. See <a href=
1.1       grant    6995:           "#components.patches" title=
                   6996:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   6997:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   6998:           title=
                   6999:           "12.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;12.3.1,
                   7000:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   7001:           details.</p>
                   7002: 
                   7003:           <p>When choosing which of these variables to use, follow
                   7004:           the following rules:</p>
                   7005: 
                   7006:           <div class="itemizedlist">
                   7007:             <ul type="disc">
                   7008:               <li>
1.14      xtraeme  7009:                 <p><code class="varname">PREFIX</code> always
                   7010:                 points to the location where the current pkg will
                   7011:                 be installed. When referring to a pkg's own
1.1       grant    7012:                 installation path, use &#8220;<span class=
                   7013:                 "quote">${PREFIX}</span>&#8221;.</p>
                   7014:               </li>
                   7015: 
                   7016:               <li>
1.14      xtraeme  7017:                 <p><code class="varname">LOCALBASE</code> is where
                   7018:                 all non-X11 pkgs are installed. If you need to
1.1       grant    7019:                 construct a -I or -L argument to the compiler to
                   7020:                 find includes and libraries installed by another
                   7021:                 non-X11 pkg, use &#8220;<span class=
                   7022:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   7023:               </li>
                   7024: 
                   7025:               <li>
1.14      xtraeme  7026:                 <p><code class="varname">X11BASE</code> is where
                   7027:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    7028:                 installed. When looking for <span class=
                   7029:                 "emphasis"><em>standard</em></span> X11 includes
                   7030:                 (not those installed by a pkg), use
                   7031:                 &#8220;<span class=
                   7032:                 "quote">${X11BASE}</span>&#8221;.</p>
                   7033:               </li>
                   7034: 
                   7035:               <li>
                   7036:                 <p>X11 based are special in that they may be
1.14      xtraeme  7037:                 installed in either <code class=
                   7038:                 "varname">X11BASE</code> or <code class=
                   7039:                 "varname">LOCALBASE</code>.</p>
1.1       grant    7040: 
                   7041:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  7042:                 <code class="varname">LOCALBASE</code> whenever
                   7043:                 possible. Note that you will need to set
                   7044:                 <code class="varname">USE_X11</code> in them to
                   7045:                 request the presence of X11 and to get the right
                   7046:                 compilation flags.</p>
1.1       grant    7047: 
                   7048:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  7049:                 be installed under <code class=
                   7050:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    7051:                 app-defaults files. These packages are special and
1.14      xtraeme  7052:                 they must be placed under <code class=
                   7053:                 "varname">X11BASE</code>. To accomplish this, set
                   7054:                 either <code class="varname">USE_X11BASE</code> or
                   7055:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    7056:                 package.</p>
                   7057: 
1.14      xtraeme  7058:                 <p>Some notes: <code class="varname">USE_X11</code>
                   7059:                 and <code class="varname">USE_X11BASE</code> are
                   7060:                 mutually exclusive. If you need to find includes or
                   7061:                 libraries installed by a pkg that has <code class=
                   7062:                 "varname">USE_IMAKE</code> or <code class=
                   7063:                 "varname">USE_X11BASE</code> in its pkg
                   7064:                 <code class="filename">Makefile</code>, you need to
                   7065:                 use <span class="emphasis"><em>both</em></span>
                   7066:                 <code class="filename">${X11BASE}</code> and
                   7067:                 <code class="filename">${LOCALBASE}</code>. To
                   7068:                 force installation of all X11 packages in
                   7069:                 <code class="varname">LOCALBASE</code>, the
                   7070:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7071:                 href=
1.1       grant    7072:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.14      xtraeme  7073:                 class="pkgname">pkgtools/xpkgwedge</a> is enabled
                   7074:                 by default.</p>
1.1       grant    7075:               </li>
                   7076: 
                   7077:               <li>
1.14      xtraeme  7078:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    7079:                 used to refer to the installed location of an X11
1.14      xtraeme  7080:                 package. <code class="varname">X11PREFIX</code>
                   7081:                 will be set to <code class="varname">X11BASE</code>
                   7082:                 if xpkgwedge is not installed, and to <code class=
                   7083:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    7084:                 installed.</p>
                   7085:               </li>
                   7086: 
                   7087:               <li>
                   7088:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  7089:                 have some packages installed in <code class=
                   7090:                 "varname">X11BASE</code> and some in <code class=
                   7091:                 "varname">LOCALBASE</code>. To determine the prefix
                   7092:                 of an installed package, the <code class=
                   7093:                 "varname">EVAL_PREFIX</code> definition can be
                   7094:                 used. It takes pairs in the format
                   7095:                 &#8220;<span class=
1.1       grant    7096:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.14      xtraeme  7097:                 the make(1) variable <code class=
                   7098:                 "varname">DIRNAME</code> will be set to the prefix
                   7099:                 of the installed package &lt;package&gt;, or
1.1       grant    7100:                 &#8220;<span class=
                   7101:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   7102:                 is not installed.</p>
                   7103: 
                   7104:                 <p>This is best illustrated by example.</p>
                   7105: 
1.14      xtraeme  7106:                 <p>The following lines are taken from <code class=
                   7107:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    7108:                 <pre class="programlisting">
1.14      xtraeme  7109: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    7110: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   7111:                         --with-gtk-prefix="${GTKDIR}"           \
                   7112:                         --enable-multibyte
                   7113: </pre>
                   7114: 
                   7115:                 <p>Specific defaults can be defined for the
1.14      xtraeme  7116:                 packages evaluated using <code class=
                   7117:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    7118:                 of the form:</p>
                   7119:                 <pre class="programlisting">
                   7120: GTKDIR_DEFAULT= ${LOCALBASE}
                   7121: </pre>
                   7122: 
1.14      xtraeme  7123:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    7124:                 corresponds to the first definition in the
1.14      xtraeme  7125:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    7126:               </li>
                   7127: 
                   7128:               <li>
1.14      xtraeme  7129:                 <p>Within <code class="filename">${PREFIX}</code>,
1.1       grant    7130:                 packages should install files according to hier(7),
                   7131:                 with the exception that manual pages go into
1.14      xtraeme  7132:                 <code class="filename">${PREFIX}/man</code>, not
                   7133:                 <code class=
                   7134:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    7135:               </li>
                   7136:             </ul>
                   7137:           </div>
                   7138:         </div>
                   7139: 
                   7140:         <div class="sect1" lang="en" xml:lang="en">
                   7141:           <div class="titlepage">
                   7142:             <div>
                   7143:               <div>
                   7144:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  7145:                 "id2589573" id="id2589573"></a>11.2.&nbsp;Main
1.1       grant    7146:                 targets</h2>
                   7147:               </div>
                   7148:             </div>
                   7149:           </div>
                   7150: 
                   7151:           <p>The main targets used during the build process defined
1.14      xtraeme  7152:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    7153: 
                   7154:           <div class="variablelist">
                   7155:             <dl>
                   7156:               <dt><span class="term">fetch</span></dt>
                   7157: 
                   7158:               <dd>
                   7159:                 <p>This will check if the file(s) given in the
1.14      xtraeme  7160:                 variables <code class="varname">DISTFILES</code>
                   7161:                 and <code class="varname">PATCHFILES</code> (as
                   7162:                 defined in the package's Makefile) are present on
                   7163:                 the local system in <code class=
                   7164:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   7165:                 are not present, an attempt will be made to fetch
                   7166:                 them using commands of the form:</p>
1.1       grant    7167:                 <pre class="programlisting">
                   7168: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   7169: </pre>
                   7170: 
                   7171:                 <p>where ${site} varies through several
1.14      xtraeme  7172:                 possibilities in turn: first, <code class=
                   7173:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   7174:                 then the sites specified in either <code class=
                   7175:                 "varname">SITES_file</code> if defined, else
                   7176:                 <code class="varname">MASTER_SITES</code> or
                   7177:                 <code class="varname">PATCH_SITES</code>, as
                   7178:                 applies, then finally the value of <code class=
                   7179:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   7180:                 all except the first can be optionally sorted by
                   7181:                 the user, via setting either <code class=
                   7182:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   7183:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    7184:               </dd>
                   7185: 
                   7186:               <dt><span class="term">checksum</span></dt>
                   7187: 
                   7188:               <dd>
                   7189:                 <p>After the distfile(s) are fetched, their
                   7190:                 checksum is generated and compared with the
                   7191:                 checksums stored in the distinfo file. If the
                   7192:                 checksums don't match, the build is aborted. This
                   7193:                 is to ensure the same distfile is used for
                   7194:                 building, and that the distfile wasn't changed,
                   7195:                 e.g. by some malign force, deliberately changed
                   7196:                 distfiles on the master distribution site or
                   7197:                 network lossage.</p>
                   7198:               </dd>
                   7199: 
                   7200:               <dt><span class="term">extract</span></dt>
                   7201: 
                   7202:               <dd>
                   7203:                 <p>When the distfiles are present on the local
                   7204:                 system, they need to be extracted, as they are
                   7205:                 usually in the form of some compressed archive
1.14      xtraeme  7206:                 format, most commonly <code class=
                   7207:                 "filename">.tar.gz</code>.</p>
1.1       grant    7208: 
                   7209:                 <p>If only some of the distfiles need to be
                   7210:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  7211:                 be put into <code class=
                   7212:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    7213: 
1.14      xtraeme  7214:                 <p>If the distfiles are not in <code class=
                   7215:                 "filename">.tar.gz</code> format, they can be
                   7216:                 extracted by setting either <code class=
                   7217:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   7218:                 "varname">EXTRACT_CMD</code>, <code class=
                   7219:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   7220:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   7221:                 the former case, pkgsrc knows how to extract a
                   7222:                 number of suffixes (<code class=
                   7223:                 "filename">.tar.gz</code>, <code class=
                   7224:                 "filename">.tgz</code>, <code class=
                   7225:                 "filename">.tar.gz2</code>, <code class=
                   7226:                 "filename">.tbz</code>, <code class=
                   7227:                 "filename">.tar.Z</code>, <code class=
                   7228:                 "filename">.tar</code>, <code class=
                   7229:                 "filename">.shar.gz</code>, <code class=
                   7230:                 "filename">.shar.bz2</code>, <code class=
                   7231:                 "filename">.shar.Z</code>, <code class=
                   7232:                 "filename">.shar</code>, <code class=
                   7233:                 "filename">.Z</code>, <code class=
                   7234:                 "filename">.bz2</code> and <code class=
                   7235:                 "filename">.gz</code>; see the definition of the
                   7236:                 various <code class="varname">DECOMPRESS_CMD</code>
                   7237:                 variables <code class="filename">bsd.pkg.mk</code>
                   7238:                 for a complete list). Here's an example on how to
                   7239:                 use the other variables for a program that comes
                   7240:                 with a compressed shell archive whose name ends in
                   7241:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    7242:                 <pre class="programlisting">
                   7243:      EXTRACT_SUFX=   .msg.gz
                   7244:      EXTRACT_CMD=            zcat
                   7245:      EXTRACT_BEFORE_ARGS=
                   7246:      EXTRACT_AFTER_ARGS=     |sh
                   7247: </pre>
                   7248:               </dd>
                   7249: 
                   7250:               <dt><span class="term">patch</span></dt>
                   7251: 
                   7252:               <dd>
                   7253:                 <p>After extraction, all the patches named by the
1.14      xtraeme  7254:                 <code class="varname">PATCHFILES</code>, those
                   7255:                 present in the patches subdirectory of the package
                   7256:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
                   7257:                 <code class=
                   7258:                 "filename">/usr/local/patches/graphics/png</code>)
                   7259:                 are applied. Patchfiles ending in <code class=
                   7260:                 "filename">.Z</code> or <code class=
                   7261:                 "filename">.gz</code> are uncompressed before they
                   7262:                 are applied, files ending in <code class=
                   7263:                 "filename">.orig</code> or <code class=
                   7264:                 "filename">.rej</code> are ignored. Any special
                   7265:                 options to patch(1) can be handed in <code class=
                   7266:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   7267:                 "#components.patches" title=
1.1       grant    7268:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   7269:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   7270: 
                   7271:                 <p>By default patch(1) is given special args to
                   7272:                 make it fail if the patches apply with some lines
                   7273:                 of fuzz. Please fix (regen) the patches so that
                   7274:                 they apply cleanly. The rationale behind this is
                   7275:                 that patches that don't apply cleanly may end up
                   7276:                 being applied in the wrong place, and cause severe
                   7277:                 harm there.</p>
                   7278:               </dd>
                   7279: 
                   7280:               <dt><span class="term">configure</span></dt>
                   7281: 
                   7282:               <dd>
                   7283:                 <p>Most pieces of software need information on the
                   7284:                 header files, system calls, and library routines
                   7285:                 which are available in NetBSD. This is the process
                   7286:                 known as configuration, and is usually automated.
                   7287:                 In most cases, a script is supplied with the
                   7288:                 source, and its invocation results in generation of
                   7289:                 header files, Makefiles, etc.</p>
                   7290: 
                   7291:                 <p>If the program's distfile contains its own
                   7292:                 configure script, this can be invoked by setting
1.14      xtraeme  7293:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    7294:                 configure script is a GNU autoconf script,
1.14      xtraeme  7295:                 <code class="varname">GNU_CONFIGURE</code> should
                   7296:                 be specified instead. In either case, any arguments
                   7297:                 to the configure script can be specified in the
                   7298:                 <code class="varname">CONFIGURE_ARGS</code>
                   7299:                 variable, and the configure script's name can be
                   7300:                 set in <code class=
                   7301:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   7302:                 from the default &#8220;<span class=
1.1       grant    7303:                 "quote">configure</span>&#8221;. Here's an example
                   7304:                 from the <a xmlns=
                   7305:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7306:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.14      xtraeme  7307:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    7308:                 <pre class="programlisting">
                   7309: HAS_CONFIGURE=          yes
                   7310: CONFIGURE_SCRIPT=       Configure
                   7311: CONFIGURE_ARGS+=        netbsd13
                   7312: </pre>
                   7313: 
                   7314:                 <p>If the program uses an Imakefile for
                   7315:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  7316:                 by setting <code class="varname">USE_IMAKE</code>
                   7317:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   7318:                 (If you only want the package installed in
                   7319:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   7320:                 not being run, set <code class=
                   7321:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    7322:               </dd>
                   7323: 
                   7324:               <dt><span class="term">build</span></dt>
                   7325: 
                   7326:               <dd>
                   7327:                 <p>Once configuration has taken place, the software
1.14      xtraeme  7328:                 will be built by invoking <code class=
                   7329:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   7330:                 "varname">$MAKEFILE</code> with <code class=
                   7331:                 "varname">$BUILD_TARGET</code> as the target to
                   7332:                 build. The default <code class=
                   7333:                 "varname">MAKE_PROGRAM</code> is
                   7334:                 &#8220;<span class="quote">gmake</span>&#8221; if
                   7335:                 <code class="varname">USE_GNU_TOOLS</code> contains
1.7       wiz      7336:                 &#8220;<span class="quote">make</span>&#8221;,
1.1       grant    7337:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  7338:                 otherwise. <code class="varname">MAKEFILE</code> is
                   7339:                 set to &#8220;<span class=
1.1       grant    7340:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  7341:                 <code class="varname">BUILD_TARGET</code> defaults
                   7342:                 to &#8220;<span class="quote">all</span>&#8221;.
                   7343:                 Any of these variables can be set in the package's
1.1       grant    7344:                 Makefile to change the default build process.</p>
                   7345:               </dd>
                   7346: 
                   7347:               <dt><span class="term">install</span></dt>
                   7348: 
                   7349:               <dd>
                   7350:                 <p>Once the build stage has completed, the final
                   7351:                 step is to install the software in public
                   7352:                 directories, so users can access the programs and
1.14      xtraeme  7353:                 files. As in the build-target, <code class=
                   7354:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   7355:                 <code class="varname">$MAKEFILE</code> here, but
                   7356:                 with the <code class=
                   7357:                 "varname">$INSTALL_TARGET</code> instead, the
                   7358:                 latter defaulting to &#8220;<span class=
                   7359:                 "quote">install</span>&#8221; (plus
                   7360:                 &#8220;<span class=
                   7361:                 "quote">install.man</span>&#8221;, if <code class=
                   7362:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    7363:               </dd>
                   7364:             </dl>
                   7365:           </div>
                   7366: 
                   7367:           <p>If no target is specified, the default is
                   7368:           &#8220;<span class="quote">build</span>&#8221;. If a
                   7369:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  7370:           e.g. <span><strong class="command">make
                   7371:           build</strong></span> will also perform the equivalent
                   7372:           of:</p>
1.1       grant    7373:           <pre class="programlisting">
                   7374: make fetch
                   7375: make checksum
                   7376: make extract
                   7377: make patch
                   7378: make configure
                   7379: make build
                   7380: </pre>
                   7381:         </div>
                   7382: 
                   7383:         <div class="sect1" lang="en" xml:lang="en">
                   7384:           <div class="titlepage">
                   7385:             <div>
                   7386:               <div>
                   7387:                 <h2 class="title" style="clear: both"><a name=
                   7388:                 "build.helpful-targets" id=
                   7389:                 "build.helpful-targets"></a>11.3.&nbsp;Other
                   7390:                 helpful targets</h2>
                   7391:               </div>
                   7392:             </div>
                   7393:           </div>
                   7394: 
                   7395:           <div class="variablelist">
                   7396:             <dl>
                   7397:               <dt><span class="term">pre/post-*</span></dt>
                   7398: 
                   7399:               <dd>
                   7400:                 <p>For any of the main targets described in the
                   7401:                 previous section, two auxiliary targets exist with
                   7402:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   7403:                 &#8220;<span class="quote">post-</span>&#8221; used
                   7404:                 as a prefix for the main target's name. These
                   7405:                 targets are invoked before and after the main
                   7406:                 target is called, allowing extra configuration or
                   7407:                 installation steps be performed from a package's
                   7408:                 Makefile, for example, which a program's configure
                   7409:                 script or install target omitted.</p>
                   7410:               </dd>
                   7411: 
                   7412:               <dt><span class="term">do-*</span></dt>
                   7413: 
                   7414:               <dd>
                   7415:                 <p>Should one of the main targets do the wrong
                   7416:                 thing, and should there be no variable to fix this,
                   7417:                 you can redefine it with the do-* target. (Note
                   7418:                 that redefining the target itself instead of the
                   7419:                 do-* target is a bad idea, as the pre-* and post-*
                   7420:                 targets won't be called anymore, etc.) You will not
                   7421:                 usually need to do this.</p>
                   7422:               </dd>
                   7423: 
                   7424:               <dt><span class="term">reinstall</span></dt>
                   7425: 
                   7426:               <dd>
1.14      xtraeme  7427:                 <p>If you did a <span><strong class="command">make
                   7428:                 install</strong></span> and you noticed some file
                   7429:                 was not installed properly, you can repeat the
1.1       grant    7430:                 installation with this target, which will ignore
                   7431:                 the &#8220;<span class="quote">already
                   7432:                 installed</span>&#8221; flag.</p>
                   7433:               </dd>
                   7434: 
                   7435:               <dt><span class="term">deinstall</span></dt>
                   7436: 
                   7437:               <dd>
                   7438:                 <p>This target does a pkg_delete(1) in the current
                   7439:                 directory, effectively de-installing the package.
                   7440:                 The following variables can be used to tune the
                   7441:                 behaviour:</p>
                   7442: 
                   7443:                 <div class="variablelist">
                   7444:                   <dl>
1.14      xtraeme  7445:                     <dt><span class="term"><code class=
                   7446:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    7447: 
                   7448:                     <dd>
                   7449:                       <p>Add a "-v" to the <a href=
                   7450:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7451:                       <span class="citerefentry"><span class=
                   7452:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7453:                       command.</p>
                   7454:                     </dd>
                   7455: 
1.14      xtraeme  7456:                     <dt><span class="term"><code class=
                   7457:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    7458: 
                   7459:                     <dd>
                   7460:                       <p>Remove all packages that require (depend
                   7461:                       on) the given package. This can be used to
                   7462:                       remove any packages that may have been pulled
                   7463:                       in by a given package, e.g. if
1.14      xtraeme  7464:                       <span><strong class="command">make deinstall
                   7465:                       DEINSTALLDEPENDS=1</strong></span> is done in
                   7466:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    7467:                       this is likely to remove whole KDE. Works by
                   7468:                       adding &#8220;<span class=
                   7469:                       "quote">-R</span>&#8221; to the <a href=
                   7470:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7471:                       <span class="citerefentry"><span class=
                   7472:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7473:                       command line.</p>
                   7474:                     </dd>
                   7475:                   </dl>
                   7476:                 </div>
                   7477:               </dd>
                   7478: 
                   7479:               <dt><span class="term">update</span></dt>
                   7480: 
                   7481:               <dd>
                   7482:                 <p>This target causes the current package to be
                   7483:                 updated to the latest version. The package and all
                   7484:                 depending packages first get de-installed, then
                   7485:                 current versions of the corresponding packages get
                   7486:                 compiled and installed. This is similar to manually
                   7487:                 noting which packages are currently installed, then
1.14      xtraeme  7488:                 performing a series of <span><strong class=
                   7489:                 "command">make deinstall</strong></span> and
                   7490:                 <span><strong class="command">make
                   7491:                 install</strong></span> (or whatever <code class=
                   7492:                 "varname">UPDATE_TARGET</code> is set to) for these
                   7493:                 packages.</p>
1.1       grant    7494: 
                   7495:                 <p>You can use the &#8220;<span class=
                   7496:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  7497:                 package updating in case a previous
                   7498:                 <span><strong class="command">make
                   7499:                 update</strong></span> was interrupted for some
                   7500:                 reason. However, in this case, make sure you don't
                   7501:                 call <span><strong class="command">make
                   7502:                 clean</strong></span> or otherwise remove the list
                   7503:                 of dependent packages in <code class=
                   7504:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    7505:                 ability to automatically update the current package
                   7506:                 along with the dependent packages you have
                   7507:                 installed.</p>
                   7508: 
1.14      xtraeme  7509:                 <p>Resuming an interrupted <span><strong class=
                   7510:                 "command">make update</strong></span> will only
                   7511:                 work as long as the package tree remains unchanged.
                   7512:                 If the source code for one of the packages to be
                   7513:                 updated has been changed, resuming
                   7514:                 <span><strong class="command">make
                   7515:                 update</strong></span> will most certainly
                   7516:                 fail!</p>
1.1       grant    7517: 
                   7518:                 <p>The following variables can be used either on
1.14      xtraeme  7519:                 the command line or in <code class=
                   7520:                 "filename">/etc/mk.conf</code> to alter the
                   7521:                 behaviour of <span><strong class="command">make
                   7522:                 update</strong></span>:</p>
1.1       grant    7523: 
                   7524:                 <div class="variablelist">
                   7525:                   <dl>
1.14      xtraeme  7526:                     <dt><span class="term"><code class=
                   7527:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    7528: 
                   7529:                     <dd>
                   7530:                       <p>Install target to recursively use for the
                   7531:                       updated package and the dependent packages.
1.14      xtraeme  7532:                       Defaults to <code class=
                   7533:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    7534:                       &#8220;<span class=
                   7535:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  7536:                       <span><strong class="command">make
                   7537:                       update</strong></span>. e.g.
                   7538:                       <span><strong class="command">make update
                   7539:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    7540:                     </dd>
                   7541: 
1.14      xtraeme  7542:                     <dt><span class="term"><code class=
                   7543:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    7544: 
                   7545:                     <dd>
                   7546:                       <p>Don't clean up after updating. Useful if
                   7547:                       you want to leave the work sources of the
                   7548:                       updated packages around for inspection or
                   7549:                       other purposes. Be sure you eventually clean
                   7550:                       up the source tree (see the
                   7551:                       &#8220;<span class=
                   7552:                       "quote">clean-update</span>&#8221; target
                   7553:                       below) or you may run into troubles with old
                   7554:                       source code still lying around on your next
1.14      xtraeme  7555:                       <span><strong class=
                   7556:                       "command">make</strong></span> or
                   7557:                       <span><strong class="command">make
                   7558:                       update</strong></span>.</p>
1.1       grant    7559:                     </dd>
                   7560: 
1.14      xtraeme  7561:                     <dt><span class="term"><code class=
                   7562:                     "varname">REINSTALL</code></span></dt>
1.1       grant    7563: 
                   7564:                     <dd>
                   7565:                       <p>Deinstall each package before installing
1.14      xtraeme  7566:                       (making <code class=
                   7567:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    7568:                       necessary if the &#8220;<span class=
                   7569:                       "quote">clean-update</span>&#8221; target
                   7570:                       (see below) was called after interrupting a
1.14      xtraeme  7571:                       running <span><strong class="command">make
                   7572:                       update</strong></span>.</p>
1.1       grant    7573:                     </dd>
                   7574: 
1.14      xtraeme  7575:                     <dt><span class="term"><code class=
                   7576:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    7577: 
                   7578:                     <dd>
                   7579:                       <p>Allows you to disable recursion and
                   7580:                       hardcode the target for packages. The default
                   7581:                       is &#8220;<span class=
                   7582:                       "quote">update</span>&#8221; for the update
                   7583:                       target, facilitating a recursive update of
1.14      xtraeme  7584:                       prerequisite packages. Only set <code class=
                   7585:                       "varname">DEPENDS_TARGET</code> if you want
                   7586:                       to disable recursive updates. Use
                   7587:                       <code class="varname">UPDATE_TARGET</code>
                   7588:                       instead to just set a specific target for
                   7589:                       each package to be installed during
                   7590:                       <span><strong class="command">make
                   7591:                       update</strong></span> (see above).</p>
1.1       grant    7592:                     </dd>
                   7593:                   </dl>
                   7594:                 </div>
                   7595:               </dd>
                   7596: 
                   7597:               <dt><span class="term">clean-update</span></dt>
                   7598: 
                   7599:               <dd>
                   7600:                 <p>Clean the source tree for all packages that
1.14      xtraeme  7601:                 would get updated if <span><strong class=
                   7602:                 "command">make update</strong></span> was called
                   7603:                 from the current directory. This target should not
                   7604:                 be used if the current package (or any of its
                   7605:                 depending packages) have already been de-installed
                   7606:                 (e.g., after calling <span><strong class=
                   7607:                 "command">make update</strong></span>) or you may
                   7608:                 lose some packages you intended to update. As a
                   7609:                 rule of thumb: only use this target <span class=
                   7610:                 "emphasis"><em>before</em></span> the first time
                   7611:                 you run <span><strong class="command">make
                   7612:                 update</strong></span> and only if you have a dirty
                   7613:                 package tree (e.g., if you used <code class=
                   7614:                 "varname">NOCLEAN</code>).</p>
1.1       grant    7615: 
                   7616:                 <p>If you unsure about whether your tree is clean
1.14      xtraeme  7617:                 you can either perform a <span><strong class=
                   7618:                 "command">make clean</strong></span> at the top of
                   7619:                 the tree, or use the following sequence of commands
1.1       grant    7620:                 from the directory of the package you want to
                   7621:                 update (<span class=
                   7622:                 "emphasis"><em>before</em></span> running
1.14      xtraeme  7623:                 <span><strong class="command">make
                   7624:                 update</strong></span> for the first time,
                   7625:                 otherwise you lose all the packages you wanted to
                   7626:                 update!):</p>
1.1       grant    7627:                 <pre class="screen">
1.14      xtraeme  7628: <code class="prompt">#</code> <strong class=
                   7629: "userinput"><code>make clean-update</code></strong>
                   7630: <code class="prompt">#</code> <strong class=
                   7631: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   7632: <code class="prompt">#</code> <strong class=
                   7633: "userinput"><code>make update</code></strong>
1.1       grant    7634: </pre>
                   7635: 
                   7636:                 <p>The following variables can be used either on
1.14      xtraeme  7637:                 the command line or in <code class=
                   7638:                 "filename">/etc/mk.conf</code> to alter the
                   7639:                 behaviour of <span><strong class="command">make
                   7640:                 clean-update</strong></span>:</p>
1.1       grant    7641: 
                   7642:                 <div class="variablelist">
                   7643:                   <dl>
1.14      xtraeme  7644:                     <dt><span class="term"><code class=
                   7645:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    7646: 
                   7647:                     <dd>
1.14      xtraeme  7648:                       <p>After <span><strong class="command">make
                   7649:                       clean</strong></span>, do not reconstruct the
                   7650:                       list of directories to update for this
                   7651:                       package. Only use this if
                   7652:                       <span><strong class="command">make
                   7653:                       update</strong></span> successfully installed
                   7654:                       all packages you wanted to update. Normally,
                   7655:                       this is done automatically on
                   7656:                       <span><strong class="command">make
                   7657:                       update</strong></span>, but may have been
                   7658:                       suppressed by the <code class=
                   7659:                       "varname">NOCLEAN</code> variable (see
1.1       grant    7660:                       above).</p>
                   7661:                     </dd>
                   7662:                   </dl>
                   7663:                 </div>
                   7664:               </dd>
                   7665: 
                   7666:               <dt><span class="term">info</span></dt>
                   7667: 
                   7668:               <dd>
                   7669:                 <p>This target invokes <a href=
                   7670:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   7671:                 <span class="citerefentry"><span class=
                   7672:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   7673:                 the current package. You can use this to check
                   7674:                 which version of a package is installed.</p>
                   7675:               </dd>
                   7676: 
                   7677:               <dt><span class="term">readme</span></dt>
                   7678: 
                   7679:               <dd>
1.14      xtraeme  7680:                 <p>This target generates a <code class=
                   7681:                 "filename">README.html</code> file, which can be
1.1       grant    7682:                 viewed using a browser such as <a xmlns=
                   7683:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7684:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.14      xtraeme  7685:                 class="pkgname">www/mozilla</a> or <a xmlns=
                   7686:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7687:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
                   7688:                 class="pkgname">www/links</a>. The generated files
                   7689:                 contain references to any packages which are in the
                   7690:                 <code class="varname">PACKAGES</code> directory on
                   7691:                 the local host. The generated files can be made to
                   7692:                 refer to URLs based on <code class=
                   7693:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   7694:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
                   7695:                 wanted to generate <code class=
                   7696:                 "filename">README.html</code> files which pointed
                   7697:                 to binary packages on the local machine, in the
                   7698:                 directory <code class=
                   7699:                 "filename">/usr/packages</code>, set <code class=
                   7700:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   7701:                 and <code class=
                   7702:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   7703:                 <code class="varname">${PACKAGES}</code> directory
                   7704:                 and its subdirectories will be searched for all the
                   7705:                 binary packages.</p>
1.1       grant    7706:               </dd>
                   7707: 
                   7708:               <dt><span class="term">readme-all</span></dt>
                   7709: 
                   7710:               <dd>
1.14      xtraeme  7711:                 <p>Use this target to create a file <code class=
                   7712:                 "filename">README-all.html</code> which contains a
1.1       grant    7713:                 list of all packages currently available in the
                   7714:                 NetBSD Packages Collection, together with the
                   7715:                 category they belong to and a short description.
1.14      xtraeme  7716:                 This file is compiled from the <code class=
                   7717:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    7718:                 sure to run this <span class=
1.14      xtraeme  7719:                 "emphasis"><em>after</em></span> a
                   7720:                 <span><strong class="command">make
                   7721:                 readme</strong></span>.</p>
1.1       grant    7722:               </dd>
                   7723: 
                   7724:               <dt><span class="term">cdrom-readme</span></dt>
                   7725: 
                   7726:               <dd>
                   7727:                 <p>This is very much the same as the
                   7728:                 &#8220;<span class="quote">readme</span>&#8221;
                   7729:                 target (see above), but is to be used when
                   7730:                 generating a pkgsrc tree to be written to a CD-ROM.
1.14      xtraeme  7731:                 This target also produces <code class=
                   7732:                 "filename">README.html</code> files, and can be
                   7733:                 made to refer to URLs based on <code class=
                   7734:                 "varname">CDROM_PKG_URL_HOST</code> and
                   7735:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    7736:               </dd>
                   7737: 
                   7738:               <dt><span class="term">show-distfiles</span></dt>
                   7739: 
                   7740:               <dd>
                   7741:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  7742:                 are needed to build the package. (<code class=
                   7743:                 "varname">DISTFILES</code> and <code class=
                   7744:                 "varname">PATCHFILES</code>, but not <code class=
                   7745:                 "filename">patches/*</code>)</p>
1.1       grant    7746:               </dd>
                   7747: 
                   7748:               <dt><span class="term">show-downlevel</span></dt>
                   7749: 
                   7750:               <dd>
                   7751:                 <p>This target shows nothing if the package is not
                   7752:                 installed. If a version of this package is
                   7753:                 installed, but is not the version provided in this
                   7754:                 version of pkgsrc, then a warning message is
                   7755:                 displayed. This target can be used to show which of
                   7756:                 your installed packages are downlevel, and so the
                   7757:                 old versions can be deleted, and the current ones
                   7758:                 added.</p>
                   7759:               </dd>
                   7760: 
                   7761:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   7762: 
                   7763:               <dd>
                   7764:                 <p>This target shows the directory in the pkgsrc
                   7765:                 hierarchy from which the package can be built and
                   7766:                 installed. This may not be the same directory as
                   7767:                 the one from which the package was installed. This
                   7768:                 target is intended to be used by people who may
                   7769:                 wish to upgrade many packages on a single host, and
                   7770:                 can be invoked from the top-level pkgsrc Makefile
                   7771:                 by using the &#8220;<span class=
                   7772:                 "quote">show-host-specific-pkgs</span>&#8221;
                   7773:                 target.</p>
                   7774:               </dd>
                   7775: 
                   7776:               <dt><span class=
                   7777:               "term">show-installed-depends</span></dt>
                   7778: 
                   7779:               <dd>
                   7780:                 <p>This target shows which installed packages match
1.14      xtraeme  7781:                 the current package's <code class=
                   7782:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    7783:                 dependencies are causing build problems.</p>
                   7784:               </dd>
                   7785: 
                   7786:               <dt><span class="term">check-shlibs</span></dt>
                   7787: 
                   7788:               <dd>
                   7789:                 <p>After a package is installed, check all its
                   7790:                 binaries and (on ELF platforms) shared libraries to
                   7791:                 see if they find the shared libs they need. Run by
1.14      xtraeme  7792:                 default if <code class=
                   7793:                 "varname">PKG_DEVELOPER</code> is set in
                   7794:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    7795:               </dd>
                   7796: 
                   7797:               <dt><span class="term">print-PLIST</span></dt>
                   7798: 
                   7799:               <dd>
                   7800:                 <p>After a &#8220;<span class="quote">make
                   7801:                 install</span>&#8221; from a new or upgraded pkg,
                   7802:                 this prints out an attempt to generate a new
1.14      xtraeme  7803:                 <code class="filename">PLIST</code> from a
                   7804:                 <span><strong class="command">find -newer
                   7805:                 work/.extract_done</strong></span>. An attempt is
                   7806:                 made to care for shared libs etc., but it is
1.1       grant    7807:                 <span class="emphasis"><em>strongly</em></span>
                   7808:                 recommended to review the result before putting it
1.14      xtraeme  7809:                 into <code class="filename">PLIST</code>. On
                   7810:                 upgrades, it's useful to diff the output of this
                   7811:                 command against an already existing <code class=
                   7812:                 "filename">PLIST</code> file.</p>
1.1       grant    7813: 
                   7814:                 <p>If the package installs files via tar(1) or
                   7815:                 other methods that don't update file access times,
                   7816:                 be sure to add these files manually to your
1.14      xtraeme  7817:                 <code class="filename">PLIST</code>, as the
1.1       grant    7818:                 &#8220;<span class="quote">find
                   7819:                 -newer</span>&#8221; command used by this target
                   7820:                 won't catch them!</p>
                   7821: 
                   7822:                 <p>See <a href="#print-PLIST" title=
                   7823:                 "8.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;8.3,
1.14      xtraeme  7824:                 &#8220;Tweaking output of <span><strong class=
                   7825:                 "command">make
                   7826:                 print-PLIST</strong></span>&#8221;</a> for more
                   7827:                 information on this target.</p>
1.1       grant    7828:               </dd>
                   7829: 
                   7830:               <dt><span class="term">bulk-package</span></dt>
                   7831: 
                   7832:               <dd>
                   7833:                 <p>Used to do bulk builds. If an appropriate binary
                   7834:                 package already exists, no action is taken. If not,
                   7835:                 this target will compile, install and package it
1.14      xtraeme  7836:                 (and it's depends, if <code class=
                   7837:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    7838:                 <a href="#binary.configuration" title=
                   7839:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   7840:                 &#8220;Configuration&#8221;</a>. After creating the
                   7841:                 binary package, the sources, the just-installed
                   7842:                 package and it's required packages are removed,
                   7843:                 preserving free disk space.</p>
                   7844: 
                   7845:                 <p><span class="emphasis"><em>Beware that this
                   7846:                 target may deinstall all packages installed on a
                   7847:                 system!</em></span></p>
                   7848:               </dd>
                   7849: 
                   7850:               <dt><span class="term">bulk-install</span></dt>
                   7851: 
                   7852:               <dd>
                   7853:                 <p>Used during bulk-installs to install required
                   7854:                 packages. If an upto-date binary package is
                   7855:                 available, it will be installed via <a href=
                   7856:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7857:                 <span class="citerefentry"><span class=
                   7858:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  7859:                 not, <span><strong class="command">make
                   7860:                 bulk-package</strong></span> will be executed, but
                   7861:                 the installed binary not be removed.</p>
1.1       grant    7862: 
                   7863:                 <p>A binary package is considered
                   7864:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   7865:                 to be installed via <a href=
                   7866:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7867:                 <span class="citerefentry"><span class=
                   7868:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   7869:                 if:</p>
                   7870: 
                   7871:                 <div class="itemizedlist">
                   7872:                   <ul type="disc">
                   7873:                     <li>
1.14      xtraeme  7874:                       <p>None of the package's files (<code class=
                   7875:                       "filename">Makefile</code>, ...) were
                   7876:                       modified since it was built.</p>
1.1       grant    7877:                     </li>
                   7878: 
                   7879:                     <li>
                   7880:                       <p>None of the package's required (binary)
                   7881:                       packages were modified since it was
                   7882:                       built.</p>
                   7883:                     </li>
                   7884:                   </ul>
                   7885:                 </div>
                   7886: 
                   7887:                 <p><span class="emphasis"><em>Beware that this
                   7888:                 target may deinstall all packages installed on a
                   7889:                 system!</em></span></p>
                   7890:               </dd>
                   7891:             </dl>
                   7892:           </div>
                   7893:         </div>
                   7894:       </div>
                   7895: 
                   7896:       <div class="chapter" lang="en" xml:lang="en">
                   7897:         <div class="titlepage">
                   7898:           <div>
                   7899:             <div>
                   7900:               <h2 class="title"><a name="fixes" id=
                   7901:               "fixes"></a>Chapter&nbsp;12.&nbsp;Notes on fixes for
                   7902:               packages</h2>
                   7903:             </div>
                   7904:           </div>
                   7905:         </div>
                   7906: 
                   7907:         <div class="toc">
                   7908:           <p><b>Table of Contents</b></p>
                   7909: 
                   7910:           <dl>
1.15      xtraeme  7911:             <dt><span class="sect1"><a href="#id2590973">12.1.
1.1       grant    7912:             General operation</a></span></dt>
                   7913: 
                   7914:             <dd>
                   7915:               <dl>
                   7916:                 <dt><span class="sect2"><a href=
1.15      xtraeme  7917:                 "#id2590977">12.1.1. How to pull in variables from
1.1       grant    7918:                 /etc/mk.conf</a></span></dt>
                   7919: 
                   7920:                 <dt><span class="sect2"><a href=
1.15      xtraeme  7921:                 "#id2591128">12.1.2. Restricted
1.1       grant    7922:                 packages</a></span></dt>
                   7923: 
                   7924:                 <dt><span class="sect2"><a href=
                   7925:                 "#dependencies">12.1.3. Handling
                   7926:                 dependencies</a></span></dt>
                   7927: 
                   7928:                 <dt><span class="sect2"><a href=
1.15      xtraeme  7929:                 "#id2591643">12.1.4. Handling conflicts with other
1.1       grant    7930:                 packages</a></span></dt>
                   7931: 
                   7932:                 <dt><span class="sect2"><a href=
1.15      xtraeme  7933:                 "#id2591762">12.1.5. Packages that cannot or should
1.1       grant    7934:                 not be built</a></span></dt>
                   7935: 
                   7936:                 <dt><span class="sect2"><a href=
1.15      xtraeme  7937:                 "#id2591787">12.1.6. Packages which should not be
1.1       grant    7938:                 deleted, once installed</a></span></dt>
                   7939: 
                   7940:                 <dt><span class="sect2"><a href=
                   7941:                 "#security-handling">12.1.7. Handling packages with
                   7942:                 security problems</a></span></dt>
                   7943: 
                   7944:                 <dt><span class="sect2"><a href=
1.15      xtraeme  7945:                 "#id2591879">12.1.8. How to handle compiler
1.1       grant    7946:                 bugs</a></span></dt>
                   7947: 
                   7948:                 <dt><span class="sect2"><a href=
1.15      xtraeme  7949:                 "#id2591901">12.1.9. How to handle incrementing
1.1       grant    7950:                 versions when fixing an existing
                   7951:                 package</a></span></dt>
                   7952: 
                   7953:                 <dt><span class="sect2"><a href=
1.15      xtraeme  7954:                 "#id2591950">12.1.10. Portability of
1.1       grant    7955:                 packages</a></span></dt>
                   7956:               </dl>
                   7957:             </dd>
                   7958: 
1.15      xtraeme  7959:             <dt><span class="sect1"><a href="#id2591975">12.2.
1.1       grant    7960:             Possible downloading issues</a></span></dt>
                   7961: 
                   7962:             <dd>
                   7963:               <dl>
                   7964:                 <dt><span class="sect2"><a href=
1.15      xtraeme  7965:                 "#id2591978">12.2.1. Packages whose distfiles
1.1       grant    7966:                 aren't available for plain
                   7967:                 downloading</a></span></dt>
                   7968: 
                   7969:                 <dt><span class="sect2"><a href=
1.15      xtraeme  7970:                 "#id2592109">12.2.2. How to handle modified
1.1       grant    7971:                 distfiles with the 'old' name</a></span></dt>
                   7972:               </dl>
                   7973:             </dd>
                   7974: 
1.15      xtraeme  7975:             <dt><span class="sect1"><a href="#id2592121">12.3.
1.1       grant    7976:             Configuration gotchas</a></span></dt>
                   7977: 
                   7978:             <dd>
                   7979:               <dl>
                   7980:                 <dt><span class="sect2"><a href=
                   7981:                 "#fixes.libtool">12.3.1. Shared libraries -
                   7982:                 libtool</a></span></dt>
                   7983: 
                   7984:                 <dt><span class="sect2"><a href=
1.15      xtraeme  7985:                 "#id2592529">12.3.2. Using libtool on GNU packages
1.1       grant    7986:                 that already support libtool</a></span></dt>
                   7987: 
                   7988:                 <dt><span class="sect2"><a href=
1.15      xtraeme  7989:                 "#id2592613">12.3.3. GNU
1.1       grant    7990:                 Autoconf/Automake</a></span></dt>
                   7991:               </dl>
                   7992:             </dd>
                   7993: 
1.15      xtraeme  7994:             <dt><span class="sect1"><a href="#id2592726">12.4.
1.1       grant    7995:             Building considerations</a></span></dt>
                   7996: 
                   7997:             <dd>
                   7998:               <dl>
                   7999:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8000:                 "#id2592729">12.4.1. CPP defines</a></span></dt>
1.1       grant    8001:               </dl>
                   8002:             </dd>
                   8003: 
1.15      xtraeme  8004:             <dt><span class="sect1"><a href="#id2592759">12.5.
1.1       grant    8005:             Package specific actions</a></span></dt>
                   8006: 
                   8007:             <dd>
                   8008:               <dl>
                   8009:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8010:                 "#id2592762">12.5.1. Package configuration
1.1       grant    8011:                 files</a></span></dt>
                   8012: 
                   8013:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8014:                 "#id2592933">12.5.2. User
1.2       hubertf  8015:                 interaction</a></span></dt>
1.1       grant    8016: 
                   8017:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8018:                 "#id2593046">12.5.3. Handling
1.1       grant    8019:                 licenses</a></span></dt>
                   8020: 
                   8021:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8022:                 "#id2593197">12.5.4. Creating an account from a
1.1       grant    8023:                 package</a></span></dt>
                   8024: 
                   8025:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8026:                 "#id2593328">12.5.5. Installing score
1.1       grant    8027:                 files</a></span></dt>
                   8028: 
                   8029:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8030:                 "#id2593371">12.5.6. Packages providing login
1.1       grant    8031:                 shells</a></span></dt>
                   8032: 
                   8033:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8034:                 "#id2593429">12.5.7. Packages containing perl
1.1       grant    8035:                 scripts</a></span></dt>
                   8036: 
                   8037:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8038:                 "#id2593447">12.5.8. Packages with hardcoded paths
1.1       grant    8039:                 to other interpreters</a></span></dt>
                   8040: 
                   8041:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8042:                 "#id2593468">12.5.9. Packages installing perl
1.1       grant    8043:                 modules</a></span></dt>
                   8044: 
                   8045:                 <dt><span class="sect2"><a href=
                   8046:                 "#faq.info-files">12.5.10. Packages installing info
                   8047:                 files</a></span></dt>
                   8048: 
                   8049:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8050:                 "#id2593688">12.5.11. Packages installing GConf2
1.1       grant    8051:                 data files</a></span></dt>
                   8052: 
                   8053:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8054:                 "#id2593788">12.5.12. Packages installing
1.1       grant    8055:                 scrollkeeper data files</a></span></dt>
                   8056: 
                   8057:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8058:                 "#id2593840">12.5.13. Packages installing X11
1.1       grant    8059:                 fonts</a></span></dt>
                   8060: 
                   8061:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8062:                 "#id2593886">12.5.14. Packages installing GTK2
1.1       grant    8063:                 modules</a></span></dt>
                   8064: 
                   8065:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8066:                 "#id2593956">12.5.15. Packages installing SGML or
1.1       grant    8067:                 XML data</a></span></dt>
                   8068: 
                   8069:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8070:                 "#id2594076">12.5.16. Packages installing
1.1       grant    8071:                 extensions to the MIME database</a></span></dt>
                   8072: 
                   8073:                 <dt><span class="sect2"><a href=
1.15      xtraeme  8074:                 "#id2594283">12.5.17. Packages using
1.1       grant    8075:                 intltool</a></span></dt>
                   8076:               </dl>
                   8077:             </dd>
                   8078: 
1.15      xtraeme  8079:             <dt><span class="sect1"><a href="#id2594297">12.6.
1.1       grant    8080:             Feedback to the author</a></span></dt>
                   8081:           </dl>
                   8082:         </div>
                   8083: 
                   8084:         <div class="sect1" lang="en" xml:lang="en">
                   8085:           <div class="titlepage">
                   8086:             <div>
                   8087:               <div>
                   8088:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  8089:                 "id2590973" id="id2590973"></a>12.1.&nbsp;General
1.1       grant    8090:                 operation</h2>
                   8091:               </div>
                   8092:             </div>
                   8093:           </div>
                   8094: 
                   8095:           <div class="sect2" lang="en" xml:lang="en">
                   8096:             <div class="titlepage">
                   8097:               <div>
                   8098:                 <div>
1.15      xtraeme  8099:                   <h3 class="title"><a name="id2590977" id=
                   8100:                   "id2590977"></a>12.1.1.&nbsp;How to pull in
1.1       grant    8101:                   variables from /etc/mk.conf</h3>
                   8102:                 </div>
                   8103:               </div>
                   8104:             </div>
                   8105: 
                   8106:             <p>The problem with package-defined variables that can
1.14      xtraeme  8107:             be overridden via <code class="varname">MAKECONF</code>
                   8108:             or <code class="filename">/etc/mk.conf</code> is that
                   8109:             <a href=
1.1       grant    8110:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8111:             <span class="citerefentry"><span class=
                   8112:             "refentrytitle">make</span>(1)</span></a> expands a
                   8113:             variable as it is used, but evaluates preprocessor like
                   8114:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  8115:             So, to use any variable (which may be set in
                   8116:             <code class="filename">/etc/mk.conf</code>) in one of
                   8117:             the .if* statements, the file <code class=
                   8118:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    8119:             that .if* statement.</p>
                   8120: 
                   8121:             <p>Rather than have a number of ad-hoc ways of
1.14      xtraeme  8122:             including <code class="filename">/etc/mk.conf</code>,
                   8123:             should it exist, or <code class=
                   8124:             "varname">MAKECONF</code>, should it exist, include the
                   8125:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
                   8126:             file in the package Makefile before any
                   8127:             preprocessor-like .if, .ifdef, or .ifndef
                   8128:             statements:</p>
1.1       grant    8129:             <pre class="programlisting">
                   8130: .include "../../mk/bsd.prefs.mk"
                   8131:     
                   8132:     .if defined(USE_MENUS)
                   8133:       ...
                   8134:     .endif
                   8135: </pre>
                   8136: 
1.14      xtraeme  8137:             <p>If you wish to set the <code class=
                   8138:             "varname">CFLAGS</code> variable in <code class=
                   8139:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    8140:             use:</p>
                   8141:             <pre class="programlisting">
                   8142: CFLAGS+=  -your -flags
                   8143: </pre>
                   8144: 
1.14      xtraeme  8145:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   8146:             without the &#8220;<span class="quote">+</span>&#8221;)
                   8147:             may lead to problems with packages that need to add
                   8148:             their own flags. Also, you may want to take a look at
                   8149:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    8150:             href=
                   8151:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.14      xtraeme  8152:             class="pkgname">devel/cpuflags</a> package if you're
                   8153:             interested in optimization for the current CPU.</p>
1.1       grant    8154:           </div>
                   8155: 
                   8156:           <div class="sect2" lang="en" xml:lang="en">
                   8157:             <div class="titlepage">
                   8158:               <div>
                   8159:                 <div>
1.15      xtraeme  8160:                   <h3 class="title"><a name="id2591128" id=
                   8161:                   "id2591128"></a>12.1.2.&nbsp;Restricted
1.1       grant    8162:                   packages</h3>
                   8163:                 </div>
                   8164:               </div>
                   8165:             </div>
                   8166: 
                   8167:             <p>Some licenses restrict how software may be
                   8168:             re-distributed. In order to satisfy these restrictions,
                   8169:             the package system defines five make variables that can
                   8170:             be set to note these restrictions:</p>
                   8171: 
                   8172:             <div class="itemizedlist">
                   8173:               <ul type="disc">
                   8174:                 <li>
1.14      xtraeme  8175:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    8176: 
                   8177:                   <p>This variable should be set whenever a
                   8178:                   restriction exists (regardless of its kind). Set
                   8179:                   this variable to a string containing the reason
                   8180:                   for the restriction.</p>
                   8181:                 </li>
                   8182: 
                   8183:                 <li>
1.14      xtraeme  8184:                   <p><code class=
                   8185:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    8186: 
                   8187:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  8188:                   variable to <code class=
                   8189:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8190:                   package may not be included on a CD-ROM.</p>
                   8191:                 </li>
                   8192: 
                   8193:                 <li>
1.14      xtraeme  8194:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    8195: 
                   8196:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  8197:                   Set this variable to <code class=
                   8198:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8199:                   package may not not be made available on the
                   8200:                   Internet.</p>
                   8201:                 </li>
                   8202: 
                   8203:                 <li>
1.14      xtraeme  8204:                   <p><code class=
                   8205:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    8206: 
                   8207:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  8208:                   this variable to <code class=
                   8209:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8210:                   of the source code or other distfile(s) is not
                   8211:                   allowed on CD-ROMs.</p>
                   8212:                 </li>
                   8213: 
                   8214:                 <li>
1.14      xtraeme  8215:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    8216: 
                   8217:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  8218:                   variable to <code class=
                   8219:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8220:                   of the source code or other distfile(s) via the
                   8221:                   Internet is not allowed.</p>
                   8222:                 </li>
                   8223:               </ul>
                   8224:             </div>
                   8225: 
1.14      xtraeme  8226:             <p>Please note that the use of <code class=
                   8227:             "varname">NO_PACKAGE</code>, <code class=
                   8228:             "varname">IGNORE</code>, <code class=
                   8229:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    8230:             variables to denote restrictions is deprecated, because
                   8231:             they unconditionally prevent users from generating
                   8232:             binary packages!</p>
                   8233:           </div>
                   8234: 
                   8235:           <div class="sect2" lang="en" xml:lang="en">
                   8236:             <div class="titlepage">
                   8237:               <div>
                   8238:                 <div>
                   8239:                   <h3 class="title"><a name="dependencies" id=
                   8240:                   "dependencies"></a>12.1.3.&nbsp;Handling
                   8241:                   dependencies</h3>
                   8242:                 </div>
                   8243:               </div>
                   8244:             </div>
                   8245: 
                   8246:             <p>Your package may depend on some other package being
                   8247:             present - and there are various ways of expressing this
1.14      xtraeme  8248:             dependency. pkgsrc supports the <code class=
                   8249:             "varname">BUILD_DEPENDS</code> and <code class=
                   8250:             "varname">DEPENDS</code> definitions, as well as
                   8251:             dependencies via <code class=
                   8252:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    8253:             way to handle dependencies, and which uses the
                   8254:             variables named above. See <a href="#buildlink" title=
                   8255:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8256:             <i>Buildlink methodology</i></a> for more
                   8257:             information.</p>
                   8258: 
                   8259:             <p>The basic difference between the two variables is as
1.14      xtraeme  8260:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    8261:             definition registers that pre-requisite in the binary
                   8262:             package so it will be pulled in when the binary package
1.14      xtraeme  8263:             is later installed, whilst the <code class=
                   8264:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    8265:             marking a dependency that is only needed for building
                   8266:             the package.</p>
                   8267: 
                   8268:             <p>This means that if you only need a package present
                   8269:             whilst you are building, it should be noted as a
1.14      xtraeme  8270:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    8271: 
1.14      xtraeme  8272:             <p>The format for a <code class=
                   8273:             "varname">BUILD_DEPENDS</code> and a <code class=
                   8274:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    8275:             <pre class="programlisting">
                   8276: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   8277: </pre>
                   8278: 
                   8279:             <p>Please note that the &#8220;<span class=
                   8280:             "quote">pre-req-package-name</span>&#8221; may include
                   8281:             any of the wildcard version numbers recognised by
                   8282:             <a href=
                   8283:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   8284:             <span class="citerefentry"><span class=
                   8285:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   8286: 
                   8287:             <div class="orderedlist">
                   8288:               <ol type="1">
                   8289:                 <li>
                   8290:                   <p>If your package needs another package's
                   8291:                   binaries or libraries to build or run, and if
1.14      xtraeme  8292:                   that package has a <code class=
                   8293:                   "filename">buildlink3.mk</code> file available,
                   8294:                   use it:</p>
1.1       grant    8295:                   <pre class="programlisting">
                   8296:     .include "../../graphics/jpeg/buildlink3.mk"
                   8297:     
                   8298: </pre>
                   8299:                 </li>
                   8300: 
                   8301:                 <li>
                   8302:                   <p>If your package needs to use another package
1.14      xtraeme  8303:                   to build itself and there is no <code class=
                   8304:                   "filename">buildlink3.mk</code> file available,
                   8305:                   use the <code class=
                   8306:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    8307:                   <pre class="programlisting">
                   8308: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   8309: </pre>
                   8310:                 </li>
                   8311: 
                   8312:                 <li>
                   8313:                   <p>If your package needs a library with which to
1.14      xtraeme  8314:                   link and again there is no <code class=
                   8315:                   "filename">buildlink3.mk</code> file available,
                   8316:                   this is specified using the <code class=
                   8317:                   "varname">DEPENDS</code> definition. An example
                   8318:                   of this is the <a xmlns=
1.1       grant    8319:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8320:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.14      xtraeme  8321:                   class="pkgname">print/lyx</a> package, which uses
                   8322:                   the xpm library, version 3.4j to build:</p>
1.1       grant    8323:                   <pre class="programlisting">
                   8324: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   8325: </pre>
                   8326: 
                   8327:                   <p>You can also use wildcards in package
                   8328:                   dependences:</p>
                   8329:                   <pre class="programlisting">
                   8330: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   8331: </pre>
                   8332: 
                   8333:                   <p>Note that such wildcard dependencies are
                   8334:                   retained when creating binary packages. The
                   8335:                   dependency is checked when installing the binary
                   8336:                   package and any package which matches the pattern
                   8337:                   will be used. Wildcard dependencies should be
                   8338:                   used with care.</p>
                   8339: 
                   8340:                   <p>The &#8220;<span class=
                   8341:                   "quote">-[0-9]*</span>&#8221; should be used
                   8342:                   instead of &#8220;<span class=
                   8343:                   "quote">-*</span>&#8221; to avoid potentially
                   8344:                   ambiguous matches such as &#8220;<span class=
                   8345:                   "quote">tk-postgresql</span>&#8221; matching a
                   8346:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  8347:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    8348: 
                   8349:                   <p>Wildcards can also be used to specify that a
                   8350:                   package will only build against a certain minimum
                   8351:                   version of a pre-requisite:</p>
                   8352:                   <pre class="programlisting">
                   8353: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   8354: </pre>
                   8355: 
                   8356:                   <p>This means that the package will build against
                   8357:                   version 3.5.4 of the tiff library or newer. Such
                   8358:                   a dependency may be warranted if, for example,
                   8359:                   the API of the library has changed with version
                   8360:                   3.5.4 and a package would not compile against an
                   8361:                   earlier version of tiff.</p>
                   8362: 
                   8363:                   <p>Please note that such dependencies should only
                   8364:                   be updated if a package requires a newer
                   8365:                   pre-requisite, but not to denote recommendations
                   8366:                   such as security updates or ABI changes that do
                   8367:                   not prevent a package from building correctly.
                   8368:                   Such recommendations can be expressed using
1.14      xtraeme  8369:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    8370:                   <pre class="programlisting">
                   8371: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   8372: </pre>
                   8373: 
1.14      xtraeme  8374:                   <p>In addition to the above <code class=
                   8375:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    8376:                   while a package will build against
                   8377:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  8378:                   recommended. <code class=
                   8379:                   "varname">RECOMMENDED</code> entries will be
                   8380:                   turned into dependencies unless explicitly
                   8381:                   ignored (in which case a warning will be
                   8382:                   printed). Packages that are built with
1.1       grant    8383:                   recommendations ignored may not be uploaded to
                   8384:                   ftp.NetBSD.org by developers and should not be
                   8385:                   used across different systems that may have
                   8386:                   different versions of binary packages
                   8387:                   installed.</p>
                   8388: 
                   8389:                   <p>For security fixes, please update the package
                   8390:                   vulnerabilities file as well as setting
1.14      xtraeme  8391:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    8392:                   <a href="#security-handling" title=
                   8393:                   "12.1.7.&nbsp;Handling packages with security problems">
                   8394:                   Section 12.1.7, &#8220;Handling packages with
                   8395:                   security problems&#8221;</a> for more
                   8396:                   information.</p>
                   8397:                 </li>
                   8398: 
                   8399:                 <li>
                   8400:                   <p>If your package needs some executable to be
                   8401:                   able to run correctly and if there's agail no
1.14      xtraeme  8402:                   <code class="filename">buildlink3.mk</code> file,
                   8403:                   this is specified using the <code class=
                   8404:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    8405:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8406:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.14      xtraeme  8407:                   class="pkgname">print/lyx</a> package needs to be
                   8408:                   able to execute the latex binary from the teTeX
                   8409:                   package when it runs, and that is specified:</p>
1.1       grant    8410:                   <pre class="programlisting">
                   8411: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   8412: </pre>
                   8413: 
                   8414:                   <p>The comment about wildcard dependencies from
                   8415:                   previous paragraph applies here, too.</p>
                   8416:                 </li>
                   8417:               </ol>
                   8418:             </div>
                   8419: 
                   8420:             <p>If your package needs files from another package to
                   8421:             build, see the first part of the &#8220;<span class=
                   8422:             "quote">do-configure</span>&#8221; target <a xmlns=
                   8423:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8424:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.14      xtraeme  8425:             class="pkgname">print/ghostscript5</a> package (it
                   8426:             relies on the jpeg sources being present in source form
                   8427:             during the build):</p>
1.1       grant    8428:             <pre class="programlisting">
                   8429: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   8430:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   8431:     fi
                   8432: </pre>
                   8433: 
                   8434:             <p>If you build any other packages that way, please
                   8435:             make sure the working files are deleted too when this
                   8436:             package's working files are cleaned up. The easiest way
                   8437:             to do so is by adding a pre-clean target:</p>
                   8438:             <pre class="programlisting">
                   8439: pre-clean:
                   8440:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   8441: </pre>
                   8442: 
1.14      xtraeme  8443:             <p>Please also note the <code class=
                   8444:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   8445:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   8446:             which are provided as convenience definitions. The
                   8447:             former works out whether msgfmt(1) is part of the base
                   8448:             system, and, if it isn't, installs the <a xmlns=
1.1       grant    8449:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8450:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.14      xtraeme  8451:             class="pkgname">devel/gettext</a> package. The latter
                   8452:             adds a build dependency on either an installed version
                   8453:             of an older gettext package, or if it isn't, installs
                   8454:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8455:             href=
                   8456:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
                   8457:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    8458:           </div>
                   8459: 
                   8460:           <div class="sect2" lang="en" xml:lang="en">
                   8461:             <div class="titlepage">
                   8462:               <div>
                   8463:                 <div>
1.15      xtraeme  8464:                   <h3 class="title"><a name="id2591643" id=
                   8465:                   "id2591643"></a>12.1.4.&nbsp;Handling conflicts
1.1       grant    8466:                   with other packages</h3>
                   8467:                 </div>
                   8468:               </div>
                   8469:             </div>
                   8470: 
                   8471:             <p>Your package may conflict with other packages a user
                   8472:             might already have installed on his system, e.g. if
                   8473:             your package installs the same set of files like
                   8474:             another package in our pkgsrc tree.</p>
                   8475: 
1.14      xtraeme  8476:             <p>In this case you can set <code class=
                   8477:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    8478:             packages (including version string) your package
                   8479:             conflicts with.</p>
                   8480: 
                   8481:             <p>For example <a xmlns=
                   8482:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8483:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.14      xtraeme  8484:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
                   8485:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8486:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
                   8487:             class="pkgname">x11/Xaw-Xpm</a> install provide the
                   8488:             same shared library, thus you set in <code class=
                   8489:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    8490:             <pre class="programlisting">
                   8491: CONFLICTS=      Xaw-Xpm-[0-9]*
                   8492: </pre>
                   8493: 
1.14      xtraeme  8494:             <p>and in <code class=
                   8495:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    8496:             <pre class="programlisting">
                   8497: CONFLICTS=      Xaw3d-[0-9]*
                   8498: </pre>
                   8499: 
                   8500:             <p>Packages will automatically conflict with other
                   8501:             packages with the name prefix and a different version
                   8502:             string. &#8220;<span class=
                   8503:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   8504:             conflict with the older version &#8220;<span class=
                   8505:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   8506:           </div>
                   8507: 
                   8508:           <div class="sect2" lang="en" xml:lang="en">
                   8509:             <div class="titlepage">
                   8510:               <div>
                   8511:                 <div>
1.15      xtraeme  8512:                   <h3 class="title"><a name="id2591762" id=
                   8513:                   "id2591762"></a>12.1.5.&nbsp;Packages that cannot
1.1       grant    8514:                   or should not be built</h3>
                   8515:                 </div>
                   8516:               </div>
                   8517:             </div>
                   8518: 
                   8519:             <p>There are several reasons why a package might be
                   8520:             instructed to not build under certain circumstances. If
                   8521:             the package builds and runs on most platforms, the
1.14      xtraeme  8522:             exceptions should be noted with <code class=
                   8523:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   8524:             builds and runs on a small handful of platforms, set
                   8525:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
                   8526:             If the package should be skipped (for example, because
                   8527:             it provides functionality already provided by the
                   8528:             system), set <code class=
                   8529:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   8530:             message. If the package should fail because some
                   8531:             preconditions are not met, set <code class=
                   8532:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    8533:             message.</p>
                   8534: 
1.14      xtraeme  8535:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    8536:             because it didn't provide enough information to
                   8537:             determine whether the build should fail.</p>
                   8538:           </div>
                   8539: 
                   8540:           <div class="sect2" lang="en" xml:lang="en">
                   8541:             <div class="titlepage">
                   8542:               <div>
                   8543:                 <div>
1.15      xtraeme  8544:                   <h3 class="title"><a name="id2591787" id=
                   8545:                   "id2591787"></a>12.1.6.&nbsp;Packages which
1.1       grant    8546:                   should not be deleted, once installed</h3>
                   8547:                 </div>
                   8548:               </div>
                   8549:             </div>
                   8550: 
                   8551:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  8552:             has been installed, the <code class=
                   8553:             "varname">PKG_PRESERVE</code> definition should be set
                   8554:             in the package Makefile. This will be carried into any
1.1       grant    8555:             binary package that is made from this pkgsrc entry. A
                   8556:             &#8220;<span class="quote">preserved</span>&#8221;
                   8557:             package will not be deleted using <a href=
                   8558:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8559:             <span class="citerefentry"><span class=
                   8560:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   8561:             the &#8220;<span class="quote">-f</span>&#8221; option
                   8562:             is used.</p>
                   8563:           </div>
                   8564: 
                   8565:           <div class="sect2" lang="en" xml:lang="en">
                   8566:             <div class="titlepage">
                   8567:               <div>
                   8568:                 <div>
                   8569:                   <h3 class="title"><a name="security-handling" id=
                   8570:                   "security-handling"></a>12.1.7.&nbsp;Handling
                   8571:                   packages with security problems</h3>
                   8572:                 </div>
                   8573:               </div>
                   8574:             </div>
                   8575: 
                   8576:             <p>When a vulnerability is found, this should be noted
1.14      xtraeme  8577:             in <code class=
                   8578:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    8579:             and after the commit of that file, it should be copied
1.14      xtraeme  8580:             to both <code class=
                   8581:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
                   8582:             and <code class=
                   8583:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
                   8584:             on ftp.NetBSD.org using <code class=
                   8585:             "filename">localsrc/security/advisories/Makefile</code>.
                   8586:             In addition, if a <code class=
                   8587:             "filename">buildlink3.mk</code> file exists for an
                   8588:             affected package, bumping <code class=
                   8589:             "varname">PKGREVISION</code> and creating a
                   8590:             corresponding <code class=
                   8591:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   8592:             "replaceable"><code>pkg</code></em></code> entry should
                   8593:             be considered. See <a href="#buildlink" title=
1.1       grant    8594:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8595:             <i>Buildlink methodology</i></a> for more information
1.14      xtraeme  8596:             about writing <code class=
                   8597:             "filename">buildlink3.mk</code> files and <code class=
                   8598:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    8599: 
                   8600:             <p>Also, if the fix should be applied to the stable
                   8601:             pkgsrc branch, be sure to submit a pullup request!</p>
                   8602:           </div>
                   8603: 
                   8604:           <div class="sect2" lang="en" xml:lang="en">
                   8605:             <div class="titlepage">
                   8606:               <div>
                   8607:                 <div>
1.15      xtraeme  8608:                   <h3 class="title"><a name="id2591879" id=
                   8609:                   "id2591879"></a>12.1.8.&nbsp;How to handle
1.1       grant    8610:                   compiler bugs</h3>
                   8611:                 </div>
                   8612:               </div>
                   8613:             </div>
                   8614: 
                   8615:             <p>Some source files trigger bugs in the compiler,
                   8616:             based on combinations of compiler version and
                   8617:             architecture and almost always relation to optimisation
                   8618:             being enabled. Common symptoms are gcc internal errors
                   8619:             or never finishing compiling a file.</p>
                   8620: 
                   8621:             <p>Typically a workaround involves testing the
1.14      xtraeme  8622:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    8623:             version, disabling optimisation for that
1.14      xtraeme  8624:             file/<code class="varname">MACHINE_ARCH</code>/compiler
                   8625:             combination, and documenting it in <code class=
                   8626:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    8627:             number of examples!</p>
                   8628:           </div>
                   8629: 
                   8630:           <div class="sect2" lang="en" xml:lang="en">
                   8631:             <div class="titlepage">
                   8632:               <div>
                   8633:                 <div>
1.15      xtraeme  8634:                   <h3 class="title"><a name="id2591901" id=
                   8635:                   "id2591901"></a>12.1.9.&nbsp;How to handle
1.1       grant    8636:                   incrementing versions when fixing an existing
                   8637:                   package</h3>
                   8638:                 </div>
                   8639:               </div>
                   8640:             </div>
                   8641: 
                   8642:             <p>When making fixes to an existing package it can be
1.14      xtraeme  8643:             useful to change the version number in <code class=
                   8644:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    8645:             future versions by the original author, a
                   8646:             &#8220;<span class="quote">nb1</span>&#8221;,
                   8647:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   8648:             suffix can be used on package versions by setting
1.14      xtraeme  8649:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   8650:             The &#8220;<span class="quote">nb</span>&#8221; is
                   8651:             treated like a &#8220;<span class=
                   8652:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    8653:             <pre class="programlisting">
                   8654:   DISTNAME= foo-17.42
                   8655:     PKGREVISION=  9
                   8656: </pre>
                   8657: 
1.14      xtraeme  8658:             <p>will result in a <code class=
                   8659:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    8660:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   8661: 
                   8662:             <p>When a new release of the package is released, the
1.14      xtraeme  8663:             <code class="varname">PKGREVISION</code> should be
                   8664:             removed. e.g. on a new minor release of the above
                   8665:             package, things should be like:</p>
1.1       grant    8666:             <pre class="programlisting">
                   8667: DISTNAME=   foo-17.43
                   8668: </pre>
                   8669:           </div>
                   8670: 
                   8671:           <div class="sect2" lang="en" xml:lang="en">
                   8672:             <div class="titlepage">
                   8673:               <div>
                   8674:                 <div>
1.15      xtraeme  8675:                   <h3 class="title"><a name="id2591950" id=
                   8676:                   "id2591950"></a>12.1.10.&nbsp;Portability of
1.1       grant    8677:                   packages</h3>
                   8678:                 </div>
                   8679:               </div>
                   8680:             </div>
                   8681: 
                   8682:             <p>One appealing feature of pkgsrc is that it runs on
                   8683:             many different platforms. As a result, it is important
                   8684:             to ensure, where possible, that packages in pkgsrc are
                   8685:             portable. There are some particular details you should
                   8686:             pay attention to while working on pkgsrc.</p>
                   8687: 
                   8688:             <div class="sect3" lang="en" xml:lang="en">
                   8689:               <div class="titlepage">
                   8690:                 <div>
                   8691:                   <div>
1.15      xtraeme  8692:                     <h4 class="title"><a name="id2591956" id=
                   8693:                     "id2591956"></a>12.1.10.1.&nbsp;${INSTALL},
1.1       grant    8694:                     ${INSTALL_DATA_DIR}, ...</h4>
                   8695:                   </div>
                   8696:                 </div>
                   8697:               </div>
                   8698: 
1.14      xtraeme  8699:               <p>The BSD-compatible <span><strong class=
                   8700:               "command">install</strong></span> supplied with some
1.1       grant    8701:               operating systems will not perform more than one
                   8702:               operation at a time. As such, you should call
                   8703:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   8704:               etc. like this:</p>
                   8705:               <pre class="programlisting">
                   8706: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   8707: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   8708: </pre>
                   8709:             </div>
                   8710:           </div>
                   8711:         </div>
                   8712: 
                   8713:         <div class="sect1" lang="en" xml:lang="en">
                   8714:           <div class="titlepage">
                   8715:             <div>
                   8716:               <div>
                   8717:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  8718:                 "id2591975" id="id2591975"></a>12.2.&nbsp;Possible
1.1       grant    8719:                 downloading issues</h2>
                   8720:               </div>
                   8721:             </div>
                   8722:           </div>
                   8723: 
                   8724:           <div class="sect2" lang="en" xml:lang="en">
                   8725:             <div class="titlepage">
                   8726:               <div>
                   8727:                 <div>
1.15      xtraeme  8728:                   <h3 class="title"><a name="id2591978" id=
                   8729:                   "id2591978"></a>12.2.1.&nbsp;Packages whose
1.1       grant    8730:                   distfiles aren't available for plain
                   8731:                   downloading</h3>
                   8732:                 </div>
                   8733:               </div>
                   8734:             </div>
                   8735: 
                   8736:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  8737:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   8738:             and a <span><strong class="command">make
                   8739:             fetch</strong></span> will call <code class=
                   8740:             "filename">files/getsite.sh</code> with the name of
                   8741:             each file to download as an argument, expecting it to
                   8742:             output the URL of the directory from which to download
                   8743:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8744:             href=
1.1       grant    8745:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.14      xtraeme  8746:             class="pkgname">graphics/ns-cult3d</a> is an example of
                   8747:             this usage.</p>
1.1       grant    8748: 
                   8749:             <p>If the download can't be automated, because the user
                   8750:             must submit personal information to apply for a
                   8751:             password, or must pay for the source, or whatever, you
1.14      xtraeme  8752:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   8753:             a macro which displays a message explaining the
                   8754:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   8755:             must be executable shell commands, not just a message.
                   8756:             (Generally, it executes <code class=
                   8757:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    8758:             following packages use this: <a xmlns=
                   8759:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8760:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.14      xtraeme  8761:             class="pkgname">audio/realplayer</a>, <a xmlns=
                   8762:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8763:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
                   8764:             class="pkgname">cad/simian</a>, <a xmlns=
                   8765:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8766:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
                   8767:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
                   8768:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8769:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
                   8770:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
                   8771:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8772:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
                   8773:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
                   8774:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8775:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
                   8776:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
                   8777:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8778:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
                   8779:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
                   8780:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8781:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
                   8782:             class="pkgname">www/openacs</a>. Try to be consistent
                   8783:             with them.</p>
1.1       grant    8784:           </div>
                   8785: 
                   8786:           <div class="sect2" lang="en" xml:lang="en">
                   8787:             <div class="titlepage">
                   8788:               <div>
                   8789:                 <div>
1.15      xtraeme  8790:                   <h3 class="title"><a name="id2592109" id=
                   8791:                   "id2592109"></a>12.2.2.&nbsp;How to handle
1.1       grant    8792:                   modified distfiles with the 'old' name</h3>
                   8793:                 </div>
                   8794:               </div>
                   8795:             </div>
                   8796: 
                   8797:             <p>Sometimes authors of a software package make some
                   8798:             modifications after the software was released, and they
                   8799:             put up a new distfile without changing the package's
                   8800:             version number. If a package is already in pkgsrc at
                   8801:             that time, the md5 checksum will no longer match. The
                   8802:             correct way to work around this is to update the
                   8803:             package's md5 checksum to match the package on the
                   8804:             master site (beware, any mirrors may not be up to date
                   8805:             yet!), and to remove the old distfile from
1.14      xtraeme  8806:             ftp.NetBSD.org's <code class=
                   8807:             "filename">/pub/NetBSD/packages/distfiles</code>
1.1       grant    8808:             directory. Furthermore, a mail to the package's author
                   8809:             seems appropriate making sure the distfile was really
                   8810:             updated on purpose, and that no trojan horse or so
                   8811:             crept in.</p>
                   8812:           </div>
                   8813:         </div>
                   8814: 
                   8815:         <div class="sect1" lang="en" xml:lang="en">
                   8816:           <div class="titlepage">
                   8817:             <div>
                   8818:               <div>
                   8819:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  8820:                 "id2592121" id=
                   8821:                 "id2592121"></a>12.3.&nbsp;Configuration
1.1       grant    8822:                 gotchas</h2>
                   8823:               </div>
                   8824:             </div>
                   8825:           </div>
                   8826: 
                   8827:           <div class="sect2" lang="en" xml:lang="en">
                   8828:             <div class="titlepage">
                   8829:               <div>
                   8830:                 <div>
                   8831:                   <h3 class="title"><a name="fixes.libtool" id=
                   8832:                   "fixes.libtool"></a>12.3.1.&nbsp;Shared libraries
                   8833:                   - libtool</h3>
                   8834:                 </div>
                   8835:               </div>
                   8836:             </div>
                   8837: 
                   8838:             <p>pkgsrc supports many different machines, with
                   8839:             different object formats like a.out and ELF, and
                   8840:             varying abilities to do shared library and dynamic
                   8841:             loading at all. To accompany this, varying commands and
                   8842:             options have to be passed to the compiler, linker, etc.
                   8843:             to get the Right Thing, which can be pretty annoying
                   8844:             especially if you don't have all the machines at your
                   8845:             hand to test things. The <a xmlns=
                   8846:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8847:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.14      xtraeme  8848:             class="pkgname">devel/libtool</a> pkg can help here, as
                   8849:             it just &#8220;<span class="quote">knows</span>&#8221;
                   8850:             how to build both static and dynamic libraries from a
                   8851:             set of source files, thus being platform
                   8852:             independent.</p>
1.1       grant    8853: 
                   8854:             <p>Here's how to use libtool in a pkg in seven simple
                   8855:             steps:</p>
                   8856: 
                   8857:             <div class="orderedlist">
                   8858:               <ol type="1">
                   8859:                 <li>
1.14      xtraeme  8860:                   <p>Add <code class=
                   8861:                   "varname">USE_LIBTOOL=yes</code> to the package
                   8862:                   Makefile.</p>
1.1       grant    8863:                 </li>
                   8864: 
                   8865:                 <li>
                   8866:                   <p>For library objects, use &#8220;<span class=
                   8867:                   "quote">${LIBTOOL} --mode=compile
                   8868:                   ${CC}</span>&#8221; in place of
                   8869:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   8870:                   You could even add it to the definition of
1.14      xtraeme  8871:                   <code class="varname">CC</code>, if only
                   8872:                   libraries are being built in a given Makefile.
                   8873:                   This one command will build both PIC and non-PIC
                   8874:                   library objects, so you need not have separate
                   8875:                   shared and non-shared library rules.</p>
1.1       grant    8876:                 </li>
                   8877: 
                   8878:                 <li>
                   8879:                   <p>For the linking of the library, remove any
                   8880:                   &#8220;<span class="quote">ar</span>&#8221;,
                   8881:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   8882:                   and &#8220;<span class="quote">ld
                   8883:                   -Bshareable</span>&#8221; commands, and instead
                   8884:                   use:</p>
                   8885:                   <pre class="programlisting">
                   8886: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   8887: </pre>
                   8888: 
                   8889:                   <p>Note that the library is changed to have a
1.14      xtraeme  8890:                   <code class="filename">.la</code> extension, and
                   8891:                   the objects are changed to have a <code class=
                   8892:                   "filename">.lo</code> extension. Change
                   8893:                   <code class="varname">OBJS</code> as necessary.
                   8894:                   This automatically creates all of the
                   8895:                   <code class="filename">.a</code>, <code class=
                   8896:                   "filename">.so.major.minor</code>, and ELF
                   8897:                   symlinks (if necessary) in the build directory.
                   8898:                   Be sure to include &#8220;<span class=
1.1       grant    8899:                   "quote">-version-info</span>&#8221;, especially
                   8900:                   when major and minor are zero, as libtool will
                   8901:                   otherwise strip off the shared library
                   8902:                   version.</p>
                   8903: 
                   8904:                   <p>From the libtool manual:</p>
                   8905:                   <pre class="programlisting">
                   8906:      So, libtool library versions are described by three integers:
                   8907: 
                   8908: CURRENT
                   8909:        The most recent interface number that this library implements.
                   8910: 
                   8911: REVISION
                   8912:        The implementation number of the CURRENT interface.
                   8913: 
                   8914: AGE
                   8915:        The difference between the newest and oldest interfaces that this
                   8916:        library implements.  In other words, the library implements all the
                   8917:        interface numbers in the range from number `CURRENT - AGE' to
                   8918:        `CURRENT'.
                   8919:        
                   8920:      If two libraries have identical CURRENT and AGE numbers, then the
                   8921: dynamic linker chooses the library with the greater REVISION number. 
                   8922: </pre>
                   8923: 
                   8924:                   <p>The &#8220;<span class=
                   8925:                   "quote">-release</span>&#8221; option will
                   8926:                   produce different results for a.out and ELF
                   8927:                   (excluding symlinks) in only one case. An ELF
                   8928:                   library of the form &#8220;<span class=
                   8929:                   "quote">libfoo-release.so.<span class=
                   8930:                   "emphasis"><em>x</em></span>.<span class=
                   8931:                   "emphasis"><em>y</em></span></span>&#8221; will
                   8932:                   have a symlink of &#8220;<span class=
                   8933:                   "quote">libfoo.so.<span class=
                   8934:                   "emphasis"><em>x</em></span>.<span class=
                   8935:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   8936:                   a.out platform. This is handled
                   8937:                   automatically.</p>
                   8938: 
                   8939:                   <p>The &#8220;<span class="quote">-rpath
                   8940:                   argument</span>&#8221; is the install directory
                   8941:                   of the library being built.</p>
                   8942: 
1.14      xtraeme  8943:                   <p>In the <code class="filename">PLIST</code>,
                   8944:                   include all of the <code class=
                   8945:                   "filename">.a</code>, <code class=
                   8946:                   "filename">.la</code>, and <code class=
                   8947:                   "filename">.so</code>, <code class=
                   8948:                   "filename">.so.<em class=
                   8949:                   "replaceable"><code>major</code></em></code> and
                   8950:                   <code class="filename">.so.<em class=
                   8951:                   "replaceable"><code>major</code></em>.<em class=
                   8952:                   "replaceable"><code>minor</code></em></code>
                   8953:                   files.</p>
1.1       grant    8954:                 </li>
                   8955: 
                   8956:                 <li>
1.14      xtraeme  8957:                   <p>When linking shared object (<code class=
                   8958:                   "filename">.so</code>) files, i.e. files that are
1.1       grant    8959:                   loaded via dlopen(3), NOT shared libraries, use
                   8960:                   &#8220;<span class="quote">-module
                   8961:                   -avoid-version</span>&#8221; to prevent them
                   8962:                   getting version tacked on.</p>
                   8963: 
1.14      xtraeme  8964:                   <p>The <code class="filename">PLIST</code> file
                   8965:                   gets the <code class="filename">foo.so</code>
                   8966:                   entry.</p>
1.1       grant    8967:                 </li>
                   8968: 
                   8969:                 <li>
                   8970:                   <p>When linking programs that depend on these
                   8971:                   libraries <span class=
                   8972:                   "emphasis"><em>before</em></span> they are
                   8973:                   installed, preface the <a href=
                   8974:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   8975:                   <span class="citerefentry"><span class=
                   8976:                   "refentrytitle">cc</span>(1)</span></a> or
                   8977:                   <a href=
                   8978:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   8979:                   <span class="citerefentry"><span class=
                   8980:                   "refentrytitle">ld</span>(1)</span></a> line with
                   8981:                   &#8220;<span class="quote">${LIBTOOL}
                   8982:                   --mode=link</span>&#8221;, and it will find the
                   8983:                   correct libraries (static or shared), but please
                   8984:                   be aware that libtool will not allow you to
                   8985:                   specify a relative path in -L (such as
                   8986:                   &#8220;<span class=
                   8987:                   "quote">-L../somelib</span>&#8221;), because it
                   8988:                   expects you to change that argument to be the
1.14      xtraeme  8989:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    8990:                   <pre class="programlisting">
                   8991: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   8992: </pre>
                   8993: 
                   8994:                   <p>should be changed to:</p>
                   8995:                   <pre class="programlisting">
1.14      xtraeme  8996: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   8997: "replaceable"><code>someprog</code></em> <em class=
                   8998: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    8999: </pre>
                   9000: 
                   9001:                   <p>and it will do the right thing with the
                   9002:                   libraries.</p>
                   9003:                 </li>
                   9004: 
                   9005:                 <li>
                   9006:                   <p>When installing libraries, preface the
                   9007:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   9008:                   <span class="citerefentry"><span class=
                   9009:                   "refentrytitle">install</span>(1)</span></a> or
                   9010:                   <a href=
                   9011:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   9012:                   <span class="citerefentry"><span class=
                   9013:                   "refentrytitle">cp</span>(1)</span></a> command
                   9014:                   with &#8220;<span class="quote">${LIBTOOL}
                   9015:                   --mode=install</span>&#8221;, and change the
1.14      xtraeme  9016:                   library name to <code class=
                   9017:                   "filename">.la</code>. e.g.</p>
1.1       grant    9018:                   <pre class="programlisting">
                   9019: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   9020: </pre>
                   9021: 
1.14      xtraeme  9022:                   <p>This will install the static <code class=
                   9023:                   "filename">.a</code>, shared library, any needed
1.1       grant    9024:                   symlinks, and run <a href=
                   9025:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   9026:                   <span class="citerefentry"><span class=
                   9027:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   9028:                 </li>
                   9029: 
                   9030:                 <li>
1.14      xtraeme  9031:                   <p>In your <code class="filename">PLIST</code>,
                   9032:                   include all of the <code class=
                   9033:                   "filename">.a</code>, <code class=
                   9034:                   "filename">.la</code>, and <code class=
                   9035:                   "filename">.so</code>, <code class=
                   9036:                   "filename">.so.CURRENT</code> and <code class=
                   9037:                   "filename">.so.CURRENT.REVISION</code> files
                   9038:                   (this is a change from the previous
                   9039:                   behaviour).</p>
1.1       grant    9040:                 </li>
                   9041:               </ol>
                   9042:             </div>
                   9043:           </div>
                   9044: 
                   9045:           <div class="sect2" lang="en" xml:lang="en">
                   9046:             <div class="titlepage">
                   9047:               <div>
                   9048:                 <div>
1.15      xtraeme  9049:                   <h3 class="title"><a name="id2592529" id=
                   9050:                   "id2592529"></a>12.3.2.&nbsp;Using libtool on GNU
1.1       grant    9051:                   packages that already support libtool</h3>
                   9052:                 </div>
                   9053:               </div>
                   9054:             </div>
                   9055: 
1.14      xtraeme  9056:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   9057:             the package Makefile. This will override the package's
                   9058:             own libtool in most cases. For older libtool using
1.1       grant    9059:             packages, libtool is made by ltconfig script during the
                   9060:             do-configure step; you can check the libtool script
1.14      xtraeme  9061:             location by doing <span><strong class="command">make
                   9062:             configure; find work*/ -name
                   9063:             libtool</strong></span>.</p>
                   9064: 
                   9065:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   9066:             specifies which libtool scripts, relative to
                   9067:             <code class="varname">WRKSRC</code>, to override. By
                   9068:             default, it is set to &#8220;<span class=
                   9069:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   9070:             this does not match the location of the package's
                   9071:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  9072: 
1.14      xtraeme  9073:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    9074:             static libraries built and installed, then use
1.14      xtraeme  9075:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    9076:             instead.</p>
                   9077: 
                   9078:             <p>If your package makes use of the platform
                   9079:             independent library for loading dynamic shared objects,
                   9080:             that comes with libtool (libltdl), you should include
1.14      xtraeme  9081:             the libtool buildlink3.mk (and set <code class=
                   9082:             "varname">USE_BUILDLINK3=YES</code>).</p>
1.1       grant    9083: 
                   9084:             <p>Some packages use libtool incorrectly so that the
                   9085:             package may not work or build in some circumstances.
                   9086:             Some of the more common errors are:</p>
                   9087: 
                   9088:             <div class="itemizedlist">
                   9089:               <ul type="disc">
                   9090:                 <li>
                   9091:                   <p>The inclusion of a shared object (-module) as
                   9092:                   a dependent library in an executable or library.
                   9093:                   This in itself isn't a problem if one of two
                   9094:                   things has been done:</p>
                   9095: 
                   9096:                   <div class="orderedlist">
                   9097:                     <ol type="1">
                   9098:                       <li>
                   9099:                         <p>The shared object is named correctly,
1.14      xtraeme  9100:                         i.e. <code class=
                   9101:                         "filename">libfoo.la</code>, not
                   9102:                         <code class="filename">foo.la</code></p>
1.1       grant    9103:                       </li>
                   9104: 
                   9105:                       <li>
                   9106:                         <p>The -dlopen option is used when linking
                   9107:                         an executable.</p>
                   9108:                       </li>
                   9109:                     </ol>
                   9110:                   </div>
                   9111:                 </li>
                   9112: 
                   9113:                 <li>
                   9114:                   <p>The use of libltdl without the correct calls
                   9115:                   to initialisation routines. The function
                   9116:                   lt_dlinit() should be called and the macro
1.14      xtraeme  9117:                   <code class=
                   9118:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    9119:                   included in executables.</p>
                   9120:                 </li>
                   9121:               </ul>
                   9122:             </div>
                   9123:           </div>
                   9124: 
                   9125:           <div class="sect2" lang="en" xml:lang="en">
                   9126:             <div class="titlepage">
                   9127:               <div>
                   9128:                 <div>
1.15      xtraeme  9129:                   <h3 class="title"><a name="id2592613" id=
                   9130:                   "id2592613"></a>12.3.3.&nbsp;GNU
1.1       grant    9131:                   Autoconf/Automake</h3>
                   9132:                 </div>
                   9133:               </div>
                   9134:             </div>
                   9135: 
                   9136:             <p>If a package needs GNU autoconf or automake to be
                   9137:             executed to regenerate the configure script and
                   9138:             Makefile.in makefile templates, then they should be
                   9139:             executed in a pre-configure target. Two Makefile
1.14      xtraeme  9140:             fragments are provided in <code class=
                   9141:             "filename">pkgsrc/mk/autoconf.mk</code> and
                   9142:             <code class="filename">pkgsrc/mk/automake.mk</code> to
                   9143:             help dealing with these tools. See comments in these
                   9144:             files for details.</p>
1.1       grant    9145: 
                   9146:             <p>For packages that need only autoconf:</p>
                   9147:             <pre class="programlisting">
                   9148: AUTOCONF_REQD=    2.50    # if default version is not good enough
                   9149: ...
                   9150: 
                   9151: pre-configure:
                   9152:           cd ${WRKSRC}; ${AUTOCONF}
                   9153: 
                   9154: ...
                   9155: .include "../../mk/autoconf.mk"
                   9156: </pre>
                   9157: 
                   9158:             <p>and for packages that need automake and
                   9159:             autoconf:</p>
                   9160:             <pre class="programlisting">
                   9161: AUTOMAKE_REQD=  1.7.1   # if default version is not good enough
                   9162: ...
                   9163: 
                   9164: pre-configure:
                   9165:           cd ${WRKSRC};                                           \
                   9166:           ${ACLOCAL};                                             \
                   9167:           ${AUTOHEADER};                                          \
                   9168:           ${AUTOMAKE} -a --foreign -i;                            \
                   9169:           ${AUTOCONF}
                   9170: 
                   9171: ...
                   9172: .include "../mk/automake.mk"
                   9173: </pre>
                   9174: 
                   9175:             <p>Packages which use GNU Automake will almost
                   9176:             certainly require GNU Make, but that's automatically
1.14      xtraeme  9177:             provided for you in <code class=
                   9178:             "filename">mk/automake.mk</code>.</p>
1.1       grant    9179: 
                   9180:             <p>There are times when the configure process makes
                   9181:             additional changes to the generated files, which then
                   9182:             causes the build process to try to re-execute the
                   9183:             automake sequence. This is prevented by touching
                   9184:             various files in the configure stage. If this causes
1.14      xtraeme  9185:             problems with your package you can set <code class=
                   9186:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    9187:             Makefile.</p>
                   9188:           </div>
                   9189:         </div>
                   9190: 
                   9191:         <div class="sect1" lang="en" xml:lang="en">
                   9192:           <div class="titlepage">
                   9193:             <div>
                   9194:               <div>
                   9195:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  9196:                 "id2592726" id="id2592726"></a>12.4.&nbsp;Building
1.1       grant    9197:                 considerations</h2>
                   9198:               </div>
                   9199:             </div>
                   9200:           </div>
                   9201: 
                   9202:           <div class="sect2" lang="en" xml:lang="en">
                   9203:             <div class="titlepage">
                   9204:               <div>
                   9205:                 <div>
1.15      xtraeme  9206:                   <h3 class="title"><a name="id2592729" id=
                   9207:                   "id2592729"></a>12.4.1.&nbsp;CPP defines</h3>
1.1       grant    9208:                 </div>
                   9209:               </div>
                   9210:             </div>
                   9211: 
                   9212:             <p>To port an application to NetBSD, it's usually
                   9213:             necessary for the compiler to be able to judge the
                   9214:             system on which it's compiling, and we use definitions
                   9215:             so that the C pre-processor can do this.</p>
                   9216: 
                   9217:             <p>To test whether you are working on a 4.4 BSD-derived
                   9218:             system, you should use the BSD definition, which is
1.14      xtraeme  9219:             defined in <code class=
                   9220:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    9221:             systems.</p>
                   9222:             <pre class="programlisting">
                   9223: #include &lt;sys/param.h&gt;
                   9224: </pre>
                   9225: 
                   9226:             <p>and then you can surround the BSD-specific parts of
                   9227:             your package's C/C++ code using this conditional:</p>
                   9228:             <pre class="programlisting">
                   9229: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   9230:     ...
                   9231: #endif
                   9232: </pre>
                   9233: 
                   9234:             <p>Please use the &#8220;<span class=
                   9235:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   9236:             it should only apply to features of NetBSD that are not
                   9237:             present in other 4.4-lite derived BSDs.</p>
                   9238:           </div>
                   9239:         </div>
                   9240: 
                   9241:         <div class="sect1" lang="en" xml:lang="en">
                   9242:           <div class="titlepage">
                   9243:             <div>
                   9244:               <div>
                   9245:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  9246:                 "id2592759" id="id2592759"></a>12.5.&nbsp;Package
1.1       grant    9247:                 specific actions</h2>
                   9248:               </div>
                   9249:             </div>
                   9250:           </div>
                   9251: 
                   9252:           <div class="sect2" lang="en" xml:lang="en">
                   9253:             <div class="titlepage">
                   9254:               <div>
                   9255:                 <div>
1.15      xtraeme  9256:                   <h3 class="title"><a name="id2592762" id=
                   9257:                   "id2592762"></a>12.5.1.&nbsp;Package
1.1       grant    9258:                   configuration files</h3>
                   9259:                 </div>
                   9260:               </div>
                   9261:             </div>
                   9262: 
                   9263:             <p>Packages should be taught to look for their
1.14      xtraeme  9264:             configuration files in <code class=
                   9265:             "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1       grant    9266:             through to the configure and build processes.
1.14      xtraeme  9267:             <code class="varname">PKG_SYSCONFDIR</code> may be
1.1       grant    9268:             customized in various ways by setting other make
                   9269:             variables:</p>
                   9270: 
                   9271:             <div class="itemizedlist">
                   9272:               <ul type="disc">
                   9273:                 <li>
1.14      xtraeme  9274:                   <p><code class="varname">PKG_SYSCONFBASE</code>
                   9275:                   is the main config directory under which all
                   9276:                   package configuration files are to be found. This
                   9277:                   defaults to <code class=
                   9278:                   "filename">${PREFIX}/etc</code>, but may be
                   9279:                   overridden in <code class=
                   9280:                   "filename">/etc/mk.conf</code>.</p>
1.1       grant    9281:                 </li>
                   9282: 
                   9283:                 <li>
1.14      xtraeme  9284:                   <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   9285:                   is the subdirectory of <code class=
                   9286:                   "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    9287:                   configuration files for a particular package may
                   9288:                   be found, e.g. the Apache configuration files may
1.14      xtraeme  9289:                   all be found under the <code class=
                   9290:                   "filename">httpd/</code> subdirectory of
                   9291:                   <code class="varname">${PKG_SYSCONFBASE}</code>.
                   9292:                   This should be set in the package Makefile.</p>
1.1       grant    9293:                 </li>
                   9294: 
                   9295:                 <li>
1.14      xtraeme  9296:                   <p>By default, <code class=
                   9297:                   "varname">PKG_SYSCONFDIR</code> is set to
                   9298:                   <code class=
                   9299:                   "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
                   9300:                   but this may be overridden by setting
                   9301:                   <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9302:                   for a particular package, where <code class=
                   9303:                   "varname">PKG_SYSCONFVAR</code> defaults to
                   9304:                   <code class="varname">${PKGBASE}</code>. This is
                   9305:                   not meant to be set by a package Makefile, but is
1.1       grant    9306:                   reserved for users who wish to override the
1.14      xtraeme  9307:                   <code class="varname">PKG_SYSCONFDIR</code>
                   9308:                   setting for a particular package with a special
1.1       grant    9309:                   location.</p>
                   9310:                 </li>
                   9311:               </ul>
                   9312:             </div>
                   9313: 
                   9314:             <p>The only variables that users should customize are
1.14      xtraeme  9315:             <code class="varname">PKG_SYSCONFBASE</code> and
                   9316:             <code class=
                   9317:             "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
                   9318:             Users will typically want to set <code class=
                   9319:             "varname">PKG_SYSCONFBASE</code> to <code class=
                   9320:             "filename">/etc</code>, or to accept the default
                   9321:             location of <code class=
                   9322:             "filename">${PREFIX}/etc</code>.</p>
1.1       grant    9323:           </div>
                   9324: 
                   9325:           <div class="sect2" lang="en" xml:lang="en">
                   9326:             <div class="titlepage">
                   9327:               <div>
                   9328:                 <div>
1.15      xtraeme  9329:                   <h3 class="title"><a name="id2592933" id=
                   9330:                   "id2592933"></a>12.5.2.&nbsp;User
1.2       hubertf  9331:                   interaction</h3>
1.1       grant    9332:                 </div>
                   9333:               </div>
                   9334:             </div>
                   9335: 
                   9336:             <p>Occasionally, packages require interaction from the
                   9337:             user, and this can be in a number of ways:</p>
                   9338: 
                   9339:             <div class="itemizedlist">
                   9340:               <ul type="disc">
                   9341:                 <li>
                   9342:                   <p>help in fetching the distfiles</p>
                   9343:                 </li>
                   9344: 
                   9345:                 <li>
                   9346:                   <p>help to configure the package before it is
                   9347:                   built</p>
                   9348:                 </li>
                   9349: 
                   9350:                 <li>
                   9351:                   <p>help during the build process</p>
                   9352:                 </li>
                   9353: 
                   9354:                 <li>
                   9355:                   <p>help during the installation of a package</p>
                   9356:                 </li>
                   9357:               </ul>
                   9358:             </div>
                   9359: 
1.14      xtraeme  9360:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    9361:             definition is provided to notify the pkgsrc mechanism
                   9362:             of an interactive stage which will be needed, and this
1.14      xtraeme  9363:             should be set in the package's <code class=
                   9364:             "filename">Makefile</code>. e.g.</p>
1.1       grant    9365:             <pre class="programlisting">
                   9366: INTERACTIVE_STAGE= build
                   9367: </pre>
                   9368: 
                   9369:             <p>Multiple interactive stages can be specified:</p>
                   9370:             <pre class="programlisting">
                   9371: INTERACTIVE_STAGE= configure install
                   9372: </pre>
                   9373:           </div>
                   9374: 
                   9375:           <div class="sect2" lang="en" xml:lang="en">
                   9376:             <div class="titlepage">
                   9377:               <div>
                   9378:                 <div>
1.15      xtraeme  9379:                   <h3 class="title"><a name="id2593046" id=
                   9380:                   "id2593046"></a>12.5.3.&nbsp;Handling
1.1       grant    9381:                   licenses</h3>
                   9382:                 </div>
                   9383:               </div>
                   9384:             </div>
                   9385: 
                   9386:             <p>A package may underly a license which the user has
                   9387:             or has not agreed to accept. Usually, packages that
                   9388:             underly well-known Open Source licenses (e.g. the GNU
                   9389:             Public License, GPL) won't have any special license
                   9390:             tags added in pkgsrc which require special action by
                   9391:             the user of such packages, but there are quite a number
                   9392:             of other licenses out there that pkgsrc users may not
                   9393:             be able to follow, for whatever reasons. For these
                   9394:             cases, pkgsrc contains a mechanism to note that a
                   9395:             package underlies a certain license, and the user has
                   9396:             to accept the license before the package can be
                   9397:             installed.</p>
                   9398: 
                   9399:             <p>Placing a certain package under a certain license
1.14      xtraeme  9400:             works by setting the <code class=
                   9401:             "varname">LICENSE</code> variable to a string
                   9402:             identifying the license, e.g. in <a xmlns=
                   9403:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9404:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.14      xtraeme  9405:             class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    9406:             <pre class="programlisting">
                   9407: LICENSE=        graphviz-license
                   9408: </pre>
                   9409: 
                   9410:             <p>When trying to build, the user will get a notice
                   9411:             that the package underlies a license which he hasn't
                   9412:             accepted (yet):</p>
                   9413:             <pre class="programlisting">
1.14      xtraeme  9414: <code class="prompt">%</code> <strong class=
                   9415: "userinput"><code>make</code></strong>
1.1       grant    9416: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   9417: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   9418: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   9419: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   9420: *** Error code 1
                   9421: </pre>
                   9422: 
1.14      xtraeme  9423:             <p>The license can be viewed with <span><strong class=
                   9424:             "command">make show-license</strong></span>, and if it
                   9425:             is considered appropriate, the line printed above can
                   9426:             be added to <code class="filename">/etc/mk.conf</code>
                   9427:             to indicate acceptance of the particular license:</p>
1.1       grant    9428:             <pre class="programlisting">
                   9429: ACCEPTABLE_LICENSES+=graphviz-license
                   9430: </pre>
                   9431: 
                   9432:             <p>When adding a package with a new license, the
1.14      xtraeme  9433:             license text should be added to <code class=
                   9434:             "filename">pkgsrc/licenses</code> for displaying. A
                   9435:             list of known licenses can be seen in this directory as
                   9436:             well as by looking at the list of (commented out)
                   9437:             <code class="varname">ACCEPTABLE_LICENSES</code>
                   9438:             variable settings in <code class=
                   9439:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    9440: 
                   9441:             <p>Is there is a <span class=
                   9442:             "emphasis"><em>really</em></span> pressing need to
                   9443:             accept all licenses at once, like when trying to
                   9444:             download or mirror all distfiles or doing a bulk build
                   9445:             to test if all packages in pkgsrc build, this can be
1.14      xtraeme  9446:             done by setting <code class=
                   9447:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    9448:           </div>
                   9449: 
                   9450:           <div class="sect2" lang="en" xml:lang="en">
                   9451:             <div class="titlepage">
                   9452:               <div>
                   9453:                 <div>
1.15      xtraeme  9454:                   <h3 class="title"><a name="id2593197" id=
                   9455:                   "id2593197"></a>12.5.4.&nbsp;Creating an account
1.1       grant    9456:                   from a package</h3>
                   9457:                 </div>
                   9458:               </div>
                   9459:             </div>
                   9460: 
                   9461:             <p>There are two make variables used to control the
                   9462:             creation of package-specific groups and users at
1.14      xtraeme  9463:             pre-install time. The first is <code class=
                   9464:             "varname">PKG_GROUPS</code>, which is a list of
1.1       grant    9465:             group[:groupid] elements, where the groupid is
1.14      xtraeme  9466:             optional. The second is <code class=
                   9467:             "varname">PKG_USERS</code>, which is a list of elements
1.1       grant    9468:             of the form:</p>
                   9469:             <pre class="programlisting">
                   9470: user:group[:[userid][:[description][:[home][:shell]]]]
                   9471: </pre>
                   9472: 
                   9473:             <p>where only the user and group are required, the rest
                   9474:             being optional. A simple example is:</p>
                   9475:             <pre class="programlisting">
                   9476:   PKG_GROUPS=       foogroup
                   9477:     PKG_USERS=    foouser:foogroup
                   9478: </pre>
                   9479: 
                   9480:             <p>A more complex example is that creates two groups
                   9481:             and two users is:</p>
                   9482:             <pre class="programlisting">
                   9483:   PKG_GROUPS=       group1 group2:1005
                   9484:     PKG_USERS=    first:group1::First\\ User                      \
                   9485:                   second:group2::Second\\ User:/home/second:${SH}
                   9486: </pre>
                   9487: 
                   9488:             <p>By default, a new user will have home directory
1.14      xtraeme  9489:             <code class="filename">/nonexistent</code>, and login
                   9490:             shell <code class="filename">/sbin/nologin</code>
                   9491:             unless they are specified as part of the user
                   9492:             element.</p>
1.1       grant    9493: 
1.14      xtraeme  9494:             <p>The package <code class="filename">Makefile</code>
                   9495:             must also set <code class=
                   9496:             "varname">USE_PKGINSTALL=YES</code>. This will cause
                   9497:             the users and groups to be created at pre-install time,
                   9498:             and the admin will be prompted to remove them at
                   9499:             post-deinstall time. Automatic creation of the users
                   9500:             and groups can be toggled on and off by setting the
                   9501:             <code class="varname">PKG_CREATE_USERGROUP</code>
                   9502:             variable prior to package installation.</p>
1.1       grant    9503:           </div>
                   9504: 
                   9505:           <div class="sect2" lang="en" xml:lang="en">
                   9506:             <div class="titlepage">
                   9507:               <div>
                   9508:                 <div>
1.15      xtraeme  9509:                   <h3 class="title"><a name="id2593328" id=
                   9510:                   "id2593328"></a>12.5.5.&nbsp;Installing score
1.1       grant    9511:                   files</h3>
                   9512:                 </div>
                   9513:               </div>
                   9514:             </div>
                   9515: 
                   9516:             <p>Certain packages, most of them in the games
                   9517:             category, install a score file that allows all users on
                   9518:             the system to record their highscores. In order for
                   9519:             this to work, the binaries need to be installed setgid
                   9520:             and the score files owned by the appropriate group
                   9521:             and/or owner (traditionally the "games" user/group).
                   9522:             The following variables, documented in more detail in
1.14      xtraeme  9523:             <code class="filename">mk/defaults/mk.conf</code>,
                   9524:             control this behaviour: <code class=
                   9525:             "varname">SETGIDGAME</code>, <code class=
                   9526:             "varname">GAMEDATAMODE</code>, <code class=
                   9527:             "varname">GAMEGRP</code>, <code class=
                   9528:             "varname">GAMEMODE</code>, <code class=
                   9529:             "varname">GAMEOWN</code>.</p>
1.1       grant    9530: 
                   9531:             <p>Note that per default, setgid installation of games
1.14      xtraeme  9532:             is disabled; setting <code class=
                   9533:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    9534:             variables accordingly.</p>
                   9535: 
                   9536:             <p>A package should therefor never hard code file
1.14      xtraeme  9537:             ownership or access permissions but rely on
                   9538:             <code class="varname">INSTALL_GAME</code> and
                   9539:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   9540:             these correctly.</p>
1.1       grant    9541:           </div>
                   9542: 
                   9543:           <div class="sect2" lang="en" xml:lang="en">
                   9544:             <div class="titlepage">
                   9545:               <div>
                   9546:                 <div>
1.15      xtraeme  9547:                   <h3 class="title"><a name="id2593371" id=
                   9548:                   "id2593371"></a>12.5.6.&nbsp;Packages providing
1.1       grant    9549:                   login shells</h3>
                   9550:                 </div>
                   9551:               </div>
                   9552:             </div>
                   9553: 
                   9554:             <p>If the purpose of the package is to provide a login
1.14      xtraeme  9555:             shell, the variable <code class=
                   9556:             "varname">PKG_SHELL</code> should contain the full
                   9557:             pathname of the shell executable installed by this
                   9558:             package. The package <code class=
                   9559:             "filename">Makefile</code> must also set <code class=
                   9560:             "varname">USE_PKGINSTALL=YES</code> to use the
                   9561:             automatically generated <code class=
                   9562:             "filename">INSTALL</code>/<code class=
                   9563:             "filename">DEINSTALL</code> scripts.</p>
1.1       grant    9564: 
                   9565:             <p>An example taken from shells/zsh:</p>
                   9566:             <pre class="programlisting">
                   9567:   USE_PKGINSTALL=   YES
                   9568:     PKG_SHELL=    ${PREFIX}/bin/zsh
                   9569: </pre>
                   9570: 
1.14      xtraeme  9571:             <p>The shell is registered into <code class=
                   9572:             "filename">/etc/shells</code> file automatically in the
                   9573:             post-install target by the generated <code class=
                   9574:             "filename">INSTALL</code> script and removed in the
                   9575:             deinstall target by the <code class=
                   9576:             "filename">DEINSTALL</code> script.</p>
1.1       grant    9577:           </div>
                   9578: 
                   9579:           <div class="sect2" lang="en" xml:lang="en">
                   9580:             <div class="titlepage">
                   9581:               <div>
                   9582:                 <div>
1.15      xtraeme  9583:                   <h3 class="title"><a name="id2593429" id=
                   9584:                   "id2593429"></a>12.5.7.&nbsp;Packages containing
1.1       grant    9585:                   perl scripts</h3>
                   9586:                 </div>
                   9587:               </div>
                   9588:             </div>
                   9589: 
                   9590:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  9591:             set <code class="varname">REPLACE_PERL</code> to ensure
                   9592:             that the proper interpreter path is set. <code class=
                   9593:             "varname">REPLACE_PERL</code> should contain a list of
                   9594:             scripts, relative to <code class=
                   9595:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    9596:           </div>
                   9597: 
                   9598:           <div class="sect2" lang="en" xml:lang="en">
                   9599:             <div class="titlepage">
                   9600:               <div>
                   9601:                 <div>
1.15      xtraeme  9602:                   <h3 class="title"><a name="id2593447" id=
                   9603:                   "id2593447"></a>12.5.8.&nbsp;Packages with
1.1       grant    9604:                   hardcoded paths to other interpreters</h3>
                   9605:                 </div>
                   9606:               </div>
                   9607:             </div>
                   9608: 
                   9609:             <p>Your package may also contain scripts with hardcoded
                   9610:             paths to other interpreters besides (or as well as)
                   9611:             perl. To correct the full pathname to the script
                   9612:             interpreter, you need to set the following definitions
1.14      xtraeme  9613:             in your <code class="filename">Makefile</code> (we
                   9614:             shall use <span><strong class=
                   9615:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    9616:             <pre class="programlisting">
                   9617:   REPLACE_INTERPRETER+=     tcl
                   9618:     _REPLACE.tcl.old=     .*/bin/tclsh
                   9619:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   9620:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   9621:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   9622: </pre>
                   9623:           </div>
                   9624: 
                   9625:           <div class="sect2" lang="en" xml:lang="en">
                   9626:             <div class="titlepage">
                   9627:               <div>
                   9628:                 <div>
1.15      xtraeme  9629:                   <h3 class="title"><a name="id2593468" id=
                   9630:                   "id2593468"></a>12.5.9.&nbsp;Packages installing
1.1       grant    9631:                   perl modules</h3>
                   9632:                 </div>
                   9633:               </div>
                   9634:             </div>
                   9635: 
                   9636:             <p>Makefiles of packages providing perl5 modules should
1.14      xtraeme  9637:             include the Makefile fragment <code class=
                   9638:             "filename">../../lang/perl5/module.mk</code>. It
                   9639:             provides a <span><strong class=
                   9640:             "command">do-configure</strong></span> target for the
                   9641:             standard perl configuration for such modules as well as
                   9642:             various hooks to tune this configuration. See comments
                   9643:             in this file for details.</p>
1.1       grant    9644: 
                   9645:             <p>Perl5 modules will install into different places
                   9646:             depending on the version of perl used during the build
                   9647:             process. To address this, pkgsrc will append lines to
1.14      xtraeme  9648:             the <code class="filename">PLIST</code> corresponding
                   9649:             to the files listed in the installed <code class=
                   9650:             "filename">.packlist</code> file generated by most
                   9651:             perl5 modules. This is invoked by defining <code class=
                   9652:             "varname">PERL5_PACKLIST</code> to a space-separated
                   9653:             list of paths to packlist files, e.g.:</p>
1.1       grant    9654:             <pre class="programlisting">
                   9655: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   9656: </pre>
                   9657: 
1.14      xtraeme  9658:             <p>The variables <code class=
                   9659:             "varname">PERL5_SITELIB</code>, <code class=
                   9660:             "varname">PERL5_SITEARCH</code>, and <code class=
                   9661:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    9662:             locations in which perl5 modules may be installed, and
                   9663:             may be used by perl5 packages that don't have a
                   9664:             packlist. These three variables are also substituted
1.14      xtraeme  9665:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    9666:           </div>
                   9667: 
                   9668:           <div class="sect2" lang="en" xml:lang="en">
                   9669:             <div class="titlepage">
                   9670:               <div>
                   9671:                 <div>
                   9672:                   <h3 class="title"><a name="faq.info-files" id=
                   9673:                   "faq.info-files"></a>12.5.10.&nbsp;Packages
                   9674:                   installing info files</h3>
                   9675:                 </div>
                   9676:               </div>
                   9677:             </div>
                   9678: 
                   9679:             <p>Some packages install info files or use the
                   9680:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   9681:             &#8220;<span class="quote">install-info</span>&#8221;
                   9682:             commands. Each of the info files:</p>
                   9683: 
                   9684:             <div class="itemizedlist">
                   9685:               <ul type="disc">
                   9686:                 <li>
                   9687:                   <p>is considered to be installed in the directory
1.14      xtraeme  9688:                   <code class=
                   9689:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    9690:                 </li>
                   9691: 
                   9692:                 <li>
                   9693:                   <p>is registered in the Info directory file
1.14      xtraeme  9694:                   <code class=
                   9695:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    9696:                 </li>
                   9697: 
                   9698:                 <li>
                   9699:                   <p>and must be listed as a filename in the
1.14      xtraeme  9700:                   <code class="varname">INFO_FILES</code> variable
                   9701:                   in the package Makefile.</p>
1.1       grant    9702:                 </li>
                   9703:               </ul>
                   9704:             </div>
                   9705: 
1.14      xtraeme  9706:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    9707:             &#8220;<span class="quote">info</span>&#8221; and can
1.14      xtraeme  9708:             be overridden in the package Makefile. <code class=
                   9709:             "filename">INSTALL</code> and <code class=
                   9710:             "filename">DEINSTALL</code> scripts will be generated
                   9711:             to handle registration of the info files in the Info
1.1       grant    9712:             directory file. The &#8220;<span class=
                   9713:             "quote">install-info</span>&#8221; command used for the
                   9714:             info files registration is either provided by the
                   9715:             system, or by a special purpose package automatically
                   9716:             added as dependency if needed.</p>
                   9717: 
                   9718:             <p>A package which needs the &#8220;<span class=
                   9719:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  9720:             must define the variable <code class=
                   9721:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    9722:             minimum version of the &#8220;<span class=
                   9723:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  9724:             should be noted with the <code class=
                   9725:             "varname">TEXINFO_REQD</code> variable in the package
                   9726:             <code class="filename">Makefile</code>. By default, a
1.1       grant    9727:             minimum version of 3.12 is required. If the system does
1.14      xtraeme  9728:             not provide a <span><strong class=
                   9729:             "command">makeinfo</strong></span> command or if it
                   9730:             does not match the required minimum, a build dependency
                   9731:             on the <a xmlns=
                   9732:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9733:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.14      xtraeme  9734:             class="pkgname">devel/gtexinfo</a> package will be
                   9735:             added automatically.</p>
1.1       grant    9736: 
                   9737:             <p>The build and installation process of the software
                   9738:             provided by the package should not use the
1.14      xtraeme  9739:             <span><strong class=
                   9740:             "command">install-info</strong></span> command as the
                   9741:             registration of info files is the task of the package
                   9742:             <code class="filename">INSTALL</code> script, and it
                   9743:             must use the appropriate <span><strong class=
                   9744:             "command">makeinfo</strong></span> command.</p>
1.1       grant    9745: 
                   9746:             <p>To achieve this goal the pkgsrc infrastructure
1.14      xtraeme  9747:             creates overriding scripts for the <span><strong class=
                   9748:             "command">install-info</strong></span> and
                   9749:             <span><strong class="command">makeinfo</strong></span>
                   9750:             commands in a directory listed early in <code class=
                   9751:             "varname">PATH</code>.</p>
1.1       grant    9752: 
1.14      xtraeme  9753:             <p>The script overriding <span><strong class=
                   9754:             "command">install-info</strong></span> has no effect
                   9755:             except the logging of a message. The script overriding
                   9756:             <span><strong class="command">makeinfo</strong></span>
                   9757:             logs a message and according to the value of
                   9758:             <code class="varname">USE_MAKEINFO</code> and
                   9759:             <code class="varname">TEXINFO_REQD</code> either run
                   9760:             the appropriate <span><strong class=
                   9761:             "command">makeinfo</strong></span> command or exit on
                   9762:             error.</p>
1.1       grant    9763:           </div>
                   9764: 
                   9765:           <div class="sect2" lang="en" xml:lang="en">
                   9766:             <div class="titlepage">
                   9767:               <div>
                   9768:                 <div>
1.15      xtraeme  9769:                   <h3 class="title"><a name="id2593688" id=
                   9770:                   "id2593688"></a>12.5.11.&nbsp;Packages installing
1.1       grant    9771:                   GConf2 data files</h3>
                   9772:                 </div>
                   9773:               </div>
                   9774:             </div>
                   9775: 
1.14      xtraeme  9776:             <p>If a package installs <code class=
                   9777:             "filename">.schemas</code> or <code class=
                   9778:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    9779:             need to take some extra steps to make sure they get
                   9780:             registered in the database:</p>
                   9781: 
                   9782:             <div class="orderedlist">
                   9783:               <ol type="1">
                   9784:                 <li>
1.14      xtraeme  9785:                   <p>Include <code class=
                   9786:                   "filename">../../devel/GConf2/schemas.mk</code>
                   9787:                   instead of its <code class=
                   9788:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9789:                   care of rebuilding the GConf2 database at
                   9790:                   installation and deinstallation time, and tells
                   9791:                   the package where to install GConf2 data files
                   9792:                   using some standard configure arguments. It also
                   9793:                   disallows any access to the database directly
                   9794:                   from the package.</p>
                   9795:                 </li>
                   9796: 
                   9797:                 <li>
                   9798:                   <p>Ensure that the package installs its
1.14      xtraeme  9799:                   <code class="filename">.schemas</code> files
                   9800:                   under <code class=
                   9801:                   "filename">${PREFIX}/share/gconf/schemas</code>.
                   9802:                   If they get installed under <code class=
                   9803:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    9804:                   manually patch the package.</p>
                   9805:                 </li>
                   9806: 
                   9807:                 <li>
                   9808:                   <p>Check the PLIST and remove any entries under
                   9809:                   the etc/gconf directory, as they will be handled
                   9810:                   automatically. See <a href="#faq.conf" title=
1.14      xtraeme  9811:                   "6.14.&nbsp;Configuration files handling and placement">
                   9812:                   Section&nbsp;6.14, &#8220;Configuration files
1.1       grant    9813:                   handling and placement&#8221;</a> for more
                   9814:                   information.</p>
                   9815:                 </li>
                   9816: 
                   9817:                 <li>
1.14      xtraeme  9818:                   <p>Define the <code class=
                   9819:                   "varname">GCONF2_SCHEMAS</code> variable in your
                   9820:                   <code class="filename">Makefile</code> with a
                   9821:                   list of all <code class=
                   9822:                   "filename">.schemas</code> files installed by the
                   9823:                   package, if any. Names must not contain any
                   9824:                   directories in them.</p>
1.1       grant    9825:                 </li>
                   9826: 
                   9827:                 <li>
1.14      xtraeme  9828:                   <p>Define the <code class=
                   9829:                   "varname">GCONF2_ENTRIES</code> variable in your
                   9830:                   <code class="filename">Makefile</code> with a
                   9831:                   list of all <code class=
                   9832:                   "filename">.entries</code> files installed by the
                   9833:                   package, if any. Names must not contain any
                   9834:                   directories in them.</p>
1.1       grant    9835:                 </li>
                   9836:               </ol>
                   9837:             </div>
                   9838:           </div>
                   9839: 
                   9840:           <div class="sect2" lang="en" xml:lang="en">
                   9841:             <div class="titlepage">
                   9842:               <div>
                   9843:                 <div>
1.15      xtraeme  9844:                   <h3 class="title"><a name="id2593788" id=
                   9845:                   "id2593788"></a>12.5.12.&nbsp;Packages installing
1.1       grant    9846:                   scrollkeeper data files</h3>
                   9847:                 </div>
                   9848:               </div>
                   9849:             </div>
                   9850: 
1.14      xtraeme  9851:             <p>If a package installs <code class=
                   9852:             "filename">.omf</code> files, used by scrollkeeper, you
                   9853:             need to take some extra steps to make sure they get
                   9854:             registered in the database:</p>
1.1       grant    9855: 
                   9856:             <div class="orderedlist">
                   9857:               <ol type="1">
                   9858:                 <li>
1.14      xtraeme  9859:                   <p>Include <code class=
                   9860:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
                   9861:                   instead of its <code class=
                   9862:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9863:                   care of rebuilding the scrollkeeper database at
                   9864:                   installation and deinstallation time, and
                   9865:                   disallows any access to it directly from the
                   9866:                   package.</p>
                   9867:                 </li>
                   9868: 
                   9869:                 <li>
                   9870:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  9871:                   the <code class=
                   9872:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    9873:                   as they will be handled automatically.</p>
                   9874:                 </li>
                   9875: 
                   9876:                 <li>
1.14      xtraeme  9877:                   <p>Remove the <code class=
                   9878:                   "filename">share/omf</code> directory from the
                   9879:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    9880:                 </li>
                   9881:               </ol>
                   9882:             </div>
                   9883:           </div>
                   9884: 
                   9885:           <div class="sect2" lang="en" xml:lang="en">
                   9886:             <div class="titlepage">
                   9887:               <div>
                   9888:                 <div>
1.15      xtraeme  9889:                   <h3 class="title"><a name="id2593840" id=
                   9890:                   "id2593840"></a>12.5.13.&nbsp;Packages installing
1.1       grant    9891:                   X11 fonts</h3>
                   9892:                 </div>
                   9893:               </div>
                   9894:             </div>
                   9895: 
                   9896:             <p>If a package installs font files, you will need to
                   9897:             rebuild the fonts database in the directory where they
                   9898:             get installed at installation and deinstallation time.
1.14      xtraeme  9899:             This can be automatically done by using <code class=
                   9900:             "filename">mk/fonts.mk</code>, which you need to
                   9901:             include in your <code class=
                   9902:             "filename">Makefile</code>.</p>
1.1       grant    9903: 
                   9904:             <p>When the file is included, you can list the
1.14      xtraeme  9905:             directories where fonts are installed in the
                   9906:             <code class="varname">FONTS_<em class=
                   9907:             "replaceable"><code>type</code></em>_DIRS</code>
                   9908:             variables, where <em class=
                   9909:             "replaceable"><code>type</code></em> can be one of
                   9910:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    9911:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   9912:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.14      xtraeme  9913:             sure that the database file <code class=
                   9914:             "filename">fonts.dir</code> is not listed in the
1.1       grant    9915:             PLIST.</p>
                   9916: 
                   9917:             <p>Note that you should not create new directories for
                   9918:             fonts; instead use the standard ones to avoid that the
                   9919:             user needs to manually configure his X server to find
                   9920:             them.</p>
                   9921:           </div>
                   9922: 
                   9923:           <div class="sect2" lang="en" xml:lang="en">
                   9924:             <div class="titlepage">
                   9925:               <div>
                   9926:                 <div>
1.15      xtraeme  9927:                   <h3 class="title"><a name="id2593886" id=
                   9928:                   "id2593886"></a>12.5.14.&nbsp;Packages installing
1.1       grant    9929:                   GTK2 modules</h3>
                   9930:                 </div>
                   9931:               </div>
                   9932:             </div>
                   9933: 
                   9934:             <p>If a package installs gtk2 immodules or loaders, you
                   9935:             need to take some extra steps to get them registered in
                   9936:             the GTK2 database properly:</p>
                   9937: 
                   9938:             <div class="orderedlist">
                   9939:               <ol type="1">
                   9940:                 <li>
1.14      xtraeme  9941:                   <p>Include <code class=
                   9942:                   "filename">../../x11/gtk2/modules.mk</code>
                   9943:                   instead of its <code class=
                   9944:                   "filename">buildlink3.mk</code> file. This takes
                   9945:                   care of rebuilding the database at installation
                   9946:                   and deinstallation time.</p>
1.1       grant    9947:                 </li>
                   9948: 
                   9949:                 <li>
1.14      xtraeme  9950:                   <p>Set <code class=
                   9951:                   "varname">GTK2_IMMODULES=YES</code> if your
                   9952:                   package installs GTK2 immodules.</p>
1.1       grant    9953:                 </li>
                   9954: 
                   9955:                 <li>
1.14      xtraeme  9956:                   <p>Set <code class=
                   9957:                   "varname">GTK2_LOADERS=YES</code> if your package
                   9958:                   installs GTK2 loaders.</p>
1.1       grant    9959:                 </li>
                   9960: 
                   9961:                 <li>
                   9962:                   <p>Patch the package to not touch any of the gtk2
                   9963:                   databases directly. These are:</p>
                   9964: 
                   9965:                   <div class="itemizedlist">
                   9966:                     <ul type="disc">
                   9967:                       <li>
1.14      xtraeme  9968:                         <p><code class=
                   9969:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    9970:                       </li>
                   9971: 
                   9972:                       <li>
1.14      xtraeme  9973:                         <p><code class=
                   9974:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    9975:                       </li>
                   9976:                     </ul>
                   9977:                   </div>
                   9978:                 </li>
                   9979: 
                   9980:                 <li>
                   9981:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  9982:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    9983:                   directory, as they will be handled
                   9984:                   automatically.</p>
                   9985:                 </li>
                   9986:               </ol>
                   9987:             </div>
                   9988:           </div>
                   9989: 
                   9990:           <div class="sect2" lang="en" xml:lang="en">
                   9991:             <div class="titlepage">
                   9992:               <div>
                   9993:                 <div>
1.15      xtraeme  9994:                   <h3 class="title"><a name="id2593956" id=
                   9995:                   "id2593956"></a>12.5.15.&nbsp;Packages installing
1.1       grant    9996:                   SGML or XML data</h3>
                   9997:                 </div>
                   9998:               </div>
                   9999:             </div>
                   10000: 
                   10001:             <p>If a package installs SGML or XML data files that
                   10002:             need to be registered in system-wide catalogs (like
                   10003:             DTDs, sub-catalogs, etc.), you need to take some extra
                   10004:             steps:</p>
                   10005: 
                   10006:             <div class="orderedlist">
                   10007:               <ol type="1">
                   10008:                 <li>
1.14      xtraeme  10009:                   <p>Include <code class=
                   10010:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
                   10011:                   in your <code class="filename">Makefile</code>,
                   10012:                   which takes care of registering those files in
1.1       grant    10013:                   system-wide catalogs at installation and
                   10014:                   deinstallation time.</p>
                   10015:                 </li>
                   10016: 
                   10017:                 <li>
1.14      xtraeme  10018:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   10019:                   to the full path of any SGML catalogs installed
                   10020:                   by the package.</p>
1.1       grant    10021:                 </li>
                   10022: 
                   10023:                 <li>
1.14      xtraeme  10024:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   10025:                   to the full path of any XML catalogs installed by
1.1       grant    10026:                   the package.</p>
                   10027:                 </li>
                   10028: 
                   10029:                 <li>
1.14      xtraeme  10030:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   10031:                   to individual entries to be added to the SGML
1.1       grant    10032:                   catalog. These come in groups of three strings;
                   10033:                   see xmlcatmgr(1) for more information
                   10034:                   (specifically, arguments recognized by the 'add'
                   10035:                   action). Note that you will normally not use this
                   10036:                   variable.</p>
                   10037:                 </li>
                   10038: 
                   10039:                 <li>
1.14      xtraeme  10040:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   10041:                   to individual entries to be added to the XML
1.1       grant    10042:                   catalog. These come in groups of three strings;
                   10043:                   see xmlcatmgr(1) for more information
                   10044:                   (specifically, arguments recognized by the 'add'
                   10045:                   action). Note that you will normally not use this
                   10046:                   variable.</p>
                   10047:                 </li>
                   10048:               </ol>
                   10049:             </div>
                   10050:           </div>
                   10051: 
                   10052:           <div class="sect2" lang="en" xml:lang="en">
                   10053:             <div class="titlepage">
                   10054:               <div>
                   10055:                 <div>
1.15      xtraeme  10056:                   <h3 class="title"><a name="id2594076" id=
                   10057:                   "id2594076"></a>12.5.16.&nbsp;Packages installing
1.1       grant    10058:                   extensions to the MIME database</h3>
                   10059:                 </div>
                   10060:               </div>
                   10061:             </div>
                   10062: 
                   10063:             <p>If a package provides extensions to the MIME
1.14      xtraeme  10064:             database by installing <code class=
                   10065:             "filename">.xml</code> files inside <code class=
                   10066:             "filename">${PREFIX}/share/mime/packages</code>, you
                   10067:             need to take some extra steps to ensure that the
                   10068:             database is kept consistent with respect to these new
                   10069:             files:</p>
1.1       grant    10070: 
                   10071:             <div class="orderedlist">
                   10072:               <ol type="1">
                   10073:                 <li>
1.14      xtraeme  10074:                   <p>Include <code class=
                   10075:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
                   10076:                   (avoid using the <code class=
                   10077:                   "filename">buildlink3.mk</code> file from this
                   10078:                   same directory, which is reserved for inclusion
                   10079:                   from other <code class=
                   10080:                   "filename">buildlink3.mk</code> files). It takes
                   10081:                   care of rebuilding the MIME database at
                   10082:                   installation and deinstallation time, and
                   10083:                   disallows any access to it directly from the
1.1       grant    10084:                   package.</p>
                   10085:                 </li>
                   10086: 
                   10087:                 <li>
                   10088:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10089:                   the <code class="filename">share/mime</code>
1.1       grant    10090:                   directory, <span class=
                   10091:                   "emphasis"><em>except</em></span> for files saved
1.14      xtraeme  10092:                   under <code class=
                   10093:                   "filename">share/mime/packages</code>. The former
1.1       grant    10094:                   are handled automatically by the
                   10095:                   update-mime-database program, but the later are
                   10096:                   package-dependent and must be removed by the
                   10097:                   package that installed them in the first
                   10098:                   place.</p>
                   10099:                 </li>
                   10100: 
                   10101:                 <li>
1.14      xtraeme  10102:                   <p>Remove any <code class=
                   10103:                   "filename">share/mime/*</code> directories from
                   10104:                   the PLIST. They will be handled by the
1.1       grant    10105:                   shared-mime-info package.</p>
                   10106:                 </li>
                   10107:               </ol>
                   10108:             </div>
                   10109:           </div>
                   10110: 
                   10111:           <div class="sect2" lang="en" xml:lang="en">
                   10112:             <div class="titlepage">
                   10113:               <div>
                   10114:                 <div>
1.15      xtraeme  10115:                   <h3 class="title"><a name="id2594283" id=
                   10116:                   "id2594283"></a>12.5.17.&nbsp;Packages using
1.1       grant    10117:                   intltool</h3>
                   10118:                 </div>
                   10119:               </div>
                   10120:             </div>
                   10121: 
                   10122:             <p>If a package uses intltool during its build, include
1.14      xtraeme  10123:             the <code class=
                   10124:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    10125:             file, which forces it to use the intltool package
                   10126:             provided by pkgsrc, instead of the one bundled with the
                   10127:             distribution file.</p>
                   10128: 
                   10129:             <p>This tracks intltool's build-time dependencies and
                   10130:             uses the latest available version; this way, the
                   10131:             package benefits of any bug fixes that may have
                   10132:             appeared since it was released.</p>
                   10133:           </div>
                   10134:         </div>
                   10135: 
                   10136:         <div class="sect1" lang="en" xml:lang="en">
                   10137:           <div class="titlepage">
                   10138:             <div>
                   10139:               <div>
                   10140:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  10141:                 "id2594297" id="id2594297"></a>12.6.&nbsp;Feedback
1.1       grant    10142:                 to the author</h2>
                   10143:               </div>
                   10144:             </div>
                   10145:           </div>
                   10146: 
                   10147:           <p>If you have found any bugs in the package you make
                   10148:           available, if you had to do special steps to make it run
                   10149:           under NetBSD or if you enhanced the software in various
                   10150:           other ways, be sure to report these changes back to the
                   10151:           original author of the program! With that kind of
                   10152:           support, the next release of the program can incorporate
                   10153:           these fixes, and people not using the NetBSD packages
                   10154:           system can win from your efforts.</p>
                   10155: 
                   10156:           <p>Support the idea of free software!</p>
                   10157:         </div>
                   10158:       </div>
                   10159: 
                   10160:       <div class="chapter" lang="en" xml:lang="en">
                   10161:         <div class="titlepage">
                   10162:           <div>
                   10163:             <div>
                   10164:               <h2 class="title"><a name="debug" id=
                   10165:               "debug"></a>Chapter&nbsp;13.&nbsp;Debugging</h2>
                   10166:             </div>
                   10167:           </div>
                   10168:         </div>
                   10169: 
                   10170:         <p>To check out all the gotchas when building a package,
                   10171:         here are the steps that I do in order to get a package
                   10172:         working. Please note this is basically the same as what was
                   10173:         explained in the previous sections, only with some
                   10174:         debugging aids.</p>
                   10175: 
                   10176:         <div class="itemizedlist">
                   10177:           <ul type="disc">
                   10178:             <li>
1.14      xtraeme  10179:               <p>Be sure to set <code class=
                   10180:               "varname">PKG_DEVELOPER=1</code> in <code class=
                   10181:               "filename">/etc/mk.conf</code></p>
1.1       grant    10182:             </li>
                   10183: 
                   10184:             <li>
                   10185:               <p>Install <a xmlns=
                   10186:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10187:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.14      xtraeme  10188:               class="pkgname">pkgtools/url2pkg</a>, create a
                   10189:               directory for a new package, change into it, then run
                   10190:               <span><strong class=
                   10191:               "command">url2pkg</strong></span>:</p>
1.1       grant    10192:               <pre class="screen">
1.14      xtraeme  10193: <code class="prompt">%</code> <strong class=
                   10194: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   10195: "replaceable"><code>category</code></em>/<em class=
                   10196: "replaceable"><code>examplepkg</code></em></code></strong>
                   10197: <code class="prompt">%</code> <strong class=
                   10198: "userinput"><code>cd /usr/pkgsrc/<em class=
                   10199: "replaceable"><code>category</code></em>/<em class=
                   10200: "replaceable"><code>examplepkg</code></em></code></strong>
                   10201: <code class="prompt">%</code> <strong class=
                   10202: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    10203: </pre>
                   10204:             </li>
                   10205: 
                   10206:             <li>
1.14      xtraeme  10207:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    10208:               requested.</p>
                   10209:             </li>
                   10210: 
                   10211:             <li>
1.14      xtraeme  10212:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    10213:               file</p>
                   10214:             </li>
                   10215: 
                   10216:             <li>
1.14      xtraeme  10217:               <p>Run <span><strong class="command">make
                   10218:               configure</strong></span></p>
1.1       grant    10219:             </li>
                   10220: 
                   10221:             <li>
                   10222:               <p>Add any dependencies glimpsed from documentation
1.14      xtraeme  10223:               and the configure step to the package's <code class=
                   10224:               "filename">Makefile</code>.</p>
1.1       grant    10225:             </li>
                   10226: 
                   10227:             <li>
                   10228:               <p>Make the package compile, doing multiple rounds
                   10229:               of</p>
                   10230:               <pre class="screen">
1.14      xtraeme  10231: <code class="prompt">%</code> <strong class=
                   10232: "userinput"><code>make</code></strong>
                   10233: <code class="prompt">%</code> <strong class=
                   10234: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   10235: <code class="prompt">%</code> <strong class=
                   10236: "userinput"><code>mkpatches</code></strong>
                   10237: <code class="prompt">%</code> <strong class=
                   10238: "userinput"><code>patchdiff</code></strong>
                   10239: <code class="prompt">%</code> <strong class=
                   10240: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   10241: <code class="prompt">%</code> <strong class=
                   10242: "userinput"><code>make mps</code></strong>
                   10243: <code class="prompt">%</code> <strong class=
                   10244: "userinput"><code>make clean</code></strong>
1.1       grant    10245: </pre>
                   10246: 
                   10247:               <p>Doing as non-root user will ensure that no files
                   10248:               are modified that shouldn't be, especially during the
1.14      xtraeme  10249:               build phase. <span><strong class=
                   10250:               "command">mkpatches</strong></span>,
                   10251:               <span><strong class=
                   10252:               "command">patchdiff</strong></span> and
                   10253:               <span><strong class="command">pkgvi</strong></span>
                   10254:               are from the <a xmlns=
1.1       grant    10255:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10256:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14      xtraeme  10257:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    10258:             </li>
                   10259: 
                   10260:             <li>
1.14      xtraeme  10261:               <p>Look at the <code class=
                   10262:               "filename">Makefile</code>, fix if necessary; see
                   10263:               <a href="#components.Makefile" title=
                   10264:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
                   10265:               &#8220;<code class=
                   10266:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    10267:             </li>
                   10268: 
                   10269:             <li>
1.14      xtraeme  10270:               <p>Generate a <code class=
                   10271:               "filename">PLIST</code>:</p>
1.1       grant    10272:               <pre class="screen">
1.14      xtraeme  10273: <code class="prompt">#</code> <strong class=
                   10274: "userinput"><code>make install</code></strong>
                   10275: <code class="prompt">#</code> <strong class=
                   10276: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   10277: <code class="prompt">#</code> <strong class=
                   10278: "userinput"><code>make deinstall</code></strong>
                   10279: <code class="prompt">#</code> <strong class=
                   10280: "userinput"><code>make install</code></strong>
                   10281: <code class="prompt">#</code> <strong class=
                   10282: "userinput"><code>make deinstall</code></strong>
1.1       grant    10283: </pre>
                   10284: 
1.14      xtraeme  10285:               <p>You usually need to be <code class=
                   10286:               "username">root</code> to do this. Look if there are
1.1       grant    10287:               any files left:</p>
                   10288:               <pre class="screen">
1.14      xtraeme  10289: <code class="prompt">#</code> <strong class=
                   10290: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10291: </pre>
                   10292: 
                   10293:               <p>If this reveals any files that are missing in
1.14      xtraeme  10294:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    10295:             </li>
                   10296: 
                   10297:             <li>
1.14      xtraeme  10298:               <p>Now that the <code class="filename">PLIST</code>
                   10299:               is OK, install the package again and make a binary
1.1       grant    10300:               package:</p>
                   10301:               <pre class="screen">
1.14      xtraeme  10302: <code class="prompt">#</code> <strong class=
                   10303: "userinput"><code>make reinstall</code></strong>
                   10304: <code class="prompt">#</code> <strong class=
                   10305: "userinput"><code>make package</code></strong>
1.1       grant    10306: </pre>
                   10307:             </li>
                   10308: 
                   10309:             <li>
                   10310:               <p>Delete the installed package:</p>
                   10311:               <pre class="screen">
1.14      xtraeme  10312: <code class="prompt">#</code> <strong class=
                   10313: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    10314: </pre>
                   10315:             </li>
                   10316: 
                   10317:             <li>
1.14      xtraeme  10318:               <p>Repeat the above <span><strong class=
                   10319:               "command">make print-PLIST</strong></span> command,
                   10320:               which shouldn't find anything now:</p>
1.1       grant    10321:               <pre class="screen">
1.14      xtraeme  10322: <code class="prompt">#</code> <strong class=
                   10323: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10324: </pre>
                   10325:             </li>
                   10326: 
                   10327:             <li>
                   10328:               <p>Reinstall the binary package:</p>
                   10329:               <pre class="screen">
1.14      xtraeme  10330: <code class="prompt">#</code> <strong class=
                   10331: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    10332: </pre>
                   10333:             </li>
                   10334: 
                   10335:             <li>
                   10336:               <p>Play with it. Make sure everything works.</p>
                   10337:             </li>
                   10338: 
                   10339:             <li>
1.14      xtraeme  10340:               <p>Run <span><strong class=
                   10341:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    10342:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10343:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14      xtraeme  10344:               class="pkgname">pkgtools/pkglint</a>, and fix the
                   10345:               problems it reports:</p>
1.1       grant    10346:               <pre class="screen">
1.14      xtraeme  10347: <code class="prompt">#</code> <strong class=
                   10348: "userinput"><code>pkglint</code></strong>
1.1       grant    10349: </pre>
                   10350:             </li>
                   10351: 
                   10352:             <li>
                   10353:               <p>Submit (or commit, if you have cvs access); see
                   10354:               <a href="#submit" title=
                   10355:               "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter&nbsp;14,
                   10356:               <i>Submitting and Committing</i></a>.</p>
                   10357:             </li>
                   10358:           </ul>
                   10359:         </div>
                   10360:       </div>
                   10361: 
                   10362:       <div class="chapter" lang="en" xml:lang="en">
                   10363:         <div class="titlepage">
                   10364:           <div>
                   10365:             <div>
                   10366:               <h2 class="title"><a name="submit" id=
                   10367:               "submit"></a>Chapter&nbsp;14.&nbsp;Submitting and
                   10368:               Committing</h2>
                   10369:             </div>
                   10370:           </div>
                   10371:         </div>
                   10372: 
                   10373:         <div class="toc">
                   10374:           <p><b>Table of Contents</b></p>
                   10375: 
                   10376:           <dl>
1.15      xtraeme  10377:             <dt><span class="sect1"><a href="#id2594827">14.1.
1.1       grant    10378:             Submitting your packages</a></span></dt>
                   10379: 
1.15      xtraeme  10380:             <dt><span class="sect1"><a href="#id2594878">14.2.
1.1       grant    10381:             Committing: Importing a package into
                   10382:             CVS</a></span></dt>
                   10383: 
1.15      xtraeme  10384:             <dt><span class="sect1"><a href="#id2594941">14.3.
1.2       hubertf  10385:             Updating a package to a newer version</a></span></dt>
1.1       grant    10386: 
1.15      xtraeme  10387:             <dt><span class="sect1"><a href="#id2594961">14.4.
1.2       hubertf  10388:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    10389:           </dl>
                   10390:         </div>
                   10391: 
                   10392:         <div class="sect1" lang="en" xml:lang="en">
                   10393:           <div class="titlepage">
                   10394:             <div>
                   10395:               <div>
                   10396:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  10397:                 "id2594827" id=
                   10398:                 "id2594827"></a>14.1.&nbsp;Submitting your
1.1       grant    10399:                 packages</h2>
                   10400:               </div>
                   10401:             </div>
                   10402:           </div>
                   10403: 
                   10404:           <p>You have to separate between binary and
                   10405:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   10406:           packages here:</p>
                   10407: 
                   10408:           <div class="itemizedlist">
                   10409:             <ul type="disc">
                   10410:               <li>
                   10411:                 <p>precompiled binary packages</p>
                   10412: 
                   10413:                 <p>Our policy is that we accept binaries only from
                   10414:                 pkgsrc developers to guarantee that the packages
                   10415:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  10416:                 annoy anyone but rather to protect our users!
1.1       grant    10417:                 You're still free to put up your home-made binary
1.13      hubertf  10418:                 packages and tell the world where to get them.
                   10419:                 NetBSD developers doing bulk builds and wanting to
                   10420:                 upload them please see <a href="#bulk-upload"
                   10421:                 title="5.3.8.&nbsp;Uploading results of a bulk build">
                   10422:                 Section&nbsp;5.3.8, &#8220;Uploading results of a
                   10423:                 bulk build&#8221;</a>.</p>
1.1       grant    10424:               </li>
                   10425: 
                   10426:               <li>
                   10427:                 <p>packages</p>
                   10428: 
                   10429:                 <p>First, check that your package is complete,
                   10430:                 compiles and runs well; see <a href="#debug" title=
                   10431:                 "Chapter&nbsp;13.&nbsp;Debugging">Chapter&nbsp;13,
                   10432:                 <i>Debugging</i></a> and the rest of this document.
                   10433:                 Next, generate an uuencoded gzipped tar(1) archive,
                   10434:                 preferably with all files in a single directory.
1.14      xtraeme  10435:                 Finally, <span><strong class=
                   10436:                 "command">send-pr</strong></span> with category
1.1       grant    10437:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   10438:                 synopsis which includes the package name and
                   10439:                 version number, a short description of your package
                   10440:                 (contents of the COMMENT variable or DESCR file are
                   10441:                 OK) and attach the archive to your PR.</p>
                   10442: 
                   10443:                 <p>If you want to submit several packages, please
                   10444:                 send a separate PR for each one, it's easier for us
                   10445:                 to track things that way.</p>
                   10446: 
                   10447:                 <p>Alternatively, you can also import new packages
                   10448:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   10449:                 work-in-progress</span>&#8221;); see the homepage
                   10450:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   10451:                 target=
                   10452:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   10453:                 details.</p>
                   10454:               </li>
                   10455:             </ul>
                   10456:           </div>
                   10457:         </div>
                   10458: 
                   10459:         <div class="sect1" lang="en" xml:lang="en">
                   10460:           <div class="titlepage">
                   10461:             <div>
                   10462:               <div>
                   10463:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  10464:                 "id2594878" id=
                   10465:                 "id2594878"></a>14.2.&nbsp;Committing: Importing a
1.1       grant    10466:                 package into CVS</h2>
                   10467:               </div>
                   10468:             </div>
                   10469:           </div>
                   10470: 
                   10471:           <p>This section is only of interest for pkgsrc developers
                   10472:           with write access to the pkgsrc repository. Please
                   10473:           remember that cvs imports files relative to the current
                   10474:           working directory, and that the pathname that you give
1.14      xtraeme  10475:           the <span><strong class="command">cvs
                   10476:           import</strong></span> command is so that it knows where
                   10477:           to place the files in the repository. Newly created
                   10478:           packages should be imported with a vendor tag of
                   10479:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   10480:           release tag of &#8220;<span class=
                   10481:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    10482:           <pre class="programlisting">
                   10483:   % cd .../pkgsrc/category/pkgname
                   10484:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   10485: </pre>
                   10486: 
                   10487:           <p>Remember to move the directory from which you imported
                   10488:           out of the way, or cvs will complain the next time you
                   10489:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   10490:           source tree. Also don't forget to add the new package to
1.14      xtraeme  10491:           the category's <code class=
                   10492:           "filename">Makefile</code>.</p>
1.1       grant    10493: 
                   10494:           <p>The commit message of the initial import should
1.14      xtraeme  10495:           include part of the <code class="filename">DESCR</code>
                   10496:           file, so people reading the mailing lists know what the
                   10497:           package is/does.</p>
1.1       grant    10498: 
                   10499:           <p>Please note all package updates/additions in
1.14      xtraeme  10500:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
                   10501:           very important to keep this file up to date and
                   10502:           conforming to the existing format, because it will be
                   10503:           used by scripts to automatically update pages on <a href=
1.1       grant    10504:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   10505:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   10506:           file and remove the entry for the package you updated, in
                   10507:           case it was mentioned there.</p>
                   10508: 
                   10509:           <p>For new packages, &#8220;<span class="quote">cvs
                   10510:           import</span>&#8221; is preferred to &#8220;<span class=
                   10511:           "quote">cvs add</span>&#8221; because the former gets
                   10512:           everything with a single command, and provides a
                   10513:           consistent tag.</p>
                   10514:         </div>
                   10515: 
                   10516:         <div class="sect1" lang="en" xml:lang="en">
                   10517:           <div class="titlepage">
                   10518:             <div>
                   10519:               <div>
                   10520:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  10521:                 "id2594941" id="id2594941"></a>14.3.&nbsp;Updating
1.2       hubertf  10522:                 a package to a newer version</h2>
1.1       grant    10523:               </div>
                   10524:             </div>
                   10525:           </div>
                   10526: 
                   10527:           <p>Please always put a concise, appropriate and relevant
                   10528:           summary of the changes between old and new versions into
                   10529:           the commit log when updating a package. There are various
                   10530:           reasons for this:</p>
                   10531: 
                   10532:           <div class="itemizedlist">
                   10533:             <ul type="disc">
                   10534:               <li>
                   10535:                 <p>A URL is volatile, and can change over time. It
                   10536:                 may go away completely or its information may be
                   10537:                 overwritten by newer information.</p>
                   10538:               </li>
                   10539: 
                   10540:               <li>
                   10541:                 <p>Having the change information between old and
                   10542:                 new versions in our CVS repository is very useful
                   10543:                 for people who use either cvs or anoncvs.</p>
                   10544:               </li>
                   10545: 
                   10546:               <li>
                   10547:                 <p>Having the change information between old and
                   10548:                 new versions in our CVS repository is very useful
                   10549:                 for people who read the pkgsrc-changes mailing
                   10550:                 list, so that they can make tactical decisions
                   10551:                 about when to upgrade the package.</p>
                   10552:               </li>
                   10553:             </ul>
                   10554:           </div>
                   10555: 
                   10556:           <p>Please also recognise that, just because a new version
                   10557:           of a package has been released, it should not
                   10558:           automatically be upgraded in the CVS repository. We
                   10559:           prefer to be conservative in the packages that are
                   10560:           included in pkgsrc - development or beta packages are not
                   10561:           really the best thing for most places in which pkgsrc is
                   10562:           used. Please use your judgement about what should go into
                   10563:           pkgsrc, and bear in mind that stability is to be
                   10564:           preferred above new and possibly untested features.</p>
                   10565:         </div>
                   10566: 
                   10567:         <div class="sect1" lang="en" xml:lang="en">
                   10568:           <div class="titlepage">
                   10569:             <div>
                   10570:               <div>
                   10571:                 <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  10572:                 "id2594961" id="id2594961"></a>14.4.&nbsp;Moving a
1.2       hubertf  10573:                 package in pkgsrc</h2>
1.1       grant    10574:               </div>
                   10575:             </div>
                   10576:           </div>
                   10577: 
                   10578:           <div class="orderedlist">
                   10579:             <ol type="1">
                   10580:               <li>
                   10581:                 <p>Make a copy of the directory somewhere else.</p>
                   10582:               </li>
                   10583: 
                   10584:               <li>
                   10585:                 <p>Remove all CVS dirs.</p>
                   10586: 
                   10587:                 <p>Alternatively to the first two steps you can
                   10588:                 also do:</p>
                   10589:                 <pre class="screen">
1.14      xtraeme  10590: <code class="prompt">%</code> <strong class=
                   10591: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    10592: </pre>
                   10593: 
                   10594:                 <p>and use that for further work.</p>
                   10595:               </li>
                   10596: 
                   10597:               <li>
1.14      xtraeme  10598:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   10599:                 any <code class="varname">DEPENDS</code> paths that
                   10600:                 just did &#8220;<span class=
1.1       grant    10601:                 "quote">../package</span>&#8221; instead of
                   10602:                 &#8220;<span class=
                   10603:                 "quote">../../category/package</span>&#8221;.</p>
                   10604:               </li>
                   10605: 
                   10606:               <li>
1.14      xtraeme  10607:                 <p><span><strong class="command">cvs
                   10608:                 import</strong></span> the modified package in the
                   10609:                 new place.</p>
1.1       grant    10610:               </li>
                   10611: 
                   10612:               <li>
                   10613:                 <p>Check if any package depends on it:</p>
                   10614:                 <pre class="screen">
1.14      xtraeme  10615: <code class="prompt">%</code> <strong class=
                   10616: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   10617: <code class="prompt">%</code> <strong class=
                   10618: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    10619: </pre>
                   10620:               </li>
                   10621: 
                   10622:               <li>
                   10623:                 <p>Fix paths in packages from step 5 to point to
                   10624:                 new location.</p>
                   10625:               </li>
                   10626: 
                   10627:               <li>
1.14      xtraeme  10628:                 <p><span><strong class="command">cvs rm
                   10629:                 (-f)</strong></span> the package at the old
                   10630:                 location.</p>
1.1       grant    10631:               </li>
                   10632: 
                   10633:               <li>
1.14      xtraeme  10634:                 <p>Remove from <code class=
                   10635:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    10636:               </li>
                   10637: 
                   10638:               <li>
1.14      xtraeme  10639:                 <p>Add to <code class=
                   10640:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    10641:               </li>
                   10642: 
                   10643:               <li>
                   10644:                 <p>Commit the changed and removed files:</p>
                   10645:                 <pre class="screen">
1.14      xtraeme  10646: <code class="prompt">%</code> <strong class=
                   10647: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    10648: </pre>
                   10649: 
                   10650:                 <p>(and any packages from step 5, of course).</p>
                   10651:               </li>
                   10652:             </ol>
                   10653:           </div>
                   10654:         </div>
                   10655:       </div>
                   10656:     </div>
                   10657: 
                   10658:     <div class="appendix" lang="en" xml:lang="en">
                   10659:       <div class="titlepage">
                   10660:         <div>
                   10661:           <div>
                   10662:             <h2 class="title"><a name="examples" id=
                   10663:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   10664:             package: bison</h2>
                   10665:           </div>
                   10666:         </div>
                   10667:       </div>
                   10668: 
                   10669:       <div class="toc">
                   10670:         <p><b>Table of Contents</b></p>
                   10671: 
                   10672:         <dl>
1.15      xtraeme  10673:           <dt><span class="sect1"><a href="#id2595255">A.1.
1.1       grant    10674:           files</a></span></dt>
                   10675: 
                   10676:           <dd>
                   10677:             <dl>
1.15      xtraeme  10678:               <dt><span class="sect2"><a href="#id2595258">A.1.1.
1.1       grant    10679:               Makefile</a></span></dt>
                   10680: 
1.15      xtraeme  10681:               <dt><span class="sect2"><a href="#id2595266">A.1.2.
1.1       grant    10682:               DESCR</a></span></dt>
                   10683: 
1.15      xtraeme  10684:               <dt><span class="sect2"><a href="#id2595281">A.1.3.
1.1       grant    10685:               PLIST</a></span></dt>
                   10686: 
1.15      xtraeme  10687:               <dt><span class="sect2"><a href="#id2595288">A.1.4.
1.14      xtraeme  10688:               Checking a package with <span><strong class=
                   10689:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    10690:             </dl>
                   10691:           </dd>
                   10692: 
1.15      xtraeme  10693:           <dt><span class="sect1"><a href="#id2595329">A.2. Steps
1.1       grant    10694:           for building, installing, packaging</a></span></dt>
                   10695:         </dl>
                   10696:       </div>
                   10697: 
                   10698:       <p>We checked to find a piece of software that wasn't in the
                   10699:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  10700:       would want to have <span><strong class=
                   10701:       "command">bison</strong></span> when Berkeley
                   10702:       <span><strong class="command">yacc</strong></span> is already
                   10703:       present in the tree is beyond us, but it's useful for the
                   10704:       purposes of this exercise.</p>
1.1       grant    10705: 
                   10706:       <div class="sect1" lang="en" xml:lang="en">
                   10707:         <div class="titlepage">
                   10708:           <div>
                   10709:             <div>
                   10710:               <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  10711:               "id2595255" id="id2595255"></a>A.1.&nbsp;files</h2>
1.1       grant    10712:             </div>
                   10713:           </div>
                   10714:         </div>
                   10715: 
                   10716:         <div class="sect2" lang="en" xml:lang="en">
                   10717:           <div class="titlepage">
                   10718:             <div>
                   10719:               <div>
1.15      xtraeme  10720:                 <h3 class="title"><a name="id2595258" id=
                   10721:                 "id2595258"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    10722:               </div>
                   10723:             </div>
                   10724:           </div>
                   10725:           <pre class="programlisting">
1.16    ! grant    10726: # $NetBSD: pkgsrc.html,v 1.15 2005/01/11 16:34:44 xtraeme Exp $
1.1       grant    10727: #
                   10728: 
                   10729: DISTNAME=       bison-1.25
                   10730: CATEGORIES=     devel
                   10731: MASTER_SITES=   ${MASTER_SITE_GNU}
                   10732: 
                   10733: MAINTAINER=     thorpej@NetBSD.org
                   10734: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   10735: COMMENT=        GNU yacc clone
                   10736: 
                   10737: GNU_CONFIGURE=  yes
                   10738: INFO_FILES=     bison.info
                   10739: 
                   10740: .include "../../mk/bsd.pkg.mk"
                   10741: </pre>
                   10742:         </div>
                   10743: 
                   10744:         <div class="sect2" lang="en" xml:lang="en">
                   10745:           <div class="titlepage">
                   10746:             <div>
                   10747:               <div>
1.15      xtraeme  10748:                 <h3 class="title"><a name="id2595266" id=
                   10749:                 "id2595266"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    10750:               </div>
                   10751:             </div>
                   10752:           </div>
                   10753:           <pre class="programlisting">
                   10754: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   10755: improvements.  Why you would want this when Berkeley <a href=
                   10756: "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
                   10757: of the NetBSD source tree is beyond me.
                   10758: </pre>
                   10759:         </div>
                   10760: 
                   10761:         <div class="sect2" lang="en" xml:lang="en">
                   10762:           <div class="titlepage">
                   10763:             <div>
                   10764:               <div>
1.15      xtraeme  10765:                 <h3 class="title"><a name="id2595281" id=
                   10766:                 "id2595281"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    10767:               </div>
                   10768:             </div>
                   10769:           </div>
                   10770:           <pre class="programlisting">
1.16    ! grant    10771: @comment $NetBSD: pkgsrc.html,v 1.15 2005/01/11 16:34:44 xtraeme Exp $
1.1       grant    10772: bin/bison
                   10773: man/man1/bison.1.gz
                   10774: share/bison.simple
                   10775: share/bison.hairy
                   10776: </pre>
                   10777:         </div>
                   10778: 
                   10779:         <div class="sect2" lang="en" xml:lang="en">
                   10780:           <div class="titlepage">
                   10781:             <div>
                   10782:               <div>
1.15      xtraeme  10783:                 <h3 class="title"><a name="id2595288" id=
                   10784:                 "id2595288"></a>A.1.4.&nbsp;Checking a package with
1.14      xtraeme  10785:                 <span><strong class=
                   10786:                 "command">pkglint</strong></span></h3>
1.1       grant    10787:               </div>
                   10788:             </div>
                   10789:           </div>
                   10790: 
                   10791:           <p>The NetBSD package system comes with <a xmlns=
                   10792:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   10793:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14      xtraeme  10794:           class="pkgname">pkgtools/pkglint</a> which helps to check
                   10795:           the contents of these files. After installation it is
                   10796:           quite easy to use, just change to the directory of the
                   10797:           package you wish to examine and execute
                   10798:           <span><strong class=
                   10799:           "command">pkglint</strong></span>:</p>
1.1       grant    10800:           <pre class="screen">
1.14      xtraeme  10801: <code class="prompt">$</code> <strong class=
                   10802: "userinput"><code>pkglint</code></strong>
1.1       grant    10803: OK: checking ./DESCR.
                   10804: OK: checking Makefile.
                   10805: OK: checking distinfo.
                   10806: OK: checking patches/patch-aa.
                   10807: looks fine.
                   10808: </pre>
                   10809: 
                   10810:           <p>Depending on the supplied command line arguments (see
                   10811:           pkglint(1)) more verbose checks will be performed. Use
1.14      xtraeme  10812:           e.g. <span><strong class="command">pkglint
                   10813:           -v</strong></span> for a very verbose check.</p>
1.1       grant    10814:         </div>
                   10815:       </div>
                   10816: 
                   10817:       <div class="sect1" lang="en" xml:lang="en">
                   10818:         <div class="titlepage">
                   10819:           <div>
                   10820:             <div>
                   10821:               <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  10822:               "id2595329" id="id2595329"></a>A.2.&nbsp;Steps for
1.1       grant    10823:               building, installing, packaging</h2>
                   10824:             </div>
                   10825:           </div>
                   10826:         </div>
                   10827: 
                   10828:         <p>Create the directory where the package lives, plus any
                   10829:         auxiliary directories:</p>
                   10830:         <pre class="screen">
1.14      xtraeme  10831: <code class="prompt">#</code> <strong class=
                   10832: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   10833: <code class="prompt">#</code> <strong class=
                   10834: "userinput"><code>mkdir bison</code></strong>
                   10835: <code class="prompt">#</code> <strong class=
                   10836: "userinput"><code>cd bison</code></strong>
                   10837: <code class="prompt">#</code> <strong class=
                   10838: "userinput"><code>mkdir patches</code></strong>
1.1       grant    10839: </pre>
                   10840: 
1.14      xtraeme  10841:         <p>Create <code class="filename">Makefile</code>,
                   10842:         <code class="filename">DESCR</code> and <code class=
                   10843:         "filename">PLIST</code> (see <a href="#components" title=
1.1       grant    10844:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   10845:         Chapter 7, <i>Package components - files, directories and
                   10846:         contents</i></a>) then continue with fetching the
                   10847:         distfile:</p>
                   10848:         <pre class="screen">
1.14      xtraeme  10849: <code class="prompt">#</code> <strong class=
                   10850: "userinput"><code>make fetch</code></strong>
1.1       grant    10851: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   10852: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   10853: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10854: ftp: Error retrieving file: 500 Internal error
                   10855: 
                   10856: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   10857: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10858: ftp: Error retrieving file: 500 Internal error
                   10859: 
                   10860: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   10861: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10862: Successfully retrieved file.
                   10863: </pre>
                   10864: 
1.14      xtraeme  10865:         <p>Generate the checksum of the distfile into <code class=
                   10866:         "filename">distinfo</code>:</p>
1.1       grant    10867:         <pre class="screen">
1.14      xtraeme  10868: <code class="prompt">#</code> <strong class=
                   10869: "userinput"><code>make makesum</code></strong>
1.1       grant    10870: </pre>
                   10871: 
                   10872:         <p>Now compile:</p>
                   10873:         <pre class="screen">
1.14      xtraeme  10874: <code class="prompt">#</code> <strong class=
                   10875: "userinput"><code>make</code></strong>
1.1       grant    10876: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10877: ===&gt;  Extracting for bison-1.25
                   10878: ===&gt;  Patching for bison-1.25
                   10879: ===&gt;   Ignoring empty patch directory
                   10880: ===&gt;  Configuring for bison-1.25
                   10881: creating cache ./config.cache
                   10882: checking for gcc... cc
                   10883: checking whether we are using GNU C... yes
                   10884: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   10885: checking how to run the C preprocessor... cc -E
                   10886: checking for minix/config.h... no
                   10887: checking for POSIXized ISC... no
                   10888: checking whether cross-compiling... no
                   10889: checking for ANSI C header files... yes
                   10890: checking for string.h... yes
                   10891: checking for stdlib.h... yes
                   10892: checking for memory.h... yes
                   10893: checking for working const... yes
                   10894: checking for working alloca.h... no
                   10895: checking for alloca... yes
                   10896: checking for strerror... yes
                   10897: updating cache ./config.cache
                   10898: creating ./config.status
                   10899: creating Makefile
                   10900: ===&gt;  Building for bison-1.25
                   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 LR0.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 allocate.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 closure.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 conflicts.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 derives.c
                   10906: 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 
                   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 getargs.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 gram.c
                   10909: 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
                   10910: 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
                   10911: 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
                   10912: 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
                   10913: 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
                   10914: 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
                   10915: 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
                   10916: 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
                   10917: 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
                   10918: 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
                   10919: 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
                   10920: 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
                   10921: 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
                   10922: 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
                   10923: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   10924: rm -f bison.s1
                   10925: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   10926: </pre>
                   10927: 
                   10928:         <p>Everything seems OK, so install the files:</p>
                   10929:         <pre class="screen">
1.14      xtraeme  10930: <code class="prompt">#</code> <strong class=
                   10931: "userinput"><code>make install</code></strong>
1.1       grant    10932: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10933: ===&gt;  Installing for bison-1.25
                   10934: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   10935: rm -f /usr/pkg/bin/bison
                   10936: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   10937: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   10938: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   10939: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   10940: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   10941: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   10942: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   10943: ===&gt;  Registering installation for bison-1.25
                   10944: </pre>
                   10945: 
                   10946:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  10947:         remove it with <span><strong class="command">pkg_delete
                   10948:         bison</strong></span>. Should you decide that you want a
                   10949:         binary package, do this now:</p>
1.1       grant    10950:         <pre class="screen">
1.14      xtraeme  10951: <code class="prompt">#</code> <strong class=
                   10952: "userinput"><code>make package</code></strong>
1.1       grant    10953: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10954: ===&gt;  Building package for bison-1.25
                   10955: Creating package bison-1.25.tgz
                   10956: Registering depends:.
                   10957: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   10958: </pre>
                   10959: 
                   10960:         <p>Now that you don't need the source and object files any
                   10961:         more, clean up:</p>
                   10962:         <pre class="screen">
1.14      xtraeme  10963: <code class="prompt">#</code> <strong class=
                   10964: "userinput"><code>make clean</code></strong>
1.1       grant    10965: ===&gt;  Cleaning for bison-1.25
                   10966: </pre>
                   10967:       </div>
                   10968:     </div>
                   10969: 
                   10970:     <div class="appendix" lang="en" xml:lang="en">
                   10971:       <div class="titlepage">
                   10972:         <div>
                   10973:           <div>
                   10974:             <h2 class="title"><a name="logs" id=
                   10975:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   10976:           </div>
                   10977:         </div>
                   10978:       </div>
                   10979: 
                   10980:       <div class="toc">
                   10981:         <p><b>Table of Contents</b></p>
                   10982: 
                   10983:         <dl>
                   10984:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   10985:           Building figlet</a></span></dt>
                   10986: 
                   10987:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   10988:           Packaging figlet</a></span></dt>
                   10989:         </dl>
                   10990:       </div>
                   10991: 
                   10992:       <div class="sect1" lang="en" xml:lang="en">
                   10993:         <div class="titlepage">
                   10994:           <div>
                   10995:             <div>
                   10996:               <h2 class="title" style="clear: both"><a name=
                   10997:               "logs.building" id=
                   10998:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   10999:             </div>
                   11000:           </div>
                   11001:         </div>
                   11002:         <pre class="screen">
1.14      xtraeme  11003: <code class="prompt">#</code> <strong class=
                   11004: "userinput"><code>make</code></strong>
1.1       grant    11005: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11006: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   11007: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   11008: =&gt; [172219 bytes]
                   11009: Connected to ftp.plig.net.
                   11010: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   11011: 331 Guest login ok, send your complete e-mail address as password.
                   11012: 230-You are user #5 of 500 simultaneous users allowed.
                   11013: 230-
                   11014: 230-  ___ _             _ _                   
                   11015: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   11016: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   11017: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   11018: 230-         |_|   |_|     |___|         |___|
                   11019: 230-
                   11020: 230-** Welcome to ftp.plig.org **
                   11021: 230-
                   11022: 230-Please note that all transfers from this FTP site are logged. If you
                   11023: 230-do not like this, please disconnect now.
                   11024: 230-
                   11025: 230-This arhive is available via
                   11026: 230-
                   11027: 230-HTTP:  http://ftp.plig.org/
                   11028: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   11029: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   11030: 230-
                   11031: 230-Please email comments, bug reports and requests for packages to be
                   11032: 230-mirrored to ftp-admin@plig.org.   
                   11033: 230-
                   11034: 230-
                   11035: 230 Logged in anonymously.
                   11036: Remote system type is UNIX.
                   11037: Using binary mode to transfer files.
                   11038: 200 Type okay.
                   11039: 250 "/pub" is new cwd.
                   11040: 250-"/pub/figlet" is new cwd.
                   11041: 250-
                   11042: 250-Welcome to the figlet archive at ftp.figlet.org
                   11043: 250-    
                   11044: 250-    ftp://ftp.figlet.org/pub/figlet/
                   11045: 250-
                   11046: 250-The official FIGlet web page is:
                   11047: 250-    http://www.figlet.org/
                   11048: 250-
                   11049: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   11050: 250-contribute a font or something else, you can email us.
                   11051: 250 
                   11052: 250 "/pub/figlet/program" is new cwd.
                   11053: 250 "/pub/figlet/program/unix" is new cwd.
                   11054: local: figlet221.tar.gz remote: figlet221.tar.gz
                   11055: 502 Unimplemented command.
                   11056: 227 Entering Passive Mode (195,40,6,41,246,104)
                   11057: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   11058: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   11059: 226 Transfer completed.
                   11060: 172219 bytes received in 00:02 (75.99 KB/s)
                   11061: 221 Goodbye.
                   11062: =&gt; Checksum OK for figlet221.tar.gz.
                   11063: ===&gt; Extracting for figlet-2.2.1nb2
                   11064: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   11065: ===&gt; Patching for figlet-2.2.1nb2
                   11066: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   11067: ===&gt; Overriding tools for figlet-2.2.1nb2
                   11068: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   11069: ===&gt; Configuring for figlet-2.2.1nb2
                   11070: ===&gt; Building for figlet-2.2.1nb2
                   11071: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   11072: chmod a+x figlet
                   11073: gcc -O2 -o chkfont chkfont.c
                   11074: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  11075: <code class="prompt">#</code>
                   11076: <code class="prompt">#</code> <strong class=
                   11077: "userinput"><code>make install</code></strong>
1.1       grant    11078: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11079: ===&gt; Installing for figlet-2.2.1nb2
                   11080: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   11081: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   11082: mkdir -p /usr/pkg/share/figlet
                   11083: cp figlet /usr/pkg/bin
                   11084: cp chkfont /usr/pkg/bin
                   11085: chmod 555 figlist showfigfonts
                   11086: cp figlist /usr/pkg/bin
                   11087: cp showfigfonts /usr/pkg/bin
                   11088: cp fonts/*.flf /usr/pkg/share/figlet
                   11089: cp fonts/*.flc /usr/pkg/share/figlet
                   11090: cp figlet.6 /usr/pkg/man/man6
                   11091: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  11092: <code class="prompt">#</code>
1.1       grant    11093: </pre>
                   11094:       </div>
                   11095: 
                   11096:       <div class="sect1" lang="en" xml:lang="en">
                   11097:         <div class="titlepage">
                   11098:           <div>
                   11099:             <div>
                   11100:               <h2 class="title" style="clear: both"><a name=
                   11101:               "logs.package" id=
                   11102:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   11103:             </div>
                   11104:           </div>
                   11105:         </div>
                   11106:         <pre class="screen">
1.14      xtraeme  11107: <code class="prompt">#</code> <strong class=
                   11108: "userinput"><code>make package</code></strong>
1.1       grant    11109: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11110: ===&gt; Packaging figlet-2.2.1nb2
                   11111: ===&gt; Building binary package for figlet-2.2.1nb2
                   11112: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   11113: Using SrcDir value of /usr/pkg
                   11114: Registering depends:.  
1.14      xtraeme  11115: <code class="prompt">#</code>
1.1       grant    11116: </pre>
                   11117:       </div>
                   11118:     </div>
                   11119: 
                   11120:     <div class="appendix" lang="en" xml:lang="en">
                   11121:       <div class="titlepage">
                   11122:         <div>
                   11123:           <div>
                   11124:             <h2 class="title"><a name="ftp-layout" id=
                   11125:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   11126:             FTP server's package archive</h2>
                   11127:           </div>
                   11128:         </div>
                   11129:       </div>
                   11130: 
                   11131:       <p>Layout for precompiled binary packages on
                   11132:       ftp.NetBSD.org:</p>
                   11133:       <pre class="programlisting">
                   11134: /pub/NetBSD/packages/
                   11135:                 distfiles/
                   11136: 
                   11137:                 # Unpacked pkgsrc trees
                   11138:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   11139:                 pkgsrc-2003Q4 -&gt; N/A
                   11140:                 pkgsrc-2004Q1/pkgsrc
                   11141: 
                   11142:                 # pkgsrc archives
                   11143:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   11144:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   11145:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   11146: 
                   11147:                 # Per pkgsrc-release/OS-release/arch package archives
                   11148:                 pkgsrc-2003Q4/
                   11149:                         NetBSD-1.6.2/
                   11150:                                 i386/
                   11151:                                         All/
                   11152:                                         archivers/
                   11153:                                                 foo -&gt; ../All/foo
                   11154:                                         ...
                   11155:                 pkgsrc-2004Q1/
                   11156:                         NetBSD-1.6.2/
                   11157:                                 i386/
                   11158:                                         All/
                   11159:                                         ...
                   11160:                         NetBSD-2.0/
                   11161:                                 i386/
                   11162:                                         All/
                   11163:                                         ...
                   11164:                         SunOS-5.9/
                   11165:                                 sparc/
                   11166:                                         All/
                   11167:                                         ...
                   11168:                                 x86/
                   11169:                                         All/
                   11170:                                         ...
                   11171: 
                   11172:                 # Per os-release package archive convenience links
                   11173:                 NetBSD-1.6.2 -&gt; 1.6.2
                   11174:                 1.6.2/
                   11175:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   11176:                         m68k/
                   11177:                                 All/
                   11178:                                 archivers/
                   11179:                                         foo -&gt; ../All/foo
                   11180:                                 ...
                   11181:                         amiga -&gt; m68k
                   11182:                         atari -&gt; m68k
                   11183:                         ...
                   11184: 
                   11185:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   11186:                 NetBSD-2.0/
                   11187:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   11188:                 SunOS-5.9/
                   11189:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   11190:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   11191:                         
                   11192: </pre>
                   11193: 
                   11194:       <p>To create:</p>
                   11195: 
                   11196:       <div class="orderedlist">
                   11197:         <ol type="1">
                   11198:           <li>
                   11199:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   11200:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   11201:             5.3, &#8220;Doing a bulk build of all
                   11202:             packages&#8221;</a></p>
                   11203:           </li>
                   11204: 
                   11205:           <li>
                   11206:             <p>Upload /usr/pkgsrc/packages to</p>
                   11207:             <pre class="programlisting">
                   11208:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  11209:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    11210:         `uname -s`-`uname -r`/                  # OS &amp; version
                   11211:         `uname -p`                              # architecture
                   11212:        
                   11213: </pre>
                   11214:           </li>
                   11215: 
                   11216:           <li>
1.14      xtraeme  11217:             <p>If necessary, create a symlink <span><strong class=
                   11218:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   11219:             (amiga -&gt; m68k, ...)</p>
1.1       grant    11220:           </li>
                   11221:         </ol>
                   11222:       </div>
                   11223:     </div>
1.2       hubertf  11224: 
                   11225:     <div class="appendix" lang="en" xml:lang="en">
                   11226:       <div class="titlepage">
                   11227:         <div>
                   11228:           <div>
                   11229:             <h2 class="title"><a name="editing" id=
                   11230:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   11231:             for the pkgsrc guide</h2>
                   11232:           </div>
                   11233:         </div>
                   11234:       </div>
                   11235: 
                   11236:       <div class="toc">
                   11237:         <p><b>Table of Contents</b></p>
                   11238: 
                   11239:         <dl>
1.15      xtraeme  11240:           <dt><span class="sect1"><a href="#id2595975">D.1.
1.2       hubertf  11241:           Targets</a></span></dt>
                   11242: 
1.15      xtraeme  11243:           <dt><span class="sect1"><a href="#id2596387">D.2.
1.2       hubertf  11244:           Procedure</a></span></dt>
                   11245:         </dl>
                   11246:       </div>
                   11247: 
                   11248:       <p>This section contains information on editing the pkgsrc
                   11249:       guide itself.</p>
                   11250: 
                   11251:       <div class="sect1" lang="en" xml:lang="en">
                   11252:         <div class="titlepage">
                   11253:           <div>
                   11254:             <div>
                   11255:               <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  11256:               "id2595975" id="id2595975"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  11257:             </div>
                   11258:           </div>
                   11259:         </div>
                   11260: 
1.14      xtraeme  11261:         <p>The pkgsrc guide's source code is stored in <code class=
                   11262:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  11263:         are created from it:</p>
                   11264: 
                   11265:         <div class="itemizedlist">
                   11266:           <ul type="disc">
                   11267:             <li>
1.14      xtraeme  11268:               <p><code class=
                   11269:               "filename">pkgsrc/doc/pkgsrc.txt</code>, which
                   11270:               replaces <code class=
                   11271:               "filename">pkgsrc/Packages.txt</code></p>
1.2       hubertf  11272:             </li>
                   11273: 
                   11274:             <li>
1.14      xtraeme  11275:               <p><code class=
                   11276:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  11277:             </li>
                   11278: 
                   11279:             <li>
1.14      xtraeme  11280:               <p><code class=
                   11281:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  11282:               the documentation on the NetBSD website will be built
                   11283:               from pkgsrc and kept up to date on the web server
                   11284:               itself. This means you <span class=
                   11285:               "emphasis"><em>must</em></span> make sure that your
                   11286:               changes haven't broken the build!</p>
                   11287:             </li>
1.6       hubertf  11288: 
                   11289:             <li>
1.14      xtraeme  11290:               <p><code class=
                   11291:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  11292:               PDF version of the pkgsrc guide.</p>
                   11293:             </li>
                   11294: 
                   11295:             <li>
1.14      xtraeme  11296:               <p><code class=
                   11297:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  11298:               PostScript version of the pkgsrc guide.</p>
                   11299:             </li>
1.2       hubertf  11300:           </ul>
                   11301:         </div>
                   11302:       </div>
                   11303: 
                   11304:       <div class="sect1" lang="en" xml:lang="en">
                   11305:         <div class="titlepage">
                   11306:           <div>
                   11307:             <div>
                   11308:               <h2 class="title" style="clear: both"><a name=
1.15      xtraeme  11309:               "id2596387" id=
                   11310:               "id2596387"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  11311:             </div>
                   11312:           </div>
                   11313:         </div>
                   11314: 
                   11315:         <p>The procedure to edit the pkgsrc guide is:</p>
                   11316: 
                   11317:         <div class="itemizedlist">
                   11318:           <ul type="disc">
                   11319:             <li>
1.6       hubertf  11320:               <p>Make sure you have the packages needed to
                   11321:               re-generate the pkgsrc guide (and other XML-based
                   11322:               NetBSD documentation) installed. These are
1.11      ben      11323:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  11324:               for creating the ASCII- and HTML-version, and
                   11325:               &#8220;<span class=
1.11      ben      11326:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  11327:               PostScript- and PDF version. You will need both
                   11328:               packages installed, to make sure documentation is
                   11329:               consistent across all formats. The packages can be
1.14      xtraeme  11330:               found in <code class=
                   11331:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
                   11332:               <code class=
                   11333:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  11334:             </li>
                   11335: 
                   11336:             <li>
1.14      xtraeme  11337:               <p>Edit the XML file(s) in <code class=
                   11338:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  11339:             </li>
                   11340: 
                   11341:             <li>
1.14      xtraeme  11342:               <p>Run <span><strong class="command">make extract
                   11343:               &amp;&amp; make do-lint</strong></span> in
                   11344:               <code class="filename">pkgsrc/doc/guide</code> to
                   11345:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  11346:             </li>
                   11347: 
                   11348:             <li>
1.14      xtraeme  11349:               <p>Run <span><strong class=
                   11350:               "command">make</strong></span> in <code class=
                   11351:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   11352:               and ASCII version.</p>
1.2       hubertf  11353:             </li>
                   11354: 
                   11355:             <li>
1.14      xtraeme  11356:               <p>If all is well, run <span><strong class=
                   11357:               "command">make install-doc</strong></span> to put the
                   11358:               generated files into <code class=
                   11359:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  11360:             </li>
                   11361: 
                   11362:             <li>
1.14      xtraeme  11363:               <p><span><strong class="command">cvs commit
                   11364:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  11365:             </li>
                   11366: 
                   11367:             <li>
1.14      xtraeme  11368:               <p><span><strong class="command">cvs commit -m
                   11369:               re-generate
                   11370:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  11371:             </li>
1.4       hubertf  11372: 
                   11373:             <li>
                   11374:               <p>Until the webserver on www.NetBSD.org is really
                   11375:               updated automatically to pick up changes to the
1.14      xtraeme  11376:               pkgsrc guide automatically, also run
                   11377:               <span><strong class="command">make install-htdoc
                   11378:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   11379:               similar, adjust <code class=
                   11380:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  11381:             </li>
                   11382: 
                   11383:             <li>
1.14      xtraeme  11384:               <p><span><strong class="command">cvs commit
                   11385:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  11386:             </li>
1.2       hubertf  11387:           </ul>
                   11388:         </div>
                   11389:       </div>
                   11390:     </div>
1.1       grant    11391:   </div>
                   11392: </body>
                   11393: </html>

CVSweb <webmaster@jp.NetBSD.org>