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

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.
        !           301:                 How to resume transferencies with
        !           302:                 pkgsrc?</a></span></dt>
        !           303: 
        !           304:                 <dt><span class="sect1"><a href="#id2584903">6.6.
1.1       grant     305:                 How can I install/use XFree86 from
                    306:                 pkgsrc?</a></span></dt>
                    307: 
1.14    ! xtraeme   308:                 <dt><span class="sect1"><a href="#id2584931">6.7.
1.1       grant     309:                 How can I install/use X.org from
                    310:                 pkgsrc?</a></span></dt>
                    311: 
1.14    ! xtraeme   312:                 <dt><span class="sect1"><a href="#id2584958">6.8.
1.1       grant     313:                 How to fetch files from behind a
                    314:                 firewall</a></span></dt>
                    315: 
1.14    ! xtraeme   316:                 <dt><span class="sect1"><a href="#id2584972">6.9.
        !           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.14    ! xtraeme   321:                 <dt><span class="sect1"><a href="#id2585024">6.10.
1.1       grant     322:                 How to fetch all distfiles at once</a></span></dt>
                    323: 
1.14    ! xtraeme   324:                 <dt><span class="sect1"><a href="#id2585163">6.11.
        !           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.14    ! xtraeme   329:                 <dt><span class="sect1"><a href="#id2585202">6.12.
        !           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.14    ! xtraeme   333:                 <dt><span class="sect1"><a href="#id2585259">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.14    ! xtraeme   371:                 <dt><span class="sect1"><a href="#id2586509">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.14    ! xtraeme   378:                 <dt><span class="sect1"><a href="#id2586635">7.6.
        !           379:                 <code class="filename">work*</code></a></span></dt>
1.1       grant     380: 
1.14    ! xtraeme   381:                 <dt><span class="sect1"><a href="#id2586791">7.7.
        !           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.14    ! xtraeme   392:                 <dt><span class="sect1"><a href="#id2586845">8.1.
1.1       grant     393:                 RCS ID</a></span></dt>
                    394: 
1.14    ! xtraeme   395:                 <dt><span class="sect1"><a href="#id2586860">8.2.
        !           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.14    ! xtraeme   407:                 <dt><span class="sect1"><a href="#id2587181">8.5.
1.1       grant     408:                 Manpage-compression</a></span></dt>
                    409: 
1.14    ! xtraeme   410:                 <dt><span class="sect1"><a href="#id2587223">8.6.
        !           411:                 Changing PLIST source with <code class=
        !           412:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     413: 
1.14    ! xtraeme   414:                 <dt><span class="sect1"><a href="#id2587240">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.14    ! xtraeme   429:                 <dt><span class="sect1"><a href="#id2587717">9.1.
1.1       grant     430:                 Converting packages to use
                    431:                 buildlink3</a></span></dt>
                    432: 
1.14    ! xtraeme   433:                 <dt><span class="sect1"><a href="#id2587908">9.2.
        !           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.14    ! xtraeme   440:                     "#id2587977">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.14    ! xtraeme   444:                     "#id2588349">9.2.2. Updating <code class=
        !           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.14    ! xtraeme   452:                 <dt><span class="sect1"><a href="#id2588428">9.3.
        !           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.14    ! xtraeme   459:                     "#id2588578">9.3.1. Anatomy of a <code class=
        !           460:                     "filename">builtin.mk</code>
1.1       grant     461:                     file</a></span></dt>
                    462: 
                    463:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   464:                     "#id2588873">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.14    ! xtraeme   476:                 <dt><span class="sect1"><a href="#id2588946">10.1.
1.1       grant     477:                 Global default options</a></span></dt>
                    478: 
1.14    ! xtraeme   479:                 <dt><span class="sect1"><a href="#id2588961">10.2.
        !           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.14    ! xtraeme   494:                 <dt><span class="sect1"><a href="#id2589569">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.14    ! xtraeme   508:                 <dt><span class="sect1"><a href="#id2590969">12.1.
1.1       grant     509:                 General operation</a></span></dt>
                    510: 
                    511:                 <dd>
                    512:                   <dl>
                    513:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   514:                     "#id2590972">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.14    ! xtraeme   518:                     "#id2591124">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.14    ! xtraeme   526:                     "#id2591639">12.1.4. Handling conflicts with
1.1       grant     527:                     other packages</a></span></dt>
                    528: 
                    529:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   530:                     "#id2591757">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.14    ! xtraeme   534:                     "#id2591783">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.14    ! xtraeme   542:                     "#id2591875">12.1.8. How to handle compiler
1.1       grant     543:                     bugs</a></span></dt>
                    544: 
                    545:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   546:                     "#id2591897">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.14    ! xtraeme   551:                     "#id2591946">12.1.10. Portability of
1.1       grant     552:                     packages</a></span></dt>
                    553:                   </dl>
                    554:                 </dd>
                    555: 
1.14    ! xtraeme   556:                 <dt><span class="sect1"><a href="#id2591971">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.14    ! xtraeme   562:                     "#id2591974">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.14    ! xtraeme   567:                     "#id2592105">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.14    ! xtraeme   572:                 <dt><span class="sect1"><a href="#id2592117">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.14    ! xtraeme   582:                     "#id2592593">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.14    ! xtraeme   587:                     "#id2592677">12.3.3. GNU
1.1       grant     588:                     Autoconf/Automake</a></span></dt>
                    589:                   </dl>
                    590:                 </dd>
                    591: 
1.14    ! xtraeme   592:                 <dt><span class="sect1"><a href="#id2592790">12.4.
1.1       grant     593:                 Building considerations</a></span></dt>
                    594: 
                    595:                 <dd>
                    596:                   <dl>
                    597:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   598:                     "#id2592793">12.4.1. CPP
1.1       grant     599:                     defines</a></span></dt>
                    600:                   </dl>
                    601:                 </dd>
                    602: 
1.14    ! xtraeme   603:                 <dt><span class="sect1"><a href="#id2592823">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.14    ! xtraeme   609:                     "#id2592826">12.5.1. Package configuration
1.1       grant     610:                     files</a></span></dt>
                    611: 
                    612:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   613:                     "#id2592929">12.5.2. User
1.2       hubertf   614:                     interaction</a></span></dt>
1.1       grant     615: 
                    616:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   617:                     "#id2593042">12.5.3. Handling
1.1       grant     618:                     licenses</a></span></dt>
                    619: 
                    620:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   621:                     "#id2593193">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.14    ! xtraeme   625:                     "#id2593392">12.5.5. Installing score
1.1       grant     626:                     files</a></span></dt>
                    627: 
                    628:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   629:                     "#id2593435">12.5.6. Packages providing login
1.1       grant     630:                     shells</a></span></dt>
                    631: 
                    632:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   633:                     "#id2593493">12.5.7. Packages containing perl
1.1       grant     634:                     scripts</a></span></dt>
                    635: 
                    636:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   637:                     "#id2593511">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.14    ! xtraeme   641:                     "#id2593532">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.14    ! xtraeme   649:                     "#id2593752">12.5.11. Packages installing
1.1       grant     650:                     GConf2 data files</a></span></dt>
                    651: 
                    652:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   653:                     "#id2593852">12.5.12. Packages installing
1.1       grant     654:                     scrollkeeper data files</a></span></dt>
                    655: 
                    656:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   657:                     "#id2593904">12.5.13. Packages installing X11
1.1       grant     658:                     fonts</a></span></dt>
                    659: 
                    660:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   661:                     "#id2593950">12.5.14. Packages installing GTK2
1.1       grant     662:                     modules</a></span></dt>
                    663: 
                    664:                     <dt><span class="sect2"><a href=
1.14    ! xtraeme   665:                     "#id2594020">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.14    ! xtraeme   669:                     "#id2594140">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.14    ! xtraeme   673:                     "#id2594347">12.5.17. Packages using
1.1       grant     674:                     intltool</a></span></dt>
                    675:                   </dl>
                    676:                 </dd>
                    677: 
1.14    ! xtraeme   678:                 <dt><span class="sect1"><a href="#id2594361">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.14    ! xtraeme   691:                 <dt><span class="sect1"><a href="#id2594823">14.1.
1.1       grant     692:                 Submitting your packages</a></span></dt>
                    693: 
1.14    ! xtraeme   694:                 <dt><span class="sect1"><a href="#id2594874">14.2.
1.1       grant     695:                 Committing: Importing a package into
                    696:                 CVS</a></span></dt>
                    697: 
1.14    ! xtraeme   698:                 <dt><span class="sect1"><a href="#id2595005">14.3.
1.2       hubertf   699:                 Updating a package to a newer
                    700:                 version</a></span></dt>
1.1       grant     701: 
1.14    ! xtraeme   702:                 <dt><span class="sect1"><a href="#id2595161">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.14    ! xtraeme   714:             <dt><span class="sect1"><a href="#id2595319">A.1.
1.1       grant     715:             files</a></span></dt>
                    716: 
                    717:             <dd>
                    718:               <dl>
1.14    ! xtraeme   719:                 <dt><span class="sect2"><a href="#id2595322">A.1.1.
1.1       grant     720:                 Makefile</a></span></dt>
                    721: 
1.14    ! xtraeme   722:                 <dt><span class="sect2"><a href="#id2595330">A.1.2.
1.1       grant     723:                 DESCR</a></span></dt>
                    724: 
1.14    ! xtraeme   725:                 <dt><span class="sect2"><a href="#id2595345">A.1.3.
1.1       grant     726:                 PLIST</a></span></dt>
                    727: 
1.14    ! xtraeme   728:                 <dt><span class="sect2"><a href="#id2595352">A.1.4.
        !           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.14    ! xtraeme   734:             <dt><span class="sect1"><a href="#id2595393">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.14    ! xtraeme   760:             <dt><span class="sect1"><a href="#id2596107">D.1.
1.2       hubertf   761:             Targets</a></span></dt>
                    762: 
1.14    ! xtraeme   763:             <dt><span class="sect1"><a href="#id2596178">D.2.
1.2       hubertf   764:             Procedure</a></span></dt>
                    765:           </dl>
                    766:         </dd>
1.1       grant     767:       </dl>
                    768:     </div>
                    769: 
                    770:     <div class="chapter" lang="en" xml:lang="en">
                    771:       <div class="titlepage">
                    772:         <div>
                    773:           <div>
                    774:             <h2 class="title"><a name="introduction" id=
                    775:             "introduction"></a>Chapter&nbsp;1.&nbsp;Introduction</h2>
                    776:           </div>
                    777:         </div>
                    778:       </div>
                    779: 
                    780:       <div class="toc">
                    781:         <p><b>Table of Contents</b></p>
                    782: 
                    783:         <dl>
1.14    ! xtraeme   784:           <dt><span class="sect1"><a href="#id2514274">1.1.
1.1       grant     785:           Introduction</a></span></dt>
                    786: 
                    787:           <dt><span class="sect1"><a href="#overview">1.2.
                    788:           Overview</a></span></dt>
                    789: 
                    790:           <dt><span class="sect1"><a href="#terminology">1.3.
                    791:           Terminology</a></span></dt>
                    792: 
                    793:           <dt><span class="sect1"><a href="#typography">1.4.
                    794:           Typography</a></span></dt>
                    795:         </dl>
                    796:       </div>
                    797: 
                    798:       <div class="sect1" lang="en" xml:lang="en">
                    799:         <div class="titlepage">
                    800:           <div>
                    801:             <div>
                    802:               <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme   803:               "id2514274" id=
        !           804:               "id2514274"></a>1.1.&nbsp;Introduction</h2>
1.1       grant     805:             </div>
                    806:           </div>
                    807:         </div>
                    808: 
                    809:         <p>There is a lot of software freely available for Unix
                    810:         based systems, which usually runs on NetBSD and other
                    811:         Unix-flavoured systems, too, sometimes with some
                    812:         modifications. The NetBSD Packages Collection (pkgsrc)
                    813:         incorporates any such changes necessary to make that
                    814:         software run, and makes the installation (and
                    815:         de-installation) of the software package easy by means of a
                    816:         single command.</p>
                    817: 
                    818:         <p>Once the software has been built, it is manipulated with
1.14    ! xtraeme   819:         the <span><strong class="command">pkg_*</strong></span>
        !           820:         tools so that installation and de-installation, printing of
        !           821:         an inventory of all installed packages and retrieval of
        !           822:         one-line comments or more verbose descriptions are all
        !           823:         simple.</p>
1.1       grant     824: 
                    825:         <p>pkgsrc currently contains several thousand packages,
                    826:         including:</p>
                    827: 
                    828:         <div class="itemizedlist">
                    829:           <ul type="disc">
                    830:             <li>
                    831:               <p><a xmlns=
                    832:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    833:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.14    ! xtraeme   834:               class="pkgname">www/apache</a> - The Apache web
        !           835:               server</p>
1.1       grant     836:             </li>
                    837: 
                    838:             <li>
                    839:               <p><a xmlns=
                    840:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    841:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.14    ! xtraeme   842:               class="pkgname">www/mozilla</a> - The Mozilla web
        !           843:               browser</p>
1.1       grant     844:             </li>
                    845: 
                    846:             <li>
                    847:               <p><a xmlns=
                    848:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    849:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.14    ! xtraeme   850:               class="pkgname">meta-pkgs/gnome</a> - The GNOME
        !           851:               Desktop Environment</p>
1.1       grant     852:             </li>
                    853: 
                    854:             <li>
                    855:               <p><a xmlns=
                    856:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    857:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.14    ! xtraeme   858:               class="pkgname">meta-pkgs/kde3</a> - The K Desktop
        !           859:               Environment</p>
1.1       grant     860:             </li>
                    861:           </ul>
                    862:         </div>
                    863: 
                    864:         <p>...just to name a few.</p>
                    865: 
                    866:         <p>pkgsrc has built-in support for handling varying
                    867:         dependencies, such as pthreads and X11, and extended
                    868:         features such as IPv6 support on a range of platforms.</p>
                    869: 
                    870:         <p>pkgsrc was derived from FreeBSD's ports system, and
                    871:         initially developed for NetBSD only. Since then, pkgsrc has
                    872:         grown a lot, and now supports the following platforms:</p>
                    873: 
                    874:         <div class="itemizedlist">
                    875:           <ul type="disc">
                    876:             <li>
                    877:               <p><a href="http://developer.apple.com/darwin/"
                    878:               target="_top">Darwin</a> (<a href=
                    879:               "http://www.apple.com/macosx/" target="_top">Mac OS
                    880:               X</a>)</p>
                    881:             </li>
                    882: 
                    883:             <li>
1.3       hubertf   884:               <p><a href="http://www.DragonFlyBSD.org/" target=
                    885:               "_top">DragonFlyBSD</a></p>
                    886:             </li>
                    887: 
                    888:             <li>
1.1       grant     889:               <p><a href="http://www.FreeBSD.org/" target=
                    890:               "_top">FreeBSD</a></p>
                    891:             </li>
                    892: 
                    893:             <li>
1.3       hubertf   894:               <p>Microsoft Windows, via <a href=
                    895:               "http://www.microsoft.com/windows/sfu/" target=
                    896:               "_top">Interix</a></p>
1.1       grant     897:             </li>
                    898: 
                    899:             <li>
                    900:               <p><a href="http://www.sgi.com/software/irix6.5/"
                    901:               target="_top">IRIX</a></p>
                    902:             </li>
                    903: 
                    904:             <li>
                    905:               <p><a href="http://www.linux.org/" target=
                    906:               "_top">Linux</a></p>
                    907:             </li>
                    908: 
                    909:             <li>
                    910:               <p><a href="http://www.NetBSD.org/" target=
                    911:               "_top">NetBSD</a> (of course)</p>
                    912:             </li>
                    913: 
                    914:             <li>
                    915:               <p><a href="http://www.openbsd.org/" target=
                    916:               "_top">OpenBSD</a></p>
                    917:             </li>
                    918: 
                    919:             <li>
                    920:               <p><a href="http://www.sun.com/solaris/" target=
                    921:               "_top">Solaris</a></p>
                    922:             </li>
                    923:           </ul>
                    924:         </div>
                    925:       </div>
                    926: 
                    927:       <div class="sect1" lang="en" xml:lang="en">
                    928:         <div class="titlepage">
                    929:           <div>
                    930:             <div>
                    931:               <h2 class="title" style="clear: both"><a name=
                    932:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
                    933:             </div>
                    934:           </div>
                    935:         </div>
                    936: 
                    937:         <p>This document is divided into two parts. The first,
                    938:         <a href="#users-guide" title=
1.2       hubertf   939:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
                    940:         user's guide</a>, describes how one can use one of the
                    941:         packages in the Package Collection, either by installing a
                    942:         precompiled binary package, or by building one's own copy
                    943:         using the NetBSD package system. The second part, <a href=
1.1       grant     944:         "#developers-guide" title=
1.2       hubertf   945:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                    946:         pkgsrc developer's guide</a>, explains how to prepare a
                    947:         package so it can be easily built by other NetBSD users
                    948:         without knowing about the package's building details.</p>
1.1       grant     949: 
                    950:         <p>This document is available in various formats:</p>
                    951: 
                    952:         <div class="itemizedlist">
                    953:           <ul type="disc">
                    954:             <li>
                    955:               <p><a href="index.html" target="_top">HTML</a></p>
                    956:             </li>
                    957: 
                    958:             <li>
                    959:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                    960:             </li>
                    961: 
                    962:             <li>
                    963:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                    964:             </li>
                    965: 
                    966:             <li>
                    967:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                    968:             </li>
                    969:           </ul>
                    970:         </div>
                    971:       </div>
                    972: 
                    973:       <div class="sect1" lang="en" xml:lang="en">
                    974:         <div class="titlepage">
                    975:           <div>
                    976:             <div>
                    977:               <h2 class="title" style="clear: both"><a name=
                    978:               "terminology" id=
                    979:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                    980:             </div>
                    981:           </div>
                    982:         </div>
                    983: 
                    984:         <p>There has been a lot of talk about &#8220;<span class=
                    985:         "quote">ports</span>&#8221;, &#8220;<span class=
                    986:         "quote">packages</span>&#8221;, etc. so far. Here is a
                    987:         description of all the terminology used within this
                    988:         document.</p>
                    989: 
                    990:         <div class="variablelist">
                    991:           <dl>
                    992:             <dt><span class="term">Package</span></dt>
                    993: 
                    994:             <dd>
                    995:               <p>A set of files and building instructions that
                    996:               describe what's necessary to build a certain piece of
                    997:               software using pkgsrc. Packages are traditionally
1.14    ! xtraeme   998:               stored under <code class=
        !           999:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1000:             </dd>
                   1001: 
                   1002:             <dt><span class="term">The NetBSD package
                   1003:             system</span></dt>
                   1004: 
                   1005:             <dd>
                   1006:               <p>This is the former name of &#8220;<span class=
                   1007:               "quote">pkgsrc</span>&#8221;. It is part of the
                   1008:               NetBSD operating system and can be bootstrap to run
                   1009:               on non-NetBSD operating systems as well. It handles
                   1010:               building (compiling), installing, and removing of
                   1011:               packages.</p>
                   1012:             </dd>
                   1013: 
                   1014:             <dt><span class="term">Distfile</span></dt>
                   1015: 
                   1016:             <dd>
                   1017:               <p>This term describes the file or files that are
                   1018:               provided by the author of the piece of software to
                   1019:               distribute his work. All the changes necessary to
                   1020:               build on NetBSD are reflected in the corresponding
                   1021:               package. Usually the distfile is in the form of a
                   1022:               compressed tar-archive, but other types are possible,
1.14    ! xtraeme  1023:               too. Distfiles are usually stored below <code class=
        !          1024:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1025:             </dd>
                   1026: 
                   1027:             <dt><span class="term">Port</span></dt>
                   1028: 
                   1029:             <dd>
                   1030:               <p>This is the term used by FreeBSD and OpenBSD
                   1031:               people for what we call a package. In NetBSD
                   1032:               terminology, &#8220;<span class=
                   1033:               "quote">port</span>&#8221; refers to a different
                   1034:               architecture.</p>
                   1035:             </dd>
                   1036: 
                   1037:             <dt><span class="term">Precompiled/binary
                   1038:             package</span></dt>
                   1039: 
                   1040:             <dd>
                   1041:               <p>A set of binaries built with pkgsrc from a
1.14    ! xtraeme  1042:               distfile and stuffed together in a single
        !          1043:               <code class="filename">.tgz</code> file so it can be
        !          1044:               installed on machines of the same machine
        !          1045:               architecture without the need to recompile. Packages
        !          1046:               are usually generated in <code class=
        !          1047:               "filename">/usr/pkgsrc/packages</code>; there is also
        !          1048:               an archive on <a href=
1.1       grant    1049:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1050:               "_top">ftp.NetBSD.org</a>.</p>
                   1051: 
                   1052:               <p>Sometimes, this is referred to by the term
                   1053:               &#8220;<span class="quote">package</span>&#8221; too,
                   1054:               especially in the context of precompiled
                   1055:               packages.</p>
                   1056:             </dd>
                   1057: 
                   1058:             <dt><span class="term">Program</span></dt>
                   1059: 
                   1060:             <dd>
                   1061:               <p>The piece of software to be installed which will
                   1062:               be constructed from all the files in the Distfile by
                   1063:               the actions defined in the corresponding package.</p>
                   1064:             </dd>
                   1065:           </dl>
                   1066:         </div>
                   1067:       </div>
                   1068: 
                   1069:       <div class="sect1" lang="en" xml:lang="en">
                   1070:         <div class="titlepage">
                   1071:           <div>
                   1072:             <div>
                   1073:               <h2 class="title" style="clear: both"><a name=
                   1074:               "typography" id=
                   1075:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1076:             </div>
                   1077:           </div>
                   1078:         </div>
                   1079: 
                   1080:         <p>When giving examples for commands, shell prompts are
                   1081:         used to show if the command should/can be issued as root,
                   1082:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14    ! xtraeme  1083:         privileges are sufficient. We use a <code class=
        !          1084:         "prompt">#</code> for root's shell prompt, and a
        !          1085:         <code class="prompt">$</code> for users' shell prompt,
        !          1086:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1087:       </div>
                   1088:     </div>
                   1089: 
                   1090:     <div class="part" lang="en" xml:lang="en">
                   1091:       <div class="titlepage">
                   1092:         <div>
                   1093:           <div>
                   1094:             <h1 class="title"><a name="users-guide" id=
1.2       hubertf  1095:             "users-guide"></a>The pkgsrc user's guide</h1>
1.1       grant    1096:           </div>
                   1097:         </div>
                   1098:       </div>
                   1099: 
                   1100:       <div class="toc">
                   1101:         <p><b>Table of Contents</b></p>
                   1102: 
                   1103:         <dl>
                   1104:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1105:           get pkgsrc</a></span></dt>
                   1106: 
                   1107:           <dd>
                   1108:             <dl>
1.14    ! xtraeme  1109:               <dt><span class="sect1"><a href="#id2514852">2.1. As
1.1       grant    1110:               tar file</a></span></dt>
                   1111: 
1.14    ! xtraeme  1112:               <dt><span class="sect1"><a href="#id2514868">2.2. Via
1.1       grant    1113:               SUP</a></span></dt>
                   1114: 
1.14    ! xtraeme  1115:               <dt><span class="sect1"><a href="#id2514968">2.3. Via
1.1       grant    1116:               CVS</a></span></dt>
                   1117:             </dl>
                   1118:           </dd>
                   1119: 
                   1120:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1121:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1122: 
                   1123:           <dd>
                   1124:             <dl>
1.14    ! xtraeme  1125:               <dt><span class="sect1"><a href="#id2515078">3.1.
1.1       grant    1126:               Bootstrapping pkgsrc</a></span></dt>
                   1127: 
1.14    ! xtraeme  1128:               <dt><span class="sect1"><a href="#id2515253">3.2.
1.1       grant    1129:               Platform specific notes</a></span></dt>
                   1130: 
                   1131:               <dd>
                   1132:                 <dl>
                   1133:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1134:                   "#id2515259">3.2.1. Darwin (Mac OS
1.1       grant    1135:                   X)</a></span></dt>
                   1136: 
                   1137:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1138:                   "#id2515558">3.2.2. FreeBSD</a></span></dt>
1.1       grant    1139: 
                   1140:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1141:                   "#id2515660">3.2.3. Interix</a></span></dt>
1.1       grant    1142: 
                   1143:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1144:                   "#id2515751">3.2.4. IRIX</a></span></dt>
1.1       grant    1145: 
                   1146:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1147:                   "#id2516278">3.2.5. OpenBSD</a></span></dt>
1.1       grant    1148: 
                   1149:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1150:                   "#id2516390">3.2.6. Solaris</a></span></dt>
1.1       grant    1151:                 </dl>
                   1152:               </dd>
                   1153:             </dl>
                   1154:           </dd>
                   1155: 
                   1156:           <dt><span class="chapter"><a href="#using">4. Using
                   1157:           pkgsrc</a></span></dt>
                   1158: 
                   1159:           <dd>
                   1160:             <dl>
                   1161:               <dt><span class="sect1"><a href=
                   1162:               "#getting-started">4.1. Working with binary
                   1163:               packages</a></span></dt>
                   1164: 
                   1165:               <dd>
                   1166:                 <dl>
                   1167:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1168:                   "#id2516526">4.1.1. Where to get binary
1.1       grant    1169:                   packages</a></span></dt>
                   1170: 
                   1171:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1172:                   "#id2516567">4.1.2. How to use binary
1.1       grant    1173:                   packages</a></span></dt>
                   1174: 
                   1175:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1176:                   "#id2516633">4.1.3. A word of
1.1       grant    1177:                   warning</a></span></dt>
                   1178:                 </dl>
                   1179:               </dd>
                   1180: 
1.14    ! xtraeme  1181:               <dt><span class="sect1"><a href="#id2516645">4.2.
1.1       grant    1182:               Building packages from source</a></span></dt>
                   1183: 
                   1184:               <dd>
                   1185:                 <dl>
                   1186:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1187:                   "#id2516723">4.2.1. Requirements</a></span></dt>
1.1       grant    1188: 
                   1189:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1190:                   "#id2516743">4.2.2. Fetching
1.1       grant    1191:                   distfiles</a></span></dt>
                   1192: 
                   1193:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1194:                   "#id2516864">4.2.3. How to build and
1.1       grant    1195:                   install</a></span></dt>
                   1196: 
                   1197:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1198:                   "#id2517180">4.2.4. Selecting the
1.1       grant    1199:                   compiler</a></span></dt>
                   1200:                 </dl>
                   1201:               </dd>
                   1202:             </dl>
                   1203:           </dd>
                   1204: 
                   1205:           <dt><span class="chapter"><a href="#binary">5. Creating
                   1206:           binary packages</a></span></dt>
                   1207: 
                   1208:           <dd>
                   1209:             <dl>
1.14    ! xtraeme  1210:               <dt><span class="sect1"><a href="#id2517335">5.1.
1.1       grant    1211:               Building a single binary package</a></span></dt>
                   1212: 
1.14    ! xtraeme  1213:               <dt><span class="sect1"><a href="#id2517822">5.2.
1.1       grant    1214:               Settings for creation of binary
                   1215:               packages</a></span></dt>
                   1216: 
                   1217:               <dt><span class="sect1"><a href="#bulkbuild">5.3.
                   1218:               Doing a bulk build of all packages</a></span></dt>
                   1219: 
                   1220:               <dd>
                   1221:                 <dl>
                   1222:                   <dt><span class="sect2"><a href=
                   1223:                   "#binary.configuration">5.3.1.
                   1224:                   Configuration</a></span></dt>
                   1225: 
                   1226:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1227:                   "#id2517962">5.3.2. Other environmental
1.1       grant    1228:                   considerations</a></span></dt>
                   1229: 
                   1230:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1231:                   "#id2518003">5.3.3. Operation</a></span></dt>
1.1       grant    1232: 
                   1233:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1234:                   "#id2583267">5.3.4. What it does</a></span></dt>
1.1       grant    1235: 
                   1236:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1237:                   "#id2583392">5.3.5. Disk space
1.1       grant    1238:                   requirements</a></span></dt>
                   1239: 
                   1240:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1241:                   "#id2583418">5.3.6. Setting up a sandbox for
1.1       grant    1242:                   chroot'ed builds</a></span></dt>
                   1243: 
                   1244:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1245:                   "#id2583811">5.3.7. Building a partial set of
1.1       grant    1246:                   packages</a></span></dt>
1.13      hubertf  1247: 
                   1248:                   <dt><span class="sect2"><a href=
                   1249:                   "#bulk-upload">5.3.8. Uploading results of a bulk
                   1250:                   build</a></span></dt>
1.1       grant    1251:                 </dl>
                   1252:               </dd>
                   1253: 
1.14    ! xtraeme  1254:               <dt><span class="sect1"><a href="#id2584227">5.4.
1.1       grant    1255:               Creating a multiple CD-ROM packages
                   1256:               collection</a></span></dt>
                   1257: 
                   1258:               <dd>
                   1259:                 <dl>
                   1260:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  1261:                   "#id2584310">5.4.1. Example of
1.1       grant    1262:                   cdpack</a></span></dt>
                   1263:                 </dl>
                   1264:               </dd>
                   1265:             </dl>
                   1266:           </dd>
                   1267: 
                   1268:           <dt><span class="chapter"><a href="#faq">6. Frequently
                   1269:           Asked Questions</a></span></dt>
                   1270: 
                   1271:           <dd>
                   1272:             <dl>
1.14    ! xtraeme  1273:               <dt><span class="sect1"><a href="#id2584502">6.1. Is
1.1       grant    1274:               there a mailing list for pkg-related
                   1275:               discussion?</a></span></dt>
                   1276: 
1.14    ! xtraeme  1277:               <dt><span class="sect1"><a href="#id2584600">6.2.
1.1       grant    1278:               Where's the pkgviews documentation?</a></span></dt>
                   1279: 
1.5       hubertf  1280:               <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    1281:               Utilities for package management
                   1282:               (pkgtools)</a></span></dt>
                   1283: 
1.14    ! xtraeme  1284:               <dt><span class="sect1"><a href="#id2584853">6.4. How
1.1       grant    1285:               to use pkgsrc as non-root</a></span></dt>
                   1286: 
1.14    ! xtraeme  1287:               <dt><span class="sect1"><a href="#id2584865">6.5. How
        !          1288:               to resume transferencies with pkgsrc?</a></span></dt>
        !          1289: 
        !          1290:               <dt><span class="sect1"><a href="#id2584903">6.6. How
1.1       grant    1291:               can I install/use XFree86 from
                   1292:               pkgsrc?</a></span></dt>
                   1293: 
1.14    ! xtraeme  1294:               <dt><span class="sect1"><a href="#id2584931">6.7. How
1.1       grant    1295:               can I install/use X.org from pkgsrc?</a></span></dt>
                   1296: 
1.14    ! xtraeme  1297:               <dt><span class="sect1"><a href="#id2584958">6.8. How
1.1       grant    1298:               to fetch files from behind a firewall</a></span></dt>
                   1299: 
1.14    ! xtraeme  1300:               <dt><span class="sect1"><a href="#id2584972">6.9. How
        !          1301:               do I tell <span><strong class="command">make
        !          1302:               fetch</strong></span> to do passive
1.1       grant    1303:               FTP?</a></span></dt>
                   1304: 
1.14    ! xtraeme  1305:               <dt><span class="sect1"><a href="#id2585024">6.10.
        !          1306:               How to fetch all distfiles at once</a></span></dt>
1.1       grant    1307: 
1.14    ! xtraeme  1308:               <dt><span class="sect1"><a href="#id2585163">6.11.
        !          1309:               What does &#8220;<span class="quote">Don't know how
        !          1310:               to make /usr/share/tmac/tmac.andoc</span>&#8221;
        !          1311:               mean?</a></span></dt>
1.13      hubertf  1312: 
1.14    ! xtraeme  1313:               <dt><span class="sect1"><a href="#id2585202">6.12.
        !          1314:               What does &#8220;<span class="quote">Could not find
        !          1315:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1316: 
1.14    ! xtraeme  1317:               <dt><span class="sect1"><a href="#id2585259">6.13.
1.1       grant    1318:               Using 'sudo' with pkgsrc</a></span></dt>
                   1319: 
1.14    ! xtraeme  1320:               <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    1321:               Configuration files handling and
                   1322:               placement</a></span></dt>
                   1323: 
                   1324:               <dt><span class="sect1"><a href=
1.14    ! xtraeme  1325:               "#audit-packages">6.15. Automated security
1.1       grant    1326:               checks</a></span></dt>
                   1327:             </dl>
                   1328:           </dd>
                   1329:         </dl>
                   1330:       </div>
                   1331: 
                   1332:       <div class="chapter" lang="en" xml:lang="en">
                   1333:         <div class="titlepage">
                   1334:           <div>
                   1335:             <div>
                   1336:               <h2 class="title"><a name="getting" id=
                   1337:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1338:               pkgsrc</h2>
                   1339:             </div>
                   1340:           </div>
                   1341:         </div>
                   1342: 
                   1343:         <div class="toc">
                   1344:           <p><b>Table of Contents</b></p>
                   1345: 
                   1346:           <dl>
1.14    ! xtraeme  1347:             <dt><span class="sect1"><a href="#id2514852">2.1. As
1.1       grant    1348:             tar file</a></span></dt>
                   1349: 
1.14    ! xtraeme  1350:             <dt><span class="sect1"><a href="#id2514868">2.2. Via
1.1       grant    1351:             SUP</a></span></dt>
                   1352: 
1.14    ! xtraeme  1353:             <dt><span class="sect1"><a href="#id2514968">2.3. Via
1.1       grant    1354:             CVS</a></span></dt>
                   1355:           </dl>
                   1356:         </div>
                   1357: 
                   1358:         <p>There are three ways to get pkgsrc. Either as a tar
                   1359:         file, via SUP, or via CVS. All three ways are described
                   1360:         here.</p>
                   1361: 
                   1362:         <div class="sect1" lang="en" xml:lang="en">
                   1363:           <div class="titlepage">
                   1364:             <div>
                   1365:               <div>
                   1366:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  1367:                 "id2514852" id="id2514852"></a>2.1.&nbsp;As tar
1.1       grant    1368:                 file</h2>
                   1369:               </div>
                   1370:             </div>
                   1371:           </div>
                   1372: 
                   1373:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1374:           file from <a href=
1.11      ben      1375:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.14    ! xtraeme  1376:           target="_top">ftp.NetBSD.org</a> and unpack it into
        !          1377:           <code class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1378:         </div>
                   1379: 
                   1380:         <div class="sect1" lang="en" xml:lang="en">
                   1381:           <div class="titlepage">
                   1382:             <div>
                   1383:               <div>
                   1384:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  1385:                 "id2514868" id="id2514868"></a>2.2.&nbsp;Via
1.1       grant    1386:                 SUP</h2>
                   1387:               </div>
                   1388:             </div>
                   1389:           </div>
                   1390: 
                   1391:           <p>As an alternative to the tar file, you can get pkgsrc
                   1392:           via the Software Update Protocol, SUP. To do so, make
                   1393:           sure your supfile has a line</p>
                   1394:           <pre class="programlisting">
                   1395: release=pkgsrc
                   1396: </pre>
                   1397: 
1.14    ! xtraeme  1398:           <p>in it, see the examples in <code class=
        !          1399:           "filename">/usr/share/examples/supfiles</code>, and that
        !          1400:           the <code class="filename">/usr/pkgsrc</code> directory
        !          1401:           exists. Then, simply run <span><strong class=
        !          1402:           "command">sup -v <em class=
        !          1403:           "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1404:         </div>
                   1405: 
                   1406:         <div class="sect1" lang="en" xml:lang="en">
                   1407:           <div class="titlepage">
                   1408:             <div>
                   1409:               <div>
                   1410:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  1411:                 "id2514968" id="id2514968"></a>2.3.&nbsp;Via
1.1       grant    1412:                 CVS</h2>
                   1413:               </div>
                   1414:             </div>
                   1415:           </div>
                   1416: 
                   1417:           <p>To get pkgsrc via CVS, make sure you have
                   1418:           &#8220;<span class="quote">cvs</span>&#8221; installed.
                   1419:           If not present on your system, it can be found as
                   1420:           precompiled binary on ftp.NetBSD.org. To do an initial
                   1421:           (full) checkout of pkgsrc, do the following steps:</p>
                   1422:           <pre class="screen">
1.14    ! xtraeme  1423: <code class="prompt">%</code> <strong class=
        !          1424: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
        !          1425: <code class="prompt">%</code> <strong class=
        !          1426: "userinput"><code>setenv CVS_RSH ssh</code></strong>
        !          1427: <code class="prompt">%</code> <strong class=
        !          1428: "userinput"><code>cd /usr</code></strong>
        !          1429: <code class="prompt">%</code> <strong class=
        !          1430: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
        !          1431: </pre>
        !          1432: 
        !          1433:           <p>This will create the <code class=
        !          1434:           "filename">pkgsrc</code> directory in your <code class=
        !          1435:           "filename">/usr</code>, and all the package source will
        !          1436:           be stored under <code class=
        !          1437:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
        !          1438:           initial checkout, make sure you have <code class=
        !          1439:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1440:           <pre class="screen">
1.14    ! xtraeme  1441: <code class="prompt">%</code> <strong class=
        !          1442: "userinput"><code>cd /usr/pkgsrc</code></strong>
        !          1443: <code class="prompt">%</code> <strong class=
        !          1444: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1445: </pre>
                   1446: 
                   1447:           <p>Please also note that it is possible to have multiple
                   1448:           copies of the pkgsrc hierarchy in use at any one time -
                   1449:           all work is done relatively within the pkgsrc tree.</p>
                   1450:         </div>
                   1451:       </div>
                   1452: 
                   1453:       <div class="chapter" lang="en" xml:lang="en">
                   1454:         <div class="titlepage">
                   1455:           <div>
                   1456:             <div>
                   1457:               <h2 class="title"><a name="platforms" id=
                   1458:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1459:               systems other than NetBSD</h2>
                   1460:             </div>
                   1461:           </div>
                   1462:         </div>
                   1463: 
                   1464:         <div class="toc">
                   1465:           <p><b>Table of Contents</b></p>
                   1466: 
                   1467:           <dl>
1.14    ! xtraeme  1468:             <dt><span class="sect1"><a href="#id2515078">3.1.
1.1       grant    1469:             Bootstrapping pkgsrc</a></span></dt>
                   1470: 
1.14    ! xtraeme  1471:             <dt><span class="sect1"><a href="#id2515253">3.2.
1.1       grant    1472:             Platform specific notes</a></span></dt>
                   1473: 
                   1474:             <dd>
                   1475:               <dl>
1.14    ! xtraeme  1476:                 <dt><span class="sect2"><a href="#id2515259">3.2.1.
1.1       grant    1477:                 Darwin (Mac OS X)</a></span></dt>
                   1478: 
1.14    ! xtraeme  1479:                 <dt><span class="sect2"><a href="#id2515558">3.2.2.
1.1       grant    1480:                 FreeBSD</a></span></dt>
                   1481: 
1.14    ! xtraeme  1482:                 <dt><span class="sect2"><a href="#id2515660">3.2.3.
1.1       grant    1483:                 Interix</a></span></dt>
                   1484: 
1.14    ! xtraeme  1485:                 <dt><span class="sect2"><a href="#id2515751">3.2.4.
1.1       grant    1486:                 IRIX</a></span></dt>
                   1487: 
1.14    ! xtraeme  1488:                 <dt><span class="sect2"><a href="#id2516278">3.2.5.
1.1       grant    1489:                 OpenBSD</a></span></dt>
                   1490: 
1.14    ! xtraeme  1491:                 <dt><span class="sect2"><a href="#id2516390">3.2.6.
1.1       grant    1492:                 Solaris</a></span></dt>
                   1493:               </dl>
                   1494:             </dd>
                   1495:           </dl>
                   1496:         </div>
                   1497: 
                   1498:         <div class="sect1" lang="en" xml:lang="en">
                   1499:           <div class="titlepage">
                   1500:             <div>
                   1501:               <div>
                   1502:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  1503:                 "id2515078" id=
        !          1504:                 "id2515078"></a>3.1.&nbsp;Bootstrapping pkgsrc</h2>
1.1       grant    1505:               </div>
                   1506:             </div>
                   1507:           </div>
                   1508: 
                   1509:           <p>For Operating Systems other than NetBSD, we provide a
                   1510:           bootstrap kit to build the required tools to use pkgsrc
                   1511:           on your platform. Besides support for native NetBSD,
                   1512:           pkgsrc and the bootstrap kit have support for the
                   1513:           following operating systems:</p>
                   1514: 
                   1515:           <div class="itemizedlist">
                   1516:             <ul type="disc">
                   1517:               <li>
                   1518:                 <p>Darwin (Mac OS X)</p>
                   1519:               </li>
                   1520: 
                   1521:               <li>
                   1522:                 <p>FreeBSD</p>
                   1523:               </li>
                   1524: 
                   1525:               <li>
                   1526:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1527:               </li>
                   1528: 
                   1529:               <li>
                   1530:                 <p>IRIX</p>
                   1531:               </li>
                   1532: 
                   1533:               <li>
                   1534:                 <p>Linux</p>
                   1535:               </li>
                   1536: 
                   1537:               <li>
                   1538:                 <p>OpenBSD</p>
                   1539:               </li>
                   1540: 
                   1541:               <li>
                   1542:                 <p>Solaris</p>
                   1543:               </li>
                   1544:             </ul>
                   1545:           </div>
                   1546: 
                   1547:           <p>Support for other platforms is under development.</p>
                   1548: 
                   1549:           <p>Installing the bootstrap kit should be as simple
                   1550:           as:</p>
                   1551:           <pre class="screen">
1.14    ! xtraeme  1552: <code class="prompt">#</code> <strong class=
        !          1553: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
        !          1554: <code class="prompt">#</code> <strong class=
        !          1555: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
        !          1556: <code class="prompt">#</code> <strong class=
        !          1557: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1558: </pre>
                   1559: 
                   1560:           <p>See <a href="#getting" title=
                   1561:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter 2,
                   1562:           <i>Where to get pkgsrc</i></a> for other ways to get
1.14    ! xtraeme  1563:           pkgsrc before bootstrapping. The given
        !          1564:           <span><strong class="command">bootstrap</strong></span>
        !          1565:           command will use the defaults of <code class=
        !          1566:           "filename">/usr/pkg</code> for the <span class=
        !          1567:           "emphasis"><em>prefix</em></span> where programs will be
        !          1568:           installed in, and <code class=
        !          1569:           "filename">/var/db/pkg</code> for the package database
1.1       grant    1570:           directory where pkgsrc will do it's internal bookkeeping.
                   1571:           However, these can also be set using command-line
                   1572:           parameters.</p>
                   1573: 
                   1574:           <p>Binary packages for the pkgsrc tools and an initial
                   1575:           set of packages is available for supported platforms. An
                   1576:           up-to-date list of these can be found on <a href=
                   1577:           "http://www.pkgsrc.org/" target=
                   1578:           "_top">www.pkgsrc.org</a>.</p>
                   1579:         </div>
                   1580: 
                   1581:         <div class="sect1" lang="en" xml:lang="en">
                   1582:           <div class="titlepage">
                   1583:             <div>
                   1584:               <div>
                   1585:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  1586:                 "id2515253" id="id2515253"></a>3.2.&nbsp;Platform
1.1       grant    1587:                 specific notes</h2>
                   1588:               </div>
                   1589:             </div>
                   1590:           </div>
                   1591: 
                   1592:           <p>Here are some platform-specific notes you should be
                   1593:           aware of.</p>
                   1594: 
                   1595:           <div class="sect2" lang="en" xml:lang="en">
                   1596:             <div class="titlepage">
                   1597:               <div>
                   1598:                 <div>
1.14    ! xtraeme  1599:                   <h3 class="title"><a name="id2515259" id=
        !          1600:                   "id2515259"></a>3.2.1.&nbsp;Darwin (Mac OS
1.1       grant    1601:                   X)</h3>
                   1602:                 </div>
                   1603:               </div>
                   1604:             </div>
                   1605: 
                   1606:             <p>Darwin 5.x and 6.x are supported. There are two
                   1607:             methods of using pkgsrc on Mac OS X, by using a
                   1608:             <a href="#platform.osx-image" title=
                   1609:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1610:             <a href="#platform.osx-ufs" title=
                   1611:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1612:             partition</a>.</p>
                   1613: 
                   1614:             <p>Before you start, you will need to download and
                   1615:             install the Mac OS X Developer Tools from Apple's
                   1616:             Developer Connection. See <a href=
                   1617:             "http://developer.apple.com/macosx/" target=
                   1618:             "_top">http://developer.apple.com/macosx/</a> for
                   1619:             details. Also, make sure you install X11 for Mac OS X
                   1620:             and the X11 SDK from <a href=
                   1621:             "http://www.apple.com/macosx/x11/download/" target=
                   1622:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1623:             you intend to build packages that use the X11 Window
                   1624:             System.</p>
                   1625: 
                   1626:             <p>If you already have a UFS partition, or have a spare
                   1627:             partition that you can format as UFS, it is recommended
                   1628:             to use that instead of the disk image. It'll be
                   1629:             somewhat faster and will mount automatically at boot
                   1630:             time, where you must manually mount a disk image.</p>
                   1631: 
                   1632:             <div class="note" style=
                   1633:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1634:               <h3 class="title">Note</h3>
                   1635: 
                   1636:               <p>You cannot use a HFS+ file system for pkgsrc,
                   1637:               because pkgsrc currently requires the filesystem to
                   1638:               be case-sensitive, and HFS+ is not.</p>
                   1639:             </div>
                   1640: 
                   1641:             <div class="sect3" lang="en" xml:lang="en">
                   1642:               <div class="titlepage">
                   1643:                 <div>
                   1644:                   <div>
                   1645:                     <h4 class="title"><a name="platform.osx-image"
                   1646:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
                   1647:                     a disk image</h4>
                   1648:                   </div>
                   1649:                 </div>
                   1650:               </div>
                   1651: 
                   1652:               <p>Create the disk image:</p>
                   1653:               <pre class="screen">
1.14    ! xtraeme  1654: <code class="prompt">#</code> <strong class=
        !          1655: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
        !          1656: <code class="prompt">#</code> <strong class=
        !          1657: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
        !          1658: <code class="prompt">#</code> <strong class=
        !          1659: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
        !          1660: <code class="prompt">#</code> <strong class=
        !          1661: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    1662: </pre>
                   1663: 
                   1664:               <p>That's it!</p>
                   1665:             </div>
                   1666: 
                   1667:             <div class="sect3" lang="en" xml:lang="en">
                   1668:               <div class="titlepage">
                   1669:                 <div>
                   1670:                   <div>
                   1671:                     <h4 class="title"><a name="platform.osx-ufs"
                   1672:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
                   1673:                     UFS partition</h4>
                   1674:                   </div>
                   1675:                 </div>
                   1676:               </div>
                   1677: 
1.14    ! xtraeme  1678:               <p>By default, <code class="filename">/usr</code>
        !          1679:               will be on your root file system, normally HFS+. It
        !          1680:               is possible to use the default <span class=
        !          1681:               "emphasis"><em>prefix</em></span> of <code class=
        !          1682:               "filename">/usr/pkg</code> by symlinking <code class=
        !          1683:               "filename">/usr/pkg</code> to a directory on a UFS
        !          1684:               file system. Obviously, another symlink is required
        !          1685:               if you want to place the package database directory
        !          1686:               outside the <span class=
        !          1687:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    1688:               <pre class="screen">
1.14    ! xtraeme  1689: <code class="prompt">#</code> <strong class=
        !          1690: "userinput"><code>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</code></strong>
1.1       grant    1691: </pre>
                   1692: 
                   1693:               <p>If you created your partitions at the time of
                   1694:               installing Mac OS X and formatted the target
                   1695:               partition as UFS, it should automatically mount on
1.14    ! xtraeme  1696:               <code class="filename">/Volumes/&lt;volume
        !          1697:               name&gt;</code> when the machine boots. If you are
1.1       grant    1698:               (re)formatting a partition as UFS, you need to ensure
                   1699:               that the partition map correctly reflects
                   1700:               &#8220;<span class="quote">Apple_UFS</span>&#8221;
                   1701:               and not &#8220;<span class=
                   1702:               "quote">Apple_HFS</span>&#8221;.</p>
                   1703: 
                   1704:               <p>The problem is that none of the disk tools will
                   1705:               let you touch a disk that is booted from. You can
                   1706:               unmount the partition, but even if you newfs it, the
                   1707:               partition type will be incorrect and the automounter
                   1708:               won't mount it. It can be mounted manually, but it
                   1709:               won't appear in Finder.</p>
                   1710: 
                   1711:               <p>You'll need to boot off of the OS X Installation
                   1712:               (User) CD. When the Installation program starts, go
                   1713:               up to the menu and select Disk Utility. Now, you will
                   1714:               be able to select the partition you want to be UFS,
                   1715:               and Format it Apple UFS. Quit the Disk Utility, quit
                   1716:               the installer which will reboot your machine. The new
                   1717:               UFS file system will appear in Finder.</p>
                   1718: 
                   1719:               <p>Be aware that the permissions on the new file
                   1720:               system will be writable by root only.</p>
                   1721: 
                   1722:               <p>This note is as of 10.2 (Jaguar) and applies to
                   1723:               earlier versions. Hopefully Apple will fix Disk
                   1724:               Utility in 10.3 (Panther).</p>
                   1725:             </div>
                   1726:           </div>
                   1727: 
                   1728:           <div class="sect2" lang="en" xml:lang="en">
                   1729:             <div class="titlepage">
                   1730:               <div>
                   1731:                 <div>
1.14    ! xtraeme  1732:                   <h3 class="title"><a name="id2515558" id=
        !          1733:                   "id2515558"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    1734:                 </div>
                   1735:               </div>
                   1736:             </div>
                   1737: 
                   1738:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   1739:             supported, other versions may work.</p>
                   1740: 
                   1741:             <p>Care should be taken so that the tools that this kit
                   1742:             installs do not conflict with the FreeBSD userland
                   1743:             tools. There are several steps:</p>
                   1744: 
                   1745:             <div class="orderedlist">
                   1746:               <ol type="1">
                   1747:                 <li>
                   1748:                   <p>FreeBSD stores its ports pkg database in
1.14    ! xtraeme  1749:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    1750:                   therefore recommended that you choose a different
1.14    ! xtraeme  1751:                   location (e.g. <code class=
        !          1752:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    1753:                   --pkgdbdir option to the bootstrap script.</p>
                   1754:                 </li>
                   1755: 
                   1756:                 <li>
                   1757:                   <p>If you do not intend to use the FreeBSD ports
                   1758:                   tools, it's probably a good idea to move them out
                   1759:                   of the way to avoid confusion, e.g.</p>
                   1760:                   <pre class="screen">
1.14    ! xtraeme  1761: <code class="prompt">#</code> <strong class=
        !          1762: "userinput"><code>cd /usr/sbin</code></strong>
        !          1763: <code class="prompt">#</code> <strong class=
        !          1764: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
        !          1765: <code class="prompt">#</code> <strong class=
        !          1766: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
        !          1767: <code class="prompt">#</code> <strong class=
        !          1768: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
        !          1769: <code class="prompt">#</code> <strong class=
        !          1770: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    1771: </pre>
                   1772:                 </li>
                   1773: 
                   1774:                 <li>
1.14    ! xtraeme  1775:                   <p>An example <code class=
        !          1776:                   "filename">/etc/mk.conf</code> file will be
        !          1777:                   placed in <code class=
        !          1778:                   "filename">/etc/mk.conf.example</code> file when
        !          1779:                   you use the bootstrap script.</p>
1.1       grant    1780:                 </li>
                   1781:               </ol>
                   1782:             </div>
                   1783:           </div>
                   1784: 
                   1785:           <div class="sect2" lang="en" xml:lang="en">
                   1786:             <div class="titlepage">
                   1787:               <div>
                   1788:                 <div>
1.14    ! xtraeme  1789:                   <h3 class="title"><a name="id2515660" id=
        !          1790:                   "id2515660"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    1791:                 </div>
                   1792:               </div>
                   1793:             </div>
                   1794: 
                   1795:             <p>Interix is a POSIX compatible subsystem for the
                   1796:             Windows NT kernel, providing a Unix-like environment
                   1797:             with a tighter kernel integration than available with
                   1798:             Cygwin. It is part of the Windows Services for Unix
                   1799:             package, available for free for any licensed copy of
                   1800:             Windows 2000, XP, or 2003. SFU can be downloaded from
                   1801:             <a href="http://www.microsoft.com/windows/sfu/" target=
                   1802:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   1803: 
                   1804:             <p>Services for Unix 3.5, current as of this writing,
                   1805:             has been tested. 3.0 or 3.1 may work, but are not
                   1806:             officially supported. (The main difference in 3.0/3.1
                   1807:             is lack of pthreads.)</p>
                   1808: 
                   1809:             <div class="sect3" lang="en" xml:lang="en">
                   1810:               <div class="titlepage">
                   1811:                 <div>
                   1812:                   <div>
                   1813:                     <h4 class="title"><a name=
                   1814:                     "platform.interix-sfu-install" id=
                   1815:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  1816:                     installing Interix/SFU</h4>
1.1       grant    1817:                   </div>
                   1818:                 </div>
                   1819:               </div>
                   1820: 
                   1821:               <p>At an absolute minimum, the following packages
                   1822:               must be installed from the Windows Services for Unix
                   1823:               3.5 distribution in order to use pkgsrc:</p>
                   1824: 
                   1825:               <div class="itemizedlist">
                   1826:                 <ul type="disc">
                   1827:                   <li>
                   1828:                     <p>Utilities -&gt; Base Utilities</p>
                   1829:                   </li>
                   1830: 
                   1831:                   <li>
                   1832:                     <p>Interix GNU Components -&gt; (all)</p>
                   1833:                   </li>
                   1834: 
                   1835:                   <li>
                   1836:                     <p>Remote Connectivity</p>
                   1837:                   </li>
                   1838: 
                   1839:                   <li>
                   1840:                     <p>Interix SDK</p>
                   1841:                   </li>
                   1842:                 </ul>
                   1843:               </div>
                   1844: 
                   1845:               <p>When using pkgsrc on Interix, DO NOT install the
                   1846:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   1847:               without shared module support, installed to
                   1848:               /usr/local, and will only cause confusion. Instead,
                   1849:               install Perl 5.8 from pkgsrc (or from a binary
                   1850:               package).</p>
                   1851: 
                   1852:               <p>The Remote Connectivity subcomponent "Windows
                   1853:               Remote Shell Service" does not need to be installed,
                   1854:               but Remote Connectivity itself should be installed in
                   1855:               order to have a working inetd.</p>
                   1856: 
                   1857:               <p>Finally, during installation you may be asked
                   1858:               whether to enable setuid behavior for Interix
                   1859:               programs, and whether to make pathnames default to
                   1860:               case-sensitive. Setuid should be enabled, and
                   1861:               case-sensitivity MUST be enabled. (Without
                   1862:               case-sensitivity, a large number of packages
                   1863:               including perl will not build.)</p>
                   1864:             </div>
                   1865: 
                   1866:             <div class="sect3" lang="en" xml:lang="en">
                   1867:               <div class="titlepage">
                   1868:                 <div>
                   1869:                   <div>
                   1870:                     <h4 class="title"><a name=
                   1871:                     "platform.interix-sfu-postinstall" id=
                   1872:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   1873:                     to do if Interix/SFU is already installed</h4>
                   1874:                   </div>
                   1875:                 </div>
                   1876:               </div>
                   1877: 
                   1878:               <p>If SFU is already installed and you wish to alter
                   1879:               these settings to work with pkgsrc, note the
                   1880:               following things.</p>
                   1881: 
                   1882:               <div class="itemizedlist">
                   1883:                 <ul type="disc">
                   1884:                   <li>
                   1885:                     <p>To uninstall UNIX Perl, use Add/Remove
                   1886:                     Programs, select Microsoft Windows Services for
                   1887:                     UNIX, then click Change. In the installer,
                   1888:                     choose Add or Remove, then uncheck
                   1889:                     Utilities-&gt;UNIX Perl.</p>
                   1890:                   </li>
                   1891: 
                   1892:                   <li>
                   1893:                     <p>To enable case-sensitivity for the
                   1894:                     filesystem, run REGEDIT.EXE, and change the
                   1895:                     following registry key:</p>
                   1896: 
                   1897:                     <p>
                   1898:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   1899:                     Manager\kernel</p>
                   1900: 
                   1901:                     <p>Set the DWORD value "obcaseinsensitive" to
                   1902:                     0; then reboot.</p>
                   1903:                   </li>
                   1904: 
                   1905:                   <li>
                   1906:                     <p>To enable setuid binaries (optional), run
                   1907:                     REGEDIT.EXE, and change the following registry
                   1908:                     key:</p>
                   1909: 
                   1910:                     <p>
                   1911:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   1912:                     for UNIX</p>
                   1913: 
                   1914:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   1915:                     to 1; then reboot.</p>
                   1916:                   </li>
                   1917:                 </ul>
                   1918:               </div>
                   1919:             </div>
                   1920: 
                   1921:             <div class="sect3" lang="en" xml:lang="en">
                   1922:               <div class="titlepage">
                   1923:                 <div>
                   1924:                   <div>
                   1925:                     <h4 class="title"><a name=
                   1926:                     "platform.interix-notes" id=
                   1927:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   1928:                     notes for using pkgsrc</h4>
                   1929:                   </div>
                   1930:                 </div>
                   1931:               </div>
                   1932: 
                   1933:               <p>The package imanager (either the pkgsrc "su" user,
                   1934:               or the user running "pkg_add") must be a member of
                   1935:               the local Administrators group. Such a user must also
                   1936:               be used to run the bootstrap. This is slightly
                   1937:               relaxed from the normal pkgsrc requirement of
                   1938:               "root".</p>
                   1939: 
                   1940:               <p>The package manager should use a umask of 002.
                   1941:               "make install" will automatically complain if this is
                   1942:               not the case. This ensures that directories written
                   1943:               in /var/db/pkg are Administrators-group
                   1944:               writeable.</p>
                   1945: 
                   1946:               <p>The popular Interix binary packages from
                   1947:               http://www.interopsystems.com/ use an older version
                   1948:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   1949:               used in conjunction with pkgsrc. If you choose to use
                   1950:               them at the same time as the pkgsrc packages, ensure
                   1951:               that you use the proper pkg_* tools for each type of
                   1952:               binary package.</p>
                   1953:             </div>
                   1954:           </div>
                   1955: 
                   1956:           <div class="sect2" lang="en" xml:lang="en">
                   1957:             <div class="titlepage">
                   1958:               <div>
                   1959:                 <div>
1.14    ! xtraeme  1960:                   <h3 class="title"><a name="id2515751" id=
        !          1961:                   "id2515751"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    1962:                 </div>
                   1963:               </div>
                   1964:             </div>
                   1965: 
                   1966:             <p>You will need a working C compiler, either gcc or
                   1967:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14    ! xtraeme  1968:             the <code class="varname">CC</code> environment
        !          1969:             variable according to your preference. If you do not
        !          1970:             have a license for the MIPSpro compiler suite, you can
1.1       grant    1971:             download a gcc tardist file from <a href=
                   1972:             "http://freeware.sgi.com/" target=
                   1973:             "_top">http://freeware.sgi.com/</a>.</p>
                   1974: 
                   1975:             <p>Please note that you will need IRIX 6.5.17 or
                   1976:             higher, as this is the earliest version of IRIX
                   1977:             providing support for if_indextoname(3),
                   1978:             if_nametoindex(3), etc.</p>
                   1979: 
                   1980:             <p>At this point in time, pkgsrc only supports one ABI.
                   1981:             That is, you can not switch between the old 32-bit ABI,
                   1982:             the new 32-bit ABI and the 64-bit ABI. If you start out
                   1983:             using "abi=n32", that's what all your packages will be
                   1984:             built with.</p>
                   1985: 
                   1986:             <p>Therefore, please make sure that you have no
1.14    ! xtraeme  1987:             conflicting <code class="varname">CFLAGS</code> in your
        !          1988:             environment or the <code class=
        !          1989:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    1990:             that you do not try to link n32 object files with lib64
1.14    ! xtraeme  1991:             or vice versa. Check your <code class=
        !          1992:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    1993: 
                   1994:             <p>If you have the actual pkgsrc tree mounted via NFS
                   1995:             from a different host, please make sure to set
1.14    ! xtraeme  1996:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    1997:             directory, as it appears that IRIX linker occasionally
                   1998:             runs into issues when trying to link over a network
                   1999:             mounted filesystem.</p>
                   2000: 
                   2001:             <p>The bootstrapping process should set all the right
                   2002:             options for programs such as imake(1), but you may want
                   2003:             to set some options depending on your local setup.
1.14    ! xtraeme  2004:             Please see <code class=
        !          2005:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.1       grant    2006:             course, your compilers man pages for details.</p>
                   2007:           </div>
                   2008: 
                   2009:           <div class="sect2" lang="en" xml:lang="en">
                   2010:             <div class="titlepage">
                   2011:               <div>
                   2012:                 <div>
1.14    ! xtraeme  2013:                   <h3 class="title"><a name="id2516278" id=
        !          2014:                   "id2516278"></a>3.2.5.&nbsp;OpenBSD</h3>
1.1       grant    2015:                 </div>
                   2016:               </div>
                   2017:             </div>
                   2018: 
                   2019:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2020: 
                   2021:             <p>Care should be taken so that the tools that this kit
                   2022:             installs do not conflict with the OpenBSD userland
                   2023:             tools. There are several steps:</p>
                   2024: 
                   2025:             <div class="orderedlist">
                   2026:               <ol type="1">
                   2027:                 <li>
                   2028:                   <p>OpenBSD stores its ports pkg database in
1.14    ! xtraeme  2029:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    2030:                   therefore recommended that you choose a different
1.14    ! xtraeme  2031:                   location (e.g. <code class=
        !          2032:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2033:                   --pkgdbdir option to the bootstrap script.</p>
                   2034:                 </li>
                   2035: 
                   2036:                 <li>
                   2037:                   <p>If you do not intend to use the OpenBSD ports
                   2038:                   tools, it's probably a good idea to move them out
                   2039:                   of the way to avoid confusion, e.g.</p>
                   2040:                   <pre class="screen">
1.14    ! xtraeme  2041: <code class="prompt">#</code> <strong class=
        !          2042: "userinput"><code>cd /usr/sbin</code></strong>
        !          2043: <code class="prompt">#</code> <strong class=
        !          2044: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
        !          2045: <code class="prompt">#</code> <strong class=
        !          2046: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
        !          2047: <code class="prompt">#</code> <strong class=
        !          2048: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
        !          2049: <code class="prompt">#</code> <strong class=
        !          2050: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2051: </pre>
                   2052:                 </li>
                   2053: 
                   2054:                 <li>
1.14    ! xtraeme  2055:                   <p>An example <code class=
        !          2056:                   "filename">/etc/mk.conf</code> file will be
        !          2057:                   placed in <code class=
        !          2058:                   "filename">/etc/mk.conf.example</code> file when
        !          2059:                   you use the bootstrap script. OpenBSD's make
        !          2060:                   program uses <code class=
        !          2061:                   "filename">/etc/mk.conf</code> as well. You can
1.1       grant    2062:                   work around this by enclosing all the pkgsrc
                   2063:                   specific parts of the file with:</p>
                   2064:                   <pre class="programlisting">
                   2065: .ifdef BSD_PKG_MK
1.11      ben      2066: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1       grant    2067: .else
                   2068: # OpenBSD stuff
                   2069: .endif
                   2070: </pre>
                   2071:                 </li>
                   2072:               </ol>
                   2073:             </div>
                   2074:           </div>
                   2075: 
                   2076:           <div class="sect2" lang="en" xml:lang="en">
                   2077:             <div class="titlepage">
                   2078:               <div>
                   2079:                 <div>
1.14    ! xtraeme  2080:                   <h3 class="title"><a name="id2516390" id=
        !          2081:                   "id2516390"></a>3.2.6.&nbsp;Solaris</h3>
1.1       grant    2082:                 </div>
                   2083:               </div>
                   2084:             </div>
                   2085: 
                   2086:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2087:             sparc. You will need a working C compiler. Both gcc
                   2088:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2089: 
                   2090:             <p>The following packages are required on Solaris 8 for
                   2091:             the bootstrap process and to build packages.</p>
                   2092: 
                   2093:             <div class="itemizedlist">
                   2094:               <ul type="disc">
                   2095:                 <li>
                   2096:                   <p>SUNWsprot</p>
                   2097:                 </li>
                   2098: 
                   2099:                 <li>
                   2100:                   <p>SUNWarc</p>
                   2101:                 </li>
                   2102: 
                   2103:                 <li>
                   2104:                   <p>SUNWbtool</p>
                   2105:                 </li>
                   2106: 
                   2107:                 <li>
                   2108:                   <p>SUNWtoo</p>
                   2109:                 </li>
                   2110: 
                   2111:                 <li>
                   2112:                   <p>SUNWlibm</p>
                   2113:                 </li>
                   2114:               </ul>
                   2115:             </div>
                   2116: 
                   2117:             <p>Please note the use of GNU binutils on Solaris is
                   2118:             <span class="emphasis"><em>not</em></span>
                   2119:             supported.</p>
                   2120: 
                   2121:             <div class="sect3" lang="en" xml:lang="en">
                   2122:               <div class="titlepage">
                   2123:                 <div>
                   2124:                   <div>
1.14    ! xtraeme  2125:                     <h4 class="title"><a name="id2516421" id=
        !          2126:                     "id2516421"></a>3.2.6.1.&nbsp;If you are using
1.1       grant    2127:                     gcc</h4>
                   2128:                   </div>
                   2129:                 </div>
                   2130:               </div>
                   2131: 
                   2132:               <p>It makes life much simpler if you only use the
                   2133:               same gcc consistently for building all packages.</p>
                   2134: 
                   2135:               <p>It is recommended that an external gcc be used
                   2136:               only for bootstrapping, then either build gcc from
                   2137:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2138:               href=
                   2139:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.14    ! xtraeme  2140:               class="pkgname">lang/gcc</a> or install a binary gcc
        !          2141:               package, then remove gcc used during
        !          2142:               bootstrapping.</p>
1.1       grant    2143: 
                   2144:               <p>Binary packages of gcc can be found through
                   2145:               <a href=
                   2146:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.14    ! xtraeme  2147:               target=
        !          2148:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2149:             </div>
                   2150: 
                   2151:             <div class="sect3" lang="en" xml:lang="en">
                   2152:               <div class="titlepage">
                   2153:                 <div>
                   2154:                   <div>
1.14    ! xtraeme  2155:                     <h4 class="title"><a name="id2516442" id=
        !          2156:                     "id2516442"></a>3.2.6.2.&nbsp;If you are using
1.1       grant    2157:                     Sun WorkShop</h4>
                   2158:                   </div>
                   2159:                 </div>
                   2160:               </div>
                   2161: 
                   2162:               <p>You will need at least the following packages
                   2163:               installed (from WorkShop 5.0)</p>
                   2164: 
                   2165:               <div class="itemizedlist">
                   2166:                 <ul type="disc">
                   2167:                   <li>
                   2168:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2169:                   </li>
                   2170: 
                   2171:                   <li>
                   2172:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2173:                   </li>
                   2174: 
                   2175:                   <li>
                   2176:                     <p>SPROild - Sun WorkShop Incremental
                   2177:                     Linker</p>
                   2178:                   </li>
                   2179: 
                   2180:                   <li>
                   2181:                     <p>SPROlang - Sun WorkShop Compilers common
                   2182:                     components</p>
                   2183:                   </li>
                   2184:                 </ul>
                   2185:               </div>
                   2186: 
1.14    ! xtraeme  2187:               <p>You should set <code class="varname">CC</code>,
        !          2188:               <code class="varname">CXX</code> and optionally,
        !          2189:               <code class="varname">CPP</code> in <code class=
        !          2190:               "filename">/etc/mk.conf</code>, eg.</p>
1.1       grant    2191:               <pre class="programlisting">
                   2192: CC=        cc
                   2193: CXX=    CC
                   2194: CPP=    /usr/ccs/lib/cpp
                   2195: </pre>
                   2196: 
                   2197:               <p>You may also want to build 64-bit binaries,
                   2198:               eg.</p>
                   2199:               <pre class="programlisting">
                   2200: CFLAGS= -xtarget=ultra -xarch=v9
                   2201: </pre>
                   2202: 
                   2203:               <p>Whichever compiler you use, please ensure the
                   2204:               compiler tools and your $prefix are in your
1.14    ! xtraeme  2205:               <code class="varname">PATH</code>. This includes
        !          2206:               <code class="filename">/usr/ccs/{bin,lib}</code> and
        !          2207:               eg. <code class=
        !          2208:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2209:             </div>
                   2210:           </div>
                   2211:         </div>
                   2212:       </div>
                   2213: 
                   2214:       <div class="chapter" lang="en" xml:lang="en">
                   2215:         <div class="titlepage">
                   2216:           <div>
                   2217:             <div>
                   2218:               <h2 class="title"><a name="using" id=
                   2219:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2220:             </div>
                   2221:           </div>
                   2222:         </div>
                   2223: 
                   2224:         <div class="toc">
                   2225:           <p><b>Table of Contents</b></p>
                   2226: 
                   2227:           <dl>
                   2228:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2229:             Working with binary packages</a></span></dt>
                   2230: 
                   2231:             <dd>
                   2232:               <dl>
1.14    ! xtraeme  2233:                 <dt><span class="sect2"><a href="#id2516526">4.1.1.
1.1       grant    2234:                 Where to get binary packages</a></span></dt>
                   2235: 
1.14    ! xtraeme  2236:                 <dt><span class="sect2"><a href="#id2516567">4.1.2.
1.1       grant    2237:                 How to use binary packages</a></span></dt>
                   2238: 
1.14    ! xtraeme  2239:                 <dt><span class="sect2"><a href="#id2516633">4.1.3.
1.1       grant    2240:                 A word of warning</a></span></dt>
                   2241:               </dl>
                   2242:             </dd>
                   2243: 
1.14    ! xtraeme  2244:             <dt><span class="sect1"><a href="#id2516645">4.2.
1.1       grant    2245:             Building packages from source</a></span></dt>
                   2246: 
                   2247:             <dd>
                   2248:               <dl>
1.14    ! xtraeme  2249:                 <dt><span class="sect2"><a href="#id2516723">4.2.1.
1.1       grant    2250:                 Requirements</a></span></dt>
                   2251: 
1.14    ! xtraeme  2252:                 <dt><span class="sect2"><a href="#id2516743">4.2.2.
1.1       grant    2253:                 Fetching distfiles</a></span></dt>
                   2254: 
1.14    ! xtraeme  2255:                 <dt><span class="sect2"><a href="#id2516864">4.2.3.
1.1       grant    2256:                 How to build and install</a></span></dt>
                   2257: 
1.14    ! xtraeme  2258:                 <dt><span class="sect2"><a href="#id2517180">4.2.4.
1.1       grant    2259:                 Selecting the compiler</a></span></dt>
                   2260:               </dl>
                   2261:             </dd>
                   2262:           </dl>
                   2263:         </div>
                   2264: 
                   2265:         <div class="sect1" lang="en" xml:lang="en">
                   2266:           <div class="titlepage">
                   2267:             <div>
                   2268:               <div>
                   2269:                 <h2 class="title" style="clear: both"><a name=
                   2270:                 "getting-started" id=
                   2271:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2272:                 packages</h2>
                   2273:               </div>
                   2274:             </div>
                   2275:           </div>
                   2276: 
                   2277:           <p>This section describes how to find, retrieve and
                   2278:           install a precompiled binary package that someone else
                   2279:           already prepared for your type of machine.</p>
                   2280: 
                   2281:           <div class="sect2" lang="en" xml:lang="en">
                   2282:             <div class="titlepage">
                   2283:               <div>
                   2284:                 <div>
1.14    ! xtraeme  2285:                   <h3 class="title"><a name="id2516526" id=
        !          2286:                   "id2516526"></a>4.1.1.&nbsp;Where to get binary
1.1       grant    2287:                   packages</h3>
                   2288:                 </div>
                   2289:               </div>
                   2290:             </div>
                   2291: 
                   2292:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.14    ! xtraeme  2293:             and its mirrors in the directory <code class=
        !          2294:             "filename">/pub/NetBSD/packages</code> for anonymous
        !          2295:             FTP access. Please pick the right subdirectory there as
        !          2296:             indicated by <span><strong class="command">uname
        !          2297:             -p</strong></span>. In that directory, there is a
1.1       grant    2298:             subdirectory for each category plus a subdirectory
1.14    ! xtraeme  2299:             <code class="filename">All</code> which includes the
        !          2300:             actual binaries in <code class="filename">.tgz</code>
        !          2301:             files. The category subdirectories use symbolic links
        !          2302:             to those files (this is the same directory layout as in
        !          2303:             <code class=
        !          2304:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2305: 
                   2306:             <p>This same directory layout applies for CDROM
                   2307:             distributions, only that the directory may be rooted
1.14    ! xtraeme  2308:             somewhere else, probably somewhere below <code class=
        !          2309:             "filename">/cdrom</code>. Please consult your CDROMs
1.1       grant    2310:             documentation for the exact location.</p>
                   2311:           </div>
                   2312: 
                   2313:           <div class="sect2" lang="en" xml:lang="en">
                   2314:             <div class="titlepage">
                   2315:               <div>
                   2316:                 <div>
1.14    ! xtraeme  2317:                   <h3 class="title"><a name="id2516567" id=
        !          2318:                   "id2516567"></a>4.1.2.&nbsp;How to use binary
1.1       grant    2319:                   packages</h3>
                   2320:                 </div>
                   2321:               </div>
                   2322:             </div>
                   2323: 
                   2324:             <p>If you have the files on a CDROM or downloaded them
                   2325:             to your hard disk, youcan install them with the
1.14    ! xtraeme  2326:             following command (be sure to<span><strong class=
        !          2327:             "command">su</strong></span> to root first):</p>
1.1       grant    2328:             <pre class="screen">
1.14    ! xtraeme  2329: <code class="prompt">#</code> <strong class=
        !          2330: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    2331: </pre>
                   2332: 
                   2333:             <p>If you have FTP access and you don't want to
                   2334:             download the packages via FTP prior to installation,
1.14    ! xtraeme  2335:             you can do this automatically by giving
        !          2336:             <span><strong class="command">pkg_add</strong></span>
        !          2337:             an FTP URL:</p>
1.1       grant    2338:             <pre class="screen">
1.14    ! xtraeme  2339: <code class="prompt">#</code> <strong class=
        !          2340: "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    2341: </pre>
                   2342: 
                   2343:             <p>If there is any doubt, the uname utility can be used
                   2344:             to determine the &lt;OSvers&gt;, and &lt;arch&gt; by
1.14    ! xtraeme  2345:             running <span><strong class="command">uname
        !          2346:             -rp</strong></span>.</p>
1.1       grant    2347: 
                   2348:             <p>Also note that any prerequisite packages needed to
                   2349:             run the package in question will be installed, too,
                   2350:             assuming they are present where you install from.</p>
                   2351: 
                   2352:             <p>After you've installed packages, be sure to have
1.14    ! xtraeme  2353:             <code class="filename">/usr/pkg/bin</code> in your
        !          2354:             <code class="varname">PATH</code> so you can actually
        !          2355:             start the just installed program.</p>
1.1       grant    2356:           </div>
                   2357: 
                   2358:           <div class="sect2" lang="en" xml:lang="en">
                   2359:             <div class="titlepage">
                   2360:               <div>
                   2361:                 <div>
1.14    ! xtraeme  2362:                   <h3 class="title"><a name="id2516633" id=
        !          2363:                   "id2516633"></a>4.1.3.&nbsp;A word of
1.1       grant    2364:                   warning</h3>
                   2365:                 </div>
                   2366:               </div>
                   2367:             </div>
                   2368: 
                   2369:             <p>Please pay very careful attention to the warnings
                   2370:             expressed in the <a href=
                   2371:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2372:             <span class="citerefentry"><span class=
                   2373:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2374:             page about the inherent dangers of installing binary
                   2375:             packages which you did not create yourself, and the
                   2376:             security holes that can be introduced onto your system
                   2377:             by indiscriminate adding of such files.</p>
                   2378:           </div>
                   2379:         </div>
                   2380: 
                   2381:         <div class="sect1" lang="en" xml:lang="en">
                   2382:           <div class="titlepage">
                   2383:             <div>
                   2384:               <div>
                   2385:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  2386:                 "id2516645" id="id2516645"></a>4.2.&nbsp;Building
1.1       grant    2387:                 packages from source</h2>
                   2388:               </div>
                   2389:             </div>
                   2390:           </div>
                   2391: 
                   2392:           <p>This assumes that the package is already in pkgsrc. If
                   2393:           it is not, see <a href="#developers-guide" title=
1.2       hubertf  2394:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
                   2395:           &#8220;The pkgsrc developer's guide&#8221;</a>.</p>
1.1       grant    2396: 
                   2397:           <div class="sect2" lang="en" xml:lang="en">
                   2398:             <div class="titlepage">
                   2399:               <div>
                   2400:                 <div>
1.14    ! xtraeme  2401:                   <h3 class="title"><a name="id2516723" id=
        !          2402:                   "id2516723"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2403:                 </div>
                   2404:               </div>
                   2405:             </div>
                   2406: 
                   2407:             <p>To build packages from source on a NetBSD system the
                   2408:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2409:             &#8220;<span class="quote">text</span>&#8221;
                   2410:             distribution sets must be installed. If you want to
                   2411:             build X11 related packages the &#8220;<span class=
                   2412:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2413:             "quote">xcomp</span>&#8221; distribution sets are
                   2414:             required, too.</p>
                   2415:           </div>
                   2416: 
                   2417:           <div class="sect2" lang="en" xml:lang="en">
                   2418:             <div class="titlepage">
                   2419:               <div>
                   2420:                 <div>
1.14    ! xtraeme  2421:                   <h3 class="title"><a name="id2516743" id=
        !          2422:                   "id2516743"></a>4.2.2.&nbsp;Fetching
1.1       grant    2423:                   distfiles</h3>
                   2424:                 </div>
                   2425:               </div>
                   2426:             </div>
                   2427: 
                   2428:             <p>The distfile (i.e. the unmodified source) must exist
                   2429:             on your system for the packages system to be able to
                   2430:             build it. If it does not exist, pkgsrc will use
                   2431:             <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   2432:             <span class="citerefentry"><span class=
                   2433:             "refentrytitle">ftp</span>(1)</span></a> to fetch it
                   2434:             automatically.</p>
                   2435: 
                   2436:             <p>You can overwrite some of the major distribution
                   2437:             sites to fit to sites that are close to your own. Have
1.14    ! xtraeme  2438:             a look at <code class=
        !          2439:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
        !          2440:             some examples - in particular, look for the
        !          2441:             <code class="varname">MASTER_SORT</code>, <code class=
        !          2442:             "varname">MASTER_SORT_REGEX</code> and <code class=
        !          2443:             "varname">INET_COUNTRY</code> definitions. This may
        !          2444:             save some of your bandwidth and time.</p>
1.1       grant    2445: 
                   2446:             <p>You can change these settings either in your shell's
                   2447:             environment, or, if you want to keep the settings, by
1.14    ! xtraeme  2448:             editing the <code class="filename">/etc/mk.conf</code>
1.1       grant    2449:             file, and adding the definitions there.</p>
                   2450: 
                   2451:             <p>If you don't have a permanent Internet connection
                   2452:             and you want to know which files to download,
1.14    ! xtraeme  2453:             <span><strong class="command">make
        !          2454:             fetch-list</strong></span> will tell you what you'll
        !          2455:             need. Put these distfiles into <code class=
        !          2456:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    2457:           </div>
                   2458: 
                   2459:           <div class="sect2" lang="en" xml:lang="en">
                   2460:             <div class="titlepage">
                   2461:               <div>
                   2462:                 <div>
1.14    ! xtraeme  2463:                   <h3 class="title"><a name="id2516864" id=
        !          2464:                   "id2516864"></a>4.2.3.&nbsp;How to build and
1.1       grant    2465:                   install</h3>
                   2466:                 </div>
                   2467:               </div>
                   2468:             </div>
                   2469: 
                   2470:             <p>Assuming that the distfile has been fetched (see
                   2471:             previous section), become root and change into the
1.14    ! xtraeme  2472:             relevant directory and running <span><strong class=
        !          2473:             "command">make</strong></span>. For example, type</p>
1.1       grant    2474:             <pre class="screen">
1.14    ! xtraeme  2475: <code class="prompt">%</code> <strong class=
        !          2476: "userinput"><code>cd misc/figlet</code></strong>
        !          2477: <code class="prompt">%</code> <strong class=
        !          2478: "userinput"><code>make</code></strong>
1.1       grant    2479: </pre>
                   2480: 
                   2481:             <p>at the shell prompt to build the various components
                   2482:             of the package, and</p>
                   2483:             <pre class="screen">
1.14    ! xtraeme  2484: <code class="prompt">#</code> <strong class=
        !          2485: "userinput"><code>make install</code></strong>
1.1       grant    2486: </pre>
                   2487: 
                   2488:             <p>to install the various components into the correct
                   2489:             places on your system. Installing the package on your
                   2490:             system requires you to be root. However, pkgsrc has a
                   2491:             <span class="emphasis"><em>just-in-time-su</em></span>
                   2492:             feature, which allows you to only become root for the
                   2493:             actual installation step</p>
                   2494: 
                   2495:             <p>Taking the figlet utility as an example, we can
                   2496:             install it on our system by building as shown in
                   2497:             <a href="#logs" title=
                   2498:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
                   2499:             logs</i></a>.</p>
                   2500: 
                   2501:             <p>The program is installed under the default root of
1.14    ! xtraeme  2502:             the packages tree - <code class=
        !          2503:             "filename">/usr/pkg</code>. Should this not conform to
        !          2504:             your tastes, set the <code class=
        !          2505:             "varname">LOCALBASE</code> variable in your
1.1       grant    2506:             environment, and it will use that value as the root of
1.14    ! xtraeme  2507:             your packages tree. So, to use <code class=
        !          2508:             "filename">/usr/local</code>, set <code class=
        !          2509:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    2510:             environment. Please note that you should use a
                   2511:             directory which is dedicated to packages and not shared
1.14    ! xtraeme  2512:             with other programs (ie, do not try and use
        !          2513:             <code class="varname">LOCALBASE=/usr</code>). Also, you
        !          2514:             should not try to add any of your own files or
        !          2515:             directories (such as <code class=
        !          2516:             "filename">src/</code>, <code class=
        !          2517:             "filename">obj/</code>, or <code class=
        !          2518:             "filename">pkgsrc/</code>) below the <code class=
        !          2519:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    2520:             possible conflicts between programs and other files
                   2521:             installed by the package system and whatever else may
                   2522:             have been installed there.</p>
                   2523: 
1.14    ! xtraeme  2524:             <p>Some packages look in <code class=
        !          2525:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    2526:             configuration options at build time. Have a look at
1.14    ! xtraeme  2527:             <code class=
        !          2528:             "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
        !          2529:             overview of what will be set there by default.
        !          2530:             Environment variables such as <code class=
        !          2531:             "varname">LOCALBASE</code> can be set in <code class=
        !          2532:             "filename">/etc/mk.conf</code> to save having to
        !          2533:             remember to set them each time you want to use
        !          2534:             pkgsrc.</p>
1.1       grant    2535: 
                   2536:             <p>Occasionally, people want to &#8220;<span class=
                   2537:             "quote">look under the covers</span>&#8221; to see what
                   2538:             is going on when a package is building or being
                   2539:             installed. This may be for debugging purposes, or out
                   2540:             of simple curiosity. A number of utility values have
                   2541:             been added to help with this.</p>
                   2542: 
                   2543:             <div class="orderedlist">
                   2544:               <ol type="1">
                   2545:                 <li>
                   2546:                   <p>If you invoke the <a href=
                   2547:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2548:                   <span class="citerefentry"><span class=
                   2549:                   "refentrytitle">make</span>(1)</span></a> command
1.14    ! xtraeme  2550:                   with <code class=
        !          2551:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
        !          2552:                   amount of information will be displayed. For
        !          2553:                   example,</p>
1.1       grant    2554:                   <pre class="screen">
1.14    ! xtraeme  2555: <strong class=
        !          2556: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    2557: </pre>
                   2558: 
                   2559:                   <p>will show all the commands that are invoked,
                   2560:                   up to and including the &#8220;<span class=
                   2561:                   "quote">patch</span>&#8221; stage.</p>
                   2562:                 </li>
                   2563: 
                   2564:                 <li>
                   2565:                   <p>If you want to know the value of a certain
1.14    ! xtraeme  2566:                   make(1) definition, then the <code class=
        !          2567:                   "varname">VARNAME</code> definition should be
        !          2568:                   used, in conjunction with the show-var target.
        !          2569:                   e.g. to show the expansion of the <a href=
1.1       grant    2570:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2571:                   <span class="citerefentry"><span class=
                   2572:                   "refentrytitle">make</span>(1)</span></a>
1.14    ! xtraeme  2573:                   variable <code class=
        !          2574:                   "varname">DISTFILES</code>:</p>
1.1       grant    2575:                   <pre class="screen">
1.14    ! xtraeme  2576: <code class="prompt">%</code> <strong class=
        !          2577: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    2578: /usr/pkg
1.14    ! xtraeme  2579: <code class="prompt">%</code>
1.1       grant    2580:           
                   2581: </pre>
                   2582:                 </li>
                   2583:               </ol>
                   2584:             </div>
                   2585: 
                   2586:             <p>If you want to install a binary package that you've
                   2587:             either created yourself (see next section), that you
                   2588:             put into pkgsrc/packages manually or that is located on
1.8       wiz      2589:             a remote FTP server, you can use the "bin-install"
1.1       grant    2590:             target. This target will install a binary package - if
                   2591:             available - via <a href=
                   2592:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2593:             <span class="citerefentry"><span class=
                   2594:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14    ! xtraeme  2595:             <span><strong class="command">make
        !          2596:             package</strong></span>. The list of remote FTP sites
        !          2597:             searched is kept in the variable <code class=
        !          2598:             "varname">BINPKG_SITES</code>, which defaults to
        !          2599:             ftp.NetBSD.org. Any flags that should be added to
        !          2600:             <a href=
1.1       grant    2601:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2602:             <span class="citerefentry"><span class=
                   2603:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14    ! xtraeme  2604:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
        !          2605:             See <code class=
        !          2606:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
        !          2607:             details.</p>
1.1       grant    2608: 
                   2609:             <p>A final word of warning: If you setup a system that
1.14    ! xtraeme  2610:             has a non-standard setting for <code class=
        !          2611:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    2612:             any packages are installed, as you can not use several
                   2613:             directories for the same purpose. Doing so will result
                   2614:             in pkgsrc not being able to properly detect your
                   2615:             installed packages, and fail miserably. Note also that
                   2616:             precompiled binary packages are usually built with the
1.14    ! xtraeme  2617:             default <code class="varname">LOCALBASE</code> of
        !          2618:             <code class="filename">/usr/pkg</code>, and that you
        !          2619:             should <span class="emphasis"><em>not</em></span>
        !          2620:             install any if you use a non-standard <code class=
        !          2621:             "varname">LOCALBASE</code>.</p>
1.1       grant    2622:           </div>
                   2623: 
                   2624:           <div class="sect2" lang="en" xml:lang="en">
                   2625:             <div class="titlepage">
                   2626:               <div>
                   2627:                 <div>
1.14    ! xtraeme  2628:                   <h3 class="title"><a name="id2517180" id=
        !          2629:                   "id2517180"></a>4.2.4.&nbsp;Selecting the
1.1       grant    2630:                   compiler</h3>
                   2631:                 </div>
                   2632:               </div>
                   2633:             </div>
                   2634: 
                   2635:             <p>By default, pkgsrc will use GCC to build packages.
                   2636:             This may be overridden by setting the following
                   2637:             variables in /etc/mk.conf:</p>
                   2638: 
                   2639:             <div class="variablelist">
                   2640:               <dl>
1.14    ! xtraeme  2641:                 <dt><span class="term"><code class=
        !          2642:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    2643: 
                   2644:                 <dd>
                   2645:                   <p>This is a list of values specifying the chain
                   2646:                   of compilers to invoke when building packages.
                   2647:                   Valid values are:</p>
                   2648: 
                   2649:                   <div class="itemizedlist">
                   2650:                     <ul type="disc">
                   2651:                       <li>
1.14    ! xtraeme  2652:                         <p><code class="varname">distcc</code>:
1.1       grant    2653:                         distributed C/C++ (chainable)</p>
                   2654:                       </li>
                   2655: 
                   2656:                       <li>
1.14    ! xtraeme  2657:                         <p><code class="varname">ccache</code>:
1.1       grant    2658:                         compiler cache (chainable)</p>
                   2659:                       </li>
                   2660: 
                   2661:                       <li>
1.14    ! xtraeme  2662:                         <p><code class="varname">gcc</code>: GNU
        !          2663:                         C/C++ Compiler</p>
1.1       grant    2664:                       </li>
                   2665: 
                   2666:                       <li>
1.14    ! xtraeme  2667:                         <p><code class="varname">mipspro</code>:
1.1       grant    2668:                         Silicon Graphics, Inc. MIPSpro
                   2669:                         (n32/n64)</p>
                   2670:                       </li>
                   2671: 
                   2672:                       <li>
1.14    ! xtraeme  2673:                         <p><code class="varname">mipspro</code>:
1.1       grant    2674:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   2675:                       </li>
                   2676: 
                   2677:                       <li>
1.14    ! xtraeme  2678:                         <p><code class="varname">sunpro</code>:
1.1       grant    2679:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   2680:                         Studio</p>
                   2681:                       </li>
                   2682:                     </ul>
                   2683:                   </div>
                   2684: 
                   2685:                   <p>The default is &#8220;<span class=
1.14    ! xtraeme  2686:                   "quote"><code class=
        !          2687:                   "varname">gcc</code></span>&#8221;. You can use
        !          2688:                   <code class="varname">ccache</code> and/or
        !          2689:                   <code class="varname">distcc</code> with an
        !          2690:                   appropriate <code class=
        !          2691:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
        !          2692:                   &#8220;<span class="quote"><code class=
        !          2693:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    2694:                   variable should always be terminated with a value
                   2695:                   for a real compiler.</p>
                   2696:                 </dd>
                   2697: 
1.14    ! xtraeme  2698:                 <dt><span class="term"><code class=
        !          2699:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    2700: 
                   2701:                 <dd>
                   2702:                   <p>This specifies the minimum version of GCC to
                   2703:                   use when building packages. If the system GCC
                   2704:                   doesn't satisfy this requirement, then pkgsrc
                   2705:                   will build and install one of the GCC packages to
                   2706:                   use instead.</p>
                   2707:                 </dd>
                   2708:               </dl>
                   2709:             </div>
                   2710:           </div>
                   2711:         </div>
                   2712:       </div>
                   2713: 
                   2714:       <div class="chapter" lang="en" xml:lang="en">
                   2715:         <div class="titlepage">
                   2716:           <div>
                   2717:             <div>
                   2718:               <h2 class="title"><a name="binary" id=
                   2719:               "binary"></a>Chapter&nbsp;5.&nbsp;Creating binary
                   2720:               packages</h2>
                   2721:             </div>
                   2722:           </div>
                   2723:         </div>
                   2724: 
                   2725:         <div class="toc">
                   2726:           <p><b>Table of Contents</b></p>
                   2727: 
                   2728:           <dl>
1.14    ! xtraeme  2729:             <dt><span class="sect1"><a href="#id2517335">5.1.
1.1       grant    2730:             Building a single binary package</a></span></dt>
                   2731: 
1.14    ! xtraeme  2732:             <dt><span class="sect1"><a href="#id2517822">5.2.
1.1       grant    2733:             Settings for creation of binary
                   2734:             packages</a></span></dt>
                   2735: 
                   2736:             <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
                   2737:             a bulk build of all packages</a></span></dt>
                   2738: 
                   2739:             <dd>
                   2740:               <dl>
                   2741:                 <dt><span class="sect2"><a href=
                   2742:                 "#binary.configuration">5.3.1.
                   2743:                 Configuration</a></span></dt>
                   2744: 
1.14    ! xtraeme  2745:                 <dt><span class="sect2"><a href="#id2517962">5.3.2.
1.1       grant    2746:                 Other environmental considerations</a></span></dt>
                   2747: 
1.14    ! xtraeme  2748:                 <dt><span class="sect2"><a href="#id2518003">5.3.3.
1.1       grant    2749:                 Operation</a></span></dt>
                   2750: 
1.14    ! xtraeme  2751:                 <dt><span class="sect2"><a href="#id2583267">5.3.4.
1.1       grant    2752:                 What it does</a></span></dt>
                   2753: 
1.14    ! xtraeme  2754:                 <dt><span class="sect2"><a href="#id2583392">5.3.5.
1.1       grant    2755:                 Disk space requirements</a></span></dt>
                   2756: 
1.14    ! xtraeme  2757:                 <dt><span class="sect2"><a href="#id2583418">5.3.6.
1.1       grant    2758:                 Setting up a sandbox for chroot'ed
                   2759:                 builds</a></span></dt>
                   2760: 
1.14    ! xtraeme  2761:                 <dt><span class="sect2"><a href="#id2583811">5.3.7.
1.1       grant    2762:                 Building a partial set of packages</a></span></dt>
1.13      hubertf  2763: 
                   2764:                 <dt><span class="sect2"><a href=
                   2765:                 "#bulk-upload">5.3.8. Uploading results of a bulk
                   2766:                 build</a></span></dt>
1.1       grant    2767:               </dl>
                   2768:             </dd>
                   2769: 
1.14    ! xtraeme  2770:             <dt><span class="sect1"><a href="#id2584227">5.4.
1.1       grant    2771:             Creating a multiple CD-ROM packages
                   2772:             collection</a></span></dt>
                   2773: 
                   2774:             <dd>
                   2775:               <dl>
1.14    ! xtraeme  2776:                 <dt><span class="sect2"><a href="#id2584310">5.4.1.
1.1       grant    2777:                 Example of cdpack</a></span></dt>
                   2778:               </dl>
                   2779:             </dd>
                   2780:           </dl>
                   2781:         </div>
                   2782: 
                   2783:         <div class="sect1" lang="en" xml:lang="en">
                   2784:           <div class="titlepage">
                   2785:             <div>
                   2786:               <div>
                   2787:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  2788:                 "id2517335" id="id2517335"></a>5.1.&nbsp;Building a
1.1       grant    2789:                 single binary package</h2>
                   2790:               </div>
                   2791:             </div>
                   2792:           </div>
                   2793: 
                   2794:           <p>Once you have built and installed a package, you can
                   2795:           create a <span class="emphasis"><em>binary
                   2796:           package</em></span> which can be installed on another
                   2797:           system with <a href=
                   2798:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2799:           <span class="citerefentry"><span class=
                   2800:           "refentrytitle">pkg_add</span>(1)</span></a> This saves
                   2801:           having to build the same package on a group of hosts and
                   2802:           wasting CPU time. It also provides a simple means for
                   2803:           others to install your package, should you distribute
                   2804:           it.</p>
                   2805: 
                   2806:           <p>To create a binary package, change into the
1.14    ! xtraeme  2807:           appropriate directory in pkgsrc, and run
        !          2808:           <span><strong class="command">make
        !          2809:           package</strong></span>:</p>
1.1       grant    2810:           <pre class="screen">
1.14    ! xtraeme  2811: <code class="prompt">#</code> <strong class=
        !          2812: "userinput"><code>cd misc/figlet</code></strong>
        !          2813: <code class="prompt">#</code> <strong class=
        !          2814: "userinput"><code>make package</code></strong>
1.1       grant    2815: </pre>
                   2816: 
                   2817:           <p>This will build and install your package (if not
                   2818:           already done), and then build a binary package from what
1.14    ! xtraeme  2819:           was installed. You can then use the <span><strong class=
        !          2820:           "command">pkg_*</strong></span> tools to manipulate it.
        !          2821:           Binary packages are created by default in <code class=
        !          2822:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    2823:           gzipped tar file. See <a href="#logs.package" title=
                   2824:           "B.2.&nbsp;Packaging figlet">Section B.2,
                   2825:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   2826:           the above <a xmlns=
                   2827:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   2828:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.14    ! xtraeme  2829:           class="pkgname">misc/figlet</a> example.</p>
1.1       grant    2830: 
                   2831:           <p>See <a href="#submit" title=
                   2832:           "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter
                   2833:           14, <i>Submitting and Committing</i></a> for information
                   2834:           on how to submit such a binary package.</p>
                   2835:         </div>
                   2836: 
                   2837:         <div class="sect1" lang="en" xml:lang="en">
                   2838:           <div class="titlepage">
                   2839:             <div>
                   2840:               <div>
                   2841:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  2842:                 "id2517822" id="id2517822"></a>5.2.&nbsp;Settings
1.1       grant    2843:                 for creation of binary packages</h2>
                   2844:               </div>
                   2845:             </div>
                   2846:           </div>
                   2847: 
                   2848:           <p>See <a href="#build.helpful-targets" title=
                   2849:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   2850:           &#8220;Other helpful targets&#8221;</a>.</p>
                   2851:         </div>
                   2852: 
                   2853:         <div class="sect1" lang="en" xml:lang="en">
                   2854:           <div class="titlepage">
                   2855:             <div>
                   2856:               <div>
                   2857:                 <h2 class="title" style="clear: both"><a name=
                   2858:                 "bulkbuild" id="bulkbuild"></a>5.3.&nbsp;Doing a
                   2859:                 bulk build of all packages</h2>
                   2860:               </div>
                   2861:             </div>
                   2862:           </div>
                   2863: 
                   2864:           <p>If you want to get a full set of precompiled binary
                   2865:           packages, this section describes how to get them. Beware
                   2866:           that the bulk build will remove all currently installed
                   2867:           packages from your system! Having a FTP server configured
                   2868:           either on the machine doing the bulk builds or on a
                   2869:           nearby NFS server can help to make the packages available
                   2870:           to everyone. See <a href=
                   2871:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   2872:           <span class="citerefentry"><span class=
                   2873:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   2874:           information. If you use a remote NFS server's storage, be
                   2875:           sure to not actually compile on NFS storage, as this
                   2876:           slows things down a lot.</p>
                   2877: 
                   2878:           <div class="sect2" lang="en" xml:lang="en">
                   2879:             <div class="titlepage">
                   2880:               <div>
                   2881:                 <div>
                   2882:                   <h3 class="title"><a name="binary.configuration"
                   2883:                   id=
                   2884:                   "binary.configuration"></a>5.3.1.&nbsp;Configuration</h3>
                   2885:                 </div>
                   2886:               </div>
                   2887:             </div>
                   2888: 
                   2889:             <div class="sect3" lang="en" xml:lang="en">
                   2890:               <div class="titlepage">
                   2891:                 <div>
                   2892:                   <div>
                   2893:                     <h4 class="title"><a name="binary.mk.conf" id=
                   2894:                     "binary.mk.conf"></a>5.3.1.1.&nbsp;/etc/mk.conf</h4>
                   2895:                   </div>
                   2896:                 </div>
                   2897:               </div>
                   2898: 
1.14    ! xtraeme  2899:               <p>You may want to set things in <code class=
        !          2900:               "filename">/etc/mk.conf</code>. Look at <code class=
        !          2901:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    2902:               details of the default settings. You will want to
1.14    ! xtraeme  2903:               ensure that <code class=
        !          2904:               "varname">ACCEPTABLE_LICENSES</code> meet your local
        !          2905:               policy. As used in this example, <code class=
        !          2906:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    2907:               "emphasis"><em>all</em></span> licenses.</p>
                   2908:               <pre class="programlisting">
                   2909: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   2910: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   2911: BSDSRCDIR=      /usr/src
                   2912: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   2913: OBJHOSTNAME?=   yes               # use work.`hostname`
                   2914: FAILOVER_FETCH= yes               # insist on the correct checksum
                   2915: PKG_DEVELOPER?= yes
                   2916: _ACCEPTABLE=    yes
                   2917: </pre>
                   2918:             </div>
                   2919: 
                   2920:             <div class="sect3" lang="en" xml:lang="en">
                   2921:               <div class="titlepage">
                   2922:                 <div>
                   2923:                   <div>
1.14    ! xtraeme  2924:                     <h4 class="title"><a name="id2517886" id=
        !          2925:                     "id2517886"></a>5.3.1.2.&nbsp;<code class=
        !          2926:                     "filename">build.conf</code></h4>
1.1       grant    2927:                   </div>
                   2928:                 </div>
                   2929:               </div>
                   2930: 
1.14    ! xtraeme  2931:               <p>In <code class="filename">pkgsrc/mk/bulk</code>,
        !          2932:               copy <code class="filename">build.conf-example</code>
        !          2933:               to <code class="filename">build.conf</code> and edit
        !          2934:               it, following the comments in that file. This is the
1.1       grant    2935:               config file that determines where log files are
                   2936:               generated after the build, where to mail the build
                   2937:               report to, where your pkgsrc tree is located and
                   2938:               which user to <a href=
                   2939:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   2940:               <span class="citerefentry"><span class=
                   2941:               "refentrytitle">su</span>(8)</span></a> to to do a
1.14    ! xtraeme  2942:               <span><strong class="command">cvs
        !          2943:               update</strong></span>.</p>
1.1       grant    2944:             </div>
                   2945: 
                   2946:             <div class="sect3" lang="en" xml:lang="en">
                   2947:               <div class="titlepage">
                   2948:                 <div>
                   2949:                   <div>
1.14    ! xtraeme  2950:                     <h4 class="title"><a name="id2517923" id=
        !          2951:                     "id2517923"></a>5.3.1.3.&nbsp;<code class=
        !          2952:                     "filename">pre-build.local</code></h4>
1.1       grant    2953:                   </div>
                   2954:                 </div>
                   2955:               </div>
                   2956: 
                   2957:               <p>It is possible to configure the bulk build to
                   2958:               perform certain site specific tasks at the end of the
1.14    ! xtraeme  2959:               pre-build stage. If the file <code class=
        !          2960:               "filename">pre-build.local</code> exists in
        !          2961:               <code class="filename">/usr/pkgsrc/mk/bulk</code> it
        !          2962:               will be executed (as a sh(1) script) at the end of
        !          2963:               the usual pre-build stage. An example use of
        !          2964:               <code class="filename">pre-build.local</code> is to
        !          2965:               have the line:</p>
1.1       grant    2966:               <pre class="screen">
1.14    ! xtraeme  2967: <code class="prompt">#</code> <strong class=
        !          2968: "userinput"><code>echo "I do not have enough disk space to build this pig." \
        !          2969:     &gt; pkgsrc/games/crafty-book-enormous/$BROKENF</code></strong>
1.1       grant    2970: </pre>
                   2971: 
                   2972:               <p>to prevent the system from trying to build a
                   2973:               particular package which requires nearly 3 GB of disk
                   2974:               space.</p>
                   2975:             </div>
                   2976:           </div>
                   2977: 
                   2978:           <div class="sect2" lang="en" xml:lang="en">
                   2979:             <div class="titlepage">
                   2980:               <div>
                   2981:                 <div>
1.14    ! xtraeme  2982:                   <h3 class="title"><a name="id2517962" id=
        !          2983:                   "id2517962"></a>5.3.2.&nbsp;Other environmental
1.1       grant    2984:                   considerations</h3>
                   2985:                 </div>
                   2986:               </div>
                   2987:             </div>
                   2988: 
1.14    ! xtraeme  2989:             <p>As <code class="filename">/usr/pkg</code> will be
1.1       grant    2990:             completely deleted at the start of bulk builds, make
                   2991:             sure your login shell is placed somewhere else. Either
1.14    ! xtraeme  2992:             drop it into <code class=
        !          2993:             "filename">/usr/local/bin</code> (and adjust your login
        !          2994:             shell in the passwd file), or (re-)install it via
        !          2995:             <a href=
1.1       grant    2996:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2997:             <span class="citerefentry"><span class=
                   2998:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.14    ! xtraeme  2999:             <code class="filename">/etc/rc.local</code>, so you can
1.1       grant    3000:             login after a reboot (remember that your current
                   3001:             process won't die if the package is removed, you just
                   3002:             can't start any new instances of the shell any more).
                   3003:             Also, if you use NetBSD earlier than 1.5, or you still
                   3004:             want to use the pkgsrc version of ssh for some reason,
                   3005:             be sure to install ssh before starting it from
1.14    ! xtraeme  3006:             <code class="filename">rc.local</code>:</p>
1.1       grant    3007:             <pre class="programlisting">
                   3008: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   3009: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   3010:     /usr/pkg/etc/rc.d/sshd
                   3011: fi
                   3012: </pre>
                   3013: 
                   3014:             <p>Not doing so will result in you being not able to
                   3015:             log in via ssh after the bulk build is finished or if
                   3016:             the machine gets rebooted or crashes. You have been
                   3017:             warned! :)</p>
                   3018:           </div>
                   3019: 
                   3020:           <div class="sect2" lang="en" xml:lang="en">
                   3021:             <div class="titlepage">
                   3022:               <div>
                   3023:                 <div>
1.14    ! xtraeme  3024:                   <h3 class="title"><a name="id2518003" id=
        !          3025:                   "id2518003"></a>5.3.3.&nbsp;Operation</h3>
1.1       grant    3026:                 </div>
                   3027:               </div>
                   3028:             </div>
                   3029: 
                   3030:             <p>Make sure you don't need any of the packages still
                   3031:             installed.</p>
                   3032: 
                   3033:             <div class="warning" style=
                   3034:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3035:               <h3 class="title">Warning</h3>
                   3036: 
                   3037:               <p>During the bulk build, <span class=
                   3038:               "emphasis"><em>all packages will be
                   3039:               removed!</em></span></p>
                   3040:             </div>
                   3041: 
                   3042:             <p>Be sure to remove all other things that might
                   3043:             interfere with builds, like some libs installed in
1.14    ! xtraeme  3044:             <code class="filename">/usr/local</code>, etc. then
        !          3045:             become root and type:</p>
1.1       grant    3046:             <pre class="screen">
1.14    ! xtraeme  3047: <code class="prompt">#</code> <strong class=
        !          3048: "userinput"><code>cd /usr/pkgsrc</code></strong>
        !          3049: <code class="prompt">#</code> <strong class=
        !          3050: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    3051: </pre>
                   3052: 
                   3053:             <p>If for some reason your last build didn't complete
                   3054:             (power failure, system panic, ...), you can continue it
                   3055:             by running:</p>
                   3056:             <pre class="screen">
1.14    ! xtraeme  3057: <code class="prompt">#</code> <strong class=
        !          3058: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    3059: </pre>
                   3060: 
                   3061:             <p>At the end of the bulk build, you will get a summary
                   3062:             via mail, and find build logs in the directory
1.14    ! xtraeme  3063:             specified by <code class="varname">FTP</code> in the
        !          3064:             <code class="filename">build.conf</code> file.</p>
1.1       grant    3065:           </div>
                   3066: 
                   3067:           <div class="sect2" lang="en" xml:lang="en">
                   3068:             <div class="titlepage">
                   3069:               <div>
                   3070:                 <div>
1.14    ! xtraeme  3071:                   <h3 class="title"><a name="id2583267" id=
        !          3072:                   "id2583267"></a>5.3.4.&nbsp;What it does</h3>
1.1       grant    3073:                 </div>
                   3074:               </div>
                   3075:             </div>
                   3076: 
                   3077:             <p>The bulk builds consist of three steps:</p>
                   3078: 
                   3079:             <div class="variablelist">
                   3080:               <dl>
                   3081:                 <dt><span class="term">1. pre-build</span></dt>
                   3082: 
                   3083:                 <dd>
                   3084:                   <p>The script updates your pkgsrc tree via
                   3085:                   (anon)cvs, then cleans out any broken distfiles,
                   3086:                   and removes all packages installed.</p>
                   3087:                 </dd>
                   3088: 
                   3089:                 <dt><span class="term">2. the bulk
                   3090:                 build</span></dt>
                   3091: 
                   3092:                 <dd>
                   3093:                   <p>This is basically &#8220;<span class=
                   3094:                   "quote">make bulk-package</span>&#8221; with an
                   3095:                   optimised order in which packages will be built.
                   3096:                   Packages that don't require other packages will
                   3097:                   be built first, and packages with many
                   3098:                   dependencies will be built later.</p>
                   3099:                 </dd>
                   3100: 
                   3101:                 <dt><span class="term">3. post-build</span></dt>
                   3102: 
                   3103:                 <dd>
                   3104:                   <p>Generates a report that's placed in the
1.14    ! xtraeme  3105:                   directory specified in the <code class=
        !          3106:                   "filename">build.conf</code> file named
        !          3107:                   <code class="filename">broken.html</code>, a
        !          3108:                   short version of that report will also be mailed
        !          3109:                   to the build's admin.</p>
1.1       grant    3110:                 </dd>
                   3111:               </dl>
                   3112:             </div>
                   3113: 
                   3114:             <p>During the build, a list of broken packages will be
1.14    ! xtraeme  3115:             compiled in <code class=
        !          3116:             "filename">/usr/pkgsrc/.broken</code> (or <code class=
        !          3117:             "filename">.../.broken.${MACHINE}</code> if
        !          3118:             <code class="varname">OBJMACHINE</code> is set),
        !          3119:             individual build logs of broken builds can be found in
        !          3120:             the package's directory. These files are used by the
        !          3121:             bulk-targets to mark broken builds to not waste time
        !          3122:             trying to rebuild them, and they can be used to debug
        !          3123:             these broken package builds later.</p>
1.1       grant    3124:           </div>
                   3125: 
                   3126:           <div class="sect2" lang="en" xml:lang="en">
                   3127:             <div class="titlepage">
                   3128:               <div>
                   3129:                 <div>
1.14    ! xtraeme  3130:                   <h3 class="title"><a name="id2583392" id=
        !          3131:                   "id2583392"></a>5.3.5.&nbsp;Disk space
1.1       grant    3132:                   requirements</h3>
                   3133:                 </div>
                   3134:               </div>
                   3135:             </div>
                   3136: 
                   3137:             <p>Currently, roughly the following requirements are
                   3138:             valid for NetBSD 2.0/i386:</p>
                   3139: 
                   3140:             <div class="itemizedlist">
                   3141:               <ul type="disc">
                   3142:                 <li>
                   3143:                   <p>10 GB - distfiles (NFS ok)</p>
                   3144:                 </li>
                   3145: 
                   3146:                 <li>
                   3147:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   3148:                 </li>
                   3149: 
                   3150:                 <li>
                   3151:                   <p>5 GB - temp space for compiling (local disk
                   3152:                   recommended)</p>
                   3153:                 </li>
                   3154:               </ul>
                   3155:             </div>
                   3156: 
                   3157:             <p>Note that all pkgs will be de-installed as soon as
                   3158:             they are turned into a binary package, and that sources
                   3159:             are removed, so there is no excessively huge demand to
                   3160:             disk space. Afterwards, if the package is needed again,
                   3161:             it will be installed via <a href=
                   3162:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3163:             <span class="citerefentry"><span class=
                   3164:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   3165:             building again, so there are no cycles wasted by
                   3166:             recompiling.</p>
                   3167:           </div>
                   3168: 
                   3169:           <div class="sect2" lang="en" xml:lang="en">
                   3170:             <div class="titlepage">
                   3171:               <div>
                   3172:                 <div>
1.14    ! xtraeme  3173:                   <h3 class="title"><a name="id2583418" id=
        !          3174:                   "id2583418"></a>5.3.6.&nbsp;Setting up a sandbox
1.1       grant    3175:                   for chroot'ed builds</h3>
                   3176:                 </div>
                   3177:               </div>
                   3178:             </div>
                   3179: 
1.12      agc      3180:             <p>If you don't want all the packages nuked from a
                   3181:             machine (rendering it useless for anything but pkg
                   3182:             compiling), there is the possibility of doing the pkg
                   3183:             bulk build inside a chroot environment.</p>
                   3184: 
                   3185:             <p>The first step is to set up a chroot sandbox, e.g.
1.14    ! xtraeme  3186:             <code class="filename">/usr/sandbox</code>. This can be
1.12      agc      3187:             done by using null mounts, or manually.</p>
                   3188: 
1.14    ! xtraeme  3189:             <p>There is a shell script called <code class=
        !          3190:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
        !          3191:             set up the sandbox environment using null mounts. It
        !          3192:             will also create a script called <code class=
        !          3193:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      3194:             environment, which will allow the null mounts to be
1.14    ! xtraeme  3195:             activated using the <span><strong class=
        !          3196:             "command">sandbox mount</strong></span> command and
        !          3197:             deactivated using the <span><strong class=
        !          3198:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      3199: 
                   3200:             <p>To set up a sandbox environment by hand, after
                   3201:             extracting all the sets from a NetBSD installation or
1.14    ! xtraeme  3202:             doing a <span><strong class="command">make distribution
        !          3203:             DESTDIR=/usr/sandbox</strong></span> in <code class=
        !          3204:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      3205:             items are present and properly configured:</p>
1.1       grant    3206: 
                   3207:             <div class="procedure">
                   3208:               <ol type="1">
                   3209:                 <li>
                   3210:                   <p>Kernel</p>
                   3211:                   <pre class="screen">
1.14    ! xtraeme  3212: <code class="prompt">#</code> <strong class=
        !          3213: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    3214: </pre>
                   3215:                 </li>
                   3216: 
                   3217:                 <li>
1.14    ! xtraeme  3218:                   <p><code class="filename">/dev/*</code></p>
1.1       grant    3219:                   <pre class="screen">
1.14    ! xtraeme  3220: <code class="prompt">#</code> <strong class=
        !          3221: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    3222: </pre>
                   3223:                 </li>
                   3224: 
                   3225:                 <li>
1.14    ! xtraeme  3226:                   <p><code class="filename">/etc/resolv.conf</code>
1.1       grant    3227:                   (for <a xmlns=
                   3228:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3229:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.14    ! xtraeme  3230:                   class="pkgname">security/smtpd</a> and mail):</p>
1.1       grant    3231:                   <pre class="screen">
1.14    ! xtraeme  3232: <code class="prompt">#</code> <strong class=
        !          3233: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    3234: </pre>
                   3235:                 </li>
                   3236: 
                   3237:                 <li>
                   3238:                   <p>Working(!) mail config (hostname,
                   3239:                   sendmail.cf):</p>
                   3240:                   <pre class="screen">
1.14    ! xtraeme  3241: <code class="prompt">#</code> <strong class=
        !          3242: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    3243: </pre>
                   3244:                 </li>
                   3245: 
                   3246:                 <li>
1.14    ! xtraeme  3247:                   <p><code class="filename">/etc/localtime</code>
        !          3248:                   (for <a xmlns=
1.1       grant    3249:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3250:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.14    ! xtraeme  3251:                   class="pkgname">security/smtpd</a>):</p>
1.1       grant    3252:                   <pre class="screen">
1.14    ! xtraeme  3253: <code class="prompt">#</code> <strong class=
        !          3254: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    3255: </pre>
                   3256:                 </li>
                   3257: 
                   3258:                 <li>
1.14    ! xtraeme  3259:                   <p><code class="filename">/usr/src</code> (system
1.1       grant    3260:                   sources, for <a xmlns=
                   3261:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3262:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.14    ! xtraeme  3263:                   class="pkgname">sysutils/aperture</a>, <a xmlns=
        !          3264:                   "http://www.w3.org/TR/xhtml1/transitional" href=
        !          3265:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
        !          3266:                   class="pkgname">net/ppp-mppe</a>):</p>
1.1       grant    3267:                   <pre class="screen">
1.14    ! xtraeme  3268: <code class="prompt">#</code> <strong class=
        !          3269: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
        !          3270: <code class="prompt">#</code> <strong class=
        !          3271: "userinput"><code>ln -s cvs/src-1.6 src</code></strong>
1.1       grant    3272: </pre>
                   3273:                 </li>
                   3274: 
                   3275:                 <li>
1.14    ! xtraeme  3276:                   <p>Create <code class=
        !          3277:                   "filename">/var/db/pkg</code> (not part of
        !          3278:                   default install):</p>
1.1       grant    3279:                   <pre class="screen">
1.14    ! xtraeme  3280: <code class="prompt">#</code> <strong class=
        !          3281: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    3282: </pre>
                   3283:                 </li>
                   3284: 
                   3285:                 <li>
1.14    ! xtraeme  3286:                   <p>Create <code class="filename">/usr/pkg</code>
        !          3287:                   (not part of default install):</p>
1.1       grant    3288:                   <pre class="screen">
1.14    ! xtraeme  3289: <code class="prompt">#</code> <strong class=
        !          3290: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    3291: </pre>
                   3292:                 </li>
                   3293: 
                   3294:                 <li>
1.14    ! xtraeme  3295:                   <p>Checkout pkgsrc via cvs into <code class=
        !          3296:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    3297:                   <pre class="screen">
1.14    ! xtraeme  3298: <code class="prompt">#</code> <strong class=
        !          3299: "userinput"><code>cd /usr/sandbox/usr</code></strong>
        !          3300: <code class="prompt">#</code> <strong class=
        !          3301: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    3302: </pre>
                   3303: 
                   3304:                   <p>Do not mount/link this to the copy of your
                   3305:                   pkgsrc tree you do development in, as this will
                   3306:                   likely cause problems!</p>
                   3307:                 </li>
                   3308: 
                   3309:                 <li>
1.14    ! xtraeme  3310:                   <p>Make <code class=
        !          3311:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
        !          3312:                   and <code class="filename">.../distfiles</code>
        !          3313:                   point somewhere appropriate. NFS- and/or
        !          3314:                   nullfs-mounts may come in handy!</p>
1.1       grant    3315:                 </li>
                   3316: 
                   3317:                 <li>
1.14    ! xtraeme  3318:                   <p>Edit <code class=
        !          3319:                   "filename">/etc/mk.conf</code>, see <a href=
        !          3320:                   "#binary.mk.conf" title=
1.1       grant    3321:                   "5.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;5.3.1.1,
                   3322:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   3323:                 </li>
                   3324: 
                   3325:                 <li>
1.14    ! xtraeme  3326:                   <p>Adjust <code class=
        !          3327:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    3328:                   needs.</p>
                   3329:                 </li>
                   3330: 
                   3331:                 <li>
1.14    ! xtraeme  3332:                   <p>If you have set <code class=
        !          3333:                   "varname">CVS_USER</code> in <code class=
        !          3334:                   "filename">build.conf</code>, make sure that
        !          3335:                   account exists and can do a <span><strong class=
        !          3336:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    3337:                   properly!</p>
                   3338:                 </li>
                   3339:               </ol>
                   3340:             </div>
                   3341: 
                   3342:             <p>When the chroot sandbox is setup, you can start the
                   3343:             build with the following steps:</p>
                   3344:             <pre class="screen">
1.14    ! xtraeme  3345: <code class="prompt">#</code> <strong class=
        !          3346: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
        !          3347: <code class="prompt">#</code> <strong class=
        !          3348: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    3349: </pre>
                   3350: 
                   3351:             <p>This will just jump inside the sandbox and start
                   3352:             building. At the end of the build, mail will be sent
                   3353:             with the results of the build. Created binary pkgs will
1.14    ! xtraeme  3354:             be in <code class=
        !          3355:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    3356:             (wherever that points/mounts to/from).</p>
                   3357:           </div>
                   3358: 
                   3359:           <div class="sect2" lang="en" xml:lang="en">
                   3360:             <div class="titlepage">
                   3361:               <div>
                   3362:                 <div>
1.14    ! xtraeme  3363:                   <h3 class="title"><a name="id2583811" id=
        !          3364:                   "id2583811"></a>5.3.7.&nbsp;Building a partial
1.1       grant    3365:                   set of packages</h3>
                   3366:                 </div>
                   3367:               </div>
                   3368:             </div>
                   3369: 
                   3370:             <p>In addition to building a complete set of all
1.14    ! xtraeme  3371:             packages in pkgsrc, the <code class=
        !          3372:             "filename">pkgsrc/mk/bulk/build</code> script may be
        !          3373:             used to build a subset of the packages contained in
        !          3374:             pkgsrc. By setting defining <code class=
        !          3375:             "varname">SPECIFIC_PKGS</code> in <code class=
        !          3376:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    3377: 
                   3378:             <div class="itemizedlist">
                   3379:               <ul type="disc">
                   3380:                 <li>
                   3381:                   <p>SITE_SPECIFIC_PKGS</p>
                   3382:                 </li>
                   3383: 
                   3384:                 <li>
                   3385:                   <p>HOST_SPECIFIC_PKGS</p>
                   3386:                 </li>
                   3387: 
                   3388:                 <li>
                   3389:                   <p>GROUP_SPECIFIC_PKGS</p>
                   3390:                 </li>
                   3391: 
                   3392:                 <li>
                   3393:                   <p>USER_SPECIFIC_PKGS</p>
                   3394:                 </li>
                   3395:               </ul>
                   3396:             </div>
                   3397: 
                   3398:             <p>will define the set of packages which should be
                   3399:             built. The bulk build code will also include any
                   3400:             packages which are needed as dependencies for the
                   3401:             explicitly listed packages.</p>
                   3402: 
                   3403:             <p>One use of this is to do a bulk build with
1.14    ! xtraeme  3404:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    3405:             sandbox periodically to have a complete set of the
                   3406:             binary packages needed for your site available without
                   3407:             the overhead of building extra packages that are not
                   3408:             needed.</p>
                   3409:           </div>
1.13      hubertf  3410: 
                   3411:           <div class="sect2" lang="en" xml:lang="en">
                   3412:             <div class="titlepage">
                   3413:               <div>
                   3414:                 <div>
                   3415:                   <h3 class="title"><a name="bulk-upload" id=
                   3416:                   "bulk-upload"></a>5.3.8.&nbsp;Uploading results
                   3417:                   of a bulk build</h3>
                   3418:                 </div>
                   3419:               </div>
                   3420:             </div>
                   3421: 
                   3422:             <p>This section describes how pkgsrc developers can
                   3423:             upload binary pkgs built by bulk builds to
                   3424:             ftp.NetBSD.org.</p>
                   3425: 
1.14    ! xtraeme  3426:             <p>First, make sure that you have <code class=
        !          3427:             "varname">RSYNC_DST</code> set properly in your
        !          3428:             <code class="filename">mk/bulk/build.conf</code> file,
        !          3429:             i.e. adjust it to something like one of the
        !          3430:             following:</p>
1.13      hubertf  3431:             <pre class="screen">
                   3432: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3433: </pre>
                   3434: 
                   3435:             <p>Please use appropviate values for "pkgsrc-200xQ4",
                   3436:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14    ! xtraeme  3437:             ftp.NetBSD.org is different from <code class=
        !          3438:             "varname">CVS_USER</code>, write your login directly
        !          3439:             into the variable, e.g. my local account is "feyrer",
        !          3440:             but for my login "hubertf", I use:</p>
1.13      hubertf  3441:             <pre class="screen">
                   3442: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3443: </pre>
                   3444: 
1.14    ! xtraeme  3445:             <p>A separate <code class="filename">upload</code>
1.13      hubertf  3446:             directory is used here to allow "closing" the directory
                   3447:             during upload. To do so, run the following command on
                   3448:             ftp.NetBSD.org next:</p>
                   3449:             <pre class="screen">
1.14    ! xtraeme  3450: nbftp% <strong class=
        !          3451: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  3452: </pre>
                   3453: 
1.14    ! xtraeme  3454:             <p>Please note that <code class=
        !          3455:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  3456:             appropriate for packages for the NetBSD operating
                   3457:             system. Binary packages for other operating systems
1.14    ! xtraeme  3458:             should go into <code class=
        !          3459:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  3460: 
                   3461:             <p>Before uploading the binary pkgs, ssh authentication
                   3462:             needs to be setup next. This example shows how to setup
                   3463:             temporary keys for the root account <span class=
                   3464:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   3465:             that no keys should be present there usually):</p>
                   3466:             <pre class="screen">
1.14    ! xtraeme  3467: <code class="prompt">#</code> <strong class=
        !          3468: "userinput"><code>chroot /usr/sandbox</code></strong>        
        !          3469: chroot-<code class="prompt">#</code> <strong class=
        !          3470: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
        !          3471: chroot-<code class="prompt">#</code> <strong class=
        !          3472: "userinput"><code>ssh-keygen -t dsa</code></strong>        
        !          3473: chroot-<code class="prompt">#</code> <strong class=
        !          3474: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  3475: </pre>
                   3476: 
1.14    ! xtraeme  3477:             <p>Now take the output of <code class=
        !          3478:             "filename">id-dsa.pub</code> and append it to your
        !          3479:             <code class="filename">~/.ssh/authorized_keys</code>
        !          3480:             file on ftp.netBSD.org. You can remove the key after
        !          3481:             the upload is done!</p>
1.13      hubertf  3482: 
                   3483:             <p>Next, test if your ssh connection really works:</p>
                   3484:             <pre class="screen">
1.14    ! xtraeme  3485: chroot-<code class="prompt">#</code> <strong class=
        !          3486: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  3487: </pre>
                   3488: 
                   3489:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   3490: 
                   3491:             <p>Now after all this works, you can exit the sandbox
                   3492:             and start the upload:</p>
                   3493:             <pre class="screen">
1.14    ! xtraeme  3494: chroot-<code class="prompt">#</code> <strong class=
        !          3495: "userinput"><code>exit</code></strong>        
        !          3496: <code class="prompt">#</code> <strong class=
        !          3497: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
        !          3498: <code class="prompt">#</code> <strong class=
        !          3499: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  3500: </pre>
                   3501: 
                   3502:             <p>The upload process may take quite some time. Use
                   3503:             "ls" or "du" on the FTP server to monitor progress of
                   3504:             the upload.</p>
                   3505: 
                   3506:             <p>After the upload has ended, first thing is to revoke
                   3507:             ssh access:</p>
                   3508:             <pre class="screen">
1.14    ! xtraeme  3509: nbftp% <strong class=
        !          3510: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  3511: Gdd:x! 
                   3512: </pre>
                   3513: 
                   3514:             <p>Use whatever is needed to remove the key you've
                   3515:             entered before! Last, move the uploaded packages out of
1.14    ! xtraeme  3516:             the <code class="filename">upload</code> directory to
        !          3517:             have them accessible to everyone:</p>
1.13      hubertf  3518:             <pre class="screen">
1.14    ! xtraeme  3519: nbftp% <strong class=
        !          3520: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
        !          3521: nbftp% <strong class=
        !          3522: "userinput"><code>mv upload/* .</code></strong>
        !          3523: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
        !          3524: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  3525: </pre>
                   3526:           </div>
1.1       grant    3527:         </div>
                   3528: 
                   3529:         <div class="sect1" lang="en" xml:lang="en">
                   3530:           <div class="titlepage">
                   3531:             <div>
                   3532:               <div>
                   3533:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  3534:                 "id2584227" id="id2584227"></a>5.4.&nbsp;Creating a
1.1       grant    3535:                 multiple CD-ROM packages collection</h2>
                   3536:               </div>
                   3537:             </div>
                   3538:           </div>
                   3539: 
                   3540:           <p>After your pkgsrc bulk-build has completed, you may
                   3541:           wish to create a CD-ROM set of the resulting binary
                   3542:           packages to assist in installing packages on other
                   3543:           machines. The <a xmlns=
                   3544:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3545:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.14    ! xtraeme  3546:           class="pkgname">pkgtools/cdpack</a> package provides a
        !          3547:           simple tool for creating the ISO 9660 images.
        !          3548:           <span><strong class="command">cdpack</strong></span>
        !          3549:           arranges the packages on the CD-ROMs in a way that keeps
        !          3550:           all the dependencies for given package on the same CD as
        !          3551:           that package.</p>
1.1       grant    3552: 
                   3553:           <div class="sect2" lang="en" xml:lang="en">
                   3554:             <div class="titlepage">
                   3555:               <div>
                   3556:                 <div>
1.14    ! xtraeme  3557:                   <h3 class="title"><a name="id2584310" id=
        !          3558:                   "id2584310"></a>5.4.1.&nbsp;Example of
1.1       grant    3559:                   cdpack</h3>
                   3560:                 </div>
                   3561:               </div>
                   3562:             </div>
                   3563: 
                   3564:             <p>Complete documentation for cdpack is found in the
                   3565:             cdpack(1) manpage. The following short example assumes
1.14    ! xtraeme  3566:             that the binary packages are left in <code class=
        !          3567:             "filename">/usr/pkgsrc/packages/All</code> and that
        !          3568:             sufficient disk space exists in <code class=
        !          3569:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    3570:             <pre class="screen">
1.14    ! xtraeme  3571: <code class="prompt">#</code> <strong class=
        !          3572: "userinput"><code>mkdir /u2/images</code></strong>
        !          3573: <code class="prompt">#</code> <strong class=
        !          3574: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
        !          3575: <code class="prompt">#</code> <strong class=
        !          3576: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3577: </pre>
                   3578: 
                   3579:             <p>If you wish to include a common set of files
1.14    ! xtraeme  3580:             (<code class="filename">COPYRIGHT</code>, <code class=
        !          3581:             "filename">README</code>, etc.) on each CD in the
1.1       grant    3582:             collection, then you need to create a directory which
                   3583:             contains these files. e.g.</p>
                   3584:             <pre class="screen">
1.14    ! xtraeme  3585: <code class="prompt">#</code> <strong class=
        !          3586: "userinput"><code>mkdir /tmp/common</code></strong>
        !          3587: <code class="prompt">#</code> <strong class=
        !          3588: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
        !          3589: <code class="prompt">#</code> <strong class=
        !          3590: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
        !          3591: <code class="prompt">#</code> <strong class=
        !          3592: "userinput"><code>mkdir /tmp/common/bin</code></strong>
        !          3593: <code class="prompt">#</code> <strong class=
        !          3594: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
        !          3595: <code class="prompt">#</code> <strong class=
        !          3596: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
        !          3597: <code class="prompt">#</code> <strong class=
        !          3598: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    3599: </pre>
                   3600: 
                   3601:             <p>Now create the images:</p>
                   3602:             <pre class="screen">
1.14    ! xtraeme  3603: <code class="prompt">#</code> <strong class=
        !          3604: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3605: </pre>
                   3606: 
1.14    ! xtraeme  3607:             <p>Each image will contain <code class=
        !          3608:             "filename">README</code>, <code class=
        !          3609:             "filename">COPYING</code>, and <code class=
        !          3610:             "filename">bin/myscript</code> in their root
1.1       grant    3611:             directories.</p>
                   3612:           </div>
                   3613:         </div>
                   3614:       </div>
                   3615: 
                   3616:       <div class="chapter" lang="en" xml:lang="en">
                   3617:         <div class="titlepage">
                   3618:           <div>
                   3619:             <div>
                   3620:               <h2 class="title"><a name="faq" id=
                   3621:               "faq"></a>Chapter&nbsp;6.&nbsp;Frequently Asked
                   3622:               Questions</h2>
                   3623:             </div>
                   3624:           </div>
                   3625:         </div>
                   3626: 
                   3627:         <div class="toc">
                   3628:           <p><b>Table of Contents</b></p>
                   3629: 
                   3630:           <dl>
1.14    ! xtraeme  3631:             <dt><span class="sect1"><a href="#id2584502">6.1. Is
1.1       grant    3632:             there a mailing list for pkg-related
                   3633:             discussion?</a></span></dt>
                   3634: 
1.14    ! xtraeme  3635:             <dt><span class="sect1"><a href="#id2584600">6.2.
1.1       grant    3636:             Where's the pkgviews documentation?</a></span></dt>
                   3637: 
1.5       hubertf  3638:             <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    3639:             Utilities for package management
                   3640:             (pkgtools)</a></span></dt>
                   3641: 
1.14    ! xtraeme  3642:             <dt><span class="sect1"><a href="#id2584853">6.4. How
1.1       grant    3643:             to use pkgsrc as non-root</a></span></dt>
                   3644: 
1.14    ! xtraeme  3645:             <dt><span class="sect1"><a href="#id2584865">6.5. How
        !          3646:             to resume transferencies with pkgsrc?</a></span></dt>
        !          3647: 
        !          3648:             <dt><span class="sect1"><a href="#id2584903">6.6. How
1.1       grant    3649:             can I install/use XFree86 from pkgsrc?</a></span></dt>
                   3650: 
1.14    ! xtraeme  3651:             <dt><span class="sect1"><a href="#id2584931">6.7. How
1.1       grant    3652:             can I install/use X.org from pkgsrc?</a></span></dt>
                   3653: 
1.14    ! xtraeme  3654:             <dt><span class="sect1"><a href="#id2584958">6.8. How
1.1       grant    3655:             to fetch files from behind a firewall</a></span></dt>
                   3656: 
1.14    ! xtraeme  3657:             <dt><span class="sect1"><a href="#id2584972">6.9. How
        !          3658:             do I tell <span><strong class="command">make
        !          3659:             fetch</strong></span> to do passive
        !          3660:             FTP?</a></span></dt>
1.1       grant    3661: 
1.14    ! xtraeme  3662:             <dt><span class="sect1"><a href="#id2585024">6.10. How
1.1       grant    3663:             to fetch all distfiles at once</a></span></dt>
                   3664: 
1.14    ! xtraeme  3665:             <dt><span class="sect1"><a href="#id2585163">6.11. What
        !          3666:             does &#8220;<span class="quote">Don't know how to make
        !          3667:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    3668:             mean?</a></span></dt>
                   3669: 
1.14    ! xtraeme  3670:             <dt><span class="sect1"><a href="#id2585202">6.12. What
        !          3671:             does &#8220;<span class="quote">Could not find
        !          3672:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    3673: 
1.14    ! xtraeme  3674:             <dt><span class="sect1"><a href="#id2585259">6.13.
1.1       grant    3675:             Using 'sudo' with pkgsrc</a></span></dt>
                   3676: 
1.14    ! xtraeme  3677:             <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    3678:             Configuration files handling and
                   3679:             placement</a></span></dt>
                   3680: 
1.14    ! xtraeme  3681:             <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1       grant    3682:             Automated security checks</a></span></dt>
                   3683:           </dl>
                   3684:         </div>
                   3685: 
                   3686:         <p>This section contains hints, tips &amp; tricks on
                   3687:         special things in pkgsrc that we didn't find a better place
                   3688:         for in the previous chapters, and it contains items for
                   3689:         both pkgsrc users and developers.</p>
                   3690: 
                   3691:         <div class="sect1" lang="en" xml:lang="en">
                   3692:           <div class="titlepage">
                   3693:             <div>
                   3694:               <div>
                   3695:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  3696:                 "id2584502" id="id2584502"></a>6.1.&nbsp;Is there a
1.1       grant    3697:                 mailing list for pkg-related discussion?</h2>
                   3698:               </div>
                   3699:             </div>
                   3700:           </div>
                   3701: 
1.14    ! xtraeme  3702:           <p>Yes, <code class="email">&lt;<a href=
        !          3703:           "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>
1.1       grant    3704:           is the list for discussing package related issues. To
                   3705:           subscribe do:</p>
                   3706:           <pre class="programlisting">
1.14    ! xtraeme  3707: <code class=
        !          3708: "prompt">%</code> echo subscribe tech-pkg | mail majordomo@NetBSD.org
1.1       grant    3709: </pre>
                   3710: 
                   3711:           <p>An archive of the list is available at <a href=
                   3712:           "http://mail-index.NetBSD.org/tech-pkg/" target=
                   3713:           "_top">http://mail-index.NetBSD.org/tech-pkg/</a>.</p>
                   3714:         </div>
                   3715: 
                   3716:         <div class="sect1" lang="en" xml:lang="en">
                   3717:           <div class="titlepage">
                   3718:             <div>
                   3719:               <div>
                   3720:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  3721:                 "id2584600" id="id2584600"></a>6.2.&nbsp;Where's
1.1       grant    3722:                 the pkgviews documentation?</h2>
                   3723:               </div>
                   3724:             </div>
                   3725:           </div>
                   3726: 
                   3727:           <p>Pkgviews is tightly integrated with buildlink. You can
1.14    ! xtraeme  3728:           find a pkgviews User's guide in <code class=
        !          3729:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    3730:         </div>
                   3731: 
                   3732:         <div class="sect1" lang="en" xml:lang="en">
                   3733:           <div class="titlepage">
                   3734:             <div>
                   3735:               <div>
                   3736:                 <h2 class="title" style="clear: both"><a name=
1.5       hubertf  3737:                 "faq-pkgtools" id=
                   3738:                 "faq-pkgtools"></a>6.3.&nbsp;Utilities for package
                   3739:                 management (pkgtools)</h2>
1.1       grant    3740:               </div>
                   3741:             </div>
                   3742:           </div>
                   3743: 
1.14    ! xtraeme  3744:           <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1       grant    3745:           directory pkgtools contains a number of useful utilities
                   3746:           for both users and developers of pkgsrc. This section
                   3747:           attempts only to make the reader aware of the utilities
                   3748:           and when they might be useful, and not to duplicate the
                   3749:           documentation that comes with each package.</p>
                   3750: 
                   3751:           <p>Utilities used by pkgsrc (automatically installed when
                   3752:           needed):</p>
                   3753: 
                   3754:           <div class="itemizedlist">
                   3755:             <ul type="disc">
                   3756:               <li>
                   3757:                 <p><a xmlns=
                   3758:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3759:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.14    ! xtraeme  3760:                 class="pkgname">pkgtools/x11-links</a>: symlinks
        !          3761:                 for use by buildlink</p>
1.1       grant    3762:               </li>
                   3763:             </ul>
                   3764:           </div>
                   3765: 
                   3766:           <p>OS tool augmentation (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/digest/README.html"
1.14    ! xtraeme  3775:                 class="pkgname">pkgtools/digest</a>: calculates
        !          3776:                 SHA1 checksums (and other kinds)</p>
1.1       grant    3777:               </li>
                   3778: 
                   3779:               <li>
                   3780:                 <p><a xmlns=
                   3781:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3782:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.14    ! xtraeme  3783:                 class="pkgname">pkgtools/libnbcompat</a>: compat
        !          3784:                 library for pkg tools</p>
1.1       grant    3785:               </li>
                   3786: 
                   3787:               <li>
                   3788:                 <p><a xmlns=
                   3789:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3790:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.14    ! xtraeme  3791:                 class="pkgname">pkgtools/mtree</a>: installed on
        !          3792:                 non-BSD systems due to lack of native mtree</p>
1.1       grant    3793:               </li>
                   3794: 
                   3795:               <li>
                   3796:                 <p><a xmlns=
                   3797:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3798:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14    ! xtraeme  3799:                 class="pkgname">pkgtools/pkg_install</a>:
        !          3800:                 up-to-date replacement for /usr/sbin/pkg_install,
        !          3801:                 or for use on operating systems where pkg_install
        !          3802:                 is not present</p>
1.1       grant    3803:               </li>
                   3804:             </ul>
                   3805:           </div>
                   3806: 
                   3807:           <p>Utilities used by pkgsrc (not automatically
                   3808:           installed):</p>
                   3809: 
                   3810:           <div class="itemizedlist">
                   3811:             <ul type="disc">
                   3812:               <li>
                   3813:                 <p><a xmlns=
                   3814:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3815:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.14    ! xtraeme  3816:                 class="pkgname">pkgtools/pkg_tarup</a>: create a
        !          3817:                 binary package from an already-installed package.
        !          3818:                 used by 'make replace' to save the old package</p>
1.1       grant    3819:               </li>
                   3820: 
                   3821:               <li>
                   3822:                 <p><a xmlns=
                   3823:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  3824:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.14    ! xtraeme  3825:                 class="pkgname">pkgtools/dfdisk</a>: adds extra
        !          3826:                 functionality to pkgsrc, allowing it to fetch
        !          3827:                 distfiles from multiple locations. It currently
        !          3828:                 supports the following methods: multiple CD-ROMs
        !          3829:                 and network FTP/HTTP connections.</p>
1.5       hubertf  3830:               </li>
                   3831: 
                   3832:               <li>
                   3833:                 <p><a xmlns=
                   3834:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    3835:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.14    ! xtraeme  3836:                 class="pkgname">pkgtools/xpkgwedge</a>: put X11
        !          3837:                 packages someplace else (enabled by default)</p>
1.1       grant    3838:               </li>
1.5       hubertf  3839: 
                   3840:               <li>
                   3841:                 <p><a xmlns=
                   3842:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3843:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.14    ! xtraeme  3844:                 class="pkgname">devel/cpuflags</a>: will determine
        !          3845:                 the best compiler flags to optimise code for your
        !          3846:                 current CPU and compiler.</p>
1.5       hubertf  3847:               </li>
1.1       grant    3848:             </ul>
                   3849:           </div>
                   3850: 
                   3851:           <p>Utilities for keeping track of installed packages,
                   3852:           being up to date, etc:</p>
                   3853: 
                   3854:           <div class="itemizedlist">
                   3855:             <ul type="disc">
                   3856:               <li>
                   3857:                 <p><a xmlns=
                   3858:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3859:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.14    ! xtraeme  3860:                 class="pkgname">pkgtools/pkg_chk</a>: installs
        !          3861:                 pkg_chk, which reports on packages whose installed
        !          3862:                 versions do not match the latest pkgsrc entries</p>
1.1       grant    3863:               </li>
                   3864: 
                   3865:               <li>
                   3866:                 <p><a xmlns=
                   3867:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3868:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.14    ! xtraeme  3869:                 class="pkgname">pkgtools/pkgdep</a>: makes
        !          3870:                 dependency graphs of packages, to aid in choosing a
        !          3871:                 strategy for updating</p>
1.1       grant    3872:               </li>
                   3873: 
                   3874:               <li>
                   3875:                 <p><a xmlns=
                   3876:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3877:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.14    ! xtraeme  3878:                 class="pkgname">pkgtools/pkgdepgraph</a>: make
        !          3879:                 graph from above (uses graphviz)</p>
1.1       grant    3880:               </li>
                   3881: 
                   3882:               <li>
                   3883:                 <p><a xmlns=
                   3884:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3885:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14    ! xtraeme  3886:                 class="pkgname">pkgtools/pkglint</a>: This provides
        !          3887:                 two distinct abilities: check a pkgsrc entry for
        !          3888:                 correctness (pkglint) check for and remove
        !          3889:                 out-of-date distfiles and binary packages
        !          3890:                 (lintpkgsrc)</p>
1.1       grant    3891:               </li>
                   3892: 
                   3893:               <li>
                   3894:                 <p><a xmlns=
                   3895:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3896:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.14    ! xtraeme  3897:                 class="pkgname">pkgtools/pkgsurvey</a>: report what
        !          3898:                 packages you have installed</p>
1.1       grant    3899:               </li>
                   3900:             </ul>
                   3901:           </div>
                   3902: 
                   3903:           <p>Utilities for people maintaining or creating
                   3904:           individual packages:</p>
                   3905: 
                   3906:           <div class="itemizedlist">
                   3907:             <ul type="disc">
                   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/pkgdiff/README.html"
1.14    ! xtraeme  3912:                 class="pkgname">pkgtools/pkgdiff</a>: automate
        !          3913:                 making and maintaining patches for a package
        !          3914:                 (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1       grant    3915:               </li>
                   3916: 
                   3917:               <li>
                   3918:                 <p><a xmlns=
                   3919:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3920:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.14    ! xtraeme  3921:                 class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
        !          3922:                 "http://www.w3.org/TR/xhtml1/transitional" href=
        !          3923:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
        !          3924:                 class="pkgname">pkgtools/url2pkg</a>: aids in
        !          3925:                 converting to pkgsrc</p>
1.1       grant    3926:               </li>
                   3927: 
                   3928:               <li>
                   3929:                 <p><a xmlns=
                   3930:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3931:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.14    ! xtraeme  3932:                 class="pkgname">pkgtools/gensolpkg</a>: convert
        !          3933:                 pkgsrc to a Solaris package</p>
1.1       grant    3934:               </li>
                   3935:             </ul>
                   3936:           </div>
                   3937: 
                   3938:           <p>Utilities for people maintaining pkgsrc (or more
                   3939:           obscure pkg utilities)</p>
                   3940: 
                   3941:           <div class="itemizedlist">
                   3942:             <ul type="disc">
                   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/pkgconflict/README.html"
1.14    ! xtraeme  3947:                 class="pkgname">pkgtools/pkgconflict</a>: find
        !          3948:                 packages that conflict but aren't marked as
        !          3949:                 such</p>
1.1       grant    3950:               </li>
                   3951: 
                   3952:               <li>
                   3953:                 <p><a xmlns=
                   3954:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3955:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.14    ! xtraeme  3956:                 class="pkgname">pkgtools/pkg_comp</a>: build
        !          3957:                 packages in a chrooted area</p>
1.1       grant    3958:               </li>
                   3959: 
                   3960:               <li>
                   3961:                 <p><a xmlns=
                   3962:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3963:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.14    ! xtraeme  3964:                 class="pkgname">pkgtools/libkver</a>: spoof kernel
        !          3965:                 version for chrooted cross builds</p>
1.1       grant    3966:               </li>
                   3967:             </ul>
                   3968:           </div>
                   3969:         </div>
                   3970: 
                   3971:         <div class="sect1" lang="en" xml:lang="en">
                   3972:           <div class="titlepage">
                   3973:             <div>
                   3974:               <div>
                   3975:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  3976:                 "id2584853" id="id2584853"></a>6.4.&nbsp;How to use
1.1       grant    3977:                 pkgsrc as non-root</h2>
                   3978:               </div>
                   3979:             </div>
                   3980:           </div>
                   3981: 
                   3982:           <p>If you want to use pkgsrc as non-root user, you can
                   3983:           set some variables to make pkgsrc work under these
                   3984:           conditions. Please see <a href=
                   3985:           "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.14    ! xtraeme  3986:           target="_top">this message</a> for more details.</p>
        !          3987:         </div>
        !          3988: 
        !          3989:         <div class="sect1" lang="en" xml:lang="en">
        !          3990:           <div class="titlepage">
        !          3991:             <div>
        !          3992:               <div>
        !          3993:                 <h2 class="title" style="clear: both"><a name=
        !          3994:                 "id2584865" id="id2584865"></a>6.5.&nbsp;How to
        !          3995:                 resume transferencies with pkgsrc?</h2>
        !          3996:               </div>
        !          3997:             </div>
        !          3998:           </div>
        !          3999: 
        !          4000:           <p>By default resuming transferencies in pkgsrc is
        !          4001:           disabled, but you can enable this feature adding the
        !          4002:           option <code class=
        !          4003:           "varname">PKG_RESUME_TRANSFERS=YES</code> into
        !          4004:           <code class="filename">mk.conf</code>, if a previous
        !          4005:           transfer wasn't completed, it will try to resume it
        !          4006:           saving your bandwidth.</p>
        !          4007: 
        !          4008:           <p>For example, if you want to use <code class=
        !          4009:           "filename">wget</code> to resume downloads, you'll have
        !          4010:           to use something like:</p>
        !          4011:           <pre class="programlisting">
        !          4012:         FETCH_CMD=wget
        !          4013:         .if defined(FETCH_CMD) &amp;&amp; ${FETCH_CMD} == "wget"
        !          4014:         FETCH_BEFORE_ARGS=--passive-ftp
        !          4015:         FETCH_RESUME_ARGS=-c
        !          4016:         FETCH_OUTPUT_ARGS=-O
        !          4017:         .endif
        !          4018:     
        !          4019: </pre>
        !          4020: 
        !          4021:           <p>Don't forget to set <code class=
        !          4022:           "varname">FETCH_RESUME_ARGS</code> and <code class=
        !          4023:           "varname">FETCH_OUTPUT_ARGS</code> if you are not using
        !          4024:           default values.</p>
1.1       grant    4025:         </div>
                   4026: 
                   4027:         <div class="sect1" lang="en" xml:lang="en">
                   4028:           <div class="titlepage">
                   4029:             <div>
                   4030:               <div>
                   4031:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  4032:                 "id2584903" id="id2584903"></a>6.6.&nbsp;How can I
1.1       grant    4033:                 install/use XFree86 from pkgsrc?</h2>
                   4034:               </div>
                   4035:             </div>
                   4036:           </div>
                   4037: 
                   4038:           <p>If you want to use XFree86 from pkgsrc instead of your
1.14    ! xtraeme  4039:           system's own X11 (<code class=
        !          4040:           "filename">/usr/X11R6</code>, <code class=
        !          4041:           "filename">/usr/openwin</code>, ...), you will have to
        !          4042:           add the following line into <code class=
        !          4043:           "filename">mk.conf</code>:</p>
1.1       grant    4044:           <pre class="programlisting">
                   4045:       X11_TYPE=XFree86
                   4046:     
                   4047: </pre>
                   4048:         </div>
                   4049: 
                   4050:         <div class="sect1" lang="en" xml:lang="en">
                   4051:           <div class="titlepage">
                   4052:             <div>
                   4053:               <div>
                   4054:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  4055:                 "id2584931" id="id2584931"></a>6.7.&nbsp;How can I
1.1       grant    4056:                 install/use X.org from pkgsrc?</h2>
                   4057:               </div>
                   4058:             </div>
                   4059:           </div>
                   4060: 
                   4061:           <p>If you want to use X.org from pkgsrc instead of your
1.14    ! xtraeme  4062:           system's own X11 (<code class=
        !          4063:           "filename">/usr/X11R6</code>, <code class=
        !          4064:           "filename">/usr/openwin</code>, ...) you will have to add
        !          4065:           the following line into <code class=
        !          4066:           "filename">mk.conf</code>:</p>
1.1       grant    4067:           <pre class="programlisting">
                   4068:       X11_TYPE=xorg
                   4069:     
                   4070: </pre>
                   4071:         </div>
                   4072: 
                   4073:         <div class="sect1" lang="en" xml:lang="en">
                   4074:           <div class="titlepage">
                   4075:             <div>
                   4076:               <div>
                   4077:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  4078:                 "id2584958" id="id2584958"></a>6.8.&nbsp;How to
1.1       grant    4079:                 fetch files from behind a firewall</h2>
                   4080:               </div>
                   4081:             </div>
                   4082:           </div>
                   4083: 
                   4084:           <p>If you are sitting behind a firewall which does not
                   4085:           allow direct connections to Internet hosts (i.e.
                   4086:           non-NAT), you may specify the relevant proxy hosts. This
                   4087:           is done using an environment variable in the form of a
                   4088:           URL e.g. in Amdahl, the machine &#8220;<span class=
                   4089:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   4090:           firewalls, and it uses port 80 as the proxy port number.
                   4091:           So the proxy environment variables are:</p>
                   4092:           <pre class="programlisting">
                   4093:   ftp_proxy=ftp://orpheus.amdahl.com:80/
                   4094: http_proxy=http://orpheus.amdahl.com:80/
                   4095: </pre>
                   4096:         </div>
                   4097: 
                   4098:         <div class="sect1" lang="en" xml:lang="en">
                   4099:           <div class="titlepage">
                   4100:             <div>
                   4101:               <div>
                   4102:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  4103:                 "id2584972" id="id2584972"></a>6.9.&nbsp;How do I
        !          4104:                 tell <span><strong class="command">make
        !          4105:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    4106:               </div>
                   4107:             </div>
                   4108:           </div>
                   4109: 
                   4110:           <p>This depends on which utility is used to retrieve
1.14    ! xtraeme  4111:           distfiles. From <code class="filename">bsd.pkg.mk</code>,
        !          4112:           <code class="varname">FETCH_CMD</code> is assigned the
        !          4113:           first available command from the following list:</p>
1.1       grant    4114:           <pre class="programlisting">
                   4115: ${LOCALBASE}/bin/ftp
                   4116: /usr/bin/ftp
                   4117: </pre>
                   4118: 
                   4119:           <p>On a default NetBSD installation, this will be
1.14    ! xtraeme  4120:           <code class="filename">/usr/bin/ftp</code>, which
1.1       grant    4121:           automatically tries passive connections first, and falls
                   4122:           back to active connections if the server refuses to do
                   4123:           passive. For the other tools, add the following to your
1.14    ! xtraeme  4124:           <code class="filename">/etc/mk.conf</code> file:
        !          4125:           <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    4126: 
1.14    ! xtraeme  4127:           <p>Having that option present will prevent <code class=
        !          4128:           "filename">/usr/bin/ftp</code> from falling back to
        !          4129:           active transfers.</p>
1.1       grant    4130:         </div>
                   4131: 
                   4132:         <div class="sect1" lang="en" xml:lang="en">
                   4133:           <div class="titlepage">
                   4134:             <div>
                   4135:               <div>
                   4136:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  4137:                 "id2585024" id="id2585024"></a>6.10.&nbsp;How to
1.1       grant    4138:                 fetch all distfiles at once</h2>
                   4139:               </div>
                   4140:             </div>
                   4141:           </div>
                   4142: 
                   4143:           <p>You would like to download all the distfiles in a
                   4144:           single batch from work or university, where you can't run
1.14    ! xtraeme  4145:           a <span><strong class="command">make
        !          4146:           fetch</strong></span>. There is an archive of distfiles
        !          4147:           on <a href=
1.1       grant    4148:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   4149:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   4150:           entire directory may not be appropriate.</p>
                   4151: 
1.14    ! xtraeme  4152:           <p>The answer here is to do a <span><strong class=
        !          4153:           "command">make fetch-list</strong></span> in <code class=
        !          4154:           "filename">/usr/pkgsrc</code> or one of it's
1.1       grant    4155:           subdirectories, carry the resulting list to your machine
                   4156:           at work/school and use it there If you don't have a
                   4157:           NetBSD-compatible ftp(1) (like lukemftp) at work, don't
1.14    ! xtraeme  4158:           forget to set <code class="varname">FETCH_CMD</code> to
1.1       grant    4159:           something that fetches a URL:</p>
                   4160: 
                   4161:           <p>At home:</p>
                   4162:           <pre class="screen">
1.14    ! xtraeme  4163: <code class="prompt">%</code> <strong class=
        !          4164: "userinput"><code>cd /usr/pkgsrc</code></strong>
        !          4165: <code class="prompt">%</code> <strong class=
        !          4166: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
        !          4167: <code class="prompt">%</code> <strong class=
        !          4168: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    4169: </pre>
                   4170: 
                   4171:           <p>At work:</p>
                   4172:           <pre class="screen">
1.14    ! xtraeme  4173: <code class="prompt">%</code> <strong class=
        !          4174: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    4175: </pre>
                   4176: 
1.14    ! xtraeme  4177:           <p>then tar up <code class=
        !          4178:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    4179: 
                   4180:           <p>If you have a machine running NetBSD, and you want to
                   4181:           get <span class="emphasis"><em>all</em></span> distfiles
                   4182:           (even ones that aren't for your machine architecture),
                   4183:           you can do so by using the above-mentioned
1.14    ! xtraeme  4184:           <span><strong class="command">make
        !          4185:           fetch-list</strong></span> approach, or fetch the
        !          4186:           distfiles directly by running:</p>
1.1       grant    4187:           <pre class="screen">
1.14    ! xtraeme  4188: <code class="prompt">%</code> <strong class=
        !          4189: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    4190: </pre>
                   4191: 
1.14    ! xtraeme  4192:           <p>If you even decide to ignore <code class=
        !          4193:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
        !          4194:           can get everything by running:</p>
1.1       grant    4195:           <pre class="screen">
1.14    ! xtraeme  4196: <code class="prompt">%</code> <strong class=
        !          4197: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    4198: </pre>
                   4199:         </div>
                   4200: 
                   4201:         <div class="sect1" lang="en" xml:lang="en">
                   4202:           <div class="titlepage">
                   4203:             <div>
                   4204:               <div>
                   4205:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  4206:                 "id2585163" id="id2585163"></a>6.11.&nbsp;What does
1.1       grant    4207:                 &#8220;<span class="quote">Don't know how to make
                   4208:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   4209:               </div>
                   4210:             </div>
                   4211:           </div>
                   4212: 
                   4213:           <p>When compiling the <a xmlns=
                   4214:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4215:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14    ! xtraeme  4216:           class="pkgname">pkgtools/pkg_install</a> package, you get
        !          4217:           the error from make that it doesn't know how to make
        !          4218:           <code class="filename">/usr/share/tmac/tmac.andoc</code>?
        !          4219:           This indicates that you don't have installed the
        !          4220:           &#8220;<span class="quote">text</span>&#8221; set on your
        !          4221:           machine (nroff, ...). It is recommended to do that to
        !          4222:           format manpages.</p>
1.1       grant    4223: 
                   4224:           <p>In the case of the <a xmlns=
                   4225:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4226:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14    ! xtraeme  4227:           class="pkgname">pkgtools/pkg_install</a> package, you can
        !          4228:           get away with setting <code class=
        !          4229:           "varname">NOMAN=YES</code> either in the environment or
        !          4230:           in <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    4231:         </div>
                   4232: 
                   4233:         <div class="sect1" lang="en" xml:lang="en">
                   4234:           <div class="titlepage">
                   4235:             <div>
                   4236:               <div>
                   4237:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  4238:                 "id2585202" id="id2585202"></a>6.12.&nbsp;What does
1.1       grant    4239:                 &#8220;<span class="quote">Could not find
                   4240:                 bsd.own.mk</span>&#8221; mean?</h2>
                   4241:               </div>
                   4242:             </div>
                   4243:           </div>
                   4244: 
1.14    ! xtraeme  4245:           <p>You didn't install the compiler set, <code class=
        !          4246:           "filename">comp.tgz</code>, when you installed your
        !          4247:           NetBSD machine. Please get it and install it, by
        !          4248:           extracting it in <code class="filename">/</code>:</p>
1.1       grant    4249:           <pre class="screen">
1.14    ! xtraeme  4250: <code class="prompt">#</code> <strong class=
        !          4251: "userinput"><code>cd /</code></strong>
        !          4252: <code class="prompt">#</code> <strong class=
        !          4253: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    4254: </pre>
                   4255: 
1.14    ! xtraeme  4256:           <p><code class="filename">comp.tgz</code> is part of
        !          4257:           every NetBSD release. Get the one that corresponds to
        !          4258:           your release (determine via <span><strong class=
        !          4259:           "command">uname -r</strong></span>).</p>
1.1       grant    4260:         </div>
                   4261: 
                   4262:         <div class="sect1" lang="en" xml:lang="en">
                   4263:           <div class="titlepage">
                   4264:             <div>
                   4265:               <div>
                   4266:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  4267:                 "id2585259" id="id2585259"></a>6.13.&nbsp;Using
1.1       grant    4268:                 'sudo' with pkgsrc</h2>
                   4269:               </div>
                   4270:             </div>
                   4271:           </div>
                   4272: 
                   4273:           <p>When installing packages as non-root user and using
                   4274:           the just-in-time su(1) feature of pkgsrc, it can become
                   4275:           annoying to type in the root password for each required
                   4276:           package installed. To avoid this, the sudo package can be
                   4277:           used, which does password caching over a limited time. To
                   4278:           use it, install sudo (either as binary package or from
                   4279:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   4280:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.14    ! xtraeme  4281:           class="pkgname">security/sudo</a>) and then put the
        !          4282:           following into your <code class=
        !          4283:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4284:           <pre class="programlisting">
                   4285:         .if exists(/usr/pkg/bin/sudo)
                   4286:         SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
                   4287:         .endif
                   4288:     
                   4289: </pre>
                   4290:         </div>
                   4291: 
                   4292:         <div class="sect1" lang="en" xml:lang="en">
                   4293:           <div class="titlepage">
                   4294:             <div>
                   4295:               <div>
                   4296:                 <h2 class="title" style="clear: both"><a name=
                   4297:                 "faq.conf" id=
1.14    ! xtraeme  4298:                 "faq.conf"></a>6.14.&nbsp;Configuration files
1.1       grant    4299:                 handling and placement</h2>
                   4300:               </div>
                   4301:             </div>
                   4302:           </div>
                   4303: 
1.14    ! xtraeme  4304:           <p>The global variable <code class=
        !          4305:           "varname">PKG_SYSCONFBASE</code> (and some others) can be
        !          4306:           set by the system administrator in <code class=
        !          4307:           "filename">/etc/mk.conf</code> to define the place where
1.1       grant    4308:           configuration files get installed. Therefore, packages
                   4309:           must be adapted to support this feature. Keep in mind
                   4310:           that you should only install files that are strictly
                   4311:           necessary in the configuration directory, files that can
1.14    ! xtraeme  4312:           go to <code class="filename">$PREFIX/share</code> should
        !          4313:           go there.</p>
1.1       grant    4314: 
                   4315:           <p>We will take a look at available variables first
1.14    ! xtraeme  4316:           (<code class="filename">bsd.pkg.mk</code> contains more
        !          4317:           information). <code class="varname">PKG_SYSCONFDIR</code>
        !          4318:           is where the configuration files for a package may be
        !          4319:           found (that is, the full path, e.g. <code class=
        !          4320:           "filename">/etc</code> or <code class=
        !          4321:           "filename">/usr/pkg/etc</code>). This value may be
1.1       grant    4322:           customized in various ways:</p>
                   4323: 
                   4324:           <div class="orderedlist">
                   4325:             <ol type="1">
                   4326:               <li>
1.14    ! xtraeme  4327:                 <p><code class="varname">PKG_SYSCONFBASE</code> is
        !          4328:                 the main config directory under which all package
1.1       grant    4329:                 configuration files are to be found. Users will
1.14    ! xtraeme  4330:                 typically want to set it to <code class=
        !          4331:                 "filename">/etc</code>, or accept the default
        !          4332:                 location of <code class=
        !          4333:                 "filename">$PREFIX/etc</code>.</p>
1.1       grant    4334:               </li>
                   4335: 
                   4336:               <li>
1.14    ! xtraeme  4337:                 <p><code class="varname">PKG_SYSCONFSUBDIR</code>
        !          4338:                 is the subdirectory of <code class=
        !          4339:                 "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    4340:                 configuration files for a particular package may be
1.14    ! xtraeme  4341:                 found. Defaults to <code class=
        !          4342:                 "varname">${SYSCONFBASE}</code>.</p>
1.1       grant    4343:               </li>
                   4344: 
                   4345:               <li>
1.14    ! xtraeme  4346:                 <p><code class="varname">PKG_SYSCONFVAR</code> is
        !          4347:                 the special suffix used to distinguish any
        !          4348:                 overriding values for a particular package (see
        !          4349:                 next item). It defaults to <code class=
        !          4350:                 "varname">${PKGBASE}</code>, but for a collection
        !          4351:                 of related packages that should all have the same
        !          4352:                 <code class="varname">PKG_SYSCONFDIR</code> value,
        !          4353:                 it can be set in each of the package Makefiles to a
        !          4354:                 common value.</p>
1.1       grant    4355:               </li>
                   4356: 
                   4357:               <li>
1.14    ! xtraeme  4358:                 <p><code class=
        !          4359:                 "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
        !          4360:                 overrides the value of <code class=
        !          4361:                 "varname">${PKG_SYSCONFDIR}</code> for packages
        !          4362:                 with the same value for <code class=
        !          4363:                 "varname">PKG_SYSCONFVAR</code>.</p>
1.1       grant    4364: 
                   4365:                 <p>As an example, all the various KDE packages may
1.14    ! xtraeme  4366:                 want to set <code class=
        !          4367:                 "varname">PKG_SYSCONFVAR</code> to
        !          4368:                 &#8220;<span class="quote">kde</span>&#8221; so
        !          4369:                 admins can set <code class=
        !          4370:                 "varname">PKG_SYSCONFDIR.kde</code> in <code class=
        !          4371:                 "filename">/etc/mk.conf</code> to define where to
1.1       grant    4372:                 install KDE config files.</p>
                   4373:               </li>
                   4374:             </ol>
                   4375:           </div>
                   4376: 
                   4377:           <p>Programs' configuration directory should be defined
                   4378:           during the configure stage. Packages that use GNU
                   4379:           autoconf can usually do this by using the
                   4380:           &#8220;<span class="quote">--sysconfdir</span>&#8221;
                   4381:           parameter, but this brings some problems as we will see
                   4382:           now. When you change this pathname in packages, you
                   4383:           should not allow them to install files in that directory
                   4384:           directly. Instead they need to install those files under
1.14    ! xtraeme  4385:           <code class="filename">share/examples/${PKGNAME}</code>
        !          4386:           so <code class="filename">PLIST</code> can register
        !          4387:           them.</p>
1.1       grant    4388: 
                   4389:           <p>Once you have the required configuration files in
1.14    ! xtraeme  4390:           place (under the <code class=
        !          4391:           "filename">share/examples</code> directory) the variable
        !          4392:           <code class="varname">CONF_FILES</code> should be set to
        !          4393:           copy them into <code class=
        !          4394:           "varname">PKG_SYSCONFDIR</code>. The contents of this
        !          4395:           variable is formed by pairs of filenames; the first
1.1       grant    4396:           element of the pair specifies the file inside the
1.14    ! xtraeme  4397:           examples directory (registered by <code class=
        !          4398:           "filename">PLIST</code>) and the second element specifies
1.1       grant    4399:           the target file. This is done this way to allow binary
                   4400:           packages to place files in the right directory using
1.14    ! xtraeme  4401:           <code class="filename">INSTALL</code>/<code class=
        !          4402:           "filename">DEINSTALL</code> scripts which are created
        !          4403:           automatically. The package <code class=
        !          4404:           "filename">Makefile</code> must also set <code class=
        !          4405:           "varname">USE_PKGINSTALL=YES</code> to use these
1.1       grant    4406:           automatically generated scripts. The automatic copying of
                   4407:           config files can be toggled by setting the environment
1.14    ! xtraeme  4408:           variable <code class="varname">PKG_CONFIG</code> prior to
1.1       grant    4409:           package installation.</p>
                   4410: 
                   4411:           <p>Here is an example, taken from mail/mutt/Makefile:</p>
                   4412:           <pre class="programlisting">
                   4413:   EGDIR=            ${PREFIX}/share/doc/mutt/samples
                   4414: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   4415: </pre>
                   4416: 
                   4417:           <p>As you can see, this package installs configuration
1.14    ! xtraeme  4418:           files inside <code class="varname">EGDIR</code>, which
        !          4419:           are registered by <code class="filename">PLIST</code>.
        !          4420:           After that, the variable <code class=
        !          4421:           "varname">CONF_FILES</code> lists the installed file
        !          4422:           first and then the target file. Users will also get an
        !          4423:           automatic message when files are installed using this
        !          4424:           method.</p>
1.1       grant    4425:         </div>
                   4426: 
                   4427:         <div class="sect1" lang="en" xml:lang="en">
                   4428:           <div class="titlepage">
                   4429:             <div>
                   4430:               <div>
                   4431:                 <h2 class="title" style="clear: both"><a name=
                   4432:                 "audit-packages" id=
1.14    ! xtraeme  4433:                 "audit-packages"></a>6.15.&nbsp;Automated security
1.1       grant    4434:                 checks</h2>
                   4435:               </div>
                   4436:             </div>
                   4437:           </div>
                   4438: 
                   4439:           <p>Please be aware that there can often be bugs in
                   4440:           third-party software, and some of these bugs can leave a
                   4441:           machine vulnerable to exploitation by attackers. In an
                   4442:           effort to lessen the exposure, the NetBSD packages team
                   4443:           maintains a database of known-exploits to packages which
                   4444:           have at one time been included in pkgsrc. The database
                   4445:           can be downloaded automatically, and a security audit of
                   4446:           all packages installed on a system can take place. To do
                   4447:           this, install the <a xmlns=
                   4448:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4449:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.14    ! xtraeme  4450:           class="pkgname">security/audit-packages</a> package. It
        !          4451:           has two components:</p>
1.1       grant    4452: 
                   4453:           <div class="orderedlist">
                   4454:             <ol type="1">
                   4455:               <li>
                   4456:                 <p>&#8220;<span class=
                   4457:                 "quote">download-vulnerability-list</span>&#8221;,
                   4458:                 an easy way to download a list of the security
                   4459:                 vulnerabilities information. This list is kept up
                   4460:                 to date by the NetBSD security officer and the
                   4461:                 NetBSD packages team, and is distributed from the
                   4462:                 NetBSD ftp server:</p>
                   4463: 
                   4464:                 <p><a href=
                   4465:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.14    ! xtraeme  4466:                 target=
        !          4467:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    4468:               </li>
                   4469: 
                   4470:               <li>
                   4471:                 <p>&#8220;<span class=
                   4472:                 "quote">audit-packages</span>&#8221;, an easy way
                   4473:                 to audit the current machine, checking each
                   4474:                 vulnerability which is known. If a vulnerable
                   4475:                 package is installed, it will be shown by output to
                   4476:                 stdout, including a description of the type of
                   4477:                 vulnerability, and a URL containing more
                   4478:                 information.</p>
                   4479:               </li>
                   4480:             </ol>
                   4481:           </div>
                   4482: 
                   4483:           <p>Use of the audit-packages package is strongly
                   4484:           recommended!</p>
                   4485: 
                   4486:           <p>The following message is displayed as part of the
                   4487:           audit-packages installation procedure:</p>
                   4488:           <pre class="screen">
                   4489: ===========================================================================
1.11      ben      4490: $NetBSD: faq.xml,v 1.2 2004/11/20 13:25:22 hubertf Exp $
1.1       grant    4491: 
                   4492: You may wish to have the vulnerabilities file downloaded daily so that
                   4493: it remains current.  This may be done by adding an appropriate entry
                   4494: to the root users crontab(5) entry.  For example the entry
                   4495: 
                   4496: # download vulnerabilities file
                   4497: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list &gt;/dev/null 2&gt;&amp;1
                   4498: 
                   4499: will update the vulnerability list every day at 3AM. You may wish to do
                   4500: this more often than once a day.
                   4501: 
                   4502: In addition, you may wish to run the package audit from the daily
                   4503: security script.  This may be accomplished by adding the following
                   4504: lines to /etc/security.local
                   4505: 
                   4506: if [ -x ${PREFIX}/sbin/audit-packages ]; then
                   4507:           ${PREFIX}/sbin/audit-packages
                   4508: fi
                   4509: 
                   4510: ===========================================================================
                   4511:     
                   4512: </pre>
                   4513:         </div>
                   4514:       </div>
                   4515:     </div>
                   4516: 
                   4517:     <div class="part" lang="en" xml:lang="en">
                   4518:       <div class="titlepage">
                   4519:         <div>
                   4520:           <div>
                   4521:             <h1 class="title"><a name="developers-guide" id=
1.2       hubertf  4522:             "developers-guide"></a>The pkgsrc developer's
                   4523:             guide</h1>
1.1       grant    4524:           </div>
                   4525:         </div>
                   4526:       </div>
                   4527: 
                   4528:       <div class="toc">
                   4529:         <p><b>Table of Contents</b></p>
                   4530: 
                   4531:         <dl>
                   4532:           <dt><span class="chapter"><a href="#components">7.
                   4533:           Package components - files, directories and
                   4534:           contents</a></span></dt>
                   4535: 
                   4536:           <dd>
                   4537:             <dl>
                   4538:               <dt><span class="sect1"><a href=
1.14    ! xtraeme  4539:               "#components.Makefile">7.1. <code class=
        !          4540:               "filename">Makefile</code></a></span></dt>
1.1       grant    4541: 
                   4542:               <dt><span class="sect1"><a href=
1.14    ! xtraeme  4543:               "#components.distinfo">7.2. <code class=
        !          4544:               "filename">distinfo</code></a></span></dt>
1.1       grant    4545: 
                   4546:               <dt><span class="sect1"><a href=
                   4547:               "#components.patches">7.3. patches/*</a></span></dt>
                   4548: 
1.14    ! xtraeme  4549:               <dt><span class="sect1"><a href="#id2586509">7.4.
1.1       grant    4550:               Other mandatory files</a></span></dt>
                   4551: 
                   4552:               <dt><span class="sect1"><a href=
                   4553:               "#components.optional">7.5. Optional
                   4554:               files</a></span></dt>
                   4555: 
1.14    ! xtraeme  4556:               <dt><span class="sect1"><a href="#id2586635">7.6.
        !          4557:               <code class="filename">work*</code></a></span></dt>
1.1       grant    4558: 
1.14    ! xtraeme  4559:               <dt><span class="sect1"><a href="#id2586791">7.7.
        !          4560:               <code class="filename">files/*</code></a></span></dt>
1.1       grant    4561:             </dl>
                   4562:           </dd>
                   4563: 
                   4564:           <dt><span class="chapter"><a href="#plist">8. PLIST
                   4565:           issues</a></span></dt>
                   4566: 
                   4567:           <dd>
                   4568:             <dl>
1.14    ! xtraeme  4569:               <dt><span class="sect1"><a href="#id2586845">8.1. RCS
1.1       grant    4570:               ID</a></span></dt>
                   4571: 
1.14    ! xtraeme  4572:               <dt><span class="sect1"><a href="#id2586860">8.2.
        !          4573:               Semi-automatic <code class="filename">PLIST</code>
        !          4574:               generation</a></span></dt>
1.1       grant    4575: 
                   4576:               <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14    ! xtraeme  4577:               Tweaking output of <span><strong class="command">make
        !          4578:               print-PLIST</strong></span></a></span></dt>
1.1       grant    4579: 
                   4580:               <dt><span class="sect1"><a href="#plist.misc">8.4.
                   4581:               Variable substitution in PLIST</a></span></dt>
                   4582: 
1.14    ! xtraeme  4583:               <dt><span class="sect1"><a href="#id2587181">8.5.
1.1       grant    4584:               Manpage-compression</a></span></dt>
                   4585: 
1.14    ! xtraeme  4586:               <dt><span class="sect1"><a href="#id2587223">8.6.
        !          4587:               Changing PLIST source with <code class=
        !          4588:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    4589: 
1.14    ! xtraeme  4590:               <dt><span class="sect1"><a href="#id2587240">8.7.
1.1       grant    4591:               Platform specific and differing
                   4592:               PLISTs</a></span></dt>
                   4593: 
                   4594:               <dt><span class="sect1"><a href=
                   4595:               "#faq.common-dirs">8.8. Sharing directories between
                   4596:               packages</a></span></dt>
                   4597:             </dl>
                   4598:           </dd>
                   4599: 
                   4600:           <dt><span class="chapter"><a href="#buildlink">9.
                   4601:           Buildlink methodology</a></span></dt>
                   4602: 
                   4603:           <dd>
                   4604:             <dl>
1.14    ! xtraeme  4605:               <dt><span class="sect1"><a href="#id2587717">9.1.
1.1       grant    4606:               Converting packages to use buildlink3</a></span></dt>
                   4607: 
1.14    ! xtraeme  4608:               <dt><span class="sect1"><a href="#id2587908">9.2.
        !          4609:               Writing <code class="filename">buildlink3.mk</code>
        !          4610:               files</a></span></dt>
1.1       grant    4611: 
                   4612:               <dd>
                   4613:                 <dl>
                   4614:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4615:                   "#id2587977">9.2.1. Anatomy of a buildlink3.mk
1.1       grant    4616:                   file</a></span></dt>
                   4617: 
                   4618:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4619:                   "#id2588349">9.2.2. Updating <code class=
        !          4620:                   "varname">BUILDLINK_DEPENDS.<em class=
        !          4621:                   "replaceable"><code>pkg</code></em></code> in
        !          4622:                   <code class="filename">buildlink3.mk</code>
1.1       grant    4623:                   files</a></span></dt>
                   4624:                 </dl>
                   4625:               </dd>
                   4626: 
1.14    ! xtraeme  4627:               <dt><span class="sect1"><a href="#id2588428">9.3.
        !          4628:               Writing <code class="filename">builtin.mk</code>
        !          4629:               files</a></span></dt>
1.1       grant    4630: 
                   4631:               <dd>
                   4632:                 <dl>
                   4633:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4634:                   "#id2588578">9.3.1. Anatomy of a <code class=
        !          4635:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    4636: 
                   4637:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4638:                   "#id2588873">9.3.2. Global preferences for native
1.1       grant    4639:                   or pkgsrc software</a></span></dt>
                   4640:                 </dl>
                   4641:               </dd>
                   4642:             </dl>
                   4643:           </dd>
                   4644: 
                   4645:           <dt><span class="chapter"><a href="#options">10. Options
                   4646:           handling</a></span></dt>
                   4647: 
                   4648:           <dd>
                   4649:             <dl>
1.14    ! xtraeme  4650:               <dt><span class="sect1"><a href="#id2588946">10.1.
1.1       grant    4651:               Global default options</a></span></dt>
                   4652: 
1.14    ! xtraeme  4653:               <dt><span class="sect1"><a href="#id2588961">10.2.
        !          4654:               Converting packages to use <code class=
        !          4655:               "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    4656:             </dl>
                   4657:           </dd>
                   4658: 
                   4659:           <dt><span class="chapter"><a href="#build">11. The build
                   4660:           process</a></span></dt>
                   4661: 
                   4662:           <dd>
                   4663:             <dl>
                   4664:               <dt><span class="sect1"><a href="#build.prefix">11.1.
                   4665:               Program location</a></span></dt>
                   4666: 
1.14    ! xtraeme  4667:               <dt><span class="sect1"><a href="#id2589569">11.2.
1.1       grant    4668:               Main targets</a></span></dt>
                   4669: 
                   4670:               <dt><span class="sect1"><a href=
                   4671:               "#build.helpful-targets">11.3. Other helpful
                   4672:               targets</a></span></dt>
                   4673:             </dl>
                   4674:           </dd>
                   4675: 
                   4676:           <dt><span class="chapter"><a href="#fixes">12. Notes on
                   4677:           fixes for packages</a></span></dt>
                   4678: 
                   4679:           <dd>
                   4680:             <dl>
1.14    ! xtraeme  4681:               <dt><span class="sect1"><a href="#id2590969">12.1.
1.1       grant    4682:               General operation</a></span></dt>
                   4683: 
                   4684:               <dd>
                   4685:                 <dl>
                   4686:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4687:                   "#id2590972">12.1.1. How to pull in variables
1.1       grant    4688:                   from /etc/mk.conf</a></span></dt>
                   4689: 
                   4690:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4691:                   "#id2591124">12.1.2. Restricted
1.1       grant    4692:                   packages</a></span></dt>
                   4693: 
                   4694:                   <dt><span class="sect2"><a href=
                   4695:                   "#dependencies">12.1.3. Handling
                   4696:                   dependencies</a></span></dt>
                   4697: 
                   4698:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4699:                   "#id2591639">12.1.4. Handling conflicts with
1.1       grant    4700:                   other packages</a></span></dt>
                   4701: 
                   4702:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4703:                   "#id2591757">12.1.5. Packages that cannot or
1.1       grant    4704:                   should not be built</a></span></dt>
                   4705: 
                   4706:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4707:                   "#id2591783">12.1.6. Packages which should not be
1.1       grant    4708:                   deleted, once installed</a></span></dt>
                   4709: 
                   4710:                   <dt><span class="sect2"><a href=
                   4711:                   "#security-handling">12.1.7. Handling packages
                   4712:                   with security problems</a></span></dt>
                   4713: 
                   4714:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4715:                   "#id2591875">12.1.8. How to handle compiler
1.1       grant    4716:                   bugs</a></span></dt>
                   4717: 
                   4718:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4719:                   "#id2591897">12.1.9. How to handle incrementing
1.1       grant    4720:                   versions when fixing an existing
                   4721:                   package</a></span></dt>
                   4722: 
                   4723:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4724:                   "#id2591946">12.1.10. Portability of
1.1       grant    4725:                   packages</a></span></dt>
                   4726:                 </dl>
                   4727:               </dd>
                   4728: 
1.14    ! xtraeme  4729:               <dt><span class="sect1"><a href="#id2591971">12.2.
1.1       grant    4730:               Possible downloading issues</a></span></dt>
                   4731: 
                   4732:               <dd>
                   4733:                 <dl>
                   4734:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4735:                   "#id2591974">12.2.1. Packages whose distfiles
1.1       grant    4736:                   aren't available for plain
                   4737:                   downloading</a></span></dt>
                   4738: 
                   4739:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4740:                   "#id2592105">12.2.2. How to handle modified
1.1       grant    4741:                   distfiles with the 'old' name</a></span></dt>
                   4742:                 </dl>
                   4743:               </dd>
                   4744: 
1.14    ! xtraeme  4745:               <dt><span class="sect1"><a href="#id2592117">12.3.
1.1       grant    4746:               Configuration gotchas</a></span></dt>
                   4747: 
                   4748:               <dd>
                   4749:                 <dl>
                   4750:                   <dt><span class="sect2"><a href=
                   4751:                   "#fixes.libtool">12.3.1. Shared libraries -
                   4752:                   libtool</a></span></dt>
                   4753: 
                   4754:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4755:                   "#id2592593">12.3.2. Using libtool on GNU
1.1       grant    4756:                   packages that already support
                   4757:                   libtool</a></span></dt>
                   4758: 
                   4759:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4760:                   "#id2592677">12.3.3. GNU
1.1       grant    4761:                   Autoconf/Automake</a></span></dt>
                   4762:                 </dl>
                   4763:               </dd>
                   4764: 
1.14    ! xtraeme  4765:               <dt><span class="sect1"><a href="#id2592790">12.4.
1.1       grant    4766:               Building considerations</a></span></dt>
                   4767: 
                   4768:               <dd>
                   4769:                 <dl>
                   4770:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4771:                   "#id2592793">12.4.1. CPP defines</a></span></dt>
1.1       grant    4772:                 </dl>
                   4773:               </dd>
                   4774: 
1.14    ! xtraeme  4775:               <dt><span class="sect1"><a href="#id2592823">12.5.
1.1       grant    4776:               Package specific actions</a></span></dt>
                   4777: 
                   4778:               <dd>
                   4779:                 <dl>
                   4780:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4781:                   "#id2592826">12.5.1. Package configuration
1.1       grant    4782:                   files</a></span></dt>
                   4783: 
                   4784:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4785:                   "#id2592929">12.5.2. User
1.2       hubertf  4786:                   interaction</a></span></dt>
1.1       grant    4787: 
                   4788:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4789:                   "#id2593042">12.5.3. Handling
1.1       grant    4790:                   licenses</a></span></dt>
                   4791: 
                   4792:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4793:                   "#id2593193">12.5.4. Creating an account from a
1.1       grant    4794:                   package</a></span></dt>
                   4795: 
                   4796:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4797:                   "#id2593392">12.5.5. Installing score
1.1       grant    4798:                   files</a></span></dt>
                   4799: 
                   4800:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4801:                   "#id2593435">12.5.6. Packages providing login
1.1       grant    4802:                   shells</a></span></dt>
                   4803: 
                   4804:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4805:                   "#id2593493">12.5.7. Packages containing perl
1.1       grant    4806:                   scripts</a></span></dt>
                   4807: 
                   4808:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4809:                   "#id2593511">12.5.8. Packages with hardcoded
1.1       grant    4810:                   paths to other interpreters</a></span></dt>
                   4811: 
                   4812:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4813:                   "#id2593532">12.5.9. Packages installing perl
1.1       grant    4814:                   modules</a></span></dt>
                   4815: 
                   4816:                   <dt><span class="sect2"><a href=
                   4817:                   "#faq.info-files">12.5.10. Packages installing
                   4818:                   info files</a></span></dt>
                   4819: 
                   4820:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4821:                   "#id2593752">12.5.11. Packages installing GConf2
1.1       grant    4822:                   data files</a></span></dt>
                   4823: 
                   4824:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4825:                   "#id2593852">12.5.12. Packages installing
1.1       grant    4826:                   scrollkeeper data files</a></span></dt>
                   4827: 
                   4828:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4829:                   "#id2593904">12.5.13. Packages installing X11
1.1       grant    4830:                   fonts</a></span></dt>
                   4831: 
                   4832:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4833:                   "#id2593950">12.5.14. Packages installing GTK2
1.1       grant    4834:                   modules</a></span></dt>
                   4835: 
                   4836:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4837:                   "#id2594020">12.5.15. Packages installing SGML or
1.1       grant    4838:                   XML data</a></span></dt>
                   4839: 
                   4840:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4841:                   "#id2594140">12.5.16. Packages installing
1.1       grant    4842:                   extensions to the MIME database</a></span></dt>
                   4843: 
                   4844:                   <dt><span class="sect2"><a href=
1.14    ! xtraeme  4845:                   "#id2594347">12.5.17. Packages using
1.1       grant    4846:                   intltool</a></span></dt>
                   4847:                 </dl>
                   4848:               </dd>
                   4849: 
1.14    ! xtraeme  4850:               <dt><span class="sect1"><a href="#id2594361">12.6.
1.1       grant    4851:               Feedback to the author</a></span></dt>
                   4852:             </dl>
                   4853:           </dd>
                   4854: 
                   4855:           <dt><span class="chapter"><a href="#debug">13.
                   4856:           Debugging</a></span></dt>
                   4857: 
                   4858:           <dt><span class="chapter"><a href="#submit">14.
                   4859:           Submitting and Committing</a></span></dt>
                   4860: 
                   4861:           <dd>
                   4862:             <dl>
1.14    ! xtraeme  4863:               <dt><span class="sect1"><a href="#id2594823">14.1.
1.1       grant    4864:               Submitting your packages</a></span></dt>
                   4865: 
1.14    ! xtraeme  4866:               <dt><span class="sect1"><a href="#id2594874">14.2.
1.1       grant    4867:               Committing: Importing a package into
                   4868:               CVS</a></span></dt>
                   4869: 
1.14    ! xtraeme  4870:               <dt><span class="sect1"><a href="#id2595005">14.3.
1.2       hubertf  4871:               Updating a package to a newer version</a></span></dt>
1.1       grant    4872: 
1.14    ! xtraeme  4873:               <dt><span class="sect1"><a href="#id2595161">14.4.
1.2       hubertf  4874:               Moving a package in pkgsrc</a></span></dt>
1.1       grant    4875:             </dl>
                   4876:           </dd>
                   4877:         </dl>
                   4878:       </div>
                   4879: 
                   4880:       <div class="chapter" lang="en" xml:lang="en">
                   4881:         <div class="titlepage">
                   4882:           <div>
                   4883:             <div>
                   4884:               <h2 class="title"><a name="components" id=
                   4885:               "components"></a>Chapter&nbsp;7.&nbsp;Package
                   4886:               components - files, directories and contents</h2>
                   4887:             </div>
                   4888:           </div>
                   4889:         </div>
                   4890: 
                   4891:         <div class="toc">
                   4892:           <p><b>Table of Contents</b></p>
                   4893: 
                   4894:           <dl>
                   4895:             <dt><span class="sect1"><a href=
1.14    ! xtraeme  4896:             "#components.Makefile">7.1. <code class=
        !          4897:             "filename">Makefile</code></a></span></dt>
1.1       grant    4898: 
                   4899:             <dt><span class="sect1"><a href=
1.14    ! xtraeme  4900:             "#components.distinfo">7.2. <code class=
        !          4901:             "filename">distinfo</code></a></span></dt>
1.1       grant    4902: 
                   4903:             <dt><span class="sect1"><a href=
                   4904:             "#components.patches">7.3. patches/*</a></span></dt>
                   4905: 
1.14    ! xtraeme  4906:             <dt><span class="sect1"><a href="#id2586509">7.4. Other
1.1       grant    4907:             mandatory files</a></span></dt>
                   4908: 
                   4909:             <dt><span class="sect1"><a href=
                   4910:             "#components.optional">7.5. Optional
                   4911:             files</a></span></dt>
                   4912: 
1.14    ! xtraeme  4913:             <dt><span class="sect1"><a href="#id2586635">7.6.
        !          4914:             <code class="filename">work*</code></a></span></dt>
1.1       grant    4915: 
1.14    ! xtraeme  4916:             <dt><span class="sect1"><a href="#id2586791">7.7.
        !          4917:             <code class="filename">files/*</code></a></span></dt>
1.1       grant    4918:           </dl>
                   4919:         </div>
                   4920: 
                   4921:         <p>Whenever you're preparing a package, there are a number
                   4922:         of files involved which are described in the following
                   4923:         sections.</p>
                   4924: 
                   4925:         <div class="sect1" lang="en" xml:lang="en">
                   4926:           <div class="titlepage">
                   4927:             <div>
                   4928:               <div>
                   4929:                 <h2 class="title" style="clear: both"><a name=
                   4930:                 "components.Makefile" id=
1.14    ! xtraeme  4931:                 "components.Makefile"></a>7.1.&nbsp;<code class=
        !          4932:                 "filename">Makefile</code></h2>
1.1       grant    4933:               </div>
                   4934:             </div>
                   4935:           </div>
                   4936: 
                   4937:           <p>Building, installation and creation of a binary
1.14    ! xtraeme  4938:           package are all controlled by the package's <code class=
        !          4939:           "filename">Makefile</code>.</p>
1.1       grant    4940: 
1.14    ! xtraeme  4941:           <p>There is a <code class="filename">Makefile</code> for
        !          4942:           each package. This file includes the standard
        !          4943:           <code class="filename">bsd.pkg.mk</code> file (referenced
        !          4944:           as <code class="filename">../../mk/bsd.pkg.mk</code>),
        !          4945:           which sets all the definitions and actions necessary for
        !          4946:           the package to compile and install itself. The mandatory
        !          4947:           variables are the <code class="varname">DISTNAME</code>
        !          4948:           which specifies the base name of the distribution file to
        !          4949:           be downloaded from the site on the Internet, <code class=
        !          4950:           "varname">MASTER_SITES</code> which specifies that site,
        !          4951:           <code class="varname">CATEGORIES</code> which denotes the
        !          4952:           categories into which the package falls, <code class=
        !          4953:           "varname">PKGNAME</code> which is the name of the
        !          4954:           package, the <code class="varname">MAINTAINER</code>'s
        !          4955:           name, and the <code class="varname">COMMENT</code>
        !          4956:           variable, which should contain a one-line description of
        !          4957:           the package (the package name should not appear, it will
        !          4958:           be added automatically). The maintainer variable is there
        !          4959:           so that anyone who quibbles with the (always completely
        !          4960:           correct) decisions taken by the guy who maintains the
        !          4961:           package can complain vigorously, or send chocolate as a
        !          4962:           sign of appreciation.</p>
1.1       grant    4963: 
1.14    ! xtraeme  4964:           <p>The <code class="varname">MASTER_SITES</code> may be
        !          4965:           set to one of the predefined sites:</p>
1.1       grant    4966:           <pre class="programlisting">
                   4967:         ${MASTER_SITE_APACHE}
                   4968:         ${MASTER_SITE_DEBIAN}
                   4969:         ${MASTER_SITE_GNOME}
                   4970:         ${MASTER_SITE_GNU}
                   4971:         ${MASTER_SITE_GNUSTEP}
1.9       dillo    4972:         ${MASTER_SITE_IFARCHIVE}
1.1       grant    4973:         ${MASTER_SITE_MOZILLA}
                   4974:         ${MASTER_SITE_PERL_CPAN}
                   4975:         ${MASTER_SITE_SOURCEFORGE}
                   4976:         ${MASTER_SITE_SUNSITE}
                   4977:         ${MASTER_SITE_R_CRAN}
                   4978:         ${MASTER_SITE_SUSE}
                   4979:         ${MASTER_SITE_TEX_CTAN}
                   4980:         ${MASTER_SITE_XCONTRIB}
                   4981:         ${MASTER_SITE_XEMACS} 
                   4982: </pre>
                   4983: 
                   4984:           <p>If one of these predefined sites is chosen, you may
                   4985:           require the ability to specify a subdirectory of that
                   4986:           site. Since these macros may expand to more than one
                   4987:           actual site, you <span class=
                   4988:           "emphasis"><em>must</em></span> use the following
                   4989:           construct to specify a subdirectory:</p>
                   4990:           <pre class="programlisting">
                   4991:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   4992:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   4993: </pre>
                   4994: 
                   4995:           <p>Note the trailing slash after the subdirectory
                   4996:           name.</p>
                   4997: 
                   4998:           <div class="note" style=
                   4999:           "margin-left: 0.5in; margin-right: 0.5in;">
                   5000:             <h3 class="title">Note</h3>
                   5001: 
1.14    ! xtraeme  5002:             <p><code class="varname">MASTER_SITE_SUBDIR</code> has
        !          5003:             been deprecated and <span class="emphasis"><em>should
        !          5004:             no longer be used</em></span>.</p>
1.1       grant    5005:           </div>
                   5006: 
1.14    ! xtraeme  5007:           <p>If the package has multiple <code class=
        !          5008:           "varname">DISTFILES</code> or multiple <code class=
        !          5009:           "varname">PATCHFILES</code> from different sites, set
        !          5010:           <code class="varname">SITES_foo</code> to a list of URI's
1.1       grant    5011:           where file &#8220;<span class="quote">foo</span>&#8221;
                   5012:           may be found. &#8220;<span class=
                   5013:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   5014:           <pre class="programlisting">
                   5015: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   5016: DISTFILES+=     foo-file.tar.gz
                   5017: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   5018:         http://www.somewhereelse.com/mirror/somehow/
                   5019: </pre>
                   5020: 
1.14    ! xtraeme  5021:           <p>Note that the normal default setting of <code class=
        !          5022:           "varname">DISTFILES</code> must be made explicit if you
1.1       grant    5023:           want to add to it (rather than replace it), as you
                   5024:           usually would.</p>
                   5025: 
                   5026:           <p>Currently the following values are available for
1.14    ! xtraeme  5027:           <code class="varname">CATEGORIES</code>. If more than one
        !          5028:           is used, they need to be separated by spaces:</p>
1.1       grant    5029:           <pre class="programlisting">
                   5030: archivers     cross         geography     meta-pkgs     security
                   5031: audio         databases     graphics      misc          shells
                   5032: benchmarks    devel         ham           multimedia    sysutils
                   5033: biology       editors       inputmethod   net           textproc
                   5034: cad           emulators     lang          news          time
                   5035: chat          finance       mail          parallel      wm
                   5036: comms         fonts         math          pkgtools      www
                   5037: converters    games         mbone         print         x11
                   5038: </pre>
                   5039: 
                   5040:           <p>Please pay attention to the following gotchas:</p>
                   5041: 
                   5042:           <div class="itemizedlist">
                   5043:             <ul type="disc">
                   5044:               <li>
1.14    ! xtraeme  5045:                 <p>Add <code class="varname">MANCOMPRESSED</code>
        !          5046:                 if manpages are installed in compressed form by the
        !          5047:                 package; see comment in <code class=
        !          5048:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    5049:               </li>
                   5050: 
                   5051:               <li>
1.14    ! xtraeme  5052:                 <p>Replace <code class="filename">/usr/local</code>
1.1       grant    5053:                 with &#8220;<span class=
                   5054:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   5055:                 patches, below).</p>
                   5056:               </li>
                   5057: 
                   5058:               <li>
                   5059:                 <p>If the package installs any info files, see
                   5060:                 <a href="#faq.info-files" title=
                   5061:                 "12.5.10.&nbsp;Packages installing info files">Section
                   5062:                 12.5.10, &#8220;Packages installing info
                   5063:                 files&#8221;</a>.</p>
                   5064:               </li>
                   5065: 
                   5066:               <li>
1.14    ! xtraeme  5067:                 <p>Set <code class="varname">MAINTAINER</code> to
        !          5068:                 be yourself. If you really can't maintain the
        !          5069:                 package for future updates, set it to <code class=
1.1       grant    5070:                 "email">&lt;<a href=
1.14    ! xtraeme  5071:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.1       grant    5072:               </li>
                   5073: 
                   5074:               <li>
                   5075:                 <p>If a home page for the software in question
1.14    ! xtraeme  5076:                 exists, add the variable <code class=
        !          5077:                 "varname">HOMEPAGE</code> right after <code class=
        !          5078:                 "varname">MAINTAINER</code>. The value of this
1.1       grant    5079:                 variable should be the URL for the home page.</p>
                   5080:               </li>
                   5081: 
                   5082:               <li>
1.14    ! xtraeme  5083:                 <p>Be sure to set the <code class=
        !          5084:                 "varname">COMMENT</code> variable to a short
1.1       grant    5085:                 description of the package, not containing the
                   5086:                 pkg's name.</p>
                   5087:               </li>
                   5088:             </ul>
                   5089:           </div>
                   5090:         </div>
                   5091: 
                   5092:         <div class="sect1" lang="en" xml:lang="en">
                   5093:           <div class="titlepage">
                   5094:             <div>
                   5095:               <div>
                   5096:                 <h2 class="title" style="clear: both"><a name=
                   5097:                 "components.distinfo" id=
1.14    ! xtraeme  5098:                 "components.distinfo"></a>7.2.&nbsp;<code class=
        !          5099:                 "filename">distinfo</code></h2>
1.1       grant    5100:               </div>
                   5101:             </div>
                   5102:           </div>
                   5103: 
                   5104:           <p>Most important, the mandatory message digest, or
                   5105:           checksum, of all the distfiles needed for the package to
                   5106:           compile, confirming they match the original file
                   5107:           distributed by the author. This ensures that the distfile
                   5108:           retrieved from the Internet has not been corrupted during
                   5109:           transfer or altered by a malign force to introduce a
1.14    ! xtraeme  5110:           security hole. It is generated using the
        !          5111:           <span><strong class="command">make
        !          5112:           makesum</strong></span> command. The digest algorithm
        !          5113:           used was, at one stage, md5, but that was felt lacking
        !          5114:           compared to sha1, and so sha1 is now the default
1.1       grant    5115:           algorithm. The distfile size is also generated and stored
                   5116:           in new distinfo files. The <a xmlns=
                   5117:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5118:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.14    ! xtraeme  5119:           class="pkgname">pkgtools/digest</a> utility calculates
        !          5120:           all of the digests in the distinfo file, and it provides
        !          5121:           various different algorithms. At the current time, the
        !          5122:           algorithms provided are: <span class=
        !          5123:           "emphasis"><em>md5</em></span>, <span class=
        !          5124:           "emphasis"><em>rmd160</em></span>, <span class=
        !          5125:           "emphasis"><em>sha1</em></span>, <span class=
        !          5126:           "emphasis"><em>sha256</em></span>, <span class=
        !          5127:           "emphasis"><em>sha384</em></span> and <span class=
        !          5128:           "emphasis"><em>sha512</em></span>.</p>
1.1       grant    5129: 
                   5130:           <p>Some packages have different sets of distfiles on a
                   5131:           per architecture basis, for example <a xmlns=
                   5132:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5133:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.14    ! xtraeme  5134:           class="pkgname">www/navigator</a>). These are kept in the
        !          5135:           same distinfo file and care should be taken when
        !          5136:           upgrading such a package to ensure distfile information
        !          5137:           is not lost.</p>
1.1       grant    5138: 
                   5139:           <p>The message digest/checksum for all the official
1.14    ! xtraeme  5140:           patches found in the <code class=
        !          5141:           "filename">patches/</code> directory (see <a href=
        !          5142:           "#components.patches" title=
1.1       grant    5143:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   5144:           &#8220;patches/*&#8221;</a>) for the package is also
1.14    ! xtraeme  5145:           stored in the <code class="filename">distinfo</code>
        !          5146:           file. This is a message digest/checksum of all lines in
        !          5147:           the patch file except the NetBSD RCS Id. This file is
        !          5148:           generated by invoking <span><strong class="command">make
        !          5149:           makepatchsum</strong></span> (or <span><strong class=
        !          5150:           "command">make mps</strong></span> if you're in a
        !          5151:           hurry).</p>
1.1       grant    5152:         </div>
                   5153: 
                   5154:         <div class="sect1" lang="en" xml:lang="en">
                   5155:           <div class="titlepage">
                   5156:             <div>
                   5157:               <div>
                   5158:                 <h2 class="title" style="clear: both"><a name=
                   5159:                 "components.patches" id=
                   5160:                 "components.patches"></a>7.3.&nbsp;patches/*</h2>
                   5161:               </div>
                   5162:             </div>
                   5163:           </div>
                   5164: 
                   5165:           <p>This directory contains files that are used by the
                   5166:           <a href=
                   5167:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   5168:           <span class="citerefentry"><span class=
                   5169:           "refentrytitle">patch</span>(1)</span></a> command to
                   5170:           modify the sources as distributed in the distribution
                   5171:           file into a form that will compile and run perfectly on
                   5172:           NetBSD. The files are applied successively in alphabetic
                   5173:           order (as returned by a shell &#8220;<span class=
                   5174:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.14    ! xtraeme  5175:           <code class="filename">patch-aa</code> is applied before
        !          5176:           <code class="filename">patch-ab</code>, etc.</p>
1.1       grant    5177: 
1.14    ! xtraeme  5178:           <p>The <code class="filename">patch-*</code> files should
        !          5179:           be in <span><strong class="command">diff
        !          5180:           -bu</strong></span> format, and apply without a fuzz to
        !          5181:           avoid problems. (To force patches to apply with fuzz you
        !          5182:           can set <code class=
        !          5183:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    5184:           not put changes for more than one file into a single
                   5185:           patch-file, as this will make future modifications more
                   5186:           difficult.</p>
                   5187: 
                   5188:           <p>Similar, a file should be patched at most once, not
                   5189:           several times by several different patches. If a file
                   5190:           needs several patches, they should be combined into one
                   5191:           file.</p>
                   5192: 
                   5193:           <p>One important thing to mention is to pay attention
                   5194:           that no RCS IDs get stored in the patch files, as these
                   5195:           will cause problems when later checked into the NetBSD
1.14    ! xtraeme  5196:           CVS tree. Use the <span><strong class=
        !          5197:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    5198:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5199:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14    ! xtraeme  5200:           class="pkgname">pkgtools/pkgdiff</a> package to avoid
        !          5201:           these problems.</p>
1.1       grant    5202: 
                   5203:           <p>For even more automation, we recommend using
1.14    ! xtraeme  5204:           <span><strong class="command">mkpatches</strong></span>
        !          5205:           from the same package to make a whole set of patches. You
        !          5206:           just have to backup files before you edit them to
        !          5207:           <code class="filename">filename.orig</code>, e.g. with
        !          5208:           <span><strong class="command">cp -p filename
        !          5209:           filename.orig</strong></span> or, easier, by using
        !          5210:           <span><strong class="command">pkgvi</strong></span> again
        !          5211:           from the same package. If you upgrade a package this way,
        !          5212:           you can easily compare the new set of patches with the
        !          5213:           previously existing one with <span><strong class=
        !          5214:           "command">patchdiff</strong></span>.</p>
1.1       grant    5215: 
                   5216:           <p>When you have finished a package, remember to generate
                   5217:           the checksums for the patch files by using the
1.14    ! xtraeme  5218:           <span><strong class="command">make
        !          5219:           makepatchsum</strong></span> command, see <a href=
        !          5220:           "#components.distinfo" title=
1.5       hubertf  5221:           "7.2.&nbsp;distinfo">Section&nbsp;7.2,
1.14    ! xtraeme  5222:           &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    5223: 
                   5224:           <p>Patch files that are distributed by the author or
1.14    ! xtraeme  5225:           other maintainers can be listed in <code class=
        !          5226:           "varname">$PATCHFILES</code>.</p>
1.1       grant    5227: 
                   5228:           <p>If it is desired to store any patches that should not
                   5229:           be committed into pkgsrc, they can be kept outside the
1.14    ! xtraeme  5230:           pkgsrc tree in the <code class=
        !          5231:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    5232:           tree there is expected to have the same
                   5233:           &#8220;<span class="quote">category/package</span>&#8221;
                   5234:           structure as pkgsrc, and patches are expected to be
1.14    ! xtraeme  5235:           stored inside these dirs (also known as <code class=
        !          5236:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
        !          5237:           you want to keep a private patch for <code class=
        !          5238:           "filename">pkgsrc/graphics/png</code>, keep it in
        !          5239:           <code class=
        !          5240:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
        !          5241:           files in the named directory are expected to be patch
1.1       grant    5242:           files, and <span class="emphasis"><em>they are applied
                   5243:           after pkgsrc patches are applied</em></span>.</p>
                   5244:         </div>
                   5245: 
                   5246:         <div class="sect1" lang="en" xml:lang="en">
                   5247:           <div class="titlepage">
                   5248:             <div>
                   5249:               <div>
                   5250:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  5251:                 "id2586509" id="id2586509"></a>7.4.&nbsp;Other
1.1       grant    5252:                 mandatory files</h2>
                   5253:               </div>
                   5254:             </div>
                   5255:           </div>
                   5256: 
                   5257:           <div class="variablelist">
                   5258:             <dl>
1.14    ! xtraeme  5259:               <dt><span class="term"><code class=
        !          5260:               "filename">DESCR</code></span></dt>
1.1       grant    5261: 
                   5262:               <dd>
                   5263:                 <p>A multi-line description of the piece of
                   5264:                 software. This should include any credits where
                   5265:                 they are due. Please bear in mind that others do
                   5266:                 not share your sense of humour (or spelling
                   5267:                 idiosyncrasies), and that others will read
                   5268:                 everything that you write here.</p>
                   5269:               </dd>
                   5270: 
1.14    ! xtraeme  5271:               <dt><span class="term"><code class=
        !          5272:               "filename">PLIST</code></span></dt>
1.1       grant    5273: 
                   5274:               <dd>
                   5275:                 <p>This file governs the files that are installed
                   5276:                 on your system: all the binaries, manual pages,
                   5277:                 etc. There are other directives which may be
                   5278:                 entered in this file, to control the creation and
                   5279:                 deletion of directories, and the location of
                   5280:                 inserted files. See <a href="#plist" title=
                   5281:                 "Chapter&nbsp;8.&nbsp;PLIST issues">Chapter&nbsp;8,
                   5282:                 <i>PLIST issues</i></a> for more information.</p>
                   5283:               </dd>
                   5284:             </dl>
                   5285:           </div>
                   5286:         </div>
                   5287: 
                   5288:         <div class="sect1" lang="en" xml:lang="en">
                   5289:           <div class="titlepage">
                   5290:             <div>
                   5291:               <div>
                   5292:                 <h2 class="title" style="clear: both"><a name=
                   5293:                 "components.optional" id=
                   5294:                 "components.optional"></a>7.5.&nbsp;Optional
                   5295:                 files</h2>
                   5296:               </div>
                   5297:             </div>
                   5298:           </div>
                   5299: 
                   5300:           <div class="variablelist">
                   5301:             <dl>
1.14    ! xtraeme  5302:               <dt><span class="term"><code class=
        !          5303:               "filename">INSTALL</code></span></dt>
1.1       grant    5304: 
                   5305:               <dd>
                   5306:                 <p>This shell script is invoked twice by <a href=
                   5307:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5308:                 <span class="citerefentry"><span class=
                   5309:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   5310:                 time after package extraction and before files are
                   5311:                 moved in place, the second time after the files to
                   5312:                 install are moved in place. This can be used to do
                   5313:                 any custom procedures not possible with @exec
1.14    ! xtraeme  5314:                 commands in <code class="filename">PLIST</code>.
        !          5315:                 See <a href=
1.1       grant    5316:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5317:                 <span class="citerefentry"><span class=
                   5318:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   5319:                 <a href=
                   5320:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5321:                 <span class="citerefentry"><span class=
                   5322:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5323:                 more information.</p>
                   5324:               </dd>
                   5325: 
1.14    ! xtraeme  5326:               <dt><span class="term"><code class=
        !          5327:               "filename">DEINSTALL</code></span></dt>
1.1       grant    5328: 
                   5329:               <dd>
                   5330:                 <p>This script is executed before and after any
                   5331:                 files are removed. It is this script's
                   5332:                 responsibility to clean up any additional messy
                   5333:                 details around the package's installation, since
                   5334:                 all pkg_delete knows is how to delete the files
                   5335:                 created in the original distribution. See <a href=
                   5336:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   5337:                 <span class="citerefentry"><span class=
                   5338:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   5339:                 <a href=
                   5340:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5341:                 <span class="citerefentry"><span class=
                   5342:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5343:                 more information.</p>
                   5344:               </dd>
                   5345: 
1.14    ! xtraeme  5346:               <dt><span class="term"><code class=
        !          5347:               "filename">MESSAGE</code></span></dt>
1.1       grant    5348: 
                   5349:               <dd>
                   5350:                 <p>Display this file after installation of the
                   5351:                 package. Useful for things like legal notices on
                   5352:                 almost-free software and hints for updating config
                   5353:                 files after installing modules for apache, PHP etc.
                   5354:                 Please note that you can modify variables in it
1.14    ! xtraeme  5355:                 easily by using <code class=
        !          5356:                 "varname">MESSAGE_SUBST</code> in the package's
        !          5357:                 <code class="filename">Makefile</code>:</p>
1.1       grant    5358:                 <pre class="programlisting">
                   5359: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   5360: </pre>
                   5361: 
                   5362:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.14    ! xtraeme  5363:                 "quote">somevalue</span>&#8221; in <code class=
        !          5364:                 "filename">MESSAGE</code>.</p>
1.1       grant    5365:               </dd>
                   5366:             </dl>
                   5367:           </div>
                   5368:         </div>
                   5369: 
                   5370:         <div class="sect1" lang="en" xml:lang="en">
                   5371:           <div class="titlepage">
                   5372:             <div>
                   5373:               <div>
                   5374:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  5375:                 "id2586635" id=
        !          5376:                 "id2586635"></a>7.6.&nbsp;<code class=
        !          5377:                 "filename">work*</code></h2>
1.1       grant    5378:               </div>
                   5379:             </div>
                   5380:           </div>
                   5381: 
1.14    ! xtraeme  5382:           <p>When you type <span><strong class=
        !          5383:           "command">make</strong></span> the distribution files are
        !          5384:           unpacked into this directory. It can be removed by
        !          5385:           running <span><strong class="command">make
        !          5386:           clean</strong></span>. Besides the sources, this
        !          5387:           directory is also used to keep various timestamp
1.1       grant    5388:           files.</p>
                   5389: 
                   5390:           <p>If a package doesn't create a subdirectory for itself
                   5391:           (like GNU software does, for instance), but extracts
                   5392:           itself in the current directory, you should set
1.14    ! xtraeme  5393:           <code class="varname">WRKSRC</code> accordingly, e.g.
1.1       grant    5394:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   5395:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.14    ! xtraeme  5396:           class="pkgname">editors/sam</a> again, but the quick
        !          5397:           answer is:</p>
1.1       grant    5398:           <pre class="programlisting">
                   5399: WRKSRC=                ${WRKDIR}
                   5400: </pre>
                   5401: 
1.14    ! xtraeme  5402:           <p>Please note that the old <code class=
        !          5403:           "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1       grant    5404:           should not be used. Also, if your package doesn't create
1.14    ! xtraeme  5405:           a subdir with the name of <code class=
        !          5406:           "varname">DISTNAME</code> but some different name, set
        !          5407:           <code class="varname">WRKSRC</code> to point to the
        !          5408:           proper name in <code class="filename">${WRKDIR}</code>.
        !          5409:           See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          5410:           href=
1.1       grant    5411:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.14    ! xtraeme  5412:           class="pkgname">lang/tcl</a> and <a xmlns=
        !          5413:           "http://www.w3.org/TR/xhtml1/transitional" href=
        !          5414:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
        !          5415:           class="pkgname">x11/tk</a> for examples, and here is
        !          5416:           another one:</p>
1.1       grant    5417:           <pre class="programlisting">
                   5418: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   5419: </pre>
                   5420: 
                   5421:           <p>The name of the working directory created by pkgsrc is
1.14    ! xtraeme  5422:           <code class="filename">work</code> by default. If the
        !          5423:           same pkgsrc tree should be used on several different
        !          5424:           platforms, the variable <code class=
        !          5425:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1       grant    5426:           attach the platform to the directory name, e.g.
1.14    ! xtraeme  5427:           <code class="filename">work.i386</code> or <code class=
        !          5428:           "filename">work.sparc</code>.</p>
1.1       grant    5429:         </div>
                   5430: 
                   5431:         <div class="sect1" lang="en" xml:lang="en">
                   5432:           <div class="titlepage">
                   5433:             <div>
                   5434:               <div>
                   5435:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  5436:                 "id2586791" id=
        !          5437:                 "id2586791"></a>7.7.&nbsp;<code class=
        !          5438:                 "filename">files/*</code></h2>
1.1       grant    5439:               </div>
                   5440:             </div>
                   5441:           </div>
                   5442: 
                   5443:           <p>If you have any files that you wish to be placed in
                   5444:           the package prior to configuration or building, you could
                   5445:           place these files here and use a &#8220;<span class=
                   5446:           "quote">${CP}</span>&#8221; command in the
                   5447:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   5448:           target to achieve this. Alternatively, you could simply
1.14    ! xtraeme  5449:           diff the file against <code class=
        !          5450:           "filename">/dev/null</code> and use the patch mechanism
        !          5451:           to manage the creation of this file.</p>
1.1       grant    5452:         </div>
                   5453:       </div>
                   5454: 
                   5455:       <div class="chapter" lang="en" xml:lang="en">
                   5456:         <div class="titlepage">
                   5457:           <div>
                   5458:             <div>
                   5459:               <h2 class="title"><a name="plist" id=
                   5460:               "plist"></a>Chapter&nbsp;8.&nbsp;PLIST issues</h2>
                   5461:             </div>
                   5462:           </div>
                   5463:         </div>
                   5464: 
                   5465:         <div class="toc">
                   5466:           <p><b>Table of Contents</b></p>
                   5467: 
                   5468:           <dl>
1.14    ! xtraeme  5469:             <dt><span class="sect1"><a href="#id2586845">8.1. RCS
1.1       grant    5470:             ID</a></span></dt>
                   5471: 
1.14    ! xtraeme  5472:             <dt><span class="sect1"><a href="#id2586860">8.2.
        !          5473:             Semi-automatic <code class="filename">PLIST</code>
        !          5474:             generation</a></span></dt>
1.1       grant    5475: 
                   5476:             <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14    ! xtraeme  5477:             Tweaking output of <span><strong class="command">make
        !          5478:             print-PLIST</strong></span></a></span></dt>
1.1       grant    5479: 
                   5480:             <dt><span class="sect1"><a href="#plist.misc">8.4.
                   5481:             Variable substitution in PLIST</a></span></dt>
                   5482: 
1.14    ! xtraeme  5483:             <dt><span class="sect1"><a href="#id2587181">8.5.
1.1       grant    5484:             Manpage-compression</a></span></dt>
                   5485: 
1.14    ! xtraeme  5486:             <dt><span class="sect1"><a href="#id2587223">8.6.
        !          5487:             Changing PLIST source with <code class=
        !          5488:             "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5489: 
1.14    ! xtraeme  5490:             <dt><span class="sect1"><a href="#id2587240">8.7.
1.1       grant    5491:             Platform specific and differing PLISTs</a></span></dt>
                   5492: 
                   5493:             <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
                   5494:             Sharing directories between packages</a></span></dt>
                   5495:           </dl>
                   5496:         </div>
                   5497: 
1.14    ! xtraeme  5498:         <p>The <code class="filename">PLIST</code> file contains a
1.1       grant    5499:         package's &#8220;<span class="quote">packing
                   5500:         list</span>&#8221;, i.e. a list of files that belong to the
1.14    ! xtraeme  5501:         package (relative to the <code class=
        !          5502:         "filename">${PREFIX}</code> directory it's been installed
        !          5503:         in) plus some additional statements - see the <a href=
1.1       grant    5504:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5505:         <span class="citerefentry"><span class=
                   5506:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   5507:         a full list. This chapter addresses some issues that need
1.14    ! xtraeme  5508:         attention when dealing with the <code class=
        !          5509:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    5510: 
                   5511:         <div class="sect1" lang="en" xml:lang="en">
                   5512:           <div class="titlepage">
                   5513:             <div>
                   5514:               <div>
                   5515:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  5516:                 "id2586845" id="id2586845"></a>8.1.&nbsp;RCS
1.1       grant    5517:                 ID</h2>
                   5518:               </div>
                   5519:             </div>
                   5520:           </div>
                   5521: 
                   5522:           <p>Be sure to add a RCS ID line as the first thing in any
1.14    ! xtraeme  5523:           <code class="filename">PLIST</code> file you write:</p>
1.1       grant    5524:           <pre class="programlisting">
1.11      ben      5525: @comment $NetBSD$
1.1       grant    5526: </pre>
                   5527:         </div>
                   5528: 
                   5529:         <div class="sect1" lang="en" xml:lang="en">
                   5530:           <div class="titlepage">
                   5531:             <div>
                   5532:               <div>
                   5533:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  5534:                 "id2586860" id=
        !          5535:                 "id2586860"></a>8.2.&nbsp;Semi-automatic
        !          5536:                 <code class="filename">PLIST</code> generation</h2>
1.1       grant    5537:               </div>
                   5538:             </div>
                   5539:           </div>
                   5540: 
1.14    ! xtraeme  5541:           <p>You can use the <span><strong class="command">make
        !          5542:           print-PLIST</strong></span> command to output a PLIST
        !          5543:           that matches any new files since the package was
        !          5544:           extracted. See <a href="#build.helpful-targets" title=
1.1       grant    5545:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   5546:           &#8220;Other helpful targets&#8221;</a> for more
                   5547:           information on this target.</p>
                   5548:         </div>
                   5549: 
                   5550:         <div class="sect1" lang="en" xml:lang="en">
                   5551:           <div class="titlepage">
                   5552:             <div>
                   5553:               <div>
                   5554:                 <h2 class="title" style="clear: both"><a name=
                   5555:                 "print-PLIST" id=
                   5556:                 "print-PLIST"></a>8.3.&nbsp;Tweaking output of
1.14    ! xtraeme  5557:                 <span><strong class="command">make
        !          5558:                 print-PLIST</strong></span></h2>
1.1       grant    5559:               </div>
                   5560:             </div>
                   5561:           </div>
                   5562: 
                   5563:           <p>If you have used any of the *-dirs packages, as
                   5564:           explained in <a href="#faq.common-dirs" title=
                   5565:           "8.8.&nbsp;Sharing directories between packages">Section&nbsp;8.8,
                   5566:           &#8220;Sharing directories between packages&#8221;</a>,
1.14    ! xtraeme  5567:           you may have noticed that <span><strong class=
        !          5568:           "command">make print-PLIST</strong></span> outputs a set
        !          5569:           of <code class="varname">@comment</code>s instead of real
        !          5570:           <code class="varname">@dirrm</code> lines. You can also
        !          5571:           do this for specific directories and files, so that the
        !          5572:           results of that command are very close to reality. This
        !          5573:           helps <span class="emphasis"><em>a lot</em></span> during
        !          5574:           the update of packages.</p>
        !          5575: 
        !          5576:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
        !          5577:           variable takes a set of AWK patterns and actions that are
        !          5578:           used to filter the output of print-PLIST. You can
        !          5579:           <span class="emphasis"><em>append</em></span> any chunk
        !          5580:           of AWK scripting you like to it, but be careful with
1.1       grant    5581:           quoting.</p>
                   5582: 
1.14    ! xtraeme  5583:           <p>For example, to get all files inside the <code class=
        !          5584:           "filename">libdata/foo</code> directory removed from the
1.1       grant    5585:           resulting PLIST:</p>
                   5586:           <pre class="programlisting">
                   5587:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   5588:     
                   5589: </pre>
                   5590: 
1.14    ! xtraeme  5591:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    5592:           lines referring to a specific (shared) directory
1.14    ! xtraeme  5593:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    5594:           <pre class="programlisting">
                   5595:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   5596:     
                   5597: </pre>
                   5598:         </div>
                   5599: 
                   5600:         <div class="sect1" lang="en" xml:lang="en">
                   5601:           <div class="titlepage">
                   5602:             <div>
                   5603:               <div>
                   5604:                 <h2 class="title" style="clear: both"><a name=
                   5605:                 "plist.misc" id="plist.misc"></a>8.4.&nbsp;Variable
                   5606:                 substitution in PLIST</h2>
                   5607:               </div>
                   5608:             </div>
                   5609:           </div>
                   5610: 
                   5611:           <p>A number of variables are substituted automatically in
                   5612:           PLISTs when a package is installed on a system. This
                   5613:           includes the following variables:</p>
                   5614: 
                   5615:           <div class="variablelist">
                   5616:             <dl>
1.14    ! xtraeme  5617:               <dt><span class="term"><code class=
        !          5618:               "varname">${MACHINE_ARCH}</code>, <code class=
        !          5619:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    5620: 
                   5621:               <dd>
                   5622:                 <p>Some packages like emacs and perl embed
                   5623:                 information about which architecture they were
                   5624:                 built on into the pathnames where they install
                   5625:                 their file. To handle this case, PLIST will be
                   5626:                 preprocessed before actually used, and the symbol
1.14    ! xtraeme  5627:                 &#8220;<span class="quote"><code class=
        !          5628:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
        !          5629:                 be replaced by what <span><strong class=
        !          5630:                 "command">uname -p</strong></span> gives. The same
        !          5631:                 is done if the string <code class=
        !          5632:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
        !          5633:                 PLIST somewhere - use this on packages that have
        !          5634:                 GNU autoconf created configure scripts.</p>
1.1       grant    5635: 
                   5636:                 <div class="note" style=
                   5637:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   5638:                   <h3 class="title">Legacy note</h3>
                   5639: 
                   5640:                   <p>There used to be a symbol &#8220;<span class=
1.14    ! xtraeme  5641:                   "quote"><code class=
        !          5642:                   "varname">$ARCH</code></span>&#8221; that was
        !          5643:                   replaced by the output of <span><strong class=
        !          5644:                   "command">uname -m</strong></span>, but that's no
1.1       grant    5645:                   longer supported and has been removed.</p>
                   5646:                 </div>
                   5647:               </dd>
                   5648: 
1.14    ! xtraeme  5649:               <dt><span class="term"><code class=
        !          5650:               "varname">${OPSYS}</code>, <code class=
        !          5651:               "varname">${LOWER_OPSYS}</code>, <code class=
        !          5652:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    5653: 
                   5654:               <dd>
                   5655:                 <p>Some packages want to embed the OS name and
                   5656:                 version into some paths. To do this, use these
1.14    ! xtraeme  5657:                 variables in the <code class=
        !          5658:                 "filename">PLIST</code>:</p>
1.1       grant    5659: 
                   5660:                 <div class="itemizedlist">
                   5661:                   <ul type="disc">
                   5662:                     <li>
1.14    ! xtraeme  5663:                       <p><code class="varname">${OPSYS}</code> -
        !          5664:                       output of &#8220;<span class=
        !          5665:                       "quote"><span><strong class="command">uname
        !          5666:                       -s</strong></span></span>&#8221;</p>
1.1       grant    5667:                     </li>
                   5668: 
                   5669:                     <li>
1.14    ! xtraeme  5670:                       <p><code class=
        !          5671:                       "varname">${LOWER_OPSYS}</code> - lowercase
        !          5672:                       common name (eg. &#8220;<span class=
        !          5673:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    5674:                     </li>
                   5675: 
                   5676:                     <li>
1.14    ! xtraeme  5677:                       <p><code class="varname">${OS_VERSION}</code>
        !          5678:                       - &#8220;<span class=
        !          5679:                       "quote"><span><strong class="command">uname
        !          5680:                       -r</strong></span></span>&#8221;</p>
1.1       grant    5681:                     </li>
                   5682:                   </ul>
                   5683:                 </div>
                   5684:               </dd>
                   5685: 
1.14    ! xtraeme  5686:               <dt><span class="term"><code class=
        !          5687:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    5688: 
                   5689:               <dd>
                   5690:                 <p>Packages that install locale files should list
                   5691:                 them in the PLIST as &#8220;<span class=
                   5692:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   5693:                 instead of &#8220;<span class=
                   5694:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   5695:                 This properly handles the fact that different
                   5696:                 operating systems expect locale files to be either
1.14    ! xtraeme  5697:                 in <code class="filename">share</code> or
        !          5698:                 <code class="filename">lib</code> by default.</p>
1.1       grant    5699:               </dd>
                   5700:             </dl>
                   5701:           </div>
                   5702: 
                   5703:           <p>For a complete list of values which are replaced by
1.14    ! xtraeme  5704:           default, please look in <code class=
        !          5705:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    5706:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   5707: 
                   5708:           <p>If you want to change other variables not listed
                   5709:           above, you can add variables and their expansions to this
1.14    ! xtraeme  5710:           variable in the following way, similar to <code class=
        !          5711:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    5712:           "#components.optional" title=
                   5713:           "7.5.&nbsp;Optional files">Section&nbsp;7.5,
                   5714:           &#8220;Optional files&#8221;</a>):</p>
                   5715:           <pre class="programlisting">
                   5716: PLIST_SUBST+=    SOMEVAR="somevalue"
                   5717: </pre>
                   5718: 
                   5719:           <p>This replaces all occurrences of &#8220;<span class=
                   5720:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   5721:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   5722:         </div>
                   5723: 
                   5724:         <div class="sect1" lang="en" xml:lang="en">
                   5725:           <div class="titlepage">
                   5726:             <div>
                   5727:               <div>
                   5728:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  5729:                 "id2587181" id=
        !          5730:                 "id2587181"></a>8.5.&nbsp;Manpage-compression</h2>
1.1       grant    5731:               </div>
                   5732:             </div>
                   5733:           </div>
                   5734: 
                   5735:           <p>Manpages should be installed in compressed form if
1.14    ! xtraeme  5736:           <code class="varname">MANZ</code> is set (in <code class=
        !          5737:           "filename">bsd.own.mk</code>), and uncompressed
        !          5738:           otherwise. To handle this in the <code class=
        !          5739:           "filename">PLIST</code> file, the suffix
        !          5740:           &#8220;<span class="quote">.gz</span>&#8221; is
        !          5741:           appended/removed automatically for manpages according to
        !          5742:           <code class="varname">MANZ</code> and <code class=
        !          5743:           "varname">MANCOMPRESSED</code> being set or not, see
        !          5744:           above for details. This modification of the <code class=
        !          5745:           "filename">PLIST</code> file is done on a copy of it, not
        !          5746:           <code class="filename">PLIST</code> itself.</p>
1.1       grant    5747:         </div>
                   5748: 
                   5749:         <div class="sect1" lang="en" xml:lang="en">
                   5750:           <div class="titlepage">
                   5751:             <div>
                   5752:               <div>
                   5753:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  5754:                 "id2587223" id="id2587223"></a>8.6.&nbsp;Changing
        !          5755:                 PLIST source with <code class=
        !          5756:                 "varname">PLIST_SRC</code></h2>
1.1       grant    5757:               </div>
                   5758:             </div>
                   5759:           </div>
                   5760: 
1.14    ! xtraeme  5761:           <p>To use one or more files as source for the
        !          5762:           <code class="filename">PLIST</code> used in generating
        !          5763:           the binary package, set the variable <code class=
        !          5764:           "varname">PLIST_SRC</code> to the names of that file(s).
1.1       grant    5765:           The files are later concatenated using cat(1), and order
                   5766:           of things is important.</p>
                   5767:         </div>
                   5768: 
                   5769:         <div class="sect1" lang="en" xml:lang="en">
                   5770:           <div class="titlepage">
                   5771:             <div>
                   5772:               <div>
                   5773:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  5774:                 "id2587240" id="id2587240"></a>8.7.&nbsp;Platform
1.1       grant    5775:                 specific and differing PLISTs</h2>
                   5776:               </div>
                   5777:             </div>
                   5778:           </div>
                   5779: 
                   5780:           <p>Some packages decide to install a different set of
                   5781:           files based on the operating system being used. These
                   5782:           differences can be automatically handled by using the
                   5783:           following files:</p>
                   5784: 
                   5785:           <div class="itemizedlist">
                   5786:             <ul type="disc">
                   5787:               <li>
1.14    ! xtraeme  5788:                 <p><code class="filename">PLIST.common</code></p>
1.1       grant    5789:               </li>
                   5790: 
                   5791:               <li>
1.14    ! xtraeme  5792:                 <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1       grant    5793:               </li>
                   5794: 
                   5795:               <li>
1.14    ! xtraeme  5796:                 <p><code class=
        !          5797:                 "filename">PLIST.common_end</code></p>
1.1       grant    5798:               </li>
                   5799:             </ul>
                   5800:           </div>
                   5801: 
1.14    ! xtraeme  5802:           <p>If <code class="filename">PLIST.${OPSYS}</code>
        !          5803:           exists, these files are used instead of <code class=
        !          5804:           "filename">PLIST</code>. This allows packages which
        !          5805:           behave in this way to be handled gracefully. Manually
        !          5806:           overriding <code class="varname">PLIST_SRC</code> for
        !          5807:           other more exotic uses is also possible.</p>
1.1       grant    5808:         </div>
                   5809: 
                   5810:         <div class="sect1" lang="en" xml:lang="en">
                   5811:           <div class="titlepage">
                   5812:             <div>
                   5813:               <div>
                   5814:                 <h2 class="title" style="clear: both"><a name=
                   5815:                 "faq.common-dirs" id=
                   5816:                 "faq.common-dirs"></a>8.8.&nbsp;Sharing directories
                   5817:                 between packages</h2>
                   5818:               </div>
                   5819:             </div>
                   5820:           </div>
                   5821: 
                   5822:           <p>A &#8220;<span class="quote">shared
                   5823:           directory</span>&#8221; is a directory where multiple
                   5824:           (and unrelated) packages install files. These directories
                   5825:           are problematic because you have to add special tricks in
                   5826:           the PLIST to conditionally remove them, or have some
                   5827:           centralized package handle them.</p>
                   5828: 
                   5829:           <p>Within pkgsrc, you'll find both approaches. If a
                   5830:           directory is shared by a few unrelated packages, it's
                   5831:           often not worth to add an extra package to remove it.
                   5832:           Therefore, one simply does:</p>
                   5833:           <pre class="programlisting">
                   5834:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   5835:     
                   5836: </pre>
                   5837: 
                   5838:           <p>in the PLISTs of all affected packages, instead of the
                   5839:           regular "@dirrm" line.</p>
                   5840: 
                   5841:           <p>However, if the directory is shared across many
                   5842:           packages, two different solutions are available:</p>
                   5843: 
                   5844:           <div class="orderedlist">
                   5845:             <ol type="1">
                   5846:               <li>
                   5847:                 <p>If the packages have a common dependency, the
                   5848:                 directory can be removed in that. For example, see
                   5849:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5850:                 href=
                   5851:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.14    ! xtraeme  5852:                 class="pkgname">textproc/scrollkeeper</a>, which
        !          5853:                 removes the shared directory <code class=
        !          5854:                 "filename">share/omf</code>.</p>
1.1       grant    5855:               </li>
                   5856: 
                   5857:               <li>
                   5858:                 <p>If the packages using the directory are not
                   5859:                 related at all (they have no common dependencies),
                   5860:                 a *-dirs package is used.</p>
                   5861:               </li>
                   5862:             </ol>
                   5863:           </div>
                   5864: 
                   5865:           <p>From now on, we'll discuss the second solution. To get
                   5866:           an idea of the *-dirs packages available, issue:</p>
                   5867:           <pre class="programlisting">
1.14    ! xtraeme  5868:       <code class="prompt">%</code> cd .../pkgsrc
        !          5869:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    5870:     
                   5871: </pre>
                   5872: 
                   5873:           <p>Their use from other packages is very simple. The
1.14    ! xtraeme  5874:           <code class="varname">USE_DIRS</code> variable takes a
        !          5875:           list of package names (without the &#8220;<span class=
1.1       grant    5876:           "quote">-dirs</span>&#8221; part) together with the
                   5877:           required version number (always pick the latest one when
                   5878:           writting new packages).</p>
                   5879: 
                   5880:           <p>For example, if a package installs files under
1.14    ! xtraeme  5881:           <code class="filename">share/applications</code>, it
        !          5882:           should have the following line in it:</p>
1.1       grant    5883:           <pre class="programlisting">
                   5884:       USE_DIRS+= xdg-1.1
                   5885:     
                   5886: </pre>
                   5887: 
1.14    ! xtraeme  5888:           <p>After regenerating the PLIST using
        !          5889:           <span><strong class="command">make
        !          5890:           print-PLIST</strong></span>, you should get the right
        !          5891:           (commented out) lines.</p>
1.1       grant    5892: 
1.14    ! xtraeme  5893:           <p>Note that, even if your package is using <code class=
        !          5894:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    5895:           *-x11-dirs packages. Just specify the name without that
1.14    ! xtraeme  5896:           part and pkgsrc (in particular, <code class=
        !          5897:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    5898:         </div>
                   5899:       </div>
                   5900: 
                   5901:       <div class="chapter" lang="en" xml:lang="en">
                   5902:         <div class="titlepage">
                   5903:           <div>
                   5904:             <div>
                   5905:               <h2 class="title"><a name="buildlink" id=
                   5906:               "buildlink"></a>Chapter&nbsp;9.&nbsp;Buildlink
                   5907:               methodology</h2>
                   5908:             </div>
                   5909:           </div>
                   5910:         </div>
                   5911: 
                   5912:         <div class="toc">
                   5913:           <p><b>Table of Contents</b></p>
                   5914: 
                   5915:           <dl>
1.14    ! xtraeme  5916:             <dt><span class="sect1"><a href="#id2587717">9.1.
1.1       grant    5917:             Converting packages to use buildlink3</a></span></dt>
                   5918: 
1.14    ! xtraeme  5919:             <dt><span class="sect1"><a href="#id2587908">9.2.
        !          5920:             Writing <code class="filename">buildlink3.mk</code>
        !          5921:             files</a></span></dt>
1.1       grant    5922: 
                   5923:             <dd>
                   5924:               <dl>
1.14    ! xtraeme  5925:                 <dt><span class="sect2"><a href="#id2587977">9.2.1.
1.1       grant    5926:                 Anatomy of a buildlink3.mk file</a></span></dt>
                   5927: 
1.14    ! xtraeme  5928:                 <dt><span class="sect2"><a href="#id2588349">9.2.2.
        !          5929:                 Updating <code class=
        !          5930:                 "varname">BUILDLINK_DEPENDS.<em class=
        !          5931:                 "replaceable"><code>pkg</code></em></code> in
        !          5932:                 <code class="filename">buildlink3.mk</code>
1.1       grant    5933:                 files</a></span></dt>
                   5934:               </dl>
                   5935:             </dd>
                   5936: 
1.14    ! xtraeme  5937:             <dt><span class="sect1"><a href="#id2588428">9.3.
        !          5938:             Writing <code class="filename">builtin.mk</code>
        !          5939:             files</a></span></dt>
1.1       grant    5940: 
                   5941:             <dd>
                   5942:               <dl>
1.14    ! xtraeme  5943:                 <dt><span class="sect2"><a href="#id2588578">9.3.1.
        !          5944:                 Anatomy of a <code class=
        !          5945:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    5946: 
1.14    ! xtraeme  5947:                 <dt><span class="sect2"><a href="#id2588873">9.3.2.
1.1       grant    5948:                 Global preferences for native or pkgsrc
                   5949:                 software</a></span></dt>
                   5950:               </dl>
                   5951:             </dd>
                   5952:           </dl>
                   5953:         </div>
                   5954: 
                   5955:         <p>Buildlink is a framework in pkgsrc that controls what
                   5956:         headers and libraries are seen by a package's configure and
                   5957:         build processes. This is implemented in a two step
                   5958:         process:</p>
                   5959: 
                   5960:         <div class="orderedlist">
                   5961:           <ol type="1">
                   5962:             <li>
                   5963:               <p>Symlink headers and libraries for dependencies
1.14    ! xtraeme  5964:               into <code class="varname">BUILDLINK_DIR</code>,
        !          5965:               which by default is a subdirectory of <code class=
        !          5966:               "varname">WRKDIR</code>.</p>
1.1       grant    5967:             </li>
                   5968: 
                   5969:             <li>
                   5970:               <p>Create wrapper scripts that are used in place of
1.14    ! xtraeme  5971:               the normal compiler tools that translate <code class=
        !          5972:               "option">-I${LOCALBASE}/include</code> and
        !          5973:               <code class="option">-L${LOCALBASE}/lib</code> into
        !          5974:               references to <code class=
        !          5975:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
        !          5976:               also make native compiler on some operating systems
        !          5977:               look like GCC, so that packages that expect GCC won't
        !          5978:               require modifications to build with those native
        !          5979:               compilers.</p>
1.1       grant    5980:             </li>
                   5981:           </ol>
                   5982:         </div>
                   5983: 
                   5984:         <p>This normalizes the environment in which a package is
                   5985:         built so that the package may be built consistently despite
                   5986:         what other software may be installed. Please note that the
1.14    ! xtraeme  5987:         normal system header and library paths, e.g. <code class=
        !          5988:         "filename">/usr/include</code>, <code class=
        !          5989:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    5990:         buildlink3 is designed to insulate the package build from
                   5991:         non-system-supplied software.</p>
                   5992: 
                   5993:         <div class="sect1" lang="en" xml:lang="en">
                   5994:           <div class="titlepage">
                   5995:             <div>
                   5996:               <div>
                   5997:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  5998:                 "id2587717" id="id2587717"></a>9.1.&nbsp;Converting
1.1       grant    5999:                 packages to use buildlink3</h2>
                   6000:               </div>
                   6001:             </div>
                   6002:           </div>
                   6003: 
                   6004:           <p>The process of converting packages to use the
                   6005:           buildlink3 framework (&#8220;<span class=
                   6006:           "quote">bl3ifying</span>&#8221;) is fairly
                   6007:           straightforward. The things to keep in mind are:</p>
                   6008: 
                   6009:           <div class="orderedlist">
                   6010:             <ol type="1">
                   6011:               <li>
1.14    ! xtraeme  6012:                 <p>Set <code class="varname">USE_BUILDLINK3</code>
        !          6013:                 to &#8220;<span class=
        !          6014:                 "quote">yes</span>&#8221;.</p>
1.1       grant    6015:               </li>
                   6016: 
                   6017:               <li>
                   6018:                 <p>Ensure that the build always calls the wrapper
                   6019:                 scripts instead of the actual toolchain. Some
                   6020:                 packages are tricky, and the only way to know for
1.14    ! xtraeme  6021:                 sure is the check <code class=
        !          6022:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    6023:                 wrappers are being invoked.</p>
                   6024:               </li>
                   6025: 
                   6026:               <li>
1.14    ! xtraeme  6027:                 <p>Don't override <code class=
        !          6028:                 "varname">PREFIX</code> from within the package
        !          6029:                 Makefile, e.g. Java VMs, standalone shells, etc.,
        !          6030:                 because the code to symlink files into <code class=
        !          6031:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    6032:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14    ! xtraeme  6033:                 <em class=
        !          6034:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    6035:               </li>
                   6036: 
                   6037:               <li>
                   6038:                 <p>Remember that <span class=
1.14    ! xtraeme  6039:                 "emphasis"><em>only</em></span> the <code class=
        !          6040:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    6041:                 in a package's Makefile are added as dependencies
                   6042:                 for that package.</p>
                   6043:               </li>
                   6044:             </ol>
                   6045:           </div>
                   6046: 
                   6047:           <p>If a dependency on a particular package is required
                   6048:           for its libraries and headers, then we replace:</p>
                   6049:           <pre class="programlisting">
                   6050: DEPENDS+=       foo&gt;=1.1.0:../../category/foo
                   6051: </pre>
                   6052: 
                   6053:           <p>with</p>
                   6054:           <pre class="programlisting">
                   6055: .include "../../category/foo/buildlink3.mk"
                   6056: </pre>
                   6057: 
1.14    ! xtraeme  6058:           <p>There are several <code class=
        !          6059:           "filename">buildlink3.mk</code> files in <code class=
        !          6060:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    6061:           issues:</p>
                   6062: 
                   6063:           <div class="itemizedlist">
                   6064:             <ul type="disc">
                   6065:               <li>
1.14    ! xtraeme  6066:                 <p><code class="filename">bdb.buildlink3.mk</code>
1.1       grant    6067:                 chooses either the native or a pkgsrc Berkeley DB
1.14    ! xtraeme  6068:                 implementation based on the values of <code class=
        !          6069:                 "varname">BDB_ACCEPTED</code> and <code class=
        !          6070:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    6071:               </li>
                   6072: 
                   6073:               <li>
1.14    ! xtraeme  6074:                 <p><code class=
        !          6075:                 "filename">curses.buildlink3.mk</code> If the
        !          6076:                 system comes with neither Curses nor NCurses, this
        !          6077:                 will take care to install the <a xmlns=
        !          6078:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    6079:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.14    ! xtraeme  6080:                 class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    6081:               </li>
                   6082: 
                   6083:               <li>
1.14    ! xtraeme  6084:                 <p><code class="filename">krb5.buildlink3.mk</code>
        !          6085:                 uses the value of <code class=
        !          6086:                 "varname">KRB5_ACCEPTED</code> to choose between
1.1       grant    6087:                 adding a dependency on Heimdal or MIT-krb5 for
                   6088:                 packages that require a Kerberos 5
                   6089:                 implementation.</p>
                   6090:               </li>
                   6091: 
                   6092:               <li>
1.14    ! xtraeme  6093:                 <p><code class=
        !          6094:                 "filename">motif.buildlink3.mk</code> checks for a
        !          6095:                 system-provided Motif installation or adds a
        !          6096:                 dependency on <a xmlns=
1.1       grant    6097:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6098:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.14    ! xtraeme  6099:                 class="pkgname">x11/lesstif</a> or <a xmlns=
        !          6100:                 "http://www.w3.org/TR/xhtml1/transitional" href=
        !          6101:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
        !          6102:                 class="pkgname">x11/openmotif</a>;</p>
1.1       grant    6103:               </li>
                   6104: 
                   6105:               <li>
1.14    ! xtraeme  6106:                 <p><code class=
        !          6107:                 "filename">ossaudio.buildlink3.mk</code> defines
        !          6108:                 several variables that may be used by packages that
        !          6109:                 use the Open Sound System (OSS) API;</p>
1.1       grant    6110:               </li>
                   6111: 
                   6112:               <li>
1.14    ! xtraeme  6113:                 <p><code class=
        !          6114:                 "filename">pgsql.buildlink3.mk</code> will accept
        !          6115:                 either Postgres 7.3 or 7.4, whichever is found
        !          6116:                 installed. See the file for more information.</p>
1.1       grant    6117:               </li>
                   6118: 
                   6119:               <li>
1.14    ! xtraeme  6120:                 <p><code class=
        !          6121:                 "filename">pthread.buildlink3.mk</code> uses the
        !          6122:                 value of <code class="varname">PTHREAD_OPTS</code>
        !          6123:                 and checks for native pthreads or adds a dependency
        !          6124:                 on <a xmlns=
1.1       grant    6125:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6126:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.14    ! xtraeme  6127:                 class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    6128:               </li>
                   6129: 
                   6130:               <li>
1.14    ! xtraeme  6131:                 <p><code class="filename">xaw.buildlink3.mk</code>
        !          6132:                 uses the value of <code class=
        !          6133:                 "varname">XAW_TYPE</code> to choose a particular
        !          6134:                 Athena widgets library.</p>
1.1       grant    6135:               </li>
                   6136:             </ul>
                   6137:           </div>
                   6138: 
1.14    ! xtraeme  6139:           <p>The comments in those <code class=
        !          6140:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    6141:           complete description of how to use them properly.</p>
                   6142:         </div>
                   6143: 
                   6144:         <div class="sect1" lang="en" xml:lang="en">
                   6145:           <div class="titlepage">
                   6146:             <div>
                   6147:               <div>
                   6148:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  6149:                 "id2587908" id="id2587908"></a>9.2.&nbsp;Writing
        !          6150:                 <code class="filename">buildlink3.mk</code>
        !          6151:                 files</h2>
1.1       grant    6152:               </div>
                   6153:             </div>
                   6154:           </div>
                   6155: 
1.14    ! xtraeme  6156:           <p>A package's <code class=
        !          6157:           "filename">buildlink3.mk</code> file is included by
        !          6158:           Makefiles to indicate the need to compile and link
        !          6159:           against header files and libraries provided by the
        !          6160:           package. A <code class="filename">buildlink3.mk</code>
        !          6161:           file should always provide enough information to add the
        !          6162:           correct type of dependency relationship and include any
        !          6163:           other <code class="filename">buildlink3.mk</code> files
        !          6164:           that it needs to find headers and libraries that it needs
        !          6165:           in turn.</p>
1.1       grant    6166: 
1.14    ! xtraeme  6167:           <p>To generate an initial <code class=
        !          6168:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    6169:           Rene Hexel's <a xmlns=
                   6170:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6171:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.14    ! xtraeme  6172:           class="pkgname">pkgtools/createbuildlink</a> package is
        !          6173:           highly recommended. For most packages, the following
        !          6174:           command will generate a good starting point for
        !          6175:           <code class="filename">buildlink3.mk</code> files:</p>
1.1       grant    6176:           <pre class="screen">
1.14    ! xtraeme  6177: <code class="prompt">%</code> <strong class=
        !          6178: "userinput"><code>cd pkgsrc/<em class=
        !          6179: "replaceable"><code>category</code></em>/<em class=
        !          6180: "replaceable"><code>pkgdir</code></em>
        !          6181: <code class=
        !          6182: "prompt">%</code> createbuildlink -3 &gt;buildlink3.mk</code></strong>
1.1       grant    6183: </pre>
                   6184: 
                   6185:           <div class="sect2" lang="en" xml:lang="en">
                   6186:             <div class="titlepage">
                   6187:               <div>
                   6188:                 <div>
1.14    ! xtraeme  6189:                   <h3 class="title"><a name="id2587977" id=
        !          6190:                   "id2587977"></a>9.2.1. Anatomy of a buildlink3.mk
1.1       grant    6191:                   file</h3>
                   6192:                 </div>
                   6193:               </div>
                   6194:             </div>
                   6195: 
1.14    ! xtraeme  6196:             <p>The following real-life example <code class=
        !          6197:             "filename">buildlink3.mk</code> is taken from
        !          6198:             <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    6199:             <pre class="programlisting">
1.11      ben      6200: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    6201: 
                   6202: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   6203: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   6204: 
                   6205: .if !empty(BUILDLINK_DEPTH:M+)
                   6206: BUILDLINK_DEPENDS+=     tiff
                   6207: .endif
                   6208: 
                   6209: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   6210: BUILDLINK_PACKAGES+=    tiff
                   6211: 
                   6212: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   6213: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   6214: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   6215: .endif  # TIFF_BUILDLINK3_MK
                   6216: 
                   6217: .include "../../devel/zlib/buildlink3.mk"
                   6218: .include "../../graphics/jpeg/buildlink3.mk"
                   6219: 
                   6220: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   6221: </pre>
                   6222: 
1.14    ! xtraeme  6223:             <p>The header and footer manipulate <code class=
        !          6224:             "varname">BUILDLINK_DEPTH</code>, which is common
        !          6225:             across all <code class="filename">buildlink3.mk</code>
        !          6226:             files and is used to track at what depth we are
        !          6227:             including <code class="filename">buildlink3.mk</code>
        !          6228:             files.</p>
1.1       grant    6229: 
                   6230:             <p>The first section controls if the dependency on
1.14    ! xtraeme  6231:             <em class="replaceable"><code>pkg</code></em> is added.
        !          6232:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    6233:             global list of packages for which dependencies are
                   6234:             added by buildlink3.</p>
                   6235: 
                   6236:             <p>The second section advises pkgsrc that the
1.14    ! xtraeme  6237:             <code class="filename">buildlink3.mk</code> file for
        !          6238:             <em class="replaceable"><code>pkg</code></em> has been
        !          6239:             included at some point. <code class=
        !          6240:             "varname">BUILDLINK_PACKAGES</code> is the global list
        !          6241:             of packages for which <code class=
        !          6242:             "filename">buildlink3.mk</code> files have been
        !          6243:             included. It must <span class=
        !          6244:             "emphasis"><em>always</em></span> be appended to within
        !          6245:             a <code class="filename">buildlink3.mk</code> file.</p>
1.1       grant    6246: 
                   6247:             <p>The third section is protected from multiple
1.14    ! xtraeme  6248:             inclusion and controls how the dependency on <em class=
        !          6249:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    6250:             important variables are set in the section:</p>
                   6251: 
                   6252:             <div class="itemizedlist">
                   6253:               <ul type="disc">
                   6254:                 <li>
1.14    ! xtraeme  6255:                   <p><code class=
        !          6256:                   "varname">BUILDLINK_DEPENDS.<em class=
        !          6257:                   "replaceable"><code>pkg</code></em></code> is the
        !          6258:                   actual dependency recorded in the installed
        !          6259:                   package; this should always be set using
        !          6260:                   <span><strong class="command">+=</strong></span>
        !          6261:                   to ensure that we're appending to any
        !          6262:                   pre-existing list of values. This variable should
        !          6263:                   be set to the first version of the package that
        !          6264:                   had the last change in the major number of a
        !          6265:                   shared library or that had a major API
        !          6266:                   change.</p>
1.1       grant    6267:                 </li>
                   6268: 
                   6269:                 <li>
1.14    ! xtraeme  6270:                   <p><code class=
        !          6271:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
        !          6272:                   "replaceable"><code>pkg</code></em></code> is the
        !          6273:                   location of the <em class=
        !          6274:                   "replaceable"><code>pkg</code></em> pkgsrc
1.1       grant    6275:                   directory;</p>
                   6276:                 </li>
                   6277: 
                   6278:                 <li>
1.14    ! xtraeme  6279:                   <p><code class=
        !          6280:                   "varname">BUILDLINK_DEPMETHOD.<em class=
        !          6281:                   "replaceable"><code>pkg</code></em></code> (not
        !          6282:                   shown above) controls whether we use <code class=
        !          6283:                   "varname">BUILD_DEPENDS</code> or <code class=
        !          6284:                   "varname">DEPENDS</code> to add the dependency on
        !          6285:                   <em class="replaceable"><code>pkg</code></em>.
        !          6286:                   The build dependency is selected by setting
        !          6287:                   <code class=
        !          6288:                   "varname">BUILDLINK_DEPMETHOD.<em class=
        !          6289:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    6290:                   &#8220;<span class="quote">build</span>&#8221;.
                   6291:                   By default, the full dependency is used.</p>
                   6292:                 </li>
                   6293: 
                   6294:                 <li>
1.14    ! xtraeme  6295:                   <p><code class=
        !          6296:                   "varname">BUILDLINK_INCDIRS.<em class=
        !          6297:                   "replaceable"><code>pkg</code></em></code> and
        !          6298:                   <code class=
        !          6299:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
        !          6300:                   <code>pkg</code></em></code> (not shown above)
        !          6301:                   are lists of subdirectories of <code class=
        !          6302:                   "filename">${BUILDLINK_PREFIX.<em class=
        !          6303:                   "replaceable"><code>pkg</code></em>}</code> to
        !          6304:                   add to the header and library search paths. These
1.1       grant    6305:                   default to &#8220;<span class=
                   6306:                   "quote">include</span>&#8221; and
                   6307:                   &#8220;<span class="quote">lib</span>&#8221;
                   6308:                   respectively.</p>
                   6309:                 </li>
                   6310: 
                   6311:                 <li>
1.14    ! xtraeme  6312:                   <p><code class=
        !          6313:                   "varname">BUILDLINK_CPPFLAGS.<em class=
        !          6314:                   "replaceable"><code>pkg</code></em></code> (not
        !          6315:                   shown above) is the list of preprocessor flags to
        !          6316:                   add to <code class="varname">CPPFLAGS</code>,
        !          6317:                   which are passed on to the configure and build
        !          6318:                   phases. The &#8220;<span class=
        !          6319:                   "quote">-I</span>&#8221; option should be avoided
        !          6320:                   and instead be handled using <code class=
        !          6321:                   "varname">BUILDLINK_INCDIRS.<em class=
        !          6322:                   "replaceable"><code>pkg</code></em></code> as
        !          6323:                   above.</p>
1.1       grant    6324:                 </li>
                   6325:               </ul>
                   6326:             </div>
                   6327: 
                   6328:             <p>The following variables are all optionally defined
                   6329:             within this second section (protected against multiple
                   6330:             inclusion) and control which package files are
1.14    ! xtraeme  6331:             symlinked into <code class=
        !          6332:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    6333:             are transformed during the symlinking:</p>
                   6334: 
                   6335:             <div class="itemizedlist">
                   6336:               <ul type="disc">
                   6337:                 <li>
1.14    ! xtraeme  6338:                   <p><code class=
        !          6339:                   "varname">BUILDLINK_FILES.<em class=
        !          6340:                   "replaceable"><code>pkg</code></em></code> (not
        !          6341:                   shown above) is a shell glob pattern relative to
        !          6342:                   <code class=
        !          6343:                   "filename">${BUILDLINK_PREFIX.<em class=
        !          6344:                   "replaceable"><code>pkg</code></em>}</code> to be
        !          6345:                   symlinked into <code class=
        !          6346:                   "filename">${BUILDLINK_DIR}</code>, e.g.
        !          6347:                   <code class="filename">include/*.h</code>.</p>
1.1       grant    6348:                 </li>
                   6349: 
                   6350:                 <li>
1.14    ! xtraeme  6351:                   <p><code class=
        !          6352:                   "varname">BUILDLINK_FILES_CMD.<em class=
        !          6353:                   "replaceable"><code>pkg</code></em></code> (not
        !          6354:                   shown above) is a shell pipeline that outputs to
        !          6355:                   stdout a list of files relative to <code class=
        !          6356:                   "filename">${BUILDLINK_PREFIX.<em class=
        !          6357:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    6358:                   resulting files are to be symlinked into
1.14    ! xtraeme  6359:                   <code class="filename">${BUILDLINK_DIR}</code>.
        !          6360:                   By default, this takes the <code class=
        !          6361:                   "filename">+CONTENTS</code> of a <em class=
        !          6362:                   "replaceable"><code>pkg</code></em> and filters
        !          6363:                   it through <code class=
        !          6364:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
        !          6365:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    6366:                 </li>
                   6367: 
                   6368:                 <li>
1.14    ! xtraeme  6369:                   <p><code class=
        !          6370:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
        !          6371:                   "replaceable"><code>pkg</code></em></code> (not
        !          6372:                   shown above) is a filter command that filters
        !          6373:                   <code class="filename">+CONTENTS</code> input
        !          6374:                   into a list of files relative to <code class=
        !          6375:                   "filename">${BUILDLINK_PREFIX.<em class=
        !          6376:                   "replaceable"><code>pkg</code></em>}</code> on
        !          6377:                   stdout. By default for overwrite packages,
        !          6378:                   <code class=
        !          6379:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
        !          6380:                   "replaceable"><code>pkg</code></em></code>
        !          6381:                   outputs the contents of the <code class=
        !          6382:                   "filename">include</code> and <code class=
        !          6383:                   "filename">lib</code> directories in the package
        !          6384:                   <code class="filename">+CONTENTS</code>, and for
        !          6385:                   pkgviews packages, it outputs any libtool
        !          6386:                   archives in <code class="filename">lib</code>
1.1       grant    6387:                   directories.</p>
                   6388:                 </li>
                   6389: 
                   6390:                 <li>
1.14    ! xtraeme  6391:                   <p><code class=
        !          6392:                   "varname">BUILDLINK_TRANSFORM.<em class=
        !          6393:                   "replaceable"><code>pkg</code></em></code> (not
        !          6394:                   shown above) is a list of sed arguments used to
1.1       grant    6395:                   transform the name of the source filename into a
1.14    ! xtraeme  6396:                   destination filename, e.g. <span><strong class=
1.1       grant    6397:                   "command">-e
1.14    ! xtraeme  6398:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    6399:                 </li>
                   6400:               </ul>
                   6401:             </div>
                   6402: 
1.14    ! xtraeme  6403:             <p>The last section includes any <code class=
        !          6404:             "filename">buildlink3.mk</code> needed for <em class=
        !          6405:             "replaceable"><code>pkg</code></em>'s library
        !          6406:             dependencies. Including these <code class=
        !          6407:             "filename">buildlink3.mk</code> files means that the
        !          6408:             headers and libraries for these dependencies are also
        !          6409:             symlinked into <code class=
        !          6410:             "filename">${BUILDLINK_DIR}</code> whenever the
        !          6411:             <em class="replaceable"><code>pkg</code></em>
        !          6412:             <code class="filename">buildlink3.mk</code> file is
        !          6413:             included.</p>
1.1       grant    6414:           </div>
                   6415: 
                   6416:           <div class="sect2" lang="en" xml:lang="en">
                   6417:             <div class="titlepage">
                   6418:               <div>
                   6419:                 <div>
1.14    ! xtraeme  6420:                   <h3 class="title"><a name="id2588349" id=
        !          6421:                   "id2588349"></a>9.2.2. Updating <code class=
        !          6422:                   "varname">BUILDLINK_DEPENDS.<em class=
        !          6423:                   "replaceable"><code>pkg</code></em></code> in
        !          6424:                   <code class="filename">buildlink3.mk</code>
        !          6425:                   files</h3>
1.1       grant    6426:                 </div>
                   6427:               </div>
                   6428:             </div>
                   6429: 
                   6430:             <p>There are two situations that require increasing the
1.14    ! xtraeme  6431:             dependency listed in <code class=
        !          6432:             "varname">BUILDLINK_DEPENDS.<em class=
        !          6433:             "replaceable"><code>pkg</code></em></code> after a
        !          6434:             package update:</p>
1.1       grant    6435: 
                   6436:             <div class="orderedlist">
                   6437:               <ol type="1">
                   6438:                 <li>
                   6439:                   <p>if the sonames (major number of the library
                   6440:                   version) of any installed shared libraries
                   6441:                   change;</p>
                   6442:                 </li>
                   6443: 
                   6444:                 <li>
                   6445:                   <p>if the API or interface to the header files
                   6446:                   change.</p>
                   6447:                 </li>
                   6448:               </ol>
                   6449:             </div>
                   6450: 
1.14    ! xtraeme  6451:             <p>In these cases, <code class=
        !          6452:             "varname">BUILDLINK_DEPENDS.<em class=
        !          6453:             "replaceable"><code>pkg</code></em></code> should be
        !          6454:             adjusted to require at least the new package version.
        !          6455:             In some cases, the packages that depend on this new
        !          6456:             version may need their <code class=
        !          6457:             "varname">PKGREVISION</code>s increased and, if they
        !          6458:             have <code class="filename">buildlink3.mk</code> files,
        !          6459:             their <code class=
        !          6460:             "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
        !          6461:             pkg</code></em></code> adjusted, too. This is needed so
        !          6462:             that binary packages made using it will require the
        !          6463:             correct package dependency and not settle for an older
        !          6464:             one which will not contain the necessary shared
        !          6465:             libraries.</p>
1.1       grant    6466: 
                   6467:             <p>Please take careful consideration before adjusting
1.14    ! xtraeme  6468:             <code class="varname">BUILDLINK_DEPENDS.<em class=
        !          6469:             "replaceable"><code>pkg</code></em></code> as we don't
        !          6470:             want to cause unneeded package deletions and rebuilds.
        !          6471:             In many cases, new versions of packages work just fine
        !          6472:             with older dependencies. See <a href="#dependencies"
        !          6473:             title="12.1.3.&nbsp;Handling dependencies">Section
        !          6474:             12.1.3, &#8220;Handling dependencies&#8221;</a> and
        !          6475:             <a href="#buildlink" title=
1.1       grant    6476:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter 9,
                   6477:             <i>Buildlink methodology</i></a> for more information
                   6478:             about dependencies on other packages, including the
1.14    ! xtraeme  6479:             <code class="varname">BUILDLINK_RECOMMENDED</code> and
        !          6480:             <code class="varname">RECOMMENDED</code>
        !          6481:             definitions.</p>
1.1       grant    6482:           </div>
                   6483:         </div>
                   6484: 
                   6485:         <div class="sect1" lang="en" xml:lang="en">
                   6486:           <div class="titlepage">
                   6487:             <div>
                   6488:               <div>
                   6489:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  6490:                 "id2588428" id="id2588428"></a>9.3.&nbsp;Writing
        !          6491:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    6492:               </div>
                   6493:             </div>
                   6494:           </div>
                   6495: 
                   6496:           <p>Some packages in pkgsrc install headers and libraries
                   6497:           that coincide with headers and libraries present in the
1.14    ! xtraeme  6498:           base system. Aside from a <code class=
        !          6499:           "filename">buildlink3.mk</code> file, these packages
        !          6500:           should also include a <code class=
        !          6501:           "filename">builtin.mk</code> file that includes the
        !          6502:           necessary checks to decide whether using the built-in
        !          6503:           software or the pkgsrc software is appropriate.</p>
1.1       grant    6504: 
                   6505:           <p>The only requirements of a builtin.mk file for
1.14    ! xtraeme  6506:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    6507: 
                   6508:           <div class="orderedlist">
                   6509:             <ol type="1">
                   6510:               <li>
1.14    ! xtraeme  6511:                 <p>It should set <code class=
        !          6512:                 "varname">USE_BUILTIN.<em class=
        !          6513:                 "replaceable"><code>pkg</code></em></code> to
        !          6514:                 either &#8220;<span class="quote">yes</span>&#8221;
        !          6515:                 or &#8220;<span class="quote">no</span>&#8221;
        !          6516:                 after it is included.</p>
1.1       grant    6517:               </li>
                   6518: 
                   6519:               <li>
                   6520:                 <p>It should <span class=
                   6521:                 "emphasis"><em>not</em></span> override any
1.14    ! xtraeme  6522:                 <code class="varname">USE_BUILTIN.<em class=
        !          6523:                 "replaceable"><code>pkg</code></em></code> which is
        !          6524:                 already set before the <code class=
        !          6525:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    6526:               </li>
                   6527: 
                   6528:               <li>
                   6529:                 <p>It should be written to allow multiple
                   6530:                 inclusion. This is <span class=
                   6531:                 "emphasis"><em>very</em></span> important and takes
1.14    ! xtraeme  6532:                 careful attention to <code class=
        !          6533:                 "filename">Makefile</code> coding.</p>
1.1       grant    6534:               </li>
                   6535:             </ol>
                   6536:           </div>
                   6537: 
                   6538:           <div class="sect2" lang="en" xml:lang="en">
                   6539:             <div class="titlepage">
                   6540:               <div>
                   6541:                 <div>
1.14    ! xtraeme  6542:                   <h3 class="title"><a name="id2588578" id=
        !          6543:                   "id2588578"></a>9.3.1.&nbsp;Anatomy of a
        !          6544:                   <code class="filename">builtin.mk</code>
        !          6545:                   file</h3>
1.1       grant    6546:                 </div>
                   6547:               </div>
                   6548:             </div>
                   6549: 
                   6550:             <p>The following is the recommended template for
                   6551:             builtin.mk files:</p>
                   6552:             <pre class="programlisting">
                   6553: .if !defined(IS_BUILTIN.foo)
                   6554: #
                   6555: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   6556: # genuinely exists in the system or not.
                   6557: #
                   6558: IS_BUILTIN.foo?=        no
                   6559: 
                   6560: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   6561: # version can be determined.
                   6562: #
                   6563: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   6564: BUILTIN_PKG.foo?=       foo-1.0
                   6565: .  endif
                   6566: .endif  # IS_BUILTIN.foo
                   6567: 
                   6568: .if !defined(USE_BUILTIN.foo)
                   6569: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   6570: .  if defined(BUILTIN_PKG.foo)
                   6571: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   6572: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   6573: USE_BUILTIN.foo!=                                                       \
                   6574:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   6575:               ${ECHO} "yes";                                            \
                   6576:       else                                                              \
                   6577:               ${ECHO} "no";                                             \
                   6578:       fi
                   6579: .      endif
                   6580: .    endfor
                   6581: .  endif
                   6582: .endif  # USE_BUILTIN.foo
                   6583: 
                   6584: CHECK_BUILTIN.foo?=     no
                   6585: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   6586: #
                   6587: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   6588: # "yes" or "no".
                   6589: #
                   6590: .endif  # CHECK_BUILTIN.foo
                   6591:       
                   6592: </pre>
                   6593: 
1.14    ! xtraeme  6594:             <p>The first section sets <code class=
        !          6595:             "varname">IS_BUILTIN.<em class=
        !          6596:             "replaceable"><code>pkg</code></em></code> depending on
        !          6597:             if <em class="replaceable"><code>pkg</code></em> really
        !          6598:             exists in the base system. This should not be a base
        !          6599:             system software with similar functionality to
        !          6600:             <em class="replaceable"><code>pkg</code></em>; it
        !          6601:             should only be &#8220;<span class=
        !          6602:             "quote">yes</span>&#8221; if the actual package is
        !          6603:             included as part of the base system. This variable is
        !          6604:             only used internally within the <code class=
        !          6605:             "filename">builtin.mk</code> file.</p>
        !          6606: 
        !          6607:             <p>The second section sets <code class=
        !          6608:             "varname">BUILTIN_PKG.<em class=
        !          6609:             "replaceable"><code>pkg</code></em></code> to the
        !          6610:             version of <em class=
        !          6611:             "replaceable"><code>pkg</code></em> in the base system
        !          6612:             if it exists (if <code class=
        !          6613:             "varname">IS_BUILTIN.<em class=
        !          6614:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6615:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14    ! xtraeme  6616:             variable is only used internally within the
        !          6617:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    6618: 
1.14    ! xtraeme  6619:             <p>The third section sets <code class=
        !          6620:             "varname">USE_BUILTIN.<em class=
        !          6621:             "replaceable"><code>pkg</code></em></code> and is
        !          6622:             <span class="emphasis"><em>required</em></span> in all
        !          6623:             <code class="filename">builtin.mk</code> files. The
        !          6624:             code in this section must make the determination
        !          6625:             whether the built-in software is adequate to satisfy
        !          6626:             the dependencies listed in <code class=
        !          6627:             "varname">BUILDLINK_DEPENDS.<em class=
        !          6628:             "replaceable"><code>pkg</code></em></code>. This is
        !          6629:             typically done by comparing <code class=
        !          6630:             "varname">BUILTIN_PKG.<em class=
        !          6631:             "replaceable"><code>pkg</code></em></code> against each
        !          6632:             of the dependencies in <code class=
        !          6633:             "varname">BUILDLINK_DEPENDS.<em class=
        !          6634:             "replaceable"><code>pkg</code></em></code>.
        !          6635:             <code class="varname">USE_BUILTIN.<em class=
        !          6636:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    6637:             "emphasis"><em>must</em></span> be set to the correct
1.14    ! xtraeme  6638:             value by the end of the <code class=
        !          6639:             "filename">builtin.mk</code> file. Note that
        !          6640:             <code class="varname">USE_BUILTIN.<em class=
        !          6641:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    6642:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14    ! xtraeme  6643:             <code class="varname">IS_BUILTIN.<em class=
        !          6644:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6645:             &#8220;<span class="quote">no</span>&#8221; because we
                   6646:             may make the determination that the built-in version of
                   6647:             the software is similar enough to be used as a
                   6648:             replacement.</p>
                   6649: 
1.14    ! xtraeme  6650:             <p>The last section is guarded by <code class=
        !          6651:             "varname">CHECK_BUILTIN.<em class=
        !          6652:             "replaceable"><code>pkg</code></em></code>, and
        !          6653:             includes code that uses the value of <code class=
        !          6654:             "varname">USE_BUILTIN.<em class=
        !          6655:             "replaceable"><code>pkg</code></em></code> set in the
        !          6656:             previous section. This typically includes, e.g., adding
1.1       grant    6657:             additional dependency restrictions and listing
1.14    ! xtraeme  6658:             additional files to symlink into <code class=
        !          6659:             "filename">${BUILDLINK_DIR}</code> (via <code class=
        !          6660:             "varname">BUILDLINK_FILES.<em class=
        !          6661:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    6662:           </div>
                   6663: 
                   6664:           <div class="sect2" lang="en" xml:lang="en">
                   6665:             <div class="titlepage">
                   6666:               <div>
                   6667:                 <div>
1.14    ! xtraeme  6668:                   <h3 class="title"><a name="id2588873" id=
        !          6669:                   "id2588873"></a>9.3.2.&nbsp;Global preferences
1.1       grant    6670:                   for native or pkgsrc software</h3>
                   6671:                 </div>
                   6672:               </div>
                   6673:             </div>
                   6674: 
                   6675:             <p>When building packages, it's possible to choose
                   6676:             whether to set a global preference for using either the
                   6677:             built-in (native) version or the pkgsrc version of
                   6678:             software to satisfy a dependency. This is controlled by
1.14    ! xtraeme  6679:             setting <code class="varname">PREFER_PKGSRC</code> and
        !          6680:             <code class="varname">PREFER_NATIVE</code>. These
        !          6681:             variables take values of either &#8220;<span class=
1.1       grant    6682:             "quote">yes</span>&#8221;, &#8220;<span class=
                   6683:             "quote">no</span>&#8221;, or a list of packages.
1.14    ! xtraeme  6684:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
        !          6685:             to use the pkgsrc versions of software, while
        !          6686:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
        !          6687:             to use the built-in versions. Preferences are
        !          6688:             determined by the most specific instance of the package
        !          6689:             in either <code class="varname">PREFER_PKGSRC</code> or
        !          6690:             <code class="varname">PREFER_NATIVE</code>. If a
        !          6691:             package is specified in neither or in both variables,
        !          6692:             then <code class="varname">PREFER_PKGSRC</code> has
        !          6693:             precedence over <code class=
        !          6694:             "varname">PREFER_NATIVE</code>. For example, to require
        !          6695:             using pkgsrc versions of software for all but the most
        !          6696:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    6697:             <pre class="programlisting">
                   6698:         PREFER_PKGSRC=  yes
                   6699:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   6700:       
                   6701: </pre>
                   6702: 
                   6703:             <p>A package <span class=
1.14    ! xtraeme  6704:             "emphasis"><em>must</em></span> have a <code class=
        !          6705:             "filename">builtin.mk</code> file to be listed in
        !          6706:             <code class="varname">PREFER_NATIVE</code>, otherwise
        !          6707:             it is simply ignored in that list.</p>
1.1       grant    6708:           </div>
                   6709:         </div>
                   6710:       </div>
                   6711: 
                   6712:       <div class="chapter" lang="en" xml:lang="en">
                   6713:         <div class="titlepage">
                   6714:           <div>
                   6715:             <div>
                   6716:               <h2 class="title"><a name="options" id=
                   6717:               "options"></a>Chapter&nbsp;10.&nbsp;Options
                   6718:               handling</h2>
                   6719:             </div>
                   6720:           </div>
                   6721:         </div>
                   6722: 
                   6723:         <div class="toc">
                   6724:           <p><b>Table of Contents</b></p>
                   6725: 
                   6726:           <dl>
1.14    ! xtraeme  6727:             <dt><span class="sect1"><a href="#id2588946">10.1.
1.1       grant    6728:             Global default options</a></span></dt>
                   6729: 
1.14    ! xtraeme  6730:             <dt><span class="sect1"><a href="#id2588961">10.2.
        !          6731:             Converting packages to use <code class=
        !          6732:             "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    6733:           </dl>
                   6734:         </div>
                   6735: 
                   6736:         <p>Many packages have the ability to be built to support
1.14    ! xtraeme  6737:         different sets of features. <code class=
        !          6738:         "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1       grant    6739:         that provides generic handling of those options that
                   6740:         determine different ways in which the packages can be
                   6741:         built. It's possible for the user to specify exactly which
                   6742:         sets of options will be built into a package or to allow a
                   6743:         set of global default options apply.</p>
                   6744: 
                   6745:         <div class="sect1" lang="en" xml:lang="en">
                   6746:           <div class="titlepage">
                   6747:             <div>
                   6748:               <div>
                   6749:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  6750:                 "id2588946" id="id2588946"></a>10.1.&nbsp;Global
1.1       grant    6751:                 default options</h2>
                   6752:               </div>
                   6753:             </div>
                   6754:           </div>
                   6755: 
1.14    ! xtraeme  6756:           <p>Global default options are listed in <code class=
        !          6757:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1       grant    6758:           the options that should be built into every package if
                   6759:           that option is supported. This variable should be set in
1.14    ! xtraeme  6760:           <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    6761:         </div>
                   6762: 
                   6763:         <div class="sect1" lang="en" xml:lang="en">
                   6764:           <div class="titlepage">
                   6765:             <div>
                   6766:               <div>
                   6767:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  6768:                 "id2588961" id=
        !          6769:                 "id2588961"></a>10.2.&nbsp;Converting packages to
        !          6770:                 use <code class=
        !          6771:                 "filename">bsd.options.mk</code></h2>
1.1       grant    6772:               </div>
                   6773:             </div>
                   6774:           </div>
                   6775: 
1.14    ! xtraeme  6776:           <p>The following example shows how <code class=
        !          6777:           "filename">bsd.options.mk</code> should be use in a
        !          6778:           package <code class="filename">Makefile</code>, or in a
        !          6779:           file, e.g. <code class="filename">options.mk</code>, that
        !          6780:           is included by the main package <code class=
        !          6781:           "filename">Makefile</code>.</p>
1.1       grant    6782:           <pre class="programlisting">
                   6783: # Global and legacy options
                   6784: .if defined(WIBBLE_USE_OPENLDAP) &amp;&amp; !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
                   6785: PKG_DEFAULT_OPTIONS+=   ldap
                   6786: .endif
                   6787: .if defined(USE_SASL2) &amp;&amp; !empty(USE_SASL2:M[yY][eE][sS])
                   6788: PKG_DEFAULT_OPTIONS+=   sasl
                   6789: .endif
                   6790: 
                   6791: PKG_OPTIONS_VAR=        PKG_OPTIONS.wibble
                   6792: PKG_SUPPORTED_OPTIONS=  ldap sasl
                   6793: #
                   6794: # Default options for "wibble" package.
                   6795: #
                   6796: .if !defined(PKG_OPTIONS.wibble)
                   6797: PKG_DEFAULT_OPTIONS+=   sasl
                   6798: endif
                   6799: .include "../../mk/bsd.options.mk"
                   6800: 
                   6801: # Package-specific option-handling
                   6802: 
                   6803: ###
                   6804: ### LDAP support
                   6805: ###
                   6806: .if !empty(PKG_OPTIONS:Mldap)
                   6807: .  include "../../databases/openldap/buildlink3.mk"
                   6808: CONFIGURE_ARGS+=      --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   6809: .endif
                   6810: 
                   6811: ###
                   6812: ### SASL authentication
                   6813: ###
                   6814: .if !empty(PKG_OPTIONS:Msasl)
                   6815: .  include "../../security/cyrus-sasl2/buildlink3.mk"
                   6816: CONFIGURE_ARGS+=        --enable-sasl=${BUILDLINK_PREFIX.sasl}
                   6817: .endif
                   6818:       
                   6819: </pre>
                   6820: 
                   6821:           <p>The first section only exists if you are converting a
                   6822:           package that had its own ad-hoc options handling to use
1.14    ! xtraeme  6823:           <code class="filename">bsd.options.mk</code>. It converts
1.1       grant    6824:           global or legacy options variables into an equivalent
1.14    ! xtraeme  6825:           <code class="varname">PKG_OPTIONS.<em class=
        !          6826:           "replaceable"><code>pkg</code></em></code> value. These
        !          6827:           sections will be removed over time as the old options are
        !          6828:           in turn deprecated and removed.</p>
1.1       grant    6829: 
                   6830:           <p>The second section contains the information about
                   6831:           which build options are supported by the package, and any
                   6832:           default options settings if needed.</p>
                   6833: 
                   6834:           <div class="orderedlist">
                   6835:             <ol type="1">
                   6836:               <li>
1.14    ! xtraeme  6837:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
        !          6838:                 a list of the name of the <a href=
1.1       grant    6839:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6840:                 <span class="citerefentry"><span class=
                   6841:                 "refentrytitle">make</span>(1)</span></a> variables
                   6842:                 that contain the options the user wishes to select.
                   6843:                 The recommended value is &#8220;<span class=
1.14    ! xtraeme  6844:                 "quote">PKG_OPTIONS.<em class=
        !          6845:                 "replaceable"><code>pkg</code></em></span>&#8221;
        !          6846:                 but any package-specific value may be used. This
1.1       grant    6847:                 variable should be set in a package Makefile.</p>
                   6848:               </li>
                   6849: 
                   6850:               <li>
1.14    ! xtraeme  6851:                 <p><code class=
        !          6852:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
        !          6853:                 build options supported by the package. This
        !          6854:                 variable should be set in a package Makefile.</p>
1.1       grant    6855:               </li>
                   6856: 
                   6857:               <li>
1.14    ! xtraeme  6858:                 <p><code class="varname">${PKG_OPTIONS_VAR}</code>
        !          6859:                 (the variables named in <code class=
        !          6860:                 "varname">PKG_OPTIONS_VAR</code>) are variables
        !          6861:                 that list the selected build options and override
        !          6862:                 any default options given in <code class=
        !          6863:                 "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1       grant    6864:                 options begin with a &#8220;<span class=
                   6865:                 "quote">-</span>&#8221;, then that option is always
                   6866:                 removed from the selected build options, e.g.</p>
                   6867:                 <pre class="programlisting">
                   6868:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   6869:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6870:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
                   6871:         # implies PKG_OPTIONS == "kerberos ldap"
                   6872:           
                   6873: </pre>
                   6874: 
                   6875:                 <p>or</p>
                   6876:                 <pre class="programlisting">
                   6877:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6878:         WIBBLE_OPTIONS=         kerberos -ldap ldap
                   6879:         # implies PKG_OPTIONS == "kerberos"
                   6880:           
                   6881: </pre>
                   6882: 
1.14    ! xtraeme  6883:                 <p>This variable should be set in <code class=
        !          6884:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    6885:               </li>
                   6886:             </ol>
                   6887:           </div>
                   6888: 
                   6889:           <p>After the inclusion of bsd.options.mk, the following
                   6890:           variables are set:</p>
                   6891: 
                   6892:           <div class="itemizedlist">
                   6893:             <ul type="disc">
                   6894:               <li>
1.14    ! xtraeme  6895:                 <p><code class="varname">PKG_OPTIONS</code>
        !          6896:                 contains the list of the selected build options,
        !          6897:                 properly filtered to remove unsupported and
        !          6898:                 duplicate options.</p>
1.1       grant    6899:               </li>
                   6900:             </ul>
                   6901:           </div>
                   6902: 
                   6903:           <p>The remaining sections contain the logic that is
                   6904:           specific to each option. There should be a check for
1.14    ! xtraeme  6905:           every option listed in <code class=
        !          6906:           "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
        !          6907:           be clear documentation on what turning on the option will
        !          6908:           do in the comments preceding each section. The correct
        !          6909:           way to check for an option is to check whether it is
        !          6910:           listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1       grant    6911:         </div>
                   6912:       </div>
                   6913: 
                   6914:       <div class="chapter" lang="en" xml:lang="en">
                   6915:         <div class="titlepage">
                   6916:           <div>
                   6917:             <div>
                   6918:               <h2 class="title"><a name="build" id=
                   6919:               "build"></a>Chapter&nbsp;11.&nbsp;The build
                   6920:               process</h2>
                   6921:             </div>
                   6922:           </div>
                   6923:         </div>
                   6924: 
                   6925:         <div class="toc">
                   6926:           <p><b>Table of Contents</b></p>
                   6927: 
                   6928:           <dl>
                   6929:             <dt><span class="sect1"><a href="#build.prefix">11.1.
                   6930:             Program location</a></span></dt>
                   6931: 
1.14    ! xtraeme  6932:             <dt><span class="sect1"><a href="#id2589569">11.2. Main
1.1       grant    6933:             targets</a></span></dt>
                   6934: 
                   6935:             <dt><span class="sect1"><a href=
                   6936:             "#build.helpful-targets">11.3. Other helpful
                   6937:             targets</a></span></dt>
                   6938:           </dl>
                   6939:         </div>
                   6940: 
                   6941:         <p>The basic steps for building a program are always the
                   6942:         same. First the program's source (<span class=
                   6943:         "emphasis"><em>distfile</em></span>) must be brought to the
                   6944:         local system and then extracted. After any patches to
                   6945:         compile properly on NetBSD are applied, the software can be
                   6946:         configured, then built (usually by compiling), and finally
                   6947:         the generated binaries, etc. can be put into place on the
                   6948:         system. These are exactly the steps performed by the NetBSD
                   6949:         package system, which is implemented as a series of targets
1.14    ! xtraeme  6950:         in a central Makefile, <code class=
        !          6951:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    6952: 
                   6953:         <div class="sect1" lang="en" xml:lang="en">
                   6954:           <div class="titlepage">
                   6955:             <div>
                   6956:               <div>
                   6957:                 <h2 class="title" style="clear: both"><a name=
                   6958:                 "build.prefix" id=
                   6959:                 "build.prefix"></a>11.1.&nbsp;Program location</h2>
                   6960:               </div>
                   6961:             </div>
                   6962:           </div>
                   6963: 
                   6964:           <p>Before outlining the process performed by the NetBSD
                   6965:           package system in the next section, here's a brief
                   6966:           discussion on where programs are installed, and which
                   6967:           variables influence this.</p>
                   6968: 
1.14    ! xtraeme  6969:           <p>The automatic variable <code class=
        !          6970:           "varname">PREFIX</code> indicates where all files of the
        !          6971:           final program shall be installed. It is usually set to
        !          6972:           <code class="varname">LOCALBASE</code> (<code class=
        !          6973:           "filename">/usr/pkg</code>), or <code class=
        !          6974:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    6975:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14    ! xtraeme  6976:           The value of <code class="varname">PREFIX</code> needs to
        !          6977:           be put into the various places in the program's source
        !          6978:           where paths to these files are encoded. See <a href=
1.1       grant    6979:           "#components.patches" title=
                   6980:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   6981:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   6982:           title=
                   6983:           "12.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;12.3.1,
                   6984:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   6985:           details.</p>
                   6986: 
                   6987:           <p>When choosing which of these variables to use, follow
                   6988:           the following rules:</p>
                   6989: 
                   6990:           <div class="itemizedlist">
                   6991:             <ul type="disc">
                   6992:               <li>
1.14    ! xtraeme  6993:                 <p><code class="varname">PREFIX</code> always
        !          6994:                 points to the location where the current pkg will
        !          6995:                 be installed. When referring to a pkg's own
1.1       grant    6996:                 installation path, use &#8220;<span class=
                   6997:                 "quote">${PREFIX}</span>&#8221;.</p>
                   6998:               </li>
                   6999: 
                   7000:               <li>
1.14    ! xtraeme  7001:                 <p><code class="varname">LOCALBASE</code> is where
        !          7002:                 all non-X11 pkgs are installed. If you need to
1.1       grant    7003:                 construct a -I or -L argument to the compiler to
                   7004:                 find includes and libraries installed by another
                   7005:                 non-X11 pkg, use &#8220;<span class=
                   7006:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   7007:               </li>
                   7008: 
                   7009:               <li>
1.14    ! xtraeme  7010:                 <p><code class="varname">X11BASE</code> is where
        !          7011:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    7012:                 installed. When looking for <span class=
                   7013:                 "emphasis"><em>standard</em></span> X11 includes
                   7014:                 (not those installed by a pkg), use
                   7015:                 &#8220;<span class=
                   7016:                 "quote">${X11BASE}</span>&#8221;.</p>
                   7017:               </li>
                   7018: 
                   7019:               <li>
                   7020:                 <p>X11 based are special in that they may be
1.14    ! xtraeme  7021:                 installed in either <code class=
        !          7022:                 "varname">X11BASE</code> or <code class=
        !          7023:                 "varname">LOCALBASE</code>.</p>
1.1       grant    7024: 
                   7025:                 <p>Usually, X11 packages should be installed under
1.14    ! xtraeme  7026:                 <code class="varname">LOCALBASE</code> whenever
        !          7027:                 possible. Note that you will need to set
        !          7028:                 <code class="varname">USE_X11</code> in them to
        !          7029:                 request the presence of X11 and to get the right
        !          7030:                 compilation flags.</p>
1.1       grant    7031: 
                   7032:                 <p>Even though, there are some packages that cannot
1.14    ! xtraeme  7033:                 be installed under <code class=
        !          7034:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    7035:                 app-defaults files. These packages are special and
1.14    ! xtraeme  7036:                 they must be placed under <code class=
        !          7037:                 "varname">X11BASE</code>. To accomplish this, set
        !          7038:                 either <code class="varname">USE_X11BASE</code> or
        !          7039:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    7040:                 package.</p>
                   7041: 
1.14    ! xtraeme  7042:                 <p>Some notes: <code class="varname">USE_X11</code>
        !          7043:                 and <code class="varname">USE_X11BASE</code> are
        !          7044:                 mutually exclusive. If you need to find includes or
        !          7045:                 libraries installed by a pkg that has <code class=
        !          7046:                 "varname">USE_IMAKE</code> or <code class=
        !          7047:                 "varname">USE_X11BASE</code> in its pkg
        !          7048:                 <code class="filename">Makefile</code>, you need to
        !          7049:                 use <span class="emphasis"><em>both</em></span>
        !          7050:                 <code class="filename">${X11BASE}</code> and
        !          7051:                 <code class="filename">${LOCALBASE}</code>. To
        !          7052:                 force installation of all X11 packages in
        !          7053:                 <code class="varname">LOCALBASE</code>, the
        !          7054:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          7055:                 href=
1.1       grant    7056:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.14    ! xtraeme  7057:                 class="pkgname">pkgtools/xpkgwedge</a> is enabled
        !          7058:                 by default.</p>
1.1       grant    7059:               </li>
                   7060: 
                   7061:               <li>
1.14    ! xtraeme  7062:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    7063:                 used to refer to the installed location of an X11
1.14    ! xtraeme  7064:                 package. <code class="varname">X11PREFIX</code>
        !          7065:                 will be set to <code class="varname">X11BASE</code>
        !          7066:                 if xpkgwedge is not installed, and to <code class=
        !          7067:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    7068:                 installed.</p>
                   7069:               </li>
                   7070: 
                   7071:               <li>
                   7072:                 <p>If xpkgwedge is installed, it is possible to
1.14    ! xtraeme  7073:                 have some packages installed in <code class=
        !          7074:                 "varname">X11BASE</code> and some in <code class=
        !          7075:                 "varname">LOCALBASE</code>. To determine the prefix
        !          7076:                 of an installed package, the <code class=
        !          7077:                 "varname">EVAL_PREFIX</code> definition can be
        !          7078:                 used. It takes pairs in the format
        !          7079:                 &#8220;<span class=
1.1       grant    7080:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.14    ! xtraeme  7081:                 the make(1) variable <code class=
        !          7082:                 "varname">DIRNAME</code> will be set to the prefix
        !          7083:                 of the installed package &lt;package&gt;, or
1.1       grant    7084:                 &#8220;<span class=
                   7085:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   7086:                 is not installed.</p>
                   7087: 
                   7088:                 <p>This is best illustrated by example.</p>
                   7089: 
1.14    ! xtraeme  7090:                 <p>The following lines are taken from <code class=
        !          7091:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    7092:                 <pre class="programlisting">
1.14    ! xtraeme  7093: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    7094: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   7095:                         --with-gtk-prefix="${GTKDIR}"           \
                   7096:                         --enable-multibyte
                   7097: </pre>
                   7098: 
                   7099:                 <p>Specific defaults can be defined for the
1.14    ! xtraeme  7100:                 packages evaluated using <code class=
        !          7101:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    7102:                 of the form:</p>
                   7103:                 <pre class="programlisting">
                   7104: GTKDIR_DEFAULT= ${LOCALBASE}
                   7105: </pre>
                   7106: 
1.14    ! xtraeme  7107:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    7108:                 corresponds to the first definition in the
1.14    ! xtraeme  7109:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    7110:               </li>
                   7111: 
                   7112:               <li>
1.14    ! xtraeme  7113:                 <p>Within <code class="filename">${PREFIX}</code>,
1.1       grant    7114:                 packages should install files according to hier(7),
                   7115:                 with the exception that manual pages go into
1.14    ! xtraeme  7116:                 <code class="filename">${PREFIX}/man</code>, not
        !          7117:                 <code class=
        !          7118:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    7119:               </li>
                   7120:             </ul>
                   7121:           </div>
                   7122:         </div>
                   7123: 
                   7124:         <div class="sect1" lang="en" xml:lang="en">
                   7125:           <div class="titlepage">
                   7126:             <div>
                   7127:               <div>
                   7128:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  7129:                 "id2589569" id="id2589569"></a>11.2.&nbsp;Main
1.1       grant    7130:                 targets</h2>
                   7131:               </div>
                   7132:             </div>
                   7133:           </div>
                   7134: 
                   7135:           <p>The main targets used during the build process defined
1.14    ! xtraeme  7136:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    7137: 
                   7138:           <div class="variablelist">
                   7139:             <dl>
                   7140:               <dt><span class="term">fetch</span></dt>
                   7141: 
                   7142:               <dd>
                   7143:                 <p>This will check if the file(s) given in the
1.14    ! xtraeme  7144:                 variables <code class="varname">DISTFILES</code>
        !          7145:                 and <code class="varname">PATCHFILES</code> (as
        !          7146:                 defined in the package's Makefile) are present on
        !          7147:                 the local system in <code class=
        !          7148:                 "filename">/usr/pkgsrc/distfiles</code>. If they
        !          7149:                 are not present, an attempt will be made to fetch
        !          7150:                 them using commands of the form:</p>
1.1       grant    7151:                 <pre class="programlisting">
                   7152: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   7153: </pre>
                   7154: 
                   7155:                 <p>where ${site} varies through several
1.14    ! xtraeme  7156:                 possibilities in turn: first, <code class=
        !          7157:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
        !          7158:                 then the sites specified in either <code class=
        !          7159:                 "varname">SITES_file</code> if defined, else
        !          7160:                 <code class="varname">MASTER_SITES</code> or
        !          7161:                 <code class="varname">PATCH_SITES</code>, as
        !          7162:                 applies, then finally the value of <code class=
        !          7163:                 "varname">MASTER_SITE_BACKUP</code>. The order of
        !          7164:                 all except the first can be optionally sorted by
        !          7165:                 the user, via setting either <code class=
        !          7166:                 "varname">MASTER_SORT_AWK</code> or <code class=
        !          7167:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    7168:               </dd>
                   7169: 
                   7170:               <dt><span class="term">checksum</span></dt>
                   7171: 
                   7172:               <dd>
                   7173:                 <p>After the distfile(s) are fetched, their
                   7174:                 checksum is generated and compared with the
                   7175:                 checksums stored in the distinfo file. If the
                   7176:                 checksums don't match, the build is aborted. This
                   7177:                 is to ensure the same distfile is used for
                   7178:                 building, and that the distfile wasn't changed,
                   7179:                 e.g. by some malign force, deliberately changed
                   7180:                 distfiles on the master distribution site or
                   7181:                 network lossage.</p>
                   7182:               </dd>
                   7183: 
                   7184:               <dt><span class="term">extract</span></dt>
                   7185: 
                   7186:               <dd>
                   7187:                 <p>When the distfiles are present on the local
                   7188:                 system, they need to be extracted, as they are
                   7189:                 usually in the form of some compressed archive
1.14    ! xtraeme  7190:                 format, most commonly <code class=
        !          7191:                 "filename">.tar.gz</code>.</p>
1.1       grant    7192: 
                   7193:                 <p>If only some of the distfiles need to be
                   7194:                 uncompressed, the files to be uncompressed should
1.14    ! xtraeme  7195:                 be put into <code class=
        !          7196:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    7197: 
1.14    ! xtraeme  7198:                 <p>If the distfiles are not in <code class=
        !          7199:                 "filename">.tar.gz</code> format, they can be
        !          7200:                 extracted by setting either <code class=
        !          7201:                 "varname">EXTRACT_SUFX</code>, or <code class=
        !          7202:                 "varname">EXTRACT_CMD</code>, <code class=
        !          7203:                 "varname">EXTRACT_BEFORE_ARGS</code> and
        !          7204:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
        !          7205:                 the former case, pkgsrc knows how to extract a
        !          7206:                 number of suffixes (<code class=
        !          7207:                 "filename">.tar.gz</code>, <code class=
        !          7208:                 "filename">.tgz</code>, <code class=
        !          7209:                 "filename">.tar.gz2</code>, <code class=
        !          7210:                 "filename">.tbz</code>, <code class=
        !          7211:                 "filename">.tar.Z</code>, <code class=
        !          7212:                 "filename">.tar</code>, <code class=
        !          7213:                 "filename">.shar.gz</code>, <code class=
        !          7214:                 "filename">.shar.bz2</code>, <code class=
        !          7215:                 "filename">.shar.Z</code>, <code class=
        !          7216:                 "filename">.shar</code>, <code class=
        !          7217:                 "filename">.Z</code>, <code class=
        !          7218:                 "filename">.bz2</code> and <code class=
        !          7219:                 "filename">.gz</code>; see the definition of the
        !          7220:                 various <code class="varname">DECOMPRESS_CMD</code>
        !          7221:                 variables <code class="filename">bsd.pkg.mk</code>
        !          7222:                 for a complete list). Here's an example on how to
        !          7223:                 use the other variables for a program that comes
        !          7224:                 with a compressed shell archive whose name ends in
        !          7225:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    7226:                 <pre class="programlisting">
                   7227:      EXTRACT_SUFX=   .msg.gz
                   7228:      EXTRACT_CMD=            zcat
                   7229:      EXTRACT_BEFORE_ARGS=
                   7230:      EXTRACT_AFTER_ARGS=     |sh
                   7231: </pre>
                   7232:               </dd>
                   7233: 
                   7234:               <dt><span class="term">patch</span></dt>
                   7235: 
                   7236:               <dd>
                   7237:                 <p>After extraction, all the patches named by the
1.14    ! xtraeme  7238:                 <code class="varname">PATCHFILES</code>, those
        !          7239:                 present in the patches subdirectory of the package
        !          7240:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
        !          7241:                 <code class=
        !          7242:                 "filename">/usr/local/patches/graphics/png</code>)
        !          7243:                 are applied. Patchfiles ending in <code class=
        !          7244:                 "filename">.Z</code> or <code class=
        !          7245:                 "filename">.gz</code> are uncompressed before they
        !          7246:                 are applied, files ending in <code class=
        !          7247:                 "filename">.orig</code> or <code class=
        !          7248:                 "filename">.rej</code> are ignored. Any special
        !          7249:                 options to patch(1) can be handed in <code class=
        !          7250:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
        !          7251:                 "#components.patches" title=
1.1       grant    7252:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   7253:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   7254: 
                   7255:                 <p>By default patch(1) is given special args to
                   7256:                 make it fail if the patches apply with some lines
                   7257:                 of fuzz. Please fix (regen) the patches so that
                   7258:                 they apply cleanly. The rationale behind this is
                   7259:                 that patches that don't apply cleanly may end up
                   7260:                 being applied in the wrong place, and cause severe
                   7261:                 harm there.</p>
                   7262:               </dd>
                   7263: 
                   7264:               <dt><span class="term">configure</span></dt>
                   7265: 
                   7266:               <dd>
                   7267:                 <p>Most pieces of software need information on the
                   7268:                 header files, system calls, and library routines
                   7269:                 which are available in NetBSD. This is the process
                   7270:                 known as configuration, and is usually automated.
                   7271:                 In most cases, a script is supplied with the
                   7272:                 source, and its invocation results in generation of
                   7273:                 header files, Makefiles, etc.</p>
                   7274: 
                   7275:                 <p>If the program's distfile contains its own
                   7276:                 configure script, this can be invoked by setting
1.14    ! xtraeme  7277:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    7278:                 configure script is a GNU autoconf script,
1.14    ! xtraeme  7279:                 <code class="varname">GNU_CONFIGURE</code> should
        !          7280:                 be specified instead. In either case, any arguments
        !          7281:                 to the configure script can be specified in the
        !          7282:                 <code class="varname">CONFIGURE_ARGS</code>
        !          7283:                 variable, and the configure script's name can be
        !          7284:                 set in <code class=
        !          7285:                 "varname">CONFIGURE_SCRIPT</code> if it differs
        !          7286:                 from the default &#8220;<span class=
1.1       grant    7287:                 "quote">configure</span>&#8221;. Here's an example
                   7288:                 from the <a xmlns=
                   7289:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7290:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.14    ! xtraeme  7291:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    7292:                 <pre class="programlisting">
                   7293: HAS_CONFIGURE=          yes
                   7294: CONFIGURE_SCRIPT=       Configure
                   7295: CONFIGURE_ARGS+=        netbsd13
                   7296: </pre>
                   7297: 
                   7298:                 <p>If the program uses an Imakefile for
                   7299:                 configuration, the appropriate steps can be invoked
1.14    ! xtraeme  7300:                 by setting <code class="varname">USE_IMAKE</code>
        !          7301:                 to &#8220;<span class="quote">YES</span>&#8221;.
        !          7302:                 (If you only want the package installed in
        !          7303:                 <code class="varname">$X11PREFIX</code> but xmkmf
        !          7304:                 not being run, set <code class=
        !          7305:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    7306:               </dd>
                   7307: 
                   7308:               <dt><span class="term">build</span></dt>
                   7309: 
                   7310:               <dd>
                   7311:                 <p>Once configuration has taken place, the software
1.14    ! xtraeme  7312:                 will be built by invoking <code class=
        !          7313:                 "varname">$MAKE_PROGRAM</code> on <code class=
        !          7314:                 "varname">$MAKEFILE</code> with <code class=
        !          7315:                 "varname">$BUILD_TARGET</code> as the target to
        !          7316:                 build. The default <code class=
        !          7317:                 "varname">MAKE_PROGRAM</code> is
        !          7318:                 &#8220;<span class="quote">gmake</span>&#8221; if
        !          7319:                 <code class="varname">USE_GNU_TOOLS</code> contains
1.7       wiz      7320:                 &#8220;<span class="quote">make</span>&#8221;,
1.1       grant    7321:                 &#8220;<span class="quote">make</span>&#8221;
1.14    ! xtraeme  7322:                 otherwise. <code class="varname">MAKEFILE</code> is
        !          7323:                 set to &#8220;<span class=
1.1       grant    7324:                 "quote">Makefile</span>&#8221; by default, and
1.14    ! xtraeme  7325:                 <code class="varname">BUILD_TARGET</code> defaults
        !          7326:                 to &#8220;<span class="quote">all</span>&#8221;.
        !          7327:                 Any of these variables can be set in the package's
1.1       grant    7328:                 Makefile to change the default build process.</p>
                   7329:               </dd>
                   7330: 
                   7331:               <dt><span class="term">install</span></dt>
                   7332: 
                   7333:               <dd>
                   7334:                 <p>Once the build stage has completed, the final
                   7335:                 step is to install the software in public
                   7336:                 directories, so users can access the programs and
1.14    ! xtraeme  7337:                 files. As in the build-target, <code class=
        !          7338:                 "varname">$MAKE_PROGRAM</code> is invoked on
        !          7339:                 <code class="varname">$MAKEFILE</code> here, but
        !          7340:                 with the <code class=
        !          7341:                 "varname">$INSTALL_TARGET</code> instead, the
        !          7342:                 latter defaulting to &#8220;<span class=
        !          7343:                 "quote">install</span>&#8221; (plus
        !          7344:                 &#8220;<span class=
        !          7345:                 "quote">install.man</span>&#8221;, if <code class=
        !          7346:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    7347:               </dd>
                   7348:             </dl>
                   7349:           </div>
                   7350: 
                   7351:           <p>If no target is specified, the default is
                   7352:           &#8220;<span class="quote">build</span>&#8221;. If a
                   7353:           subsequent stage is requested, all prior stages are made:
1.14    ! xtraeme  7354:           e.g. <span><strong class="command">make
        !          7355:           build</strong></span> will also perform the equivalent
        !          7356:           of:</p>
1.1       grant    7357:           <pre class="programlisting">
                   7358: make fetch
                   7359: make checksum
                   7360: make extract
                   7361: make patch
                   7362: make configure
                   7363: make build
                   7364: </pre>
                   7365:         </div>
                   7366: 
                   7367:         <div class="sect1" lang="en" xml:lang="en">
                   7368:           <div class="titlepage">
                   7369:             <div>
                   7370:               <div>
                   7371:                 <h2 class="title" style="clear: both"><a name=
                   7372:                 "build.helpful-targets" id=
                   7373:                 "build.helpful-targets"></a>11.3.&nbsp;Other
                   7374:                 helpful targets</h2>
                   7375:               </div>
                   7376:             </div>
                   7377:           </div>
                   7378: 
                   7379:           <div class="variablelist">
                   7380:             <dl>
                   7381:               <dt><span class="term">pre/post-*</span></dt>
                   7382: 
                   7383:               <dd>
                   7384:                 <p>For any of the main targets described in the
                   7385:                 previous section, two auxiliary targets exist with
                   7386:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   7387:                 &#8220;<span class="quote">post-</span>&#8221; used
                   7388:                 as a prefix for the main target's name. These
                   7389:                 targets are invoked before and after the main
                   7390:                 target is called, allowing extra configuration or
                   7391:                 installation steps be performed from a package's
                   7392:                 Makefile, for example, which a program's configure
                   7393:                 script or install target omitted.</p>
                   7394:               </dd>
                   7395: 
                   7396:               <dt><span class="term">do-*</span></dt>
                   7397: 
                   7398:               <dd>
                   7399:                 <p>Should one of the main targets do the wrong
                   7400:                 thing, and should there be no variable to fix this,
                   7401:                 you can redefine it with the do-* target. (Note
                   7402:                 that redefining the target itself instead of the
                   7403:                 do-* target is a bad idea, as the pre-* and post-*
                   7404:                 targets won't be called anymore, etc.) You will not
                   7405:                 usually need to do this.</p>
                   7406:               </dd>
                   7407: 
                   7408:               <dt><span class="term">reinstall</span></dt>
                   7409: 
                   7410:               <dd>
1.14    ! xtraeme  7411:                 <p>If you did a <span><strong class="command">make
        !          7412:                 install</strong></span> and you noticed some file
        !          7413:                 was not installed properly, you can repeat the
1.1       grant    7414:                 installation with this target, which will ignore
                   7415:                 the &#8220;<span class="quote">already
                   7416:                 installed</span>&#8221; flag.</p>
                   7417:               </dd>
                   7418: 
                   7419:               <dt><span class="term">deinstall</span></dt>
                   7420: 
                   7421:               <dd>
                   7422:                 <p>This target does a pkg_delete(1) in the current
                   7423:                 directory, effectively de-installing the package.
                   7424:                 The following variables can be used to tune the
                   7425:                 behaviour:</p>
                   7426: 
                   7427:                 <div class="variablelist">
                   7428:                   <dl>
1.14    ! xtraeme  7429:                     <dt><span class="term"><code class=
        !          7430:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    7431: 
                   7432:                     <dd>
                   7433:                       <p>Add a "-v" to the <a href=
                   7434:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7435:                       <span class="citerefentry"><span class=
                   7436:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7437:                       command.</p>
                   7438:                     </dd>
                   7439: 
1.14    ! xtraeme  7440:                     <dt><span class="term"><code class=
        !          7441:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    7442: 
                   7443:                     <dd>
                   7444:                       <p>Remove all packages that require (depend
                   7445:                       on) the given package. This can be used to
                   7446:                       remove any packages that may have been pulled
                   7447:                       in by a given package, e.g. if
1.14    ! xtraeme  7448:                       <span><strong class="command">make deinstall
        !          7449:                       DEINSTALLDEPENDS=1</strong></span> is done in
        !          7450:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    7451:                       this is likely to remove whole KDE. Works by
                   7452:                       adding &#8220;<span class=
                   7453:                       "quote">-R</span>&#8221; to the <a href=
                   7454:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7455:                       <span class="citerefentry"><span class=
                   7456:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7457:                       command line.</p>
                   7458:                     </dd>
                   7459:                   </dl>
                   7460:                 </div>
                   7461:               </dd>
                   7462: 
                   7463:               <dt><span class="term">update</span></dt>
                   7464: 
                   7465:               <dd>
                   7466:                 <p>This target causes the current package to be
                   7467:                 updated to the latest version. The package and all
                   7468:                 depending packages first get de-installed, then
                   7469:                 current versions of the corresponding packages get
                   7470:                 compiled and installed. This is similar to manually
                   7471:                 noting which packages are currently installed, then
1.14    ! xtraeme  7472:                 performing a series of <span><strong class=
        !          7473:                 "command">make deinstall</strong></span> and
        !          7474:                 <span><strong class="command">make
        !          7475:                 install</strong></span> (or whatever <code class=
        !          7476:                 "varname">UPDATE_TARGET</code> is set to) for these
        !          7477:                 packages.</p>
1.1       grant    7478: 
                   7479:                 <p>You can use the &#8220;<span class=
                   7480:                 "quote">update</span>&#8221; target to resume
1.14    ! xtraeme  7481:                 package updating in case a previous
        !          7482:                 <span><strong class="command">make
        !          7483:                 update</strong></span> was interrupted for some
        !          7484:                 reason. However, in this case, make sure you don't
        !          7485:                 call <span><strong class="command">make
        !          7486:                 clean</strong></span> or otherwise remove the list
        !          7487:                 of dependent packages in <code class=
        !          7488:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    7489:                 ability to automatically update the current package
                   7490:                 along with the dependent packages you have
                   7491:                 installed.</p>
                   7492: 
1.14    ! xtraeme  7493:                 <p>Resuming an interrupted <span><strong class=
        !          7494:                 "command">make update</strong></span> will only
        !          7495:                 work as long as the package tree remains unchanged.
        !          7496:                 If the source code for one of the packages to be
        !          7497:                 updated has been changed, resuming
        !          7498:                 <span><strong class="command">make
        !          7499:                 update</strong></span> will most certainly
        !          7500:                 fail!</p>
1.1       grant    7501: 
                   7502:                 <p>The following variables can be used either on
1.14    ! xtraeme  7503:                 the command line or in <code class=
        !          7504:                 "filename">/etc/mk.conf</code> to alter the
        !          7505:                 behaviour of <span><strong class="command">make
        !          7506:                 update</strong></span>:</p>
1.1       grant    7507: 
                   7508:                 <div class="variablelist">
                   7509:                   <dl>
1.14    ! xtraeme  7510:                     <dt><span class="term"><code class=
        !          7511:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    7512: 
                   7513:                     <dd>
                   7514:                       <p>Install target to recursively use for the
                   7515:                       updated package and the dependent packages.
1.14    ! xtraeme  7516:                       Defaults to <code class=
        !          7517:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    7518:                       &#8220;<span class=
                   7519:                       "quote">install</span>&#8221; otherwise for
1.14    ! xtraeme  7520:                       <span><strong class="command">make
        !          7521:                       update</strong></span>. e.g.
        !          7522:                       <span><strong class="command">make update
        !          7523:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    7524:                     </dd>
                   7525: 
1.14    ! xtraeme  7526:                     <dt><span class="term"><code class=
        !          7527:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    7528: 
                   7529:                     <dd>
                   7530:                       <p>Don't clean up after updating. Useful if
                   7531:                       you want to leave the work sources of the
                   7532:                       updated packages around for inspection or
                   7533:                       other purposes. Be sure you eventually clean
                   7534:                       up the source tree (see the
                   7535:                       &#8220;<span class=
                   7536:                       "quote">clean-update</span>&#8221; target
                   7537:                       below) or you may run into troubles with old
                   7538:                       source code still lying around on your next
1.14    ! xtraeme  7539:                       <span><strong class=
        !          7540:                       "command">make</strong></span> or
        !          7541:                       <span><strong class="command">make
        !          7542:                       update</strong></span>.</p>
1.1       grant    7543:                     </dd>
                   7544: 
1.14    ! xtraeme  7545:                     <dt><span class="term"><code class=
        !          7546:                     "varname">REINSTALL</code></span></dt>
1.1       grant    7547: 
                   7548:                     <dd>
                   7549:                       <p>Deinstall each package before installing
1.14    ! xtraeme  7550:                       (making <code class=
        !          7551:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    7552:                       necessary if the &#8220;<span class=
                   7553:                       "quote">clean-update</span>&#8221; target
                   7554:                       (see below) was called after interrupting a
1.14    ! xtraeme  7555:                       running <span><strong class="command">make
        !          7556:                       update</strong></span>.</p>
1.1       grant    7557:                     </dd>
                   7558: 
1.14    ! xtraeme  7559:                     <dt><span class="term"><code class=
        !          7560:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    7561: 
                   7562:                     <dd>
                   7563:                       <p>Allows you to disable recursion and
                   7564:                       hardcode the target for packages. The default
                   7565:                       is &#8220;<span class=
                   7566:                       "quote">update</span>&#8221; for the update
                   7567:                       target, facilitating a recursive update of
1.14    ! xtraeme  7568:                       prerequisite packages. Only set <code class=
        !          7569:                       "varname">DEPENDS_TARGET</code> if you want
        !          7570:                       to disable recursive updates. Use
        !          7571:                       <code class="varname">UPDATE_TARGET</code>
        !          7572:                       instead to just set a specific target for
        !          7573:                       each package to be installed during
        !          7574:                       <span><strong class="command">make
        !          7575:                       update</strong></span> (see above).</p>
1.1       grant    7576:                     </dd>
                   7577:                   </dl>
                   7578:                 </div>
                   7579:               </dd>
                   7580: 
                   7581:               <dt><span class="term">clean-update</span></dt>
                   7582: 
                   7583:               <dd>
                   7584:                 <p>Clean the source tree for all packages that
1.14    ! xtraeme  7585:                 would get updated if <span><strong class=
        !          7586:                 "command">make update</strong></span> was called
        !          7587:                 from the current directory. This target should not
        !          7588:                 be used if the current package (or any of its
        !          7589:                 depending packages) have already been de-installed
        !          7590:                 (e.g., after calling <span><strong class=
        !          7591:                 "command">make update</strong></span>) or you may
        !          7592:                 lose some packages you intended to update. As a
        !          7593:                 rule of thumb: only use this target <span class=
        !          7594:                 "emphasis"><em>before</em></span> the first time
        !          7595:                 you run <span><strong class="command">make
        !          7596:                 update</strong></span> and only if you have a dirty
        !          7597:                 package tree (e.g., if you used <code class=
        !          7598:                 "varname">NOCLEAN</code>).</p>
1.1       grant    7599: 
                   7600:                 <p>If you unsure about whether your tree is clean
1.14    ! xtraeme  7601:                 you can either perform a <span><strong class=
        !          7602:                 "command">make clean</strong></span> at the top of
        !          7603:                 the tree, or use the following sequence of commands
1.1       grant    7604:                 from the directory of the package you want to
                   7605:                 update (<span class=
                   7606:                 "emphasis"><em>before</em></span> running
1.14    ! xtraeme  7607:                 <span><strong class="command">make
        !          7608:                 update</strong></span> for the first time,
        !          7609:                 otherwise you lose all the packages you wanted to
        !          7610:                 update!):</p>
1.1       grant    7611:                 <pre class="screen">
1.14    ! xtraeme  7612: <code class="prompt">#</code> <strong class=
        !          7613: "userinput"><code>make clean-update</code></strong>
        !          7614: <code class="prompt">#</code> <strong class=
        !          7615: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
        !          7616: <code class="prompt">#</code> <strong class=
        !          7617: "userinput"><code>make update</code></strong>
1.1       grant    7618: </pre>
                   7619: 
                   7620:                 <p>The following variables can be used either on
1.14    ! xtraeme  7621:                 the command line or in <code class=
        !          7622:                 "filename">/etc/mk.conf</code> to alter the
        !          7623:                 behaviour of <span><strong class="command">make
        !          7624:                 clean-update</strong></span>:</p>
1.1       grant    7625: 
                   7626:                 <div class="variablelist">
                   7627:                   <dl>
1.14    ! xtraeme  7628:                     <dt><span class="term"><code class=
        !          7629:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    7630: 
                   7631:                     <dd>
1.14    ! xtraeme  7632:                       <p>After <span><strong class="command">make
        !          7633:                       clean</strong></span>, do not reconstruct the
        !          7634:                       list of directories to update for this
        !          7635:                       package. Only use this if
        !          7636:                       <span><strong class="command">make
        !          7637:                       update</strong></span> successfully installed
        !          7638:                       all packages you wanted to update. Normally,
        !          7639:                       this is done automatically on
        !          7640:                       <span><strong class="command">make
        !          7641:                       update</strong></span>, but may have been
        !          7642:                       suppressed by the <code class=
        !          7643:                       "varname">NOCLEAN</code> variable (see
1.1       grant    7644:                       above).</p>
                   7645:                     </dd>
                   7646:                   </dl>
                   7647:                 </div>
                   7648:               </dd>
                   7649: 
                   7650:               <dt><span class="term">info</span></dt>
                   7651: 
                   7652:               <dd>
                   7653:                 <p>This target invokes <a href=
                   7654:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   7655:                 <span class="citerefentry"><span class=
                   7656:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   7657:                 the current package. You can use this to check
                   7658:                 which version of a package is installed.</p>
                   7659:               </dd>
                   7660: 
                   7661:               <dt><span class="term">readme</span></dt>
                   7662: 
                   7663:               <dd>
1.14    ! xtraeme  7664:                 <p>This target generates a <code class=
        !          7665:                 "filename">README.html</code> file, which can be
1.1       grant    7666:                 viewed using a browser such as <a xmlns=
                   7667:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7668:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.14    ! xtraeme  7669:                 class="pkgname">www/mozilla</a> or <a xmlns=
        !          7670:                 "http://www.w3.org/TR/xhtml1/transitional" href=
        !          7671:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
        !          7672:                 class="pkgname">www/links</a>. The generated files
        !          7673:                 contain references to any packages which are in the
        !          7674:                 <code class="varname">PACKAGES</code> directory on
        !          7675:                 the local host. The generated files can be made to
        !          7676:                 refer to URLs based on <code class=
        !          7677:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
        !          7678:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
        !          7679:                 wanted to generate <code class=
        !          7680:                 "filename">README.html</code> files which pointed
        !          7681:                 to binary packages on the local machine, in the
        !          7682:                 directory <code class=
        !          7683:                 "filename">/usr/packages</code>, set <code class=
        !          7684:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
        !          7685:                 and <code class=
        !          7686:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
        !          7687:                 <code class="varname">${PACKAGES}</code> directory
        !          7688:                 and its subdirectories will be searched for all the
        !          7689:                 binary packages.</p>
1.1       grant    7690:               </dd>
                   7691: 
                   7692:               <dt><span class="term">readme-all</span></dt>
                   7693: 
                   7694:               <dd>
1.14    ! xtraeme  7695:                 <p>Use this target to create a file <code class=
        !          7696:                 "filename">README-all.html</code> which contains a
1.1       grant    7697:                 list of all packages currently available in the
                   7698:                 NetBSD Packages Collection, together with the
                   7699:                 category they belong to and a short description.
1.14    ! xtraeme  7700:                 This file is compiled from the <code class=
        !          7701:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    7702:                 sure to run this <span class=
1.14    ! xtraeme  7703:                 "emphasis"><em>after</em></span> a
        !          7704:                 <span><strong class="command">make
        !          7705:                 readme</strong></span>.</p>
1.1       grant    7706:               </dd>
                   7707: 
                   7708:               <dt><span class="term">cdrom-readme</span></dt>
                   7709: 
                   7710:               <dd>
                   7711:                 <p>This is very much the same as the
                   7712:                 &#8220;<span class="quote">readme</span>&#8221;
                   7713:                 target (see above), but is to be used when
                   7714:                 generating a pkgsrc tree to be written to a CD-ROM.
1.14    ! xtraeme  7715:                 This target also produces <code class=
        !          7716:                 "filename">README.html</code> files, and can be
        !          7717:                 made to refer to URLs based on <code class=
        !          7718:                 "varname">CDROM_PKG_URL_HOST</code> and
        !          7719:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    7720:               </dd>
                   7721: 
                   7722:               <dt><span class="term">show-distfiles</span></dt>
                   7723: 
                   7724:               <dd>
                   7725:                 <p>This target shows which distfiles and patchfiles
1.14    ! xtraeme  7726:                 are needed to build the package. (<code class=
        !          7727:                 "varname">DISTFILES</code> and <code class=
        !          7728:                 "varname">PATCHFILES</code>, but not <code class=
        !          7729:                 "filename">patches/*</code>)</p>
1.1       grant    7730:               </dd>
                   7731: 
                   7732:               <dt><span class="term">show-downlevel</span></dt>
                   7733: 
                   7734:               <dd>
                   7735:                 <p>This target shows nothing if the package is not
                   7736:                 installed. If a version of this package is
                   7737:                 installed, but is not the version provided in this
                   7738:                 version of pkgsrc, then a warning message is
                   7739:                 displayed. This target can be used to show which of
                   7740:                 your installed packages are downlevel, and so the
                   7741:                 old versions can be deleted, and the current ones
                   7742:                 added.</p>
                   7743:               </dd>
                   7744: 
                   7745:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   7746: 
                   7747:               <dd>
                   7748:                 <p>This target shows the directory in the pkgsrc
                   7749:                 hierarchy from which the package can be built and
                   7750:                 installed. This may not be the same directory as
                   7751:                 the one from which the package was installed. This
                   7752:                 target is intended to be used by people who may
                   7753:                 wish to upgrade many packages on a single host, and
                   7754:                 can be invoked from the top-level pkgsrc Makefile
                   7755:                 by using the &#8220;<span class=
                   7756:                 "quote">show-host-specific-pkgs</span>&#8221;
                   7757:                 target.</p>
                   7758:               </dd>
                   7759: 
                   7760:               <dt><span class=
                   7761:               "term">show-installed-depends</span></dt>
                   7762: 
                   7763:               <dd>
                   7764:                 <p>This target shows which installed packages match
1.14    ! xtraeme  7765:                 the current package's <code class=
        !          7766:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    7767:                 dependencies are causing build problems.</p>
                   7768:               </dd>
                   7769: 
                   7770:               <dt><span class="term">check-shlibs</span></dt>
                   7771: 
                   7772:               <dd>
                   7773:                 <p>After a package is installed, check all its
                   7774:                 binaries and (on ELF platforms) shared libraries to
                   7775:                 see if they find the shared libs they need. Run by
1.14    ! xtraeme  7776:                 default if <code class=
        !          7777:                 "varname">PKG_DEVELOPER</code> is set in
        !          7778:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    7779:               </dd>
                   7780: 
                   7781:               <dt><span class="term">print-PLIST</span></dt>
                   7782: 
                   7783:               <dd>
                   7784:                 <p>After a &#8220;<span class="quote">make
                   7785:                 install</span>&#8221; from a new or upgraded pkg,
                   7786:                 this prints out an attempt to generate a new
1.14    ! xtraeme  7787:                 <code class="filename">PLIST</code> from a
        !          7788:                 <span><strong class="command">find -newer
        !          7789:                 work/.extract_done</strong></span>. An attempt is
        !          7790:                 made to care for shared libs etc., but it is
1.1       grant    7791:                 <span class="emphasis"><em>strongly</em></span>
                   7792:                 recommended to review the result before putting it
1.14    ! xtraeme  7793:                 into <code class="filename">PLIST</code>. On
        !          7794:                 upgrades, it's useful to diff the output of this
        !          7795:                 command against an already existing <code class=
        !          7796:                 "filename">PLIST</code> file.</p>
1.1       grant    7797: 
                   7798:                 <p>If the package installs files via tar(1) or
                   7799:                 other methods that don't update file access times,
                   7800:                 be sure to add these files manually to your
1.14    ! xtraeme  7801:                 <code class="filename">PLIST</code>, as the
1.1       grant    7802:                 &#8220;<span class="quote">find
                   7803:                 -newer</span>&#8221; command used by this target
                   7804:                 won't catch them!</p>
                   7805: 
                   7806:                 <p>See <a href="#print-PLIST" title=
                   7807:                 "8.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;8.3,
1.14    ! xtraeme  7808:                 &#8220;Tweaking output of <span><strong class=
        !          7809:                 "command">make
        !          7810:                 print-PLIST</strong></span>&#8221;</a> for more
        !          7811:                 information on this target.</p>
1.1       grant    7812:               </dd>
                   7813: 
                   7814:               <dt><span class="term">bulk-package</span></dt>
                   7815: 
                   7816:               <dd>
                   7817:                 <p>Used to do bulk builds. If an appropriate binary
                   7818:                 package already exists, no action is taken. If not,
                   7819:                 this target will compile, install and package it
1.14    ! xtraeme  7820:                 (and it's depends, if <code class=
        !          7821:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    7822:                 <a href="#binary.configuration" title=
                   7823:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   7824:                 &#8220;Configuration&#8221;</a>. After creating the
                   7825:                 binary package, the sources, the just-installed
                   7826:                 package and it's required packages are removed,
                   7827:                 preserving free disk space.</p>
                   7828: 
                   7829:                 <p><span class="emphasis"><em>Beware that this
                   7830:                 target may deinstall all packages installed on a
                   7831:                 system!</em></span></p>
                   7832:               </dd>
                   7833: 
                   7834:               <dt><span class="term">bulk-install</span></dt>
                   7835: 
                   7836:               <dd>
                   7837:                 <p>Used during bulk-installs to install required
                   7838:                 packages. If an upto-date binary package is
                   7839:                 available, it will be installed via <a href=
                   7840:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7841:                 <span class="citerefentry"><span class=
                   7842:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14    ! xtraeme  7843:                 not, <span><strong class="command">make
        !          7844:                 bulk-package</strong></span> will be executed, but
        !          7845:                 the installed binary not be removed.</p>
1.1       grant    7846: 
                   7847:                 <p>A binary package is considered
                   7848:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   7849:                 to be installed via <a href=
                   7850:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7851:                 <span class="citerefentry"><span class=
                   7852:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   7853:                 if:</p>
                   7854: 
                   7855:                 <div class="itemizedlist">
                   7856:                   <ul type="disc">
                   7857:                     <li>
1.14    ! xtraeme  7858:                       <p>None of the package's files (<code class=
        !          7859:                       "filename">Makefile</code>, ...) were
        !          7860:                       modified since it was built.</p>
1.1       grant    7861:                     </li>
                   7862: 
                   7863:                     <li>
                   7864:                       <p>None of the package's required (binary)
                   7865:                       packages were modified since it was
                   7866:                       built.</p>
                   7867:                     </li>
                   7868:                   </ul>
                   7869:                 </div>
                   7870: 
                   7871:                 <p><span class="emphasis"><em>Beware that this
                   7872:                 target may deinstall all packages installed on a
                   7873:                 system!</em></span></p>
                   7874:               </dd>
                   7875:             </dl>
                   7876:           </div>
                   7877:         </div>
                   7878:       </div>
                   7879: 
                   7880:       <div class="chapter" lang="en" xml:lang="en">
                   7881:         <div class="titlepage">
                   7882:           <div>
                   7883:             <div>
                   7884:               <h2 class="title"><a name="fixes" id=
                   7885:               "fixes"></a>Chapter&nbsp;12.&nbsp;Notes on fixes for
                   7886:               packages</h2>
                   7887:             </div>
                   7888:           </div>
                   7889:         </div>
                   7890: 
                   7891:         <div class="toc">
                   7892:           <p><b>Table of Contents</b></p>
                   7893: 
                   7894:           <dl>
1.14    ! xtraeme  7895:             <dt><span class="sect1"><a href="#id2590969">12.1.
1.1       grant    7896:             General operation</a></span></dt>
                   7897: 
                   7898:             <dd>
                   7899:               <dl>
                   7900:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7901:                 "#id2590972">12.1.1. How to pull in variables from
1.1       grant    7902:                 /etc/mk.conf</a></span></dt>
                   7903: 
                   7904:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7905:                 "#id2591124">12.1.2. Restricted
1.1       grant    7906:                 packages</a></span></dt>
                   7907: 
                   7908:                 <dt><span class="sect2"><a href=
                   7909:                 "#dependencies">12.1.3. Handling
                   7910:                 dependencies</a></span></dt>
                   7911: 
                   7912:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7913:                 "#id2591639">12.1.4. Handling conflicts with other
1.1       grant    7914:                 packages</a></span></dt>
                   7915: 
                   7916:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7917:                 "#id2591757">12.1.5. Packages that cannot or should
1.1       grant    7918:                 not be built</a></span></dt>
                   7919: 
                   7920:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7921:                 "#id2591783">12.1.6. Packages which should not be
1.1       grant    7922:                 deleted, once installed</a></span></dt>
                   7923: 
                   7924:                 <dt><span class="sect2"><a href=
                   7925:                 "#security-handling">12.1.7. Handling packages with
                   7926:                 security problems</a></span></dt>
                   7927: 
                   7928:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7929:                 "#id2591875">12.1.8. How to handle compiler
1.1       grant    7930:                 bugs</a></span></dt>
                   7931: 
                   7932:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7933:                 "#id2591897">12.1.9. How to handle incrementing
1.1       grant    7934:                 versions when fixing an existing
                   7935:                 package</a></span></dt>
                   7936: 
                   7937:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7938:                 "#id2591946">12.1.10. Portability of
1.1       grant    7939:                 packages</a></span></dt>
                   7940:               </dl>
                   7941:             </dd>
                   7942: 
1.14    ! xtraeme  7943:             <dt><span class="sect1"><a href="#id2591971">12.2.
1.1       grant    7944:             Possible downloading issues</a></span></dt>
                   7945: 
                   7946:             <dd>
                   7947:               <dl>
                   7948:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7949:                 "#id2591974">12.2.1. Packages whose distfiles
1.1       grant    7950:                 aren't available for plain
                   7951:                 downloading</a></span></dt>
                   7952: 
                   7953:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7954:                 "#id2592105">12.2.2. How to handle modified
1.1       grant    7955:                 distfiles with the 'old' name</a></span></dt>
                   7956:               </dl>
                   7957:             </dd>
                   7958: 
1.14    ! xtraeme  7959:             <dt><span class="sect1"><a href="#id2592117">12.3.
1.1       grant    7960:             Configuration gotchas</a></span></dt>
                   7961: 
                   7962:             <dd>
                   7963:               <dl>
                   7964:                 <dt><span class="sect2"><a href=
                   7965:                 "#fixes.libtool">12.3.1. Shared libraries -
                   7966:                 libtool</a></span></dt>
                   7967: 
                   7968:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7969:                 "#id2592593">12.3.2. Using libtool on GNU packages
1.1       grant    7970:                 that already support libtool</a></span></dt>
                   7971: 
                   7972:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7973:                 "#id2592677">12.3.3. GNU
1.1       grant    7974:                 Autoconf/Automake</a></span></dt>
                   7975:               </dl>
                   7976:             </dd>
                   7977: 
1.14    ! xtraeme  7978:             <dt><span class="sect1"><a href="#id2592790">12.4.
1.1       grant    7979:             Building considerations</a></span></dt>
                   7980: 
                   7981:             <dd>
                   7982:               <dl>
                   7983:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7984:                 "#id2592793">12.4.1. CPP defines</a></span></dt>
1.1       grant    7985:               </dl>
                   7986:             </dd>
                   7987: 
1.14    ! xtraeme  7988:             <dt><span class="sect1"><a href="#id2592823">12.5.
1.1       grant    7989:             Package specific actions</a></span></dt>
                   7990: 
                   7991:             <dd>
                   7992:               <dl>
                   7993:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7994:                 "#id2592826">12.5.1. Package configuration
1.1       grant    7995:                 files</a></span></dt>
                   7996: 
                   7997:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  7998:                 "#id2592929">12.5.2. User
1.2       hubertf  7999:                 interaction</a></span></dt>
1.1       grant    8000: 
                   8001:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8002:                 "#id2593042">12.5.3. Handling
1.1       grant    8003:                 licenses</a></span></dt>
                   8004: 
                   8005:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8006:                 "#id2593193">12.5.4. Creating an account from a
1.1       grant    8007:                 package</a></span></dt>
                   8008: 
                   8009:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8010:                 "#id2593392">12.5.5. Installing score
1.1       grant    8011:                 files</a></span></dt>
                   8012: 
                   8013:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8014:                 "#id2593435">12.5.6. Packages providing login
1.1       grant    8015:                 shells</a></span></dt>
                   8016: 
                   8017:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8018:                 "#id2593493">12.5.7. Packages containing perl
1.1       grant    8019:                 scripts</a></span></dt>
                   8020: 
                   8021:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8022:                 "#id2593511">12.5.8. Packages with hardcoded paths
1.1       grant    8023:                 to other interpreters</a></span></dt>
                   8024: 
                   8025:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8026:                 "#id2593532">12.5.9. Packages installing perl
1.1       grant    8027:                 modules</a></span></dt>
                   8028: 
                   8029:                 <dt><span class="sect2"><a href=
                   8030:                 "#faq.info-files">12.5.10. Packages installing info
                   8031:                 files</a></span></dt>
                   8032: 
                   8033:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8034:                 "#id2593752">12.5.11. Packages installing GConf2
1.1       grant    8035:                 data files</a></span></dt>
                   8036: 
                   8037:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8038:                 "#id2593852">12.5.12. Packages installing
1.1       grant    8039:                 scrollkeeper data files</a></span></dt>
                   8040: 
                   8041:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8042:                 "#id2593904">12.5.13. Packages installing X11
1.1       grant    8043:                 fonts</a></span></dt>
                   8044: 
                   8045:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8046:                 "#id2593950">12.5.14. Packages installing GTK2
1.1       grant    8047:                 modules</a></span></dt>
                   8048: 
                   8049:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8050:                 "#id2594020">12.5.15. Packages installing SGML or
1.1       grant    8051:                 XML data</a></span></dt>
                   8052: 
                   8053:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8054:                 "#id2594140">12.5.16. Packages installing
1.1       grant    8055:                 extensions to the MIME database</a></span></dt>
                   8056: 
                   8057:                 <dt><span class="sect2"><a href=
1.14    ! xtraeme  8058:                 "#id2594347">12.5.17. Packages using
1.1       grant    8059:                 intltool</a></span></dt>
                   8060:               </dl>
                   8061:             </dd>
                   8062: 
1.14    ! xtraeme  8063:             <dt><span class="sect1"><a href="#id2594361">12.6.
1.1       grant    8064:             Feedback to the author</a></span></dt>
                   8065:           </dl>
                   8066:         </div>
                   8067: 
                   8068:         <div class="sect1" lang="en" xml:lang="en">
                   8069:           <div class="titlepage">
                   8070:             <div>
                   8071:               <div>
                   8072:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  8073:                 "id2590969" id="id2590969"></a>12.1.&nbsp;General
1.1       grant    8074:                 operation</h2>
                   8075:               </div>
                   8076:             </div>
                   8077:           </div>
                   8078: 
                   8079:           <div class="sect2" lang="en" xml:lang="en">
                   8080:             <div class="titlepage">
                   8081:               <div>
                   8082:                 <div>
1.14    ! xtraeme  8083:                   <h3 class="title"><a name="id2590972" id=
        !          8084:                   "id2590972"></a>12.1.1.&nbsp;How to pull in
1.1       grant    8085:                   variables from /etc/mk.conf</h3>
                   8086:                 </div>
                   8087:               </div>
                   8088:             </div>
                   8089: 
                   8090:             <p>The problem with package-defined variables that can
1.14    ! xtraeme  8091:             be overridden via <code class="varname">MAKECONF</code>
        !          8092:             or <code class="filename">/etc/mk.conf</code> is that
        !          8093:             <a href=
1.1       grant    8094:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8095:             <span class="citerefentry"><span class=
                   8096:             "refentrytitle">make</span>(1)</span></a> expands a
                   8097:             variable as it is used, but evaluates preprocessor like
                   8098:             statements (.if, .ifdef and .ifndef) as they are read.
1.14    ! xtraeme  8099:             So, to use any variable (which may be set in
        !          8100:             <code class="filename">/etc/mk.conf</code>) in one of
        !          8101:             the .if* statements, the file <code class=
        !          8102:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    8103:             that .if* statement.</p>
                   8104: 
                   8105:             <p>Rather than have a number of ad-hoc ways of
1.14    ! xtraeme  8106:             including <code class="filename">/etc/mk.conf</code>,
        !          8107:             should it exist, or <code class=
        !          8108:             "varname">MAKECONF</code>, should it exist, include the
        !          8109:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
        !          8110:             file in the package Makefile before any
        !          8111:             preprocessor-like .if, .ifdef, or .ifndef
        !          8112:             statements:</p>
1.1       grant    8113:             <pre class="programlisting">
                   8114: .include "../../mk/bsd.prefs.mk"
                   8115:     
                   8116:     .if defined(USE_MENUS)
                   8117:       ...
                   8118:     .endif
                   8119: </pre>
                   8120: 
1.14    ! xtraeme  8121:             <p>If you wish to set the <code class=
        !          8122:             "varname">CFLAGS</code> variable in <code class=
        !          8123:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    8124:             use:</p>
                   8125:             <pre class="programlisting">
                   8126: CFLAGS+=  -your -flags
                   8127: </pre>
                   8128: 
1.14    ! xtraeme  8129:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
        !          8130:             without the &#8220;<span class="quote">+</span>&#8221;)
        !          8131:             may lead to problems with packages that need to add
        !          8132:             their own flags. Also, you may want to take a look at
        !          8133:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    8134:             href=
                   8135:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.14    ! xtraeme  8136:             class="pkgname">devel/cpuflags</a> package if you're
        !          8137:             interested in optimization for the current CPU.</p>
1.1       grant    8138:           </div>
                   8139: 
                   8140:           <div class="sect2" lang="en" xml:lang="en">
                   8141:             <div class="titlepage">
                   8142:               <div>
                   8143:                 <div>
1.14    ! xtraeme  8144:                   <h3 class="title"><a name="id2591124" id=
        !          8145:                   "id2591124"></a>12.1.2.&nbsp;Restricted
1.1       grant    8146:                   packages</h3>
                   8147:                 </div>
                   8148:               </div>
                   8149:             </div>
                   8150: 
                   8151:             <p>Some licenses restrict how software may be
                   8152:             re-distributed. In order to satisfy these restrictions,
                   8153:             the package system defines five make variables that can
                   8154:             be set to note these restrictions:</p>
                   8155: 
                   8156:             <div class="itemizedlist">
                   8157:               <ul type="disc">
                   8158:                 <li>
1.14    ! xtraeme  8159:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    8160: 
                   8161:                   <p>This variable should be set whenever a
                   8162:                   restriction exists (regardless of its kind). Set
                   8163:                   this variable to a string containing the reason
                   8164:                   for the restriction.</p>
                   8165:                 </li>
                   8166: 
                   8167:                 <li>
1.14    ! xtraeme  8168:                   <p><code class=
        !          8169:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    8170: 
                   8171:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14    ! xtraeme  8172:                   variable to <code class=
        !          8173:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8174:                   package may not be included on a CD-ROM.</p>
                   8175:                 </li>
                   8176: 
                   8177:                 <li>
1.14    ! xtraeme  8178:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    8179: 
                   8180:                   <p>Binaries may not be placed on an FTP server.
1.14    ! xtraeme  8181:                   Set this variable to <code class=
        !          8182:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8183:                   package may not not be made available on the
                   8184:                   Internet.</p>
                   8185:                 </li>
                   8186: 
                   8187:                 <li>
1.14    ! xtraeme  8188:                   <p><code class=
        !          8189:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    8190: 
                   8191:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14    ! xtraeme  8192:                   this variable to <code class=
        !          8193:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8194:                   of the source code or other distfile(s) is not
                   8195:                   allowed on CD-ROMs.</p>
                   8196:                 </li>
                   8197: 
                   8198:                 <li>
1.14    ! xtraeme  8199:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    8200: 
                   8201:                   <p>Distfiles may not be placed on FTP. Set this
1.14    ! xtraeme  8202:                   variable to <code class=
        !          8203:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8204:                   of the source code or other distfile(s) via the
                   8205:                   Internet is not allowed.</p>
                   8206:                 </li>
                   8207:               </ul>
                   8208:             </div>
                   8209: 
1.14    ! xtraeme  8210:             <p>Please note that the use of <code class=
        !          8211:             "varname">NO_PACKAGE</code>, <code class=
        !          8212:             "varname">IGNORE</code>, <code class=
        !          8213:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    8214:             variables to denote restrictions is deprecated, because
                   8215:             they unconditionally prevent users from generating
                   8216:             binary packages!</p>
                   8217:           </div>
                   8218: 
                   8219:           <div class="sect2" lang="en" xml:lang="en">
                   8220:             <div class="titlepage">
                   8221:               <div>
                   8222:                 <div>
                   8223:                   <h3 class="title"><a name="dependencies" id=
                   8224:                   "dependencies"></a>12.1.3.&nbsp;Handling
                   8225:                   dependencies</h3>
                   8226:                 </div>
                   8227:               </div>
                   8228:             </div>
                   8229: 
                   8230:             <p>Your package may depend on some other package being
                   8231:             present - and there are various ways of expressing this
1.14    ! xtraeme  8232:             dependency. pkgsrc supports the <code class=
        !          8233:             "varname">BUILD_DEPENDS</code> and <code class=
        !          8234:             "varname">DEPENDS</code> definitions, as well as
        !          8235:             dependencies via <code class=
        !          8236:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    8237:             way to handle dependencies, and which uses the
                   8238:             variables named above. See <a href="#buildlink" title=
                   8239:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8240:             <i>Buildlink methodology</i></a> for more
                   8241:             information.</p>
                   8242: 
                   8243:             <p>The basic difference between the two variables is as
1.14    ! xtraeme  8244:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    8245:             definition registers that pre-requisite in the binary
                   8246:             package so it will be pulled in when the binary package
1.14    ! xtraeme  8247:             is later installed, whilst the <code class=
        !          8248:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    8249:             marking a dependency that is only needed for building
                   8250:             the package.</p>
                   8251: 
                   8252:             <p>This means that if you only need a package present
                   8253:             whilst you are building, it should be noted as a
1.14    ! xtraeme  8254:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    8255: 
1.14    ! xtraeme  8256:             <p>The format for a <code class=
        !          8257:             "varname">BUILD_DEPENDS</code> and a <code class=
        !          8258:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    8259:             <pre class="programlisting">
                   8260: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   8261: </pre>
                   8262: 
                   8263:             <p>Please note that the &#8220;<span class=
                   8264:             "quote">pre-req-package-name</span>&#8221; may include
                   8265:             any of the wildcard version numbers recognised by
                   8266:             <a href=
                   8267:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   8268:             <span class="citerefentry"><span class=
                   8269:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   8270: 
                   8271:             <div class="orderedlist">
                   8272:               <ol type="1">
                   8273:                 <li>
                   8274:                   <p>If your package needs another package's
                   8275:                   binaries or libraries to build or run, and if
1.14    ! xtraeme  8276:                   that package has a <code class=
        !          8277:                   "filename">buildlink3.mk</code> file available,
        !          8278:                   use it:</p>
1.1       grant    8279:                   <pre class="programlisting">
                   8280:     .include "../../graphics/jpeg/buildlink3.mk"
                   8281:     
                   8282: </pre>
                   8283:                 </li>
                   8284: 
                   8285:                 <li>
                   8286:                   <p>If your package needs to use another package
1.14    ! xtraeme  8287:                   to build itself and there is no <code class=
        !          8288:                   "filename">buildlink3.mk</code> file available,
        !          8289:                   use the <code class=
        !          8290:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    8291:                   <pre class="programlisting">
                   8292: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   8293: </pre>
                   8294:                 </li>
                   8295: 
                   8296:                 <li>
                   8297:                   <p>If your package needs a library with which to
1.14    ! xtraeme  8298:                   link and again there is no <code class=
        !          8299:                   "filename">buildlink3.mk</code> file available,
        !          8300:                   this is specified using the <code class=
        !          8301:                   "varname">DEPENDS</code> definition. An example
        !          8302:                   of this is the <a xmlns=
1.1       grant    8303:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8304:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.14    ! xtraeme  8305:                   class="pkgname">print/lyx</a> package, which uses
        !          8306:                   the xpm library, version 3.4j to build:</p>
1.1       grant    8307:                   <pre class="programlisting">
                   8308: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   8309: </pre>
                   8310: 
                   8311:                   <p>You can also use wildcards in package
                   8312:                   dependences:</p>
                   8313:                   <pre class="programlisting">
                   8314: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   8315: </pre>
                   8316: 
                   8317:                   <p>Note that such wildcard dependencies are
                   8318:                   retained when creating binary packages. The
                   8319:                   dependency is checked when installing the binary
                   8320:                   package and any package which matches the pattern
                   8321:                   will be used. Wildcard dependencies should be
                   8322:                   used with care.</p>
                   8323: 
                   8324:                   <p>The &#8220;<span class=
                   8325:                   "quote">-[0-9]*</span>&#8221; should be used
                   8326:                   instead of &#8220;<span class=
                   8327:                   "quote">-*</span>&#8221; to avoid potentially
                   8328:                   ambiguous matches such as &#8220;<span class=
                   8329:                   "quote">tk-postgresql</span>&#8221; matching a
                   8330:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14    ! xtraeme  8331:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    8332: 
                   8333:                   <p>Wildcards can also be used to specify that a
                   8334:                   package will only build against a certain minimum
                   8335:                   version of a pre-requisite:</p>
                   8336:                   <pre class="programlisting">
                   8337: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   8338: </pre>
                   8339: 
                   8340:                   <p>This means that the package will build against
                   8341:                   version 3.5.4 of the tiff library or newer. Such
                   8342:                   a dependency may be warranted if, for example,
                   8343:                   the API of the library has changed with version
                   8344:                   3.5.4 and a package would not compile against an
                   8345:                   earlier version of tiff.</p>
                   8346: 
                   8347:                   <p>Please note that such dependencies should only
                   8348:                   be updated if a package requires a newer
                   8349:                   pre-requisite, but not to denote recommendations
                   8350:                   such as security updates or ABI changes that do
                   8351:                   not prevent a package from building correctly.
                   8352:                   Such recommendations can be expressed using
1.14    ! xtraeme  8353:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    8354:                   <pre class="programlisting">
                   8355: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   8356: </pre>
                   8357: 
1.14    ! xtraeme  8358:                   <p>In addition to the above <code class=
        !          8359:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    8360:                   while a package will build against
                   8361:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14    ! xtraeme  8362:                   recommended. <code class=
        !          8363:                   "varname">RECOMMENDED</code> entries will be
        !          8364:                   turned into dependencies unless explicitly
        !          8365:                   ignored (in which case a warning will be
        !          8366:                   printed). Packages that are built with
1.1       grant    8367:                   recommendations ignored may not be uploaded to
                   8368:                   ftp.NetBSD.org by developers and should not be
                   8369:                   used across different systems that may have
                   8370:                   different versions of binary packages
                   8371:                   installed.</p>
                   8372: 
                   8373:                   <p>For security fixes, please update the package
                   8374:                   vulnerabilities file as well as setting
1.14    ! xtraeme  8375:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    8376:                   <a href="#security-handling" title=
                   8377:                   "12.1.7.&nbsp;Handling packages with security problems">
                   8378:                   Section 12.1.7, &#8220;Handling packages with
                   8379:                   security problems&#8221;</a> for more
                   8380:                   information.</p>
                   8381:                 </li>
                   8382: 
                   8383:                 <li>
                   8384:                   <p>If your package needs some executable to be
                   8385:                   able to run correctly and if there's agail no
1.14    ! xtraeme  8386:                   <code class="filename">buildlink3.mk</code> file,
        !          8387:                   this is specified using the <code class=
        !          8388:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    8389:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8390:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.14    ! xtraeme  8391:                   class="pkgname">print/lyx</a> package needs to be
        !          8392:                   able to execute the latex binary from the teTeX
        !          8393:                   package when it runs, and that is specified:</p>
1.1       grant    8394:                   <pre class="programlisting">
                   8395: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   8396: </pre>
                   8397: 
                   8398:                   <p>The comment about wildcard dependencies from
                   8399:                   previous paragraph applies here, too.</p>
                   8400:                 </li>
                   8401:               </ol>
                   8402:             </div>
                   8403: 
                   8404:             <p>If your package needs files from another package to
                   8405:             build, see the first part of the &#8220;<span class=
                   8406:             "quote">do-configure</span>&#8221; target <a xmlns=
                   8407:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8408:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.14    ! xtraeme  8409:             class="pkgname">print/ghostscript5</a> package (it
        !          8410:             relies on the jpeg sources being present in source form
        !          8411:             during the build):</p>
1.1       grant    8412:             <pre class="programlisting">
                   8413: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   8414:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   8415:     fi
                   8416: </pre>
                   8417: 
                   8418:             <p>If you build any other packages that way, please
                   8419:             make sure the working files are deleted too when this
                   8420:             package's working files are cleaned up. The easiest way
                   8421:             to do so is by adding a pre-clean target:</p>
                   8422:             <pre class="programlisting">
                   8423: pre-clean:
                   8424:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   8425: </pre>
                   8426: 
1.14    ! xtraeme  8427:             <p>Please also note the <code class=
        !          8428:             "varname">BUILD_USES_MSGFMT</code> and <code class=
        !          8429:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
        !          8430:             which are provided as convenience definitions. The
        !          8431:             former works out whether msgfmt(1) is part of the base
        !          8432:             system, and, if it isn't, installs the <a xmlns=
1.1       grant    8433:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8434:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.14    ! xtraeme  8435:             class="pkgname">devel/gettext</a> package. The latter
        !          8436:             adds a build dependency on either an installed version
        !          8437:             of an older gettext package, or if it isn't, installs
        !          8438:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          8439:             href=
        !          8440:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
        !          8441:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    8442:           </div>
                   8443: 
                   8444:           <div class="sect2" lang="en" xml:lang="en">
                   8445:             <div class="titlepage">
                   8446:               <div>
                   8447:                 <div>
1.14    ! xtraeme  8448:                   <h3 class="title"><a name="id2591639" id=
        !          8449:                   "id2591639"></a>12.1.4.&nbsp;Handling conflicts
1.1       grant    8450:                   with other packages</h3>
                   8451:                 </div>
                   8452:               </div>
                   8453:             </div>
                   8454: 
                   8455:             <p>Your package may conflict with other packages a user
                   8456:             might already have installed on his system, e.g. if
                   8457:             your package installs the same set of files like
                   8458:             another package in our pkgsrc tree.</p>
                   8459: 
1.14    ! xtraeme  8460:             <p>In this case you can set <code class=
        !          8461:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    8462:             packages (including version string) your package
                   8463:             conflicts with.</p>
                   8464: 
                   8465:             <p>For example <a xmlns=
                   8466:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8467:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.14    ! xtraeme  8468:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
        !          8469:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8470:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
        !          8471:             class="pkgname">x11/Xaw-Xpm</a> install provide the
        !          8472:             same shared library, thus you set in <code class=
        !          8473:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    8474:             <pre class="programlisting">
                   8475: CONFLICTS=      Xaw-Xpm-[0-9]*
                   8476: </pre>
                   8477: 
1.14    ! xtraeme  8478:             <p>and in <code class=
        !          8479:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    8480:             <pre class="programlisting">
                   8481: CONFLICTS=      Xaw3d-[0-9]*
                   8482: </pre>
                   8483: 
                   8484:             <p>Packages will automatically conflict with other
                   8485:             packages with the name prefix and a different version
                   8486:             string. &#8220;<span class=
                   8487:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   8488:             conflict with the older version &#8220;<span class=
                   8489:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   8490:           </div>
                   8491: 
                   8492:           <div class="sect2" lang="en" xml:lang="en">
                   8493:             <div class="titlepage">
                   8494:               <div>
                   8495:                 <div>
1.14    ! xtraeme  8496:                   <h3 class="title"><a name="id2591757" id=
        !          8497:                   "id2591757"></a>12.1.5.&nbsp;Packages that cannot
1.1       grant    8498:                   or should not be built</h3>
                   8499:                 </div>
                   8500:               </div>
                   8501:             </div>
                   8502: 
                   8503:             <p>There are several reasons why a package might be
                   8504:             instructed to not build under certain circumstances. If
                   8505:             the package builds and runs on most platforms, the
1.14    ! xtraeme  8506:             exceptions should be noted with <code class=
        !          8507:             "varname">NOT_FOR_PLATFORM</code>. If the package
        !          8508:             builds and runs on a small handful of platforms, set
        !          8509:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
        !          8510:             If the package should be skipped (for example, because
        !          8511:             it provides functionality already provided by the
        !          8512:             system), set <code class=
        !          8513:             "varname">PKG_SKIP_REASON</code> to a descriptive
        !          8514:             message. If the package should fail because some
        !          8515:             preconditions are not met, set <code class=
        !          8516:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    8517:             message.</p>
                   8518: 
1.14    ! xtraeme  8519:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    8520:             because it didn't provide enough information to
                   8521:             determine whether the build should fail.</p>
                   8522:           </div>
                   8523: 
                   8524:           <div class="sect2" lang="en" xml:lang="en">
                   8525:             <div class="titlepage">
                   8526:               <div>
                   8527:                 <div>
1.14    ! xtraeme  8528:                   <h3 class="title"><a name="id2591783" id=
        !          8529:                   "id2591783"></a>12.1.6.&nbsp;Packages which
1.1       grant    8530:                   should not be deleted, once installed</h3>
                   8531:                 </div>
                   8532:               </div>
                   8533:             </div>
                   8534: 
                   8535:             <p>To ensure that a package may not be deleted, once it
1.14    ! xtraeme  8536:             has been installed, the <code class=
        !          8537:             "varname">PKG_PRESERVE</code> definition should be set
        !          8538:             in the package Makefile. This will be carried into any
1.1       grant    8539:             binary package that is made from this pkgsrc entry. A
                   8540:             &#8220;<span class="quote">preserved</span>&#8221;
                   8541:             package will not be deleted using <a href=
                   8542:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8543:             <span class="citerefentry"><span class=
                   8544:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   8545:             the &#8220;<span class="quote">-f</span>&#8221; option
                   8546:             is used.</p>
                   8547:           </div>
                   8548: 
                   8549:           <div class="sect2" lang="en" xml:lang="en">
                   8550:             <div class="titlepage">
                   8551:               <div>
                   8552:                 <div>
                   8553:                   <h3 class="title"><a name="security-handling" id=
                   8554:                   "security-handling"></a>12.1.7.&nbsp;Handling
                   8555:                   packages with security problems</h3>
                   8556:                 </div>
                   8557:               </div>
                   8558:             </div>
                   8559: 
                   8560:             <p>When a vulnerability is found, this should be noted
1.14    ! xtraeme  8561:             in <code class=
        !          8562:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    8563:             and after the commit of that file, it should be copied
1.14    ! xtraeme  8564:             to both <code class=
        !          8565:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
        !          8566:             and <code class=
        !          8567:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
        !          8568:             on ftp.NetBSD.org using <code class=
        !          8569:             "filename">localsrc/security/advisories/Makefile</code>.
        !          8570:             In addition, if a <code class=
        !          8571:             "filename">buildlink3.mk</code> file exists for an
        !          8572:             affected package, bumping <code class=
        !          8573:             "varname">PKGREVISION</code> and creating a
        !          8574:             corresponding <code class=
        !          8575:             "varname">BUILDLINK_RECOMMENDED.<em class=
        !          8576:             "replaceable"><code>pkg</code></em></code> entry should
        !          8577:             be considered. See <a href="#buildlink" title=
1.1       grant    8578:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8579:             <i>Buildlink methodology</i></a> for more information
1.14    ! xtraeme  8580:             about writing <code class=
        !          8581:             "filename">buildlink3.mk</code> files and <code class=
        !          8582:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    8583: 
                   8584:             <p>Also, if the fix should be applied to the stable
                   8585:             pkgsrc branch, be sure to submit a pullup request!</p>
                   8586:           </div>
                   8587: 
                   8588:           <div class="sect2" lang="en" xml:lang="en">
                   8589:             <div class="titlepage">
                   8590:               <div>
                   8591:                 <div>
1.14    ! xtraeme  8592:                   <h3 class="title"><a name="id2591875" id=
        !          8593:                   "id2591875"></a>12.1.8.&nbsp;How to handle
1.1       grant    8594:                   compiler bugs</h3>
                   8595:                 </div>
                   8596:               </div>
                   8597:             </div>
                   8598: 
                   8599:             <p>Some source files trigger bugs in the compiler,
                   8600:             based on combinations of compiler version and
                   8601:             architecture and almost always relation to optimisation
                   8602:             being enabled. Common symptoms are gcc internal errors
                   8603:             or never finishing compiling a file.</p>
                   8604: 
                   8605:             <p>Typically a workaround involves testing the
1.14    ! xtraeme  8606:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    8607:             version, disabling optimisation for that
1.14    ! xtraeme  8608:             file/<code class="varname">MACHINE_ARCH</code>/compiler
        !          8609:             combination, and documenting it in <code class=
        !          8610:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    8611:             number of examples!</p>
                   8612:           </div>
                   8613: 
                   8614:           <div class="sect2" lang="en" xml:lang="en">
                   8615:             <div class="titlepage">
                   8616:               <div>
                   8617:                 <div>
1.14    ! xtraeme  8618:                   <h3 class="title"><a name="id2591897" id=
        !          8619:                   "id2591897"></a>12.1.9.&nbsp;How to handle
1.1       grant    8620:                   incrementing versions when fixing an existing
                   8621:                   package</h3>
                   8622:                 </div>
                   8623:               </div>
                   8624:             </div>
                   8625: 
                   8626:             <p>When making fixes to an existing package it can be
1.14    ! xtraeme  8627:             useful to change the version number in <code class=
        !          8628:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    8629:             future versions by the original author, a
                   8630:             &#8220;<span class="quote">nb1</span>&#8221;,
                   8631:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   8632:             suffix can be used on package versions by setting
1.14    ! xtraeme  8633:             <code class="varname">PKGREVISION=1</code> (2, ...).
        !          8634:             The &#8220;<span class="quote">nb</span>&#8221; is
        !          8635:             treated like a &#8220;<span class=
        !          8636:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    8637:             <pre class="programlisting">
                   8638:   DISTNAME= foo-17.42
                   8639:     PKGREVISION=  9
                   8640: </pre>
                   8641: 
1.14    ! xtraeme  8642:             <p>will result in a <code class=
        !          8643:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    8644:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   8645: 
                   8646:             <p>When a new release of the package is released, the
1.14    ! xtraeme  8647:             <code class="varname">PKGREVISION</code> should be
        !          8648:             removed. e.g. on a new minor release of the above
        !          8649:             package, things should be like:</p>
1.1       grant    8650:             <pre class="programlisting">
                   8651: DISTNAME=   foo-17.43
                   8652: </pre>
                   8653:           </div>
                   8654: 
                   8655:           <div class="sect2" lang="en" xml:lang="en">
                   8656:             <div class="titlepage">
                   8657:               <div>
                   8658:                 <div>
1.14    ! xtraeme  8659:                   <h3 class="title"><a name="id2591946" id=
        !          8660:                   "id2591946"></a>12.1.10.&nbsp;Portability of
1.1       grant    8661:                   packages</h3>
                   8662:                 </div>
                   8663:               </div>
                   8664:             </div>
                   8665: 
                   8666:             <p>One appealing feature of pkgsrc is that it runs on
                   8667:             many different platforms. As a result, it is important
                   8668:             to ensure, where possible, that packages in pkgsrc are
                   8669:             portable. There are some particular details you should
                   8670:             pay attention to while working on pkgsrc.</p>
                   8671: 
                   8672:             <div class="sect3" lang="en" xml:lang="en">
                   8673:               <div class="titlepage">
                   8674:                 <div>
                   8675:                   <div>
1.14    ! xtraeme  8676:                     <h4 class="title"><a name="id2591952" id=
        !          8677:                     "id2591952"></a>12.1.10.1.&nbsp;${INSTALL},
1.1       grant    8678:                     ${INSTALL_DATA_DIR}, ...</h4>
                   8679:                   </div>
                   8680:                 </div>
                   8681:               </div>
                   8682: 
1.14    ! xtraeme  8683:               <p>The BSD-compatible <span><strong class=
        !          8684:               "command">install</strong></span> supplied with some
1.1       grant    8685:               operating systems will not perform more than one
                   8686:               operation at a time. As such, you should call
                   8687:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   8688:               etc. like this:</p>
                   8689:               <pre class="programlisting">
                   8690: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   8691: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   8692: </pre>
                   8693:             </div>
                   8694:           </div>
                   8695:         </div>
                   8696: 
                   8697:         <div class="sect1" lang="en" xml:lang="en">
                   8698:           <div class="titlepage">
                   8699:             <div>
                   8700:               <div>
                   8701:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  8702:                 "id2591971" id="id2591971"></a>12.2.&nbsp;Possible
1.1       grant    8703:                 downloading issues</h2>
                   8704:               </div>
                   8705:             </div>
                   8706:           </div>
                   8707: 
                   8708:           <div class="sect2" lang="en" xml:lang="en">
                   8709:             <div class="titlepage">
                   8710:               <div>
                   8711:                 <div>
1.14    ! xtraeme  8712:                   <h3 class="title"><a name="id2591974" id=
        !          8713:                   "id2591974"></a>12.2.1.&nbsp;Packages whose
1.1       grant    8714:                   distfiles aren't available for plain
                   8715:                   downloading</h3>
                   8716:                 </div>
                   8717:               </div>
                   8718:             </div>
                   8719: 
                   8720:             <p>If you need to download from a dynamic URL you can
1.14    ! xtraeme  8721:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
        !          8722:             and a <span><strong class="command">make
        !          8723:             fetch</strong></span> will call <code class=
        !          8724:             "filename">files/getsite.sh</code> with the name of
        !          8725:             each file to download as an argument, expecting it to
        !          8726:             output the URL of the directory from which to download
        !          8727:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          8728:             href=
1.1       grant    8729:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.14    ! xtraeme  8730:             class="pkgname">graphics/ns-cult3d</a> is an example of
        !          8731:             this usage.</p>
1.1       grant    8732: 
                   8733:             <p>If the download can't be automated, because the user
                   8734:             must submit personal information to apply for a
                   8735:             password, or must pay for the source, or whatever, you
1.14    ! xtraeme  8736:             can set <code class="varname">_FETCH_MESSAGE</code> to
        !          8737:             a macro which displays a message explaining the
        !          8738:             situation. <code class="varname">_FETCH_MESSAGE</code>
        !          8739:             must be executable shell commands, not just a message.
        !          8740:             (Generally, it executes <code class=
        !          8741:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    8742:             following packages use this: <a xmlns=
                   8743:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8744:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.14    ! xtraeme  8745:             class="pkgname">audio/realplayer</a>, <a xmlns=
        !          8746:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8747:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
        !          8748:             class="pkgname">cad/simian</a>, <a xmlns=
        !          8749:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8750:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
        !          8751:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
        !          8752:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8753:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
        !          8754:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
        !          8755:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8756:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
        !          8757:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
        !          8758:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8759:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
        !          8760:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
        !          8761:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8762:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
        !          8763:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
        !          8764:             "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8765:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
        !          8766:             class="pkgname">www/openacs</a>. Try to be consistent
        !          8767:             with them.</p>
1.1       grant    8768:           </div>
                   8769: 
                   8770:           <div class="sect2" lang="en" xml:lang="en">
                   8771:             <div class="titlepage">
                   8772:               <div>
                   8773:                 <div>
1.14    ! xtraeme  8774:                   <h3 class="title"><a name="id2592105" id=
        !          8775:                   "id2592105"></a>12.2.2.&nbsp;How to handle
1.1       grant    8776:                   modified distfiles with the 'old' name</h3>
                   8777:                 </div>
                   8778:               </div>
                   8779:             </div>
                   8780: 
                   8781:             <p>Sometimes authors of a software package make some
                   8782:             modifications after the software was released, and they
                   8783:             put up a new distfile without changing the package's
                   8784:             version number. If a package is already in pkgsrc at
                   8785:             that time, the md5 checksum will no longer match. The
                   8786:             correct way to work around this is to update the
                   8787:             package's md5 checksum to match the package on the
                   8788:             master site (beware, any mirrors may not be up to date
                   8789:             yet!), and to remove the old distfile from
1.14    ! xtraeme  8790:             ftp.NetBSD.org's <code class=
        !          8791:             "filename">/pub/NetBSD/packages/distfiles</code>
1.1       grant    8792:             directory. Furthermore, a mail to the package's author
                   8793:             seems appropriate making sure the distfile was really
                   8794:             updated on purpose, and that no trojan horse or so
                   8795:             crept in.</p>
                   8796:           </div>
                   8797:         </div>
                   8798: 
                   8799:         <div class="sect1" lang="en" xml:lang="en">
                   8800:           <div class="titlepage">
                   8801:             <div>
                   8802:               <div>
                   8803:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  8804:                 "id2592117" id=
        !          8805:                 "id2592117"></a>12.3.&nbsp;Configuration
1.1       grant    8806:                 gotchas</h2>
                   8807:               </div>
                   8808:             </div>
                   8809:           </div>
                   8810: 
                   8811:           <div class="sect2" lang="en" xml:lang="en">
                   8812:             <div class="titlepage">
                   8813:               <div>
                   8814:                 <div>
                   8815:                   <h3 class="title"><a name="fixes.libtool" id=
                   8816:                   "fixes.libtool"></a>12.3.1.&nbsp;Shared libraries
                   8817:                   - libtool</h3>
                   8818:                 </div>
                   8819:               </div>
                   8820:             </div>
                   8821: 
                   8822:             <p>pkgsrc supports many different machines, with
                   8823:             different object formats like a.out and ELF, and
                   8824:             varying abilities to do shared library and dynamic
                   8825:             loading at all. To accompany this, varying commands and
                   8826:             options have to be passed to the compiler, linker, etc.
                   8827:             to get the Right Thing, which can be pretty annoying
                   8828:             especially if you don't have all the machines at your
                   8829:             hand to test things. The <a xmlns=
                   8830:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8831:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.14    ! xtraeme  8832:             class="pkgname">devel/libtool</a> pkg can help here, as
        !          8833:             it just &#8220;<span class="quote">knows</span>&#8221;
        !          8834:             how to build both static and dynamic libraries from a
        !          8835:             set of source files, thus being platform
        !          8836:             independent.</p>
1.1       grant    8837: 
                   8838:             <p>Here's how to use libtool in a pkg in seven simple
                   8839:             steps:</p>
                   8840: 
                   8841:             <div class="orderedlist">
                   8842:               <ol type="1">
                   8843:                 <li>
1.14    ! xtraeme  8844:                   <p>Add <code class=
        !          8845:                   "varname">USE_LIBTOOL=yes</code> to the package
        !          8846:                   Makefile.</p>
1.1       grant    8847:                 </li>
                   8848: 
                   8849:                 <li>
                   8850:                   <p>For library objects, use &#8220;<span class=
                   8851:                   "quote">${LIBTOOL} --mode=compile
                   8852:                   ${CC}</span>&#8221; in place of
                   8853:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   8854:                   You could even add it to the definition of
1.14    ! xtraeme  8855:                   <code class="varname">CC</code>, if only
        !          8856:                   libraries are being built in a given Makefile.
        !          8857:                   This one command will build both PIC and non-PIC
        !          8858:                   library objects, so you need not have separate
        !          8859:                   shared and non-shared library rules.</p>
1.1       grant    8860:                 </li>
                   8861: 
                   8862:                 <li>
                   8863:                   <p>For the linking of the library, remove any
                   8864:                   &#8220;<span class="quote">ar</span>&#8221;,
                   8865:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   8866:                   and &#8220;<span class="quote">ld
                   8867:                   -Bshareable</span>&#8221; commands, and instead
                   8868:                   use:</p>
                   8869:                   <pre class="programlisting">
                   8870: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   8871: </pre>
                   8872: 
                   8873:                   <p>Note that the library is changed to have a
1.14    ! xtraeme  8874:                   <code class="filename">.la</code> extension, and
        !          8875:                   the objects are changed to have a <code class=
        !          8876:                   "filename">.lo</code> extension. Change
        !          8877:                   <code class="varname">OBJS</code> as necessary.
        !          8878:                   This automatically creates all of the
        !          8879:                   <code class="filename">.a</code>, <code class=
        !          8880:                   "filename">.so.major.minor</code>, and ELF
        !          8881:                   symlinks (if necessary) in the build directory.
        !          8882:                   Be sure to include &#8220;<span class=
1.1       grant    8883:                   "quote">-version-info</span>&#8221;, especially
                   8884:                   when major and minor are zero, as libtool will
                   8885:                   otherwise strip off the shared library
                   8886:                   version.</p>
                   8887: 
                   8888:                   <p>From the libtool manual:</p>
                   8889:                   <pre class="programlisting">
                   8890:      So, libtool library versions are described by three integers:
                   8891: 
                   8892: CURRENT
                   8893:        The most recent interface number that this library implements.
                   8894: 
                   8895: REVISION
                   8896:        The implementation number of the CURRENT interface.
                   8897: 
                   8898: AGE
                   8899:        The difference between the newest and oldest interfaces that this
                   8900:        library implements.  In other words, the library implements all the
                   8901:        interface numbers in the range from number `CURRENT - AGE' to
                   8902:        `CURRENT'.
                   8903:        
                   8904:      If two libraries have identical CURRENT and AGE numbers, then the
                   8905: dynamic linker chooses the library with the greater REVISION number. 
                   8906: </pre>
                   8907: 
                   8908:                   <p>The &#8220;<span class=
                   8909:                   "quote">-release</span>&#8221; option will
                   8910:                   produce different results for a.out and ELF
                   8911:                   (excluding symlinks) in only one case. An ELF
                   8912:                   library of the form &#8220;<span class=
                   8913:                   "quote">libfoo-release.so.<span class=
                   8914:                   "emphasis"><em>x</em></span>.<span class=
                   8915:                   "emphasis"><em>y</em></span></span>&#8221; will
                   8916:                   have a symlink of &#8220;<span class=
                   8917:                   "quote">libfoo.so.<span class=
                   8918:                   "emphasis"><em>x</em></span>.<span class=
                   8919:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   8920:                   a.out platform. This is handled
                   8921:                   automatically.</p>
                   8922: 
                   8923:                   <p>The &#8220;<span class="quote">-rpath
                   8924:                   argument</span>&#8221; is the install directory
                   8925:                   of the library being built.</p>
                   8926: 
1.14    ! xtraeme  8927:                   <p>In the <code class="filename">PLIST</code>,
        !          8928:                   include all of the <code class=
        !          8929:                   "filename">.a</code>, <code class=
        !          8930:                   "filename">.la</code>, and <code class=
        !          8931:                   "filename">.so</code>, <code class=
        !          8932:                   "filename">.so.<em class=
        !          8933:                   "replaceable"><code>major</code></em></code> and
        !          8934:                   <code class="filename">.so.<em class=
        !          8935:                   "replaceable"><code>major</code></em>.<em class=
        !          8936:                   "replaceable"><code>minor</code></em></code>
        !          8937:                   files.</p>
1.1       grant    8938:                 </li>
                   8939: 
                   8940:                 <li>
1.14    ! xtraeme  8941:                   <p>When linking shared object (<code class=
        !          8942:                   "filename">.so</code>) files, i.e. files that are
1.1       grant    8943:                   loaded via dlopen(3), NOT shared libraries, use
                   8944:                   &#8220;<span class="quote">-module
                   8945:                   -avoid-version</span>&#8221; to prevent them
                   8946:                   getting version tacked on.</p>
                   8947: 
1.14    ! xtraeme  8948:                   <p>The <code class="filename">PLIST</code> file
        !          8949:                   gets the <code class="filename">foo.so</code>
        !          8950:                   entry.</p>
1.1       grant    8951:                 </li>
                   8952: 
                   8953:                 <li>
                   8954:                   <p>When linking programs that depend on these
                   8955:                   libraries <span class=
                   8956:                   "emphasis"><em>before</em></span> they are
                   8957:                   installed, preface the <a href=
                   8958:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   8959:                   <span class="citerefentry"><span class=
                   8960:                   "refentrytitle">cc</span>(1)</span></a> or
                   8961:                   <a href=
                   8962:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   8963:                   <span class="citerefentry"><span class=
                   8964:                   "refentrytitle">ld</span>(1)</span></a> line with
                   8965:                   &#8220;<span class="quote">${LIBTOOL}
                   8966:                   --mode=link</span>&#8221;, and it will find the
                   8967:                   correct libraries (static or shared), but please
                   8968:                   be aware that libtool will not allow you to
                   8969:                   specify a relative path in -L (such as
                   8970:                   &#8220;<span class=
                   8971:                   "quote">-L../somelib</span>&#8221;), because it
                   8972:                   expects you to change that argument to be the
1.14    ! xtraeme  8973:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    8974:                   <pre class="programlisting">
                   8975: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   8976: </pre>
                   8977: 
                   8978:                   <p>should be changed to:</p>
                   8979:                   <pre class="programlisting">
1.14    ! xtraeme  8980: ${LIBTOOL} --mode=link ${CC} -o <em class=
        !          8981: "replaceable"><code>someprog</code></em> <em class=
        !          8982: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    8983: </pre>
                   8984: 
                   8985:                   <p>and it will do the right thing with the
                   8986:                   libraries.</p>
                   8987:                 </li>
                   8988: 
                   8989:                 <li>
                   8990:                   <p>When installing libraries, preface the
                   8991:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   8992:                   <span class="citerefentry"><span class=
                   8993:                   "refentrytitle">install</span>(1)</span></a> or
                   8994:                   <a href=
                   8995:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   8996:                   <span class="citerefentry"><span class=
                   8997:                   "refentrytitle">cp</span>(1)</span></a> command
                   8998:                   with &#8220;<span class="quote">${LIBTOOL}
                   8999:                   --mode=install</span>&#8221;, and change the
1.14    ! xtraeme  9000:                   library name to <code class=
        !          9001:                   "filename">.la</code>. e.g.</p>
1.1       grant    9002:                   <pre class="programlisting">
                   9003: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   9004: </pre>
                   9005: 
1.14    ! xtraeme  9006:                   <p>This will install the static <code class=
        !          9007:                   "filename">.a</code>, shared library, any needed
1.1       grant    9008:                   symlinks, and run <a href=
                   9009:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   9010:                   <span class="citerefentry"><span class=
                   9011:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   9012:                 </li>
                   9013: 
                   9014:                 <li>
1.14    ! xtraeme  9015:                   <p>In your <code class="filename">PLIST</code>,
        !          9016:                   include all of the <code class=
        !          9017:                   "filename">.a</code>, <code class=
        !          9018:                   "filename">.la</code>, and <code class=
        !          9019:                   "filename">.so</code>, <code class=
        !          9020:                   "filename">.so.CURRENT</code> and <code class=
        !          9021:                   "filename">.so.CURRENT.REVISION</code> files
        !          9022:                   (this is a change from the previous
        !          9023:                   behaviour).</p>
1.1       grant    9024:                 </li>
                   9025:               </ol>
                   9026:             </div>
                   9027:           </div>
                   9028: 
                   9029:           <div class="sect2" lang="en" xml:lang="en">
                   9030:             <div class="titlepage">
                   9031:               <div>
                   9032:                 <div>
1.14    ! xtraeme  9033:                   <h3 class="title"><a name="id2592593" id=
        !          9034:                   "id2592593"></a>12.3.2.&nbsp;Using libtool on GNU
1.1       grant    9035:                   packages that already support libtool</h3>
                   9036:                 </div>
                   9037:               </div>
                   9038:             </div>
                   9039: 
1.14    ! xtraeme  9040:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
        !          9041:             the package Makefile. This will override the package's
        !          9042:             own libtool in most cases. For older libtool using
1.1       grant    9043:             packages, libtool is made by ltconfig script during the
                   9044:             do-configure step; you can check the libtool script
1.14    ! xtraeme  9045:             location by doing <span><strong class="command">make
        !          9046:             configure; find work*/ -name
        !          9047:             libtool</strong></span>.</p>
        !          9048: 
        !          9049:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
        !          9050:             specifies which libtool scripts, relative to
        !          9051:             <code class="varname">WRKSRC</code>, to override. By
        !          9052:             default, it is set to &#8220;<span class=
        !          9053:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
        !          9054:             this does not match the location of the package's
        !          9055:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  9056: 
1.14    ! xtraeme  9057:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    9058:             static libraries built and installed, then use
1.14    ! xtraeme  9059:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    9060:             instead.</p>
                   9061: 
                   9062:             <p>If your package makes use of the platform
                   9063:             independent library for loading dynamic shared objects,
                   9064:             that comes with libtool (libltdl), you should include
1.14    ! xtraeme  9065:             the libtool buildlink3.mk (and set <code class=
        !          9066:             "varname">USE_BUILDLINK3=YES</code>).</p>
1.1       grant    9067: 
                   9068:             <p>Some packages use libtool incorrectly so that the
                   9069:             package may not work or build in some circumstances.
                   9070:             Some of the more common errors are:</p>
                   9071: 
                   9072:             <div class="itemizedlist">
                   9073:               <ul type="disc">
                   9074:                 <li>
                   9075:                   <p>The inclusion of a shared object (-module) as
                   9076:                   a dependent library in an executable or library.
                   9077:                   This in itself isn't a problem if one of two
                   9078:                   things has been done:</p>
                   9079: 
                   9080:                   <div class="orderedlist">
                   9081:                     <ol type="1">
                   9082:                       <li>
                   9083:                         <p>The shared object is named correctly,
1.14    ! xtraeme  9084:                         i.e. <code class=
        !          9085:                         "filename">libfoo.la</code>, not
        !          9086:                         <code class="filename">foo.la</code></p>
1.1       grant    9087:                       </li>
                   9088: 
                   9089:                       <li>
                   9090:                         <p>The -dlopen option is used when linking
                   9091:                         an executable.</p>
                   9092:                       </li>
                   9093:                     </ol>
                   9094:                   </div>
                   9095:                 </li>
                   9096: 
                   9097:                 <li>
                   9098:                   <p>The use of libltdl without the correct calls
                   9099:                   to initialisation routines. The function
                   9100:                   lt_dlinit() should be called and the macro
1.14    ! xtraeme  9101:                   <code class=
        !          9102:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    9103:                   included in executables.</p>
                   9104:                 </li>
                   9105:               </ul>
                   9106:             </div>
                   9107:           </div>
                   9108: 
                   9109:           <div class="sect2" lang="en" xml:lang="en">
                   9110:             <div class="titlepage">
                   9111:               <div>
                   9112:                 <div>
1.14    ! xtraeme  9113:                   <h3 class="title"><a name="id2592677" id=
        !          9114:                   "id2592677"></a>12.3.3.&nbsp;GNU
1.1       grant    9115:                   Autoconf/Automake</h3>
                   9116:                 </div>
                   9117:               </div>
                   9118:             </div>
                   9119: 
                   9120:             <p>If a package needs GNU autoconf or automake to be
                   9121:             executed to regenerate the configure script and
                   9122:             Makefile.in makefile templates, then they should be
                   9123:             executed in a pre-configure target. Two Makefile
1.14    ! xtraeme  9124:             fragments are provided in <code class=
        !          9125:             "filename">pkgsrc/mk/autoconf.mk</code> and
        !          9126:             <code class="filename">pkgsrc/mk/automake.mk</code> to
        !          9127:             help dealing with these tools. See comments in these
        !          9128:             files for details.</p>
1.1       grant    9129: 
                   9130:             <p>For packages that need only autoconf:</p>
                   9131:             <pre class="programlisting">
                   9132: AUTOCONF_REQD=    2.50    # if default version is not good enough
                   9133: ...
                   9134: 
                   9135: pre-configure:
                   9136:           cd ${WRKSRC}; ${AUTOCONF}
                   9137: 
                   9138: ...
                   9139: .include "../../mk/autoconf.mk"
                   9140: </pre>
                   9141: 
                   9142:             <p>and for packages that need automake and
                   9143:             autoconf:</p>
                   9144:             <pre class="programlisting">
                   9145: AUTOMAKE_REQD=  1.7.1   # if default version is not good enough
                   9146: ...
                   9147: 
                   9148: pre-configure:
                   9149:           cd ${WRKSRC};                                           \
                   9150:           ${ACLOCAL};                                             \
                   9151:           ${AUTOHEADER};                                          \
                   9152:           ${AUTOMAKE} -a --foreign -i;                            \
                   9153:           ${AUTOCONF}
                   9154: 
                   9155: ...
                   9156: .include "../mk/automake.mk"
                   9157: </pre>
                   9158: 
                   9159:             <p>Packages which use GNU Automake will almost
                   9160:             certainly require GNU Make, but that's automatically
1.14    ! xtraeme  9161:             provided for you in <code class=
        !          9162:             "filename">mk/automake.mk</code>.</p>
1.1       grant    9163: 
                   9164:             <p>There are times when the configure process makes
                   9165:             additional changes to the generated files, which then
                   9166:             causes the build process to try to re-execute the
                   9167:             automake sequence. This is prevented by touching
                   9168:             various files in the configure stage. If this causes
1.14    ! xtraeme  9169:             problems with your package you can set <code class=
        !          9170:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    9171:             Makefile.</p>
                   9172:           </div>
                   9173:         </div>
                   9174: 
                   9175:         <div class="sect1" lang="en" xml:lang="en">
                   9176:           <div class="titlepage">
                   9177:             <div>
                   9178:               <div>
                   9179:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  9180:                 "id2592790" id="id2592790"></a>12.4.&nbsp;Building
1.1       grant    9181:                 considerations</h2>
                   9182:               </div>
                   9183:             </div>
                   9184:           </div>
                   9185: 
                   9186:           <div class="sect2" lang="en" xml:lang="en">
                   9187:             <div class="titlepage">
                   9188:               <div>
                   9189:                 <div>
1.14    ! xtraeme  9190:                   <h3 class="title"><a name="id2592793" id=
        !          9191:                   "id2592793"></a>12.4.1.&nbsp;CPP defines</h3>
1.1       grant    9192:                 </div>
                   9193:               </div>
                   9194:             </div>
                   9195: 
                   9196:             <p>To port an application to NetBSD, it's usually
                   9197:             necessary for the compiler to be able to judge the
                   9198:             system on which it's compiling, and we use definitions
                   9199:             so that the C pre-processor can do this.</p>
                   9200: 
                   9201:             <p>To test whether you are working on a 4.4 BSD-derived
                   9202:             system, you should use the BSD definition, which is
1.14    ! xtraeme  9203:             defined in <code class=
        !          9204:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    9205:             systems.</p>
                   9206:             <pre class="programlisting">
                   9207: #include &lt;sys/param.h&gt;
                   9208: </pre>
                   9209: 
                   9210:             <p>and then you can surround the BSD-specific parts of
                   9211:             your package's C/C++ code using this conditional:</p>
                   9212:             <pre class="programlisting">
                   9213: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   9214:     ...
                   9215: #endif
                   9216: </pre>
                   9217: 
                   9218:             <p>Please use the &#8220;<span class=
                   9219:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   9220:             it should only apply to features of NetBSD that are not
                   9221:             present in other 4.4-lite derived BSDs.</p>
                   9222:           </div>
                   9223:         </div>
                   9224: 
                   9225:         <div class="sect1" lang="en" xml:lang="en">
                   9226:           <div class="titlepage">
                   9227:             <div>
                   9228:               <div>
                   9229:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  9230:                 "id2592823" id="id2592823"></a>12.5.&nbsp;Package
1.1       grant    9231:                 specific actions</h2>
                   9232:               </div>
                   9233:             </div>
                   9234:           </div>
                   9235: 
                   9236:           <div class="sect2" lang="en" xml:lang="en">
                   9237:             <div class="titlepage">
                   9238:               <div>
                   9239:                 <div>
1.14    ! xtraeme  9240:                   <h3 class="title"><a name="id2592826" id=
        !          9241:                   "id2592826"></a>12.5.1.&nbsp;Package
1.1       grant    9242:                   configuration files</h3>
                   9243:                 </div>
                   9244:               </div>
                   9245:             </div>
                   9246: 
                   9247:             <p>Packages should be taught to look for their
1.14    ! xtraeme  9248:             configuration files in <code class=
        !          9249:             "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1       grant    9250:             through to the configure and build processes.
1.14    ! xtraeme  9251:             <code class="varname">PKG_SYSCONFDIR</code> may be
1.1       grant    9252:             customized in various ways by setting other make
                   9253:             variables:</p>
                   9254: 
                   9255:             <div class="itemizedlist">
                   9256:               <ul type="disc">
                   9257:                 <li>
1.14    ! xtraeme  9258:                   <p><code class="varname">PKG_SYSCONFBASE</code>
        !          9259:                   is the main config directory under which all
        !          9260:                   package configuration files are to be found. This
        !          9261:                   defaults to <code class=
        !          9262:                   "filename">${PREFIX}/etc</code>, but may be
        !          9263:                   overridden in <code class=
        !          9264:                   "filename">/etc/mk.conf</code>.</p>
1.1       grant    9265:                 </li>
                   9266: 
                   9267:                 <li>
1.14    ! xtraeme  9268:                   <p><code class="varname">PKG_SYSCONFSUBDIR</code>
        !          9269:                   is the subdirectory of <code class=
        !          9270:                   "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    9271:                   configuration files for a particular package may
                   9272:                   be found, e.g. the Apache configuration files may
1.14    ! xtraeme  9273:                   all be found under the <code class=
        !          9274:                   "filename">httpd/</code> subdirectory of
        !          9275:                   <code class="varname">${PKG_SYSCONFBASE}</code>.
        !          9276:                   This should be set in the package Makefile.</p>
1.1       grant    9277:                 </li>
                   9278: 
                   9279:                 <li>
1.14    ! xtraeme  9280:                   <p>By default, <code class=
        !          9281:                   "varname">PKG_SYSCONFDIR</code> is set to
        !          9282:                   <code class=
        !          9283:                   "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
        !          9284:                   but this may be overridden by setting
        !          9285:                   <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
        !          9286:                   for a particular package, where <code class=
        !          9287:                   "varname">PKG_SYSCONFVAR</code> defaults to
        !          9288:                   <code class="varname">${PKGBASE}</code>. This is
        !          9289:                   not meant to be set by a package Makefile, but is
1.1       grant    9290:                   reserved for users who wish to override the
1.14    ! xtraeme  9291:                   <code class="varname">PKG_SYSCONFDIR</code>
        !          9292:                   setting for a particular package with a special
1.1       grant    9293:                   location.</p>
                   9294:                 </li>
                   9295:               </ul>
                   9296:             </div>
                   9297: 
                   9298:             <p>The only variables that users should customize are
1.14    ! xtraeme  9299:             <code class="varname">PKG_SYSCONFBASE</code> and
        !          9300:             <code class=
        !          9301:             "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
        !          9302:             Users will typically want to set <code class=
        !          9303:             "varname">PKG_SYSCONFBASE</code> to <code class=
        !          9304:             "filename">/etc</code>, or to accept the default
        !          9305:             location of <code class=
        !          9306:             "filename">${PREFIX}/etc</code>.</p>
1.1       grant    9307:           </div>
                   9308: 
                   9309:           <div class="sect2" lang="en" xml:lang="en">
                   9310:             <div class="titlepage">
                   9311:               <div>
                   9312:                 <div>
1.14    ! xtraeme  9313:                   <h3 class="title"><a name="id2592929" id=
        !          9314:                   "id2592929"></a>12.5.2.&nbsp;User
1.2       hubertf  9315:                   interaction</h3>
1.1       grant    9316:                 </div>
                   9317:               </div>
                   9318:             </div>
                   9319: 
                   9320:             <p>Occasionally, packages require interaction from the
                   9321:             user, and this can be in a number of ways:</p>
                   9322: 
                   9323:             <div class="itemizedlist">
                   9324:               <ul type="disc">
                   9325:                 <li>
                   9326:                   <p>help in fetching the distfiles</p>
                   9327:                 </li>
                   9328: 
                   9329:                 <li>
                   9330:                   <p>help to configure the package before it is
                   9331:                   built</p>
                   9332:                 </li>
                   9333: 
                   9334:                 <li>
                   9335:                   <p>help during the build process</p>
                   9336:                 </li>
                   9337: 
                   9338:                 <li>
                   9339:                   <p>help during the installation of a package</p>
                   9340:                 </li>
                   9341:               </ul>
                   9342:             </div>
                   9343: 
1.14    ! xtraeme  9344:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    9345:             definition is provided to notify the pkgsrc mechanism
                   9346:             of an interactive stage which will be needed, and this
1.14    ! xtraeme  9347:             should be set in the package's <code class=
        !          9348:             "filename">Makefile</code>. e.g.</p>
1.1       grant    9349:             <pre class="programlisting">
                   9350: INTERACTIVE_STAGE= build
                   9351: </pre>
                   9352: 
                   9353:             <p>Multiple interactive stages can be specified:</p>
                   9354:             <pre class="programlisting">
                   9355: INTERACTIVE_STAGE= configure install
                   9356: </pre>
                   9357:           </div>
                   9358: 
                   9359:           <div class="sect2" lang="en" xml:lang="en">
                   9360:             <div class="titlepage">
                   9361:               <div>
                   9362:                 <div>
1.14    ! xtraeme  9363:                   <h3 class="title"><a name="id2593042" id=
        !          9364:                   "id2593042"></a>12.5.3.&nbsp;Handling
1.1       grant    9365:                   licenses</h3>
                   9366:                 </div>
                   9367:               </div>
                   9368:             </div>
                   9369: 
                   9370:             <p>A package may underly a license which the user has
                   9371:             or has not agreed to accept. Usually, packages that
                   9372:             underly well-known Open Source licenses (e.g. the GNU
                   9373:             Public License, GPL) won't have any special license
                   9374:             tags added in pkgsrc which require special action by
                   9375:             the user of such packages, but there are quite a number
                   9376:             of other licenses out there that pkgsrc users may not
                   9377:             be able to follow, for whatever reasons. For these
                   9378:             cases, pkgsrc contains a mechanism to note that a
                   9379:             package underlies a certain license, and the user has
                   9380:             to accept the license before the package can be
                   9381:             installed.</p>
                   9382: 
                   9383:             <p>Placing a certain package under a certain license
1.14    ! xtraeme  9384:             works by setting the <code class=
        !          9385:             "varname">LICENSE</code> variable to a string
        !          9386:             identifying the license, e.g. in <a xmlns=
        !          9387:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9388:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.14    ! xtraeme  9389:             class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    9390:             <pre class="programlisting">
                   9391: LICENSE=        graphviz-license
                   9392: </pre>
                   9393: 
                   9394:             <p>When trying to build, the user will get a notice
                   9395:             that the package underlies a license which he hasn't
                   9396:             accepted (yet):</p>
                   9397:             <pre class="programlisting">
1.14    ! xtraeme  9398: <code class="prompt">%</code> <strong class=
        !          9399: "userinput"><code>make</code></strong>
1.1       grant    9400: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   9401: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   9402: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   9403: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   9404: *** Error code 1
                   9405: </pre>
                   9406: 
1.14    ! xtraeme  9407:             <p>The license can be viewed with <span><strong class=
        !          9408:             "command">make show-license</strong></span>, and if it
        !          9409:             is considered appropriate, the line printed above can
        !          9410:             be added to <code class="filename">/etc/mk.conf</code>
        !          9411:             to indicate acceptance of the particular license:</p>
1.1       grant    9412:             <pre class="programlisting">
                   9413: ACCEPTABLE_LICENSES+=graphviz-license
                   9414: </pre>
                   9415: 
                   9416:             <p>When adding a package with a new license, the
1.14    ! xtraeme  9417:             license text should be added to <code class=
        !          9418:             "filename">pkgsrc/licenses</code> for displaying. A
        !          9419:             list of known licenses can be seen in this directory as
        !          9420:             well as by looking at the list of (commented out)
        !          9421:             <code class="varname">ACCEPTABLE_LICENSES</code>
        !          9422:             variable settings in <code class=
        !          9423:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    9424: 
                   9425:             <p>Is there is a <span class=
                   9426:             "emphasis"><em>really</em></span> pressing need to
                   9427:             accept all licenses at once, like when trying to
                   9428:             download or mirror all distfiles or doing a bulk build
                   9429:             to test if all packages in pkgsrc build, this can be
1.14    ! xtraeme  9430:             done by setting <code class=
        !          9431:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    9432:           </div>
                   9433: 
                   9434:           <div class="sect2" lang="en" xml:lang="en">
                   9435:             <div class="titlepage">
                   9436:               <div>
                   9437:                 <div>
1.14    ! xtraeme  9438:                   <h3 class="title"><a name="id2593193" id=
        !          9439:                   "id2593193"></a>12.5.4.&nbsp;Creating an account
1.1       grant    9440:                   from a package</h3>
                   9441:                 </div>
                   9442:               </div>
                   9443:             </div>
                   9444: 
                   9445:             <p>There are two make variables used to control the
                   9446:             creation of package-specific groups and users at
1.14    ! xtraeme  9447:             pre-install time. The first is <code class=
        !          9448:             "varname">PKG_GROUPS</code>, which is a list of
1.1       grant    9449:             group[:groupid] elements, where the groupid is
1.14    ! xtraeme  9450:             optional. The second is <code class=
        !          9451:             "varname">PKG_USERS</code>, which is a list of elements
1.1       grant    9452:             of the form:</p>
                   9453:             <pre class="programlisting">
                   9454: user:group[:[userid][:[description][:[home][:shell]]]]
                   9455: </pre>
                   9456: 
                   9457:             <p>where only the user and group are required, the rest
                   9458:             being optional. A simple example is:</p>
                   9459:             <pre class="programlisting">
                   9460:   PKG_GROUPS=       foogroup
                   9461:     PKG_USERS=    foouser:foogroup
                   9462: </pre>
                   9463: 
                   9464:             <p>A more complex example is that creates two groups
                   9465:             and two users is:</p>
                   9466:             <pre class="programlisting">
                   9467:   PKG_GROUPS=       group1 group2:1005
                   9468:     PKG_USERS=    first:group1::First\\ User                      \
                   9469:                   second:group2::Second\\ User:/home/second:${SH}
                   9470: </pre>
                   9471: 
                   9472:             <p>By default, a new user will have home directory
1.14    ! xtraeme  9473:             <code class="filename">/nonexistent</code>, and login
        !          9474:             shell <code class="filename">/sbin/nologin</code>
        !          9475:             unless they are specified as part of the user
        !          9476:             element.</p>
1.1       grant    9477: 
1.14    ! xtraeme  9478:             <p>The package <code class="filename">Makefile</code>
        !          9479:             must also set <code class=
        !          9480:             "varname">USE_PKGINSTALL=YES</code>. This will cause
        !          9481:             the users and groups to be created at pre-install time,
        !          9482:             and the admin will be prompted to remove them at
        !          9483:             post-deinstall time. Automatic creation of the users
        !          9484:             and groups can be toggled on and off by setting the
        !          9485:             <code class="varname">PKG_CREATE_USERGROUP</code>
        !          9486:             variable prior to package installation.</p>
1.1       grant    9487:           </div>
                   9488: 
                   9489:           <div class="sect2" lang="en" xml:lang="en">
                   9490:             <div class="titlepage">
                   9491:               <div>
                   9492:                 <div>
1.14    ! xtraeme  9493:                   <h3 class="title"><a name="id2593392" id=
        !          9494:                   "id2593392"></a>12.5.5.&nbsp;Installing score
1.1       grant    9495:                   files</h3>
                   9496:                 </div>
                   9497:               </div>
                   9498:             </div>
                   9499: 
                   9500:             <p>Certain packages, most of them in the games
                   9501:             category, install a score file that allows all users on
                   9502:             the system to record their highscores. In order for
                   9503:             this to work, the binaries need to be installed setgid
                   9504:             and the score files owned by the appropriate group
                   9505:             and/or owner (traditionally the "games" user/group).
                   9506:             The following variables, documented in more detail in
1.14    ! xtraeme  9507:             <code class="filename">mk/defaults/mk.conf</code>,
        !          9508:             control this behaviour: <code class=
        !          9509:             "varname">SETGIDGAME</code>, <code class=
        !          9510:             "varname">GAMEDATAMODE</code>, <code class=
        !          9511:             "varname">GAMEGRP</code>, <code class=
        !          9512:             "varname">GAMEMODE</code>, <code class=
        !          9513:             "varname">GAMEOWN</code>.</p>
1.1       grant    9514: 
                   9515:             <p>Note that per default, setgid installation of games
1.14    ! xtraeme  9516:             is disabled; setting <code class=
        !          9517:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    9518:             variables accordingly.</p>
                   9519: 
                   9520:             <p>A package should therefor never hard code file
1.14    ! xtraeme  9521:             ownership or access permissions but rely on
        !          9522:             <code class="varname">INSTALL_GAME</code> and
        !          9523:             <code class="varname">INSTALL_GAME_DATA</code> to set
        !          9524:             these correctly.</p>
1.1       grant    9525:           </div>
                   9526: 
                   9527:           <div class="sect2" lang="en" xml:lang="en">
                   9528:             <div class="titlepage">
                   9529:               <div>
                   9530:                 <div>
1.14    ! xtraeme  9531:                   <h3 class="title"><a name="id2593435" id=
        !          9532:                   "id2593435"></a>12.5.6.&nbsp;Packages providing
1.1       grant    9533:                   login shells</h3>
                   9534:                 </div>
                   9535:               </div>
                   9536:             </div>
                   9537: 
                   9538:             <p>If the purpose of the package is to provide a login
1.14    ! xtraeme  9539:             shell, the variable <code class=
        !          9540:             "varname">PKG_SHELL</code> should contain the full
        !          9541:             pathname of the shell executable installed by this
        !          9542:             package. The package <code class=
        !          9543:             "filename">Makefile</code> must also set <code class=
        !          9544:             "varname">USE_PKGINSTALL=YES</code> to use the
        !          9545:             automatically generated <code class=
        !          9546:             "filename">INSTALL</code>/<code class=
        !          9547:             "filename">DEINSTALL</code> scripts.</p>
1.1       grant    9548: 
                   9549:             <p>An example taken from shells/zsh:</p>
                   9550:             <pre class="programlisting">
                   9551:   USE_PKGINSTALL=   YES
                   9552:     PKG_SHELL=    ${PREFIX}/bin/zsh
                   9553: </pre>
                   9554: 
1.14    ! xtraeme  9555:             <p>The shell is registered into <code class=
        !          9556:             "filename">/etc/shells</code> file automatically in the
        !          9557:             post-install target by the generated <code class=
        !          9558:             "filename">INSTALL</code> script and removed in the
        !          9559:             deinstall target by the <code class=
        !          9560:             "filename">DEINSTALL</code> script.</p>
1.1       grant    9561:           </div>
                   9562: 
                   9563:           <div class="sect2" lang="en" xml:lang="en">
                   9564:             <div class="titlepage">
                   9565:               <div>
                   9566:                 <div>
1.14    ! xtraeme  9567:                   <h3 class="title"><a name="id2593493" id=
        !          9568:                   "id2593493"></a>12.5.7.&nbsp;Packages containing
1.1       grant    9569:                   perl scripts</h3>
                   9570:                 </div>
                   9571:               </div>
                   9572:             </div>
                   9573: 
                   9574:             <p>If your package contains interpreted perl scripts,
1.14    ! xtraeme  9575:             set <code class="varname">REPLACE_PERL</code> to ensure
        !          9576:             that the proper interpreter path is set. <code class=
        !          9577:             "varname">REPLACE_PERL</code> should contain a list of
        !          9578:             scripts, relative to <code class=
        !          9579:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    9580:           </div>
                   9581: 
                   9582:           <div class="sect2" lang="en" xml:lang="en">
                   9583:             <div class="titlepage">
                   9584:               <div>
                   9585:                 <div>
1.14    ! xtraeme  9586:                   <h3 class="title"><a name="id2593511" id=
        !          9587:                   "id2593511"></a>12.5.8.&nbsp;Packages with
1.1       grant    9588:                   hardcoded paths to other interpreters</h3>
                   9589:                 </div>
                   9590:               </div>
                   9591:             </div>
                   9592: 
                   9593:             <p>Your package may also contain scripts with hardcoded
                   9594:             paths to other interpreters besides (or as well as)
                   9595:             perl. To correct the full pathname to the script
                   9596:             interpreter, you need to set the following definitions
1.14    ! xtraeme  9597:             in your <code class="filename">Makefile</code> (we
        !          9598:             shall use <span><strong class=
        !          9599:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    9600:             <pre class="programlisting">
                   9601:   REPLACE_INTERPRETER+=     tcl
                   9602:     _REPLACE.tcl.old=     .*/bin/tclsh
                   9603:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   9604:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   9605:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   9606: </pre>
                   9607:           </div>
                   9608: 
                   9609:           <div class="sect2" lang="en" xml:lang="en">
                   9610:             <div class="titlepage">
                   9611:               <div>
                   9612:                 <div>
1.14    ! xtraeme  9613:                   <h3 class="title"><a name="id2593532" id=
        !          9614:                   "id2593532"></a>12.5.9.&nbsp;Packages installing
1.1       grant    9615:                   perl modules</h3>
                   9616:                 </div>
                   9617:               </div>
                   9618:             </div>
                   9619: 
                   9620:             <p>Makefiles of packages providing perl5 modules should
1.14    ! xtraeme  9621:             include the Makefile fragment <code class=
        !          9622:             "filename">../../lang/perl5/module.mk</code>. It
        !          9623:             provides a <span><strong class=
        !          9624:             "command">do-configure</strong></span> target for the
        !          9625:             standard perl configuration for such modules as well as
        !          9626:             various hooks to tune this configuration. See comments
        !          9627:             in this file for details.</p>
1.1       grant    9628: 
                   9629:             <p>Perl5 modules will install into different places
                   9630:             depending on the version of perl used during the build
                   9631:             process. To address this, pkgsrc will append lines to
1.14    ! xtraeme  9632:             the <code class="filename">PLIST</code> corresponding
        !          9633:             to the files listed in the installed <code class=
        !          9634:             "filename">.packlist</code> file generated by most
        !          9635:             perl5 modules. This is invoked by defining <code class=
        !          9636:             "varname">PERL5_PACKLIST</code> to a space-separated
        !          9637:             list of paths to packlist files, e.g.:</p>
1.1       grant    9638:             <pre class="programlisting">
                   9639: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   9640: </pre>
                   9641: 
1.14    ! xtraeme  9642:             <p>The variables <code class=
        !          9643:             "varname">PERL5_SITELIB</code>, <code class=
        !          9644:             "varname">PERL5_SITEARCH</code>, and <code class=
        !          9645:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    9646:             locations in which perl5 modules may be installed, and
                   9647:             may be used by perl5 packages that don't have a
                   9648:             packlist. These three variables are also substituted
1.14    ! xtraeme  9649:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    9650:           </div>
                   9651: 
                   9652:           <div class="sect2" lang="en" xml:lang="en">
                   9653:             <div class="titlepage">
                   9654:               <div>
                   9655:                 <div>
                   9656:                   <h3 class="title"><a name="faq.info-files" id=
                   9657:                   "faq.info-files"></a>12.5.10.&nbsp;Packages
                   9658:                   installing info files</h3>
                   9659:                 </div>
                   9660:               </div>
                   9661:             </div>
                   9662: 
                   9663:             <p>Some packages install info files or use the
                   9664:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   9665:             &#8220;<span class="quote">install-info</span>&#8221;
                   9666:             commands. Each of the info files:</p>
                   9667: 
                   9668:             <div class="itemizedlist">
                   9669:               <ul type="disc">
                   9670:                 <li>
                   9671:                   <p>is considered to be installed in the directory
1.14    ! xtraeme  9672:                   <code class=
        !          9673:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    9674:                 </li>
                   9675: 
                   9676:                 <li>
                   9677:                   <p>is registered in the Info directory file
1.14    ! xtraeme  9678:                   <code class=
        !          9679:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    9680:                 </li>
                   9681: 
                   9682:                 <li>
                   9683:                   <p>and must be listed as a filename in the
1.14    ! xtraeme  9684:                   <code class="varname">INFO_FILES</code> variable
        !          9685:                   in the package Makefile.</p>
1.1       grant    9686:                 </li>
                   9687:               </ul>
                   9688:             </div>
                   9689: 
1.14    ! xtraeme  9690:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    9691:             &#8220;<span class="quote">info</span>&#8221; and can
1.14    ! xtraeme  9692:             be overridden in the package Makefile. <code class=
        !          9693:             "filename">INSTALL</code> and <code class=
        !          9694:             "filename">DEINSTALL</code> scripts will be generated
        !          9695:             to handle registration of the info files in the Info
1.1       grant    9696:             directory file. The &#8220;<span class=
                   9697:             "quote">install-info</span>&#8221; command used for the
                   9698:             info files registration is either provided by the
                   9699:             system, or by a special purpose package automatically
                   9700:             added as dependency if needed.</p>
                   9701: 
                   9702:             <p>A package which needs the &#8220;<span class=
                   9703:             "quote">makeinfo</span>&#8221; command at build time
1.14    ! xtraeme  9704:             must define the variable <code class=
        !          9705:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    9706:             minimum version of the &#8220;<span class=
                   9707:             "quote">makeinfo</span>&#8221; command is needed it
1.14    ! xtraeme  9708:             should be noted with the <code class=
        !          9709:             "varname">TEXINFO_REQD</code> variable in the package
        !          9710:             <code class="filename">Makefile</code>. By default, a
1.1       grant    9711:             minimum version of 3.12 is required. If the system does
1.14    ! xtraeme  9712:             not provide a <span><strong class=
        !          9713:             "command">makeinfo</strong></span> command or if it
        !          9714:             does not match the required minimum, a build dependency
        !          9715:             on the <a xmlns=
        !          9716:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9717:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.14    ! xtraeme  9718:             class="pkgname">devel/gtexinfo</a> package will be
        !          9719:             added automatically.</p>
1.1       grant    9720: 
                   9721:             <p>The build and installation process of the software
                   9722:             provided by the package should not use the
1.14    ! xtraeme  9723:             <span><strong class=
        !          9724:             "command">install-info</strong></span> command as the
        !          9725:             registration of info files is the task of the package
        !          9726:             <code class="filename">INSTALL</code> script, and it
        !          9727:             must use the appropriate <span><strong class=
        !          9728:             "command">makeinfo</strong></span> command.</p>
1.1       grant    9729: 
                   9730:             <p>To achieve this goal the pkgsrc infrastructure
1.14    ! xtraeme  9731:             creates overriding scripts for the <span><strong class=
        !          9732:             "command">install-info</strong></span> and
        !          9733:             <span><strong class="command">makeinfo</strong></span>
        !          9734:             commands in a directory listed early in <code class=
        !          9735:             "varname">PATH</code>.</p>
1.1       grant    9736: 
1.14    ! xtraeme  9737:             <p>The script overriding <span><strong class=
        !          9738:             "command">install-info</strong></span> has no effect
        !          9739:             except the logging of a message. The script overriding
        !          9740:             <span><strong class="command">makeinfo</strong></span>
        !          9741:             logs a message and according to the value of
        !          9742:             <code class="varname">USE_MAKEINFO</code> and
        !          9743:             <code class="varname">TEXINFO_REQD</code> either run
        !          9744:             the appropriate <span><strong class=
        !          9745:             "command">makeinfo</strong></span> command or exit on
        !          9746:             error.</p>
1.1       grant    9747:           </div>
                   9748: 
                   9749:           <div class="sect2" lang="en" xml:lang="en">
                   9750:             <div class="titlepage">
                   9751:               <div>
                   9752:                 <div>
1.14    ! xtraeme  9753:                   <h3 class="title"><a name="id2593752" id=
        !          9754:                   "id2593752"></a>12.5.11.&nbsp;Packages installing
1.1       grant    9755:                   GConf2 data files</h3>
                   9756:                 </div>
                   9757:               </div>
                   9758:             </div>
                   9759: 
1.14    ! xtraeme  9760:             <p>If a package installs <code class=
        !          9761:             "filename">.schemas</code> or <code class=
        !          9762:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    9763:             need to take some extra steps to make sure they get
                   9764:             registered in the database:</p>
                   9765: 
                   9766:             <div class="orderedlist">
                   9767:               <ol type="1">
                   9768:                 <li>
1.14    ! xtraeme  9769:                   <p>Include <code class=
        !          9770:                   "filename">../../devel/GConf2/schemas.mk</code>
        !          9771:                   instead of its <code class=
        !          9772:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9773:                   care of rebuilding the GConf2 database at
                   9774:                   installation and deinstallation time, and tells
                   9775:                   the package where to install GConf2 data files
                   9776:                   using some standard configure arguments. It also
                   9777:                   disallows any access to the database directly
                   9778:                   from the package.</p>
                   9779:                 </li>
                   9780: 
                   9781:                 <li>
                   9782:                   <p>Ensure that the package installs its
1.14    ! xtraeme  9783:                   <code class="filename">.schemas</code> files
        !          9784:                   under <code class=
        !          9785:                   "filename">${PREFIX}/share/gconf/schemas</code>.
        !          9786:                   If they get installed under <code class=
        !          9787:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    9788:                   manually patch the package.</p>
                   9789:                 </li>
                   9790: 
                   9791:                 <li>
                   9792:                   <p>Check the PLIST and remove any entries under
                   9793:                   the etc/gconf directory, as they will be handled
                   9794:                   automatically. See <a href="#faq.conf" title=
1.14    ! xtraeme  9795:                   "6.14.&nbsp;Configuration files handling and placement">
        !          9796:                   Section&nbsp;6.14, &#8220;Configuration files
1.1       grant    9797:                   handling and placement&#8221;</a> for more
                   9798:                   information.</p>
                   9799:                 </li>
                   9800: 
                   9801:                 <li>
1.14    ! xtraeme  9802:                   <p>Define the <code class=
        !          9803:                   "varname">GCONF2_SCHEMAS</code> variable in your
        !          9804:                   <code class="filename">Makefile</code> with a
        !          9805:                   list of all <code class=
        !          9806:                   "filename">.schemas</code> files installed by the
        !          9807:                   package, if any. Names must not contain any
        !          9808:                   directories in them.</p>
1.1       grant    9809:                 </li>
                   9810: 
                   9811:                 <li>
1.14    ! xtraeme  9812:                   <p>Define the <code class=
        !          9813:                   "varname">GCONF2_ENTRIES</code> variable in your
        !          9814:                   <code class="filename">Makefile</code> with a
        !          9815:                   list of all <code class=
        !          9816:                   "filename">.entries</code> files installed by the
        !          9817:                   package, if any. Names must not contain any
        !          9818:                   directories in them.</p>
1.1       grant    9819:                 </li>
                   9820:               </ol>
                   9821:             </div>
                   9822:           </div>
                   9823: 
                   9824:           <div class="sect2" lang="en" xml:lang="en">
                   9825:             <div class="titlepage">
                   9826:               <div>
                   9827:                 <div>
1.14    ! xtraeme  9828:                   <h3 class="title"><a name="id2593852" id=
        !          9829:                   "id2593852"></a>12.5.12.&nbsp;Packages installing
1.1       grant    9830:                   scrollkeeper data files</h3>
                   9831:                 </div>
                   9832:               </div>
                   9833:             </div>
                   9834: 
1.14    ! xtraeme  9835:             <p>If a package installs <code class=
        !          9836:             "filename">.omf</code> files, used by scrollkeeper, you
        !          9837:             need to take some extra steps to make sure they get
        !          9838:             registered in the database:</p>
1.1       grant    9839: 
                   9840:             <div class="orderedlist">
                   9841:               <ol type="1">
                   9842:                 <li>
1.14    ! xtraeme  9843:                   <p>Include <code class=
        !          9844:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
        !          9845:                   instead of its <code class=
        !          9846:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9847:                   care of rebuilding the scrollkeeper database at
                   9848:                   installation and deinstallation time, and
                   9849:                   disallows any access to it directly from the
                   9850:                   package.</p>
                   9851:                 </li>
                   9852: 
                   9853:                 <li>
                   9854:                   <p>Check the PLIST and remove any entries under
1.14    ! xtraeme  9855:                   the <code class=
        !          9856:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    9857:                   as they will be handled automatically.</p>
                   9858:                 </li>
                   9859: 
                   9860:                 <li>
1.14    ! xtraeme  9861:                   <p>Remove the <code class=
        !          9862:                   "filename">share/omf</code> directory from the
        !          9863:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    9864:                 </li>
                   9865:               </ol>
                   9866:             </div>
                   9867:           </div>
                   9868: 
                   9869:           <div class="sect2" lang="en" xml:lang="en">
                   9870:             <div class="titlepage">
                   9871:               <div>
                   9872:                 <div>
1.14    ! xtraeme  9873:                   <h3 class="title"><a name="id2593904" id=
        !          9874:                   "id2593904"></a>12.5.13.&nbsp;Packages installing
1.1       grant    9875:                   X11 fonts</h3>
                   9876:                 </div>
                   9877:               </div>
                   9878:             </div>
                   9879: 
                   9880:             <p>If a package installs font files, you will need to
                   9881:             rebuild the fonts database in the directory where they
                   9882:             get installed at installation and deinstallation time.
1.14    ! xtraeme  9883:             This can be automatically done by using <code class=
        !          9884:             "filename">mk/fonts.mk</code>, which you need to
        !          9885:             include in your <code class=
        !          9886:             "filename">Makefile</code>.</p>
1.1       grant    9887: 
                   9888:             <p>When the file is included, you can list the
1.14    ! xtraeme  9889:             directories where fonts are installed in the
        !          9890:             <code class="varname">FONTS_<em class=
        !          9891:             "replaceable"><code>type</code></em>_DIRS</code>
        !          9892:             variables, where <em class=
        !          9893:             "replaceable"><code>type</code></em> can be one of
        !          9894:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    9895:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   9896:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.14    ! xtraeme  9897:             sure that the database file <code class=
        !          9898:             "filename">fonts.dir</code> is not listed in the
1.1       grant    9899:             PLIST.</p>
                   9900: 
                   9901:             <p>Note that you should not create new directories for
                   9902:             fonts; instead use the standard ones to avoid that the
                   9903:             user needs to manually configure his X server to find
                   9904:             them.</p>
                   9905:           </div>
                   9906: 
                   9907:           <div class="sect2" lang="en" xml:lang="en">
                   9908:             <div class="titlepage">
                   9909:               <div>
                   9910:                 <div>
1.14    ! xtraeme  9911:                   <h3 class="title"><a name="id2593950" id=
        !          9912:                   "id2593950"></a>12.5.14.&nbsp;Packages installing
1.1       grant    9913:                   GTK2 modules</h3>
                   9914:                 </div>
                   9915:               </div>
                   9916:             </div>
                   9917: 
                   9918:             <p>If a package installs gtk2 immodules or loaders, you
                   9919:             need to take some extra steps to get them registered in
                   9920:             the GTK2 database properly:</p>
                   9921: 
                   9922:             <div class="orderedlist">
                   9923:               <ol type="1">
                   9924:                 <li>
1.14    ! xtraeme  9925:                   <p>Include <code class=
        !          9926:                   "filename">../../x11/gtk2/modules.mk</code>
        !          9927:                   instead of its <code class=
        !          9928:                   "filename">buildlink3.mk</code> file. This takes
        !          9929:                   care of rebuilding the database at installation
        !          9930:                   and deinstallation time.</p>
1.1       grant    9931:                 </li>
                   9932: 
                   9933:                 <li>
1.14    ! xtraeme  9934:                   <p>Set <code class=
        !          9935:                   "varname">GTK2_IMMODULES=YES</code> if your
        !          9936:                   package installs GTK2 immodules.</p>
1.1       grant    9937:                 </li>
                   9938: 
                   9939:                 <li>
1.14    ! xtraeme  9940:                   <p>Set <code class=
        !          9941:                   "varname">GTK2_LOADERS=YES</code> if your package
        !          9942:                   installs GTK2 loaders.</p>
1.1       grant    9943:                 </li>
                   9944: 
                   9945:                 <li>
                   9946:                   <p>Patch the package to not touch any of the gtk2
                   9947:                   databases directly. These are:</p>
                   9948: 
                   9949:                   <div class="itemizedlist">
                   9950:                     <ul type="disc">
                   9951:                       <li>
1.14    ! xtraeme  9952:                         <p><code class=
        !          9953:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    9954:                       </li>
                   9955: 
                   9956:                       <li>
1.14    ! xtraeme  9957:                         <p><code class=
        !          9958:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    9959:                       </li>
                   9960:                     </ul>
                   9961:                   </div>
                   9962:                 </li>
                   9963: 
                   9964:                 <li>
                   9965:                   <p>Check the PLIST and remove any entries under
1.14    ! xtraeme  9966:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    9967:                   directory, as they will be handled
                   9968:                   automatically.</p>
                   9969:                 </li>
                   9970:               </ol>
                   9971:             </div>
                   9972:           </div>
                   9973: 
                   9974:           <div class="sect2" lang="en" xml:lang="en">
                   9975:             <div class="titlepage">
                   9976:               <div>
                   9977:                 <div>
1.14    ! xtraeme  9978:                   <h3 class="title"><a name="id2594020" id=
        !          9979:                   "id2594020"></a>12.5.15.&nbsp;Packages installing
1.1       grant    9980:                   SGML or XML data</h3>
                   9981:                 </div>
                   9982:               </div>
                   9983:             </div>
                   9984: 
                   9985:             <p>If a package installs SGML or XML data files that
                   9986:             need to be registered in system-wide catalogs (like
                   9987:             DTDs, sub-catalogs, etc.), you need to take some extra
                   9988:             steps:</p>
                   9989: 
                   9990:             <div class="orderedlist">
                   9991:               <ol type="1">
                   9992:                 <li>
1.14    ! xtraeme  9993:                   <p>Include <code class=
        !          9994:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
        !          9995:                   in your <code class="filename">Makefile</code>,
        !          9996:                   which takes care of registering those files in
1.1       grant    9997:                   system-wide catalogs at installation and
                   9998:                   deinstallation time.</p>
                   9999:                 </li>
                   10000: 
                   10001:                 <li>
1.14    ! xtraeme  10002:                   <p>Set <code class="varname">SGML_CATALOGS</code>
        !          10003:                   to the full path of any SGML catalogs installed
        !          10004:                   by the package.</p>
1.1       grant    10005:                 </li>
                   10006: 
                   10007:                 <li>
1.14    ! xtraeme  10008:                   <p>Set <code class="varname">XML_CATALOGS</code>
        !          10009:                   to the full path of any XML catalogs installed by
1.1       grant    10010:                   the package.</p>
                   10011:                 </li>
                   10012: 
                   10013:                 <li>
1.14    ! xtraeme  10014:                   <p>Set <code class="varname">SGML_ENTRIES</code>
        !          10015:                   to individual entries to be added to the SGML
1.1       grant    10016:                   catalog. These come in groups of three strings;
                   10017:                   see xmlcatmgr(1) for more information
                   10018:                   (specifically, arguments recognized by the 'add'
                   10019:                   action). Note that you will normally not use this
                   10020:                   variable.</p>
                   10021:                 </li>
                   10022: 
                   10023:                 <li>
1.14    ! xtraeme  10024:                   <p>Set <code class="varname">XML_ENTRIES</code>
        !          10025:                   to individual entries to be added to the XML
1.1       grant    10026:                   catalog. These come in groups of three strings;
                   10027:                   see xmlcatmgr(1) for more information
                   10028:                   (specifically, arguments recognized by the 'add'
                   10029:                   action). Note that you will normally not use this
                   10030:                   variable.</p>
                   10031:                 </li>
                   10032:               </ol>
                   10033:             </div>
                   10034:           </div>
                   10035: 
                   10036:           <div class="sect2" lang="en" xml:lang="en">
                   10037:             <div class="titlepage">
                   10038:               <div>
                   10039:                 <div>
1.14    ! xtraeme  10040:                   <h3 class="title"><a name="id2594140" id=
        !          10041:                   "id2594140"></a>12.5.16.&nbsp;Packages installing
1.1       grant    10042:                   extensions to the MIME database</h3>
                   10043:                 </div>
                   10044:               </div>
                   10045:             </div>
                   10046: 
                   10047:             <p>If a package provides extensions to the MIME
1.14    ! xtraeme  10048:             database by installing <code class=
        !          10049:             "filename">.xml</code> files inside <code class=
        !          10050:             "filename">${PREFIX}/share/mime/packages</code>, you
        !          10051:             need to take some extra steps to ensure that the
        !          10052:             database is kept consistent with respect to these new
        !          10053:             files:</p>
1.1       grant    10054: 
                   10055:             <div class="orderedlist">
                   10056:               <ol type="1">
                   10057:                 <li>
1.14    ! xtraeme  10058:                   <p>Include <code class=
        !          10059:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
        !          10060:                   (avoid using the <code class=
        !          10061:                   "filename">buildlink3.mk</code> file from this
        !          10062:                   same directory, which is reserved for inclusion
        !          10063:                   from other <code class=
        !          10064:                   "filename">buildlink3.mk</code> files). It takes
        !          10065:                   care of rebuilding the MIME database at
        !          10066:                   installation and deinstallation time, and
        !          10067:                   disallows any access to it directly from the
1.1       grant    10068:                   package.</p>
                   10069:                 </li>
                   10070: 
                   10071:                 <li>
                   10072:                   <p>Check the PLIST and remove any entries under
1.14    ! xtraeme  10073:                   the <code class="filename">share/mime</code>
1.1       grant    10074:                   directory, <span class=
                   10075:                   "emphasis"><em>except</em></span> for files saved
1.14    ! xtraeme  10076:                   under <code class=
        !          10077:                   "filename">share/mime/packages</code>. The former
1.1       grant    10078:                   are handled automatically by the
                   10079:                   update-mime-database program, but the later are
                   10080:                   package-dependent and must be removed by the
                   10081:                   package that installed them in the first
                   10082:                   place.</p>
                   10083:                 </li>
                   10084: 
                   10085:                 <li>
1.14    ! xtraeme  10086:                   <p>Remove any <code class=
        !          10087:                   "filename">share/mime/*</code> directories from
        !          10088:                   the PLIST. They will be handled by the
1.1       grant    10089:                   shared-mime-info package.</p>
                   10090:                 </li>
                   10091:               </ol>
                   10092:             </div>
                   10093:           </div>
                   10094: 
                   10095:           <div class="sect2" lang="en" xml:lang="en">
                   10096:             <div class="titlepage">
                   10097:               <div>
                   10098:                 <div>
1.14    ! xtraeme  10099:                   <h3 class="title"><a name="id2594347" id=
        !          10100:                   "id2594347"></a>12.5.17.&nbsp;Packages using
1.1       grant    10101:                   intltool</h3>
                   10102:                 </div>
                   10103:               </div>
                   10104:             </div>
                   10105: 
                   10106:             <p>If a package uses intltool during its build, include
1.14    ! xtraeme  10107:             the <code class=
        !          10108:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    10109:             file, which forces it to use the intltool package
                   10110:             provided by pkgsrc, instead of the one bundled with the
                   10111:             distribution file.</p>
                   10112: 
                   10113:             <p>This tracks intltool's build-time dependencies and
                   10114:             uses the latest available version; this way, the
                   10115:             package benefits of any bug fixes that may have
                   10116:             appeared since it was released.</p>
                   10117:           </div>
                   10118:         </div>
                   10119: 
                   10120:         <div class="sect1" lang="en" xml:lang="en">
                   10121:           <div class="titlepage">
                   10122:             <div>
                   10123:               <div>
                   10124:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  10125:                 "id2594361" id="id2594361"></a>12.6.&nbsp;Feedback
1.1       grant    10126:                 to the author</h2>
                   10127:               </div>
                   10128:             </div>
                   10129:           </div>
                   10130: 
                   10131:           <p>If you have found any bugs in the package you make
                   10132:           available, if you had to do special steps to make it run
                   10133:           under NetBSD or if you enhanced the software in various
                   10134:           other ways, be sure to report these changes back to the
                   10135:           original author of the program! With that kind of
                   10136:           support, the next release of the program can incorporate
                   10137:           these fixes, and people not using the NetBSD packages
                   10138:           system can win from your efforts.</p>
                   10139: 
                   10140:           <p>Support the idea of free software!</p>
                   10141:         </div>
                   10142:       </div>
                   10143: 
                   10144:       <div class="chapter" lang="en" xml:lang="en">
                   10145:         <div class="titlepage">
                   10146:           <div>
                   10147:             <div>
                   10148:               <h2 class="title"><a name="debug" id=
                   10149:               "debug"></a>Chapter&nbsp;13.&nbsp;Debugging</h2>
                   10150:             </div>
                   10151:           </div>
                   10152:         </div>
                   10153: 
                   10154:         <p>To check out all the gotchas when building a package,
                   10155:         here are the steps that I do in order to get a package
                   10156:         working. Please note this is basically the same as what was
                   10157:         explained in the previous sections, only with some
                   10158:         debugging aids.</p>
                   10159: 
                   10160:         <div class="itemizedlist">
                   10161:           <ul type="disc">
                   10162:             <li>
1.14    ! xtraeme  10163:               <p>Be sure to set <code class=
        !          10164:               "varname">PKG_DEVELOPER=1</code> in <code class=
        !          10165:               "filename">/etc/mk.conf</code></p>
1.1       grant    10166:             </li>
                   10167: 
                   10168:             <li>
                   10169:               <p>Install <a xmlns=
                   10170:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10171:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.14    ! xtraeme  10172:               class="pkgname">pkgtools/url2pkg</a>, create a
        !          10173:               directory for a new package, change into it, then run
        !          10174:               <span><strong class=
        !          10175:               "command">url2pkg</strong></span>:</p>
1.1       grant    10176:               <pre class="screen">
1.14    ! xtraeme  10177: <code class="prompt">%</code> <strong class=
        !          10178: "userinput"><code>mkdir /usr/pkgsrc/<em class=
        !          10179: "replaceable"><code>category</code></em>/<em class=
        !          10180: "replaceable"><code>examplepkg</code></em></code></strong>
        !          10181: <code class="prompt">%</code> <strong class=
        !          10182: "userinput"><code>cd /usr/pkgsrc/<em class=
        !          10183: "replaceable"><code>category</code></em>/<em class=
        !          10184: "replaceable"><code>examplepkg</code></em></code></strong>
        !          10185: <code class="prompt">%</code> <strong class=
        !          10186: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    10187: </pre>
                   10188:             </li>
                   10189: 
                   10190:             <li>
1.14    ! xtraeme  10191:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    10192:               requested.</p>
                   10193:             </li>
                   10194: 
                   10195:             <li>
1.14    ! xtraeme  10196:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    10197:               file</p>
                   10198:             </li>
                   10199: 
                   10200:             <li>
1.14    ! xtraeme  10201:               <p>Run <span><strong class="command">make
        !          10202:               configure</strong></span></p>
1.1       grant    10203:             </li>
                   10204: 
                   10205:             <li>
                   10206:               <p>Add any dependencies glimpsed from documentation
1.14    ! xtraeme  10207:               and the configure step to the package's <code class=
        !          10208:               "filename">Makefile</code>.</p>
1.1       grant    10209:             </li>
                   10210: 
                   10211:             <li>
                   10212:               <p>Make the package compile, doing multiple rounds
                   10213:               of</p>
                   10214:               <pre class="screen">
1.14    ! xtraeme  10215: <code class="prompt">%</code> <strong class=
        !          10216: "userinput"><code>make</code></strong>
        !          10217: <code class="prompt">%</code> <strong class=
        !          10218: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
        !          10219: <code class="prompt">%</code> <strong class=
        !          10220: "userinput"><code>mkpatches</code></strong>
        !          10221: <code class="prompt">%</code> <strong class=
        !          10222: "userinput"><code>patchdiff</code></strong>
        !          10223: <code class="prompt">%</code> <strong class=
        !          10224: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
        !          10225: <code class="prompt">%</code> <strong class=
        !          10226: "userinput"><code>make mps</code></strong>
        !          10227: <code class="prompt">%</code> <strong class=
        !          10228: "userinput"><code>make clean</code></strong>
1.1       grant    10229: </pre>
                   10230: 
                   10231:               <p>Doing as non-root user will ensure that no files
                   10232:               are modified that shouldn't be, especially during the
1.14    ! xtraeme  10233:               build phase. <span><strong class=
        !          10234:               "command">mkpatches</strong></span>,
        !          10235:               <span><strong class=
        !          10236:               "command">patchdiff</strong></span> and
        !          10237:               <span><strong class="command">pkgvi</strong></span>
        !          10238:               are from the <a xmlns=
1.1       grant    10239:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10240:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14    ! xtraeme  10241:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    10242:             </li>
                   10243: 
                   10244:             <li>
1.14    ! xtraeme  10245:               <p>Look at the <code class=
        !          10246:               "filename">Makefile</code>, fix if necessary; see
        !          10247:               <a href="#components.Makefile" title=
        !          10248:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
        !          10249:               &#8220;<code class=
        !          10250:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    10251:             </li>
                   10252: 
                   10253:             <li>
1.14    ! xtraeme  10254:               <p>Generate a <code class=
        !          10255:               "filename">PLIST</code>:</p>
1.1       grant    10256:               <pre class="screen">
1.14    ! xtraeme  10257: <code class="prompt">#</code> <strong class=
        !          10258: "userinput"><code>make install</code></strong>
        !          10259: <code class="prompt">#</code> <strong class=
        !          10260: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
        !          10261: <code class="prompt">#</code> <strong class=
        !          10262: "userinput"><code>make deinstall</code></strong>
        !          10263: <code class="prompt">#</code> <strong class=
        !          10264: "userinput"><code>make install</code></strong>
        !          10265: <code class="prompt">#</code> <strong class=
        !          10266: "userinput"><code>make deinstall</code></strong>
1.1       grant    10267: </pre>
                   10268: 
1.14    ! xtraeme  10269:               <p>You usually need to be <code class=
        !          10270:               "username">root</code> to do this. Look if there are
1.1       grant    10271:               any files left:</p>
                   10272:               <pre class="screen">
1.14    ! xtraeme  10273: <code class="prompt">#</code> <strong class=
        !          10274: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10275: </pre>
                   10276: 
                   10277:               <p>If this reveals any files that are missing in
1.14    ! xtraeme  10278:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    10279:             </li>
                   10280: 
                   10281:             <li>
1.14    ! xtraeme  10282:               <p>Now that the <code class="filename">PLIST</code>
        !          10283:               is OK, install the package again and make a binary
1.1       grant    10284:               package:</p>
                   10285:               <pre class="screen">
1.14    ! xtraeme  10286: <code class="prompt">#</code> <strong class=
        !          10287: "userinput"><code>make reinstall</code></strong>
        !          10288: <code class="prompt">#</code> <strong class=
        !          10289: "userinput"><code>make package</code></strong>
1.1       grant    10290: </pre>
                   10291:             </li>
                   10292: 
                   10293:             <li>
                   10294:               <p>Delete the installed package:</p>
                   10295:               <pre class="screen">
1.14    ! xtraeme  10296: <code class="prompt">#</code> <strong class=
        !          10297: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    10298: </pre>
                   10299:             </li>
                   10300: 
                   10301:             <li>
1.14    ! xtraeme  10302:               <p>Repeat the above <span><strong class=
        !          10303:               "command">make print-PLIST</strong></span> command,
        !          10304:               which shouldn't find anything now:</p>
1.1       grant    10305:               <pre class="screen">
1.14    ! xtraeme  10306: <code class="prompt">#</code> <strong class=
        !          10307: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10308: </pre>
                   10309:             </li>
                   10310: 
                   10311:             <li>
                   10312:               <p>Reinstall the binary package:</p>
                   10313:               <pre class="screen">
1.14    ! xtraeme  10314: <code class="prompt">#</code> <strong class=
        !          10315: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    10316: </pre>
                   10317:             </li>
                   10318: 
                   10319:             <li>
                   10320:               <p>Play with it. Make sure everything works.</p>
                   10321:             </li>
                   10322: 
                   10323:             <li>
1.14    ! xtraeme  10324:               <p>Run <span><strong class=
        !          10325:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    10326:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10327:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14    ! xtraeme  10328:               class="pkgname">pkgtools/pkglint</a>, and fix the
        !          10329:               problems it reports:</p>
1.1       grant    10330:               <pre class="screen">
1.14    ! xtraeme  10331: <code class="prompt">#</code> <strong class=
        !          10332: "userinput"><code>pkglint</code></strong>
1.1       grant    10333: </pre>
                   10334:             </li>
                   10335: 
                   10336:             <li>
                   10337:               <p>Submit (or commit, if you have cvs access); see
                   10338:               <a href="#submit" title=
                   10339:               "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter&nbsp;14,
                   10340:               <i>Submitting and Committing</i></a>.</p>
                   10341:             </li>
                   10342:           </ul>
                   10343:         </div>
                   10344:       </div>
                   10345: 
                   10346:       <div class="chapter" lang="en" xml:lang="en">
                   10347:         <div class="titlepage">
                   10348:           <div>
                   10349:             <div>
                   10350:               <h2 class="title"><a name="submit" id=
                   10351:               "submit"></a>Chapter&nbsp;14.&nbsp;Submitting and
                   10352:               Committing</h2>
                   10353:             </div>
                   10354:           </div>
                   10355:         </div>
                   10356: 
                   10357:         <div class="toc">
                   10358:           <p><b>Table of Contents</b></p>
                   10359: 
                   10360:           <dl>
1.14    ! xtraeme  10361:             <dt><span class="sect1"><a href="#id2594823">14.1.
1.1       grant    10362:             Submitting your packages</a></span></dt>
                   10363: 
1.14    ! xtraeme  10364:             <dt><span class="sect1"><a href="#id2594874">14.2.
1.1       grant    10365:             Committing: Importing a package into
                   10366:             CVS</a></span></dt>
                   10367: 
1.14    ! xtraeme  10368:             <dt><span class="sect1"><a href="#id2595005">14.3.
1.2       hubertf  10369:             Updating a package to a newer version</a></span></dt>
1.1       grant    10370: 
1.14    ! xtraeme  10371:             <dt><span class="sect1"><a href="#id2595161">14.4.
1.2       hubertf  10372:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    10373:           </dl>
                   10374:         </div>
                   10375: 
                   10376:         <div class="sect1" lang="en" xml:lang="en">
                   10377:           <div class="titlepage">
                   10378:             <div>
                   10379:               <div>
                   10380:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  10381:                 "id2594823" id=
        !          10382:                 "id2594823"></a>14.1.&nbsp;Submitting your
1.1       grant    10383:                 packages</h2>
                   10384:               </div>
                   10385:             </div>
                   10386:           </div>
                   10387: 
                   10388:           <p>You have to separate between binary and
                   10389:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   10390:           packages here:</p>
                   10391: 
                   10392:           <div class="itemizedlist">
                   10393:             <ul type="disc">
                   10394:               <li>
                   10395:                 <p>precompiled binary packages</p>
                   10396: 
                   10397:                 <p>Our policy is that we accept binaries only from
                   10398:                 pkgsrc developers to guarantee that the packages
                   10399:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  10400:                 annoy anyone but rather to protect our users!
1.1       grant    10401:                 You're still free to put up your home-made binary
1.13      hubertf  10402:                 packages and tell the world where to get them.
                   10403:                 NetBSD developers doing bulk builds and wanting to
                   10404:                 upload them please see <a href="#bulk-upload"
                   10405:                 title="5.3.8.&nbsp;Uploading results of a bulk build">
                   10406:                 Section&nbsp;5.3.8, &#8220;Uploading results of a
                   10407:                 bulk build&#8221;</a>.</p>
1.1       grant    10408:               </li>
                   10409: 
                   10410:               <li>
                   10411:                 <p>packages</p>
                   10412: 
                   10413:                 <p>First, check that your package is complete,
                   10414:                 compiles and runs well; see <a href="#debug" title=
                   10415:                 "Chapter&nbsp;13.&nbsp;Debugging">Chapter&nbsp;13,
                   10416:                 <i>Debugging</i></a> and the rest of this document.
                   10417:                 Next, generate an uuencoded gzipped tar(1) archive,
                   10418:                 preferably with all files in a single directory.
1.14    ! xtraeme  10419:                 Finally, <span><strong class=
        !          10420:                 "command">send-pr</strong></span> with category
1.1       grant    10421:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   10422:                 synopsis which includes the package name and
                   10423:                 version number, a short description of your package
                   10424:                 (contents of the COMMENT variable or DESCR file are
                   10425:                 OK) and attach the archive to your PR.</p>
                   10426: 
                   10427:                 <p>If you want to submit several packages, please
                   10428:                 send a separate PR for each one, it's easier for us
                   10429:                 to track things that way.</p>
                   10430: 
                   10431:                 <p>Alternatively, you can also import new packages
                   10432:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   10433:                 work-in-progress</span>&#8221;); see the homepage
                   10434:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   10435:                 target=
                   10436:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   10437:                 details.</p>
                   10438:               </li>
                   10439:             </ul>
                   10440:           </div>
                   10441:         </div>
                   10442: 
                   10443:         <div class="sect1" lang="en" xml:lang="en">
                   10444:           <div class="titlepage">
                   10445:             <div>
                   10446:               <div>
                   10447:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  10448:                 "id2594874" id=
        !          10449:                 "id2594874"></a>14.2.&nbsp;Committing: Importing a
1.1       grant    10450:                 package into CVS</h2>
                   10451:               </div>
                   10452:             </div>
                   10453:           </div>
                   10454: 
                   10455:           <p>This section is only of interest for pkgsrc developers
                   10456:           with write access to the pkgsrc repository. Please
                   10457:           remember that cvs imports files relative to the current
                   10458:           working directory, and that the pathname that you give
1.14    ! xtraeme  10459:           the <span><strong class="command">cvs
        !          10460:           import</strong></span> command is so that it knows where
        !          10461:           to place the files in the repository. Newly created
        !          10462:           packages should be imported with a vendor tag of
        !          10463:           &#8220;<span class="quote">TNF</span>&#8221; and a
        !          10464:           release tag of &#8220;<span class=
        !          10465:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    10466:           <pre class="programlisting">
                   10467:   % cd .../pkgsrc/category/pkgname
                   10468:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   10469: </pre>
                   10470: 
                   10471:           <p>Remember to move the directory from which you imported
                   10472:           out of the way, or cvs will complain the next time you
                   10473:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   10474:           source tree. Also don't forget to add the new package to
1.14    ! xtraeme  10475:           the category's <code class=
        !          10476:           "filename">Makefile</code>.</p>
1.1       grant    10477: 
                   10478:           <p>The commit message of the initial import should
1.14    ! xtraeme  10479:           include part of the <code class="filename">DESCR</code>
        !          10480:           file, so people reading the mailing lists know what the
        !          10481:           package is/does.</p>
1.1       grant    10482: 
                   10483:           <p>Please note all package updates/additions in
1.14    ! xtraeme  10484:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
        !          10485:           very important to keep this file up to date and
        !          10486:           conforming to the existing format, because it will be
        !          10487:           used by scripts to automatically update pages on <a href=
1.1       grant    10488:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   10489:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   10490:           file and remove the entry for the package you updated, in
                   10491:           case it was mentioned there.</p>
                   10492: 
                   10493:           <p>For new packages, &#8220;<span class="quote">cvs
                   10494:           import</span>&#8221; is preferred to &#8220;<span class=
                   10495:           "quote">cvs add</span>&#8221; because the former gets
                   10496:           everything with a single command, and provides a
                   10497:           consistent tag.</p>
                   10498:         </div>
                   10499: 
                   10500:         <div class="sect1" lang="en" xml:lang="en">
                   10501:           <div class="titlepage">
                   10502:             <div>
                   10503:               <div>
                   10504:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  10505:                 "id2595005" id="id2595005"></a>14.3.&nbsp;Updating
1.2       hubertf  10506:                 a package to a newer version</h2>
1.1       grant    10507:               </div>
                   10508:             </div>
                   10509:           </div>
                   10510: 
                   10511:           <p>Please always put a concise, appropriate and relevant
                   10512:           summary of the changes between old and new versions into
                   10513:           the commit log when updating a package. There are various
                   10514:           reasons for this:</p>
                   10515: 
                   10516:           <div class="itemizedlist">
                   10517:             <ul type="disc">
                   10518:               <li>
                   10519:                 <p>A URL is volatile, and can change over time. It
                   10520:                 may go away completely or its information may be
                   10521:                 overwritten by newer information.</p>
                   10522:               </li>
                   10523: 
                   10524:               <li>
                   10525:                 <p>Having the change information between old and
                   10526:                 new versions in our CVS repository is very useful
                   10527:                 for people who use either cvs or anoncvs.</p>
                   10528:               </li>
                   10529: 
                   10530:               <li>
                   10531:                 <p>Having the change information between old and
                   10532:                 new versions in our CVS repository is very useful
                   10533:                 for people who read the pkgsrc-changes mailing
                   10534:                 list, so that they can make tactical decisions
                   10535:                 about when to upgrade the package.</p>
                   10536:               </li>
                   10537:             </ul>
                   10538:           </div>
                   10539: 
                   10540:           <p>Please also recognise that, just because a new version
                   10541:           of a package has been released, it should not
                   10542:           automatically be upgraded in the CVS repository. We
                   10543:           prefer to be conservative in the packages that are
                   10544:           included in pkgsrc - development or beta packages are not
                   10545:           really the best thing for most places in which pkgsrc is
                   10546:           used. Please use your judgement about what should go into
                   10547:           pkgsrc, and bear in mind that stability is to be
                   10548:           preferred above new and possibly untested features.</p>
                   10549:         </div>
                   10550: 
                   10551:         <div class="sect1" lang="en" xml:lang="en">
                   10552:           <div class="titlepage">
                   10553:             <div>
                   10554:               <div>
                   10555:                 <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  10556:                 "id2595161" id="id2595161"></a>14.4.&nbsp;Moving a
1.2       hubertf  10557:                 package in pkgsrc</h2>
1.1       grant    10558:               </div>
                   10559:             </div>
                   10560:           </div>
                   10561: 
                   10562:           <div class="orderedlist">
                   10563:             <ol type="1">
                   10564:               <li>
                   10565:                 <p>Make a copy of the directory somewhere else.</p>
                   10566:               </li>
                   10567: 
                   10568:               <li>
                   10569:                 <p>Remove all CVS dirs.</p>
                   10570: 
                   10571:                 <p>Alternatively to the first two steps you can
                   10572:                 also do:</p>
                   10573:                 <pre class="screen">
1.14    ! xtraeme  10574: <code class="prompt">%</code> <strong class=
        !          10575: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    10576: </pre>
                   10577: 
                   10578:                 <p>and use that for further work.</p>
                   10579:               </li>
                   10580: 
                   10581:               <li>
1.14    ! xtraeme  10582:                 <p>Fix <code class="varname">CATEGORIES</code> and
        !          10583:                 any <code class="varname">DEPENDS</code> paths that
        !          10584:                 just did &#8220;<span class=
1.1       grant    10585:                 "quote">../package</span>&#8221; instead of
                   10586:                 &#8220;<span class=
                   10587:                 "quote">../../category/package</span>&#8221;.</p>
                   10588:               </li>
                   10589: 
                   10590:               <li>
1.14    ! xtraeme  10591:                 <p><span><strong class="command">cvs
        !          10592:                 import</strong></span> the modified package in the
        !          10593:                 new place.</p>
1.1       grant    10594:               </li>
                   10595: 
                   10596:               <li>
                   10597:                 <p>Check if any package depends on it:</p>
                   10598:                 <pre class="screen">
1.14    ! xtraeme  10599: <code class="prompt">%</code> <strong class=
        !          10600: "userinput"><code>cd /usr/pkgsrc</code></strong>
        !          10601: <code class="prompt">%</code> <strong class=
        !          10602: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    10603: </pre>
                   10604:               </li>
                   10605: 
                   10606:               <li>
                   10607:                 <p>Fix paths in packages from step 5 to point to
                   10608:                 new location.</p>
                   10609:               </li>
                   10610: 
                   10611:               <li>
1.14    ! xtraeme  10612:                 <p><span><strong class="command">cvs rm
        !          10613:                 (-f)</strong></span> the package at the old
        !          10614:                 location.</p>
1.1       grant    10615:               </li>
                   10616: 
                   10617:               <li>
1.14    ! xtraeme  10618:                 <p>Remove from <code class=
        !          10619:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    10620:               </li>
                   10621: 
                   10622:               <li>
1.14    ! xtraeme  10623:                 <p>Add to <code class=
        !          10624:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    10625:               </li>
                   10626: 
                   10627:               <li>
                   10628:                 <p>Commit the changed and removed files:</p>
                   10629:                 <pre class="screen">
1.14    ! xtraeme  10630: <code class="prompt">%</code> <strong class=
        !          10631: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    10632: </pre>
                   10633: 
                   10634:                 <p>(and any packages from step 5, of course).</p>
                   10635:               </li>
                   10636:             </ol>
                   10637:           </div>
                   10638:         </div>
                   10639:       </div>
                   10640:     </div>
                   10641: 
                   10642:     <div class="appendix" lang="en" xml:lang="en">
                   10643:       <div class="titlepage">
                   10644:         <div>
                   10645:           <div>
                   10646:             <h2 class="title"><a name="examples" id=
                   10647:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   10648:             package: bison</h2>
                   10649:           </div>
                   10650:         </div>
                   10651:       </div>
                   10652: 
                   10653:       <div class="toc">
                   10654:         <p><b>Table of Contents</b></p>
                   10655: 
                   10656:         <dl>
1.14    ! xtraeme  10657:           <dt><span class="sect1"><a href="#id2595319">A.1.
1.1       grant    10658:           files</a></span></dt>
                   10659: 
                   10660:           <dd>
                   10661:             <dl>
1.14    ! xtraeme  10662:               <dt><span class="sect2"><a href="#id2595322">A.1.1.
1.1       grant    10663:               Makefile</a></span></dt>
                   10664: 
1.14    ! xtraeme  10665:               <dt><span class="sect2"><a href="#id2595330">A.1.2.
1.1       grant    10666:               DESCR</a></span></dt>
                   10667: 
1.14    ! xtraeme  10668:               <dt><span class="sect2"><a href="#id2595345">A.1.3.
1.1       grant    10669:               PLIST</a></span></dt>
                   10670: 
1.14    ! xtraeme  10671:               <dt><span class="sect2"><a href="#id2595352">A.1.4.
        !          10672:               Checking a package with <span><strong class=
        !          10673:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    10674:             </dl>
                   10675:           </dd>
                   10676: 
1.14    ! xtraeme  10677:           <dt><span class="sect1"><a href="#id2595393">A.2. Steps
1.1       grant    10678:           for building, installing, packaging</a></span></dt>
                   10679:         </dl>
                   10680:       </div>
                   10681: 
                   10682:       <p>We checked to find a piece of software that wasn't in the
                   10683:       packages collection, and picked GNU bison. Quite why someone
1.14    ! xtraeme  10684:       would want to have <span><strong class=
        !          10685:       "command">bison</strong></span> when Berkeley
        !          10686:       <span><strong class="command">yacc</strong></span> is already
        !          10687:       present in the tree is beyond us, but it's useful for the
        !          10688:       purposes of this exercise.</p>
1.1       grant    10689: 
                   10690:       <div class="sect1" lang="en" xml:lang="en">
                   10691:         <div class="titlepage">
                   10692:           <div>
                   10693:             <div>
                   10694:               <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  10695:               "id2595319" id="id2595319"></a>A.1.&nbsp;files</h2>
1.1       grant    10696:             </div>
                   10697:           </div>
                   10698:         </div>
                   10699: 
                   10700:         <div class="sect2" lang="en" xml:lang="en">
                   10701:           <div class="titlepage">
                   10702:             <div>
                   10703:               <div>
1.14    ! xtraeme  10704:                 <h3 class="title"><a name="id2595322" id=
        !          10705:                 "id2595322"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    10706:               </div>
                   10707:             </div>
                   10708:           </div>
                   10709:           <pre class="programlisting">
1.11      ben      10710: # $NetBSD$
1.1       grant    10711: #
                   10712: 
                   10713: DISTNAME=       bison-1.25
                   10714: CATEGORIES=     devel
                   10715: MASTER_SITES=   ${MASTER_SITE_GNU}
                   10716: 
                   10717: MAINTAINER=     thorpej@NetBSD.org
                   10718: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   10719: COMMENT=        GNU yacc clone
                   10720: 
                   10721: GNU_CONFIGURE=  yes
                   10722: INFO_FILES=     bison.info
                   10723: 
                   10724: .include "../../mk/bsd.pkg.mk"
                   10725: </pre>
                   10726:         </div>
                   10727: 
                   10728:         <div class="sect2" lang="en" xml:lang="en">
                   10729:           <div class="titlepage">
                   10730:             <div>
                   10731:               <div>
1.14    ! xtraeme  10732:                 <h3 class="title"><a name="id2595330" id=
        !          10733:                 "id2595330"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    10734:               </div>
                   10735:             </div>
                   10736:           </div>
                   10737:           <pre class="programlisting">
                   10738: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   10739: improvements.  Why you would want this when Berkeley <a href=
                   10740: "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
                   10741: of the NetBSD source tree is beyond me.
                   10742: </pre>
                   10743:         </div>
                   10744: 
                   10745:         <div class="sect2" lang="en" xml:lang="en">
                   10746:           <div class="titlepage">
                   10747:             <div>
                   10748:               <div>
1.14    ! xtraeme  10749:                 <h3 class="title"><a name="id2595345" id=
        !          10750:                 "id2595345"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    10751:               </div>
                   10752:             </div>
                   10753:           </div>
                   10754:           <pre class="programlisting">
1.11      ben      10755: @comment $NetBSD$
1.1       grant    10756: bin/bison
                   10757: man/man1/bison.1.gz
                   10758: share/bison.simple
                   10759: share/bison.hairy
                   10760: </pre>
                   10761:         </div>
                   10762: 
                   10763:         <div class="sect2" lang="en" xml:lang="en">
                   10764:           <div class="titlepage">
                   10765:             <div>
                   10766:               <div>
1.14    ! xtraeme  10767:                 <h3 class="title"><a name="id2595352" id=
        !          10768:                 "id2595352"></a>A.1.4.&nbsp;Checking a package with
        !          10769:                 <span><strong class=
        !          10770:                 "command">pkglint</strong></span></h3>
1.1       grant    10771:               </div>
                   10772:             </div>
                   10773:           </div>
                   10774: 
                   10775:           <p>The NetBSD package system comes with <a xmlns=
                   10776:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   10777:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14    ! xtraeme  10778:           class="pkgname">pkgtools/pkglint</a> which helps to check
        !          10779:           the contents of these files. After installation it is
        !          10780:           quite easy to use, just change to the directory of the
        !          10781:           package you wish to examine and execute
        !          10782:           <span><strong class=
        !          10783:           "command">pkglint</strong></span>:</p>
1.1       grant    10784:           <pre class="screen">
1.14    ! xtraeme  10785: <code class="prompt">$</code> <strong class=
        !          10786: "userinput"><code>pkglint</code></strong>
1.1       grant    10787: OK: checking ./DESCR.
                   10788: OK: checking Makefile.
                   10789: OK: checking distinfo.
                   10790: OK: checking patches/patch-aa.
                   10791: looks fine.
                   10792: </pre>
                   10793: 
                   10794:           <p>Depending on the supplied command line arguments (see
                   10795:           pkglint(1)) more verbose checks will be performed. Use
1.14    ! xtraeme  10796:           e.g. <span><strong class="command">pkglint
        !          10797:           -v</strong></span> for a very verbose check.</p>
1.1       grant    10798:         </div>
                   10799:       </div>
                   10800: 
                   10801:       <div class="sect1" lang="en" xml:lang="en">
                   10802:         <div class="titlepage">
                   10803:           <div>
                   10804:             <div>
                   10805:               <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  10806:               "id2595393" id="id2595393"></a>A.2.&nbsp;Steps for
1.1       grant    10807:               building, installing, packaging</h2>
                   10808:             </div>
                   10809:           </div>
                   10810:         </div>
                   10811: 
                   10812:         <p>Create the directory where the package lives, plus any
                   10813:         auxiliary directories:</p>
                   10814:         <pre class="screen">
1.14    ! xtraeme  10815: <code class="prompt">#</code> <strong class=
        !          10816: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
        !          10817: <code class="prompt">#</code> <strong class=
        !          10818: "userinput"><code>mkdir bison</code></strong>
        !          10819: <code class="prompt">#</code> <strong class=
        !          10820: "userinput"><code>cd bison</code></strong>
        !          10821: <code class="prompt">#</code> <strong class=
        !          10822: "userinput"><code>mkdir patches</code></strong>
1.1       grant    10823: </pre>
                   10824: 
1.14    ! xtraeme  10825:         <p>Create <code class="filename">Makefile</code>,
        !          10826:         <code class="filename">DESCR</code> and <code class=
        !          10827:         "filename">PLIST</code> (see <a href="#components" title=
1.1       grant    10828:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   10829:         Chapter 7, <i>Package components - files, directories and
                   10830:         contents</i></a>) then continue with fetching the
                   10831:         distfile:</p>
                   10832:         <pre class="screen">
1.14    ! xtraeme  10833: <code class="prompt">#</code> <strong class=
        !          10834: "userinput"><code>make fetch</code></strong>
1.1       grant    10835: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   10836: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   10837: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10838: ftp: Error retrieving file: 500 Internal error
                   10839: 
                   10840: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   10841: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10842: ftp: Error retrieving file: 500 Internal error
                   10843: 
                   10844: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   10845: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10846: Successfully retrieved file.
                   10847: </pre>
                   10848: 
1.14    ! xtraeme  10849:         <p>Generate the checksum of the distfile into <code class=
        !          10850:         "filename">distinfo</code>:</p>
1.1       grant    10851:         <pre class="screen">
1.14    ! xtraeme  10852: <code class="prompt">#</code> <strong class=
        !          10853: "userinput"><code>make makesum</code></strong>
1.1       grant    10854: </pre>
                   10855: 
                   10856:         <p>Now compile:</p>
                   10857:         <pre class="screen">
1.14    ! xtraeme  10858: <code class="prompt">#</code> <strong class=
        !          10859: "userinput"><code>make</code></strong>
1.1       grant    10860: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10861: ===&gt;  Extracting for bison-1.25
                   10862: ===&gt;  Patching for bison-1.25
                   10863: ===&gt;   Ignoring empty patch directory
                   10864: ===&gt;  Configuring for bison-1.25
                   10865: creating cache ./config.cache
                   10866: checking for gcc... cc
                   10867: checking whether we are using GNU C... yes
                   10868: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   10869: checking how to run the C preprocessor... cc -E
                   10870: checking for minix/config.h... no
                   10871: checking for POSIXized ISC... no
                   10872: checking whether cross-compiling... no
                   10873: checking for ANSI C header files... yes
                   10874: checking for string.h... yes
                   10875: checking for stdlib.h... yes
                   10876: checking for memory.h... yes
                   10877: checking for working const... yes
                   10878: checking for working alloca.h... no
                   10879: checking for alloca... yes
                   10880: checking for strerror... yes
                   10881: updating cache ./config.cache
                   10882: creating ./config.status
                   10883: creating Makefile
                   10884: ===&gt;  Building for bison-1.25
                   10885: 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
                   10886: 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
                   10887: 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
                   10888: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g conflicts.c
                   10889: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g derives.c
                   10890: 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 
                   10891: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g getargs.c
                   10892: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g gram.c
                   10893: 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
                   10894: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g lex.c
                   10895: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g main.c
                   10896: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g nullable.c
                   10897: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g output.c
                   10898: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g print.c
                   10899: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g reader.c
                   10900: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g reduce.c
                   10901: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g symtab.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 warshall.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 version.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 getopt.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 getopt1.c
                   10906: 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
                   10907: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   10908: rm -f bison.s1
                   10909: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   10910: </pre>
                   10911: 
                   10912:         <p>Everything seems OK, so install the files:</p>
                   10913:         <pre class="screen">
1.14    ! xtraeme  10914: <code class="prompt">#</code> <strong class=
        !          10915: "userinput"><code>make install</code></strong>
1.1       grant    10916: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10917: ===&gt;  Installing for bison-1.25
                   10918: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   10919: rm -f /usr/pkg/bin/bison
                   10920: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   10921: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   10922: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   10923: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   10924: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   10925: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   10926: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   10927: ===&gt;  Registering installation for bison-1.25
                   10928: </pre>
                   10929: 
                   10930:         <p>You can now use bison, and also - if you decide so -
1.14    ! xtraeme  10931:         remove it with <span><strong class="command">pkg_delete
        !          10932:         bison</strong></span>. Should you decide that you want a
        !          10933:         binary package, do this now:</p>
1.1       grant    10934:         <pre class="screen">
1.14    ! xtraeme  10935: <code class="prompt">#</code> <strong class=
        !          10936: "userinput"><code>make package</code></strong>
1.1       grant    10937: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10938: ===&gt;  Building package for bison-1.25
                   10939: Creating package bison-1.25.tgz
                   10940: Registering depends:.
                   10941: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   10942: </pre>
                   10943: 
                   10944:         <p>Now that you don't need the source and object files any
                   10945:         more, clean up:</p>
                   10946:         <pre class="screen">
1.14    ! xtraeme  10947: <code class="prompt">#</code> <strong class=
        !          10948: "userinput"><code>make clean</code></strong>
1.1       grant    10949: ===&gt;  Cleaning for bison-1.25
                   10950: </pre>
                   10951:       </div>
                   10952:     </div>
                   10953: 
                   10954:     <div class="appendix" lang="en" xml:lang="en">
                   10955:       <div class="titlepage">
                   10956:         <div>
                   10957:           <div>
                   10958:             <h2 class="title"><a name="logs" id=
                   10959:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   10960:           </div>
                   10961:         </div>
                   10962:       </div>
                   10963: 
                   10964:       <div class="toc">
                   10965:         <p><b>Table of Contents</b></p>
                   10966: 
                   10967:         <dl>
                   10968:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   10969:           Building figlet</a></span></dt>
                   10970: 
                   10971:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   10972:           Packaging figlet</a></span></dt>
                   10973:         </dl>
                   10974:       </div>
                   10975: 
                   10976:       <div class="sect1" lang="en" xml:lang="en">
                   10977:         <div class="titlepage">
                   10978:           <div>
                   10979:             <div>
                   10980:               <h2 class="title" style="clear: both"><a name=
                   10981:               "logs.building" id=
                   10982:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   10983:             </div>
                   10984:           </div>
                   10985:         </div>
                   10986:         <pre class="screen">
1.14    ! xtraeme  10987: <code class="prompt">#</code> <strong class=
        !          10988: "userinput"><code>make</code></strong>
1.1       grant    10989: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10990: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   10991: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   10992: =&gt; [172219 bytes]
                   10993: Connected to ftp.plig.net.
                   10994: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   10995: 331 Guest login ok, send your complete e-mail address as password.
                   10996: 230-You are user #5 of 500 simultaneous users allowed.
                   10997: 230-
                   10998: 230-  ___ _             _ _                   
                   10999: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   11000: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   11001: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   11002: 230-         |_|   |_|     |___|         |___|
                   11003: 230-
                   11004: 230-** Welcome to ftp.plig.org **
                   11005: 230-
                   11006: 230-Please note that all transfers from this FTP site are logged. If you
                   11007: 230-do not like this, please disconnect now.
                   11008: 230-
                   11009: 230-This arhive is available via
                   11010: 230-
                   11011: 230-HTTP:  http://ftp.plig.org/
                   11012: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   11013: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   11014: 230-
                   11015: 230-Please email comments, bug reports and requests for packages to be
                   11016: 230-mirrored to ftp-admin@plig.org.   
                   11017: 230-
                   11018: 230-
                   11019: 230 Logged in anonymously.
                   11020: Remote system type is UNIX.
                   11021: Using binary mode to transfer files.
                   11022: 200 Type okay.
                   11023: 250 "/pub" is new cwd.
                   11024: 250-"/pub/figlet" is new cwd.
                   11025: 250-
                   11026: 250-Welcome to the figlet archive at ftp.figlet.org
                   11027: 250-    
                   11028: 250-    ftp://ftp.figlet.org/pub/figlet/
                   11029: 250-
                   11030: 250-The official FIGlet web page is:
                   11031: 250-    http://www.figlet.org/
                   11032: 250-
                   11033: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   11034: 250-contribute a font or something else, you can email us.
                   11035: 250 
                   11036: 250 "/pub/figlet/program" is new cwd.
                   11037: 250 "/pub/figlet/program/unix" is new cwd.
                   11038: local: figlet221.tar.gz remote: figlet221.tar.gz
                   11039: 502 Unimplemented command.
                   11040: 227 Entering Passive Mode (195,40,6,41,246,104)
                   11041: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   11042: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   11043: 226 Transfer completed.
                   11044: 172219 bytes received in 00:02 (75.99 KB/s)
                   11045: 221 Goodbye.
                   11046: =&gt; Checksum OK for figlet221.tar.gz.
                   11047: ===&gt; Extracting for figlet-2.2.1nb2
                   11048: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   11049: ===&gt; Patching for figlet-2.2.1nb2
                   11050: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   11051: ===&gt; Overriding tools for figlet-2.2.1nb2
                   11052: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   11053: ===&gt; Configuring for figlet-2.2.1nb2
                   11054: ===&gt; Building for figlet-2.2.1nb2
                   11055: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   11056: chmod a+x figlet
                   11057: gcc -O2 -o chkfont chkfont.c
                   11058: =&gt; Unwrapping files-to-be-installed.
1.14    ! xtraeme  11059: <code class="prompt">#</code>
        !          11060: <code class="prompt">#</code> <strong class=
        !          11061: "userinput"><code>make install</code></strong>
1.1       grant    11062: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11063: ===&gt; Installing for figlet-2.2.1nb2
                   11064: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   11065: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   11066: mkdir -p /usr/pkg/share/figlet
                   11067: cp figlet /usr/pkg/bin
                   11068: cp chkfont /usr/pkg/bin
                   11069: chmod 555 figlist showfigfonts
                   11070: cp figlist /usr/pkg/bin
                   11071: cp showfigfonts /usr/pkg/bin
                   11072: cp fonts/*.flf /usr/pkg/share/figlet
                   11073: cp fonts/*.flc /usr/pkg/share/figlet
                   11074: cp figlet.6 /usr/pkg/man/man6
                   11075: ===&gt; Registering installation for figlet-2.2.1nb2
1.14    ! xtraeme  11076: <code class="prompt">#</code>
1.1       grant    11077: </pre>
                   11078:       </div>
                   11079: 
                   11080:       <div class="sect1" lang="en" xml:lang="en">
                   11081:         <div class="titlepage">
                   11082:           <div>
                   11083:             <div>
                   11084:               <h2 class="title" style="clear: both"><a name=
                   11085:               "logs.package" id=
                   11086:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   11087:             </div>
                   11088:           </div>
                   11089:         </div>
                   11090:         <pre class="screen">
1.14    ! xtraeme  11091: <code class="prompt">#</code> <strong class=
        !          11092: "userinput"><code>make package</code></strong>
1.1       grant    11093: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11094: ===&gt; Packaging figlet-2.2.1nb2
                   11095: ===&gt; Building binary package for figlet-2.2.1nb2
                   11096: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   11097: Using SrcDir value of /usr/pkg
                   11098: Registering depends:.  
1.14    ! xtraeme  11099: <code class="prompt">#</code>
1.1       grant    11100: </pre>
                   11101:       </div>
                   11102:     </div>
                   11103: 
                   11104:     <div class="appendix" lang="en" xml:lang="en">
                   11105:       <div class="titlepage">
                   11106:         <div>
                   11107:           <div>
                   11108:             <h2 class="title"><a name="ftp-layout" id=
                   11109:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   11110:             FTP server's package archive</h2>
                   11111:           </div>
                   11112:         </div>
                   11113:       </div>
                   11114: 
                   11115:       <p>Layout for precompiled binary packages on
                   11116:       ftp.NetBSD.org:</p>
                   11117:       <pre class="programlisting">
                   11118: /pub/NetBSD/packages/
                   11119:                 distfiles/
                   11120: 
                   11121:                 # Unpacked pkgsrc trees
                   11122:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   11123:                 pkgsrc-2003Q4 -&gt; N/A
                   11124:                 pkgsrc-2004Q1/pkgsrc
                   11125: 
                   11126:                 # pkgsrc archives
                   11127:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   11128:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   11129:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   11130: 
                   11131:                 # Per pkgsrc-release/OS-release/arch package archives
                   11132:                 pkgsrc-2003Q4/
                   11133:                         NetBSD-1.6.2/
                   11134:                                 i386/
                   11135:                                         All/
                   11136:                                         archivers/
                   11137:                                                 foo -&gt; ../All/foo
                   11138:                                         ...
                   11139:                 pkgsrc-2004Q1/
                   11140:                         NetBSD-1.6.2/
                   11141:                                 i386/
                   11142:                                         All/
                   11143:                                         ...
                   11144:                         NetBSD-2.0/
                   11145:                                 i386/
                   11146:                                         All/
                   11147:                                         ...
                   11148:                         SunOS-5.9/
                   11149:                                 sparc/
                   11150:                                         All/
                   11151:                                         ...
                   11152:                                 x86/
                   11153:                                         All/
                   11154:                                         ...
                   11155: 
                   11156:                 # Per os-release package archive convenience links
                   11157:                 NetBSD-1.6.2 -&gt; 1.6.2
                   11158:                 1.6.2/
                   11159:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   11160:                         m68k/
                   11161:                                 All/
                   11162:                                 archivers/
                   11163:                                         foo -&gt; ../All/foo
                   11164:                                 ...
                   11165:                         amiga -&gt; m68k
                   11166:                         atari -&gt; m68k
                   11167:                         ...
                   11168: 
                   11169:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   11170:                 NetBSD-2.0/
                   11171:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   11172:                 SunOS-5.9/
                   11173:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   11174:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   11175:                         
                   11176: </pre>
                   11177: 
                   11178:       <p>To create:</p>
                   11179: 
                   11180:       <div class="orderedlist">
                   11181:         <ol type="1">
                   11182:           <li>
                   11183:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   11184:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   11185:             5.3, &#8220;Doing a bulk build of all
                   11186:             packages&#8221;</a></p>
                   11187:           </li>
                   11188: 
                   11189:           <li>
                   11190:             <p>Upload /usr/pkgsrc/packages to</p>
                   11191:             <pre class="programlisting">
                   11192:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  11193:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    11194:         `uname -s`-`uname -r`/                  # OS &amp; version
                   11195:         `uname -p`                              # architecture
                   11196:        
                   11197: </pre>
                   11198:           </li>
                   11199: 
                   11200:           <li>
1.14    ! xtraeme  11201:             <p>If necessary, create a symlink <span><strong class=
        !          11202:             "command">ln -s `uname -m` `uname -p`</strong></span>
        !          11203:             (amiga -&gt; m68k, ...)</p>
1.1       grant    11204:           </li>
                   11205:         </ol>
                   11206:       </div>
                   11207:     </div>
1.2       hubertf  11208: 
                   11209:     <div class="appendix" lang="en" xml:lang="en">
                   11210:       <div class="titlepage">
                   11211:         <div>
                   11212:           <div>
                   11213:             <h2 class="title"><a name="editing" id=
                   11214:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   11215:             for the pkgsrc guide</h2>
                   11216:           </div>
                   11217:         </div>
                   11218:       </div>
                   11219: 
                   11220:       <div class="toc">
                   11221:         <p><b>Table of Contents</b></p>
                   11222: 
                   11223:         <dl>
1.14    ! xtraeme  11224:           <dt><span class="sect1"><a href="#id2596107">D.1.
1.2       hubertf  11225:           Targets</a></span></dt>
                   11226: 
1.14    ! xtraeme  11227:           <dt><span class="sect1"><a href="#id2596178">D.2.
1.2       hubertf  11228:           Procedure</a></span></dt>
                   11229:         </dl>
                   11230:       </div>
                   11231: 
                   11232:       <p>This section contains information on editing the pkgsrc
                   11233:       guide itself.</p>
                   11234: 
                   11235:       <div class="sect1" lang="en" xml:lang="en">
                   11236:         <div class="titlepage">
                   11237:           <div>
                   11238:             <div>
                   11239:               <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  11240:               "id2596107" id="id2596107"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  11241:             </div>
                   11242:           </div>
                   11243:         </div>
                   11244: 
1.14    ! xtraeme  11245:         <p>The pkgsrc guide's source code is stored in <code class=
        !          11246:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  11247:         are created from it:</p>
                   11248: 
                   11249:         <div class="itemizedlist">
                   11250:           <ul type="disc">
                   11251:             <li>
1.14    ! xtraeme  11252:               <p><code class=
        !          11253:               "filename">pkgsrc/doc/pkgsrc.txt</code>, which
        !          11254:               replaces <code class=
        !          11255:               "filename">pkgsrc/Packages.txt</code></p>
1.2       hubertf  11256:             </li>
                   11257: 
                   11258:             <li>
1.14    ! xtraeme  11259:               <p><code class=
        !          11260:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  11261:             </li>
                   11262: 
                   11263:             <li>
1.14    ! xtraeme  11264:               <p><code class=
        !          11265:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  11266:               the documentation on the NetBSD website will be built
                   11267:               from pkgsrc and kept up to date on the web server
                   11268:               itself. This means you <span class=
                   11269:               "emphasis"><em>must</em></span> make sure that your
                   11270:               changes haven't broken the build!</p>
                   11271:             </li>
1.6       hubertf  11272: 
                   11273:             <li>
1.14    ! xtraeme  11274:               <p><code class=
        !          11275:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  11276:               PDF version of the pkgsrc guide.</p>
                   11277:             </li>
                   11278: 
                   11279:             <li>
1.14    ! xtraeme  11280:               <p><code class=
        !          11281:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  11282:               PostScript version of the pkgsrc guide.</p>
                   11283:             </li>
1.2       hubertf  11284:           </ul>
                   11285:         </div>
                   11286:       </div>
                   11287: 
                   11288:       <div class="sect1" lang="en" xml:lang="en">
                   11289:         <div class="titlepage">
                   11290:           <div>
                   11291:             <div>
                   11292:               <h2 class="title" style="clear: both"><a name=
1.14    ! xtraeme  11293:               "id2596178" id=
        !          11294:               "id2596178"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  11295:             </div>
                   11296:           </div>
                   11297:         </div>
                   11298: 
                   11299:         <p>The procedure to edit the pkgsrc guide is:</p>
                   11300: 
                   11301:         <div class="itemizedlist">
                   11302:           <ul type="disc">
                   11303:             <li>
1.6       hubertf  11304:               <p>Make sure you have the packages needed to
                   11305:               re-generate the pkgsrc guide (and other XML-based
                   11306:               NetBSD documentation) installed. These are
1.11      ben      11307:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  11308:               for creating the ASCII- and HTML-version, and
                   11309:               &#8220;<span class=
1.11      ben      11310:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  11311:               PostScript- and PDF version. You will need both
                   11312:               packages installed, to make sure documentation is
                   11313:               consistent across all formats. The packages can be
1.14    ! xtraeme  11314:               found in <code class=
        !          11315:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
        !          11316:               <code class=
        !          11317:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  11318:             </li>
                   11319: 
                   11320:             <li>
1.14    ! xtraeme  11321:               <p>Edit the XML file(s) in <code class=
        !          11322:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  11323:             </li>
                   11324: 
                   11325:             <li>
1.14    ! xtraeme  11326:               <p>Run <span><strong class="command">make extract
        !          11327:               &amp;&amp; make do-lint</strong></span> in
        !          11328:               <code class="filename">pkgsrc/doc/guide</code> to
        !          11329:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  11330:             </li>
                   11331: 
                   11332:             <li>
1.14    ! xtraeme  11333:               <p>Run <span><strong class=
        !          11334:               "command">make</strong></span> in <code class=
        !          11335:               "filename">pkgsrc/doc/guide</code> to build the HTML
        !          11336:               and ASCII version.</p>
1.2       hubertf  11337:             </li>
                   11338: 
                   11339:             <li>
1.14    ! xtraeme  11340:               <p>If all is well, run <span><strong class=
        !          11341:               "command">make install-doc</strong></span> to put the
        !          11342:               generated files into <code class=
        !          11343:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  11344:             </li>
                   11345: 
                   11346:             <li>
1.14    ! xtraeme  11347:               <p><span><strong class="command">cvs commit
        !          11348:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  11349:             </li>
                   11350: 
                   11351:             <li>
1.14    ! xtraeme  11352:               <p><span><strong class="command">cvs commit -m
        !          11353:               re-generate
        !          11354:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  11355:             </li>
1.4       hubertf  11356: 
                   11357:             <li>
                   11358:               <p>Until the webserver on www.NetBSD.org is really
                   11359:               updated automatically to pick up changes to the
1.14    ! xtraeme  11360:               pkgsrc guide automatically, also run
        !          11361:               <span><strong class="command">make install-htdoc
        !          11362:               HTDOCSDIR=../../../htdocs</strong></span> (or
        !          11363:               similar, adjust <code class=
        !          11364:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  11365:             </li>
                   11366: 
                   11367:             <li>
1.14    ! xtraeme  11368:               <p><span><strong class="command">cvs commit
        !          11369:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  11370:             </li>
1.2       hubertf  11371:           </ul>
                   11372:         </div>
                   11373:       </div>
                   11374:     </div>
1.1       grant    11375:   </div>
                   11376: </body>
                   11377: </html>

CVSweb <webmaster@jp.NetBSD.org>