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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.2     ! hubertf     4:   "HTML Tidy for NetBSD (vers 1st October 2003), see www.w3.org" />
1.1       grant       5:   <meta http-equiv="Content-Type" content=
                      6:   "text/html; charset=us-ascii" />
                      7: 
                      8:   <title>The pkgsrc guide</title>
                      9:   <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
                     10:   <meta name="generator" content=
                     11:   "DocBook XSL Stylesheets V1.65.0" />
                     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.2     ! hubertf    22:           <h1 class="title"><a name="id2526935" id=
        !            23:           "id2526935"></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">
                     40:                   <p><tt class="email">&lt;<a href=
                     41:                   "mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</tt></p>
                     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">
                     53:                   <p><tt class="email">&lt;<a href=
                     54:                   "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</tt></p>
                     55:                 </div>
                     56:               </div>
                     57:             </div>
1.2     ! hubertf    58: 
        !            59:             <h3 class="corpauthor">The pkgsrc Developers Group</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.2     ! hubertf    69:           <p class="pubdate">$NetBSD: pkgsrc.xml,v 1.2 2004/10/21
        !            70:           15:07:47 grant 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.2     ! hubertf    96:             <dt><span class="sect1"><a href="#id2494406">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.2     ! hubertf   120:                 <dt><span class="sect1"><a href="#id2495045">2.1.
1.1       grant     121:                 As tar file</a></span></dt>
                    122: 
1.2     ! hubertf   123:                 <dt><span class="sect1"><a href="#id2495062">2.2.
1.1       grant     124:                 Via SUP</a></span></dt>
                    125: 
1.2     ! hubertf   126:                 <dt><span class="sect1"><a href="#id2495094">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.2     ! hubertf   136:                 <dt><span class="sect1"><a href="#id2495204">3.1.
1.1       grant     137:                 Bootstrapping pkgsrc</a></span></dt>
                    138: 
1.2     ! hubertf   139:                 <dt><span class="sect1"><a href="#id2495310">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.2     ! hubertf   145:                     "#id2495317">3.2.1. Darwin (Mac OS
1.1       grant     146:                     X)</a></span></dt>
                    147: 
                    148:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   149:                     "#id2495616">3.2.2. FreeBSD</a></span></dt>
1.1       grant     150: 
                    151:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   152:                     "#id2496264">3.2.3. Interix</a></span></dt>
1.1       grant     153: 
                    154:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   155:                     "#id2496355">3.2.4. IRIX</a></span></dt>
1.1       grant     156: 
                    157:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   158:                     "#id2496472">3.2.5. OpenBSD</a></span></dt>
1.1       grant     159: 
                    160:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   161:                     "#id2496652">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.2     ! hubertf   179:                     "#id2496857">4.1.1. Where to get binary
1.1       grant     180:                     packages</a></span></dt>
                    181: 
                    182:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   183:                     "#id2496898">4.1.2. How to use binary
1.1       grant     184:                     packages</a></span></dt>
                    185: 
                    186:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   187:                     "#id2497032">4.1.3. A word of
1.1       grant     188:                     warning</a></span></dt>
                    189:                   </dl>
                    190:                 </dd>
                    191: 
1.2     ! hubertf   192:                 <dt><span class="sect1"><a href="#id2497044">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.2     ! hubertf   198:                     "#id2497053">4.2.1.
1.1       grant     199:                     Requirements</a></span></dt>
                    200: 
                    201:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   202:                     "#id2497142">4.2.2. Fetching
1.1       grant     203:                     distfiles</a></span></dt>
                    204: 
                    205:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   206:                     "#id2497194">4.2.3. How to build and
1.1       grant     207:                     install</a></span></dt>
                    208: 
                    209:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   210:                     "#id2498125">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.2     ! hubertf   222:                 <dt><span class="sect1"><a href="#id2498280">5.1.
1.1       grant     223:                 Building a single binary package</a></span></dt>
                    224: 
1.2     ! hubertf   225:                 <dt><span class="sect1"><a href="#id2563075">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.2     ! hubertf   239:                     "#id2563214">5.3.2. Other environmental
1.1       grant     240:                     considerations</a></span></dt>
                    241: 
                    242:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   243:                     "#id2563255">5.3.3. Operation</a></span></dt>
1.1       grant     244: 
                    245:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   246:                     "#id2563462">5.3.4. What it
1.1       grant     247:                     does</a></span></dt>
                    248: 
                    249:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   250:                     "#id2563518">5.3.5. Disk space
1.1       grant     251:                     requirements</a></span></dt>
                    252: 
                    253:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   254:                     "#id2563545">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.2     ! hubertf   258:                     "#id2563909">5.3.7. Building a partial set of
1.1       grant     259:                     packages</a></span></dt>
                    260:                   </dl>
                    261:                 </dd>
                    262: 
1.2     ! hubertf   263:                 <dt><span class="sect1"><a href="#id2563952">5.4.
1.1       grant     264:                 Creating a multiple CD-ROM packages
                    265:                 collection</a></span></dt>
                    266: 
                    267:                 <dd>
                    268:                   <dl>
                    269:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   270:                     "#id2564035">5.4.1. Example of
1.1       grant     271:                     cdpack</a></span></dt>
                    272:                   </dl>
                    273:                 </dd>
                    274:               </dl>
                    275:             </dd>
                    276: 
                    277:             <dt><span class="chapter"><a href="#faq">6. Frequently
                    278:             Asked Questions</a></span></dt>
                    279: 
                    280:             <dd>
                    281:               <dl>
1.2     ! hubertf   282:                 <dt><span class="sect1"><a href="#id2564294">6.1.
1.1       grant     283:                 Is there a mailing list for pkg-related
                    284:                 discussion?</a></span></dt>
                    285: 
1.2     ! hubertf   286:                 <dt><span class="sect1"><a href="#id2564324">6.2.
1.1       grant     287:                 Where's the pkgviews documentation?</a></span></dt>
                    288: 
1.2     ! hubertf   289:                 <dt><span class="sect1"><a href="#id2564337">6.3.
1.1       grant     290:                 Utilities for package management
                    291:                 (pkgtools)</a></span></dt>
                    292: 
1.2     ! hubertf   293:                 <dt><span class="sect1"><a href="#id2564562">6.4.
1.1       grant     294:                 How to use pkgsrc as non-root</a></span></dt>
                    295: 
1.2     ! hubertf   296:                 <dt><span class="sect1"><a href="#id2564642">6.5.
1.1       grant     297:                 How can I install/use XFree86 from
                    298:                 pkgsrc?</a></span></dt>
                    299: 
1.2     ! hubertf   300:                 <dt><span class="sect1"><a href="#id2564669">6.6.
1.1       grant     301:                 How can I install/use X.org from
                    302:                 pkgsrc?</a></span></dt>
                    303: 
1.2     ! hubertf   304:                 <dt><span class="sect1"><a href="#id2564697">6.7.
1.1       grant     305:                 How to fetch files from behind a
                    306:                 firewall</a></span></dt>
                    307: 
1.2     ! hubertf   308:                 <dt><span class="sect1"><a href="#id2564711">6.8.
1.1       grant     309:                 How do I tell make fetch to do passive
                    310:                 FTP?</a></span></dt>
                    311: 
1.2     ! hubertf   312:                 <dt><span class="sect1"><a href="#id2564762">6.9.
1.1       grant     313:                 How to fetch all distfiles at once</a></span></dt>
                    314: 
1.2     ! hubertf   315:                 <dt><span class="sect1"><a href="#id2564970">6.10.
1.1       grant     316:                 What does Don't know how to make
                    317:                 /usr/share/tmac/tmac.andoc mean?</a></span></dt>
                    318: 
1.2     ! hubertf   319:                 <dt><span class="sect1"><a href="#id2565009">6.11.
1.1       grant     320:                 What does Could not find bsd.own.mk
                    321:                 mean?</a></span></dt>
                    322: 
1.2     ! hubertf   323:                 <dt><span class="sect1"><a href="#id2565066">6.12.
1.1       grant     324:                 Using 'sudo' with pkgsrc</a></span></dt>
                    325: 
                    326:                 <dt><span class="sect1"><a href="#faq.conf">6.13.
                    327:                 Configuration files handling and
                    328:                 placement</a></span></dt>
                    329: 
                    330:                 <dt><span class="sect1"><a href=
                    331:                 "#audit-packages">6.14. Automated security
                    332:                 checks</a></span></dt>
                    333:               </dl>
                    334:             </dd>
                    335:           </dl>
                    336:         </dd>
                    337: 
1.2     ! hubertf   338:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     339:         pkgsrc developer's guide</a></span></dt>
                    340: 
                    341:         <dd>
                    342:           <dl>
                    343:             <dt><span class="chapter"><a href="#components">7.
                    344:             Package components - files, directories and
                    345:             contents</a></span></dt>
                    346: 
                    347:             <dd>
                    348:               <dl>
                    349:                 <dt><span class="sect1"><a href=
                    350:                 "#components.Makefile">7.1.
                    351:                 Makefile</a></span></dt>
                    352: 
                    353:                 <dt><span class="sect1"><a href=
                    354:                 "#components.distinfo">7.2.
                    355:                 distinfo</a></span></dt>
                    356: 
                    357:                 <dt><span class="sect1"><a href=
                    358:                 "#components.patches">7.3.
                    359:                 patches/*</a></span></dt>
                    360: 
1.2     ! hubertf   361:                 <dt><span class="sect1"><a href="#id2566242">7.4.
1.1       grant     362:                 Other mandatory files</a></span></dt>
                    363: 
                    364:                 <dt><span class="sect1"><a href=
                    365:                 "#components.optional">7.5. Optional
                    366:                 files</a></span></dt>
                    367: 
1.2     ! hubertf   368:                 <dt><span class="sect1"><a href="#id2566436">7.6.
1.1       grant     369:                 work*</a></span></dt>
                    370: 
1.2     ! hubertf   371:                 <dt><span class="sect1"><a href="#id2566523">7.7.
1.1       grant     372:                 files/*</a></span></dt>
                    373:               </dl>
                    374:             </dd>
                    375: 
                    376:             <dt><span class="chapter"><a href="#plist">8. PLIST
                    377:             issues</a></span></dt>
                    378: 
                    379:             <dd>
                    380:               <dl>
1.2     ! hubertf   381:                 <dt><span class="sect1"><a href="#id2566578">8.1.
1.1       grant     382:                 RCS ID</a></span></dt>
                    383: 
1.2     ! hubertf   384:                 <dt><span class="sect1"><a href="#id2566593">8.2.
1.1       grant     385:                 Semi-automatic PLIST generation</a></span></dt>
                    386: 
                    387:                 <dt><span class="sect1"><a href="#print-PLIST">8.3.
                    388:                 Tweaking output of make print-PLIST</a></span></dt>
                    389: 
                    390:                 <dt><span class="sect1"><a href="#plist.misc">8.4.
                    391:                 Variable substitution in PLIST</a></span></dt>
                    392: 
1.2     ! hubertf   393:                 <dt><span class="sect1"><a href="#id2566914">8.5.
1.1       grant     394:                 Manpage-compression</a></span></dt>
                    395: 
1.2     ! hubertf   396:                 <dt><span class="sect1"><a href="#id2566955">8.6.
1.1       grant     397:                 Changing PLIST source with
                    398:                 PLIST_SRC</a></span></dt>
                    399: 
1.2     ! hubertf   400:                 <dt><span class="sect1"><a href="#id2566972">8.7.
1.1       grant     401:                 Platform specific and differing
                    402:                 PLISTs</a></span></dt>
                    403: 
                    404:                 <dt><span class="sect1"><a href=
                    405:                 "#faq.common-dirs">8.8. Sharing directories between
                    406:                 packages</a></span></dt>
                    407:               </dl>
                    408:             </dd>
                    409: 
                    410:             <dt><span class="chapter"><a href="#buildlink">9.
                    411:             Buildlink methodology</a></span></dt>
                    412: 
                    413:             <dd>
                    414:               <dl>
1.2     ! hubertf   415:                 <dt><span class="sect1"><a href="#id2567313">9.1.
1.1       grant     416:                 Converting packages to use
                    417:                 buildlink3</a></span></dt>
                    418: 
1.2     ! hubertf   419:                 <dt><span class="sect1"><a href="#id2567640">9.2.
1.1       grant     420:                 Writing buildlink3.mk files</a></span></dt>
                    421: 
                    422:                 <dd>
                    423:                   <dl>
                    424:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   425:                     "#id2567709">9.2.1. Anatomy of a buildlink3.mk
1.1       grant     426:                     file</a></span></dt>
                    427: 
                    428:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   429:                     "#id2568150">9.2.2. Updating
1.1       grant     430:                     BUILDLINK_DEPENDS.pkg in buildlink3.mk
                    431:                     files</a></span></dt>
                    432:                   </dl>
                    433:                 </dd>
                    434: 
1.2     ! hubertf   435:                 <dt><span class="sect1"><a href="#id2568229">9.3.
1.1       grant     436:                 Writing builtin.mk files</a></span></dt>
                    437: 
                    438:                 <dd>
                    439:                   <dl>
                    440:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   441:                     "#id2568378">9.3.1. Anatomy of a builtin.mk
1.1       grant     442:                     file</a></span></dt>
                    443: 
                    444:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   445:                     "#id2568537">9.3.2. Global preferences for
1.1       grant     446:                     native or pkgsrc software</a></span></dt>
                    447:                   </dl>
                    448:                 </dd>
                    449:               </dl>
                    450:             </dd>
                    451: 
                    452:             <dt><span class="chapter"><a href="#options">10.
                    453:             Options handling</a></span></dt>
                    454: 
                    455:             <dd>
                    456:               <dl>
1.2     ! hubertf   457:                 <dt><span class="sect1"><a href="#id2568610">10.1.
1.1       grant     458:                 Global default options</a></span></dt>
                    459: 
1.2     ! hubertf   460:                 <dt><span class="sect1"><a href="#id2568625">10.2.
1.1       grant     461:                 Converting packages to use
                    462:                 bsd.options.mk</a></span></dt>
                    463:               </dl>
                    464:             </dd>
                    465: 
                    466:             <dt><span class="chapter"><a href="#build">11. The
                    467:             build process</a></span></dt>
                    468: 
                    469:             <dd>
                    470:               <dl>
                    471:                 <dt><span class="sect1"><a href=
                    472:                 "#build.prefix">11.1. Program
                    473:                 location</a></span></dt>
                    474: 
1.2     ! hubertf   475:                 <dt><span class="sect1"><a href="#id2569369">11.2.
1.1       grant     476:                 Main targets</a></span></dt>
                    477: 
                    478:                 <dt><span class="sect1"><a href=
                    479:                 "#build.helpful-targets">11.3. Other helpful
                    480:                 targets</a></span></dt>
                    481:               </dl>
                    482:             </dd>
                    483: 
                    484:             <dt><span class="chapter"><a href="#fixes">12. Notes on
                    485:             fixes for packages</a></span></dt>
                    486: 
                    487:             <dd>
                    488:               <dl>
1.2     ! hubertf   489:                 <dt><span class="sect1"><a href="#id2570766">12.1.
1.1       grant     490:                 General operation</a></span></dt>
                    491: 
                    492:                 <dd>
                    493:                   <dl>
                    494:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   495:                     "#id2570770">12.1.1. How to pull in variables
1.1       grant     496:                     from /etc/mk.conf</a></span></dt>
                    497: 
                    498:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   499:                     "#id2570853">12.1.2. Restricted
1.1       grant     500:                     packages</a></span></dt>
                    501: 
                    502:                     <dt><span class="sect2"><a href=
                    503:                     "#dependencies">12.1.3. Handling
                    504:                     dependencies</a></span></dt>
                    505: 
                    506:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   507:                     "#id2571436">12.1.4. Handling conflicts with
1.1       grant     508:                     other packages</a></span></dt>
                    509: 
                    510:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   511:                     "#id2571486">12.1.5. Packages that cannot or
1.1       grant     512:                     should not be built</a></span></dt>
                    513: 
                    514:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   515:                     "#id2571512">12.1.6. Packages which should not
1.1       grant     516:                     be deleted, once installed</a></span></dt>
                    517: 
                    518:                     <dt><span class="sect2"><a href=
                    519:                     "#security-handling">12.1.7. Handling packages
                    520:                     with security problems</a></span></dt>
                    521: 
                    522:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   523:                     "#id2571604">12.1.8. How to handle compiler
1.1       grant     524:                     bugs</a></span></dt>
                    525: 
                    526:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   527:                     "#id2571626">12.1.9. How to handle incrementing
1.1       grant     528:                     versions when fixing an existing
                    529:                     package</a></span></dt>
                    530: 
                    531:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   532:                     "#id2571675">12.1.10. Portability of
1.1       grant     533:                     packages</a></span></dt>
                    534:                   </dl>
                    535:                 </dd>
                    536: 
1.2     ! hubertf   537:                 <dt><span class="sect1"><a href="#id2571700">12.2.
1.1       grant     538:                 Possible downloading issues</a></span></dt>
                    539: 
                    540:                 <dd>
                    541:                   <dl>
                    542:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   543:                     "#id2571703">12.2.1. Packages whose distfiles
1.1       grant     544:                     aren't available for plain
                    545:                     downloading</a></span></dt>
                    546: 
                    547:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   548:                     "#id2571902">12.2.2. How to handle modified
1.1       grant     549:                     distfiles with the 'old' name</a></span></dt>
                    550:                   </dl>
                    551:                 </dd>
                    552: 
1.2     ! hubertf   553:                 <dt><span class="sect1"><a href="#id2571914">12.3.
1.1       grant     554:                 Configuration gotchas</a></span></dt>
                    555: 
                    556:                 <dd>
                    557:                   <dl>
                    558:                     <dt><span class="sect2"><a href=
                    559:                     "#fixes.libtool">12.3.1. Shared libraries -
                    560:                     libtool</a></span></dt>
                    561: 
                    562:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   563:                     "#id2572390">12.3.2. Using libtool on GNU
1.1       grant     564:                     packages that already support
                    565:                     libtool</a></span></dt>
                    566: 
                    567:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   568:                     "#id2572474">12.3.3. GNU
1.1       grant     569:                     Autoconf/Automake</a></span></dt>
                    570:                   </dl>
                    571:                 </dd>
                    572: 
1.2     ! hubertf   573:                 <dt><span class="sect1"><a href="#id2572519">12.4.
1.1       grant     574:                 Building considerations</a></span></dt>
                    575: 
                    576:                 <dd>
                    577:                   <dl>
                    578:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   579:                     "#id2572522">12.4.1. CPP
1.1       grant     580:                     defines</a></span></dt>
                    581:                   </dl>
                    582:                 </dd>
                    583: 
1.2     ! hubertf   584:                 <dt><span class="sect1"><a href="#id2572552">12.5.
1.1       grant     585:                 Package specific actions</a></span></dt>
                    586: 
                    587:                 <dd>
                    588:                   <dl>
                    589:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   590:                     "#id2572555">12.5.1. Package configuration
1.1       grant     591:                     files</a></span></dt>
                    592: 
                    593:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   594:                     "#id2572726">12.5.2. User
        !           595:                     interaction</a></span></dt>
1.1       grant     596: 
                    597:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   598:                     "#id2572771">12.5.3. Handling
1.1       grant     599:                     licenses</a></span></dt>
                    600: 
                    601:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   602:                     "#id2572922">12.5.4. Creating an account from a
1.1       grant     603:                     package</a></span></dt>
                    604: 
                    605:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   606:                     "#id2573052">12.5.5. Installing score
1.1       grant     607:                     files</a></span></dt>
                    608: 
                    609:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   610:                     "#id2573096">12.5.6. Packages providing login
1.1       grant     611:                     shells</a></span></dt>
                    612: 
                    613:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   614:                     "#id2573222">12.5.7. Packages containing perl
1.1       grant     615:                     scripts</a></span></dt>
                    616: 
                    617:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   618:                     "#id2573240">12.5.8. Packages with hardcoded
1.1       grant     619:                     paths to other interpreters</a></span></dt>
                    620: 
                    621:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   622:                     "#id2573261">12.5.9. Packages installing perl
1.1       grant     623:                     modules</a></span></dt>
                    624: 
                    625:                     <dt><span class="sect2"><a href=
                    626:                     "#faq.info-files">12.5.10. Packages installing
                    627:                     info files</a></span></dt>
                    628: 
                    629:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   630:                     "#id2573549">12.5.11. Packages installing
1.1       grant     631:                     GConf2 data files</a></span></dt>
                    632: 
                    633:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   634:                     "#id2573650">12.5.12. Packages installing
1.1       grant     635:                     scrollkeeper data files</a></span></dt>
                    636: 
                    637:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   638:                     "#id2573701">12.5.13. Packages installing X11
1.1       grant     639:                     fonts</a></span></dt>
                    640: 
                    641:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   642:                     "#id2573816">12.5.14. Packages installing GTK2
1.1       grant     643:                     modules</a></span></dt>
                    644: 
                    645:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   646:                     "#id2573885">12.5.15. Packages installing SGML
1.1       grant     647:                     or XML data</a></span></dt>
                    648: 
                    649:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   650:                     "#id2573938">12.5.16. Packages installing
1.1       grant     651:                     extensions to the MIME database</a></span></dt>
                    652: 
                    653:                     <dt><span class="sect2"><a href=
1.2     ! hubertf   654:                     "#id2574008">12.5.17. Packages using
1.1       grant     655:                     intltool</a></span></dt>
                    656:                   </dl>
                    657:                 </dd>
                    658: 
1.2     ! hubertf   659:                 <dt><span class="sect1"><a href="#id2574022">12.6.
1.1       grant     660:                 Feedback to the author</a></span></dt>
                    661:               </dl>
                    662:             </dd>
                    663: 
                    664:             <dt><span class="chapter"><a href="#debug">13.
                    665:             Debugging</a></span></dt>
                    666: 
                    667:             <dt><span class="chapter"><a href="#submit">14.
                    668:             Submitting and Committing</a></span></dt>
                    669: 
                    670:             <dd>
                    671:               <dl>
1.2     ! hubertf   672:                 <dt><span class="sect1"><a href="#id2574484">14.1.
1.1       grant     673:                 Submitting your packages</a></span></dt>
                    674: 
1.2     ! hubertf   675:                 <dt><span class="sect1"><a href="#id2574531">14.2.
1.1       grant     676:                 Committing: Importing a package into
                    677:                 CVS</a></span></dt>
                    678: 
1.2     ! hubertf   679:                 <dt><span class="sect1"><a href="#id2574730">14.3.
        !           680:                 Updating a package to a newer
        !           681:                 version</a></span></dt>
1.1       grant     682: 
1.2     ! hubertf   683:                 <dt><span class="sect1"><a href="#id2574818">14.4.
        !           684:                 Moving a package in pkgsrc</a></span></dt>
1.1       grant     685:               </dl>
                    686:             </dd>
                    687:           </dl>
                    688:         </dd>
                    689: 
                    690:         <dt><span class="appendix"><a href="#examples">A. A simple
                    691:         example package: bison</a></span></dt>
                    692: 
                    693:         <dd>
                    694:           <dl>
1.2     ! hubertf   695:             <dt><span class="sect1"><a href="#id2575044">A.1.
1.1       grant     696:             files</a></span></dt>
                    697: 
                    698:             <dd>
                    699:               <dl>
1.2     ! hubertf   700:                 <dt><span class="sect2"><a href="#id2575047">A.1.1.
1.1       grant     701:                 Makefile</a></span></dt>
                    702: 
1.2     ! hubertf   703:                 <dt><span class="sect2"><a href="#id2575054">A.1.2.
1.1       grant     704:                 DESCR</a></span></dt>
                    705: 
1.2     ! hubertf   706:                 <dt><span class="sect2"><a href="#id2575069">A.1.3.
1.1       grant     707:                 PLIST</a></span></dt>
                    708: 
1.2     ! hubertf   709:                 <dt><span class="sect2"><a href="#id2575077">A.1.4.
1.1       grant     710:                 Checking a package with pkglint</a></span></dt>
                    711:               </dl>
                    712:             </dd>
                    713: 
1.2     ! hubertf   714:             <dt><span class="sect1"><a href="#id2575186">A.2. Steps
1.1       grant     715:             for building, installing, packaging</a></span></dt>
                    716:           </dl>
                    717:         </dd>
                    718: 
                    719:         <dt><span class="appendix"><a href="#logs">B. Build
                    720:         logs</a></span></dt>
                    721: 
                    722:         <dd>
                    723:           <dl>
                    724:             <dt><span class="sect1"><a href="#logs.building">B.1.
                    725:             Building figlet</a></span></dt>
                    726: 
                    727:             <dt><span class="sect1"><a href="#logs.package">B.2.
                    728:             Packaging figlet</a></span></dt>
                    729:           </dl>
                    730:         </dd>
                    731: 
                    732:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
                    733:         of the FTP server's package archive</a></span></dt>
1.2     ! hubertf   734: 
        !           735:         <dt><span class="appendix"><a href="#editing">D. Editing
        !           736:         guidelines for the pkgsrc guide</a></span></dt>
        !           737: 
        !           738:         <dd>
        !           739:           <dl>
        !           740:             <dt><span class="sect1"><a href="#id2575900">D.1.
        !           741:             Targets</a></span></dt>
        !           742: 
        !           743:             <dt><span class="sect1"><a href="#id2575949">D.2.
        !           744:             Procedure</a></span></dt>
        !           745:           </dl>
        !           746:         </dd>
1.1       grant     747:       </dl>
                    748:     </div>
                    749: 
                    750:     <div class="chapter" lang="en" xml:lang="en">
                    751:       <div class="titlepage">
                    752:         <div>
                    753:           <div>
                    754:             <h2 class="title"><a name="introduction" id=
                    755:             "introduction"></a>Chapter&nbsp;1.&nbsp;Introduction</h2>
                    756:           </div>
                    757:         </div>
                    758:       </div>
                    759: 
                    760:       <div class="toc">
                    761:         <p><b>Table of Contents</b></p>
                    762: 
                    763:         <dl>
1.2     ! hubertf   764:           <dt><span class="sect1"><a href="#id2494406">1.1.
1.1       grant     765:           Introduction</a></span></dt>
                    766: 
                    767:           <dt><span class="sect1"><a href="#overview">1.2.
                    768:           Overview</a></span></dt>
                    769: 
                    770:           <dt><span class="sect1"><a href="#terminology">1.3.
                    771:           Terminology</a></span></dt>
                    772: 
                    773:           <dt><span class="sect1"><a href="#typography">1.4.
                    774:           Typography</a></span></dt>
                    775:         </dl>
                    776:       </div>
                    777: 
                    778:       <div class="sect1" lang="en" xml:lang="en">
                    779:         <div class="titlepage">
                    780:           <div>
                    781:             <div>
                    782:               <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf   783:               "id2494406" id=
        !           784:               "id2494406"></a>1.1.&nbsp;Introduction</h2>
1.1       grant     785:             </div>
                    786:           </div>
                    787:         </div>
                    788: 
                    789:         <p>There is a lot of software freely available for Unix
                    790:         based systems, which usually runs on NetBSD and other
                    791:         Unix-flavoured systems, too, sometimes with some
                    792:         modifications. The NetBSD Packages Collection (pkgsrc)
                    793:         incorporates any such changes necessary to make that
                    794:         software run, and makes the installation (and
                    795:         de-installation) of the software package easy by means of a
                    796:         single command.</p>
                    797: 
                    798:         <p>Once the software has been built, it is manipulated with
                    799:         the <span><b class="command">pkg_*</b></span> tools so that
                    800:         installation and de-installation, printing of an inventory
                    801:         of all installed packages and retrieval of one-line
                    802:         comments or more verbose descriptions are all simple.</p>
                    803: 
                    804:         <p>pkgsrc currently contains several thousand packages,
                    805:         including:</p>
                    806: 
                    807:         <div class="itemizedlist">
                    808:           <ul type="disc">
                    809:             <li>
                    810:               <p><a xmlns=
                    811:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    812:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.2     ! hubertf   813:                  class="pkgname">www/apache</a> - The Apache web
        !           814:                  server</p>
1.1       grant     815:             </li>
                    816: 
                    817:             <li>
                    818:               <p><a xmlns=
                    819:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    820:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.2     ! hubertf   821:                  class="pkgname">www/mozilla</a> - The Mozilla web
        !           822:                  browser</p>
1.1       grant     823:             </li>
                    824: 
                    825:             <li>
                    826:               <p><a xmlns=
                    827:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    828:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.2     ! hubertf   829:                  class="pkgname">meta-pkgs/gnome</a> - The GNOME
        !           830:                  Desktop Environment</p>
1.1       grant     831:             </li>
                    832: 
                    833:             <li>
                    834:               <p><a xmlns=
                    835:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    836:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.2     ! hubertf   837:                  class="pkgname">meta-pkgs/kde3</a> - The K Desktop
        !           838:                  Environment</p>
1.1       grant     839:             </li>
                    840:           </ul>
                    841:         </div>
                    842: 
                    843:         <p>...just to name a few.</p>
                    844: 
                    845:         <p>pkgsrc has built-in support for handling varying
                    846:         dependencies, such as pthreads and X11, and extended
                    847:         features such as IPv6 support on a range of platforms.</p>
                    848: 
                    849:         <p>pkgsrc was derived from FreeBSD's ports system, and
                    850:         initially developed for NetBSD only. Since then, pkgsrc has
                    851:         grown a lot, and now supports the following platforms:</p>
                    852: 
                    853:         <div class="itemizedlist">
                    854:           <ul type="disc">
                    855:             <li>
                    856:               <p><a href="http://developer.apple.com/darwin/"
                    857:               target="_top">Darwin</a> (<a href=
                    858:               "http://www.apple.com/macosx/" target="_top">Mac OS
                    859:               X</a>)</p>
                    860:             </li>
                    861: 
                    862:             <li>
                    863:               <p><a href="http://www.FreeBSD.org/" target=
                    864:               "_top">FreeBSD</a></p>
                    865:             </li>
                    866: 
                    867:             <li>
                    868:               <p><a href="http://www.microsoft.com/windows/sfu/"
                    869:               target="_top">Interix</a></p>
                    870:             </li>
                    871: 
                    872:             <li>
                    873:               <p><a href="http://www.sgi.com/software/irix6.5/"
                    874:               target="_top">IRIX</a></p>
                    875:             </li>
                    876: 
                    877:             <li>
                    878:               <p><a href="http://www.linux.org/" target=
                    879:               "_top">Linux</a></p>
                    880:             </li>
                    881: 
                    882:             <li>
                    883:               <p><a href="http://www.NetBSD.org/" target=
                    884:               "_top">NetBSD</a> (of course)</p>
                    885:             </li>
                    886: 
                    887:             <li>
                    888:               <p><a href="http://www.openbsd.org/" target=
                    889:               "_top">OpenBSD</a></p>
                    890:             </li>
                    891: 
                    892:             <li>
                    893:               <p><a href="http://www.sun.com/solaris/" target=
                    894:               "_top">Solaris</a></p>
                    895:             </li>
                    896:           </ul>
                    897:         </div>
                    898:       </div>
                    899: 
                    900:       <div class="sect1" lang="en" xml:lang="en">
                    901:         <div class="titlepage">
                    902:           <div>
                    903:             <div>
                    904:               <h2 class="title" style="clear: both"><a name=
                    905:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
                    906:             </div>
                    907:           </div>
                    908:         </div>
                    909: 
                    910:         <p>This document is divided into two parts. The first,
                    911:         <a href="#users-guide" title=
1.2     ! hubertf   912:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
        !           913:         user's guide</a>, describes how one can use one of the
        !           914:         packages in the Package Collection, either by installing a
        !           915:         precompiled binary package, or by building one's own copy
        !           916:         using the NetBSD package system. The second part, <a href=
1.1       grant     917:         "#developers-guide" title=
1.2     ! hubertf   918:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
        !           919:         pkgsrc developer's guide</a>, explains how to prepare a
        !           920:         package so it can be easily built by other NetBSD users
        !           921:         without knowing about the package's building details.</p>
1.1       grant     922: 
                    923:         <p>This document is available in various formats:</p>
                    924: 
                    925:         <div class="itemizedlist">
                    926:           <ul type="disc">
                    927:             <li>
                    928:               <p><a href="index.html" target="_top">HTML</a></p>
                    929:             </li>
                    930: 
                    931:             <li>
                    932:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                    933:             </li>
                    934: 
                    935:             <li>
                    936:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                    937:             </li>
                    938: 
                    939:             <li>
                    940:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                    941:             </li>
                    942:           </ul>
                    943:         </div>
                    944:       </div>
                    945: 
                    946:       <div class="sect1" lang="en" xml:lang="en">
                    947:         <div class="titlepage">
                    948:           <div>
                    949:             <div>
                    950:               <h2 class="title" style="clear: both"><a name=
                    951:               "terminology" id=
                    952:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                    953:             </div>
                    954:           </div>
                    955:         </div>
                    956: 
                    957:         <p>There has been a lot of talk about &#8220;<span class=
                    958:         "quote">ports</span>&#8221;, &#8220;<span class=
                    959:         "quote">packages</span>&#8221;, etc. so far. Here is a
                    960:         description of all the terminology used within this
                    961:         document.</p>
                    962: 
                    963:         <div class="variablelist">
                    964:           <dl>
                    965:             <dt><span class="term">Package</span></dt>
                    966: 
                    967:             <dd>
                    968:               <p>A set of files and building instructions that
                    969:               describe what's necessary to build a certain piece of
                    970:               software using pkgsrc. Packages are traditionally
                    971:               stored under <tt class=
                    972:               "filename">/usr/pkgsrc</tt>.</p>
                    973:             </dd>
                    974: 
                    975:             <dt><span class="term">The NetBSD package
                    976:             system</span></dt>
                    977: 
                    978:             <dd>
                    979:               <p>This is the former name of &#8220;<span class=
                    980:               "quote">pkgsrc</span>&#8221;. It is part of the
                    981:               NetBSD operating system and can be bootstrap to run
                    982:               on non-NetBSD operating systems as well. It handles
                    983:               building (compiling), installing, and removing of
                    984:               packages.</p>
                    985:             </dd>
                    986: 
                    987:             <dt><span class="term">Distfile</span></dt>
                    988: 
                    989:             <dd>
                    990:               <p>This term describes the file or files that are
                    991:               provided by the author of the piece of software to
                    992:               distribute his work. All the changes necessary to
                    993:               build on NetBSD are reflected in the corresponding
                    994:               package. Usually the distfile is in the form of a
                    995:               compressed tar-archive, but other types are possible,
                    996:               too. Distfiles are usually stored below <tt class=
                    997:               "filename">/usr/pkgsrc/distfiles</tt>.</p>
                    998:             </dd>
                    999: 
                   1000:             <dt><span class="term">Port</span></dt>
                   1001: 
                   1002:             <dd>
                   1003:               <p>This is the term used by FreeBSD and OpenBSD
                   1004:               people for what we call a package. In NetBSD
                   1005:               terminology, &#8220;<span class=
                   1006:               "quote">port</span>&#8221; refers to a different
                   1007:               architecture.</p>
                   1008:             </dd>
                   1009: 
                   1010:             <dt><span class="term">Precompiled/binary
                   1011:             package</span></dt>
                   1012: 
                   1013:             <dd>
                   1014:               <p>A set of binaries built with pkgsrc from a
                   1015:               distfile and stuffed together in a single <tt class=
                   1016:               "filename">.tgz</tt> file so it can be installed on
                   1017:               machines of the same machine architecture without the
                   1018:               need to recompile. Packages are usually generated in
                   1019:               <tt class="filename">/usr/pkgsrc/packages</tt>; there
                   1020:               is also an archive on <a href=
                   1021:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1022:               "_top">ftp.NetBSD.org</a>.</p>
                   1023: 
                   1024:               <p>Sometimes, this is referred to by the term
                   1025:               &#8220;<span class="quote">package</span>&#8221; too,
                   1026:               especially in the context of precompiled
                   1027:               packages.</p>
                   1028:             </dd>
                   1029: 
                   1030:             <dt><span class="term">Program</span></dt>
                   1031: 
                   1032:             <dd>
                   1033:               <p>The piece of software to be installed which will
                   1034:               be constructed from all the files in the Distfile by
                   1035:               the actions defined in the corresponding package.</p>
                   1036:             </dd>
                   1037:           </dl>
                   1038:         </div>
                   1039:       </div>
                   1040: 
                   1041:       <div class="sect1" lang="en" xml:lang="en">
                   1042:         <div class="titlepage">
                   1043:           <div>
                   1044:             <div>
                   1045:               <h2 class="title" style="clear: both"><a name=
                   1046:               "typography" id=
                   1047:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1048:             </div>
                   1049:           </div>
                   1050:         </div>
                   1051: 
                   1052:         <p>When giving examples for commands, shell prompts are
                   1053:         used to show if the command should/can be issued as root,
                   1054:         or if &#8220;<span class="quote">normal</span>&#8221; user
                   1055:         privileges are sufficient. We use a <tt class=
                   1056:         "prompt">#</tt> for root's shell prompt, and a <tt class=
                   1057:         "prompt">$</tt> for users' shell prompt, assuming they use
                   1058:         the C-shell or tcsh.</p>
                   1059:       </div>
                   1060:     </div>
                   1061: 
                   1062:     <div class="part" lang="en" xml:lang="en">
                   1063:       <div class="titlepage">
                   1064:         <div>
                   1065:           <div>
                   1066:             <h1 class="title"><a name="users-guide" id=
1.2     ! hubertf  1067:             "users-guide"></a>The pkgsrc user's guide</h1>
1.1       grant    1068:           </div>
                   1069:         </div>
                   1070:       </div>
                   1071: 
                   1072:       <div class="toc">
                   1073:         <p><b>Table of Contents</b></p>
                   1074: 
                   1075:         <dl>
                   1076:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1077:           get pkgsrc</a></span></dt>
                   1078: 
                   1079:           <dd>
                   1080:             <dl>
1.2     ! hubertf  1081:               <dt><span class="sect1"><a href="#id2495045">2.1. As
1.1       grant    1082:               tar file</a></span></dt>
                   1083: 
1.2     ! hubertf  1084:               <dt><span class="sect1"><a href="#id2495062">2.2. Via
1.1       grant    1085:               SUP</a></span></dt>
                   1086: 
1.2     ! hubertf  1087:               <dt><span class="sect1"><a href="#id2495094">2.3. Via
1.1       grant    1088:               CVS</a></span></dt>
                   1089:             </dl>
                   1090:           </dd>
                   1091: 
                   1092:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1093:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1094: 
                   1095:           <dd>
                   1096:             <dl>
1.2     ! hubertf  1097:               <dt><span class="sect1"><a href="#id2495204">3.1.
1.1       grant    1098:               Bootstrapping pkgsrc</a></span></dt>
                   1099: 
1.2     ! hubertf  1100:               <dt><span class="sect1"><a href="#id2495310">3.2.
1.1       grant    1101:               Platform specific notes</a></span></dt>
                   1102: 
                   1103:               <dd>
                   1104:                 <dl>
                   1105:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1106:                   "#id2495317">3.2.1. Darwin (Mac OS
1.1       grant    1107:                   X)</a></span></dt>
                   1108: 
                   1109:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1110:                   "#id2495616">3.2.2. FreeBSD</a></span></dt>
1.1       grant    1111: 
                   1112:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1113:                   "#id2496264">3.2.3. Interix</a></span></dt>
1.1       grant    1114: 
                   1115:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1116:                   "#id2496355">3.2.4. IRIX</a></span></dt>
1.1       grant    1117: 
                   1118:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1119:                   "#id2496472">3.2.5. OpenBSD</a></span></dt>
1.1       grant    1120: 
                   1121:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1122:                   "#id2496652">3.2.6. Solaris</a></span></dt>
1.1       grant    1123:                 </dl>
                   1124:               </dd>
                   1125:             </dl>
                   1126:           </dd>
                   1127: 
                   1128:           <dt><span class="chapter"><a href="#using">4. Using
                   1129:           pkgsrc</a></span></dt>
                   1130: 
                   1131:           <dd>
                   1132:             <dl>
                   1133:               <dt><span class="sect1"><a href=
                   1134:               "#getting-started">4.1. Working with binary
                   1135:               packages</a></span></dt>
                   1136: 
                   1137:               <dd>
                   1138:                 <dl>
                   1139:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1140:                   "#id2496857">4.1.1. Where to get binary
1.1       grant    1141:                   packages</a></span></dt>
                   1142: 
                   1143:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1144:                   "#id2496898">4.1.2. How to use binary
1.1       grant    1145:                   packages</a></span></dt>
                   1146: 
                   1147:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1148:                   "#id2497032">4.1.3. A word of
1.1       grant    1149:                   warning</a></span></dt>
                   1150:                 </dl>
                   1151:               </dd>
                   1152: 
1.2     ! hubertf  1153:               <dt><span class="sect1"><a href="#id2497044">4.2.
1.1       grant    1154:               Building packages from source</a></span></dt>
                   1155: 
                   1156:               <dd>
                   1157:                 <dl>
                   1158:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1159:                   "#id2497053">4.2.1. Requirements</a></span></dt>
1.1       grant    1160: 
                   1161:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1162:                   "#id2497142">4.2.2. Fetching
1.1       grant    1163:                   distfiles</a></span></dt>
                   1164: 
                   1165:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1166:                   "#id2497194">4.2.3. How to build and
1.1       grant    1167:                   install</a></span></dt>
                   1168: 
                   1169:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1170:                   "#id2498125">4.2.4. Selecting the
1.1       grant    1171:                   compiler</a></span></dt>
                   1172:                 </dl>
                   1173:               </dd>
                   1174:             </dl>
                   1175:           </dd>
                   1176: 
                   1177:           <dt><span class="chapter"><a href="#binary">5. Creating
                   1178:           binary packages</a></span></dt>
                   1179: 
                   1180:           <dd>
                   1181:             <dl>
1.2     ! hubertf  1182:               <dt><span class="sect1"><a href="#id2498280">5.1.
1.1       grant    1183:               Building a single binary package</a></span></dt>
                   1184: 
1.2     ! hubertf  1185:               <dt><span class="sect1"><a href="#id2563075">5.2.
1.1       grant    1186:               Settings for creation of binary
                   1187:               packages</a></span></dt>
                   1188: 
                   1189:               <dt><span class="sect1"><a href="#bulkbuild">5.3.
                   1190:               Doing a bulk build of all packages</a></span></dt>
                   1191: 
                   1192:               <dd>
                   1193:                 <dl>
                   1194:                   <dt><span class="sect2"><a href=
                   1195:                   "#binary.configuration">5.3.1.
                   1196:                   Configuration</a></span></dt>
                   1197: 
                   1198:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1199:                   "#id2563214">5.3.2. Other environmental
1.1       grant    1200:                   considerations</a></span></dt>
                   1201: 
                   1202:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1203:                   "#id2563255">5.3.3. Operation</a></span></dt>
1.1       grant    1204: 
                   1205:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1206:                   "#id2563462">5.3.4. What it does</a></span></dt>
1.1       grant    1207: 
                   1208:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1209:                   "#id2563518">5.3.5. Disk space
1.1       grant    1210:                   requirements</a></span></dt>
                   1211: 
                   1212:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1213:                   "#id2563545">5.3.6. Setting up a sandbox for
1.1       grant    1214:                   chroot'ed builds</a></span></dt>
                   1215: 
                   1216:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1217:                   "#id2563909">5.3.7. Building a partial set of
1.1       grant    1218:                   packages</a></span></dt>
                   1219:                 </dl>
                   1220:               </dd>
                   1221: 
1.2     ! hubertf  1222:               <dt><span class="sect1"><a href="#id2563952">5.4.
1.1       grant    1223:               Creating a multiple CD-ROM packages
                   1224:               collection</a></span></dt>
                   1225: 
                   1226:               <dd>
                   1227:                 <dl>
                   1228:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  1229:                   "#id2564035">5.4.1. Example of
1.1       grant    1230:                   cdpack</a></span></dt>
                   1231:                 </dl>
                   1232:               </dd>
                   1233:             </dl>
                   1234:           </dd>
                   1235: 
                   1236:           <dt><span class="chapter"><a href="#faq">6. Frequently
                   1237:           Asked Questions</a></span></dt>
                   1238: 
                   1239:           <dd>
                   1240:             <dl>
1.2     ! hubertf  1241:               <dt><span class="sect1"><a href="#id2564294">6.1. Is
1.1       grant    1242:               there a mailing list for pkg-related
                   1243:               discussion?</a></span></dt>
                   1244: 
1.2     ! hubertf  1245:               <dt><span class="sect1"><a href="#id2564324">6.2.
1.1       grant    1246:               Where's the pkgviews documentation?</a></span></dt>
                   1247: 
1.2     ! hubertf  1248:               <dt><span class="sect1"><a href="#id2564337">6.3.
1.1       grant    1249:               Utilities for package management
                   1250:               (pkgtools)</a></span></dt>
                   1251: 
1.2     ! hubertf  1252:               <dt><span class="sect1"><a href="#id2564562">6.4. How
1.1       grant    1253:               to use pkgsrc as non-root</a></span></dt>
                   1254: 
1.2     ! hubertf  1255:               <dt><span class="sect1"><a href="#id2564642">6.5. How
1.1       grant    1256:               can I install/use XFree86 from
                   1257:               pkgsrc?</a></span></dt>
                   1258: 
1.2     ! hubertf  1259:               <dt><span class="sect1"><a href="#id2564669">6.6. How
1.1       grant    1260:               can I install/use X.org from pkgsrc?</a></span></dt>
                   1261: 
1.2     ! hubertf  1262:               <dt><span class="sect1"><a href="#id2564697">6.7. How
1.1       grant    1263:               to fetch files from behind a firewall</a></span></dt>
                   1264: 
1.2     ! hubertf  1265:               <dt><span class="sect1"><a href="#id2564711">6.8. How
1.1       grant    1266:               do I tell make fetch to do passive
                   1267:               FTP?</a></span></dt>
                   1268: 
1.2     ! hubertf  1269:               <dt><span class="sect1"><a href="#id2564762">6.9. How
1.1       grant    1270:               to fetch all distfiles at once</a></span></dt>
                   1271: 
1.2     ! hubertf  1272:               <dt><span class="sect1"><a href="#id2564970">6.10.
1.1       grant    1273:               What does Don't know how to make
                   1274:               /usr/share/tmac/tmac.andoc mean?</a></span></dt>
                   1275: 
1.2     ! hubertf  1276:               <dt><span class="sect1"><a href="#id2565009">6.11.
1.1       grant    1277:               What does Could not find bsd.own.mk
                   1278:               mean?</a></span></dt>
                   1279: 
1.2     ! hubertf  1280:               <dt><span class="sect1"><a href="#id2565066">6.12.
1.1       grant    1281:               Using 'sudo' with pkgsrc</a></span></dt>
                   1282: 
                   1283:               <dt><span class="sect1"><a href="#faq.conf">6.13.
                   1284:               Configuration files handling and
                   1285:               placement</a></span></dt>
                   1286: 
                   1287:               <dt><span class="sect1"><a href=
                   1288:               "#audit-packages">6.14. Automated security
                   1289:               checks</a></span></dt>
                   1290:             </dl>
                   1291:           </dd>
                   1292:         </dl>
                   1293:       </div>
                   1294: 
                   1295:       <div class="chapter" lang="en" xml:lang="en">
                   1296:         <div class="titlepage">
                   1297:           <div>
                   1298:             <div>
                   1299:               <h2 class="title"><a name="getting" id=
                   1300:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1301:               pkgsrc</h2>
                   1302:             </div>
                   1303:           </div>
                   1304:         </div>
                   1305: 
                   1306:         <div class="toc">
                   1307:           <p><b>Table of Contents</b></p>
                   1308: 
                   1309:           <dl>
1.2     ! hubertf  1310:             <dt><span class="sect1"><a href="#id2495045">2.1. As
1.1       grant    1311:             tar file</a></span></dt>
                   1312: 
1.2     ! hubertf  1313:             <dt><span class="sect1"><a href="#id2495062">2.2. Via
1.1       grant    1314:             SUP</a></span></dt>
                   1315: 
1.2     ! hubertf  1316:             <dt><span class="sect1"><a href="#id2495094">2.3. Via
1.1       grant    1317:             CVS</a></span></dt>
                   1318:           </dl>
                   1319:         </div>
                   1320: 
                   1321:         <p>There are three ways to get pkgsrc. Either as a tar
                   1322:         file, via SUP, or via CVS. All three ways are described
                   1323:         here.</p>
                   1324: 
                   1325:         <div class="sect1" lang="en" xml:lang="en">
                   1326:           <div class="titlepage">
                   1327:             <div>
                   1328:               <div>
                   1329:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  1330:                 "id2495045" id="id2495045"></a>2.1.&nbsp;As tar
1.1       grant    1331:                 file</h2>
                   1332:               </div>
                   1333:             </div>
                   1334:           </div>
                   1335: 
                   1336:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1337:           file from <a href=
                   1338:           "ftp://ftp.NetBSD.org/pub/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.2     ! hubertf  1339:              target="_top">ftp.NetBSD.org</a> and unpack it into
        !          1340:              <tt class="filename">/usr/pkgsrc</tt>.</p>
1.1       grant    1341:         </div>
                   1342: 
                   1343:         <div class="sect1" lang="en" xml:lang="en">
                   1344:           <div class="titlepage">
                   1345:             <div>
                   1346:               <div>
                   1347:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  1348:                 "id2495062" id="id2495062"></a>2.2.&nbsp;Via
1.1       grant    1349:                 SUP</h2>
                   1350:               </div>
                   1351:             </div>
                   1352:           </div>
                   1353: 
                   1354:           <p>As an alternative to the tar file, you can get pkgsrc
                   1355:           via the Software Update Protocol, SUP. To do so, make
                   1356:           sure your supfile has a line</p>
                   1357:           <pre class="programlisting">
                   1358: release=pkgsrc
                   1359: </pre>
                   1360: 
                   1361:           <p>in it, see the examples in <tt class=
                   1362:           "filename">/usr/share/examples/supfiles</tt>, and that
                   1363:           the <tt class="filename">/usr/pkgsrc</tt> directory
                   1364:           exists. Then, simply run <span><b class="command">sup -v
                   1365:           <i class=
                   1366:           "replaceable"><tt>/path/to/your/supfile</tt></i></b></span>.</p>
                   1367:         </div>
                   1368: 
                   1369:         <div class="sect1" lang="en" xml:lang="en">
                   1370:           <div class="titlepage">
                   1371:             <div>
                   1372:               <div>
                   1373:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  1374:                 "id2495094" id="id2495094"></a>2.3.&nbsp;Via
1.1       grant    1375:                 CVS</h2>
                   1376:               </div>
                   1377:             </div>
                   1378:           </div>
                   1379: 
                   1380:           <p>To get pkgsrc via CVS, make sure you have
                   1381:           &#8220;<span class="quote">cvs</span>&#8221; installed.
                   1382:           If not present on your system, it can be found as
                   1383:           precompiled binary on ftp.NetBSD.org. To do an initial
                   1384:           (full) checkout of pkgsrc, do the following steps:</p>
                   1385:           <pre class="screen">
                   1386: <tt class="prompt">%</tt> <b class=
                   1387: "userinput"><tt>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</tt></b>
                   1388: <tt class="prompt">%</tt> <b class=
                   1389: "userinput"><tt>setenv CVS_RSH ssh</tt></b>
                   1390: <tt class="prompt">%</tt> <b class="userinput"><tt>cd /usr</tt></b>
                   1391: <tt class="prompt">%</tt> <b class=
                   1392: "userinput"><tt>cvs checkout -P pkgsrc</tt></b>
                   1393: </pre>
                   1394: 
                   1395:           <p>This will create the <tt class="filename">pkgsrc</tt>
                   1396:           directory in your <tt class="filename">/usr</tt>, and all
                   1397:           the package source will be stored under <tt class=
                   1398:           "filename">/usr/pkgsrc</tt>. To update pkgsrc after the
                   1399:           initial checkout, make sure you have <tt class=
                   1400:           "varname">CVS_RSH</tt> set as above, then do:</p>
                   1401:           <pre class="screen">
                   1402: <tt class="prompt">%</tt> <b class=
                   1403: "userinput"><tt>cd /usr/pkgsrc</tt></b>
                   1404: <tt class="prompt">%</tt> <b class=
                   1405: "userinput"><tt>cvs -q update -dP</tt></b>
                   1406: </pre>
                   1407: 
                   1408:           <p>Please also note that it is possible to have multiple
                   1409:           copies of the pkgsrc hierarchy in use at any one time -
                   1410:           all work is done relatively within the pkgsrc tree.</p>
                   1411:         </div>
                   1412:       </div>
                   1413: 
                   1414:       <div class="chapter" lang="en" xml:lang="en">
                   1415:         <div class="titlepage">
                   1416:           <div>
                   1417:             <div>
                   1418:               <h2 class="title"><a name="platforms" id=
                   1419:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1420:               systems other than NetBSD</h2>
                   1421:             </div>
                   1422:           </div>
                   1423:         </div>
                   1424: 
                   1425:         <div class="toc">
                   1426:           <p><b>Table of Contents</b></p>
                   1427: 
                   1428:           <dl>
1.2     ! hubertf  1429:             <dt><span class="sect1"><a href="#id2495204">3.1.
1.1       grant    1430:             Bootstrapping pkgsrc</a></span></dt>
                   1431: 
1.2     ! hubertf  1432:             <dt><span class="sect1"><a href="#id2495310">3.2.
1.1       grant    1433:             Platform specific notes</a></span></dt>
                   1434: 
                   1435:             <dd>
                   1436:               <dl>
1.2     ! hubertf  1437:                 <dt><span class="sect2"><a href="#id2495317">3.2.1.
1.1       grant    1438:                 Darwin (Mac OS X)</a></span></dt>
                   1439: 
1.2     ! hubertf  1440:                 <dt><span class="sect2"><a href="#id2495616">3.2.2.
1.1       grant    1441:                 FreeBSD</a></span></dt>
                   1442: 
1.2     ! hubertf  1443:                 <dt><span class="sect2"><a href="#id2496264">3.2.3.
1.1       grant    1444:                 Interix</a></span></dt>
                   1445: 
1.2     ! hubertf  1446:                 <dt><span class="sect2"><a href="#id2496355">3.2.4.
1.1       grant    1447:                 IRIX</a></span></dt>
                   1448: 
1.2     ! hubertf  1449:                 <dt><span class="sect2"><a href="#id2496472">3.2.5.
1.1       grant    1450:                 OpenBSD</a></span></dt>
                   1451: 
1.2     ! hubertf  1452:                 <dt><span class="sect2"><a href="#id2496652">3.2.6.
1.1       grant    1453:                 Solaris</a></span></dt>
                   1454:               </dl>
                   1455:             </dd>
                   1456:           </dl>
                   1457:         </div>
                   1458: 
                   1459:         <div class="sect1" lang="en" xml:lang="en">
                   1460:           <div class="titlepage">
                   1461:             <div>
                   1462:               <div>
                   1463:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  1464:                 "id2495204" id=
        !          1465:                 "id2495204"></a>3.1.&nbsp;Bootstrapping pkgsrc</h2>
1.1       grant    1466:               </div>
                   1467:             </div>
                   1468:           </div>
                   1469: 
                   1470:           <p>For Operating Systems other than NetBSD, we provide a
                   1471:           bootstrap kit to build the required tools to use pkgsrc
                   1472:           on your platform. Besides support for native NetBSD,
                   1473:           pkgsrc and the bootstrap kit have support for the
                   1474:           following operating systems:</p>
                   1475: 
                   1476:           <div class="itemizedlist">
                   1477:             <ul type="disc">
                   1478:               <li>
                   1479:                 <p>Darwin (Mac OS X)</p>
                   1480:               </li>
                   1481: 
                   1482:               <li>
                   1483:                 <p>FreeBSD</p>
                   1484:               </li>
                   1485: 
                   1486:               <li>
                   1487:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1488:               </li>
                   1489: 
                   1490:               <li>
                   1491:                 <p>IRIX</p>
                   1492:               </li>
                   1493: 
                   1494:               <li>
                   1495:                 <p>Linux</p>
                   1496:               </li>
                   1497: 
                   1498:               <li>
                   1499:                 <p>OpenBSD</p>
                   1500:               </li>
                   1501: 
                   1502:               <li>
                   1503:                 <p>Solaris</p>
                   1504:               </li>
                   1505:             </ul>
                   1506:           </div>
                   1507: 
                   1508:           <p>Support for other platforms is under development.</p>
                   1509: 
                   1510:           <p>Installing the bootstrap kit should be as simple
                   1511:           as:</p>
                   1512:           <pre class="screen">
                   1513: <tt class="prompt">#</tt> <b class=
                   1514: "userinput"><tt>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</tt></b>
                   1515: <tt class="prompt">#</tt> <b class=
                   1516: "userinput"><tt>cd pkgsrc/bootstrap</tt></b>
                   1517: <tt class="prompt">#</tt> <b class=
                   1518: "userinput"><tt>./bootstrap</tt></b>
                   1519: </pre>
                   1520: 
                   1521:           <p>See <a href="#getting" title=
                   1522:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter 2,
                   1523:           <i>Where to get pkgsrc</i></a> for other ways to get
                   1524:           pkgsrc before bootstrapping. The given <span><b class=
                   1525:           "command">bootstrap</b></span> command will use the
                   1526:           defaults of <tt class="filename">/usr/pkg</tt> for the
                   1527:           <span class="emphasis"><em>prefix</em></span> where
                   1528:           programs will be installed in, and <tt class=
                   1529:           "filename">/var/db/pkg</tt> for the package database
                   1530:           directory where pkgsrc will do it's internal bookkeeping.
                   1531:           However, these can also be set using command-line
                   1532:           parameters.</p>
                   1533: 
                   1534:           <p>Binary packages for the pkgsrc tools and an initial
                   1535:           set of packages is available for supported platforms. An
                   1536:           up-to-date list of these can be found on <a href=
                   1537:           "http://www.pkgsrc.org/" target=
                   1538:           "_top">www.pkgsrc.org</a>.</p>
                   1539:         </div>
                   1540: 
                   1541:         <div class="sect1" lang="en" xml:lang="en">
                   1542:           <div class="titlepage">
                   1543:             <div>
                   1544:               <div>
                   1545:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  1546:                 "id2495310" id="id2495310"></a>3.2.&nbsp;Platform
1.1       grant    1547:                 specific notes</h2>
                   1548:               </div>
                   1549:             </div>
                   1550:           </div>
                   1551: 
                   1552:           <p>Here are some platform-specific notes you should be
                   1553:           aware of.</p>
                   1554: 
                   1555:           <div class="sect2" lang="en" xml:lang="en">
                   1556:             <div class="titlepage">
                   1557:               <div>
                   1558:                 <div>
1.2     ! hubertf  1559:                   <h3 class="title"><a name="id2495317" id=
        !          1560:                   "id2495317"></a>3.2.1.&nbsp;Darwin (Mac OS
1.1       grant    1561:                   X)</h3>
                   1562:                 </div>
                   1563:               </div>
                   1564:             </div>
                   1565: 
                   1566:             <p>Darwin 5.x and 6.x are supported. There are two
                   1567:             methods of using pkgsrc on Mac OS X, by using a
                   1568:             <a href="#platform.osx-image" title=
                   1569:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1570:             <a href="#platform.osx-ufs" title=
                   1571:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1572:             partition</a>.</p>
                   1573: 
                   1574:             <p>Before you start, you will need to download and
                   1575:             install the Mac OS X Developer Tools from Apple's
                   1576:             Developer Connection. See <a href=
                   1577:             "http://developer.apple.com/macosx/" target=
                   1578:             "_top">http://developer.apple.com/macosx/</a> for
                   1579:             details. Also, make sure you install X11 for Mac OS X
                   1580:             and the X11 SDK from <a href=
                   1581:             "http://www.apple.com/macosx/x11/download/" target=
                   1582:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1583:             you intend to build packages that use the X11 Window
                   1584:             System.</p>
                   1585: 
                   1586:             <p>If you already have a UFS partition, or have a spare
                   1587:             partition that you can format as UFS, it is recommended
                   1588:             to use that instead of the disk image. It'll be
                   1589:             somewhat faster and will mount automatically at boot
                   1590:             time, where you must manually mount a disk image.</p>
                   1591: 
                   1592:             <div class="note" style=
                   1593:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1594:               <h3 class="title">Note</h3>
                   1595: 
                   1596:               <p>You cannot use a HFS+ file system for pkgsrc,
                   1597:               because pkgsrc currently requires the filesystem to
                   1598:               be case-sensitive, and HFS+ is not.</p>
                   1599:             </div>
                   1600: 
                   1601:             <div class="sect3" lang="en" xml:lang="en">
                   1602:               <div class="titlepage">
                   1603:                 <div>
                   1604:                   <div>
                   1605:                     <h4 class="title"><a name="platform.osx-image"
                   1606:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
                   1607:                     a disk image</h4>
                   1608:                   </div>
                   1609:                 </div>
                   1610:               </div>
                   1611: 
                   1612:               <p>Create the disk image:</p>
                   1613:               <pre class="screen">
                   1614: <tt class="prompt">#</tt> <b class=
                   1615: "userinput"><tt>cd pkgsrc/bootstrap</tt></b>
                   1616: <tt class="prompt">#</tt> <b class=
                   1617: "userinput"><tt>./ufsdiskimage create ~/Documents/NetBSD 512</tt></b> # megabytes - season to taste
                   1618: <tt class="prompt">#</tt> <b class=
                   1619: "userinput"><tt>./ufsdiskimage mount ~/Documents/NetBSD</tt></b>
                   1620: <tt class="prompt">#</tt> <b class=
                   1621: "userinput"><tt>sudo chown `id -u`:`id -g` /Volumes/NetBSD</tt></b>
                   1622: </pre>
                   1623: 
                   1624:               <p>That's it!</p>
                   1625:             </div>
                   1626: 
                   1627:             <div class="sect3" lang="en" xml:lang="en">
                   1628:               <div class="titlepage">
                   1629:                 <div>
                   1630:                   <div>
                   1631:                     <h4 class="title"><a name="platform.osx-ufs"
                   1632:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
                   1633:                     UFS partition</h4>
                   1634:                   </div>
                   1635:                 </div>
                   1636:               </div>
                   1637: 
                   1638:               <p>By default, <tt class="filename">/usr</tt> will be
                   1639:               on your root file system, normally HFS+. It is
                   1640:               possible to use the default <span class=
                   1641:               "emphasis"><em>prefix</em></span> of <tt class=
                   1642:               "filename">/usr/pkg</tt> by symlinking <tt class=
                   1643:               "filename">/usr/pkg</tt> to a directory on a UFS file
                   1644:               system. Obviously, another symlink is required if you
                   1645:               want to place the package database directory outside
                   1646:               the <span class="emphasis"><em>prefix</em></span>.
                   1647:               e.g.</p>
                   1648:               <pre class="screen">
                   1649: <tt class="prompt">#</tt> <b class=
                   1650: "userinput"><tt>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</tt></b>
                   1651: </pre>
                   1652: 
                   1653:               <p>If you created your partitions at the time of
                   1654:               installing Mac OS X and formatted the target
                   1655:               partition as UFS, it should automatically mount on
                   1656:               <tt class="filename">/Volumes/&lt;volume
                   1657:               name&gt;</tt> when the machine boots. If you are
                   1658:               (re)formatting a partition as UFS, you need to ensure
                   1659:               that the partition map correctly reflects
                   1660:               &#8220;<span class="quote">Apple_UFS</span>&#8221;
                   1661:               and not &#8220;<span class=
                   1662:               "quote">Apple_HFS</span>&#8221;.</p>
                   1663: 
                   1664:               <p>The problem is that none of the disk tools will
                   1665:               let you touch a disk that is booted from. You can
                   1666:               unmount the partition, but even if you newfs it, the
                   1667:               partition type will be incorrect and the automounter
                   1668:               won't mount it. It can be mounted manually, but it
                   1669:               won't appear in Finder.</p>
                   1670: 
                   1671:               <p>You'll need to boot off of the OS X Installation
                   1672:               (User) CD. When the Installation program starts, go
                   1673:               up to the menu and select Disk Utility. Now, you will
                   1674:               be able to select the partition you want to be UFS,
                   1675:               and Format it Apple UFS. Quit the Disk Utility, quit
                   1676:               the installer which will reboot your machine. The new
                   1677:               UFS file system will appear in Finder.</p>
                   1678: 
                   1679:               <p>Be aware that the permissions on the new file
                   1680:               system will be writable by root only.</p>
                   1681: 
                   1682:               <p>This note is as of 10.2 (Jaguar) and applies to
                   1683:               earlier versions. Hopefully Apple will fix Disk
                   1684:               Utility in 10.3 (Panther).</p>
                   1685:             </div>
                   1686:           </div>
                   1687: 
                   1688:           <div class="sect2" lang="en" xml:lang="en">
                   1689:             <div class="titlepage">
                   1690:               <div>
                   1691:                 <div>
1.2     ! hubertf  1692:                   <h3 class="title"><a name="id2495616" id=
        !          1693:                   "id2495616"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    1694:                 </div>
                   1695:               </div>
                   1696:             </div>
                   1697: 
                   1698:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   1699:             supported, other versions may work.</p>
                   1700: 
                   1701:             <p>Care should be taken so that the tools that this kit
                   1702:             installs do not conflict with the FreeBSD userland
                   1703:             tools. There are several steps:</p>
                   1704: 
                   1705:             <div class="orderedlist">
                   1706:               <ol type="1">
                   1707:                 <li>
                   1708:                   <p>FreeBSD stores its ports pkg database in
                   1709:                   <tt class="filename">/var/db/pkg</tt>. It is
                   1710:                   therefore recommended that you choose a different
                   1711:                   location (e.g. <tt class=
                   1712:                   "filename">/usr/pkgdb</tt>) by using the
                   1713:                   --pkgdbdir option to the bootstrap script.</p>
                   1714:                 </li>
                   1715: 
                   1716:                 <li>
                   1717:                   <p>If you do not intend to use the FreeBSD ports
                   1718:                   tools, it's probably a good idea to move them out
                   1719:                   of the way to avoid confusion, e.g.</p>
                   1720:                   <pre class="screen">
                   1721: <tt class="prompt">#</tt> <b class=
                   1722: "userinput"><tt>cd /usr/sbin</tt></b>
                   1723: <tt class="prompt">#</tt> <b class=
                   1724: "userinput"><tt>mv pkg_add pkg_add.orig</tt></b>
                   1725: <tt class="prompt">#</tt> <b class=
                   1726: "userinput"><tt>mv pkg_create pkg_create.orig</tt></b>
                   1727: <tt class="prompt">#</tt> <b class=
                   1728: "userinput"><tt>mv pkg_delete pkg_delete.orig</tt></b>
                   1729: <tt class="prompt">#</tt> <b class=
                   1730: "userinput"><tt>mv pkg_info pkg_info.orig</tt></b>
                   1731: </pre>
                   1732:                 </li>
                   1733: 
                   1734:                 <li>
                   1735:                   <p>An example <tt class=
                   1736:                   "filename">/etc/mk.conf</tt> file will be placed
                   1737:                   in <tt class="filename">/etc/mk.conf.example</tt>
                   1738:                   file when you use the bootstrap script.</p>
                   1739:                 </li>
                   1740:               </ol>
                   1741:             </div>
                   1742:           </div>
                   1743: 
                   1744:           <div class="sect2" lang="en" xml:lang="en">
                   1745:             <div class="titlepage">
                   1746:               <div>
                   1747:                 <div>
1.2     ! hubertf  1748:                   <h3 class="title"><a name="id2496264" id=
        !          1749:                   "id2496264"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    1750:                 </div>
                   1751:               </div>
                   1752:             </div>
                   1753: 
                   1754:             <p>Interix is a POSIX compatible subsystem for the
                   1755:             Windows NT kernel, providing a Unix-like environment
                   1756:             with a tighter kernel integration than available with
                   1757:             Cygwin. It is part of the Windows Services for Unix
                   1758:             package, available for free for any licensed copy of
                   1759:             Windows 2000, XP, or 2003. SFU can be downloaded from
                   1760:             <a href="http://www.microsoft.com/windows/sfu/" target=
                   1761:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   1762: 
                   1763:             <p>Services for Unix 3.5, current as of this writing,
                   1764:             has been tested. 3.0 or 3.1 may work, but are not
                   1765:             officially supported. (The main difference in 3.0/3.1
                   1766:             is lack of pthreads.)</p>
                   1767: 
                   1768:             <div class="sect3" lang="en" xml:lang="en">
                   1769:               <div class="titlepage">
                   1770:                 <div>
                   1771:                   <div>
                   1772:                     <h4 class="title"><a name=
                   1773:                     "platform.interix-sfu-install" id=
                   1774:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2     ! hubertf  1775:                     installing Interix/SFU</h4>
1.1       grant    1776:                   </div>
                   1777:                 </div>
                   1778:               </div>
                   1779: 
                   1780:               <p>At an absolute minimum, the following packages
                   1781:               must be installed from the Windows Services for Unix
                   1782:               3.5 distribution in order to use pkgsrc:</p>
                   1783: 
                   1784:               <div class="itemizedlist">
                   1785:                 <ul type="disc">
                   1786:                   <li>
                   1787:                     <p>Utilities -&gt; Base Utilities</p>
                   1788:                   </li>
                   1789: 
                   1790:                   <li>
                   1791:                     <p>Interix GNU Components -&gt; (all)</p>
                   1792:                   </li>
                   1793: 
                   1794:                   <li>
                   1795:                     <p>Remote Connectivity</p>
                   1796:                   </li>
                   1797: 
                   1798:                   <li>
                   1799:                     <p>Interix SDK</p>
                   1800:                   </li>
                   1801:                 </ul>
                   1802:               </div>
                   1803: 
                   1804:               <p>When using pkgsrc on Interix, DO NOT install the
                   1805:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   1806:               without shared module support, installed to
                   1807:               /usr/local, and will only cause confusion. Instead,
                   1808:               install Perl 5.8 from pkgsrc (or from a binary
                   1809:               package).</p>
                   1810: 
                   1811:               <p>The Remote Connectivity subcomponent "Windows
                   1812:               Remote Shell Service" does not need to be installed,
                   1813:               but Remote Connectivity itself should be installed in
                   1814:               order to have a working inetd.</p>
                   1815: 
                   1816:               <p>Finally, during installation you may be asked
                   1817:               whether to enable setuid behavior for Interix
                   1818:               programs, and whether to make pathnames default to
                   1819:               case-sensitive. Setuid should be enabled, and
                   1820:               case-sensitivity MUST be enabled. (Without
                   1821:               case-sensitivity, a large number of packages
                   1822:               including perl will not build.)</p>
                   1823:             </div>
                   1824: 
                   1825:             <div class="sect3" lang="en" xml:lang="en">
                   1826:               <div class="titlepage">
                   1827:                 <div>
                   1828:                   <div>
                   1829:                     <h4 class="title"><a name=
                   1830:                     "platform.interix-sfu-postinstall" id=
                   1831:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   1832:                     to do if Interix/SFU is already installed</h4>
                   1833:                   </div>
                   1834:                 </div>
                   1835:               </div>
                   1836: 
                   1837:               <p>If SFU is already installed and you wish to alter
                   1838:               these settings to work with pkgsrc, note the
                   1839:               following things.</p>
                   1840: 
                   1841:               <div class="itemizedlist">
                   1842:                 <ul type="disc">
                   1843:                   <li>
                   1844:                     <p>To uninstall UNIX Perl, use Add/Remove
                   1845:                     Programs, select Microsoft Windows Services for
                   1846:                     UNIX, then click Change. In the installer,
                   1847:                     choose Add or Remove, then uncheck
                   1848:                     Utilities-&gt;UNIX Perl.</p>
                   1849:                   </li>
                   1850: 
                   1851:                   <li>
                   1852:                     <p>To enable case-sensitivity for the
                   1853:                     filesystem, run REGEDIT.EXE, and change the
                   1854:                     following registry key:</p>
                   1855: 
                   1856:                     <p>
                   1857:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   1858:                     Manager\kernel</p>
                   1859: 
                   1860:                     <p>Set the DWORD value "obcaseinsensitive" to
                   1861:                     0; then reboot.</p>
                   1862:                   </li>
                   1863: 
                   1864:                   <li>
                   1865:                     <p>To enable setuid binaries (optional), run
                   1866:                     REGEDIT.EXE, and change the following registry
                   1867:                     key:</p>
                   1868: 
                   1869:                     <p>
                   1870:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   1871:                     for UNIX</p>
                   1872: 
                   1873:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   1874:                     to 1; then reboot.</p>
                   1875:                   </li>
                   1876:                 </ul>
                   1877:               </div>
                   1878:             </div>
                   1879: 
                   1880:             <div class="sect3" lang="en" xml:lang="en">
                   1881:               <div class="titlepage">
                   1882:                 <div>
                   1883:                   <div>
                   1884:                     <h4 class="title"><a name=
                   1885:                     "platform.interix-notes" id=
                   1886:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   1887:                     notes for using pkgsrc</h4>
                   1888:                   </div>
                   1889:                 </div>
                   1890:               </div>
                   1891: 
                   1892:               <p>The package imanager (either the pkgsrc "su" user,
                   1893:               or the user running "pkg_add") must be a member of
                   1894:               the local Administrators group. Such a user must also
                   1895:               be used to run the bootstrap. This is slightly
                   1896:               relaxed from the normal pkgsrc requirement of
                   1897:               "root".</p>
                   1898: 
                   1899:               <p>The package manager should use a umask of 002.
                   1900:               "make install" will automatically complain if this is
                   1901:               not the case. This ensures that directories written
                   1902:               in /var/db/pkg are Administrators-group
                   1903:               writeable.</p>
                   1904: 
                   1905:               <p>The popular Interix binary packages from
                   1906:               http://www.interopsystems.com/ use an older version
                   1907:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   1908:               used in conjunction with pkgsrc. If you choose to use
                   1909:               them at the same time as the pkgsrc packages, ensure
                   1910:               that you use the proper pkg_* tools for each type of
                   1911:               binary package.</p>
                   1912:             </div>
                   1913:           </div>
                   1914: 
                   1915:           <div class="sect2" lang="en" xml:lang="en">
                   1916:             <div class="titlepage">
                   1917:               <div>
                   1918:                 <div>
1.2     ! hubertf  1919:                   <h3 class="title"><a name="id2496355" id=
        !          1920:                   "id2496355"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    1921:                 </div>
                   1922:               </div>
                   1923:             </div>
                   1924: 
                   1925:             <p>You will need a working C compiler, either gcc or
                   1926:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
                   1927:             the <tt class="varname">CC</tt> environment variable
                   1928:             according to your preference. If you do not have a
                   1929:             license for the MIPSpro compiler suite, you can
                   1930:             download a gcc tardist file from <a href=
                   1931:             "http://freeware.sgi.com/" target=
                   1932:             "_top">http://freeware.sgi.com/</a>.</p>
                   1933: 
                   1934:             <p>Please note that you will need IRIX 6.5.17 or
                   1935:             higher, as this is the earliest version of IRIX
                   1936:             providing support for if_indextoname(3),
                   1937:             if_nametoindex(3), etc.</p>
                   1938: 
                   1939:             <p>At this point in time, pkgsrc only supports one ABI.
                   1940:             That is, you can not switch between the old 32-bit ABI,
                   1941:             the new 32-bit ABI and the 64-bit ABI. If you start out
                   1942:             using "abi=n32", that's what all your packages will be
                   1943:             built with.</p>
                   1944: 
                   1945:             <p>Therefore, please make sure that you have no
                   1946:             conflicting <tt class="varname">CFLAGS</tt> in your
                   1947:             environment or the <tt class=
                   1948:             "filename">/etc/mk.conf</tt>. Particularly, make sure
                   1949:             that you do not try to link n32 object files with lib64
                   1950:             or vice versa. Check your <tt class=
                   1951:             "filename">/etc/compiler.defaults</tt>!</p>
                   1952: 
                   1953:             <p>If you have the actual pkgsrc tree mounted via NFS
                   1954:             from a different host, please make sure to set
                   1955:             <tt class="varname">WRKOBJDIR</tt> to a local
                   1956:             directory, as it appears that IRIX linker occasionally
                   1957:             runs into issues when trying to link over a network
                   1958:             mounted filesystem.</p>
                   1959: 
                   1960:             <p>The bootstrapping process should set all the right
                   1961:             options for programs such as imake(1), but you may want
                   1962:             to set some options depending on your local setup.
                   1963:             Please see <tt class=
                   1964:             "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt> and, of
                   1965:             course, your compilers man pages for details.</p>
                   1966:           </div>
                   1967: 
                   1968:           <div class="sect2" lang="en" xml:lang="en">
                   1969:             <div class="titlepage">
                   1970:               <div>
                   1971:                 <div>
1.2     ! hubertf  1972:                   <h3 class="title"><a name="id2496472" id=
        !          1973:                   "id2496472"></a>3.2.5.&nbsp;OpenBSD</h3>
1.1       grant    1974:                 </div>
                   1975:               </div>
                   1976:             </div>
                   1977: 
                   1978:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   1979: 
                   1980:             <p>Care should be taken so that the tools that this kit
                   1981:             installs do not conflict with the OpenBSD userland
                   1982:             tools. There are several steps:</p>
                   1983: 
                   1984:             <div class="orderedlist">
                   1985:               <ol type="1">
                   1986:                 <li>
                   1987:                   <p>OpenBSD stores its ports pkg database in
                   1988:                   <tt class="filename">/var/db/pkg</tt>. It is
                   1989:                   therefore recommended that you choose a different
                   1990:                   location (e.g. <tt class=
                   1991:                   "filename">/usr/pkgdb</tt>) by using the
                   1992:                   --pkgdbdir option to the bootstrap script.</p>
                   1993:                 </li>
                   1994: 
                   1995:                 <li>
                   1996:                   <p>If you do not intend to use the OpenBSD ports
                   1997:                   tools, it's probably a good idea to move them out
                   1998:                   of the way to avoid confusion, e.g.</p>
                   1999:                   <pre class="screen">
                   2000: <tt class="prompt">#</tt> <b class=
                   2001: "userinput"><tt>cd /usr/sbin</tt></b>
                   2002: <tt class="prompt">#</tt> <b class=
                   2003: "userinput"><tt>mv pkg_add pkg_add.orig</tt></b>
                   2004: <tt class="prompt">#</tt> <b class=
                   2005: "userinput"><tt>mv pkg_create pkg_create.orig</tt></b>
                   2006: <tt class="prompt">#</tt> <b class=
                   2007: "userinput"><tt>mv pkg_delete pkg_delete.orig</tt></b>
                   2008: <tt class="prompt">#</tt> <b class=
                   2009: "userinput"><tt>mv pkg_info pkg_info.orig</tt></b>
                   2010: </pre>
                   2011:                 </li>
                   2012: 
                   2013:                 <li>
                   2014:                   <p>An example <tt class=
                   2015:                   "filename">/etc/mk.conf</tt> file will be placed
                   2016:                   in <tt class="filename">/etc/mk.conf.example</tt>
                   2017:                   file when you use the bootstrap script. OpenBSD's
                   2018:                   make program uses <tt class=
                   2019:                   "filename">/etc/mk.conf</tt> as well. You can
                   2020:                   work around this by enclosing all the pkgsrc
                   2021:                   specific parts of the file with:</p>
                   2022:                   <pre class="programlisting">
                   2023: .ifdef BSD_PKG_MK
                   2024: # pkgsrc stuff, e.g. insert bsd.pkg.defaults.mk or similar here
                   2025: .else
                   2026: # OpenBSD stuff
                   2027: .endif
                   2028: </pre>
                   2029:                 </li>
                   2030:               </ol>
                   2031:             </div>
                   2032:           </div>
                   2033: 
                   2034:           <div class="sect2" lang="en" xml:lang="en">
                   2035:             <div class="titlepage">
                   2036:               <div>
                   2037:                 <div>
1.2     ! hubertf  2038:                   <h3 class="title"><a name="id2496652" id=
        !          2039:                   "id2496652"></a>3.2.6.&nbsp;Solaris</h3>
1.1       grant    2040:                 </div>
                   2041:               </div>
                   2042:             </div>
                   2043: 
                   2044:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2045:             sparc. You will need a working C compiler. Both gcc
                   2046:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2047: 
                   2048:             <p>The following packages are required on Solaris 8 for
                   2049:             the bootstrap process and to build packages.</p>
                   2050: 
                   2051:             <div class="itemizedlist">
                   2052:               <ul type="disc">
                   2053:                 <li>
                   2054:                   <p>SUNWsprot</p>
                   2055:                 </li>
                   2056: 
                   2057:                 <li>
                   2058:                   <p>SUNWarc</p>
                   2059:                 </li>
                   2060: 
                   2061:                 <li>
                   2062:                   <p>SUNWbtool</p>
                   2063:                 </li>
                   2064: 
                   2065:                 <li>
                   2066:                   <p>SUNWtoo</p>
                   2067:                 </li>
                   2068: 
                   2069:                 <li>
                   2070:                   <p>SUNWlibm</p>
                   2071:                 </li>
                   2072:               </ul>
                   2073:             </div>
                   2074: 
                   2075:             <p>Please note the use of GNU binutils on Solaris is
                   2076:             <span class="emphasis"><em>not</em></span>
                   2077:             supported.</p>
                   2078: 
                   2079:             <div class="sect3" lang="en" xml:lang="en">
                   2080:               <div class="titlepage">
                   2081:                 <div>
                   2082:                   <div>
1.2     ! hubertf  2083:                     <h4 class="title"><a name="id2496683" id=
        !          2084:                     "id2496683"></a>3.2.6.1.&nbsp;If you are using
1.1       grant    2085:                     gcc</h4>
                   2086:                   </div>
                   2087:                 </div>
                   2088:               </div>
                   2089: 
                   2090:               <p>It makes life much simpler if you only use the
                   2091:               same gcc consistently for building all packages.</p>
                   2092: 
                   2093:               <p>It is recommended that an external gcc be used
                   2094:               only for bootstrapping, then either build gcc from
                   2095:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2096:               href=
                   2097:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.2     ! hubertf  2098:                  class="pkgname">lang/gcc</a> or install a binary
        !          2099:                  gcc package, then remove gcc used during
        !          2100:                  bootstrapping.</p>
1.1       grant    2101: 
                   2102:               <p>Binary packages of gcc can be found through
                   2103:               <a href=
                   2104:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.2     ! hubertf  2105:                  target=
        !          2106:                  "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2107:             </div>
                   2108: 
                   2109:             <div class="sect3" lang="en" xml:lang="en">
                   2110:               <div class="titlepage">
                   2111:                 <div>
                   2112:                   <div>
1.2     ! hubertf  2113:                     <h4 class="title"><a name="id2496705" id=
        !          2114:                     "id2496705"></a>3.2.6.2.&nbsp;If you are using
1.1       grant    2115:                     Sun WorkShop</h4>
                   2116:                   </div>
                   2117:                 </div>
                   2118:               </div>
                   2119: 
                   2120:               <p>You will need at least the following packages
                   2121:               installed (from WorkShop 5.0)</p>
                   2122: 
                   2123:               <div class="itemizedlist">
                   2124:                 <ul type="disc">
                   2125:                   <li>
                   2126:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2127:                   </li>
                   2128: 
                   2129:                   <li>
                   2130:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2131:                   </li>
                   2132: 
                   2133:                   <li>
                   2134:                     <p>SPROild - Sun WorkShop Incremental
                   2135:                     Linker</p>
                   2136:                   </li>
                   2137: 
                   2138:                   <li>
                   2139:                     <p>SPROlang - Sun WorkShop Compilers common
                   2140:                     components</p>
                   2141:                   </li>
                   2142:                 </ul>
                   2143:               </div>
                   2144: 
                   2145:               <p>You should set <tt class="varname">CC</tt>,
                   2146:               <tt class="varname">CXX</tt> and optionally,
                   2147:               <tt class="varname">CPP</tt> in <tt class=
                   2148:               "filename">/etc/mk.conf</tt>, eg.</p>
                   2149:               <pre class="programlisting">
                   2150: CC=        cc
                   2151: CXX=    CC
                   2152: CPP=    /usr/ccs/lib/cpp
                   2153: </pre>
                   2154: 
                   2155:               <p>You may also want to build 64-bit binaries,
                   2156:               eg.</p>
                   2157:               <pre class="programlisting">
                   2158: CFLAGS= -xtarget=ultra -xarch=v9
                   2159: </pre>
                   2160: 
                   2161:               <p>Whichever compiler you use, please ensure the
                   2162:               compiler tools and your $prefix are in your
                   2163:               <tt class="varname">PATH</tt>. This includes
                   2164:               <tt class="filename">/usr/ccs/{bin,lib}</tt> and eg.
                   2165:               <tt class="filename">/usr/pkg/{bin,sbin}</tt>.</p>
                   2166:             </div>
                   2167:           </div>
                   2168:         </div>
                   2169:       </div>
                   2170: 
                   2171:       <div class="chapter" lang="en" xml:lang="en">
                   2172:         <div class="titlepage">
                   2173:           <div>
                   2174:             <div>
                   2175:               <h2 class="title"><a name="using" id=
                   2176:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2177:             </div>
                   2178:           </div>
                   2179:         </div>
                   2180: 
                   2181:         <div class="toc">
                   2182:           <p><b>Table of Contents</b></p>
                   2183: 
                   2184:           <dl>
                   2185:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2186:             Working with binary packages</a></span></dt>
                   2187: 
                   2188:             <dd>
                   2189:               <dl>
1.2     ! hubertf  2190:                 <dt><span class="sect2"><a href="#id2496857">4.1.1.
1.1       grant    2191:                 Where to get binary packages</a></span></dt>
                   2192: 
1.2     ! hubertf  2193:                 <dt><span class="sect2"><a href="#id2496898">4.1.2.
1.1       grant    2194:                 How to use binary packages</a></span></dt>
                   2195: 
1.2     ! hubertf  2196:                 <dt><span class="sect2"><a href="#id2497032">4.1.3.
1.1       grant    2197:                 A word of warning</a></span></dt>
                   2198:               </dl>
                   2199:             </dd>
                   2200: 
1.2     ! hubertf  2201:             <dt><span class="sect1"><a href="#id2497044">4.2.
1.1       grant    2202:             Building packages from source</a></span></dt>
                   2203: 
                   2204:             <dd>
                   2205:               <dl>
1.2     ! hubertf  2206:                 <dt><span class="sect2"><a href="#id2497053">4.2.1.
1.1       grant    2207:                 Requirements</a></span></dt>
                   2208: 
1.2     ! hubertf  2209:                 <dt><span class="sect2"><a href="#id2497142">4.2.2.
1.1       grant    2210:                 Fetching distfiles</a></span></dt>
                   2211: 
1.2     ! hubertf  2212:                 <dt><span class="sect2"><a href="#id2497194">4.2.3.
1.1       grant    2213:                 How to build and install</a></span></dt>
                   2214: 
1.2     ! hubertf  2215:                 <dt><span class="sect2"><a href="#id2498125">4.2.4.
1.1       grant    2216:                 Selecting the compiler</a></span></dt>
                   2217:               </dl>
                   2218:             </dd>
                   2219:           </dl>
                   2220:         </div>
                   2221: 
                   2222:         <div class="sect1" lang="en" xml:lang="en">
                   2223:           <div class="titlepage">
                   2224:             <div>
                   2225:               <div>
                   2226:                 <h2 class="title" style="clear: both"><a name=
                   2227:                 "getting-started" id=
                   2228:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2229:                 packages</h2>
                   2230:               </div>
                   2231:             </div>
                   2232:           </div>
                   2233: 
                   2234:           <p>This section describes how to find, retrieve and
                   2235:           install a precompiled binary package that someone else
                   2236:           already prepared for your type of machine.</p>
                   2237: 
                   2238:           <div class="sect2" lang="en" xml:lang="en">
                   2239:             <div class="titlepage">
                   2240:               <div>
                   2241:                 <div>
1.2     ! hubertf  2242:                   <h3 class="title"><a name="id2496857" id=
        !          2243:                   "id2496857"></a>4.1.1.&nbsp;Where to get binary
1.1       grant    2244:                   packages</h3>
                   2245:                 </div>
                   2246:               </div>
                   2247:             </div>
                   2248: 
                   2249:             <p>Precompiled packages are stored on ftp.NetBSD.org
                   2250:             and its mirrors in the directory <tt class=
                   2251:             "filename">/pub/NetBSD/packages</tt> for anonymous FTP
                   2252:             access. Please pick the right subdirectory there as
                   2253:             indicated by <span><b class="command">uname
                   2254:             -p</b></span>. In that directory, there is a
                   2255:             subdirectory for each category plus a subdirectory
                   2256:             <tt class="filename">All</tt> which includes the actual
                   2257:             binaries in <tt class="filename">.tgz</tt> files. The
                   2258:             category subdirectories use symbolic links to those
                   2259:             files (this is the same directory layout as in
                   2260:             <tt class="filename">/usr/pkgsrc/packages</tt>).</p>
                   2261: 
                   2262:             <p>This same directory layout applies for CDROM
                   2263:             distributions, only that the directory may be rooted
                   2264:             somewhere else, probably somewhere below <tt class=
                   2265:             "filename">/cdrom</tt>. Please consult your CDROMs
                   2266:             documentation for the exact location.</p>
                   2267:           </div>
                   2268: 
                   2269:           <div class="sect2" lang="en" xml:lang="en">
                   2270:             <div class="titlepage">
                   2271:               <div>
                   2272:                 <div>
1.2     ! hubertf  2273:                   <h3 class="title"><a name="id2496898" id=
        !          2274:                   "id2496898"></a>4.1.2.&nbsp;How to use binary
1.1       grant    2275:                   packages</h3>
                   2276:                 </div>
                   2277:               </div>
                   2278:             </div>
                   2279: 
                   2280:             <p>If you have the files on a CDROM or downloaded them
                   2281:             to your hard disk, youcan install them with the
                   2282:             following command (be sure to<span><b class=
                   2283:             "command">su</b></span> to root first):</p>
                   2284:             <pre class="screen">
                   2285: <tt class="prompt">#</tt> <b class=
                   2286: "userinput"><tt>pkg_add /path/to/package.tgz</tt></b>
                   2287: </pre>
                   2288: 
                   2289:             <p>If you have FTP access and you don't want to
                   2290:             download the packages via FTP prior to installation,
                   2291:             you can do this automatically by giving <span><b class=
                   2292:             "command">pkg_add</b></span> an FTP URL:</p>
                   2293:             <pre class="screen">
                   2294: <tt class="prompt">#</tt> <b class=
                   2295: "userinput"><tt>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/&lt;OSvers&gt;/&lt;arch&gt;/All/package.tgz</tt></b>
                   2296: </pre>
                   2297: 
                   2298:             <p>If there is any doubt, the uname utility can be used
                   2299:             to determine the &lt;OSvers&gt;, and &lt;arch&gt; by
                   2300:             running <span><b class="command">uname
                   2301:             -rp</b></span>.</p>
                   2302: 
                   2303:             <p>Also note that any prerequisite packages needed to
                   2304:             run the package in question will be installed, too,
                   2305:             assuming they are present where you install from.</p>
                   2306: 
                   2307:             <p>After you've installed packages, be sure to have
                   2308:             <tt class="filename">/usr/pkg/bin</tt> in your
                   2309:             <tt class="varname">PATH</tt> so you can actually start
                   2310:             the just installed program.</p>
                   2311:           </div>
                   2312: 
                   2313:           <div class="sect2" lang="en" xml:lang="en">
                   2314:             <div class="titlepage">
                   2315:               <div>
                   2316:                 <div>
1.2     ! hubertf  2317:                   <h3 class="title"><a name="id2497032" id=
        !          2318:                   "id2497032"></a>4.1.3.&nbsp;A word of
1.1       grant    2319:                   warning</h3>
                   2320:                 </div>
                   2321:               </div>
                   2322:             </div>
                   2323: 
                   2324:             <p>Please pay very careful attention to the warnings
                   2325:             expressed in the <a href=
                   2326:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2327:             <span class="citerefentry"><span class=
                   2328:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2329:             page about the inherent dangers of installing binary
                   2330:             packages which you did not create yourself, and the
                   2331:             security holes that can be introduced onto your system
                   2332:             by indiscriminate adding of such files.</p>
                   2333:           </div>
                   2334:         </div>
                   2335: 
                   2336:         <div class="sect1" lang="en" xml:lang="en">
                   2337:           <div class="titlepage">
                   2338:             <div>
                   2339:               <div>
                   2340:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  2341:                 "id2497044" id="id2497044"></a>4.2.&nbsp;Building
1.1       grant    2342:                 packages from source</h2>
                   2343:               </div>
                   2344:             </div>
                   2345:           </div>
                   2346: 
                   2347:           <p>This assumes that the package is already in pkgsrc. If
                   2348:           it is not, see <a href="#developers-guide" title=
1.2     ! hubertf  2349:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
        !          2350:           &#8220;The pkgsrc developer's guide&#8221;</a>.</p>
1.1       grant    2351: 
                   2352:           <div class="sect2" lang="en" xml:lang="en">
                   2353:             <div class="titlepage">
                   2354:               <div>
                   2355:                 <div>
1.2     ! hubertf  2356:                   <h3 class="title"><a name="id2497053" id=
        !          2357:                   "id2497053"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2358:                 </div>
                   2359:               </div>
                   2360:             </div>
                   2361: 
                   2362:             <p>To build packages from source on a NetBSD system the
                   2363:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2364:             &#8220;<span class="quote">text</span>&#8221;
                   2365:             distribution sets must be installed. If you want to
                   2366:             build X11 related packages the &#8220;<span class=
                   2367:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2368:             "quote">xcomp</span>&#8221; distribution sets are
                   2369:             required, too.</p>
                   2370:           </div>
                   2371: 
                   2372:           <div class="sect2" lang="en" xml:lang="en">
                   2373:             <div class="titlepage">
                   2374:               <div>
                   2375:                 <div>
1.2     ! hubertf  2376:                   <h3 class="title"><a name="id2497142" id=
        !          2377:                   "id2497142"></a>4.2.2.&nbsp;Fetching
1.1       grant    2378:                   distfiles</h3>
                   2379:                 </div>
                   2380:               </div>
                   2381:             </div>
                   2382: 
                   2383:             <p>The distfile (i.e. the unmodified source) must exist
                   2384:             on your system for the packages system to be able to
                   2385:             build it. If it does not exist, pkgsrc will use
                   2386:             <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   2387:             <span class="citerefentry"><span class=
                   2388:             "refentrytitle">ftp</span>(1)</span></a> to fetch it
                   2389:             automatically.</p>
                   2390: 
                   2391:             <p>You can overwrite some of the major distribution
                   2392:             sites to fit to sites that are close to your own. Have
                   2393:             a look at <tt class=
                   2394:             "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt> to find
                   2395:             some examples - in particular, look for the <tt class=
                   2396:             "varname">MASTER_SORT</tt>, <tt class=
                   2397:             "varname">MASTER_SORT_REGEX</tt> and <tt class=
                   2398:             "varname">INET_COUNTRY</tt> definitions. This may save
                   2399:             some of your bandwidth and time.</p>
                   2400: 
                   2401:             <p>You can change these settings either in your shell's
                   2402:             environment, or, if you want to keep the settings, by
                   2403:             editing the <tt class="filename">/etc/mk.conf</tt>
                   2404:             file, and adding the definitions there.</p>
                   2405: 
                   2406:             <p>If you don't have a permanent Internet connection
                   2407:             and you want to know which files to download,
                   2408:             <span><b class="command">make fetch-list</b></span>
                   2409:             will tell you what you'll need. Put these distfiles
                   2410:             into <tt class=
                   2411:             "filename">/usr/pkgsrc/distfiles</tt>.</p>
                   2412:           </div>
                   2413: 
                   2414:           <div class="sect2" lang="en" xml:lang="en">
                   2415:             <div class="titlepage">
                   2416:               <div>
                   2417:                 <div>
1.2     ! hubertf  2418:                   <h3 class="title"><a name="id2497194" id=
        !          2419:                   "id2497194"></a>4.2.3.&nbsp;How to build and
1.1       grant    2420:                   install</h3>
                   2421:                 </div>
                   2422:               </div>
                   2423:             </div>
                   2424: 
                   2425:             <p>Assuming that the distfile has been fetched (see
                   2426:             previous section), become root and change into the
                   2427:             relevant directory and running <span><b class=
                   2428:             "command">make</b></span>. For example, type</p>
                   2429:             <pre class="screen">
                   2430: <tt class="prompt">%</tt> <b class=
                   2431: "userinput"><tt>cd misc/figlet</tt></b>
                   2432: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
                   2433: </pre>
                   2434: 
                   2435:             <p>at the shell prompt to build the various components
                   2436:             of the package, and</p>
                   2437:             <pre class="screen">
                   2438: <tt class="prompt">#</tt> <b class=
                   2439: "userinput"><tt>make install</tt></b>
                   2440: </pre>
                   2441: 
                   2442:             <p>to install the various components into the correct
                   2443:             places on your system. Installing the package on your
                   2444:             system requires you to be root. However, pkgsrc has a
                   2445:             <span class="emphasis"><em>just-in-time-su</em></span>
                   2446:             feature, which allows you to only become root for the
                   2447:             actual installation step</p>
                   2448: 
                   2449:             <p>Taking the figlet utility as an example, we can
                   2450:             install it on our system by building as shown in
                   2451:             <a href="#logs" title=
                   2452:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
                   2453:             logs</i></a>.</p>
                   2454: 
                   2455:             <p>The program is installed under the default root of
                   2456:             the packages tree - <tt class="filename">/usr/pkg</tt>.
                   2457:             Should this not conform to your tastes, set the
                   2458:             <tt class="varname">LOCALBASE</tt> variable in your
                   2459:             environment, and it will use that value as the root of
                   2460:             your packages tree. So, to use <tt class=
                   2461:             "filename">/usr/local</tt>, set <tt class=
                   2462:             "varname">LOCALBASE=/usr/local</tt> in your
                   2463:             environment. Please note that you should use a
                   2464:             directory which is dedicated to packages and not shared
                   2465:             with other programs (ie, do not try and use <tt class=
                   2466:             "varname">LOCALBASE=/usr</tt>). Also, you should not
                   2467:             try to add any of your own files or directories (such
                   2468:             as <tt class="filename">src/</tt>, <tt class=
                   2469:             "filename">obj/</tt>, or <tt class=
                   2470:             "filename">pkgsrc/</tt>) below the <tt class=
                   2471:             "varname">LOCALBASE</tt> tree. This is to prevent
                   2472:             possible conflicts between programs and other files
                   2473:             installed by the package system and whatever else may
                   2474:             have been installed there.</p>
                   2475: 
                   2476:             <p>Some packages look in <tt class=
                   2477:             "filename">/etc/mk.conf</tt> to alter some
                   2478:             configuration options at build time. Have a look at
                   2479:             <tt class="filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt>
                   2480:             to get an overview of what will be set there by
                   2481:             default. Environment variables such as <tt class=
                   2482:             "varname">LOCALBASE</tt> can be set in <tt class=
                   2483:             "filename">/etc/mk.conf</tt> to save having to remember
                   2484:             to set them each time you want to use pkgsrc.</p>
                   2485: 
                   2486:             <p>Occasionally, people want to &#8220;<span class=
                   2487:             "quote">look under the covers</span>&#8221; to see what
                   2488:             is going on when a package is building or being
                   2489:             installed. This may be for debugging purposes, or out
                   2490:             of simple curiosity. A number of utility values have
                   2491:             been added to help with this.</p>
                   2492: 
                   2493:             <div class="orderedlist">
                   2494:               <ol type="1">
                   2495:                 <li>
                   2496:                   <p>If you invoke the <a href=
                   2497:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2498:                   <span class="citerefentry"><span class=
                   2499:                   "refentrytitle">make</span>(1)</span></a> command
                   2500:                   with <tt class="varname">PKG_DEBUG_LEVEL=2</tt>,
                   2501:                   then a huge amount of information will be
                   2502:                   displayed. For example,</p>
                   2503:                   <pre class="screen">
                   2504: <b class="userinput"><tt>make patch PKG_DEBUG_LEVEL=2</tt></b>
                   2505: </pre>
                   2506: 
                   2507:                   <p>will show all the commands that are invoked,
                   2508:                   up to and including the &#8220;<span class=
                   2509:                   "quote">patch</span>&#8221; stage.</p>
                   2510:                 </li>
                   2511: 
                   2512:                 <li>
                   2513:                   <p>If you want to know the value of a certain
                   2514:                   make(1) definition, then the <tt class=
                   2515:                   "varname">VARNAME</tt> definition should be used,
                   2516:                   in conjunction with the show-var target. e.g. to
                   2517:                   show the expansion of the <a href=
                   2518:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2519:                   <span class="citerefentry"><span class=
                   2520:                   "refentrytitle">make</span>(1)</span></a>
                   2521:                   variable <tt class="varname">DISTFILES</tt>:</p>
                   2522:                   <pre class="screen">
                   2523: <tt class="prompt">%</tt> <b class=
                   2524: "userinput"><tt>make show-var VARNAME=LOCALBASE</tt></b>
                   2525: /usr/pkg
                   2526: <tt class="prompt">%</tt>
                   2527:           
                   2528: </pre>
                   2529:                 </li>
                   2530:               </ol>
                   2531:             </div>
                   2532: 
                   2533:             <p>If you want to install a binary package that you've
                   2534:             either created yourself (see next section), that you
                   2535:             put into pkgsrc/packages manually or that is located on
                   2536:             a remote FTP server, you can use the the "bin-install"
                   2537:             target. This target will install a binary package - if
                   2538:             available - via <a href=
                   2539:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2540:             <span class="citerefentry"><span class=
                   2541:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
                   2542:             <span><b class="command">make package</b></span>. The
                   2543:             list of remote FTP sites searched is kept in the
                   2544:             variable <tt class="varname">BINPKG_SITE</tt>, which
                   2545:             defaults to ftp.NetBSD.org. Any flags that should be
                   2546:             added to <a href=
                   2547:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2548:             <span class="citerefentry"><span class=
                   2549:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
                   2550:             into <tt class="varname">BIN_INSTALL_FLAGS</tt>. See
                   2551:             <tt class="filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt>
                   2552:             for more details.</p>
                   2553: 
                   2554:             <p>A final word of warning: If you setup a system that
                   2555:             has a non-standard setting for <tt class=
                   2556:             "varname">LOCALBASE</tt>, be sure to set that before
                   2557:             any packages are installed, as you can not use several
                   2558:             directories for the same purpose. Doing so will result
                   2559:             in pkgsrc not being able to properly detect your
                   2560:             installed packages, and fail miserably. Note also that
                   2561:             precompiled binary packages are usually built with the
                   2562:             default <tt class="varname">LOCALBASE</tt> of
                   2563:             <tt class="filename">/usr/pkg</tt>, and that you should
                   2564:             <span class="emphasis"><em>not</em></span> install any
                   2565:             if you use a non-standard <tt class=
                   2566:             "varname">LOCALBASE</tt>.</p>
                   2567:           </div>
                   2568: 
                   2569:           <div class="sect2" lang="en" xml:lang="en">
                   2570:             <div class="titlepage">
                   2571:               <div>
                   2572:                 <div>
1.2     ! hubertf  2573:                   <h3 class="title"><a name="id2498125" id=
        !          2574:                   "id2498125"></a>4.2.4.&nbsp;Selecting the
1.1       grant    2575:                   compiler</h3>
                   2576:                 </div>
                   2577:               </div>
                   2578:             </div>
                   2579: 
                   2580:             <p>By default, pkgsrc will use GCC to build packages.
                   2581:             This may be overridden by setting the following
                   2582:             variables in /etc/mk.conf:</p>
                   2583: 
                   2584:             <div class="variablelist">
                   2585:               <dl>
                   2586:                 <dt><span class="term"><tt class=
                   2587:                 "varname">PKGSRC_COMPILER</tt>:</span></dt>
                   2588: 
                   2589:                 <dd>
                   2590:                   <p>This is a list of values specifying the chain
                   2591:                   of compilers to invoke when building packages.
                   2592:                   Valid values are:</p>
                   2593: 
                   2594:                   <div class="itemizedlist">
                   2595:                     <ul type="disc">
                   2596:                       <li>
                   2597:                         <p><tt class="varname">distcc</tt>:
                   2598:                         distributed C/C++ (chainable)</p>
                   2599:                       </li>
                   2600: 
                   2601:                       <li>
                   2602:                         <p><tt class="varname">ccache</tt>:
                   2603:                         compiler cache (chainable)</p>
                   2604:                       </li>
                   2605: 
                   2606:                       <li>
                   2607:                         <p><tt class="varname">gcc</tt>: GNU C/C++
                   2608:                         Compiler</p>
                   2609:                       </li>
                   2610: 
                   2611:                       <li>
                   2612:                         <p><tt class="varname">mipspro</tt>:
                   2613:                         Silicon Graphics, Inc. MIPSpro
                   2614:                         (n32/n64)</p>
                   2615:                       </li>
                   2616: 
                   2617:                       <li>
                   2618:                         <p><tt class="varname">mipspro</tt>:
                   2619:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   2620:                       </li>
                   2621: 
                   2622:                       <li>
                   2623:                         <p><tt class="varname">sunpro</tt>:
                   2624:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   2625:                         Studio</p>
                   2626:                       </li>
                   2627:                     </ul>
                   2628:                   </div>
                   2629: 
                   2630:                   <p>The default is &#8220;<span class=
                   2631:                   "quote"><tt class=
                   2632:                   "varname">gcc</tt></span>&#8221;. You can use
                   2633:                   <tt class="varname">ccache</tt> and/or <tt class=
                   2634:                   "varname">distcc</tt> with an appropriate
                   2635:                   <tt class="varname">PKGSRC_COMPILER</tt> setting,
                   2636:                   e.g. &#8220;<span class="quote"><tt class=
                   2637:                   "varname">ccache gcc</tt></span>&#8221;. This
                   2638:                   variable should always be terminated with a value
                   2639:                   for a real compiler.</p>
                   2640:                 </dd>
                   2641: 
                   2642:                 <dt><span class="term"><tt class=
                   2643:                 "varname">GCC_REQD</tt>:</span></dt>
                   2644: 
                   2645:                 <dd>
                   2646:                   <p>This specifies the minimum version of GCC to
                   2647:                   use when building packages. If the system GCC
                   2648:                   doesn't satisfy this requirement, then pkgsrc
                   2649:                   will build and install one of the GCC packages to
                   2650:                   use instead.</p>
                   2651:                 </dd>
                   2652:               </dl>
                   2653:             </div>
                   2654:           </div>
                   2655:         </div>
                   2656:       </div>
                   2657: 
                   2658:       <div class="chapter" lang="en" xml:lang="en">
                   2659:         <div class="titlepage">
                   2660:           <div>
                   2661:             <div>
                   2662:               <h2 class="title"><a name="binary" id=
                   2663:               "binary"></a>Chapter&nbsp;5.&nbsp;Creating binary
                   2664:               packages</h2>
                   2665:             </div>
                   2666:           </div>
                   2667:         </div>
                   2668: 
                   2669:         <div class="toc">
                   2670:           <p><b>Table of Contents</b></p>
                   2671: 
                   2672:           <dl>
1.2     ! hubertf  2673:             <dt><span class="sect1"><a href="#id2498280">5.1.
1.1       grant    2674:             Building a single binary package</a></span></dt>
                   2675: 
1.2     ! hubertf  2676:             <dt><span class="sect1"><a href="#id2563075">5.2.
1.1       grant    2677:             Settings for creation of binary
                   2678:             packages</a></span></dt>
                   2679: 
                   2680:             <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
                   2681:             a bulk build of all packages</a></span></dt>
                   2682: 
                   2683:             <dd>
                   2684:               <dl>
                   2685:                 <dt><span class="sect2"><a href=
                   2686:                 "#binary.configuration">5.3.1.
                   2687:                 Configuration</a></span></dt>
                   2688: 
1.2     ! hubertf  2689:                 <dt><span class="sect2"><a href="#id2563214">5.3.2.
1.1       grant    2690:                 Other environmental considerations</a></span></dt>
                   2691: 
1.2     ! hubertf  2692:                 <dt><span class="sect2"><a href="#id2563255">5.3.3.
1.1       grant    2693:                 Operation</a></span></dt>
                   2694: 
1.2     ! hubertf  2695:                 <dt><span class="sect2"><a href="#id2563462">5.3.4.
1.1       grant    2696:                 What it does</a></span></dt>
                   2697: 
1.2     ! hubertf  2698:                 <dt><span class="sect2"><a href="#id2563518">5.3.5.
1.1       grant    2699:                 Disk space requirements</a></span></dt>
                   2700: 
1.2     ! hubertf  2701:                 <dt><span class="sect2"><a href="#id2563545">5.3.6.
1.1       grant    2702:                 Setting up a sandbox for chroot'ed
                   2703:                 builds</a></span></dt>
                   2704: 
1.2     ! hubertf  2705:                 <dt><span class="sect2"><a href="#id2563909">5.3.7.
1.1       grant    2706:                 Building a partial set of packages</a></span></dt>
                   2707:               </dl>
                   2708:             </dd>
                   2709: 
1.2     ! hubertf  2710:             <dt><span class="sect1"><a href="#id2563952">5.4.
1.1       grant    2711:             Creating a multiple CD-ROM packages
                   2712:             collection</a></span></dt>
                   2713: 
                   2714:             <dd>
                   2715:               <dl>
1.2     ! hubertf  2716:                 <dt><span class="sect2"><a href="#id2564035">5.4.1.
1.1       grant    2717:                 Example of cdpack</a></span></dt>
                   2718:               </dl>
                   2719:             </dd>
                   2720:           </dl>
                   2721:         </div>
                   2722: 
                   2723:         <div class="sect1" lang="en" xml:lang="en">
                   2724:           <div class="titlepage">
                   2725:             <div>
                   2726:               <div>
                   2727:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  2728:                 "id2498280" id="id2498280"></a>5.1.&nbsp;Building a
1.1       grant    2729:                 single binary package</h2>
                   2730:               </div>
                   2731:             </div>
                   2732:           </div>
                   2733: 
                   2734:           <p>Once you have built and installed a package, you can
                   2735:           create a <span class="emphasis"><em>binary
                   2736:           package</em></span> which can be installed on another
                   2737:           system with <a href=
                   2738:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2739:           <span class="citerefentry"><span class=
                   2740:           "refentrytitle">pkg_add</span>(1)</span></a> This saves
                   2741:           having to build the same package on a group of hosts and
                   2742:           wasting CPU time. It also provides a simple means for
                   2743:           others to install your package, should you distribute
                   2744:           it.</p>
                   2745: 
                   2746:           <p>To create a binary package, change into the
                   2747:           appropriate directory in pkgsrc, and run <span><b class=
                   2748:           "command">make package</b></span>:</p>
                   2749:           <pre class="screen">
                   2750: <tt class="prompt">#</tt> <b class=
                   2751: "userinput"><tt>cd misc/figlet</tt></b>
                   2752: <tt class="prompt">#</tt> <b class=
                   2753: "userinput"><tt>make package</tt></b>
                   2754: </pre>
                   2755: 
                   2756:           <p>This will build and install your package (if not
                   2757:           already done), and then build a binary package from what
                   2758:           was installed. You can then use the <span><b class=
                   2759:           "command">pkg_*</b></span> tools to manipulate it. Binary
                   2760:           packages are created by default in <tt class=
                   2761:           "filename">/usr/pkgsrc/packages</tt>, in the form of a
                   2762:           gzipped tar file. See <a href="#logs.package" title=
                   2763:           "B.2.&nbsp;Packaging figlet">Section B.2,
                   2764:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   2765:           the above <a xmlns=
                   2766:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   2767:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.2     ! hubertf  2768:              class="pkgname">misc/figlet</a> example.</p>
1.1       grant    2769: 
                   2770:           <p>See <a href="#submit" title=
                   2771:           "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter
                   2772:           14, <i>Submitting and Committing</i></a> for information
                   2773:           on how to submit such a binary package.</p>
                   2774:         </div>
                   2775: 
                   2776:         <div class="sect1" lang="en" xml:lang="en">
                   2777:           <div class="titlepage">
                   2778:             <div>
                   2779:               <div>
                   2780:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  2781:                 "id2563075" id="id2563075"></a>5.2.&nbsp;Settings
1.1       grant    2782:                 for creation of binary packages</h2>
                   2783:               </div>
                   2784:             </div>
                   2785:           </div>
                   2786: 
                   2787:           <p>See <a href="#build.helpful-targets" title=
                   2788:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   2789:           &#8220;Other helpful targets&#8221;</a>.</p>
                   2790:         </div>
                   2791: 
                   2792:         <div class="sect1" lang="en" xml:lang="en">
                   2793:           <div class="titlepage">
                   2794:             <div>
                   2795:               <div>
                   2796:                 <h2 class="title" style="clear: both"><a name=
                   2797:                 "bulkbuild" id="bulkbuild"></a>5.3.&nbsp;Doing a
                   2798:                 bulk build of all packages</h2>
                   2799:               </div>
                   2800:             </div>
                   2801:           </div>
                   2802: 
                   2803:           <p>If you want to get a full set of precompiled binary
                   2804:           packages, this section describes how to get them. Beware
                   2805:           that the bulk build will remove all currently installed
                   2806:           packages from your system! Having a FTP server configured
                   2807:           either on the machine doing the bulk builds or on a
                   2808:           nearby NFS server can help to make the packages available
                   2809:           to everyone. See <a href=
                   2810:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   2811:           <span class="citerefentry"><span class=
                   2812:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   2813:           information. If you use a remote NFS server's storage, be
                   2814:           sure to not actually compile on NFS storage, as this
                   2815:           slows things down a lot.</p>
                   2816: 
                   2817:           <div class="sect2" lang="en" xml:lang="en">
                   2818:             <div class="titlepage">
                   2819:               <div>
                   2820:                 <div>
                   2821:                   <h3 class="title"><a name="binary.configuration"
                   2822:                   id=
                   2823:                   "binary.configuration"></a>5.3.1.&nbsp;Configuration</h3>
                   2824:                 </div>
                   2825:               </div>
                   2826:             </div>
                   2827: 
                   2828:             <div class="sect3" lang="en" xml:lang="en">
                   2829:               <div class="titlepage">
                   2830:                 <div>
                   2831:                   <div>
                   2832:                     <h4 class="title"><a name="binary.mk.conf" id=
                   2833:                     "binary.mk.conf"></a>5.3.1.1.&nbsp;/etc/mk.conf</h4>
                   2834:                   </div>
                   2835:                 </div>
                   2836:               </div>
                   2837: 
                   2838:               <p>You may want to set things in <tt class=
                   2839:               "filename">/etc/mk.conf</tt>. Look at <tt class=
                   2840:               "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt> for
                   2841:               details of the default settings. You will want to
                   2842:               ensure that <tt class=
                   2843:               "varname">ACCEPTABLE_LICENSES</tt> meet your local
                   2844:               policy. As used in this example, <tt class=
                   2845:               "varname">_ACCEPTABLE=yes</tt> accepts <span class=
                   2846:               "emphasis"><em>all</em></span> licenses.</p>
                   2847:               <pre class="programlisting">
                   2848: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   2849: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   2850: BSDSRCDIR=      /usr/src
                   2851: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   2852: OBJHOSTNAME?=   yes               # use work.`hostname`
                   2853: FAILOVER_FETCH= yes               # insist on the correct checksum
                   2854: PKG_DEVELOPER?= yes
                   2855: _ACCEPTABLE=    yes
                   2856: </pre>
                   2857:             </div>
                   2858: 
                   2859:             <div class="sect3" lang="en" xml:lang="en">
                   2860:               <div class="titlepage">
                   2861:                 <div>
                   2862:                   <div>
1.2     ! hubertf  2863:                     <h4 class="title"><a name="id2563139" id=
        !          2864:                     "id2563139"></a>5.3.1.2.&nbsp;<tt class=
1.1       grant    2865:                     "filename">build.conf</tt></h4>
                   2866:                   </div>
                   2867:                 </div>
                   2868:               </div>
                   2869: 
                   2870:               <p>In <tt class="filename">pkgsrc/mk/bulk</tt>, copy
                   2871:               <tt class="filename">build.conf-example</tt> to
                   2872:               <tt class="filename">build.conf</tt> and edit it,
                   2873:               following the comments in that file. This is the
                   2874:               config file that determines where log files are
                   2875:               generated after the build, where to mail the build
                   2876:               report to, where your pkgsrc tree is located and
                   2877:               which user to <a href=
                   2878:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   2879:               <span class="citerefentry"><span class=
                   2880:               "refentrytitle">su</span>(8)</span></a> to to do a
                   2881:               <span><b class="command">cvs update</b></span>.</p>
                   2882:             </div>
                   2883: 
                   2884:             <div class="sect3" lang="en" xml:lang="en">
                   2885:               <div class="titlepage">
                   2886:                 <div>
                   2887:                   <div>
1.2     ! hubertf  2888:                     <h4 class="title"><a name="id2563175" id=
        !          2889:                     "id2563175"></a>5.3.1.3.&nbsp;<tt class=
1.1       grant    2890:                     "filename">pre-build.local</tt></h4>
                   2891:                   </div>
                   2892:                 </div>
                   2893:               </div>
                   2894: 
                   2895:               <p>It is possible to configure the bulk build to
                   2896:               perform certain site specific tasks at the end of the
                   2897:               pre-build stage. If the file <tt class=
                   2898:               "filename">pre-build.local</tt> exists in <tt class=
                   2899:               "filename">/usr/pkgsrc/mk/bulk</tt> it will be
                   2900:               executed (as a sh(1) script) at the end of the usual
                   2901:               pre-build stage. An example use of <tt class=
                   2902:               "filename">pre-build.local</tt> is to have the
                   2903:               line:</p>
                   2904:               <pre class="screen">
                   2905: <tt class="prompt">#</tt> <b class=
                   2906: "userinput"><tt>echo "I do not have enough disk space to build this pig." \
                   2907:     &gt; pkgsrc/games/crafty-book-enormous/$BROKENF</tt></b>
                   2908: </pre>
                   2909: 
                   2910:               <p>to prevent the system from trying to build a
                   2911:               particular package which requires nearly 3 GB of disk
                   2912:               space.</p>
                   2913:             </div>
                   2914:           </div>
                   2915: 
                   2916:           <div class="sect2" lang="en" xml:lang="en">
                   2917:             <div class="titlepage">
                   2918:               <div>
                   2919:                 <div>
1.2     ! hubertf  2920:                   <h3 class="title"><a name="id2563214" id=
        !          2921:                   "id2563214"></a>5.3.2.&nbsp;Other environmental
1.1       grant    2922:                   considerations</h3>
                   2923:                 </div>
                   2924:               </div>
                   2925:             </div>
                   2926: 
                   2927:             <p>As <tt class="filename">/usr/pkg</tt> will be
                   2928:             completely deleted at the start of bulk builds, make
                   2929:             sure your login shell is placed somewhere else. Either
                   2930:             drop it into <tt class="filename">/usr/local/bin</tt>
                   2931:             (and adjust your login shell in the passwd file), or
                   2932:             (re-)install it via <a href=
                   2933:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2934:             <span class="citerefentry"><span class=
                   2935:             "refentrytitle">pkg_add</span>(1)</span></a> from
                   2936:             <tt class="filename">/etc/rc.local</tt>, so you can
                   2937:             login after a reboot (remember that your current
                   2938:             process won't die if the package is removed, you just
                   2939:             can't start any new instances of the shell any more).
                   2940:             Also, if you use NetBSD earlier than 1.5, or you still
                   2941:             want to use the pkgsrc version of ssh for some reason,
                   2942:             be sure to install ssh before starting it from
                   2943:             <tt class="filename">rc.local</tt>:</p>
                   2944:             <pre class="programlisting">
                   2945: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   2946: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   2947:     /usr/pkg/etc/rc.d/sshd
                   2948: fi
                   2949: </pre>
                   2950: 
                   2951:             <p>Not doing so will result in you being not able to
                   2952:             log in via ssh after the bulk build is finished or if
                   2953:             the machine gets rebooted or crashes. You have been
                   2954:             warned! :)</p>
                   2955:           </div>
                   2956: 
                   2957:           <div class="sect2" lang="en" xml:lang="en">
                   2958:             <div class="titlepage">
                   2959:               <div>
                   2960:                 <div>
1.2     ! hubertf  2961:                   <h3 class="title"><a name="id2563255" id=
        !          2962:                   "id2563255"></a>5.3.3.&nbsp;Operation</h3>
1.1       grant    2963:                 </div>
                   2964:               </div>
                   2965:             </div>
                   2966: 
                   2967:             <p>Make sure you don't need any of the packages still
                   2968:             installed.</p>
                   2969: 
                   2970:             <div class="warning" style=
                   2971:             "margin-left: 0.5in; margin-right: 0.5in;">
                   2972:               <h3 class="title">Warning</h3>
                   2973: 
                   2974:               <p>During the bulk build, <span class=
                   2975:               "emphasis"><em>all packages will be
                   2976:               removed!</em></span></p>
                   2977:             </div>
                   2978: 
                   2979:             <p>Be sure to remove all other things that might
                   2980:             interfere with builds, like some libs installed in
                   2981:             <tt class="filename">/usr/local</tt>, etc. then become
                   2982:             root and type:</p>
                   2983:             <pre class="screen">
                   2984: <tt class="prompt">#</tt> <b class=
                   2985: "userinput"><tt>cd /usr/pkgsrc</tt></b>
                   2986: <tt class="prompt">#</tt> <b class=
                   2987: "userinput"><tt>sh mk/bulk/build</tt></b>
                   2988: </pre>
                   2989: 
                   2990:             <p>If for some reason your last build didn't complete
                   2991:             (power failure, system panic, ...), you can continue it
                   2992:             by running:</p>
                   2993:             <pre class="screen">
                   2994: <tt class="prompt">#</tt> <b class=
                   2995: "userinput"><tt>sh mk/bulk/build restart</tt></b>
                   2996: </pre>
                   2997: 
                   2998:             <p>At the end of the bulk build, you will get a summary
                   2999:             via mail, and find build logs in the directory
                   3000:             specified by <tt class="varname">FTP</tt> in the
                   3001:             <tt class="filename">build.conf</tt> file.</p>
                   3002:           </div>
                   3003: 
                   3004:           <div class="sect2" lang="en" xml:lang="en">
                   3005:             <div class="titlepage">
                   3006:               <div>
                   3007:                 <div>
1.2     ! hubertf  3008:                   <h3 class="title"><a name="id2563462" id=
        !          3009:                   "id2563462"></a>5.3.4.&nbsp;What it does</h3>
1.1       grant    3010:                 </div>
                   3011:               </div>
                   3012:             </div>
                   3013: 
                   3014:             <p>The bulk builds consist of three steps:</p>
                   3015: 
                   3016:             <div class="variablelist">
                   3017:               <dl>
                   3018:                 <dt><span class="term">1. pre-build</span></dt>
                   3019: 
                   3020:                 <dd>
                   3021:                   <p>The script updates your pkgsrc tree via
                   3022:                   (anon)cvs, then cleans out any broken distfiles,
                   3023:                   and removes all packages installed.</p>
                   3024:                 </dd>
                   3025: 
                   3026:                 <dt><span class="term">2. the bulk
                   3027:                 build</span></dt>
                   3028: 
                   3029:                 <dd>
                   3030:                   <p>This is basically &#8220;<span class=
                   3031:                   "quote">make bulk-package</span>&#8221; with an
                   3032:                   optimised order in which packages will be built.
                   3033:                   Packages that don't require other packages will
                   3034:                   be built first, and packages with many
                   3035:                   dependencies will be built later.</p>
                   3036:                 </dd>
                   3037: 
                   3038:                 <dt><span class="term">3. post-build</span></dt>
                   3039: 
                   3040:                 <dd>
                   3041:                   <p>Generates a report that's placed in the
                   3042:                   directory specified in the <tt class=
                   3043:                   "filename">build.conf</tt> file named <tt class=
                   3044:                   "filename">broken.html</tt>, a short version of
                   3045:                   that report will also be mailed to the build's
                   3046:                   admin.</p>
                   3047:                 </dd>
                   3048:               </dl>
                   3049:             </div>
                   3050: 
                   3051:             <p>During the build, a list of broken packages will be
                   3052:             compiled in <tt class=
                   3053:             "filename">/usr/pkgsrc/.broken</tt> (or <tt class=
                   3054:             "filename">.../.broken.${MACHINE}</tt> if <tt class=
                   3055:             "varname">OBJMACHINE</tt> is set), individual build
                   3056:             logs of broken builds can be found in the package's
                   3057:             directory. These files are used by the bulk-targets to
                   3058:             mark broken builds to not waste time trying to rebuild
                   3059:             them, and they can be used to debug these broken
                   3060:             package builds later.</p>
                   3061:           </div>
                   3062: 
                   3063:           <div class="sect2" lang="en" xml:lang="en">
                   3064:             <div class="titlepage">
                   3065:               <div>
                   3066:                 <div>
1.2     ! hubertf  3067:                   <h3 class="title"><a name="id2563518" id=
        !          3068:                   "id2563518"></a>5.3.5.&nbsp;Disk space
1.1       grant    3069:                   requirements</h3>
                   3070:                 </div>
                   3071:               </div>
                   3072:             </div>
                   3073: 
                   3074:             <p>Currently, roughly the following requirements are
                   3075:             valid for NetBSD 2.0/i386:</p>
                   3076: 
                   3077:             <div class="itemizedlist">
                   3078:               <ul type="disc">
                   3079:                 <li>
                   3080:                   <p>10 GB - distfiles (NFS ok)</p>
                   3081:                 </li>
                   3082: 
                   3083:                 <li>
                   3084:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   3085:                 </li>
                   3086: 
                   3087:                 <li>
                   3088:                   <p>5 GB - temp space for compiling (local disk
                   3089:                   recommended)</p>
                   3090:                 </li>
                   3091:               </ul>
                   3092:             </div>
                   3093: 
                   3094:             <p>Note that all pkgs will be de-installed as soon as
                   3095:             they are turned into a binary package, and that sources
                   3096:             are removed, so there is no excessively huge demand to
                   3097:             disk space. Afterwards, if the package is needed again,
                   3098:             it will be installed via <a href=
                   3099:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3100:             <span class="citerefentry"><span class=
                   3101:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   3102:             building again, so there are no cycles wasted by
                   3103:             recompiling.</p>
                   3104:           </div>
                   3105: 
                   3106:           <div class="sect2" lang="en" xml:lang="en">
                   3107:             <div class="titlepage">
                   3108:               <div>
                   3109:                 <div>
1.2     ! hubertf  3110:                   <h3 class="title"><a name="id2563545" id=
        !          3111:                   "id2563545"></a>5.3.6.&nbsp;Setting up a sandbox
1.1       grant    3112:                   for chroot'ed builds</h3>
                   3113:                 </div>
                   3114:               </div>
                   3115:             </div>
                   3116: 
                   3117:             <p>If you don't want all the pkgs nuked from a machine
                   3118:             (rendering it useless for anything but pkg compiling),
                   3119:             there is the possibility of doing the pkg bulk build
                   3120:             inside a chroot environment.</p>
                   3121: 
                   3122:             <p>The first step to do so is setting up a chroot
                   3123:             sandbox, e.g. <tt class="filename">/usr/sandbox</tt>.
                   3124:             After extracting all the sets from a NetBSD
                   3125:             installation or doing a <span><b class="command">make
                   3126:             distribution DESTDIR=/usr/sandbox</b></span> in
                   3127:             <tt class="filename">/usr/src/etc</tt>, be sure the
                   3128:             following items are present and properly
                   3129:             configured:</p>
                   3130: 
                   3131:             <div class="procedure">
                   3132:               <ol type="1">
                   3133:                 <li>
                   3134:                   <p>Kernel</p>
                   3135:                   <pre class="screen">
                   3136: <tt class="prompt">#</tt> <b class=
                   3137: "userinput"><tt>cp /netbsd /usr/sandbox</tt></b>
                   3138: </pre>
                   3139:                 </li>
                   3140: 
                   3141:                 <li>
                   3142:                   <p><tt class="filename">/dev/*</tt></p>
                   3143:                   <pre class="screen">
                   3144: <tt class="prompt">#</tt> <b class=
                   3145: "userinput"><tt>cd /usr/sandbox/dev ; sh MAKEDEV all</tt></b>
                   3146: </pre>
                   3147:                 </li>
                   3148: 
                   3149:                 <li>
                   3150:                   <p><tt class="filename">/etc/resolv.conf</tt>
                   3151:                   (for <a xmlns=
                   3152:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3153:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.2     ! hubertf  3154:                      class="pkgname">security/smtpd</a> and
        !          3155:                      mail):</p>
1.1       grant    3156:                   <pre class="screen">
                   3157: <tt class="prompt">#</tt> <b class=
                   3158: "userinput"><tt>cp /etc/resolv.conf /usr/sandbox/etc</tt></b>
                   3159: </pre>
                   3160:                 </li>
                   3161: 
                   3162:                 <li>
                   3163:                   <p>Working(!) mail config (hostname,
                   3164:                   sendmail.cf):</p>
                   3165:                   <pre class="screen">
                   3166: <tt class="prompt">#</tt> <b class=
                   3167: "userinput"><tt>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</tt></b>
                   3168: </pre>
                   3169:                 </li>
                   3170: 
                   3171:                 <li>
                   3172:                   <p><tt class="filename">/etc/localtime</tt> (for
                   3173:                   <a xmlns=
                   3174:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3175:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.2     ! hubertf  3176:                      class="pkgname">security/smtpd</a>):</p>
1.1       grant    3177:                   <pre class="screen">
                   3178: <tt class="prompt">#</tt> <b class=
                   3179: "userinput"><tt>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</tt></b>
                   3180: </pre>
                   3181:                 </li>
                   3182: 
                   3183:                 <li>
                   3184:                   <p><tt class="filename">/usr/src</tt> (system
                   3185:                   sources, for <a xmlns=
                   3186:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3187:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.2     ! hubertf  3188:                      class="pkgname">sysutils/aperture</a>,
        !          3189:                      <a xmlns=
        !          3190:                      "http://www.w3.org/TR/xhtml1/transitional"
        !          3191:                      href=
        !          3192:                      "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
        !          3193:                      class="pkgname">net/ppp-mppe</a>):</p>
1.1       grant    3194:                   <pre class="screen">
                   3195: <tt class="prompt">#</tt> <b class=
                   3196: "userinput"><tt>ln -s ../disk1/cvs .</tt></b>
                   3197: <tt class="prompt">#</tt> <b class=
                   3198: "userinput"><tt>ln -s cvs/src-1.6 src</tt></b>
                   3199: </pre>
                   3200:                 </li>
                   3201: 
                   3202:                 <li>
                   3203:                   <p>Create <tt class="filename">/var/db/pkg</tt>
                   3204:                   (not part of default install):</p>
                   3205:                   <pre class="screen">
                   3206: <tt class="prompt">#</tt> <b class=
                   3207: "userinput"><tt>mkdir /usr/sandbox/var/db/pkg</tt></b>
                   3208: </pre>
                   3209:                 </li>
                   3210: 
                   3211:                 <li>
                   3212:                   <p>Create <tt class="filename">/usr/pkg</tt> (not
                   3213:                   part of default install):</p>
                   3214:                   <pre class="screen">
                   3215: <tt class="prompt">#</tt> <b class=
                   3216: "userinput"><tt>mkdir /usr/sandbox/usr/pkg</tt></b>
                   3217: </pre>
                   3218:                 </li>
                   3219: 
                   3220:                 <li>
                   3221:                   <p>Checkout pkgsrc via cvs into <tt class=
                   3222:                   "filename">/usr/sandbox/usr/pkgsrc</tt>:</p>
                   3223:                   <pre class="screen">
                   3224: <tt class="prompt">#</tt> <b class=
                   3225: "userinput"><tt>cd /usr/sandbox/usr</tt></b>
                   3226: <tt class="prompt">#</tt> <b class=
                   3227: "userinput"><tt>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</tt></b>
                   3228: </pre>
                   3229: 
                   3230:                   <p>Do not mount/link this to the copy of your
                   3231:                   pkgsrc tree you do development in, as this will
                   3232:                   likely cause problems!</p>
                   3233:                 </li>
                   3234: 
                   3235:                 <li>
                   3236:                   <p>Make <tt class=
                   3237:                   "filename">/usr/sandbox/usr/pkgsrc/packages</tt>
                   3238:                   and <tt class="filename">.../distfiles</tt> point
                   3239:                   somewhere appropriate. NFS- and/or nullfs-mounts
                   3240:                   may come in handy!</p>
                   3241:                 </li>
                   3242: 
                   3243:                 <li>
                   3244:                   <p>Edit <tt class="filename">/etc/mk.conf</tt>,
                   3245:                   see <a href="#binary.mk.conf" title=
                   3246:                   "5.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;5.3.1.1,
                   3247:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   3248:                 </li>
                   3249: 
                   3250:                 <li>
                   3251:                   <p>Adjust <tt class=
                   3252:                   "filename">mk/bulk/build.conf</tt> to suit your
                   3253:                   needs.</p>
                   3254:                 </li>
                   3255: 
                   3256:                 <li>
                   3257:                   <p>If you have set <tt class=
                   3258:                   "varname">CVS_USER</tt> in <tt class=
                   3259:                   "filename">build.conf</tt>, make sure that
                   3260:                   account exists and can do a <span><b class=
                   3261:                   "command">cvs ${CVS_FLAGS} update</b></span>
                   3262:                   properly!</p>
                   3263:                 </li>
                   3264:               </ol>
                   3265:             </div>
                   3266: 
                   3267:             <p>When the chroot sandbox is setup, you can start the
                   3268:             build with the following steps:</p>
                   3269:             <pre class="screen">
                   3270: <tt class="prompt">#</tt> <b class=
                   3271: "userinput"><tt>cd /usr/sandbox/usr/pkgsrc</tt></b>
                   3272: <tt class="prompt">#</tt> <b class=
                   3273: "userinput"><tt>sh mk/bulk/do-sandbox-build</tt></b>
                   3274: </pre>
                   3275: 
                   3276:             <p>This will just jump inside the sandbox and start
                   3277:             building. At the end of the build, mail will be sent
                   3278:             with the results of the build. Created binary pkgs will
                   3279:             be in <tt class=
                   3280:             "filename">/usr/sandbox/usr/pkgsrc/packages</tt>
                   3281:             (wherever that points/mounts to/from).</p>
                   3282:           </div>
                   3283: 
                   3284:           <div class="sect2" lang="en" xml:lang="en">
                   3285:             <div class="titlepage">
                   3286:               <div>
                   3287:                 <div>
1.2     ! hubertf  3288:                   <h3 class="title"><a name="id2563909" id=
        !          3289:                   "id2563909"></a>5.3.7.&nbsp;Building a partial
1.1       grant    3290:                   set of packages</h3>
                   3291:                 </div>
                   3292:               </div>
                   3293:             </div>
                   3294: 
                   3295:             <p>In addition to building a complete set of all
                   3296:             packages in pkgsrc, the <tt class=
                   3297:             "filename">pkgsrc/mk/bulk/build</tt> script may be used
                   3298:             to build a subset of the packages contained in pkgsrc.
                   3299:             By setting defining <tt class=
                   3300:             "varname">SPECIFIC_PKGS</tt> in <tt class=
                   3301:             "filename">/etc/mk.conf</tt>, the variables</p>
                   3302: 
                   3303:             <div class="itemizedlist">
                   3304:               <ul type="disc">
                   3305:                 <li>
                   3306:                   <p>SITE_SPECIFIC_PKGS</p>
                   3307:                 </li>
                   3308: 
                   3309:                 <li>
                   3310:                   <p>HOST_SPECIFIC_PKGS</p>
                   3311:                 </li>
                   3312: 
                   3313:                 <li>
                   3314:                   <p>GROUP_SPECIFIC_PKGS</p>
                   3315:                 </li>
                   3316: 
                   3317:                 <li>
                   3318:                   <p>USER_SPECIFIC_PKGS</p>
                   3319:                 </li>
                   3320:               </ul>
                   3321:             </div>
                   3322: 
                   3323:             <p>will define the set of packages which should be
                   3324:             built. The bulk build code will also include any
                   3325:             packages which are needed as dependencies for the
                   3326:             explicitly listed packages.</p>
                   3327: 
                   3328:             <p>One use of this is to do a bulk build with
                   3329:             <tt class="varname">SPECIFIC_PKGS</tt> in a chroot
                   3330:             sandbox periodically to have a complete set of the
                   3331:             binary packages needed for your site available without
                   3332:             the overhead of building extra packages that are not
                   3333:             needed.</p>
                   3334:           </div>
                   3335:         </div>
                   3336: 
                   3337:         <div class="sect1" lang="en" xml:lang="en">
                   3338:           <div class="titlepage">
                   3339:             <div>
                   3340:               <div>
                   3341:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  3342:                 "id2563952" id="id2563952"></a>5.4.&nbsp;Creating a
1.1       grant    3343:                 multiple CD-ROM packages collection</h2>
                   3344:               </div>
                   3345:             </div>
                   3346:           </div>
                   3347: 
                   3348:           <p>After your pkgsrc bulk-build has completed, you may
                   3349:           wish to create a CD-ROM set of the resulting binary
                   3350:           packages to assist in installing packages on other
                   3351:           machines. The <a xmlns=
                   3352:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3353:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.2     ! hubertf  3354:              class="pkgname">pkgtools/cdpack</a> package provides a
        !          3355:              simple tool for creating the ISO 9660 images.
        !          3356:              <span><b class="command">cdpack</b></span> arranges
        !          3357:              the packages on the CD-ROMs in a way that keeps all
        !          3358:              the dependencies for given package on the same CD as
        !          3359:              that package.</p>
1.1       grant    3360: 
                   3361:           <div class="sect2" lang="en" xml:lang="en">
                   3362:             <div class="titlepage">
                   3363:               <div>
                   3364:                 <div>
1.2     ! hubertf  3365:                   <h3 class="title"><a name="id2564035" id=
        !          3366:                   "id2564035"></a>5.4.1.&nbsp;Example of
1.1       grant    3367:                   cdpack</h3>
                   3368:                 </div>
                   3369:               </div>
                   3370:             </div>
                   3371: 
                   3372:             <p>Complete documentation for cdpack is found in the
                   3373:             cdpack(1) manpage. The following short example assumes
                   3374:             that the binary packages are left in <tt class=
                   3375:             "filename">/usr/pkgsrc/packages/All</tt> and that
                   3376:             sufficient disk space exists in <tt class=
                   3377:             "filename">/u2</tt> to hold the ISO 9660 images.</p>
                   3378:             <pre class="screen">
                   3379: <tt class="prompt">#</tt> <b class=
                   3380: "userinput"><tt>mkdir /u2/images</tt></b>
                   3381: <tt class="prompt">#</tt> <b class=
                   3382: "userinput"><tt>pkg_add /usr/pkgsrc/packages/All/cdpack</tt></b>
                   3383: <tt class="prompt">#</tt> <b class=
                   3384: "userinput"><tt>cdpack /usr/pkgsrc/packages/All /u2/images</tt></b>
                   3385: </pre>
                   3386: 
                   3387:             <p>If you wish to include a common set of files
                   3388:             (<tt class="filename">COPYRIGHT</tt>, <tt class=
                   3389:             "filename">README</tt>, etc.) on each CD in the
                   3390:             collection, then you need to create a directory which
                   3391:             contains these files. e.g.</p>
                   3392:             <pre class="screen">
                   3393: <tt class="prompt">#</tt> <b class=
                   3394: "userinput"><tt>mkdir /tmp/common</tt></b>
                   3395: <tt class="prompt">#</tt> <b class=
                   3396: "userinput"><tt>echo "This is a README" &gt; /tmp/common/README</tt></b>
                   3397: <tt class="prompt">#</tt> <b class=
                   3398: "userinput"><tt>echo "Another file" &gt; /tmp/common/COPYING</tt></b>
                   3399: <tt class="prompt">#</tt> <b class=
                   3400: "userinput"><tt>mkdir /tmp/common/bin</tt></b>
                   3401: <tt class="prompt">#</tt> <b class=
                   3402: "userinput"><tt>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</tt></b>
                   3403: <tt class="prompt">#</tt> <b class=
                   3404: "userinput"><tt>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</tt></b>
                   3405: <tt class="prompt">#</tt> <b class=
                   3406: "userinput"><tt>chmod 755 /tmp/common/bin/myscript</tt></b>
                   3407: </pre>
                   3408: 
                   3409:             <p>Now create the images:</p>
                   3410:             <pre class="screen">
                   3411: <tt class="prompt">#</tt> <b class=
                   3412: "userinput"><tt>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</tt></b>
                   3413: </pre>
                   3414: 
                   3415:             <p>Each image will contain <tt class=
                   3416:             "filename">README</tt>, <tt class=
                   3417:             "filename">COPYING</tt>, and <tt class=
                   3418:             "filename">bin/myscript</tt> in their root
                   3419:             directories.</p>
                   3420:           </div>
                   3421:         </div>
                   3422:       </div>
                   3423: 
                   3424:       <div class="chapter" lang="en" xml:lang="en">
                   3425:         <div class="titlepage">
                   3426:           <div>
                   3427:             <div>
                   3428:               <h2 class="title"><a name="faq" id=
                   3429:               "faq"></a>Chapter&nbsp;6.&nbsp;Frequently Asked
                   3430:               Questions</h2>
                   3431:             </div>
                   3432:           </div>
                   3433:         </div>
                   3434: 
                   3435:         <div class="toc">
                   3436:           <p><b>Table of Contents</b></p>
                   3437: 
                   3438:           <dl>
1.2     ! hubertf  3439:             <dt><span class="sect1"><a href="#id2564294">6.1. Is
1.1       grant    3440:             there a mailing list for pkg-related
                   3441:             discussion?</a></span></dt>
                   3442: 
1.2     ! hubertf  3443:             <dt><span class="sect1"><a href="#id2564324">6.2.
1.1       grant    3444:             Where's the pkgviews documentation?</a></span></dt>
                   3445: 
1.2     ! hubertf  3446:             <dt><span class="sect1"><a href="#id2564337">6.3.
1.1       grant    3447:             Utilities for package management
                   3448:             (pkgtools)</a></span></dt>
                   3449: 
1.2     ! hubertf  3450:             <dt><span class="sect1"><a href="#id2564562">6.4. How
1.1       grant    3451:             to use pkgsrc as non-root</a></span></dt>
                   3452: 
1.2     ! hubertf  3453:             <dt><span class="sect1"><a href="#id2564642">6.5. How
1.1       grant    3454:             can I install/use XFree86 from pkgsrc?</a></span></dt>
                   3455: 
1.2     ! hubertf  3456:             <dt><span class="sect1"><a href="#id2564669">6.6. How
1.1       grant    3457:             can I install/use X.org from pkgsrc?</a></span></dt>
                   3458: 
1.2     ! hubertf  3459:             <dt><span class="sect1"><a href="#id2564697">6.7. How
1.1       grant    3460:             to fetch files from behind a firewall</a></span></dt>
                   3461: 
1.2     ! hubertf  3462:             <dt><span class="sect1"><a href="#id2564711">6.8. How
1.1       grant    3463:             do I tell make fetch to do passive FTP?</a></span></dt>
                   3464: 
1.2     ! hubertf  3465:             <dt><span class="sect1"><a href="#id2564762">6.9. How
1.1       grant    3466:             to fetch all distfiles at once</a></span></dt>
                   3467: 
1.2     ! hubertf  3468:             <dt><span class="sect1"><a href="#id2564970">6.10. What
1.1       grant    3469:             does Don't know how to make /usr/share/tmac/tmac.andoc
                   3470:             mean?</a></span></dt>
                   3471: 
1.2     ! hubertf  3472:             <dt><span class="sect1"><a href="#id2565009">6.11. What
1.1       grant    3473:             does Could not find bsd.own.mk mean?</a></span></dt>
                   3474: 
1.2     ! hubertf  3475:             <dt><span class="sect1"><a href="#id2565066">6.12.
1.1       grant    3476:             Using 'sudo' with pkgsrc</a></span></dt>
                   3477: 
                   3478:             <dt><span class="sect1"><a href="#faq.conf">6.13.
                   3479:             Configuration files handling and
                   3480:             placement</a></span></dt>
                   3481: 
                   3482:             <dt><span class="sect1"><a href="#audit-packages">6.14.
                   3483:             Automated security checks</a></span></dt>
                   3484:           </dl>
                   3485:         </div>
                   3486: 
                   3487:         <p>This section contains hints, tips &amp; tricks on
                   3488:         special things in pkgsrc that we didn't find a better place
                   3489:         for in the previous chapters, and it contains items for
                   3490:         both pkgsrc users and developers.</p>
                   3491: 
                   3492:         <div class="sect1" lang="en" xml:lang="en">
                   3493:           <div class="titlepage">
                   3494:             <div>
                   3495:               <div>
                   3496:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  3497:                 "id2564294" id="id2564294"></a>6.1.&nbsp;Is there a
1.1       grant    3498:                 mailing list for pkg-related discussion?</h2>
                   3499:               </div>
                   3500:             </div>
                   3501:           </div>
                   3502: 
                   3503:           <p>Yes, <tt class="email">&lt;<a href=
                   3504:           "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</tt>
                   3505:           is the list for discussing package related issues. To
                   3506:           subscribe do:</p>
                   3507:           <pre class="programlisting">
                   3508: <tt class=
                   3509: "prompt">%</tt> echo subscribe tech-pkg | mail majordomo@NetBSD.org
                   3510: </pre>
                   3511: 
                   3512:           <p>An archive of the list is available at <a href=
                   3513:           "http://mail-index.NetBSD.org/tech-pkg/" target=
                   3514:           "_top">http://mail-index.NetBSD.org/tech-pkg/</a>.</p>
                   3515:         </div>
                   3516: 
                   3517:         <div class="sect1" lang="en" xml:lang="en">
                   3518:           <div class="titlepage">
                   3519:             <div>
                   3520:               <div>
                   3521:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  3522:                 "id2564324" id="id2564324"></a>6.2.&nbsp;Where's
1.1       grant    3523:                 the pkgviews documentation?</h2>
                   3524:               </div>
                   3525:             </div>
                   3526:           </div>
                   3527: 
                   3528:           <p>Pkgviews is tightly integrated with buildlink. You can
                   3529:           find a pkgviews User's guide in <tt class=
                   3530:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</tt>.</p>
                   3531:         </div>
                   3532: 
                   3533:         <div class="sect1" lang="en" xml:lang="en">
                   3534:           <div class="titlepage">
                   3535:             <div>
                   3536:               <div>
                   3537:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  3538:                 "id2564337" id="id2564337"></a>6.3.&nbsp;Utilities
1.1       grant    3539:                 for package management (pkgtools)</h2>
                   3540:               </div>
                   3541:             </div>
                   3542:           </div>
                   3543: 
                   3544:           <p>The <tt class="filename">pkgsrc/pkgtools</tt>
                   3545:           directory pkgtools contains a number of useful utilities
                   3546:           for both users and developers of pkgsrc. This section
                   3547:           attempts only to make the reader aware of the utilities
                   3548:           and when they might be useful, and not to duplicate the
                   3549:           documentation that comes with each package.</p>
                   3550: 
                   3551:           <p>Utilities used by pkgsrc (automatically installed when
                   3552:           needed):</p>
                   3553: 
                   3554:           <div class="itemizedlist">
                   3555:             <ul type="disc">
                   3556:               <li>
                   3557:                 <p><a xmlns=
                   3558:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3559:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.2     ! hubertf  3560:                    class="pkgname">pkgtools/x11-links</a>: symlinks
        !          3561:                    for use by buildlink</p>
1.1       grant    3562:               </li>
                   3563:             </ul>
                   3564:           </div>
                   3565: 
                   3566:           <p>OS tool augmentation (automatically installed when
                   3567:           needed):</p>
                   3568: 
                   3569:           <div class="itemizedlist">
                   3570:             <ul type="disc">
                   3571:               <li>
                   3572:                 <p><a xmlns=
                   3573:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3574:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.2     ! hubertf  3575:                    class="pkgname">pkgtools/digest</a>: calculates
        !          3576:                    SHA1 checksums (and other kinds)</p>
1.1       grant    3577:               </li>
                   3578: 
                   3579:               <li>
                   3580:                 <p><a xmlns=
                   3581:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3582:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.2     ! hubertf  3583:                    class="pkgname">pkgtools/libnbcompat</a>: compat
        !          3584:                    library for pkg tools</p>
1.1       grant    3585:               </li>
                   3586: 
                   3587:               <li>
                   3588:                 <p><a xmlns=
                   3589:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3590:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.2     ! hubertf  3591:                    class="pkgname">pkgtools/mtree</a>: installed on
        !          3592:                    non-BSD systems due to lack of native mtree</p>
1.1       grant    3593:               </li>
                   3594: 
                   3595:               <li>
                   3596:                 <p><a xmlns=
                   3597:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3598:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.2     ! hubertf  3599:                    class="pkgname">pkgtools/pkg_install</a>:
        !          3600:                    up-to-date replacement for
        !          3601:                    /usr/sbin/pkg_install, or for use on operating
        !          3602:                    systems where pkg_install is not present</p>
1.1       grant    3603:               </li>
                   3604:             </ul>
                   3605:           </div>
                   3606: 
                   3607:           <p>Utilities used by pkgsrc (not automatically
                   3608:           installed):</p>
                   3609: 
                   3610:           <div class="itemizedlist">
                   3611:             <ul type="disc">
                   3612:               <li>
                   3613:                 <p><a xmlns=
                   3614:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3615:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.2     ! hubertf  3616:                    class="pkgname">pkgtools/pkg_tarup</a>: create a
        !          3617:                    binary package from an already-installed
        !          3618:                    package. used by 'make replace' to save the old
        !          3619:                    package</p>
1.1       grant    3620:               </li>
                   3621: 
                   3622:               <li>
                   3623:                 <p><a xmlns=
                   3624:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3625:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.2     ! hubertf  3626:                    class="pkgname">pkgtools/xpkgwedge</a>: put X11
        !          3627:                    packages someplace else (enabled by default)</p>
1.1       grant    3628:               </li>
                   3629:             </ul>
                   3630:           </div>
                   3631: 
                   3632:           <p>Utilities for keeping track of installed packages,
                   3633:           being up to date, etc:</p>
                   3634: 
                   3635:           <div class="itemizedlist">
                   3636:             <ul type="disc">
                   3637:               <li>
                   3638:                 <p><a xmlns=
                   3639:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3640:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.2     ! hubertf  3641:                    class="pkgname">pkgtools/pkg_chk</a>: installs
        !          3642:                    pkg_chk, which reports on packages whose
        !          3643:                    installed versions do not match the latest
        !          3644:                    pkgsrc entries</p>
1.1       grant    3645:               </li>
                   3646: 
                   3647:               <li>
                   3648:                 <p><a xmlns=
                   3649:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3650:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.2     ! hubertf  3651:                    class="pkgname">pkgtools/pkgdep</a>: makes
        !          3652:                    dependency graphs of packages, to aid in
        !          3653:                    choosing a strategy for updating</p>
1.1       grant    3654:               </li>
                   3655: 
                   3656:               <li>
                   3657:                 <p><a xmlns=
                   3658:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3659:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.2     ! hubertf  3660:                    class="pkgname">pkgtools/pkgdepgraph</a>: make
        !          3661:                    graph from above (uses graphviz)</p>
1.1       grant    3662:               </li>
                   3663: 
                   3664:               <li>
                   3665:                 <p><a xmlns=
                   3666:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3667:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.2     ! hubertf  3668:                    class="pkgname">pkgtools/pkglint</a>: This
        !          3669:                    provides two distinct abilities: check a pkgsrc
        !          3670:                    entry for correctness (pkglint) check for and
        !          3671:                    remove out-of-date distfiles and binary packages
        !          3672:                    (lintpkgsrc)</p>
1.1       grant    3673:               </li>
                   3674: 
                   3675:               <li>
                   3676:                 <p><a xmlns=
                   3677:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3678:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.2     ! hubertf  3679:                    class="pkgname">pkgtools/pkgsurvey</a>: report
        !          3680:                    what packages you have installed</p>
1.1       grant    3681:               </li>
                   3682:             </ul>
                   3683:           </div>
                   3684: 
                   3685:           <p>Utilities for people maintaining or creating
                   3686:           individual packages:</p>
                   3687: 
                   3688:           <div class="itemizedlist">
                   3689:             <ul type="disc">
                   3690:               <li>
                   3691:                 <p><a xmlns=
                   3692:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3693:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.2     ! hubertf  3694:                    class="pkgname">pkgtools/pkgdiff</a>: automate
        !          3695:                    making and maintaining patches for a package
        !          3696:                    (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1       grant    3697:               </li>
                   3698: 
                   3699:               <li>
                   3700:                 <p><a xmlns=
                   3701:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3702:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.2     ! hubertf  3703:                    class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
        !          3704:                    "http://www.w3.org/TR/xhtml1/transitional" href=
        !          3705:                    "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
        !          3706:                    class="pkgname">pkgtools/url2pkg</a>: aids in
        !          3707:                    converting to pkgsrc</p>
1.1       grant    3708:               </li>
                   3709: 
                   3710:               <li>
                   3711:                 <p><a xmlns=
                   3712:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3713:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.2     ! hubertf  3714:                    class="pkgname">pkgtools/gensolpkg</a>: convert
        !          3715:                    pkgsrc to a Solaris package</p>
1.1       grant    3716:               </li>
                   3717:             </ul>
                   3718:           </div>
                   3719: 
                   3720:           <p>Utilities for people maintaining pkgsrc (or more
                   3721:           obscure pkg utilities)</p>
                   3722: 
                   3723:           <div class="itemizedlist">
                   3724:             <ul type="disc">
                   3725:               <li>
                   3726:                 <p><a xmlns=
                   3727:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3728:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.2     ! hubertf  3729:                    class="pkgname">pkgtools/pkgconflict</a>: find
        !          3730:                    packages that conflict but aren't marked as
        !          3731:                    such</p>
1.1       grant    3732:               </li>
                   3733: 
                   3734:               <li>
                   3735:                 <p><a xmlns=
                   3736:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3737:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.2     ! hubertf  3738:                    class="pkgname">pkgtools/pkg_comp</a>: build
        !          3739:                    packages in a chrooted area</p>
1.1       grant    3740:               </li>
                   3741: 
                   3742:               <li>
                   3743:                 <p><a xmlns=
                   3744:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3745:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.2     ! hubertf  3746:                    class="pkgname">pkgtools/libkver</a>: spoof
        !          3747:                    kernel version for chrooted cross builds</p>
1.1       grant    3748:               </li>
                   3749:             </ul>
                   3750:           </div>
                   3751:         </div>
                   3752: 
                   3753:         <div class="sect1" lang="en" xml:lang="en">
                   3754:           <div class="titlepage">
                   3755:             <div>
                   3756:               <div>
                   3757:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  3758:                 "id2564562" id="id2564562"></a>6.4.&nbsp;How to use
1.1       grant    3759:                 pkgsrc as non-root</h2>
                   3760:               </div>
                   3761:             </div>
                   3762:           </div>
                   3763: 
                   3764:           <p>If you want to use pkgsrc as non-root user, you can
                   3765:           set some variables to make pkgsrc work under these
                   3766:           conditions. Please see <a href=
                   3767:           "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.2     ! hubertf  3768:              target="_top">this message</a> for more details.</p>
1.1       grant    3769:         </div>
                   3770: 
                   3771:         <div class="sect1" lang="en" xml:lang="en">
                   3772:           <div class="titlepage">
                   3773:             <div>
                   3774:               <div>
                   3775:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  3776:                 "id2564642" id="id2564642"></a>6.5.&nbsp;How can I
1.1       grant    3777:                 install/use XFree86 from pkgsrc?</h2>
                   3778:               </div>
                   3779:             </div>
                   3780:           </div>
                   3781: 
                   3782:           <p>If you want to use XFree86 from pkgsrc instead of your
                   3783:           system's own X11 (<tt class="filename">/usr/X11R6</tt>,
                   3784:           <tt class="filename">/usr/openwin</tt>, ...), you will
                   3785:           have to add the following lines into <tt class=
                   3786:           "filename">mk.conf</tt>:</p>
                   3787:           <pre class="programlisting">
                   3788:       X11_TYPE=XFree86
                   3789:     
                   3790: </pre>
                   3791:         </div>
                   3792: 
                   3793:         <div class="sect1" lang="en" xml:lang="en">
                   3794:           <div class="titlepage">
                   3795:             <div>
                   3796:               <div>
                   3797:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  3798:                 "id2564669" id="id2564669"></a>6.6.&nbsp;How can I
1.1       grant    3799:                 install/use X.org from pkgsrc?</h2>
                   3800:               </div>
                   3801:             </div>
                   3802:           </div>
                   3803: 
                   3804:           <p>If you want to use X.org from pkgsrc instead of your
                   3805:           system's own X11 (<tt class="filename">/usr/X11R6</tt>,
                   3806:           <tt class="filename">/usr/openwin</tt>, ...) you will
                   3807:           have to add the following lines into <tt class=
                   3808:           "filename">mk.conf</tt>:</p>
                   3809:           <pre class="programlisting">
                   3810:       X11_TYPE=xorg
                   3811:     
                   3812: </pre>
                   3813:         </div>
                   3814: 
                   3815:         <div class="sect1" lang="en" xml:lang="en">
                   3816:           <div class="titlepage">
                   3817:             <div>
                   3818:               <div>
                   3819:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  3820:                 "id2564697" id="id2564697"></a>6.7.&nbsp;How to
1.1       grant    3821:                 fetch files from behind a firewall</h2>
                   3822:               </div>
                   3823:             </div>
                   3824:           </div>
                   3825: 
                   3826:           <p>If you are sitting behind a firewall which does not
                   3827:           allow direct connections to Internet hosts (i.e.
                   3828:           non-NAT), you may specify the relevant proxy hosts. This
                   3829:           is done using an environment variable in the form of a
                   3830:           URL e.g. in Amdahl, the machine &#8220;<span class=
                   3831:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   3832:           firewalls, and it uses port 80 as the proxy port number.
                   3833:           So the proxy environment variables are:</p>
                   3834:           <pre class="programlisting">
                   3835:   ftp_proxy=ftp://orpheus.amdahl.com:80/
                   3836: http_proxy=http://orpheus.amdahl.com:80/
                   3837: </pre>
                   3838:         </div>
                   3839: 
                   3840:         <div class="sect1" lang="en" xml:lang="en">
                   3841:           <div class="titlepage">
                   3842:             <div>
                   3843:               <div>
                   3844:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  3845:                 "id2564711" id="id2564711"></a>6.8.&nbsp;How do I
1.1       grant    3846:                 tell <span><b class="command">make fetch</b></span>
                   3847:                 to do passive FTP?</h2>
                   3848:               </div>
                   3849:             </div>
                   3850:           </div>
                   3851: 
                   3852:           <p>This depends on which utility is used to retrieve
                   3853:           distfiles. From <tt class="filename">bsd.pkg.mk</tt>,
                   3854:           <tt class="varname">FETCH_CMD</tt> is assigned the first
                   3855:           available command from the following list:</p>
                   3856:           <pre class="programlisting">
                   3857: ${LOCALBASE}/bin/ftp
                   3858: /usr/bin/ftp
                   3859: </pre>
                   3860: 
                   3861:           <p>On a default NetBSD installation, this will be
                   3862:           <tt class="filename">/usr/bin/ftp</tt>, which
                   3863:           automatically tries passive connections first, and falls
                   3864:           back to active connections if the server refuses to do
                   3865:           passive. For the other tools, add the following to your
                   3866:           <tt class="filename">/etc/mk.conf</tt> file: <tt class=
                   3867:           "varname">PASSIVE_FETCH=1</tt>.</p>
                   3868: 
                   3869:           <p>Having that option present will prevent <tt class=
                   3870:           "filename">/usr/bin/ftp</tt> from falling back to active
                   3871:           transfers.</p>
                   3872:         </div>
                   3873: 
                   3874:         <div class="sect1" lang="en" xml:lang="en">
                   3875:           <div class="titlepage">
                   3876:             <div>
                   3877:               <div>
                   3878:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  3879:                 "id2564762" id="id2564762"></a>6.9.&nbsp;How to
1.1       grant    3880:                 fetch all distfiles at once</h2>
                   3881:               </div>
                   3882:             </div>
                   3883:           </div>
                   3884: 
                   3885:           <p>You would like to download all the distfiles in a
                   3886:           single batch from work or university, where you can't run
                   3887:           a <span><b class="command">make fetch</b></span>. There
                   3888:           is an archive of distfiles on <a href=
                   3889:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   3890:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   3891:           entire directory may not be appropriate.</p>
                   3892: 
                   3893:           <p>The answer here is to do a <span><b class=
                   3894:           "command">make fetch-list</b></span> in <tt class=
                   3895:           "filename">/usr/pkgsrc</tt> or one of it's
                   3896:           subdirectories, carry the resulting list to your machine
                   3897:           at work/school and use it there If you don't have a
                   3898:           NetBSD-compatible ftp(1) (like lukemftp) at work, don't
                   3899:           forget to set <tt class="varname">FETCH_CMD</tt> to
                   3900:           something that fetches a URL:</p>
                   3901: 
                   3902:           <p>At home:</p>
                   3903:           <pre class="screen">
                   3904: <tt class="prompt">%</tt> <b class=
                   3905: "userinput"><tt>cd /usr/pkgsrc</tt></b>
                   3906: <tt class="prompt">%</tt> <b class=
                   3907: "userinput"><tt>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</tt></b>
                   3908: <tt class="prompt">%</tt> <b class=
                   3909: "userinput"><tt>scp /tmp/fetch.sh work:/tmp</tt></b>
                   3910: </pre>
                   3911: 
                   3912:           <p>At work:</p>
                   3913:           <pre class="screen">
                   3914: <tt class="prompt">%</tt> <b class=
                   3915: "userinput"><tt>sh /tmp/fetch.sh</tt></b>
                   3916: </pre>
                   3917: 
                   3918:           <p>then tar up <tt class="filename">/tmp/distfiles</tt>
                   3919:           and take it home.</p>
                   3920: 
                   3921:           <p>If you have a machine running NetBSD, and you want to
                   3922:           get <span class="emphasis"><em>all</em></span> distfiles
                   3923:           (even ones that aren't for your machine architecture),
                   3924:           you can do so by using the above-mentioned
                   3925:           <span><b class="command">make fetch-list</b></span>
                   3926:           approach, or fetch the distfiles directly by running:</p>
                   3927:           <pre class="screen">
                   3928: <tt class="prompt">%</tt> <b class=
                   3929: "userinput"><tt>make mirror-distfiles</tt></b>
                   3930: </pre>
                   3931: 
                   3932:           <p>If you even decide to ignore <tt class=
                   3933:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</tt>, then you can
                   3934:           get everything by running:</p>
                   3935:           <pre class="screen">
                   3936: <tt class="prompt">%</tt> <b class=
                   3937: "userinput"><tt>make fetch NO_SKIP=yes</tt></b>
                   3938: </pre>
                   3939:         </div>
                   3940: 
                   3941:         <div class="sect1" lang="en" xml:lang="en">
                   3942:           <div class="titlepage">
                   3943:             <div>
                   3944:               <div>
                   3945:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  3946:                 "id2564970" id="id2564970"></a>6.10.&nbsp;What does
1.1       grant    3947:                 &#8220;<span class="quote">Don't know how to make
                   3948:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   3949:               </div>
                   3950:             </div>
                   3951:           </div>
                   3952: 
                   3953:           <p>When compiling the <a xmlns=
                   3954:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3955:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.2     ! hubertf  3956:              class="pkgname">pkgtools/pkg_install</a> package, you
        !          3957:              get the error from make that it doesn't know how to
        !          3958:              make <tt class=
        !          3959:              "filename">/usr/share/tmac/tmac.andoc</tt>? This
        !          3960:              indicates that you don't have installed the
        !          3961:              &#8220;<span class="quote">text</span>&#8221; set on
        !          3962:              your machine (nroff, ...). It is recommended to do
        !          3963:              that to format manpages.</p>
1.1       grant    3964: 
                   3965:           <p>In the case of the <a xmlns=
                   3966:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3967:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.2     ! hubertf  3968:              class="pkgname">pkgtools/pkg_install</a> package, you
        !          3969:              can get away with setting <tt class=
        !          3970:              "varname">NOMAN=YES</tt> either in the environment or
        !          3971:              in <tt class="filename">/etc/mk.conf</tt>.</p>
1.1       grant    3972:         </div>
                   3973: 
                   3974:         <div class="sect1" lang="en" xml:lang="en">
                   3975:           <div class="titlepage">
                   3976:             <div>
                   3977:               <div>
                   3978:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  3979:                 "id2565009" id="id2565009"></a>6.11.&nbsp;What does
1.1       grant    3980:                 &#8220;<span class="quote">Could not find
                   3981:                 bsd.own.mk</span>&#8221; mean?</h2>
                   3982:               </div>
                   3983:             </div>
                   3984:           </div>
                   3985: 
                   3986:           <p>You didn't install the compiler set, <tt class=
                   3987:           "filename">comp.tgz</tt>, when you installed your NetBSD
                   3988:           machine. Please get it and install it, by extracting it
                   3989:           in <tt class="filename">/</tt>:</p>
                   3990:           <pre class="screen">
                   3991: <tt class="prompt">#</tt> <b class="userinput"><tt>cd /</tt></b>
                   3992: <tt class="prompt">#</tt> <b class=
                   3993: "userinput"><tt>tar --unlink -zxvpf .../comp.tgz</tt></b>
                   3994: </pre>
                   3995: 
                   3996:           <p><tt class="filename">comp.tgz</tt> is part of every
                   3997:           NetBSD release. Get the one that corresponds to your
                   3998:           release (determine via <span><b class="command">uname
                   3999:           -r</b></span>).</p>
                   4000:         </div>
                   4001: 
                   4002:         <div class="sect1" lang="en" xml:lang="en">
                   4003:           <div class="titlepage">
                   4004:             <div>
                   4005:               <div>
                   4006:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  4007:                 "id2565066" id="id2565066"></a>6.12.&nbsp;Using
1.1       grant    4008:                 'sudo' with pkgsrc</h2>
                   4009:               </div>
                   4010:             </div>
                   4011:           </div>
                   4012: 
                   4013:           <p>When installing packages as non-root user and using
                   4014:           the just-in-time su(1) feature of pkgsrc, it can become
                   4015:           annoying to type in the root password for each required
                   4016:           package installed. To avoid this, the sudo package can be
                   4017:           used, which does password caching over a limited time. To
                   4018:           use it, install sudo (either as binary package or from
                   4019:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   4020:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.2     ! hubertf  4021:              class="pkgname">security/sudo</a>) and then put the
        !          4022:              following into your <tt class=
        !          4023:              "filename">/etc/mk.conf</tt>:</p>
1.1       grant    4024:           <pre class="programlisting">
                   4025:         .if exists(/usr/pkg/bin/sudo)
                   4026:         SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
                   4027:         .endif
                   4028:     
                   4029: </pre>
                   4030:         </div>
                   4031: 
                   4032:         <div class="sect1" lang="en" xml:lang="en">
                   4033:           <div class="titlepage">
                   4034:             <div>
                   4035:               <div>
                   4036:                 <h2 class="title" style="clear: both"><a name=
                   4037:                 "faq.conf" id=
                   4038:                 "faq.conf"></a>6.13.&nbsp;Configuration files
                   4039:                 handling and placement</h2>
                   4040:               </div>
                   4041:             </div>
                   4042:           </div>
                   4043: 
                   4044:           <p>The global variable <tt class=
                   4045:           "varname">PKG_SYSCONFBASE</tt> (and some others) can be
                   4046:           set by the system administrator in <tt class=
                   4047:           "filename">/etc/mk.conf</tt> to define the place where
                   4048:           configuration files get installed. Therefore, packages
                   4049:           must be adapted to support this feature. Keep in mind
                   4050:           that you should only install files that are strictly
                   4051:           necessary in the configuration directory, files that can
                   4052:           go to <tt class="filename">$PREFIX/share</tt> should go
                   4053:           there.</p>
                   4054: 
                   4055:           <p>We will take a look at available variables first
                   4056:           (<tt class="filename">bsd.pkg.mk</tt> contains more
                   4057:           information). <tt class="varname">PKG_SYSCONFDIR</tt> is
                   4058:           where the configuration files for a package may be found
                   4059:           (that is, the full path, e.g. <tt class=
                   4060:           "filename">/etc</tt> or <tt class=
                   4061:           "filename">/usr/pkg/etc</tt>). This value may be
                   4062:           customized in various ways:</p>
                   4063: 
                   4064:           <div class="orderedlist">
                   4065:             <ol type="1">
                   4066:               <li>
                   4067:                 <p><tt class="varname">PKG_SYSCONFBASE</tt> is the
                   4068:                 main config directory under which all package
                   4069:                 configuration files are to be found. Users will
                   4070:                 typically want to set it to <tt class=
                   4071:                 "filename">/etc</tt>, or accept the default
                   4072:                 location of <tt class=
                   4073:                 "filename">$PREFIX/etc</tt>.</p>
                   4074:               </li>
                   4075: 
                   4076:               <li>
                   4077:                 <p><tt class="varname">PKG_SYSCONFSUBDIR</tt> is
                   4078:                 the subdirectory of <tt class=
                   4079:                 "varname">PKG_SYSCONFBASE</tt> under which the
                   4080:                 configuration files for a particular package may be
                   4081:                 found. Defaults to <tt class=
                   4082:                 "varname">${SYSCONFBASE}</tt>.</p>
                   4083:               </li>
                   4084: 
                   4085:               <li>
                   4086:                 <p><tt class="varname">PKG_SYSCONFVAR</tt> is the
                   4087:                 special suffix used to distinguish any overriding
                   4088:                 values for a particular package (see next item). It
                   4089:                 defaults to <tt class="varname">${PKGBASE}</tt>,
                   4090:                 but for a collection of related packages that
                   4091:                 should all have the same <tt class=
                   4092:                 "varname">PKG_SYSCONFDIR</tt> value, it can be set
                   4093:                 in each of the package Makefiles to a common
                   4094:                 value.</p>
                   4095:               </li>
                   4096: 
                   4097:               <li>
                   4098:                 <p><tt class=
                   4099:                 "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>
                   4100:                 overrides the value of <tt class=
                   4101:                 "varname">${PKG_SYSCONFDIR}</tt> for packages with
                   4102:                 the same value for <tt class=
                   4103:                 "varname">PKG_SYSCONFVAR</tt>.</p>
                   4104: 
                   4105:                 <p>As an example, all the various KDE packages may
                   4106:                 want to set <tt class="varname">PKG_SYSCONFVAR</tt>
                   4107:                 to &#8220;<span class="quote">kde</span>&#8221; so
                   4108:                 admins can set <tt class=
                   4109:                 "varname">PKG_SYSCONFDIR.kde</tt> in <tt class=
                   4110:                 "filename">/etc/mk.conf</tt> to define where to
                   4111:                 install KDE config files.</p>
                   4112:               </li>
                   4113:             </ol>
                   4114:           </div>
                   4115: 
                   4116:           <p>Programs' configuration directory should be defined
                   4117:           during the configure stage. Packages that use GNU
                   4118:           autoconf can usually do this by using the
                   4119:           &#8220;<span class="quote">--sysconfdir</span>&#8221;
                   4120:           parameter, but this brings some problems as we will see
                   4121:           now. When you change this pathname in packages, you
                   4122:           should not allow them to install files in that directory
                   4123:           directly. Instead they need to install those files under
                   4124:           <tt class="filename">share/examples/${PKGNAME}</tt> so
                   4125:           <tt class="filename">PLIST</tt> can register them.</p>
                   4126: 
                   4127:           <p>Once you have the required configuration files in
                   4128:           place (under the <tt class="filename">share/examples</tt>
                   4129:           directory) the variable <tt class=
                   4130:           "varname">CONF_FILES</tt> should be set to copy them into
                   4131:           <tt class="varname">PKG_SYSCONFDIR</tt>. The contents of
                   4132:           this variable is formed by pairs of filenames; the first
                   4133:           element of the pair specifies the file inside the
                   4134:           examples directory (registered by <tt class=
                   4135:           "filename">PLIST</tt>) and the second element specifies
                   4136:           the target file. This is done this way to allow binary
                   4137:           packages to place files in the right directory using
                   4138:           <tt class="filename">INSTALL</tt>/<tt class=
                   4139:           "filename">DEINSTALL</tt> scripts which are created
                   4140:           automatically. The package <tt class=
                   4141:           "filename">Makefile</tt> must also set <tt class=
                   4142:           "varname">USE_PKGINSTALL=YES</tt> to use these
                   4143:           automatically generated scripts. The automatic copying of
                   4144:           config files can be toggled by setting the environment
                   4145:           variable <tt class="varname">PKG_CONFIG</tt> prior to
                   4146:           package installation.</p>
                   4147: 
                   4148:           <p>Here is an example, taken from mail/mutt/Makefile:</p>
                   4149:           <pre class="programlisting">
                   4150:   EGDIR=            ${PREFIX}/share/doc/mutt/samples
                   4151: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   4152: </pre>
                   4153: 
                   4154:           <p>As you can see, this package installs configuration
                   4155:           files inside <tt class="varname">EGDIR</tt>, which are
                   4156:           registered by <tt class="filename">PLIST</tt>. After
                   4157:           that, the variable <tt class="varname">CONF_FILES</tt>
                   4158:           lists the installed file first and then the target file.
                   4159:           Users will also get an automatic message when files are
                   4160:           installed using this method.</p>
                   4161:         </div>
                   4162: 
                   4163:         <div class="sect1" lang="en" xml:lang="en">
                   4164:           <div class="titlepage">
                   4165:             <div>
                   4166:               <div>
                   4167:                 <h2 class="title" style="clear: both"><a name=
                   4168:                 "audit-packages" id=
                   4169:                 "audit-packages"></a>6.14.&nbsp;Automated security
                   4170:                 checks</h2>
                   4171:               </div>
                   4172:             </div>
                   4173:           </div>
                   4174: 
                   4175:           <p>Please be aware that there can often be bugs in
                   4176:           third-party software, and some of these bugs can leave a
                   4177:           machine vulnerable to exploitation by attackers. In an
                   4178:           effort to lessen the exposure, the NetBSD packages team
                   4179:           maintains a database of known-exploits to packages which
                   4180:           have at one time been included in pkgsrc. The database
                   4181:           can be downloaded automatically, and a security audit of
                   4182:           all packages installed on a system can take place. To do
                   4183:           this, install the <a xmlns=
                   4184:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4185:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.2     ! hubertf  4186:              class="pkgname">security/audit-packages</a> package.
        !          4187:              It has two components:</p>
1.1       grant    4188: 
                   4189:           <div class="orderedlist">
                   4190:             <ol type="1">
                   4191:               <li>
                   4192:                 <p>&#8220;<span class=
                   4193:                 "quote">download-vulnerability-list</span>&#8221;,
                   4194:                 an easy way to download a list of the security
                   4195:                 vulnerabilities information. This list is kept up
                   4196:                 to date by the NetBSD security officer and the
                   4197:                 NetBSD packages team, and is distributed from the
                   4198:                 NetBSD ftp server:</p>
                   4199: 
                   4200:                 <p><a href=
                   4201:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.2     ! hubertf  4202:                    target=
        !          4203:                    "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    4204:               </li>
                   4205: 
                   4206:               <li>
                   4207:                 <p>&#8220;<span class=
                   4208:                 "quote">audit-packages</span>&#8221;, an easy way
                   4209:                 to audit the current machine, checking each
                   4210:                 vulnerability which is known. If a vulnerable
                   4211:                 package is installed, it will be shown by output to
                   4212:                 stdout, including a description of the type of
                   4213:                 vulnerability, and a URL containing more
                   4214:                 information.</p>
                   4215:               </li>
                   4216:             </ol>
                   4217:           </div>
                   4218: 
                   4219:           <p>Use of the audit-packages package is strongly
                   4220:           recommended!</p>
                   4221: 
                   4222:           <p>The following message is displayed as part of the
                   4223:           audit-packages installation procedure:</p>
                   4224:           <pre class="screen">
                   4225: ===========================================================================
                   4226: $NetBSD: faq.xml,v 1.1.1.1 2004/10/21 14:27:43 grant Exp $
                   4227: 
                   4228: You may wish to have the vulnerabilities file downloaded daily so that
                   4229: it remains current.  This may be done by adding an appropriate entry
                   4230: to the root users crontab(5) entry.  For example the entry
                   4231: 
                   4232: # download vulnerabilities file
                   4233: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list &gt;/dev/null 2&gt;&amp;1
                   4234: 
                   4235: will update the vulnerability list every day at 3AM. You may wish to do
                   4236: this more often than once a day.
                   4237: 
                   4238: In addition, you may wish to run the package audit from the daily
                   4239: security script.  This may be accomplished by adding the following
                   4240: lines to /etc/security.local
                   4241: 
                   4242: if [ -x ${PREFIX}/sbin/audit-packages ]; then
                   4243:           ${PREFIX}/sbin/audit-packages
                   4244: fi
                   4245: 
                   4246: ===========================================================================
                   4247:     
                   4248: </pre>
                   4249:         </div>
                   4250:       </div>
                   4251:     </div>
                   4252: 
                   4253:     <div class="part" lang="en" xml:lang="en">
                   4254:       <div class="titlepage">
                   4255:         <div>
                   4256:           <div>
                   4257:             <h1 class="title"><a name="developers-guide" id=
1.2     ! hubertf  4258:             "developers-guide"></a>The pkgsrc developer's
        !          4259:             guide</h1>
1.1       grant    4260:           </div>
                   4261:         </div>
                   4262:       </div>
                   4263: 
                   4264:       <div class="toc">
                   4265:         <p><b>Table of Contents</b></p>
                   4266: 
                   4267:         <dl>
                   4268:           <dt><span class="chapter"><a href="#components">7.
                   4269:           Package components - files, directories and
                   4270:           contents</a></span></dt>
                   4271: 
                   4272:           <dd>
                   4273:             <dl>
                   4274:               <dt><span class="sect1"><a href=
                   4275:               "#components.Makefile">7.1. Makefile</a></span></dt>
                   4276: 
                   4277:               <dt><span class="sect1"><a href=
                   4278:               "#components.distinfo">7.2. distinfo</a></span></dt>
                   4279: 
                   4280:               <dt><span class="sect1"><a href=
                   4281:               "#components.patches">7.3. patches/*</a></span></dt>
                   4282: 
1.2     ! hubertf  4283:               <dt><span class="sect1"><a href="#id2566242">7.4.
1.1       grant    4284:               Other mandatory files</a></span></dt>
                   4285: 
                   4286:               <dt><span class="sect1"><a href=
                   4287:               "#components.optional">7.5. Optional
                   4288:               files</a></span></dt>
                   4289: 
1.2     ! hubertf  4290:               <dt><span class="sect1"><a href="#id2566436">7.6.
1.1       grant    4291:               work*</a></span></dt>
                   4292: 
1.2     ! hubertf  4293:               <dt><span class="sect1"><a href="#id2566523">7.7.
1.1       grant    4294:               files/*</a></span></dt>
                   4295:             </dl>
                   4296:           </dd>
                   4297: 
                   4298:           <dt><span class="chapter"><a href="#plist">8. PLIST
                   4299:           issues</a></span></dt>
                   4300: 
                   4301:           <dd>
                   4302:             <dl>
1.2     ! hubertf  4303:               <dt><span class="sect1"><a href="#id2566578">8.1. RCS
1.1       grant    4304:               ID</a></span></dt>
                   4305: 
1.2     ! hubertf  4306:               <dt><span class="sect1"><a href="#id2566593">8.2.
1.1       grant    4307:               Semi-automatic PLIST generation</a></span></dt>
                   4308: 
                   4309:               <dt><span class="sect1"><a href="#print-PLIST">8.3.
                   4310:               Tweaking output of make print-PLIST</a></span></dt>
                   4311: 
                   4312:               <dt><span class="sect1"><a href="#plist.misc">8.4.
                   4313:               Variable substitution in PLIST</a></span></dt>
                   4314: 
1.2     ! hubertf  4315:               <dt><span class="sect1"><a href="#id2566914">8.5.
1.1       grant    4316:               Manpage-compression</a></span></dt>
                   4317: 
1.2     ! hubertf  4318:               <dt><span class="sect1"><a href="#id2566955">8.6.
1.1       grant    4319:               Changing PLIST source with PLIST_SRC</a></span></dt>
                   4320: 
1.2     ! hubertf  4321:               <dt><span class="sect1"><a href="#id2566972">8.7.
1.1       grant    4322:               Platform specific and differing
                   4323:               PLISTs</a></span></dt>
                   4324: 
                   4325:               <dt><span class="sect1"><a href=
                   4326:               "#faq.common-dirs">8.8. Sharing directories between
                   4327:               packages</a></span></dt>
                   4328:             </dl>
                   4329:           </dd>
                   4330: 
                   4331:           <dt><span class="chapter"><a href="#buildlink">9.
                   4332:           Buildlink methodology</a></span></dt>
                   4333: 
                   4334:           <dd>
                   4335:             <dl>
1.2     ! hubertf  4336:               <dt><span class="sect1"><a href="#id2567313">9.1.
1.1       grant    4337:               Converting packages to use buildlink3</a></span></dt>
                   4338: 
1.2     ! hubertf  4339:               <dt><span class="sect1"><a href="#id2567640">9.2.
1.1       grant    4340:               Writing buildlink3.mk files</a></span></dt>
                   4341: 
                   4342:               <dd>
                   4343:                 <dl>
                   4344:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4345:                   "#id2567709">9.2.1. Anatomy of a buildlink3.mk
1.1       grant    4346:                   file</a></span></dt>
                   4347: 
                   4348:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4349:                   "#id2568150">9.2.2. Updating
1.1       grant    4350:                   BUILDLINK_DEPENDS.pkg in buildlink3.mk
                   4351:                   files</a></span></dt>
                   4352:                 </dl>
                   4353:               </dd>
                   4354: 
1.2     ! hubertf  4355:               <dt><span class="sect1"><a href="#id2568229">9.3.
1.1       grant    4356:               Writing builtin.mk files</a></span></dt>
                   4357: 
                   4358:               <dd>
                   4359:                 <dl>
                   4360:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4361:                   "#id2568378">9.3.1. Anatomy of a builtin.mk
1.1       grant    4362:                   file</a></span></dt>
                   4363: 
                   4364:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4365:                   "#id2568537">9.3.2. Global preferences for native
1.1       grant    4366:                   or pkgsrc software</a></span></dt>
                   4367:                 </dl>
                   4368:               </dd>
                   4369:             </dl>
                   4370:           </dd>
                   4371: 
                   4372:           <dt><span class="chapter"><a href="#options">10. Options
                   4373:           handling</a></span></dt>
                   4374: 
                   4375:           <dd>
                   4376:             <dl>
1.2     ! hubertf  4377:               <dt><span class="sect1"><a href="#id2568610">10.1.
1.1       grant    4378:               Global default options</a></span></dt>
                   4379: 
1.2     ! hubertf  4380:               <dt><span class="sect1"><a href="#id2568625">10.2.
1.1       grant    4381:               Converting packages to use
                   4382:               bsd.options.mk</a></span></dt>
                   4383:             </dl>
                   4384:           </dd>
                   4385: 
                   4386:           <dt><span class="chapter"><a href="#build">11. The build
                   4387:           process</a></span></dt>
                   4388: 
                   4389:           <dd>
                   4390:             <dl>
                   4391:               <dt><span class="sect1"><a href="#build.prefix">11.1.
                   4392:               Program location</a></span></dt>
                   4393: 
1.2     ! hubertf  4394:               <dt><span class="sect1"><a href="#id2569369">11.2.
1.1       grant    4395:               Main targets</a></span></dt>
                   4396: 
                   4397:               <dt><span class="sect1"><a href=
                   4398:               "#build.helpful-targets">11.3. Other helpful
                   4399:               targets</a></span></dt>
                   4400:             </dl>
                   4401:           </dd>
                   4402: 
                   4403:           <dt><span class="chapter"><a href="#fixes">12. Notes on
                   4404:           fixes for packages</a></span></dt>
                   4405: 
                   4406:           <dd>
                   4407:             <dl>
1.2     ! hubertf  4408:               <dt><span class="sect1"><a href="#id2570766">12.1.
1.1       grant    4409:               General operation</a></span></dt>
                   4410: 
                   4411:               <dd>
                   4412:                 <dl>
                   4413:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4414:                   "#id2570770">12.1.1. How to pull in variables
1.1       grant    4415:                   from /etc/mk.conf</a></span></dt>
                   4416: 
                   4417:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4418:                   "#id2570853">12.1.2. Restricted
1.1       grant    4419:                   packages</a></span></dt>
                   4420: 
                   4421:                   <dt><span class="sect2"><a href=
                   4422:                   "#dependencies">12.1.3. Handling
                   4423:                   dependencies</a></span></dt>
                   4424: 
                   4425:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4426:                   "#id2571436">12.1.4. Handling conflicts with
1.1       grant    4427:                   other packages</a></span></dt>
                   4428: 
                   4429:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4430:                   "#id2571486">12.1.5. Packages that cannot or
1.1       grant    4431:                   should not be built</a></span></dt>
                   4432: 
                   4433:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4434:                   "#id2571512">12.1.6. Packages which should not be
1.1       grant    4435:                   deleted, once installed</a></span></dt>
                   4436: 
                   4437:                   <dt><span class="sect2"><a href=
                   4438:                   "#security-handling">12.1.7. Handling packages
                   4439:                   with security problems</a></span></dt>
                   4440: 
                   4441:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4442:                   "#id2571604">12.1.8. How to handle compiler
1.1       grant    4443:                   bugs</a></span></dt>
                   4444: 
                   4445:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4446:                   "#id2571626">12.1.9. How to handle incrementing
1.1       grant    4447:                   versions when fixing an existing
                   4448:                   package</a></span></dt>
                   4449: 
                   4450:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4451:                   "#id2571675">12.1.10. Portability of
1.1       grant    4452:                   packages</a></span></dt>
                   4453:                 </dl>
                   4454:               </dd>
                   4455: 
1.2     ! hubertf  4456:               <dt><span class="sect1"><a href="#id2571700">12.2.
1.1       grant    4457:               Possible downloading issues</a></span></dt>
                   4458: 
                   4459:               <dd>
                   4460:                 <dl>
                   4461:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4462:                   "#id2571703">12.2.1. Packages whose distfiles
1.1       grant    4463:                   aren't available for plain
                   4464:                   downloading</a></span></dt>
                   4465: 
                   4466:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4467:                   "#id2571902">12.2.2. How to handle modified
1.1       grant    4468:                   distfiles with the 'old' name</a></span></dt>
                   4469:                 </dl>
                   4470:               </dd>
                   4471: 
1.2     ! hubertf  4472:               <dt><span class="sect1"><a href="#id2571914">12.3.
1.1       grant    4473:               Configuration gotchas</a></span></dt>
                   4474: 
                   4475:               <dd>
                   4476:                 <dl>
                   4477:                   <dt><span class="sect2"><a href=
                   4478:                   "#fixes.libtool">12.3.1. Shared libraries -
                   4479:                   libtool</a></span></dt>
                   4480: 
                   4481:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4482:                   "#id2572390">12.3.2. Using libtool on GNU
1.1       grant    4483:                   packages that already support
                   4484:                   libtool</a></span></dt>
                   4485: 
                   4486:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4487:                   "#id2572474">12.3.3. GNU
1.1       grant    4488:                   Autoconf/Automake</a></span></dt>
                   4489:                 </dl>
                   4490:               </dd>
                   4491: 
1.2     ! hubertf  4492:               <dt><span class="sect1"><a href="#id2572519">12.4.
1.1       grant    4493:               Building considerations</a></span></dt>
                   4494: 
                   4495:               <dd>
                   4496:                 <dl>
                   4497:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4498:                   "#id2572522">12.4.1. CPP defines</a></span></dt>
1.1       grant    4499:                 </dl>
                   4500:               </dd>
                   4501: 
1.2     ! hubertf  4502:               <dt><span class="sect1"><a href="#id2572552">12.5.
1.1       grant    4503:               Package specific actions</a></span></dt>
                   4504: 
                   4505:               <dd>
                   4506:                 <dl>
                   4507:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4508:                   "#id2572555">12.5.1. Package configuration
1.1       grant    4509:                   files</a></span></dt>
                   4510: 
                   4511:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4512:                   "#id2572726">12.5.2. User
        !          4513:                   interaction</a></span></dt>
1.1       grant    4514: 
                   4515:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4516:                   "#id2572771">12.5.3. Handling
1.1       grant    4517:                   licenses</a></span></dt>
                   4518: 
                   4519:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4520:                   "#id2572922">12.5.4. Creating an account from a
1.1       grant    4521:                   package</a></span></dt>
                   4522: 
                   4523:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4524:                   "#id2573052">12.5.5. Installing score
1.1       grant    4525:                   files</a></span></dt>
                   4526: 
                   4527:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4528:                   "#id2573096">12.5.6. Packages providing login
1.1       grant    4529:                   shells</a></span></dt>
                   4530: 
                   4531:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4532:                   "#id2573222">12.5.7. Packages containing perl
1.1       grant    4533:                   scripts</a></span></dt>
                   4534: 
                   4535:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4536:                   "#id2573240">12.5.8. Packages with hardcoded
1.1       grant    4537:                   paths to other interpreters</a></span></dt>
                   4538: 
                   4539:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4540:                   "#id2573261">12.5.9. Packages installing perl
1.1       grant    4541:                   modules</a></span></dt>
                   4542: 
                   4543:                   <dt><span class="sect2"><a href=
                   4544:                   "#faq.info-files">12.5.10. Packages installing
                   4545:                   info files</a></span></dt>
                   4546: 
                   4547:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4548:                   "#id2573549">12.5.11. Packages installing GConf2
1.1       grant    4549:                   data files</a></span></dt>
                   4550: 
                   4551:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4552:                   "#id2573650">12.5.12. Packages installing
1.1       grant    4553:                   scrollkeeper data files</a></span></dt>
                   4554: 
                   4555:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4556:                   "#id2573701">12.5.13. Packages installing X11
1.1       grant    4557:                   fonts</a></span></dt>
                   4558: 
                   4559:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4560:                   "#id2573816">12.5.14. Packages installing GTK2
1.1       grant    4561:                   modules</a></span></dt>
                   4562: 
                   4563:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4564:                   "#id2573885">12.5.15. Packages installing SGML or
1.1       grant    4565:                   XML data</a></span></dt>
                   4566: 
                   4567:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4568:                   "#id2573938">12.5.16. Packages installing
1.1       grant    4569:                   extensions to the MIME database</a></span></dt>
                   4570: 
                   4571:                   <dt><span class="sect2"><a href=
1.2     ! hubertf  4572:                   "#id2574008">12.5.17. Packages using
1.1       grant    4573:                   intltool</a></span></dt>
                   4574:                 </dl>
                   4575:               </dd>
                   4576: 
1.2     ! hubertf  4577:               <dt><span class="sect1"><a href="#id2574022">12.6.
1.1       grant    4578:               Feedback to the author</a></span></dt>
                   4579:             </dl>
                   4580:           </dd>
                   4581: 
                   4582:           <dt><span class="chapter"><a href="#debug">13.
                   4583:           Debugging</a></span></dt>
                   4584: 
                   4585:           <dt><span class="chapter"><a href="#submit">14.
                   4586:           Submitting and Committing</a></span></dt>
                   4587: 
                   4588:           <dd>
                   4589:             <dl>
1.2     ! hubertf  4590:               <dt><span class="sect1"><a href="#id2574484">14.1.
1.1       grant    4591:               Submitting your packages</a></span></dt>
                   4592: 
1.2     ! hubertf  4593:               <dt><span class="sect1"><a href="#id2574531">14.2.
1.1       grant    4594:               Committing: Importing a package into
                   4595:               CVS</a></span></dt>
                   4596: 
1.2     ! hubertf  4597:               <dt><span class="sect1"><a href="#id2574730">14.3.
        !          4598:               Updating a package to a newer version</a></span></dt>
1.1       grant    4599: 
1.2     ! hubertf  4600:               <dt><span class="sect1"><a href="#id2574818">14.4.
        !          4601:               Moving a package in pkgsrc</a></span></dt>
1.1       grant    4602:             </dl>
                   4603:           </dd>
                   4604:         </dl>
                   4605:       </div>
                   4606: 
                   4607:       <div class="chapter" lang="en" xml:lang="en">
                   4608:         <div class="titlepage">
                   4609:           <div>
                   4610:             <div>
                   4611:               <h2 class="title"><a name="components" id=
                   4612:               "components"></a>Chapter&nbsp;7.&nbsp;Package
                   4613:               components - files, directories and contents</h2>
                   4614:             </div>
                   4615:           </div>
                   4616:         </div>
                   4617: 
                   4618:         <div class="toc">
                   4619:           <p><b>Table of Contents</b></p>
                   4620: 
                   4621:           <dl>
                   4622:             <dt><span class="sect1"><a href=
                   4623:             "#components.Makefile">7.1. Makefile</a></span></dt>
                   4624: 
                   4625:             <dt><span class="sect1"><a href=
                   4626:             "#components.distinfo">7.2. distinfo</a></span></dt>
                   4627: 
                   4628:             <dt><span class="sect1"><a href=
                   4629:             "#components.patches">7.3. patches/*</a></span></dt>
                   4630: 
1.2     ! hubertf  4631:             <dt><span class="sect1"><a href="#id2566242">7.4. Other
1.1       grant    4632:             mandatory files</a></span></dt>
                   4633: 
                   4634:             <dt><span class="sect1"><a href=
                   4635:             "#components.optional">7.5. Optional
                   4636:             files</a></span></dt>
                   4637: 
1.2     ! hubertf  4638:             <dt><span class="sect1"><a href="#id2566436">7.6.
1.1       grant    4639:             work*</a></span></dt>
                   4640: 
1.2     ! hubertf  4641:             <dt><span class="sect1"><a href="#id2566523">7.7.
1.1       grant    4642:             files/*</a></span></dt>
                   4643:           </dl>
                   4644:         </div>
                   4645: 
                   4646:         <p>Whenever you're preparing a package, there are a number
                   4647:         of files involved which are described in the following
                   4648:         sections.</p>
                   4649: 
                   4650:         <div class="sect1" lang="en" xml:lang="en">
                   4651:           <div class="titlepage">
                   4652:             <div>
                   4653:               <div>
                   4654:                 <h2 class="title" style="clear: both"><a name=
                   4655:                 "components.Makefile" id=
                   4656:                 "components.Makefile"></a>7.1.&nbsp;<tt class=
                   4657:                 "filename">Makefile</tt></h2>
                   4658:               </div>
                   4659:             </div>
                   4660:           </div>
                   4661: 
                   4662:           <p>Building, installation and creation of a binary
                   4663:           package are all controlled by the package's <tt class=
                   4664:           "filename">Makefile</tt>.</p>
                   4665: 
                   4666:           <p>There is a <tt class="filename">Makefile</tt> for each
                   4667:           package. This file includes the standard <tt class=
                   4668:           "filename">bsd.pkg.mk</tt> file (referenced as <tt class=
                   4669:           "filename">../../mk/bsd.pkg.mk</tt>), which sets all the
                   4670:           definitions and actions necessary for the package to
                   4671:           compile and install itself. The mandatory variables are
                   4672:           the <tt class="varname">DISTNAME</tt> which specifies the
                   4673:           base name of the distribution file to be downloaded from
                   4674:           the site on the Internet, <tt class=
                   4675:           "varname">MASTER_SITES</tt> which specifies that site,
                   4676:           <tt class="varname">CATEGORIES</tt> which denotes the
                   4677:           categories into which the package falls, <tt class=
                   4678:           "varname">PKGNAME</tt> which is the name of the package,
                   4679:           the <tt class="varname">MAINTAINER</tt>'s name, and the
                   4680:           <tt class="varname">COMMENT</tt> variable, which should
                   4681:           contain a one-line description of the package (the
                   4682:           package name should not appear, it will be added
                   4683:           automatically). The maintainer variable is there so that
                   4684:           anyone who quibbles with the (always completely correct)
                   4685:           decisions taken by the guy who maintains the package can
                   4686:           complain vigorously, or send chocolate as a sign of
                   4687:           appreciation.</p>
                   4688: 
                   4689:           <p>The <tt class="varname">MASTER_SITES</tt> may be set
                   4690:           to one of the predefined sites:</p>
                   4691:           <pre class="programlisting">
                   4692:         ${MASTER_SITE_APACHE}
                   4693:         ${MASTER_SITE_DEBIAN}
                   4694:         ${MASTER_SITE_GNOME}
                   4695:         ${MASTER_SITE_GNU}
                   4696:         ${MASTER_SITE_GNUSTEP}
                   4697:         ${MASTER_SITE_MOZILLA}
                   4698:         ${MASTER_SITE_PERL_CPAN}
                   4699:         ${MASTER_SITE_SOURCEFORGE}
                   4700:         ${MASTER_SITE_SUNSITE}
                   4701:         ${MASTER_SITE_R_CRAN}
                   4702:         ${MASTER_SITE_SUSE}
                   4703:         ${MASTER_SITE_TEX_CTAN}
                   4704:         ${MASTER_SITE_XCONTRIB}
                   4705:         ${MASTER_SITE_XEMACS} 
                   4706: </pre>
                   4707: 
                   4708:           <p>If one of these predefined sites is chosen, you may
                   4709:           require the ability to specify a subdirectory of that
                   4710:           site. Since these macros may expand to more than one
                   4711:           actual site, you <span class=
                   4712:           "emphasis"><em>must</em></span> use the following
                   4713:           construct to specify a subdirectory:</p>
                   4714:           <pre class="programlisting">
                   4715:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   4716:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   4717: </pre>
                   4718: 
                   4719:           <p>Note the trailing slash after the subdirectory
                   4720:           name.</p>
                   4721: 
                   4722:           <div class="note" style=
                   4723:           "margin-left: 0.5in; margin-right: 0.5in;">
                   4724:             <h3 class="title">Note</h3>
                   4725: 
                   4726:             <p><tt class="varname">MASTER_SITE_SUBDIR</tt> has been
                   4727:             deprecated and <span class="emphasis"><em>should no
                   4728:             longer be used</em></span>.</p>
                   4729:           </div>
                   4730: 
                   4731:           <p>If the package has multiple <tt class=
                   4732:           "varname">DISTFILES</tt> or multiple <tt class=
                   4733:           "varname">PATCHFILES</tt> from different sites, set
                   4734:           <tt class="varname">SITES_foo</tt> to a list of URI's
                   4735:           where file &#8220;<span class="quote">foo</span>&#8221;
                   4736:           may be found. &#8220;<span class=
                   4737:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   4738:           <pre class="programlisting">
                   4739: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   4740: DISTFILES+=     foo-file.tar.gz
                   4741: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   4742:         http://www.somewhereelse.com/mirror/somehow/
                   4743: </pre>
                   4744: 
                   4745:           <p>Note that the normal default setting of <tt class=
                   4746:           "varname">DISTFILES</tt> must be made explicit if you
                   4747:           want to add to it (rather than replace it), as you
                   4748:           usually would.</p>
                   4749: 
                   4750:           <p>Currently the following values are available for
                   4751:           <tt class="varname">CATEGORIES</tt>. If more than one is
                   4752:           used, they need to be separated by spaces:</p>
                   4753:           <pre class="programlisting">
                   4754: archivers     cross         geography     meta-pkgs     security
                   4755: audio         databases     graphics      misc          shells
                   4756: benchmarks    devel         ham           multimedia    sysutils
                   4757: biology       editors       inputmethod   net           textproc
                   4758: cad           emulators     lang          news          time
                   4759: chat          finance       mail          parallel      wm
                   4760: comms         fonts         math          pkgtools      www
                   4761: converters    games         mbone         print         x11
                   4762: </pre>
                   4763: 
                   4764:           <p>Please pay attention to the following gotchas:</p>
                   4765: 
                   4766:           <div class="itemizedlist">
                   4767:             <ul type="disc">
                   4768:               <li>
                   4769:                 <p>Add <tt class="varname">MANCOMPRESSED</tt> if
                   4770:                 manpages are installed in compressed form by the
                   4771:                 package; see comment in <tt class=
                   4772:                 "filename">bsd.pkg.mk</tt>.</p>
                   4773:               </li>
                   4774: 
                   4775:               <li>
                   4776:                 <p>Replace <tt class="filename">/usr/local</tt>
                   4777:                 with &#8220;<span class=
                   4778:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   4779:                 patches, below).</p>
                   4780:               </li>
                   4781: 
                   4782:               <li>
                   4783:                 <p>If the package installs any info files, see
                   4784:                 <a href="#faq.info-files" title=
                   4785:                 "12.5.10.&nbsp;Packages installing info files">Section
                   4786:                 12.5.10, &#8220;Packages installing info
                   4787:                 files&#8221;</a>.</p>
                   4788:               </li>
                   4789: 
                   4790:               <li>
                   4791:                 <p>Set <tt class="varname">MAINTAINER</tt> to be
                   4792:                 yourself. If you really can't maintain the package
                   4793:                 for future updates, set it to <tt class=
                   4794:                 "email">&lt;<a href=
                   4795:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</tt>.</p>
                   4796:               </li>
                   4797: 
                   4798:               <li>
                   4799:                 <p>If a home page for the software in question
                   4800:                 exists, add the variable <tt class=
                   4801:                 "varname">HOMEPAGE</tt> right after <tt class=
                   4802:                 "varname">MAINTAINER</tt>. The value of this
                   4803:                 variable should be the URL for the home page.</p>
                   4804:               </li>
                   4805: 
                   4806:               <li>
                   4807:                 <p>Be sure to set the <tt class=
                   4808:                 "varname">COMMENT</tt> variable to a short
                   4809:                 description of the package, not containing the
                   4810:                 pkg's name.</p>
                   4811:               </li>
                   4812:             </ul>
                   4813:           </div>
                   4814:         </div>
                   4815: 
                   4816:         <div class="sect1" lang="en" xml:lang="en">
                   4817:           <div class="titlepage">
                   4818:             <div>
                   4819:               <div>
                   4820:                 <h2 class="title" style="clear: both"><a name=
                   4821:                 "components.distinfo" id=
                   4822:                 "components.distinfo"></a>7.2.&nbsp;<tt class=
                   4823:                 "filename">distinfo</tt></h2>
                   4824:               </div>
                   4825:             </div>
                   4826:           </div>
                   4827: 
                   4828:           <p>Most important, the mandatory message digest, or
                   4829:           checksum, of all the distfiles needed for the package to
                   4830:           compile, confirming they match the original file
                   4831:           distributed by the author. This ensures that the distfile
                   4832:           retrieved from the Internet has not been corrupted during
                   4833:           transfer or altered by a malign force to introduce a
                   4834:           security hole. It is generated using the <span><b class=
                   4835:           "command">make makesum</b></span> command. The digest
                   4836:           algorithm used was, at one stage, md5, but that was felt
                   4837:           lacking compared to sha1, and so sha1 is now the default
                   4838:           algorithm. The distfile size is also generated and stored
                   4839:           in new distinfo files. The <a xmlns=
                   4840:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4841:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.2     ! hubertf  4842:              class="pkgname">pkgtools/digest</a> utility calculates
        !          4843:              all of the digests in the distinfo file, and it
        !          4844:              provides various different algorithms. At the current
        !          4845:              time, the algorithms provided are: <span class=
        !          4846:              "emphasis"><em>md5</em></span>, <span class=
        !          4847:              "emphasis"><em>rmd160</em></span>, <span class=
        !          4848:              "emphasis"><em>sha1</em></span>, <span class=
        !          4849:              "emphasis"><em>sha256</em></span>, <span class=
        !          4850:              "emphasis"><em>sha384</em></span> and <span class=
        !          4851:              "emphasis"><em>sha512</em></span>.</p>
1.1       grant    4852: 
                   4853:           <p>Some packages have different sets of distfiles on a
                   4854:           per architecture basis, for example <a xmlns=
                   4855:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4856:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.2     ! hubertf  4857:              class="pkgname">www/navigator</a>). These are kept in
        !          4858:              the same distinfo file and care should be taken when
        !          4859:              upgrading such a package to ensure distfile
        !          4860:              information is not lost.</p>
1.1       grant    4861: 
                   4862:           <p>The message digest/checksum for all the official
                   4863:           patches found in the <tt class="filename">patches/</tt>
                   4864:           directory (see <a href="#components.patches" title=
                   4865:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   4866:           &#8220;patches/*&#8221;</a>) for the package is also
                   4867:           stored in the <tt class="filename">distinfo</tt> file.
                   4868:           This is a message digest/checksum of all lines in the
                   4869:           patch file except the NetBSD RCS Id. This file is
                   4870:           generated by invoking <span><b class="command">make
                   4871:           makepatchsum</b></span> (or <span><b class="command">make
                   4872:           mps</b></span> if you're in a hurry).</p>
                   4873:         </div>
                   4874: 
                   4875:         <div class="sect1" lang="en" xml:lang="en">
                   4876:           <div class="titlepage">
                   4877:             <div>
                   4878:               <div>
                   4879:                 <h2 class="title" style="clear: both"><a name=
                   4880:                 "components.patches" id=
                   4881:                 "components.patches"></a>7.3.&nbsp;patches/*</h2>
                   4882:               </div>
                   4883:             </div>
                   4884:           </div>
                   4885: 
                   4886:           <p>This directory contains files that are used by the
                   4887:           <a href=
                   4888:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   4889:           <span class="citerefentry"><span class=
                   4890:           "refentrytitle">patch</span>(1)</span></a> command to
                   4891:           modify the sources as distributed in the distribution
                   4892:           file into a form that will compile and run perfectly on
                   4893:           NetBSD. The files are applied successively in alphabetic
                   4894:           order (as returned by a shell &#8220;<span class=
                   4895:           "quote">patches/patch-*</span>&#8221; glob expansion), so
                   4896:           <tt class="filename">patch-aa</tt> is applied before
                   4897:           <tt class="filename">patch-ab</tt>, etc.</p>
                   4898: 
                   4899:           <p>Patch files which are optional and will depend on
                   4900:           local site configuration can be included with names
                   4901:           matching the pattern <tt class=
                   4902:           "filename">patches/patch-optional-*</tt>. Their suffixes
                   4903:           should match the configuration options. The selected
                   4904:           optional patch file names should be assigned to the
                   4905:           variable <tt class="varname">OPTIONAL_PATCHFILES</tt>.
                   4906:           They will not be applied by default.</p>
                   4907: 
                   4908:           <p>For example if a package data file needs patching to
                   4909:           indicate the default local printer paper size as
                   4910:           specified in the <tt class="varname">$PAPERSIZE</tt> file
                   4911:           you can include patches for all the possible paper sizes
                   4912:           other than the one the package comes configured for by
                   4913:           default. In this case you might have a patch called
                   4914:           "<tt class=
                   4915:           "filename">patch-optional-Letter-papersize</tt>" and/or
                   4916:           another patch called "<tt class=
                   4917:           "filename">patch-optional-A4-papersize</tt>". In your
                   4918:           <tt class="filename">Makefile</tt> you would select
                   4919:           between them with the following construct:</p>
                   4920:           <pre class="programlisting">
                   4921:             
                   4922:    PATCHDIR=    ${.CURDIR}/patches
                   4923:    .if exists(${PATCHDIR}/patch-optional-${PAPERSIZE}-papersize)
                   4924:         OPTIONAL_PATCHFILES+= ${PATCHDIR}/patch-optional-${PAPERSIZE}-papersize
                   4925:    .endif 
                   4926: </pre>
                   4927: 
                   4928:           <p>Note that you have to define the value of <tt class=
                   4929:           "varname">PATCHDIR</tt> in order to use it in a
                   4930:           &#8220;<span class="quote"><span><b class=
                   4931:           "command">.if</b></span></span>&#8221; statement like
                   4932:           this as otherwise it's not defined until too late during
                   4933:           the processing of the Makefile. You should use a
                   4934:           &#8220;<span class="quote"><span><b class=
                   4935:           "command">.if</b></span></span>&#8221; statement in order
                   4936:           to avoid problems should the configuration item
                   4937:           (<tt class="varname">$PAPERSIZE</tt> in this example) be
                   4938:           set to an unexpected value.</p>
                   4939: 
                   4940:           <p>The <tt class="filename">patch-*</tt> files should be
                   4941:           in <span><b class="command">diff -bu</b></span> format,
                   4942:           and apply without a fuzz to avoid problems. (To force
                   4943:           patches to apply with fuzz you can set <tt class=
                   4944:           "varname">PATCH_FUZZ_FACTOR=-F2</tt>). Furthermore, do
                   4945:           not put changes for more than one file into a single
                   4946:           patch-file, as this will make future modifications more
                   4947:           difficult.</p>
                   4948: 
                   4949:           <p>Similar, a file should be patched at most once, not
                   4950:           several times by several different patches. If a file
                   4951:           needs several patches, they should be combined into one
                   4952:           file.</p>
                   4953: 
                   4954:           <p>One important thing to mention is to pay attention
                   4955:           that no RCS IDs get stored in the patch files, as these
                   4956:           will cause problems when later checked into the NetBSD
                   4957:           CVS tree. Use the <span><b class=
                   4958:           "command">pkgdiff</b></span> from the <a xmlns=
                   4959:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4960:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.2     ! hubertf  4961:              class="pkgname">pkgtools/pkgdiff</a> package to avoid
        !          4962:              these problems.</p>
1.1       grant    4963: 
                   4964:           <p>For even more automation, we recommend using
                   4965:           <span><b class="command">mkpatches</b></span> from the
                   4966:           same package to make a whole set of patches. You just
                   4967:           have to backup files before you edit them to <tt class=
                   4968:           "filename">filename.orig</tt>, e.g. with <span><b class=
                   4969:           "command">cp -p filename filename.orig</b></span> or,
                   4970:           easier, by using <span><b class=
                   4971:           "command">pkgvi</b></span> again from the same package.
                   4972:           If you upgrade a package this way, you can easily compare
                   4973:           the new set of patches with the previously existing one
                   4974:           with <span><b class="command">patchdiff</b></span>.</p>
                   4975: 
                   4976:           <p>When you have finished a package, remember to generate
                   4977:           the checksums for the patch files by using the
                   4978:           <span><b class="command">make makepatchsum</b></span>
                   4979:           command, see <a href="#components.distinfo" title=
                   4980:           "7.2.&nbsp;distinfo">Section 7.2,
                   4981:           &#8220;distinfo&#8221;</a>.</p>
                   4982: 
                   4983:           <p>Patch files that are distributed by the author or
                   4984:           other maintainers can be listed in <tt class=
                   4985:           "varname">$PATCHFILES</tt>.</p>
                   4986: 
                   4987:           <p>If it is desired to store any patches that should not
                   4988:           be committed into pkgsrc, they can be kept outside the
                   4989:           pkgsrc tree in the <tt class=
                   4990:           "filename">$LOCALPATCHES</tt> directory. The directory
                   4991:           tree there is expected to have the same
                   4992:           &#8220;<span class="quote">category/package</span>&#8221;
                   4993:           structure as pkgsrc, and patches are expected to be
                   4994:           stored inside these dirs (also known as <tt class=
                   4995:           "filename">$LOCALPATCHES/$PKGPATH</tt>). For example if
                   4996:           you want to keep a private patch for <tt class=
                   4997:           "filename">pkgsrc/graphics/png</tt>, keep it in
                   4998:           <tt class="filename">$LOCALPATCHES/graphics/png/mypatch</tt>.
                   4999:           All files in the named directory are expected to be patch
                   5000:           files, and <span class="emphasis"><em>they are applied
                   5001:           after pkgsrc patches are applied</em></span>.</p>
                   5002:         </div>
                   5003: 
                   5004:         <div class="sect1" lang="en" xml:lang="en">
                   5005:           <div class="titlepage">
                   5006:             <div>
                   5007:               <div>
                   5008:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  5009:                 "id2566242" id="id2566242"></a>7.4.&nbsp;Other
1.1       grant    5010:                 mandatory files</h2>
                   5011:               </div>
                   5012:             </div>
                   5013:           </div>
                   5014: 
                   5015:           <div class="variablelist">
                   5016:             <dl>
                   5017:               <dt><span class="term"><tt class=
                   5018:               "filename">DESCR</tt></span></dt>
                   5019: 
                   5020:               <dd>
                   5021:                 <p>A multi-line description of the piece of
                   5022:                 software. This should include any credits where
                   5023:                 they are due. Please bear in mind that others do
                   5024:                 not share your sense of humour (or spelling
                   5025:                 idiosyncrasies), and that others will read
                   5026:                 everything that you write here.</p>
                   5027:               </dd>
                   5028: 
                   5029:               <dt><span class="term"><tt class=
                   5030:               "filename">PLIST</tt></span></dt>
                   5031: 
                   5032:               <dd>
                   5033:                 <p>This file governs the files that are installed
                   5034:                 on your system: all the binaries, manual pages,
                   5035:                 etc. There are other directives which may be
                   5036:                 entered in this file, to control the creation and
                   5037:                 deletion of directories, and the location of
                   5038:                 inserted files. See <a href="#plist" title=
                   5039:                 "Chapter&nbsp;8.&nbsp;PLIST issues">Chapter&nbsp;8,
                   5040:                 <i>PLIST issues</i></a> for more information.</p>
                   5041:               </dd>
                   5042:             </dl>
                   5043:           </div>
                   5044:         </div>
                   5045: 
                   5046:         <div class="sect1" lang="en" xml:lang="en">
                   5047:           <div class="titlepage">
                   5048:             <div>
                   5049:               <div>
                   5050:                 <h2 class="title" style="clear: both"><a name=
                   5051:                 "components.optional" id=
                   5052:                 "components.optional"></a>7.5.&nbsp;Optional
                   5053:                 files</h2>
                   5054:               </div>
                   5055:             </div>
                   5056:           </div>
                   5057: 
                   5058:           <div class="variablelist">
                   5059:             <dl>
                   5060:               <dt><span class="term"><tt class=
                   5061:               "filename">INSTALL</tt></span></dt>
                   5062: 
                   5063:               <dd>
                   5064:                 <p>This shell script is invoked twice by <a href=
                   5065:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5066:                 <span class="citerefentry"><span class=
                   5067:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   5068:                 time after package extraction and before files are
                   5069:                 moved in place, the second time after the files to
                   5070:                 install are moved in place. This can be used to do
                   5071:                 any custom procedures not possible with @exec
                   5072:                 commands in <tt class="filename">PLIST</tt>. See
                   5073:                 <a href=
                   5074:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5075:                 <span class="citerefentry"><span class=
                   5076:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   5077:                 <a href=
                   5078:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5079:                 <span class="citerefentry"><span class=
                   5080:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5081:                 more information.</p>
                   5082:               </dd>
                   5083: 
                   5084:               <dt><span class="term"><tt class=
                   5085:               "filename">DEINSTALL</tt></span></dt>
                   5086: 
                   5087:               <dd>
                   5088:                 <p>This script is executed before and after any
                   5089:                 files are removed. It is this script's
                   5090:                 responsibility to clean up any additional messy
                   5091:                 details around the package's installation, since
                   5092:                 all pkg_delete knows is how to delete the files
                   5093:                 created in the original distribution. See <a href=
                   5094:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   5095:                 <span class="citerefentry"><span class=
                   5096:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   5097:                 <a href=
                   5098:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5099:                 <span class="citerefentry"><span class=
                   5100:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5101:                 more information.</p>
                   5102:               </dd>
                   5103: 
                   5104:               <dt><span class="term"><tt class=
                   5105:               "filename">MESSAGE</tt></span></dt>
                   5106: 
                   5107:               <dd>
                   5108:                 <p>Display this file after installation of the
                   5109:                 package. Useful for things like legal notices on
                   5110:                 almost-free software and hints for updating config
                   5111:                 files after installing modules for apache, PHP etc.
                   5112:                 Please note that you can modify variables in it
                   5113:                 easily by using <tt class=
                   5114:                 "varname">MESSAGE_SUBST</tt> in the package's
                   5115:                 <tt class="filename">Makefile</tt>:</p>
                   5116:                 <pre class="programlisting">
                   5117: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   5118: </pre>
                   5119: 
                   5120:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
                   5121:                 "quote">somevalue</span>&#8221; in <tt class=
                   5122:                 "filename">MESSAGE</tt>.</p>
                   5123:               </dd>
                   5124:             </dl>
                   5125:           </div>
                   5126:         </div>
                   5127: 
                   5128:         <div class="sect1" lang="en" xml:lang="en">
                   5129:           <div class="titlepage">
                   5130:             <div>
                   5131:               <div>
                   5132:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  5133:                 "id2566436" id="id2566436"></a>7.6.&nbsp;<tt class=
1.1       grant    5134:                 "filename">work*</tt></h2>
                   5135:               </div>
                   5136:             </div>
                   5137:           </div>
                   5138: 
                   5139:           <p>When you type <span><b class="command">make</b></span>
                   5140:           the distribution files are unpacked into this directory.
                   5141:           It can be removed by running <span><b class=
                   5142:           "command">make clean</b></span>. Besides the sources,
                   5143:           this directory is also used to keep various timestamp
                   5144:           files.</p>
                   5145: 
                   5146:           <p>If a package doesn't create a subdirectory for itself
                   5147:           (like GNU software does, for instance), but extracts
                   5148:           itself in the current directory, you should set
                   5149:           <tt class="varname">WRKSRC</tt> accordingly, e.g.
                   5150:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   5151:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.2     ! hubertf  5152:              class="pkgname">editors/sam</a> again, but the quick
        !          5153:              answer is:</p>
1.1       grant    5154:           <pre class="programlisting">
                   5155: WRKSRC=                ${WRKDIR}
                   5156: </pre>
                   5157: 
                   5158:           <p>Please note that the old <tt class=
                   5159:           "varname">NO_WRKSUBDIR</tt> has been deprecated and
                   5160:           should not be used. Also, if your package doesn't create
                   5161:           a subdir with the name of <tt class=
                   5162:           "varname">DISTNAME</tt> but some different name, set
                   5163:           <tt class="varname">WRKSRC</tt> to point to the proper
                   5164:           name in <tt class="filename">${WRKDIR}</tt>. See
                   5165:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   5166:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.2     ! hubertf  5167:              class="pkgname">lang/tcl</a> and <a xmlns=
        !          5168:              "http://www.w3.org/TR/xhtml1/transitional" href=
        !          5169:              "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
        !          5170:              class="pkgname">x11/tk</a> for examples, and here is
        !          5171:              another one:</p>
1.1       grant    5172:           <pre class="programlisting">
                   5173: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   5174: </pre>
                   5175: 
                   5176:           <p>The name of the working directory created by pkgsrc is
                   5177:           <tt class="filename">work</tt> by default. If the same
                   5178:           pkgsrc tree should be used on several different
                   5179:           platforms, the variable <tt class=
                   5180:           "varname">OBJMACHINE</tt> can be set in /etc/mk.conf to
                   5181:           attach the platform to the directory name, e.g.
                   5182:           <tt class="filename">work.i386</tt> or <tt class=
                   5183:           "filename">work.sparc</tt>.</p>
                   5184:         </div>
                   5185: 
                   5186:         <div class="sect1" lang="en" xml:lang="en">
                   5187:           <div class="titlepage">
                   5188:             <div>
                   5189:               <div>
                   5190:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  5191:                 "id2566523" id="id2566523"></a>7.7.&nbsp;<tt class=
1.1       grant    5192:                 "filename">files/*</tt></h2>
                   5193:               </div>
                   5194:             </div>
                   5195:           </div>
                   5196: 
                   5197:           <p>If you have any files that you wish to be placed in
                   5198:           the package prior to configuration or building, you could
                   5199:           place these files here and use a &#8220;<span class=
                   5200:           "quote">${CP}</span>&#8221; command in the
                   5201:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   5202:           target to achieve this. Alternatively, you could simply
                   5203:           diff the file against <tt class="filename">/dev/null</tt>
                   5204:           and use the patch mechanism to manage the creation of
                   5205:           this file.</p>
                   5206:         </div>
                   5207:       </div>
                   5208: 
                   5209:       <div class="chapter" lang="en" xml:lang="en">
                   5210:         <div class="titlepage">
                   5211:           <div>
                   5212:             <div>
                   5213:               <h2 class="title"><a name="plist" id=
                   5214:               "plist"></a>Chapter&nbsp;8.&nbsp;PLIST issues</h2>
                   5215:             </div>
                   5216:           </div>
                   5217:         </div>
                   5218: 
                   5219:         <div class="toc">
                   5220:           <p><b>Table of Contents</b></p>
                   5221: 
                   5222:           <dl>
1.2     ! hubertf  5223:             <dt><span class="sect1"><a href="#id2566578">8.1. RCS
1.1       grant    5224:             ID</a></span></dt>
                   5225: 
1.2     ! hubertf  5226:             <dt><span class="sect1"><a href="#id2566593">8.2.
1.1       grant    5227:             Semi-automatic PLIST generation</a></span></dt>
                   5228: 
                   5229:             <dt><span class="sect1"><a href="#print-PLIST">8.3.
                   5230:             Tweaking output of make print-PLIST</a></span></dt>
                   5231: 
                   5232:             <dt><span class="sect1"><a href="#plist.misc">8.4.
                   5233:             Variable substitution in PLIST</a></span></dt>
                   5234: 
1.2     ! hubertf  5235:             <dt><span class="sect1"><a href="#id2566914">8.5.
1.1       grant    5236:             Manpage-compression</a></span></dt>
                   5237: 
1.2     ! hubertf  5238:             <dt><span class="sect1"><a href="#id2566955">8.6.
1.1       grant    5239:             Changing PLIST source with PLIST_SRC</a></span></dt>
                   5240: 
1.2     ! hubertf  5241:             <dt><span class="sect1"><a href="#id2566972">8.7.
1.1       grant    5242:             Platform specific and differing PLISTs</a></span></dt>
                   5243: 
                   5244:             <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
                   5245:             Sharing directories between packages</a></span></dt>
                   5246:           </dl>
                   5247:         </div>
                   5248: 
                   5249:         <p>The <tt class="filename">PLIST</tt> file contains a
                   5250:         package's &#8220;<span class="quote">packing
                   5251:         list</span>&#8221;, i.e. a list of files that belong to the
                   5252:         package (relative to the <tt class=
                   5253:         "filename">${PREFIX}</tt> directory it's been installed in)
                   5254:         plus some additional statements - see the <a href=
                   5255:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5256:         <span class="citerefentry"><span class=
                   5257:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   5258:         a full list. This chapter addresses some issues that need
                   5259:         attention when dealing with the <tt class=
                   5260:         "filename">PLIST</tt> file (or files, see below!).</p>
                   5261: 
                   5262:         <div class="sect1" lang="en" xml:lang="en">
                   5263:           <div class="titlepage">
                   5264:             <div>
                   5265:               <div>
                   5266:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  5267:                 "id2566578" id="id2566578"></a>8.1.&nbsp;RCS
1.1       grant    5268:                 ID</h2>
                   5269:               </div>
                   5270:             </div>
                   5271:           </div>
                   5272: 
                   5273:           <p>Be sure to add a RCS ID line as the first thing in any
                   5274:           <tt class="filename">PLIST</tt> file you write:</p>
                   5275:           <pre class="programlisting">
                   5276: @comment $NetBSD$
                   5277: </pre>
                   5278:         </div>
                   5279: 
                   5280:         <div class="sect1" lang="en" xml:lang="en">
                   5281:           <div class="titlepage">
                   5282:             <div>
                   5283:               <div>
                   5284:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  5285:                 "id2566593" id=
        !          5286:                 "id2566593"></a>8.2.&nbsp;Semi-automatic <tt class=
1.1       grant    5287:                 "filename">PLIST</tt> generation</h2>
                   5288:               </div>
                   5289:             </div>
                   5290:           </div>
                   5291: 
                   5292:           <p>You can use the <span><b class="command">make
                   5293:           print-PLIST</b></span> command to output a PLIST that
                   5294:           matches any new files since the package was extracted.
                   5295:           See <a href="#build.helpful-targets" title=
                   5296:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   5297:           &#8220;Other helpful targets&#8221;</a> for more
                   5298:           information on this target.</p>
                   5299:         </div>
                   5300: 
                   5301:         <div class="sect1" lang="en" xml:lang="en">
                   5302:           <div class="titlepage">
                   5303:             <div>
                   5304:               <div>
                   5305:                 <h2 class="title" style="clear: both"><a name=
                   5306:                 "print-PLIST" id=
                   5307:                 "print-PLIST"></a>8.3.&nbsp;Tweaking output of
                   5308:                 <span><b class="command">make
                   5309:                 print-PLIST</b></span></h2>
                   5310:               </div>
                   5311:             </div>
                   5312:           </div>
                   5313: 
                   5314:           <p>If you have used any of the *-dirs packages, as
                   5315:           explained in <a href="#faq.common-dirs" title=
                   5316:           "8.8.&nbsp;Sharing directories between packages">Section&nbsp;8.8,
                   5317:           &#8220;Sharing directories between packages&#8221;</a>,
                   5318:           you may have noticed that <span><b class="command">make
                   5319:           print-PLIST</b></span> outputs a set of <tt class=
                   5320:           "varname">@comment</tt>s instead of real <tt class=
                   5321:           "varname">@dirrm</tt> lines. You can also do this for
                   5322:           specific directories and files, so that the results of
                   5323:           that command are very close to reality. This helps
                   5324:           <span class="emphasis"><em>a lot</em></span> during the
                   5325:           update of packages.</p>
                   5326: 
                   5327:           <p>The <tt class="varname">PRINT_PLIST_AWK</tt> variable
                   5328:           takes a set of AWK patterns and actions that are used to
                   5329:           filter the output of print-PLIST. You can <span class=
                   5330:           "emphasis"><em>append</em></span> any chunk of AWK
                   5331:           scripting you like to it, but be careful with
                   5332:           quoting.</p>
                   5333: 
                   5334:           <p>For example, to get all files inside the <tt class=
                   5335:           "filename">libdata/foo</tt> directory removed from the
                   5336:           resulting PLIST:</p>
                   5337:           <pre class="programlisting">
                   5338:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   5339:     
                   5340: </pre>
                   5341: 
                   5342:           <p>And to get all the <tt class="varname">@dirrm</tt>
                   5343:           lines referring to a specific (shared) directory
                   5344:           converted to <tt class="varname">@comment</tt>s:</p>
                   5345:           <pre class="programlisting">
                   5346:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   5347:     
                   5348: </pre>
                   5349:         </div>
                   5350: 
                   5351:         <div class="sect1" lang="en" xml:lang="en">
                   5352:           <div class="titlepage">
                   5353:             <div>
                   5354:               <div>
                   5355:                 <h2 class="title" style="clear: both"><a name=
                   5356:                 "plist.misc" id="plist.misc"></a>8.4.&nbsp;Variable
                   5357:                 substitution in PLIST</h2>
                   5358:               </div>
                   5359:             </div>
                   5360:           </div>
                   5361: 
                   5362:           <p>A number of variables are substituted automatically in
                   5363:           PLISTs when a package is installed on a system. This
                   5364:           includes the following variables:</p>
                   5365: 
                   5366:           <div class="variablelist">
                   5367:             <dl>
                   5368:               <dt><span class="term"><tt class=
                   5369:               "varname">${MACHINE_ARCH}</tt>, <tt class=
                   5370:               "varname">${MACHINE_GNU_ARCH}</tt></span></dt>
                   5371: 
                   5372:               <dd>
                   5373:                 <p>Some packages like emacs and perl embed
                   5374:                 information about which architecture they were
                   5375:                 built on into the pathnames where they install
                   5376:                 their file. To handle this case, PLIST will be
                   5377:                 preprocessed before actually used, and the symbol
                   5378:                 &#8220;<span class="quote"><tt class=
                   5379:                 "varname">${MACHINE_ARCH}</tt></span>&#8221; will
                   5380:                 be replaced by what <span><b class="command">uname
                   5381:                 -p</b></span> gives. The same is done if the string
                   5382:                 <tt class="varname">${MACHINE_GNU_ARCH}</tt> is
                   5383:                 embedded in PLIST somewhere - use this on packages
                   5384:                 that have GNU autoconf created configure
                   5385:                 scripts.</p>
                   5386: 
                   5387:                 <div class="note" style=
                   5388:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   5389:                   <h3 class="title">Legacy note</h3>
                   5390: 
                   5391:                   <p>There used to be a symbol &#8220;<span class=
                   5392:                   "quote"><tt class=
                   5393:                   "varname">$ARCH</tt></span>&#8221; that was
                   5394:                   replaced by the output of <span><b class=
                   5395:                   "command">uname -m</b></span>, but that's no
                   5396:                   longer supported and has been removed.</p>
                   5397:                 </div>
                   5398:               </dd>
                   5399: 
                   5400:               <dt><span class="term"><tt class=
                   5401:               "varname">${OPSYS}</tt>, <tt class=
                   5402:               "varname">${LOWER_OPSYS}</tt>, <tt class=
                   5403:               "varname">${OS_VERSION}</tt></span></dt>
                   5404: 
                   5405:               <dd>
                   5406:                 <p>Some packages want to embed the OS name and
                   5407:                 version into some paths. To do this, use these
                   5408:                 variables in the <tt class=
                   5409:                 "filename">PLIST</tt>:</p>
                   5410: 
                   5411:                 <div class="itemizedlist">
                   5412:                   <ul type="disc">
                   5413:                     <li>
                   5414:                       <p><tt class="varname">${OPSYS}</tt> - output
                   5415:                       of &#8220;<span class="quote"><span><b class=
                   5416:                       "command">uname
                   5417:                       -s</b></span></span>&#8221;</p>
                   5418:                     </li>
                   5419: 
                   5420:                     <li>
                   5421:                       <p><tt class="varname">${LOWER_OPSYS}</tt> -
                   5422:                       lowercase common name (eg.
                   5423:                       &#8220;<span class="quote">solaris</span>&#8221;)</p>
                   5424:                     </li>
                   5425: 
                   5426:                     <li>
                   5427:                       <p><tt class="varname">${OS_VERSION}</tt> -
                   5428:                       &#8220;<span class="quote"><span><b class=
                   5429:                       "command">uname
                   5430:                       -r</b></span></span>&#8221;</p>
                   5431:                     </li>
                   5432:                   </ul>
                   5433:                 </div>
                   5434:               </dd>
                   5435: 
                   5436:               <dt><span class="term"><tt class=
                   5437:               "varname">${PKGLOCALEDIR}</tt></span></dt>
                   5438: 
                   5439:               <dd>
                   5440:                 <p>Packages that install locale files should list
                   5441:                 them in the PLIST as &#8220;<span class=
                   5442:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   5443:                 instead of &#8220;<span class=
                   5444:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   5445:                 This properly handles the fact that different
                   5446:                 operating systems expect locale files to be either
                   5447:                 in <tt class="filename">share</tt> or <tt class=
                   5448:                 "filename">lib</tt> by default.</p>
                   5449:               </dd>
                   5450:             </dl>
                   5451:           </div>
                   5452: 
                   5453:           <p>For a complete list of values which are replaced by
                   5454:           default, please look in <tt class=
                   5455:           "filename">bsd.pkg.mk</tt> (and search for <span class=
                   5456:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   5457: 
                   5458:           <p>If you want to change other variables not listed
                   5459:           above, you can add variables and their expansions to this
                   5460:           variable in the following way, similar to <tt class=
                   5461:           "varname">MESSAGE_SUBST</tt> (see <a href=
                   5462:           "#components.optional" title=
                   5463:           "7.5.&nbsp;Optional files">Section&nbsp;7.5,
                   5464:           &#8220;Optional files&#8221;</a>):</p>
                   5465:           <pre class="programlisting">
                   5466: PLIST_SUBST+=    SOMEVAR="somevalue"
                   5467: </pre>
                   5468: 
                   5469:           <p>This replaces all occurrences of &#8220;<span class=
                   5470:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   5471:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   5472:         </div>
                   5473: 
                   5474:         <div class="sect1" lang="en" xml:lang="en">
                   5475:           <div class="titlepage">
                   5476:             <div>
                   5477:               <div>
                   5478:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  5479:                 "id2566914" id=
        !          5480:                 "id2566914"></a>8.5.&nbsp;Manpage-compression</h2>
1.1       grant    5481:               </div>
                   5482:             </div>
                   5483:           </div>
                   5484: 
                   5485:           <p>Manpages should be installed in compressed form if
                   5486:           <tt class="varname">MANZ</tt> is set (in <tt class=
                   5487:           "filename">bsd.own.mk</tt>), and uncompressed otherwise.
                   5488:           To handle this in the <tt class="filename">PLIST</tt>
                   5489:           file, the suffix &#8220;<span class=
                   5490:           "quote">.gz</span>&#8221; is appended/removed
                   5491:           automatically for manpages according to <tt class=
                   5492:           "varname">MANZ</tt> and <tt class=
                   5493:           "varname">MANCOMPRESSED</tt> being set or not, see above
                   5494:           for details. This modification of the <tt class=
                   5495:           "filename">PLIST</tt> file is done on a copy of it, not
                   5496:           <tt class="filename">PLIST</tt> itself.</p>
                   5497:         </div>
                   5498: 
                   5499:         <div class="sect1" lang="en" xml:lang="en">
                   5500:           <div class="titlepage">
                   5501:             <div>
                   5502:               <div>
                   5503:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  5504:                 "id2566955" id="id2566955"></a>8.6.&nbsp;Changing
1.1       grant    5505:                 PLIST source with <tt class=
                   5506:                 "varname">PLIST_SRC</tt></h2>
                   5507:               </div>
                   5508:             </div>
                   5509:           </div>
                   5510: 
                   5511:           <p>To use one or more files as source for the <tt class=
                   5512:           "filename">PLIST</tt> used in generating the binary
                   5513:           package, set the variable <tt class=
                   5514:           "varname">PLIST_SRC</tt> to the names of that file(s).
                   5515:           The files are later concatenated using cat(1), and order
                   5516:           of things is important.</p>
                   5517:         </div>
                   5518: 
                   5519:         <div class="sect1" lang="en" xml:lang="en">
                   5520:           <div class="titlepage">
                   5521:             <div>
                   5522:               <div>
                   5523:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  5524:                 "id2566972" id="id2566972"></a>8.7.&nbsp;Platform
1.1       grant    5525:                 specific and differing PLISTs</h2>
                   5526:               </div>
                   5527:             </div>
                   5528:           </div>
                   5529: 
                   5530:           <p>Some packages decide to install a different set of
                   5531:           files based on the operating system being used. These
                   5532:           differences can be automatically handled by using the
                   5533:           following files:</p>
                   5534: 
                   5535:           <div class="itemizedlist">
                   5536:             <ul type="disc">
                   5537:               <li>
                   5538:                 <p><tt class="filename">PLIST.common</tt></p>
                   5539:               </li>
                   5540: 
                   5541:               <li>
                   5542:                 <p><tt class="filename">PLIST.${OPSYS}</tt></p>
                   5543:               </li>
                   5544: 
                   5545:               <li>
                   5546:                 <p><tt class="filename">PLIST.common_end</tt></p>
                   5547:               </li>
                   5548:             </ul>
                   5549:           </div>
                   5550: 
                   5551:           <p>If <tt class="filename">PLIST.${OPSYS}</tt> exists,
                   5552:           these files are used instead of <tt class=
                   5553:           "filename">PLIST</tt>. This allows packages which behave
                   5554:           in this way to be handled gracefully. Manually overriding
                   5555:           <tt class="varname">PLIST_SRC</tt> for other more exotic
                   5556:           uses is also possible.</p>
                   5557:         </div>
                   5558: 
                   5559:         <div class="sect1" lang="en" xml:lang="en">
                   5560:           <div class="titlepage">
                   5561:             <div>
                   5562:               <div>
                   5563:                 <h2 class="title" style="clear: both"><a name=
                   5564:                 "faq.common-dirs" id=
                   5565:                 "faq.common-dirs"></a>8.8.&nbsp;Sharing directories
                   5566:                 between packages</h2>
                   5567:               </div>
                   5568:             </div>
                   5569:           </div>
                   5570: 
                   5571:           <p>A &#8220;<span class="quote">shared
                   5572:           directory</span>&#8221; is a directory where multiple
                   5573:           (and unrelated) packages install files. These directories
                   5574:           are problematic because you have to add special tricks in
                   5575:           the PLIST to conditionally remove them, or have some
                   5576:           centralized package handle them.</p>
                   5577: 
                   5578:           <p>Within pkgsrc, you'll find both approaches. If a
                   5579:           directory is shared by a few unrelated packages, it's
                   5580:           often not worth to add an extra package to remove it.
                   5581:           Therefore, one simply does:</p>
                   5582:           <pre class="programlisting">
                   5583:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   5584:     
                   5585: </pre>
                   5586: 
                   5587:           <p>in the PLISTs of all affected packages, instead of the
                   5588:           regular "@dirrm" line.</p>
                   5589: 
                   5590:           <p>However, if the directory is shared across many
                   5591:           packages, two different solutions are available:</p>
                   5592: 
                   5593:           <div class="orderedlist">
                   5594:             <ol type="1">
                   5595:               <li>
                   5596:                 <p>If the packages have a common dependency, the
                   5597:                 directory can be removed in that. For example, see
                   5598:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5599:                 href=
                   5600:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.2     ! hubertf  5601:                    class="pkgname">textproc/scrollkeeper</a>, which
        !          5602:                    removes the shared directory <tt class=
        !          5603:                    "filename">share/omf</tt>.</p>
1.1       grant    5604:               </li>
                   5605: 
                   5606:               <li>
                   5607:                 <p>If the packages using the directory are not
                   5608:                 related at all (they have no common dependencies),
                   5609:                 a *-dirs package is used.</p>
                   5610:               </li>
                   5611:             </ol>
                   5612:           </div>
                   5613: 
                   5614:           <p>From now on, we'll discuss the second solution. To get
                   5615:           an idea of the *-dirs packages available, issue:</p>
                   5616:           <pre class="programlisting">
                   5617:       <tt class="prompt">%</tt> cd .../pkgsrc
                   5618:       <tt class="prompt">%</tt> ls -d */*-dirs
                   5619:     
                   5620: </pre>
                   5621: 
                   5622:           <p>Their use from other packages is very simple. The
                   5623:           <tt class="varname">USE_DIRS</tt> variable takes a list
                   5624:           of package names (without the &#8220;<span class=
                   5625:           "quote">-dirs</span>&#8221; part) together with the
                   5626:           required version number (always pick the latest one when
                   5627:           writting new packages).</p>
                   5628: 
                   5629:           <p>For example, if a package installs files under
                   5630:           <tt class="filename">share/applications</tt>, it should
                   5631:           have the following line in it:</p>
                   5632:           <pre class="programlisting">
                   5633:       USE_DIRS+= xdg-1.1
                   5634:     
                   5635: </pre>
                   5636: 
                   5637:           <p>After regenerating the PLIST using <span><b class=
                   5638:           "command">make print-PLIST</b></span>, you should get the
                   5639:           right (commented out) lines.</p>
                   5640: 
                   5641:           <p>Note that, even if your package is using <tt class=
                   5642:           "filename">$X11BASE</tt>, it must not depend on the
                   5643:           *-x11-dirs packages. Just specify the name without that
                   5644:           part and pkgsrc (in particular, <tt class=
                   5645:           "filename">mk/dirs.mk</tt>) will take care of it.</p>
                   5646:         </div>
                   5647:       </div>
                   5648: 
                   5649:       <div class="chapter" lang="en" xml:lang="en">
                   5650:         <div class="titlepage">
                   5651:           <div>
                   5652:             <div>
                   5653:               <h2 class="title"><a name="buildlink" id=
                   5654:               "buildlink"></a>Chapter&nbsp;9.&nbsp;Buildlink
                   5655:               methodology</h2>
                   5656:             </div>
                   5657:           </div>
                   5658:         </div>
                   5659: 
                   5660:         <div class="toc">
                   5661:           <p><b>Table of Contents</b></p>
                   5662: 
                   5663:           <dl>
1.2     ! hubertf  5664:             <dt><span class="sect1"><a href="#id2567313">9.1.
1.1       grant    5665:             Converting packages to use buildlink3</a></span></dt>
                   5666: 
1.2     ! hubertf  5667:             <dt><span class="sect1"><a href="#id2567640">9.2.
1.1       grant    5668:             Writing buildlink3.mk files</a></span></dt>
                   5669: 
                   5670:             <dd>
                   5671:               <dl>
1.2     ! hubertf  5672:                 <dt><span class="sect2"><a href="#id2567709">9.2.1.
1.1       grant    5673:                 Anatomy of a buildlink3.mk file</a></span></dt>
                   5674: 
1.2     ! hubertf  5675:                 <dt><span class="sect2"><a href="#id2568150">9.2.2.
1.1       grant    5676:                 Updating BUILDLINK_DEPENDS.pkg in buildlink3.mk
                   5677:                 files</a></span></dt>
                   5678:               </dl>
                   5679:             </dd>
                   5680: 
1.2     ! hubertf  5681:             <dt><span class="sect1"><a href="#id2568229">9.3.
1.1       grant    5682:             Writing builtin.mk files</a></span></dt>
                   5683: 
                   5684:             <dd>
                   5685:               <dl>
1.2     ! hubertf  5686:                 <dt><span class="sect2"><a href="#id2568378">9.3.1.
1.1       grant    5687:                 Anatomy of a builtin.mk file</a></span></dt>
                   5688: 
1.2     ! hubertf  5689:                 <dt><span class="sect2"><a href="#id2568537">9.3.2.
1.1       grant    5690:                 Global preferences for native or pkgsrc
                   5691:                 software</a></span></dt>
                   5692:               </dl>
                   5693:             </dd>
                   5694:           </dl>
                   5695:         </div>
                   5696: 
                   5697:         <p>Buildlink is a framework in pkgsrc that controls what
                   5698:         headers and libraries are seen by a package's configure and
                   5699:         build processes. This is implemented in a two step
                   5700:         process:</p>
                   5701: 
                   5702:         <div class="orderedlist">
                   5703:           <ol type="1">
                   5704:             <li>
                   5705:               <p>Symlink headers and libraries for dependencies
                   5706:               into <tt class="varname">BUILDLINK_DIR</tt>, which by
                   5707:               default is a subdirectory of <tt class=
                   5708:               "varname">WRKDIR</tt>.</p>
                   5709:             </li>
                   5710: 
                   5711:             <li>
                   5712:               <p>Create wrapper scripts that are used in place of
                   5713:               the normal compiler tools that translate <tt class=
                   5714:               "option">-I${LOCALBASE}/include</tt> and <tt class=
                   5715:               "option">-L${LOCALBASE}/lib</tt> into references to
                   5716:               <tt class="varname">BUILDLINK_DIR</tt>. The wrapper
                   5717:               scripts also make native compiler on some operating
                   5718:               systems look like GCC, so that packages that expect
                   5719:               GCC won't require modifications to build with those
                   5720:               native compilers.</p>
                   5721:             </li>
                   5722:           </ol>
                   5723:         </div>
                   5724: 
                   5725:         <p>This normalizes the environment in which a package is
                   5726:         built so that the package may be built consistently despite
                   5727:         what other software may be installed. Please note that the
                   5728:         normal system header and library paths, e.g. <tt class=
                   5729:         "filename">/usr/include</tt>, <tt class=
                   5730:         "filename">/usr/lib</tt>, etc., are always searched --
                   5731:         buildlink3 is designed to insulate the package build from
                   5732:         non-system-supplied software.</p>
                   5733: 
                   5734:         <div class="sect1" lang="en" xml:lang="en">
                   5735:           <div class="titlepage">
                   5736:             <div>
                   5737:               <div>
                   5738:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  5739:                 "id2567313" id="id2567313"></a>9.1.&nbsp;Converting
1.1       grant    5740:                 packages to use buildlink3</h2>
                   5741:               </div>
                   5742:             </div>
                   5743:           </div>
                   5744: 
                   5745:           <p>The process of converting packages to use the
                   5746:           buildlink3 framework (&#8220;<span class=
                   5747:           "quote">bl3ifying</span>&#8221;) is fairly
                   5748:           straightforward. The things to keep in mind are:</p>
                   5749: 
                   5750:           <div class="orderedlist">
                   5751:             <ol type="1">
                   5752:               <li>
                   5753:                 <p>Set <tt class="varname">USE_BUILDLINK3</tt> to
                   5754:                 &#8220;<span class="quote">yes</span>&#8221;.</p>
                   5755:               </li>
                   5756: 
                   5757:               <li>
                   5758:                 <p>Ensure that the build always calls the wrapper
                   5759:                 scripts instead of the actual toolchain. Some
                   5760:                 packages are tricky, and the only way to know for
                   5761:                 sure is the check <tt class=
                   5762:                 "filename">${WRKDIR}/.work.log</tt> to see if the
                   5763:                 wrappers are being invoked.</p>
                   5764:               </li>
                   5765: 
                   5766:               <li>
                   5767:                 <p>Don't override <tt class="varname">PREFIX</tt>
                   5768:                 from within the package Makefile, e.g. Java VMs,
                   5769:                 standalone shells, etc., because the code to
                   5770:                 symlink files into <tt class=
                   5771:                 "filename">${BUILDLINK_DIR}</tt> looks for files
                   5772:                 relative to &#8220;<span class="quote">pkg_info -qp
                   5773:                 <i class=
                   5774:                 "replaceable"><tt>pkgname</tt></i></span>&#8221;.</p>
                   5775:               </li>
                   5776: 
                   5777:               <li>
                   5778:                 <p>Remember that <span class=
                   5779:                 "emphasis"><em>only</em></span> the <tt class=
                   5780:                 "filename">buildlink3.mk</tt> files that you list
                   5781:                 in a package's Makefile are added as dependencies
                   5782:                 for that package.</p>
                   5783:               </li>
                   5784:             </ol>
                   5785:           </div>
                   5786: 
                   5787:           <p>If a dependency on a particular package is required
                   5788:           for its libraries and headers, then we replace:</p>
                   5789:           <pre class="programlisting">
                   5790: DEPENDS+=       foo&gt;=1.1.0:../../category/foo
                   5791: </pre>
                   5792: 
                   5793:           <p>with</p>
                   5794:           <pre class="programlisting">
                   5795: .include "../../category/foo/buildlink3.mk"
                   5796: </pre>
                   5797: 
                   5798:           <p>There are several <tt class=
                   5799:           "filename">buildlink3.mk</tt> files in <tt class=
                   5800:           "filename">pkgsrc/mk</tt> that handle special package
                   5801:           issues:</p>
                   5802: 
                   5803:           <div class="itemizedlist">
                   5804:             <ul type="disc">
                   5805:               <li>
                   5806:                 <p><tt class="filename">bdb.buildlink3.mk</tt>
                   5807:                 chooses either the native or a pkgsrc Berkeley DB
                   5808:                 implementation based on the values of <tt class=
                   5809:                 "varname">BDB_ACCEPTED</tt> and <tt class=
                   5810:                 "varname">BDB_DEFAULT</tt>.</p>
                   5811:               </li>
                   5812: 
                   5813:               <li>
                   5814:                 <p><tt class="filename">curses.buildlink3.mk</tt>
                   5815:                 If the system comes with neither Curses nor
                   5816:                 NCurses, this will take care to install the
                   5817:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5818:                 href=
                   5819:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.2     ! hubertf  5820:                    class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    5821:               </li>
                   5822: 
                   5823:               <li>
                   5824:                 <p><tt class="filename">krb5.buildlink3.mk</tt>
                   5825:                 uses the value of <tt class=
                   5826:                 "varname">KRB5_ACCEPTED</tt> to choose between
                   5827:                 adding a dependency on Heimdal or MIT-krb5 for
                   5828:                 packages that require a Kerberos 5
                   5829:                 implementation.</p>
                   5830:               </li>
                   5831: 
                   5832:               <li>
                   5833:                 <p><tt class="filename">motif.buildlink3.mk</tt>
                   5834:                 checks for a system-provided Motif installation or
                   5835:                 adds a dependency on <a xmlns=
                   5836:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5837:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.2     ! hubertf  5838:                    class="pkgname">x11/lesstif</a> or <a xmlns=
        !          5839:                    "http://www.w3.org/TR/xhtml1/transitional" href=
        !          5840:                    "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
        !          5841:                    class="pkgname">x11/openmotif</a>;</p>
1.1       grant    5842:               </li>
                   5843: 
                   5844:               <li>
                   5845:                 <p><tt class="filename">ossaudio.buildlink3.mk</tt>
                   5846:                 defines several variables that may be used by
                   5847:                 packages that use the Open Sound System (OSS)
                   5848:                 API;</p>
                   5849:               </li>
                   5850: 
                   5851:               <li>
                   5852:                 <p><tt class="filename">pgsql.buildlink3.mk</tt>
                   5853:                 will accept either Postgres 7.3 or 7.4, whichever
                   5854:                 is found installed. See the file for more
                   5855:                 information.</p>
                   5856:               </li>
                   5857: 
                   5858:               <li>
                   5859:                 <p><tt class="filename">pthread.buildlink3.mk</tt>
                   5860:                 uses the value of <tt class=
                   5861:                 "varname">PTHREAD_OPTS</tt> and checks for native
                   5862:                 pthreads or adds a dependency on <a xmlns=
                   5863:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   5864:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.2     ! hubertf  5865:                    class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    5866:               </li>
                   5867: 
                   5868:               <li>
                   5869:                 <p><tt class="filename">xaw.buildlink3.mk</tt> uses
                   5870:                 the value of <tt class="varname">XAW_TYPE</tt> to
                   5871:                 choose a particular Athena widgets library.</p>
                   5872:               </li>
                   5873:             </ul>
                   5874:           </div>
                   5875: 
                   5876:           <p>The comments in those <tt class=
                   5877:           "filename">buildlink3.mk</tt> files provide a more
                   5878:           complete description of how to use them properly.</p>
                   5879:         </div>
                   5880: 
                   5881:         <div class="sect1" lang="en" xml:lang="en">
                   5882:           <div class="titlepage">
                   5883:             <div>
                   5884:               <div>
                   5885:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  5886:                 "id2567640" id="id2567640"></a>9.2.&nbsp;Writing
1.1       grant    5887:                 <tt class="filename">buildlink3.mk</tt> files</h2>
                   5888:               </div>
                   5889:             </div>
                   5890:           </div>
                   5891: 
                   5892:           <p>A package's <tt class="filename">buildlink3.mk</tt>
                   5893:           file is included by Makefiles to indicate the need to
                   5894:           compile and link against header files and libraries
                   5895:           provided by the package. A <tt class=
                   5896:           "filename">buildlink3.mk</tt> file should always provide
                   5897:           enough information to add the correct type of dependency
                   5898:           relationship and include any other <tt class=
                   5899:           "filename">buildlink3.mk</tt> files that it needs to find
                   5900:           headers and libraries that it needs in turn.</p>
                   5901: 
                   5902:           <p>To generate an initial <tt class=
                   5903:           "filename">buildlink3.mk</tt> file for further editing,
                   5904:           Rene Hexel's <a xmlns=
                   5905:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5906:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.2     ! hubertf  5907:              class="pkgname">pkgtools/createbuildlink</a> package
        !          5908:              is highly recommended. For most packages, the
        !          5909:              following command will generate a good starting point
        !          5910:              for <tt class="filename">buildlink3.mk</tt> files:</p>
1.1       grant    5911:           <pre class="screen">
                   5912: <tt class="prompt">%</tt> <b class=
                   5913: "userinput"><tt>cd pkgsrc/<i class=
                   5914: "replaceable"><tt>category</tt></i>/<i class=
                   5915: "replaceable"><tt>pkgdir</tt></i>
                   5916: <tt class=
                   5917: "prompt">%</tt> createbuildlink -3 &gt;buildlink3.mk</tt></b>
                   5918: </pre>
                   5919: 
                   5920:           <div class="sect2" lang="en" xml:lang="en">
                   5921:             <div class="titlepage">
                   5922:               <div>
                   5923:                 <div>
1.2     ! hubertf  5924:                   <h3 class="title"><a name="id2567709" id=
        !          5925:                   "id2567709"></a>9.2.1. Anatomy of a buildlink3.mk
1.1       grant    5926:                   file</h3>
                   5927:                 </div>
                   5928:               </div>
                   5929:             </div>
                   5930: 
                   5931:             <p>The following real-life example <tt class=
                   5932:             "filename">buildlink3.mk</tt> is taken from <tt class=
                   5933:             "filename">pkgsrc/graphics/tiff</tt>:</p>
                   5934:             <pre class="programlisting">
                   5935: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
                   5936: 
                   5937: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   5938: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   5939: 
                   5940: .if !empty(BUILDLINK_DEPTH:M+)
                   5941: BUILDLINK_DEPENDS+=     tiff
                   5942: .endif
                   5943: 
                   5944: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   5945: BUILDLINK_PACKAGES+=    tiff
                   5946: 
                   5947: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   5948: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   5949: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   5950: .endif  # TIFF_BUILDLINK3_MK
                   5951: 
                   5952: .include "../../devel/zlib/buildlink3.mk"
                   5953: .include "../../graphics/jpeg/buildlink3.mk"
                   5954: 
                   5955: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   5956: </pre>
                   5957: 
                   5958:             <p>The header and footer manipulate <tt class=
                   5959:             "varname">BUILDLINK_DEPTH</tt>, which is common across
                   5960:             all <tt class="filename">buildlink3.mk</tt> files and
                   5961:             is used to track at what depth we are including
                   5962:             <tt class="filename">buildlink3.mk</tt> files.</p>
                   5963: 
                   5964:             <p>The first section controls if the dependency on
                   5965:             <i class="replaceable"><tt>pkg</tt></i> is added.
                   5966:             <tt class="varname">BUILDLINK_DEPENDS</tt> is the
                   5967:             global list of packages for which dependencies are
                   5968:             added by buildlink3.</p>
                   5969: 
                   5970:             <p>The second section advises pkgsrc that the
                   5971:             <tt class="filename">buildlink3.mk</tt> file for
                   5972:             <i class="replaceable"><tt>pkg</tt></i> has been
                   5973:             included at some point. <tt class=
                   5974:             "varname">BUILDLINK_PACKAGES</tt> is the global list of
                   5975:             packages for which <tt class=
                   5976:             "filename">buildlink3.mk</tt> files have been included.
                   5977:             It must <span class="emphasis"><em>always</em></span>
                   5978:             be appended to within a <tt class=
                   5979:             "filename">buildlink3.mk</tt> file.</p>
                   5980: 
                   5981:             <p>The third section is protected from multiple
                   5982:             inclusion and controls how the dependency on <i class=
                   5983:             "replaceable"><tt>pkg</tt></i> is added. Several
                   5984:             important variables are set in the section:</p>
                   5985: 
                   5986:             <div class="itemizedlist">
                   5987:               <ul type="disc">
                   5988:                 <li>
                   5989:                   <p><tt class=
                   5990:                   "varname">BUILDLINK_DEPENDS.<i class="replaceable">
                   5991:                   <tt>pkg</tt></i></tt> is the actual dependency
                   5992:                   recorded in the installed package; this should
                   5993:                   always be set using <span><b class=
                   5994:                   "command">+=</b></span> to ensure that we're
                   5995:                   appending to any pre-existing list of values.
                   5996:                   This variable should be set to the first version
                   5997:                   of the package that had the last change in the
                   5998:                   major number of a shared library or that had a
                   5999:                   major API change.</p>
                   6000:                 </li>
                   6001: 
                   6002:                 <li>
                   6003:                   <p><tt class=
                   6004:                   "varname">BUILDLINK_PKGSRCDIR.<i class=
                   6005:                   "replaceable"><tt>pkg</tt></i></tt> is the
                   6006:                   location of the <i class=
                   6007:                   "replaceable"><tt>pkg</tt></i> pkgsrc
                   6008:                   directory;</p>
                   6009:                 </li>
                   6010: 
                   6011:                 <li>
                   6012:                   <p><tt class=
                   6013:                   "varname">BUILDLINK_DEPMETHOD.<i class=
                   6014:                   "replaceable"><tt>pkg</tt></i></tt> (not shown
                   6015:                   above) controls whether we use <tt class=
                   6016:                   "varname">BUILD_DEPENDS</tt> or <tt class=
                   6017:                   "varname">DEPENDS</tt> to add the dependency on
                   6018:                   <i class="replaceable"><tt>pkg</tt></i>. The
                   6019:                   build dependency is selected by setting
                   6020:                   <tt class="varname">BUILDLINK_DEPMETHOD.<i class=
                   6021:                   "replaceable"><tt>pkg</tt></i></tt> to
                   6022:                   &#8220;<span class="quote">build</span>&#8221;.
                   6023:                   By default, the full dependency is used.</p>
                   6024:                 </li>
                   6025: 
                   6026:                 <li>
                   6027:                   <p><tt class=
                   6028:                   "varname">BUILDLINK_INCDIRS.<i class="replaceable">
                   6029:                   <tt>pkg</tt></i></tt> and <tt class=
                   6030:                   "varname">BUILDLINK_LIBDIRS.<i class=
                   6031:                   "replaceable"><tt>pkg</tt></i></tt> (not shown
                   6032:                   above) are lists of subdirectories of <tt class=
                   6033:                   "filename">${BUILDLINK_PREFIX.<i class=
                   6034:                   "replaceable"><tt>pkg</tt></i>}</tt> to add to
                   6035:                   the header and library search paths. These
                   6036:                   default to &#8220;<span class=
                   6037:                   "quote">include</span>&#8221; and
                   6038:                   &#8220;<span class="quote">lib</span>&#8221;
                   6039:                   respectively.</p>
                   6040:                 </li>
                   6041: 
                   6042:                 <li>
                   6043:                   <p><tt class=
                   6044:                   "varname">BUILDLINK_CPPFLAGS.<i class=
                   6045:                   "replaceable"><tt>pkg</tt></i></tt> (not shown
                   6046:                   above) is the list of preprocessor flags to add
                   6047:                   to <tt class="varname">CPPFLAGS</tt>, which are
                   6048:                   passed on to the configure and build phases. The
                   6049:                   &#8220;<span class="quote">-I</span>&#8221;
                   6050:                   option should be avoided and instead be handled
                   6051:                   using <tt class=
                   6052:                   "varname">BUILDLINK_INCDIRS.<i class=
                   6053:                   "replaceable"><tt>pkg</tt></i></tt> as above.</p>
                   6054:                 </li>
                   6055:               </ul>
                   6056:             </div>
                   6057: 
                   6058:             <p>The following variables are all optionally defined
                   6059:             within this second section (protected against multiple
                   6060:             inclusion) and control which package files are
                   6061:             symlinked into <tt class=
                   6062:             "filename">${BUILDLINK_DIR}</tt> and how their names
                   6063:             are transformed during the symlinking:</p>
                   6064: 
                   6065:             <div class="itemizedlist">
                   6066:               <ul type="disc">
                   6067:                 <li>
                   6068:                   <p><tt class="varname">BUILDLINK_FILES.<i class=
                   6069:                   "replaceable"><tt>pkg</tt></i></tt> (not shown
                   6070:                   above) is a shell glob pattern relative to
                   6071:                   <tt class="filename">${BUILDLINK_PREFIX.<i class=
                   6072:                   "replaceable"><tt>pkg</tt></i>}</tt> to be
                   6073:                   symlinked into <tt class=
                   6074:                   "filename">${BUILDLINK_DIR}</tt>, e.g. <tt class=
                   6075:                   "filename">include/*.h</tt>.</p>
                   6076:                 </li>
                   6077: 
                   6078:                 <li>
                   6079:                   <p><tt class=
                   6080:                   "varname">BUILDLINK_FILES_CMD.<i class=
                   6081:                   "replaceable"><tt>pkg</tt></i></tt> (not shown
                   6082:                   above) is a shell pipeline that outputs to stdout
                   6083:                   a list of files relative to <tt class=
                   6084:                   "filename">${BUILDLINK_PREFIX.<i class=
                   6085:                   "replaceable"><tt>pkg</tt></i>}</tt>. The
                   6086:                   resulting files are to be symlinked into
                   6087:                   <tt class="filename">${BUILDLINK_DIR}</tt>. By
                   6088:                   default, this takes the <tt class=
                   6089:                   "filename">+CONTENTS</tt> of a <i class=
                   6090:                   "replaceable"><tt>pkg</tt></i> and filters it
                   6091:                   through <tt class=
                   6092:                   "varname">${BUILDLINK_CONTENTS_FILTER.<i class=
                   6093:                   "replaceable"><tt>pkg</tt></i>}</tt>.</p>
                   6094:                 </li>
                   6095: 
                   6096:                 <li>
                   6097:                   <p><tt class=
                   6098:                   "varname">BUILDLINK_CONTENTS_FILTER.<i class=
                   6099:                   "replaceable"><tt>pkg</tt></i></tt> (not shown
                   6100:                   above) is a filter command that filters
                   6101:                   <tt class="filename">+CONTENTS</tt> input into a
                   6102:                   list of files relative to <tt class=
                   6103:                   "filename">${BUILDLINK_PREFIX.<i class=
                   6104:                   "replaceable"><tt>pkg</tt></i>}</tt> on stdout.
                   6105:                   By default for overwrite packages, <tt class=
                   6106:                   "varname">BUILDLINK_CONTENTS_FILTER.<i class=
                   6107:                   "replaceable"><tt>pkg</tt></i></tt> outputs the
                   6108:                   contents of the <tt class="filename">include</tt>
                   6109:                   and <tt class="filename">lib</tt> directories in
                   6110:                   the package <tt class="filename">+CONTENTS</tt>,
                   6111:                   and for pkgviews packages, it outputs any libtool
                   6112:                   archives in <tt class="filename">lib</tt>
                   6113:                   directories.</p>
                   6114:                 </li>
                   6115: 
                   6116:                 <li>
                   6117:                   <p><tt class=
                   6118:                   "varname">BUILDLINK_TRANSFORM.<i class=
                   6119:                   "replaceable"><tt>pkg</tt></i></tt> (not shown
                   6120:                   above) is a list of sed arguments used to
                   6121:                   transform the name of the source filename into a
                   6122:                   destination filename, e.g. <span><b class=
                   6123:                   "command">-e
                   6124:                   "s|/curses.h|/ncurses.h|g"</b></span>.</p>
                   6125:                 </li>
                   6126:               </ul>
                   6127:             </div>
                   6128: 
                   6129:             <p>The last section includes any <tt class=
                   6130:             "filename">buildlink3.mk</tt> needed for <i class=
                   6131:             "replaceable"><tt>pkg</tt></i>'s library dependencies.
                   6132:             Including these <tt class="filename">buildlink3.mk</tt>
                   6133:             files means that the headers and libraries for these
                   6134:             dependencies are also symlinked into <tt class=
                   6135:             "filename">${BUILDLINK_DIR}</tt> whenever the <i class=
                   6136:             "replaceable"><tt>pkg</tt></i> <tt class=
                   6137:             "filename">buildlink3.mk</tt> file is included.</p>
                   6138:           </div>
                   6139: 
                   6140:           <div class="sect2" lang="en" xml:lang="en">
                   6141:             <div class="titlepage">
                   6142:               <div>
                   6143:                 <div>
1.2     ! hubertf  6144:                   <h3 class="title"><a name="id2568150" id=
        !          6145:                   "id2568150"></a>9.2.2. Updating <tt class=
1.1       grant    6146:                   "varname">BUILDLINK_DEPENDS.<i class=
                   6147:                   "replaceable"><tt>pkg</tt></i></tt> in <tt class=
                   6148:                   "filename">buildlink3.mk</tt> files</h3>
                   6149:                 </div>
                   6150:               </div>
                   6151:             </div>
                   6152: 
                   6153:             <p>There are two situations that require increasing the
                   6154:             dependency listed in <tt class=
                   6155:             "varname">BUILDLINK_DEPENDS.<i class=
                   6156:             "replaceable"><tt>pkg</tt></i></tt> after a package
                   6157:             update:</p>
                   6158: 
                   6159:             <div class="orderedlist">
                   6160:               <ol type="1">
                   6161:                 <li>
                   6162:                   <p>if the sonames (major number of the library
                   6163:                   version) of any installed shared libraries
                   6164:                   change;</p>
                   6165:                 </li>
                   6166: 
                   6167:                 <li>
                   6168:                   <p>if the API or interface to the header files
                   6169:                   change.</p>
                   6170:                 </li>
                   6171:               </ol>
                   6172:             </div>
                   6173: 
                   6174:             <p>In these cases, <tt class=
                   6175:             "varname">BUILDLINK_DEPENDS.<i class=
                   6176:             "replaceable"><tt>pkg</tt></i></tt> should be adjusted
                   6177:             to require at least the new package version. In some
                   6178:             cases, the packages that depend on this new version may
                   6179:             need their <tt class="varname">PKGREVISION</tt>s
                   6180:             increased and, if they have <tt class=
                   6181:             "filename">buildlink3.mk</tt> files, their <tt class=
                   6182:             "varname">BUILDLINK_DEPENDS.<i class=
                   6183:             "replaceable"><tt>pkg</tt></i></tt> adjusted, too. This
                   6184:             is needed so that binary packages made using it will
                   6185:             require the correct package dependency and not settle
                   6186:             for an older one which will not contain the necessary
                   6187:             shared libraries.</p>
                   6188: 
                   6189:             <p>Please take careful consideration before adjusting
                   6190:             <tt class="varname">BUILDLINK_DEPENDS.<i class=
                   6191:             "replaceable"><tt>pkg</tt></i></tt> as we don't want to
                   6192:             cause unneeded package deletions and rebuilds. In many
                   6193:             cases, new versions of packages work just fine with
                   6194:             older dependencies. See <a href="#dependencies" title=
                   6195:             "12.1.3.&nbsp;Handling dependencies">Section 12.1.3,
                   6196:             &#8220;Handling dependencies&#8221;</a> and <a href=
                   6197:             "#buildlink" title=
                   6198:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter 9,
                   6199:             <i>Buildlink methodology</i></a> for more information
                   6200:             about dependencies on other packages, including the
                   6201:             <tt class="varname">BUILDLINK_RECOMMENDED</tt> and
                   6202:             <tt class="varname">RECOMMENDED</tt> definitions.</p>
                   6203:           </div>
                   6204:         </div>
                   6205: 
                   6206:         <div class="sect1" lang="en" xml:lang="en">
                   6207:           <div class="titlepage">
                   6208:             <div>
                   6209:               <div>
                   6210:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  6211:                 "id2568229" id="id2568229"></a>9.3.&nbsp;Writing
1.1       grant    6212:                 <tt class="filename">builtin.mk</tt> files</h2>
                   6213:               </div>
                   6214:             </div>
                   6215:           </div>
                   6216: 
                   6217:           <p>Some packages in pkgsrc install headers and libraries
                   6218:           that coincide with headers and libraries present in the
                   6219:           base system. Aside from a <tt class=
                   6220:           "filename">buildlink3.mk</tt> file, these packages should
                   6221:           also include a <tt class="filename">builtin.mk</tt> file
                   6222:           that includes the necessary checks to decide whether
                   6223:           using the built-in software or the pkgsrc software is
                   6224:           appropriate.</p>
                   6225: 
                   6226:           <p>The only requirements of a builtin.mk file for
                   6227:           <i class="replaceable"><tt>pkg</tt></i> are:</p>
                   6228: 
                   6229:           <div class="orderedlist">
                   6230:             <ol type="1">
                   6231:               <li>
                   6232:                 <p>It should set <tt class=
                   6233:                 "varname">USE_BUILTIN.<i class=
                   6234:                 "replaceable"><tt>pkg</tt></i></tt> to either
                   6235:                 &#8220;<span class="quote">yes</span>&#8221; or
                   6236:                 &#8220;<span class="quote">no</span>&#8221; after
                   6237:                 it is included.</p>
                   6238:               </li>
                   6239: 
                   6240:               <li>
                   6241:                 <p>It should <span class=
                   6242:                 "emphasis"><em>not</em></span> override any
                   6243:                 <tt class="varname">USE_BUILTIN.<i class=
                   6244:                 "replaceable"><tt>pkg</tt></i></tt> which is
                   6245:                 already set before the <tt class=
                   6246:                 "filename">builtin.mk</tt> file is included.</p>
                   6247:               </li>
                   6248: 
                   6249:               <li>
                   6250:                 <p>It should be written to allow multiple
                   6251:                 inclusion. This is <span class=
                   6252:                 "emphasis"><em>very</em></span> important and takes
                   6253:                 careful attention to <tt class=
                   6254:                 "filename">Makefile</tt> coding.</p>
                   6255:               </li>
                   6256:             </ol>
                   6257:           </div>
                   6258: 
                   6259:           <div class="sect2" lang="en" xml:lang="en">
                   6260:             <div class="titlepage">
                   6261:               <div>
                   6262:                 <div>
1.2     ! hubertf  6263:                   <h3 class="title"><a name="id2568378" id=
        !          6264:                   "id2568378"></a>9.3.1.&nbsp;Anatomy of a
1.1       grant    6265:                   <tt class="filename">builtin.mk</tt> file</h3>
                   6266:                 </div>
                   6267:               </div>
                   6268:             </div>
                   6269: 
                   6270:             <p>The following is the recommended template for
                   6271:             builtin.mk files:</p>
                   6272:             <pre class="programlisting">
                   6273: .if !defined(IS_BUILTIN.foo)
                   6274: #
                   6275: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   6276: # genuinely exists in the system or not.
                   6277: #
                   6278: IS_BUILTIN.foo?=        no
                   6279: 
                   6280: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   6281: # version can be determined.
                   6282: #
                   6283: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   6284: BUILTIN_PKG.foo?=       foo-1.0
                   6285: .  endif
                   6286: .endif  # IS_BUILTIN.foo
                   6287: 
                   6288: .if !defined(USE_BUILTIN.foo)
                   6289: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   6290: .  if defined(BUILTIN_PKG.foo)
                   6291: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   6292: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   6293: USE_BUILTIN.foo!=                                                       \
                   6294:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   6295:               ${ECHO} "yes";                                            \
                   6296:       else                                                              \
                   6297:               ${ECHO} "no";                                             \
                   6298:       fi
                   6299: .      endif
                   6300: .    endfor
                   6301: .  endif
                   6302: .endif  # USE_BUILTIN.foo
                   6303: 
                   6304: CHECK_BUILTIN.foo?=     no
                   6305: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   6306: #
                   6307: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   6308: # "yes" or "no".
                   6309: #
                   6310: .endif  # CHECK_BUILTIN.foo
                   6311:       
                   6312: </pre>
                   6313: 
                   6314:             <p>The first section sets <tt class=
                   6315:             "varname">IS_BUILTIN.<i class=
                   6316:             "replaceable"><tt>pkg</tt></i></tt> depending on if
                   6317:             <i class="replaceable"><tt>pkg</tt></i> really exists
                   6318:             in the base system. This should not be a base system
                   6319:             software with similar functionality to <i class=
                   6320:             "replaceable"><tt>pkg</tt></i>; it should only be
                   6321:             &#8220;<span class="quote">yes</span>&#8221; if the
                   6322:             actual package is included as part of the base system.
                   6323:             This variable is only used internally within the
                   6324:             <tt class="filename">builtin.mk</tt> file.</p>
                   6325: 
                   6326:             <p>The second section sets <tt class=
                   6327:             "varname">BUILTIN_PKG.<i class=
                   6328:             "replaceable"><tt>pkg</tt></i></tt> to the version of
                   6329:             <i class="replaceable"><tt>pkg</tt></i> in the base
                   6330:             system if it exists (if <tt class=
                   6331:             "varname">IS_BUILTIN.<i class=
                   6332:             "replaceable"><tt>pkg</tt></i></tt> is
                   6333:             &#8220;<span class="quote">yes</span>&#8221;). This
                   6334:             variable is only used internally within the <tt class=
                   6335:             "filename">builtin.mk</tt> file.</p>
                   6336: 
                   6337:             <p>The third section sets <tt class=
                   6338:             "varname">USE_BUILTIN.<i class=
                   6339:             "replaceable"><tt>pkg</tt></i></tt> and is <span class=
                   6340:             "emphasis"><em>required</em></span> in all <tt class=
                   6341:             "filename">builtin.mk</tt> files. The code in this
                   6342:             section must make the determination whether the
                   6343:             built-in software is adequate to satisfy the
                   6344:             dependencies listed in <tt class=
                   6345:             "varname">BUILDLINK_DEPENDS.<i class=
                   6346:             "replaceable"><tt>pkg</tt></i></tt>. This is typically
                   6347:             done by comparing <tt class=
                   6348:             "varname">BUILTIN_PKG.<i class=
                   6349:             "replaceable"><tt>pkg</tt></i></tt> against each of the
                   6350:             dependencies in <tt class=
                   6351:             "varname">BUILDLINK_DEPENDS.<i class=
                   6352:             "replaceable"><tt>pkg</tt></i></tt>. <tt class=
                   6353:             "varname">USE_BUILTIN.<i class=
                   6354:             "replaceable"><tt>pkg</tt></i></tt> <span class=
                   6355:             "emphasis"><em>must</em></span> be set to the correct
                   6356:             value by the end of the <tt class=
                   6357:             "filename">builtin.mk</tt> file. Note that <tt class=
                   6358:             "varname">USE_BUILTIN.<i class=
                   6359:             "replaceable"><tt>pkg</tt></i></tt> may be
                   6360:             &#8220;<span class="quote">yes</span>&#8221; even if
                   6361:             <tt class="varname">IS_BUILTIN.<i class=
                   6362:             "replaceable"><tt>pkg</tt></i></tt> is
                   6363:             &#8220;<span class="quote">no</span>&#8221; because we
                   6364:             may make the determination that the built-in version of
                   6365:             the software is similar enough to be used as a
                   6366:             replacement.</p>
                   6367: 
                   6368:             <p>The last section is guarded by <tt class=
                   6369:             "varname">CHECK_BUILTIN.<i class=
                   6370:             "replaceable"><tt>pkg</tt></i></tt>, and includes code
                   6371:             that uses the value of <tt class=
                   6372:             "varname">USE_BUILTIN.<i class=
                   6373:             "replaceable"><tt>pkg</tt></i></tt> set in the previous
                   6374:             section. This typically includes, e.g., adding
                   6375:             additional dependency restrictions and listing
                   6376:             additional files to symlink into <tt class=
                   6377:             "filename">${BUILDLINK_DIR}</tt> (via <tt class=
                   6378:             "varname">BUILDLINK_FILES.<i class=
                   6379:             "replaceable"><tt>pkg</tt></i></tt>).</p>
                   6380:           </div>
                   6381: 
                   6382:           <div class="sect2" lang="en" xml:lang="en">
                   6383:             <div class="titlepage">
                   6384:               <div>
                   6385:                 <div>
1.2     ! hubertf  6386:                   <h3 class="title"><a name="id2568537" id=
        !          6387:                   "id2568537"></a>9.3.2.&nbsp;Global preferences
1.1       grant    6388:                   for native or pkgsrc software</h3>
                   6389:                 </div>
                   6390:               </div>
                   6391:             </div>
                   6392: 
                   6393:             <p>When building packages, it's possible to choose
                   6394:             whether to set a global preference for using either the
                   6395:             built-in (native) version or the pkgsrc version of
                   6396:             software to satisfy a dependency. This is controlled by
                   6397:             setting <tt class="varname">PREFER_PKGSRC</tt> and
                   6398:             <tt class="varname">PREFER_NATIVE</tt>. These variables
                   6399:             take values of either &#8220;<span class=
                   6400:             "quote">yes</span>&#8221;, &#8220;<span class=
                   6401:             "quote">no</span>&#8221;, or a list of packages.
                   6402:             <tt class="varname">PREFER_PKGSRC</tt> tells pkgsrc to
                   6403:             use the pkgsrc versions of software, while <tt class=
                   6404:             "varname">PREFER_NATIVE</tt> tells pkgsrc to use the
                   6405:             built-in versions. Preferences are determined by the
                   6406:             most specific instance of the package in either
                   6407:             <tt class="varname">PREFER_PKGSRC</tt> or <tt class=
                   6408:             "varname">PREFER_NATIVE</tt>. If a package is specified
                   6409:             in neither or in both variables, then <tt class=
                   6410:             "varname">PREFER_PKGSRC</tt> has precedence over
                   6411:             <tt class="varname">PREFER_NATIVE</tt>. For example, to
                   6412:             require using pkgsrc versions of software for all but
                   6413:             the most basic bits on a NetBSD system, you can
                   6414:             set:</p>
                   6415:             <pre class="programlisting">
                   6416:         PREFER_PKGSRC=  yes
                   6417:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   6418:       
                   6419: </pre>
                   6420: 
                   6421:             <p>A package <span class=
                   6422:             "emphasis"><em>must</em></span> have a <tt class=
                   6423:             "filename">builtin.mk</tt> file to be listed in
                   6424:             <tt class="varname">PREFER_NATIVE</tt>, otherwise it is
                   6425:             simply ignored in that list.</p>
                   6426:           </div>
                   6427:         </div>
                   6428:       </div>
                   6429: 
                   6430:       <div class="chapter" lang="en" xml:lang="en">
                   6431:         <div class="titlepage">
                   6432:           <div>
                   6433:             <div>
                   6434:               <h2 class="title"><a name="options" id=
                   6435:               "options"></a>Chapter&nbsp;10.&nbsp;Options
                   6436:               handling</h2>
                   6437:             </div>
                   6438:           </div>
                   6439:         </div>
                   6440: 
                   6441:         <div class="toc">
                   6442:           <p><b>Table of Contents</b></p>
                   6443: 
                   6444:           <dl>
1.2     ! hubertf  6445:             <dt><span class="sect1"><a href="#id2568610">10.1.
1.1       grant    6446:             Global default options</a></span></dt>
                   6447: 
1.2     ! hubertf  6448:             <dt><span class="sect1"><a href="#id2568625">10.2.
1.1       grant    6449:             Converting packages to use
                   6450:             bsd.options.mk</a></span></dt>
                   6451:           </dl>
                   6452:         </div>
                   6453: 
                   6454:         <p>Many packages have the ability to be built to support
                   6455:         different sets of features. <tt class=
                   6456:         "filename">bsd.options.mk</tt> is a framework in pkgsrc
                   6457:         that provides generic handling of those options that
                   6458:         determine different ways in which the packages can be
                   6459:         built. It's possible for the user to specify exactly which
                   6460:         sets of options will be built into a package or to allow a
                   6461:         set of global default options apply.</p>
                   6462: 
                   6463:         <div class="sect1" lang="en" xml:lang="en">
                   6464:           <div class="titlepage">
                   6465:             <div>
                   6466:               <div>
                   6467:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  6468:                 "id2568610" id="id2568610"></a>10.1.&nbsp;Global
1.1       grant    6469:                 default options</h2>
                   6470:               </div>
                   6471:             </div>
                   6472:           </div>
                   6473: 
                   6474:           <p>Global default options are listed in <tt class=
                   6475:           "varname">PKG_DEFAULT_OPTIONS</tt>, which is a list of
                   6476:           the options that should be built into every package if
                   6477:           that option is supported. This variable should be set in
                   6478:           <tt class="filename">/etc/mk.conf</tt>.</p>
                   6479:         </div>
                   6480: 
                   6481:         <div class="sect1" lang="en" xml:lang="en">
                   6482:           <div class="titlepage">
                   6483:             <div>
                   6484:               <div>
                   6485:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  6486:                 "id2568625" id=
        !          6487:                 "id2568625"></a>10.2.&nbsp;Converting packages to
1.1       grant    6488:                 use <tt class="filename">bsd.options.mk</tt></h2>
                   6489:               </div>
                   6490:             </div>
                   6491:           </div>
                   6492: 
                   6493:           <p>The following example shows how <tt class=
                   6494:           "filename">bsd.options.mk</tt> should be use in a package
                   6495:           <tt class="filename">Makefile</tt>, or in a file, e.g.
                   6496:           <tt class="filename">options.mk</tt>, that is included by
                   6497:           the main package <tt class="filename">Makefile</tt>.</p>
                   6498:           <pre class="programlisting">
                   6499: # Global and legacy options
                   6500: .if defined(WIBBLE_USE_OPENLDAP) &amp;&amp; !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
                   6501: PKG_DEFAULT_OPTIONS+=   ldap
                   6502: .endif
                   6503: .if defined(USE_SASL2) &amp;&amp; !empty(USE_SASL2:M[yY][eE][sS])
                   6504: PKG_DEFAULT_OPTIONS+=   sasl
                   6505: .endif
                   6506: 
                   6507: PKG_OPTIONS_VAR=        PKG_OPTIONS.wibble
                   6508: PKG_SUPPORTED_OPTIONS=  ldap sasl
                   6509: #
                   6510: # Default options for "wibble" package.
                   6511: #
                   6512: .if !defined(PKG_OPTIONS.wibble)
                   6513: PKG_DEFAULT_OPTIONS+=   sasl
                   6514: endif
                   6515: .include "../../mk/bsd.options.mk"
                   6516: 
                   6517: # Package-specific option-handling
                   6518: 
                   6519: ###
                   6520: ### LDAP support
                   6521: ###
                   6522: .if !empty(PKG_OPTIONS:Mldap)
                   6523: .  include "../../databases/openldap/buildlink3.mk"
                   6524: CONFIGURE_ARGS+=      --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   6525: .endif
                   6526: 
                   6527: ###
                   6528: ### SASL authentication
                   6529: ###
                   6530: .if !empty(PKG_OPTIONS:Msasl)
                   6531: .  include "../../security/cyrus-sasl2/buildlink3.mk"
                   6532: CONFIGURE_ARGS+=        --enable-sasl=${BUILDLINK_PREFIX.sasl}
                   6533: .endif
                   6534:       
                   6535: </pre>
                   6536: 
                   6537:           <p>The first section only exists if you are converting a
                   6538:           package that had its own ad-hoc options handling to use
                   6539:           <tt class="filename">bsd.options.mk</tt>. It converts
                   6540:           global or legacy options variables into an equivalent
                   6541:           <tt class="varname">PKG_OPTIONS.<i class=
                   6542:           "replaceable"><tt>pkg</tt></i></tt> value. These sections
                   6543:           will be removed over time as the old options are in turn
                   6544:           deprecated and removed.</p>
                   6545: 
                   6546:           <p>The second section contains the information about
                   6547:           which build options are supported by the package, and any
                   6548:           default options settings if needed.</p>
                   6549: 
                   6550:           <div class="orderedlist">
                   6551:             <ol type="1">
                   6552:               <li>
                   6553:                 <p><tt class="varname">PKG_OPTIONS_VAR</tt> is a
                   6554:                 list of the name of the <a href=
                   6555:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6556:                 <span class="citerefentry"><span class=
                   6557:                 "refentrytitle">make</span>(1)</span></a> variables
                   6558:                 that contain the options the user wishes to select.
                   6559:                 The recommended value is &#8220;<span class=
                   6560:                 "quote">PKG_OPTIONS.<i class=
                   6561:                 "replaceable"><tt>pkg</tt></i></span>&#8221; but
                   6562:                 any package-specific value may be used. This
                   6563:                 variable should be set in a package Makefile.</p>
                   6564:               </li>
                   6565: 
                   6566:               <li>
                   6567:                 <p><tt class="varname">PKG_SUPPORTED_OPTIONS</tt>
                   6568:                 is a list of build options supported by the
                   6569:                 package. This variable should be set in a package
                   6570:                 Makefile.</p>
                   6571:               </li>
                   6572: 
                   6573:               <li>
                   6574:                 <p><tt class="varname">${PKG_OPTIONS_VAR}</tt> (the
                   6575:                 variables named in <tt class=
                   6576:                 "varname">PKG_OPTIONS_VAR</tt>) are variables that
                   6577:                 list the selected build options and override any
                   6578:                 default options given in <tt class=
                   6579:                 "varname">PKG_DEFAULT_OPTIONS</tt>. If any of the
                   6580:                 options begin with a &#8220;<span class=
                   6581:                 "quote">-</span>&#8221;, then that option is always
                   6582:                 removed from the selected build options, e.g.</p>
                   6583:                 <pre class="programlisting">
                   6584:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   6585:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6586:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
                   6587:         # implies PKG_OPTIONS == "kerberos ldap"
                   6588:           
                   6589: </pre>
                   6590: 
                   6591:                 <p>or</p>
                   6592:                 <pre class="programlisting">
                   6593:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6594:         WIBBLE_OPTIONS=         kerberos -ldap ldap
                   6595:         # implies PKG_OPTIONS == "kerberos"
                   6596:           
                   6597: </pre>
                   6598: 
                   6599:                 <p>This variable should be set in <tt class=
                   6600:                 "filename">/etc/mk.conf</tt>.</p>
                   6601:               </li>
                   6602:             </ol>
                   6603:           </div>
                   6604: 
                   6605:           <p>After the inclusion of bsd.options.mk, the following
                   6606:           variables are set:</p>
                   6607: 
                   6608:           <div class="itemizedlist">
                   6609:             <ul type="disc">
                   6610:               <li>
                   6611:                 <p><tt class="varname">PKG_OPTIONS</tt> contains
                   6612:                 the list of the selected build options, properly
                   6613:                 filtered to remove unsupported and duplicate
                   6614:                 options.</p>
                   6615:               </li>
                   6616:             </ul>
                   6617:           </div>
                   6618: 
                   6619:           <p>The remaining sections contain the logic that is
                   6620:           specific to each option. There should be a check for
                   6621:           every option listed in <tt class=
                   6622:           "varname">PKG_SUPPORTED_OPTIONS</tt>, and there should be
                   6623:           clear documentation on what turning on the option will do
                   6624:           in the comments preceding each section. The correct way
                   6625:           to check for an option is to check whether it is listed
                   6626:           in <tt class="varname">PKG_OPTIONS</tt>.</p>
                   6627:         </div>
                   6628:       </div>
                   6629: 
                   6630:       <div class="chapter" lang="en" xml:lang="en">
                   6631:         <div class="titlepage">
                   6632:           <div>
                   6633:             <div>
                   6634:               <h2 class="title"><a name="build" id=
                   6635:               "build"></a>Chapter&nbsp;11.&nbsp;The build
                   6636:               process</h2>
                   6637:             </div>
                   6638:           </div>
                   6639:         </div>
                   6640: 
                   6641:         <div class="toc">
                   6642:           <p><b>Table of Contents</b></p>
                   6643: 
                   6644:           <dl>
                   6645:             <dt><span class="sect1"><a href="#build.prefix">11.1.
                   6646:             Program location</a></span></dt>
                   6647: 
1.2     ! hubertf  6648:             <dt><span class="sect1"><a href="#id2569369">11.2. Main
1.1       grant    6649:             targets</a></span></dt>
                   6650: 
                   6651:             <dt><span class="sect1"><a href=
                   6652:             "#build.helpful-targets">11.3. Other helpful
                   6653:             targets</a></span></dt>
                   6654:           </dl>
                   6655:         </div>
                   6656: 
                   6657:         <p>The basic steps for building a program are always the
                   6658:         same. First the program's source (<span class=
                   6659:         "emphasis"><em>distfile</em></span>) must be brought to the
                   6660:         local system and then extracted. After any patches to
                   6661:         compile properly on NetBSD are applied, the software can be
                   6662:         configured, then built (usually by compiling), and finally
                   6663:         the generated binaries, etc. can be put into place on the
                   6664:         system. These are exactly the steps performed by the NetBSD
                   6665:         package system, which is implemented as a series of targets
                   6666:         in a central Makefile, <tt class=
                   6667:         "filename">pkgsrc/mk/bsd.pkg.mk</tt>.</p>
                   6668: 
                   6669:         <div class="sect1" lang="en" xml:lang="en">
                   6670:           <div class="titlepage">
                   6671:             <div>
                   6672:               <div>
                   6673:                 <h2 class="title" style="clear: both"><a name=
                   6674:                 "build.prefix" id=
                   6675:                 "build.prefix"></a>11.1.&nbsp;Program location</h2>
                   6676:               </div>
                   6677:             </div>
                   6678:           </div>
                   6679: 
                   6680:           <p>Before outlining the process performed by the NetBSD
                   6681:           package system in the next section, here's a brief
                   6682:           discussion on where programs are installed, and which
                   6683:           variables influence this.</p>
                   6684: 
                   6685:           <p>The automatic variable <tt class="varname">PREFIX</tt>
                   6686:           indicates where all files of the final program shall be
                   6687:           installed. It is usually set to <tt class=
                   6688:           "varname">LOCALBASE</tt> (<tt class=
                   6689:           "filename">/usr/pkg</tt>), or <tt class=
                   6690:           "varname">CROSSBASE</tt> for pkgs in the
                   6691:           &#8220;<span class="quote">cross</span>&#8221; category.
                   6692:           The value of <tt class="varname">PREFIX</tt> needs to be
                   6693:           put into the various places in the program's source where
                   6694:           paths to these files are encoded. See <a href=
                   6695:           "#components.patches" title=
                   6696:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   6697:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   6698:           title=
                   6699:           "12.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;12.3.1,
                   6700:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   6701:           details.</p>
                   6702: 
                   6703:           <p>When choosing which of these variables to use, follow
                   6704:           the following rules:</p>
                   6705: 
                   6706:           <div class="itemizedlist">
                   6707:             <ul type="disc">
                   6708:               <li>
                   6709:                 <p><tt class="varname">PREFIX</tt> always points to
                   6710:                 the location where the current pkg will be
                   6711:                 installed. When referring to a pkg's own
                   6712:                 installation path, use &#8220;<span class=
                   6713:                 "quote">${PREFIX}</span>&#8221;.</p>
                   6714:               </li>
                   6715: 
                   6716:               <li>
                   6717:                 <p><tt class="varname">LOCALBASE</tt> is where all
                   6718:                 non-X11 pkgs are installed. If you need to
                   6719:                 construct a -I or -L argument to the compiler to
                   6720:                 find includes and libraries installed by another
                   6721:                 non-X11 pkg, use &#8220;<span class=
                   6722:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   6723:               </li>
                   6724: 
                   6725:               <li>
                   6726:                 <p><tt class="varname">X11BASE</tt> is where the
                   6727:                 actual X11 distribution (from xsrc, etc.) is
                   6728:                 installed. When looking for <span class=
                   6729:                 "emphasis"><em>standard</em></span> X11 includes
                   6730:                 (not those installed by a pkg), use
                   6731:                 &#8220;<span class=
                   6732:                 "quote">${X11BASE}</span>&#8221;.</p>
                   6733:               </li>
                   6734: 
                   6735:               <li>
                   6736:                 <p>X11 based are special in that they may be
                   6737:                 installed in either <tt class=
                   6738:                 "varname">X11BASE</tt> or <tt class=
                   6739:                 "varname">LOCALBASE</tt>.</p>
                   6740: 
                   6741:                 <p>Usually, X11 packages should be installed under
                   6742:                 <tt class="varname">LOCALBASE</tt> whenever
                   6743:                 possible. Note that you will need to set <tt class=
                   6744:                 "varname">USE_X11</tt> in them to request the
                   6745:                 presence of X11 and to get the right compilation
                   6746:                 flags.</p>
                   6747: 
                   6748:                 <p>Even though, there are some packages that cannot
                   6749:                 be installed under <tt class=
                   6750:                 "varname">LOCALBASE</tt>: those that come with
                   6751:                 app-defaults files. These packages are special and
                   6752:                 they must be placed under <tt class=
                   6753:                 "varname">X11BASE</tt>. To accomplish this, set
                   6754:                 either <tt class="varname">USE_X11BASE</tt> or
                   6755:                 <tt class="varname">USE_IMAKE</tt> in your
                   6756:                 package.</p>
                   6757: 
                   6758:                 <p>Some notes: <tt class="varname">USE_X11</tt> and
                   6759:                 <tt class="varname">USE_X11BASE</tt> are mutually
                   6760:                 exclusive. If you need to find includes or
                   6761:                 libraries installed by a pkg that has <tt class=
                   6762:                 "varname">USE_IMAKE</tt> or <tt class=
                   6763:                 "varname">USE_X11BASE</tt> in its pkg <tt class=
                   6764:                 "filename">Makefile</tt>, you need to use
                   6765:                 <span class="emphasis"><em>both</em></span>
                   6766:                 <tt class="filename">${X11BASE}</tt> and <tt class=
                   6767:                 "filename">${LOCALBASE}</tt>. To force installation
                   6768:                 of all X11 packages in <tt class=
                   6769:                 "varname">LOCALBASE</tt>, the <a xmlns=
                   6770:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6771:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.2     ! hubertf  6772:                    class="pkgname">pkgtools/xpkgwedge</a> is
        !          6773:                    enabled by default.</p>
1.1       grant    6774:               </li>
                   6775: 
                   6776:               <li>
                   6777:                 <p><tt class="varname">X11PREFIX</tt> should be
                   6778:                 used to refer to the installed location of an X11
                   6779:                 package. <tt class="varname">X11PREFIX</tt> will be
                   6780:                 set to <tt class="varname">X11BASE</tt> if
                   6781:                 xpkgwedge is not installed, and to <tt class=
                   6782:                 "varname">LOCALBASE</tt> if xpkgwedge is
                   6783:                 installed.</p>
                   6784:               </li>
                   6785: 
                   6786:               <li>
                   6787:                 <p>If xpkgwedge is installed, it is possible to
                   6788:                 have some packages installed in <tt class=
                   6789:                 "varname">X11BASE</tt> and some in <tt class=
                   6790:                 "varname">LOCALBASE</tt>. To determine the prefix
                   6791:                 of an installed package, the <tt class=
                   6792:                 "varname">EVAL_PREFIX</tt> definition can be used.
                   6793:                 It takes pairs in the format &#8220;<span class=
                   6794:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
                   6795:                 the make(1) variable <tt class=
                   6796:                 "varname">DIRNAME</tt> will be set to the prefix of
                   6797:                 the installed package &lt;package&gt;, or
                   6798:                 &#8220;<span class=
                   6799:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   6800:                 is not installed.</p>
                   6801: 
                   6802:                 <p>This is best illustrated by example.</p>
                   6803: 
                   6804:                 <p>The following lines are taken from <tt class=
                   6805:                 "filename">pkgsrc/wm/scwm/Makefile</tt>:</p>
                   6806:                 <pre class="programlisting">
                   6807: EVAL_PREFIX+=               GTKDIR=gtk+
                   6808: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   6809:                         --with-gtk-prefix="${GTKDIR}"           \
                   6810:                         --enable-multibyte
                   6811: </pre>
                   6812: 
                   6813:                 <p>Specific defaults can be defined for the
                   6814:                 packages evaluated using <tt class=
                   6815:                 "varname">EVAL_PREFIX</tt>, by using a definition
                   6816:                 of the form:</p>
                   6817:                 <pre class="programlisting">
                   6818: GTKDIR_DEFAULT= ${LOCALBASE}
                   6819: </pre>
                   6820: 
                   6821:                 <p>where <tt class="varname">GTKDIR</tt>
                   6822:                 corresponds to the first definition in the
                   6823:                 <tt class="varname">EVAL_PREFIX</tt> pair.</p>
                   6824:               </li>
                   6825: 
                   6826:               <li>
                   6827:                 <p>Within <tt class="filename">${PREFIX}</tt>,
                   6828:                 packages should install files according to hier(7),
                   6829:                 with the exception that manual pages go into
                   6830:                 <tt class="filename">${PREFIX}/man</tt>, not
                   6831:                 <tt class="filename">${PREFIX}/share/man</tt>.</p>
                   6832:               </li>
                   6833:             </ul>
                   6834:           </div>
                   6835:         </div>
                   6836: 
                   6837:         <div class="sect1" lang="en" xml:lang="en">
                   6838:           <div class="titlepage">
                   6839:             <div>
                   6840:               <div>
                   6841:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  6842:                 "id2569369" id="id2569369"></a>11.2.&nbsp;Main
1.1       grant    6843:                 targets</h2>
                   6844:               </div>
                   6845:             </div>
                   6846:           </div>
                   6847: 
                   6848:           <p>The main targets used during the build process defined
                   6849:           in <tt class="filename">bsd.pkg.mk</tt> are:</p>
                   6850: 
                   6851:           <div class="variablelist">
                   6852:             <dl>
                   6853:               <dt><span class="term">fetch</span></dt>
                   6854: 
                   6855:               <dd>
                   6856:                 <p>This will check if the file(s) given in the
                   6857:                 variables <tt class="varname">DISTFILES</tt> and
                   6858:                 <tt class="varname">PATCHFILES</tt> (as defined in
                   6859:                 the package's Makefile) are present on the local
                   6860:                 system in <tt class=
                   6861:                 "filename">/usr/pkgsrc/distfiles</tt>. If they are
                   6862:                 not present, an attempt will be made to fetch them
                   6863:                 using commands of the form:</p>
                   6864:                 <pre class="programlisting">
                   6865: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   6866: </pre>
                   6867: 
                   6868:                 <p>where ${site} varies through several
                   6869:                 possibilities in turn: first, <tt class=
                   6870:                 "varname">MASTER_SITE_OVERRIDE</tt> is tried, then
                   6871:                 the sites specified in either <tt class=
                   6872:                 "varname">SITES_file</tt> if defined, else
                   6873:                 <tt class="varname">MASTER_SITES</tt> or <tt class=
                   6874:                 "varname">PATCH_SITES</tt>, as applies, then
                   6875:                 finally the value of <tt class=
                   6876:                 "varname">MASTER_SITE_BACKUP</tt>. The order of all
                   6877:                 except the first can be optionally sorted by the
                   6878:                 user, via setting either <tt class=
                   6879:                 "varname">MASTER_SORT_AWK</tt> or <tt class=
                   6880:                 "varname">MASTER_SORT_REGEX</tt>.</p>
                   6881:               </dd>
                   6882: 
                   6883:               <dt><span class="term">checksum</span></dt>
                   6884: 
                   6885:               <dd>
                   6886:                 <p>After the distfile(s) are fetched, their
                   6887:                 checksum is generated and compared with the
                   6888:                 checksums stored in the distinfo file. If the
                   6889:                 checksums don't match, the build is aborted. This
                   6890:                 is to ensure the same distfile is used for
                   6891:                 building, and that the distfile wasn't changed,
                   6892:                 e.g. by some malign force, deliberately changed
                   6893:                 distfiles on the master distribution site or
                   6894:                 network lossage.</p>
                   6895:               </dd>
                   6896: 
                   6897:               <dt><span class="term">extract</span></dt>
                   6898: 
                   6899:               <dd>
                   6900:                 <p>When the distfiles are present on the local
                   6901:                 system, they need to be extracted, as they are
                   6902:                 usually in the form of some compressed archive
                   6903:                 format, most commonly <tt class=
                   6904:                 "filename">.tar.gz</tt>.</p>
                   6905: 
                   6906:                 <p>If only some of the distfiles need to be
                   6907:                 uncompressed, the files to be uncompressed should
                   6908:                 be put into <tt class=
                   6909:                 "varname">EXTRACT_ONLY</tt>.</p>
                   6910: 
                   6911:                 <p>If the distfiles are not in <tt class=
                   6912:                 "filename">.tar.gz</tt> format, they can be
                   6913:                 extracted by setting either <tt class=
                   6914:                 "varname">EXTRACT_SUFX</tt>, or <tt class=
                   6915:                 "varname">EXTRACT_CMD</tt>, <tt class=
                   6916:                 "varname">EXTRACT_BEFORE_ARGS</tt> and <tt class=
                   6917:                 "varname">EXTRACT_AFTER_ARGS</tt>. In the former
                   6918:                 case, pkgsrc knows how to extract a number of
                   6919:                 suffixes (<tt class="filename">.tar.gz</tt>,
                   6920:                 <tt class="filename">.tgz</tt>, <tt class=
                   6921:                 "filename">.tar.gz2</tt>, <tt class=
                   6922:                 "filename">.tbz</tt>, <tt class=
                   6923:                 "filename">.tar.Z</tt>, <tt class=
                   6924:                 "filename">.tar</tt>, <tt class=
                   6925:                 "filename">.shar.gz</tt>, <tt class=
                   6926:                 "filename">.shar.bz2</tt>, <tt class=
                   6927:                 "filename">.shar.Z</tt>, <tt class=
                   6928:                 "filename">.shar</tt>, <tt class=
                   6929:                 "filename">.Z</tt>, <tt class="filename">.bz2</tt>
                   6930:                 and <tt class="filename">.gz</tt>; see the
                   6931:                 definition of the various <tt class=
                   6932:                 "varname">DECOMPRESS_CMD</tt> variables <tt class=
                   6933:                 "filename">bsd.pkg.mk</tt> for a complete list).
                   6934:                 Here's an example on how to use the other variables
                   6935:                 for a program that comes with a compressed shell
                   6936:                 archive whose name ends in <tt class=
                   6937:                 "filename">.msg.gz</tt>:</p>
                   6938:                 <pre class="programlisting">
                   6939:      EXTRACT_SUFX=   .msg.gz
                   6940:      EXTRACT_CMD=            zcat
                   6941:      EXTRACT_BEFORE_ARGS=
                   6942:      EXTRACT_AFTER_ARGS=     |sh
                   6943: </pre>
                   6944:               </dd>
                   6945: 
                   6946:               <dt><span class="term">patch</span></dt>
                   6947: 
                   6948:               <dd>
                   6949:                 <p>After extraction, all the patches named by the
                   6950:                 <tt class="varname">PATCHFILES</tt>, those present
                   6951:                 in the patches subdirectory of the package as well
                   6952:                 as in $LOCALPATCHES/$PKGPATH (e.g. <tt class=
                   6953:                 "filename">/usr/local/patches/graphics/png</tt>)
                   6954:                 are applied. Patchfiles ending in <tt class=
                   6955:                 "filename">.Z</tt> or <tt class="filename">.gz</tt>
                   6956:                 are uncompressed before they are applied, files
                   6957:                 ending in <tt class="filename">.orig</tt> or
                   6958:                 <tt class="filename">.rej</tt> are ignored. Any
                   6959:                 special options to patch(1) can be handed in
                   6960:                 <tt class="varname">PATCH_DIST_ARGS</tt>. See
                   6961:                 <a href="#components.patches" title=
                   6962:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   6963:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   6964: 
                   6965:                 <p>By default patch(1) is given special args to
                   6966:                 make it fail if the patches apply with some lines
                   6967:                 of fuzz. Please fix (regen) the patches so that
                   6968:                 they apply cleanly. The rationale behind this is
                   6969:                 that patches that don't apply cleanly may end up
                   6970:                 being applied in the wrong place, and cause severe
                   6971:                 harm there.</p>
                   6972:               </dd>
                   6973: 
                   6974:               <dt><span class="term">configure</span></dt>
                   6975: 
                   6976:               <dd>
                   6977:                 <p>Most pieces of software need information on the
                   6978:                 header files, system calls, and library routines
                   6979:                 which are available in NetBSD. This is the process
                   6980:                 known as configuration, and is usually automated.
                   6981:                 In most cases, a script is supplied with the
                   6982:                 source, and its invocation results in generation of
                   6983:                 header files, Makefiles, etc.</p>
                   6984: 
                   6985:                 <p>If the program's distfile contains its own
                   6986:                 configure script, this can be invoked by setting
                   6987:                 <tt class="varname">HAS_CONFIGURE</tt>. If the
                   6988:                 configure script is a GNU autoconf script,
                   6989:                 <tt class="varname">GNU_CONFIGURE</tt> should be
                   6990:                 specified instead. In either case, any arguments to
                   6991:                 the configure script can be specified in the
                   6992:                 <tt class="varname">CONFIGURE_ARGS</tt> variable,
                   6993:                 and the configure script's name can be set in
                   6994:                 <tt class="varname">CONFIGURE_SCRIPT</tt> if it
                   6995:                 differs from the default &#8220;<span class=
                   6996:                 "quote">configure</span>&#8221;. Here's an example
                   6997:                 from the <a xmlns=
                   6998:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6999:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.2     ! hubertf  7000:                    class="pkgname">sysutils/top</a> package:</p>
1.1       grant    7001:                 <pre class="programlisting">
                   7002: HAS_CONFIGURE=          yes
                   7003: CONFIGURE_SCRIPT=       Configure
                   7004: CONFIGURE_ARGS+=        netbsd13
                   7005: </pre>
                   7006: 
                   7007:                 <p>If the program uses an Imakefile for
                   7008:                 configuration, the appropriate steps can be invoked
                   7009:                 by setting <tt class="varname">USE_IMAKE</tt> to
                   7010:                 &#8220;<span class="quote">YES</span>&#8221;. (If
                   7011:                 you only want the package installed in <tt class=
                   7012:                 "varname">$X11PREFIX</tt> but xmkmf not being run,
                   7013:                 set <tt class="varname">USE_X11BASE</tt>
                   7014:                 instead!)</p>
                   7015:               </dd>
                   7016: 
                   7017:               <dt><span class="term">build</span></dt>
                   7018: 
                   7019:               <dd>
                   7020:                 <p>Once configuration has taken place, the software
                   7021:                 will be built by invoking <tt class=
                   7022:                 "varname">$MAKE_PROGRAM</tt> on <tt class=
                   7023:                 "varname">$MAKEFILE</tt> with <tt class=
                   7024:                 "varname">$ALL_TARGET</tt> as the target to build.
                   7025:                 The default <tt class="varname">MAKE_PROGRAM</tt>
                   7026:                 is &#8220;<span class="quote">gmake</span>&#8221;
                   7027:                 if <tt class="varname">USE_GMAKE</tt> is set,
                   7028:                 &#8220;<span class="quote">make</span>&#8221;
                   7029:                 otherwise. <tt class="varname">MAKEFILE</tt> is set
                   7030:                 to &#8220;<span class=
                   7031:                 "quote">Makefile</span>&#8221; by default, and
                   7032:                 <tt class="varname">ALL_TARGET</tt> defaults to
                   7033:                 &#8220;<span class="quote">all</span>&#8221;. Any
                   7034:                 of these variables can be set in the package's
                   7035:                 Makefile to change the default build process.</p>
                   7036:               </dd>
                   7037: 
                   7038:               <dt><span class="term">install</span></dt>
                   7039: 
                   7040:               <dd>
                   7041:                 <p>Once the build stage has completed, the final
                   7042:                 step is to install the software in public
                   7043:                 directories, so users can access the programs and
                   7044:                 files. As in the build-target, <tt class=
                   7045:                 "varname">$MAKE_PROGRAM</tt> is invoked on
                   7046:                 <tt class="varname">$MAKEFILE</tt> here, but with
                   7047:                 the <tt class="varname">$INSTALL_TARGET</tt>
                   7048:                 instead, the latter defaulting to
                   7049:                 &#8220;<span class="quote">install</span>&#8221;
                   7050:                 (plus &#8220;<span class=
                   7051:                 "quote">install.man</span>&#8221;, if <tt class=
                   7052:                 "varname">USE_IMAKE</tt> is set).</p>
                   7053:               </dd>
                   7054:             </dl>
                   7055:           </div>
                   7056: 
                   7057:           <p>If no target is specified, the default is
                   7058:           &#8220;<span class="quote">build</span>&#8221;. If a
                   7059:           subsequent stage is requested, all prior stages are made:
                   7060:           e.g. <span><b class="command">make build</b></span> will
                   7061:           also perform the equivalent of:</p>
                   7062:           <pre class="programlisting">
                   7063: make fetch
                   7064: make checksum
                   7065: make extract
                   7066: make patch
                   7067: make configure
                   7068: make build
                   7069: </pre>
                   7070:         </div>
                   7071: 
                   7072:         <div class="sect1" lang="en" xml:lang="en">
                   7073:           <div class="titlepage">
                   7074:             <div>
                   7075:               <div>
                   7076:                 <h2 class="title" style="clear: both"><a name=
                   7077:                 "build.helpful-targets" id=
                   7078:                 "build.helpful-targets"></a>11.3.&nbsp;Other
                   7079:                 helpful targets</h2>
                   7080:               </div>
                   7081:             </div>
                   7082:           </div>
                   7083: 
                   7084:           <div class="variablelist">
                   7085:             <dl>
                   7086:               <dt><span class="term">pre/post-*</span></dt>
                   7087: 
                   7088:               <dd>
                   7089:                 <p>For any of the main targets described in the
                   7090:                 previous section, two auxiliary targets exist with
                   7091:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   7092:                 &#8220;<span class="quote">post-</span>&#8221; used
                   7093:                 as a prefix for the main target's name. These
                   7094:                 targets are invoked before and after the main
                   7095:                 target is called, allowing extra configuration or
                   7096:                 installation steps be performed from a package's
                   7097:                 Makefile, for example, which a program's configure
                   7098:                 script or install target omitted.</p>
                   7099:               </dd>
                   7100: 
                   7101:               <dt><span class="term">do-*</span></dt>
                   7102: 
                   7103:               <dd>
                   7104:                 <p>Should one of the main targets do the wrong
                   7105:                 thing, and should there be no variable to fix this,
                   7106:                 you can redefine it with the do-* target. (Note
                   7107:                 that redefining the target itself instead of the
                   7108:                 do-* target is a bad idea, as the pre-* and post-*
                   7109:                 targets won't be called anymore, etc.) You will not
                   7110:                 usually need to do this.</p>
                   7111:               </dd>
                   7112: 
                   7113:               <dt><span class="term">reinstall</span></dt>
                   7114: 
                   7115:               <dd>
                   7116:                 <p>If you did a <span><b class="command">make
                   7117:                 install</b></span> and you noticed some file was
                   7118:                 not installed properly, you can repeat the
                   7119:                 installation with this target, which will ignore
                   7120:                 the &#8220;<span class="quote">already
                   7121:                 installed</span>&#8221; flag.</p>
                   7122:               </dd>
                   7123: 
                   7124:               <dt><span class="term">deinstall</span></dt>
                   7125: 
                   7126:               <dd>
                   7127:                 <p>This target does a pkg_delete(1) in the current
                   7128:                 directory, effectively de-installing the package.
                   7129:                 The following variables can be used to tune the
                   7130:                 behaviour:</p>
                   7131: 
                   7132:                 <div class="variablelist">
                   7133:                   <dl>
                   7134:                     <dt><span class="term"><tt class=
                   7135:                     "varname">PKG_VERBOSE</tt></span></dt>
                   7136: 
                   7137:                     <dd>
                   7138:                       <p>Add a "-v" to the <a href=
                   7139:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7140:                       <span class="citerefentry"><span class=
                   7141:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7142:                       command.</p>
                   7143:                     </dd>
                   7144: 
                   7145:                     <dt><span class="term"><tt class=
                   7146:                     "varname">DEINSTALLDEPENDS</tt></span></dt>
                   7147: 
                   7148:                     <dd>
                   7149:                       <p>Remove all packages that require (depend
                   7150:                       on) the given package. This can be used to
                   7151:                       remove any packages that may have been pulled
                   7152:                       in by a given package, e.g. if
                   7153:                       <span><b class="command">make deinstall
                   7154:                       DEINSTALLDEPENDS=1</b></span> is done in
                   7155:                       <tt class="filename">pkgsrc/x11/kde</tt>,
                   7156:                       this is likely to remove whole KDE. Works by
                   7157:                       adding &#8220;<span class=
                   7158:                       "quote">-R</span>&#8221; to the <a href=
                   7159:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7160:                       <span class="citerefentry"><span class=
                   7161:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7162:                       command line.</p>
                   7163:                     </dd>
                   7164:                   </dl>
                   7165:                 </div>
                   7166:               </dd>
                   7167: 
                   7168:               <dt><span class="term">update</span></dt>
                   7169: 
                   7170:               <dd>
                   7171:                 <p>This target causes the current package to be
                   7172:                 updated to the latest version. The package and all
                   7173:                 depending packages first get de-installed, then
                   7174:                 current versions of the corresponding packages get
                   7175:                 compiled and installed. This is similar to manually
                   7176:                 noting which packages are currently installed, then
                   7177:                 performing a series of <span><b class=
                   7178:                 "command">make deinstall</b></span> and
                   7179:                 <span><b class="command">make install</b></span>
                   7180:                 (or whatever <tt class="varname">UPDATE_TARGET</tt>
                   7181:                 is set to) for these packages.</p>
                   7182: 
                   7183:                 <p>You can use the &#8220;<span class=
                   7184:                 "quote">update</span>&#8221; target to resume
                   7185:                 package updating in case a previous <span><b class=
                   7186:                 "command">make update</b></span> was interrupted
                   7187:                 for some reason. However, in this case, make sure
                   7188:                 you don't call <span><b class="command">make
                   7189:                 clean</b></span> or otherwise remove the list of
                   7190:                 dependent packages in <tt class=
                   7191:                 "varname">WRKDIR</tt>. Otherwise you lose the
                   7192:                 ability to automatically update the current package
                   7193:                 along with the dependent packages you have
                   7194:                 installed.</p>
                   7195: 
                   7196:                 <p>Resuming an interrupted <span><b class=
                   7197:                 "command">make update</b></span> will only work as
                   7198:                 long as the package tree remains unchanged. If the
                   7199:                 source code for one of the packages to be updated
                   7200:                 has been changed, resuming <span><b class=
                   7201:                 "command">make update</b></span> will most
                   7202:                 certainly fail!</p>
                   7203: 
                   7204:                 <p>The following variables can be used either on
                   7205:                 the command line or in <tt class=
                   7206:                 "filename">/etc/mk.conf</tt> to alter the behaviour
                   7207:                 of <span><b class="command">make
                   7208:                 update</b></span>:</p>
                   7209: 
                   7210:                 <div class="variablelist">
                   7211:                   <dl>
                   7212:                     <dt><span class="term"><tt class=
                   7213:                     "varname">UPDATE_TARGET</tt></span></dt>
                   7214: 
                   7215:                     <dd>
                   7216:                       <p>Install target to recursively use for the
                   7217:                       updated package and the dependent packages.
                   7218:                       Defaults to <tt class=
                   7219:                       "varname">DEPENDS_TARGET</tt> if set,
                   7220:                       &#8220;<span class=
                   7221:                       "quote">install</span>&#8221; otherwise for
                   7222:                       <span><b class="command">make
                   7223:                       update</b></span>. e.g. <span><b class=
                   7224:                       "command">make update
                   7225:                       UPDATE_TARGET=package</b></span></p>
                   7226:                     </dd>
                   7227: 
                   7228:                     <dt><span class="term"><tt class=
                   7229:                     "varname">NOCLEAN</tt></span></dt>
                   7230: 
                   7231:                     <dd>
                   7232:                       <p>Don't clean up after updating. Useful if
                   7233:                       you want to leave the work sources of the
                   7234:                       updated packages around for inspection or
                   7235:                       other purposes. Be sure you eventually clean
                   7236:                       up the source tree (see the
                   7237:                       &#8220;<span class=
                   7238:                       "quote">clean-update</span>&#8221; target
                   7239:                       below) or you may run into troubles with old
                   7240:                       source code still lying around on your next
                   7241:                       <span><b class="command">make</b></span> or
                   7242:                       <span><b class="command">make
                   7243:                       update</b></span>.</p>
                   7244:                     </dd>
                   7245: 
                   7246:                     <dt><span class="term"><tt class=
                   7247:                     "varname">REINSTALL</tt></span></dt>
                   7248: 
                   7249:                     <dd>
                   7250:                       <p>Deinstall each package before installing
                   7251:                       (making <tt class=
                   7252:                       "varname">DEPENDS_TARGET</tt>). This may be
                   7253:                       necessary if the &#8220;<span class=
                   7254:                       "quote">clean-update</span>&#8221; target
                   7255:                       (see below) was called after interrupting a
                   7256:                       running <span><b class="command">make
                   7257:                       update</b></span>.</p>
                   7258:                     </dd>
                   7259: 
                   7260:                     <dt><span class="term"><tt class=
                   7261:                     "varname">DEPENDS_TARGET</tt></span></dt>
                   7262: 
                   7263:                     <dd>
                   7264:                       <p>Allows you to disable recursion and
                   7265:                       hardcode the target for packages. The default
                   7266:                       is &#8220;<span class=
                   7267:                       "quote">update</span>&#8221; for the update
                   7268:                       target, facilitating a recursive update of
                   7269:                       prerequisite packages. Only set <tt class=
                   7270:                       "varname">DEPENDS_TARGET</tt> if you want to
                   7271:                       disable recursive updates. Use <tt class=
                   7272:                       "varname">UPDATE_TARGET</tt> instead to just
                   7273:                       set a specific target for each package to be
                   7274:                       installed during <span><b class=
                   7275:                       "command">make update</b></span> (see
                   7276:                       above).</p>
                   7277:                     </dd>
                   7278:                   </dl>
                   7279:                 </div>
                   7280:               </dd>
                   7281: 
                   7282:               <dt><span class="term">clean-update</span></dt>
                   7283: 
                   7284:               <dd>
                   7285:                 <p>Clean the source tree for all packages that
                   7286:                 would get updated if <span><b class="command">make
                   7287:                 update</b></span> was called from the current
                   7288:                 directory. This target should not be used if the
                   7289:                 current package (or any of its depending packages)
                   7290:                 have already been de-installed (e.g., after calling
                   7291:                 <span><b class="command">make update</b></span>) or
                   7292:                 you may lose some packages you intended to update.
                   7293:                 As a rule of thumb: only use this target
                   7294:                 <span class="emphasis"><em>before</em></span> the
                   7295:                 first time you run <span><b class="command">make
                   7296:                 update</b></span> and only if you have a dirty
                   7297:                 package tree (e.g., if you used <tt class=
                   7298:                 "varname">NOCLEAN</tt>).</p>
                   7299: 
                   7300:                 <p>If you unsure about whether your tree is clean
                   7301:                 you can either perform a <span><b class=
                   7302:                 "command">make clean</b></span> at the top of the
                   7303:                 tree, or use the following sequence of commands
                   7304:                 from the directory of the package you want to
                   7305:                 update (<span class=
                   7306:                 "emphasis"><em>before</em></span> running
                   7307:                 <span><b class="command">make update</b></span> for
                   7308:                 the first time, otherwise you lose all the packages
                   7309:                 you wanted to update!):</p>
                   7310:                 <pre class="screen">
                   7311: <tt class="prompt">#</tt> <b class=
                   7312: "userinput"><tt>make clean-update</tt></b>
                   7313: <tt class="prompt">#</tt> <b class=
                   7314: "userinput"><tt>make clean CLEANDEPENDS=YES</tt></b>
                   7315: <tt class="prompt">#</tt> <b class=
                   7316: "userinput"><tt>make update</tt></b>
                   7317: </pre>
                   7318: 
                   7319:                 <p>The following variables can be used either on
                   7320:                 the command line or in <tt class=
                   7321:                 "filename">/etc/mk.conf</tt> to alter the behaviour
                   7322:                 of <span><b class="command">make
                   7323:                 clean-update</b></span>:</p>
                   7324: 
                   7325:                 <div class="variablelist">
                   7326:                   <dl>
                   7327:                     <dt><span class="term"><tt class=
                   7328:                     "varname">CLEAR_DIRLIST</tt></span></dt>
                   7329: 
                   7330:                     <dd>
                   7331:                       <p>After <span><b class="command">make
                   7332:                       clean</b></span>, do not reconstruct the list
                   7333:                       of directories to update for this package.
                   7334:                       Only use this if <span><b class=
                   7335:                       "command">make update</b></span> successfully
                   7336:                       installed all packages you wanted to update.
                   7337:                       Normally, this is done automatically on
                   7338:                       <span><b class="command">make
                   7339:                       update</b></span>, but may have been
                   7340:                       suppressed by the <tt class=
                   7341:                       "varname">NOCLEAN</tt> variable (see
                   7342:                       above).</p>
                   7343:                     </dd>
                   7344:                   </dl>
                   7345:                 </div>
                   7346:               </dd>
                   7347: 
                   7348:               <dt><span class="term">info</span></dt>
                   7349: 
                   7350:               <dd>
                   7351:                 <p>This target invokes <a href=
                   7352:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   7353:                 <span class="citerefentry"><span class=
                   7354:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   7355:                 the current package. You can use this to check
                   7356:                 which version of a package is installed.</p>
                   7357:               </dd>
                   7358: 
                   7359:               <dt><span class="term">readme</span></dt>
                   7360: 
                   7361:               <dd>
                   7362:                 <p>This target generates a <tt class=
                   7363:                 "filename">README.html</tt> file, which can be
                   7364:                 viewed using a browser such as <a xmlns=
                   7365:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7366:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.2     ! hubertf  7367:                    class="pkgname">www/mozilla</a> or <a xmlns=
        !          7368:                    "http://www.w3.org/TR/xhtml1/transitional" href=
        !          7369:                    "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
        !          7370:                    class="pkgname">www/links</a>. The generated
        !          7371:                    files contain references to any packages which
        !          7372:                    are in the <tt class="varname">PACKAGES</tt>
        !          7373:                    directory on the local host. The generated files
        !          7374:                    can be made to refer to URLs based on <tt class=
        !          7375:                    "varname">FTP_PKG_URL_HOST</tt> and <tt class=
        !          7376:                    "varname">FTP_PKG_URL_DIR</tt>. For example, if
        !          7377:                    I wanted to generate <tt class=
        !          7378:                    "filename">README.html</tt> files which pointed
        !          7379:                    to binary packages on the local machine, in the
        !          7380:                    directory <tt class=
        !          7381:                    "filename">/usr/packages</tt>, set <tt class=
        !          7382:                    "varname">FTP_PKG_URL_HOST=file://localhost</tt>
        !          7383:                    and <tt class=
        !          7384:                    "varname">FTP_PKG_URL_DIR=/usr/packages</tt>.
        !          7385:                    The <tt class="varname">${PACKAGES}</tt>
        !          7386:                    directory and its subdirectories will be
        !          7387:                    searched for all the binary packages.</p>
1.1       grant    7388:               </dd>
                   7389: 
                   7390:               <dt><span class="term">readme-all</span></dt>
                   7391: 
                   7392:               <dd>
                   7393:                 <p>Use this target to create a file <tt class=
                   7394:                 "filename">README-all.html</tt> which contains a
                   7395:                 list of all packages currently available in the
                   7396:                 NetBSD Packages Collection, together with the
                   7397:                 category they belong to and a short description.
                   7398:                 This file is compiled from the <tt class=
                   7399:                 "filename">pkgsrc/*/README.html</tt> files, so be
                   7400:                 sure to run this <span class=
                   7401:                 "emphasis"><em>after</em></span> a <span><b class=
                   7402:                 "command">make readme</b></span>.</p>
                   7403:               </dd>
                   7404: 
                   7405:               <dt><span class="term">cdrom-readme</span></dt>
                   7406: 
                   7407:               <dd>
                   7408:                 <p>This is very much the same as the
                   7409:                 &#8220;<span class="quote">readme</span>&#8221;
                   7410:                 target (see above), but is to be used when
                   7411:                 generating a pkgsrc tree to be written to a CD-ROM.
                   7412:                 This target also produces <tt class=
                   7413:                 "filename">README.html</tt> files, and can be made
                   7414:                 to refer to URLs based on <tt class=
                   7415:                 "varname">CDROM_PKG_URL_HOST</tt> and <tt class=
                   7416:                 "varname">CDROM_PKG_URL_DIR</tt>.</p>
                   7417:               </dd>
                   7418: 
                   7419:               <dt><span class="term">show-distfiles</span></dt>
                   7420: 
                   7421:               <dd>
                   7422:                 <p>This target shows which distfiles and patchfiles
                   7423:                 are needed to build the package. (<tt class=
                   7424:                 "varname">DISTFILES</tt> and <tt class=
                   7425:                 "varname">PATCHFILES</tt>, but not <tt class=
                   7426:                 "filename">patches/*</tt>)</p>
                   7427:               </dd>
                   7428: 
                   7429:               <dt><span class="term">show-downlevel</span></dt>
                   7430: 
                   7431:               <dd>
                   7432:                 <p>This target shows nothing if the package is not
                   7433:                 installed. If a version of this package is
                   7434:                 installed, but is not the version provided in this
                   7435:                 version of pkgsrc, then a warning message is
                   7436:                 displayed. This target can be used to show which of
                   7437:                 your installed packages are downlevel, and so the
                   7438:                 old versions can be deleted, and the current ones
                   7439:                 added.</p>
                   7440:               </dd>
                   7441: 
                   7442:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   7443: 
                   7444:               <dd>
                   7445:                 <p>This target shows the directory in the pkgsrc
                   7446:                 hierarchy from which the package can be built and
                   7447:                 installed. This may not be the same directory as
                   7448:                 the one from which the package was installed. This
                   7449:                 target is intended to be used by people who may
                   7450:                 wish to upgrade many packages on a single host, and
                   7451:                 can be invoked from the top-level pkgsrc Makefile
                   7452:                 by using the &#8220;<span class=
                   7453:                 "quote">show-host-specific-pkgs</span>&#8221;
                   7454:                 target.</p>
                   7455:               </dd>
                   7456: 
                   7457:               <dt><span class=
                   7458:               "term">show-installed-depends</span></dt>
                   7459: 
                   7460:               <dd>
                   7461:                 <p>This target shows which installed packages match
                   7462:                 the current package's <tt class=
                   7463:                 "varname">DEPENDS</tt>. Useful if out of date
                   7464:                 dependencies are causing build problems.</p>
                   7465:               </dd>
                   7466: 
                   7467:               <dt><span class="term">check-shlibs</span></dt>
                   7468: 
                   7469:               <dd>
                   7470:                 <p>After a package is installed, check all its
                   7471:                 binaries and (on ELF platforms) shared libraries to
                   7472:                 see if they find the shared libs they need. Run by
                   7473:                 default if <tt class="varname">PKG_DEVELOPER</tt>
                   7474:                 is set in <tt class=
                   7475:                 "filename">/etc/mk.conf</tt>.</p>
                   7476:               </dd>
                   7477: 
                   7478:               <dt><span class="term">print-PLIST</span></dt>
                   7479: 
                   7480:               <dd>
                   7481:                 <p>After a &#8220;<span class="quote">make
                   7482:                 install</span>&#8221; from a new or upgraded pkg,
                   7483:                 this prints out an attempt to generate a new
                   7484:                 <tt class="filename">PLIST</tt> from a
                   7485:                 <span><b class="command">find -newer
                   7486:                 work/.extract_done</b></span>. An attempt is made
                   7487:                 to care for shared libs etc., but it is
                   7488:                 <span class="emphasis"><em>strongly</em></span>
                   7489:                 recommended to review the result before putting it
                   7490:                 into <tt class="filename">PLIST</tt>. On upgrades,
                   7491:                 it's useful to diff the output of this command
                   7492:                 against an already existing <tt class=
                   7493:                 "filename">PLIST</tt> file.</p>
                   7494: 
                   7495:                 <p>If the package installs files via tar(1) or
                   7496:                 other methods that don't update file access times,
                   7497:                 be sure to add these files manually to your
                   7498:                 <tt class="filename">PLIST</tt>, as the
                   7499:                 &#8220;<span class="quote">find
                   7500:                 -newer</span>&#8221; command used by this target
                   7501:                 won't catch them!</p>
                   7502: 
                   7503:                 <p>See <a href="#print-PLIST" title=
                   7504:                 "8.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;8.3,
                   7505:                 &#8220;Tweaking output of make
                   7506:                 print-PLIST&#8221;</a> for more information on this
                   7507:                 target.</p>
                   7508:               </dd>
                   7509: 
                   7510:               <dt><span class="term">bulk-package</span></dt>
                   7511: 
                   7512:               <dd>
                   7513:                 <p>Used to do bulk builds. If an appropriate binary
                   7514:                 package already exists, no action is taken. If not,
                   7515:                 this target will compile, install and package it
                   7516:                 (and it's depends, if <tt class=
                   7517:                 "varname">PKG_DEPENDS</tt> is set properly. See
                   7518:                 <a href="#binary.configuration" title=
                   7519:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   7520:                 &#8220;Configuration&#8221;</a>. After creating the
                   7521:                 binary package, the sources, the just-installed
                   7522:                 package and it's required packages are removed,
                   7523:                 preserving free disk space.</p>
                   7524: 
                   7525:                 <p><span class="emphasis"><em>Beware that this
                   7526:                 target may deinstall all packages installed on a
                   7527:                 system!</em></span></p>
                   7528:               </dd>
                   7529: 
                   7530:               <dt><span class="term">bulk-install</span></dt>
                   7531: 
                   7532:               <dd>
                   7533:                 <p>Used during bulk-installs to install required
                   7534:                 packages. If an upto-date binary package is
                   7535:                 available, it will be installed via <a href=
                   7536:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7537:                 <span class="citerefentry"><span class=
                   7538:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
                   7539:                 not, <span><b class="command">make
                   7540:                 bulk-package</b></span> will be executed, but the
                   7541:                 installed binary not be removed.</p>
                   7542: 
                   7543:                 <p>A binary package is considered
                   7544:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   7545:                 to be installed via <a href=
                   7546:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7547:                 <span class="citerefentry"><span class=
                   7548:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   7549:                 if:</p>
                   7550: 
                   7551:                 <div class="itemizedlist">
                   7552:                   <ul type="disc">
                   7553:                     <li>
                   7554:                       <p>None of the package's files (<tt class=
                   7555:                       "filename">Makefile</tt>, ...) were modified
                   7556:                       since it was built.</p>
                   7557:                     </li>
                   7558: 
                   7559:                     <li>
                   7560:                       <p>None of the package's required (binary)
                   7561:                       packages were modified since it was
                   7562:                       built.</p>
                   7563:                     </li>
                   7564:                   </ul>
                   7565:                 </div>
                   7566: 
                   7567:                 <p><span class="emphasis"><em>Beware that this
                   7568:                 target may deinstall all packages installed on a
                   7569:                 system!</em></span></p>
                   7570:               </dd>
                   7571:             </dl>
                   7572:           </div>
                   7573:         </div>
                   7574:       </div>
                   7575: 
                   7576:       <div class="chapter" lang="en" xml:lang="en">
                   7577:         <div class="titlepage">
                   7578:           <div>
                   7579:             <div>
                   7580:               <h2 class="title"><a name="fixes" id=
                   7581:               "fixes"></a>Chapter&nbsp;12.&nbsp;Notes on fixes for
                   7582:               packages</h2>
                   7583:             </div>
                   7584:           </div>
                   7585:         </div>
                   7586: 
                   7587:         <div class="toc">
                   7588:           <p><b>Table of Contents</b></p>
                   7589: 
                   7590:           <dl>
1.2     ! hubertf  7591:             <dt><span class="sect1"><a href="#id2570766">12.1.
1.1       grant    7592:             General operation</a></span></dt>
                   7593: 
                   7594:             <dd>
                   7595:               <dl>
                   7596:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7597:                 "#id2570770">12.1.1. How to pull in variables from
1.1       grant    7598:                 /etc/mk.conf</a></span></dt>
                   7599: 
                   7600:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7601:                 "#id2570853">12.1.2. Restricted
1.1       grant    7602:                 packages</a></span></dt>
                   7603: 
                   7604:                 <dt><span class="sect2"><a href=
                   7605:                 "#dependencies">12.1.3. Handling
                   7606:                 dependencies</a></span></dt>
                   7607: 
                   7608:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7609:                 "#id2571436">12.1.4. Handling conflicts with other
1.1       grant    7610:                 packages</a></span></dt>
                   7611: 
                   7612:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7613:                 "#id2571486">12.1.5. Packages that cannot or should
1.1       grant    7614:                 not be built</a></span></dt>
                   7615: 
                   7616:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7617:                 "#id2571512">12.1.6. Packages which should not be
1.1       grant    7618:                 deleted, once installed</a></span></dt>
                   7619: 
                   7620:                 <dt><span class="sect2"><a href=
                   7621:                 "#security-handling">12.1.7. Handling packages with
                   7622:                 security problems</a></span></dt>
                   7623: 
                   7624:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7625:                 "#id2571604">12.1.8. How to handle compiler
1.1       grant    7626:                 bugs</a></span></dt>
                   7627: 
                   7628:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7629:                 "#id2571626">12.1.9. How to handle incrementing
1.1       grant    7630:                 versions when fixing an existing
                   7631:                 package</a></span></dt>
                   7632: 
                   7633:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7634:                 "#id2571675">12.1.10. Portability of
1.1       grant    7635:                 packages</a></span></dt>
                   7636:               </dl>
                   7637:             </dd>
                   7638: 
1.2     ! hubertf  7639:             <dt><span class="sect1"><a href="#id2571700">12.2.
1.1       grant    7640:             Possible downloading issues</a></span></dt>
                   7641: 
                   7642:             <dd>
                   7643:               <dl>
                   7644:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7645:                 "#id2571703">12.2.1. Packages whose distfiles
1.1       grant    7646:                 aren't available for plain
                   7647:                 downloading</a></span></dt>
                   7648: 
                   7649:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7650:                 "#id2571902">12.2.2. How to handle modified
1.1       grant    7651:                 distfiles with the 'old' name</a></span></dt>
                   7652:               </dl>
                   7653:             </dd>
                   7654: 
1.2     ! hubertf  7655:             <dt><span class="sect1"><a href="#id2571914">12.3.
1.1       grant    7656:             Configuration gotchas</a></span></dt>
                   7657: 
                   7658:             <dd>
                   7659:               <dl>
                   7660:                 <dt><span class="sect2"><a href=
                   7661:                 "#fixes.libtool">12.3.1. Shared libraries -
                   7662:                 libtool</a></span></dt>
                   7663: 
                   7664:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7665:                 "#id2572390">12.3.2. Using libtool on GNU packages
1.1       grant    7666:                 that already support libtool</a></span></dt>
                   7667: 
                   7668:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7669:                 "#id2572474">12.3.3. GNU
1.1       grant    7670:                 Autoconf/Automake</a></span></dt>
                   7671:               </dl>
                   7672:             </dd>
                   7673: 
1.2     ! hubertf  7674:             <dt><span class="sect1"><a href="#id2572519">12.4.
1.1       grant    7675:             Building considerations</a></span></dt>
                   7676: 
                   7677:             <dd>
                   7678:               <dl>
                   7679:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7680:                 "#id2572522">12.4.1. CPP defines</a></span></dt>
1.1       grant    7681:               </dl>
                   7682:             </dd>
                   7683: 
1.2     ! hubertf  7684:             <dt><span class="sect1"><a href="#id2572552">12.5.
1.1       grant    7685:             Package specific actions</a></span></dt>
                   7686: 
                   7687:             <dd>
                   7688:               <dl>
                   7689:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7690:                 "#id2572555">12.5.1. Package configuration
1.1       grant    7691:                 files</a></span></dt>
                   7692: 
                   7693:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7694:                 "#id2572726">12.5.2. User
        !          7695:                 interaction</a></span></dt>
1.1       grant    7696: 
                   7697:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7698:                 "#id2572771">12.5.3. Handling
1.1       grant    7699:                 licenses</a></span></dt>
                   7700: 
                   7701:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7702:                 "#id2572922">12.5.4. Creating an account from a
1.1       grant    7703:                 package</a></span></dt>
                   7704: 
                   7705:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7706:                 "#id2573052">12.5.5. Installing score
1.1       grant    7707:                 files</a></span></dt>
                   7708: 
                   7709:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7710:                 "#id2573096">12.5.6. Packages providing login
1.1       grant    7711:                 shells</a></span></dt>
                   7712: 
                   7713:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7714:                 "#id2573222">12.5.7. Packages containing perl
1.1       grant    7715:                 scripts</a></span></dt>
                   7716: 
                   7717:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7718:                 "#id2573240">12.5.8. Packages with hardcoded paths
1.1       grant    7719:                 to other interpreters</a></span></dt>
                   7720: 
                   7721:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7722:                 "#id2573261">12.5.9. Packages installing perl
1.1       grant    7723:                 modules</a></span></dt>
                   7724: 
                   7725:                 <dt><span class="sect2"><a href=
                   7726:                 "#faq.info-files">12.5.10. Packages installing info
                   7727:                 files</a></span></dt>
                   7728: 
                   7729:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7730:                 "#id2573549">12.5.11. Packages installing GConf2
1.1       grant    7731:                 data files</a></span></dt>
                   7732: 
                   7733:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7734:                 "#id2573650">12.5.12. Packages installing
1.1       grant    7735:                 scrollkeeper data files</a></span></dt>
                   7736: 
                   7737:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7738:                 "#id2573701">12.5.13. Packages installing X11
1.1       grant    7739:                 fonts</a></span></dt>
                   7740: 
                   7741:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7742:                 "#id2573816">12.5.14. Packages installing GTK2
1.1       grant    7743:                 modules</a></span></dt>
                   7744: 
                   7745:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7746:                 "#id2573885">12.5.15. Packages installing SGML or
1.1       grant    7747:                 XML data</a></span></dt>
                   7748: 
                   7749:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7750:                 "#id2573938">12.5.16. Packages installing
1.1       grant    7751:                 extensions to the MIME database</a></span></dt>
                   7752: 
                   7753:                 <dt><span class="sect2"><a href=
1.2     ! hubertf  7754:                 "#id2574008">12.5.17. Packages using
1.1       grant    7755:                 intltool</a></span></dt>
                   7756:               </dl>
                   7757:             </dd>
                   7758: 
1.2     ! hubertf  7759:             <dt><span class="sect1"><a href="#id2574022">12.6.
1.1       grant    7760:             Feedback to the author</a></span></dt>
                   7761:           </dl>
                   7762:         </div>
                   7763: 
                   7764:         <div class="sect1" lang="en" xml:lang="en">
                   7765:           <div class="titlepage">
                   7766:             <div>
                   7767:               <div>
                   7768:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  7769:                 "id2570766" id="id2570766"></a>12.1.&nbsp;General
1.1       grant    7770:                 operation</h2>
                   7771:               </div>
                   7772:             </div>
                   7773:           </div>
                   7774: 
                   7775:           <div class="sect2" lang="en" xml:lang="en">
                   7776:             <div class="titlepage">
                   7777:               <div>
                   7778:                 <div>
1.2     ! hubertf  7779:                   <h3 class="title"><a name="id2570770" id=
        !          7780:                   "id2570770"></a>12.1.1.&nbsp;How to pull in
1.1       grant    7781:                   variables from /etc/mk.conf</h3>
                   7782:                 </div>
                   7783:               </div>
                   7784:             </div>
                   7785: 
                   7786:             <p>The problem with package-defined variables that can
                   7787:             be overridden via <tt class="varname">MAKECONF</tt> or
                   7788:             <tt class="filename">/etc/mk.conf</tt> is that <a href=
                   7789:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   7790:             <span class="citerefentry"><span class=
                   7791:             "refentrytitle">make</span>(1)</span></a> expands a
                   7792:             variable as it is used, but evaluates preprocessor like
                   7793:             statements (.if, .ifdef and .ifndef) as they are read.
                   7794:             So, to use any variable (which may be set in <tt class=
                   7795:             "filename">/etc/mk.conf</tt>) in one of the .if*
                   7796:             statements, the file <tt class=
                   7797:             "filename">/etc/mk.conf</tt> must be included before
                   7798:             that .if* statement.</p>
                   7799: 
                   7800:             <p>Rather than have a number of ad-hoc ways of
                   7801:             including <tt class="filename">/etc/mk.conf</tt>,
                   7802:             should it exist, or <tt class="varname">MAKECONF</tt>,
                   7803:             should it exist, include the <tt class=
                   7804:             "filename">pkgsrc/mk/bsd.prefs.mk</tt> file in the
                   7805:             package Makefile before any preprocessor-like .if,
                   7806:             .ifdef, or .ifndef statements:</p>
                   7807:             <pre class="programlisting">
                   7808: .include "../../mk/bsd.prefs.mk"
                   7809:     
                   7810:     .if defined(USE_MENUS)
                   7811:       ...
                   7812:     .endif
                   7813: </pre>
                   7814: 
                   7815:             <p>If you wish to set the <tt class=
                   7816:             "varname">CFLAGS</tt> variable in <tt class=
                   7817:             "filename">/etc/mk.conf</tt> please make sure to
                   7818:             use:</p>
                   7819:             <pre class="programlisting">
                   7820: CFLAGS+=  -your -flags
                   7821: </pre>
                   7822: 
                   7823:             <p>Using <tt class="varname">CFLAGS=</tt> (i.e. without
                   7824:             the &#8220;<span class="quote">+</span>&#8221;) may
                   7825:             lead to problems with packages that need to add their
                   7826:             own flags. Also, you may want to take a look at the
                   7827:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7828:             href=
                   7829:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.2     ! hubertf  7830:                class="pkgname">devel/cpuflags</a> package if you're
        !          7831:                interested in optimization for the current CPU.</p>
1.1       grant    7832:           </div>
                   7833: 
                   7834:           <div class="sect2" lang="en" xml:lang="en">
                   7835:             <div class="titlepage">
                   7836:               <div>
                   7837:                 <div>
1.2     ! hubertf  7838:                   <h3 class="title"><a name="id2570853" id=
        !          7839:                   "id2570853"></a>12.1.2.&nbsp;Restricted
1.1       grant    7840:                   packages</h3>
                   7841:                 </div>
                   7842:               </div>
                   7843:             </div>
                   7844: 
                   7845:             <p>Some licenses restrict how software may be
                   7846:             re-distributed. In order to satisfy these restrictions,
                   7847:             the package system defines five make variables that can
                   7848:             be set to note these restrictions:</p>
                   7849: 
                   7850:             <div class="itemizedlist">
                   7851:               <ul type="disc">
                   7852:                 <li>
                   7853:                   <p><tt class="varname">RESTRICTED</tt></p>
                   7854: 
                   7855:                   <p>This variable should be set whenever a
                   7856:                   restriction exists (regardless of its kind). Set
                   7857:                   this variable to a string containing the reason
                   7858:                   for the restriction.</p>
                   7859:                 </li>
                   7860: 
                   7861:                 <li>
                   7862:                   <p><tt class="varname">NO_BIN_ON_CDROM</tt></p>
                   7863: 
                   7864:                   <p>Binaries may not be placed on CD-ROM. Set this
                   7865:                   variable to <tt class=
                   7866:                   "varname">${RESTRICTED}</tt> whenever a binary
                   7867:                   package may not be included on a CD-ROM.</p>
                   7868:                 </li>
                   7869: 
                   7870:                 <li>
                   7871:                   <p><tt class="varname">NO_BIN_ON_FTP</tt></p>
                   7872: 
                   7873:                   <p>Binaries may not be placed on an FTP server.
                   7874:                   Set this variable to <tt class=
                   7875:                   "varname">${RESTRICTED}</tt> whenever a binary
                   7876:                   package may not not be made available on the
                   7877:                   Internet.</p>
                   7878:                 </li>
                   7879: 
                   7880:                 <li>
                   7881:                   <p><tt class="varname">NO_SRC_ON_CDROM</tt></p>
                   7882: 
                   7883:                   <p>Distfiles may not be placed on CD-ROM. Set
                   7884:                   this variable to <tt class=
                   7885:                   "varname">${RESTRICTED}</tt> if re-distribution
                   7886:                   of the source code or other distfile(s) is not
                   7887:                   allowed on CD-ROMs.</p>
                   7888:                 </li>
                   7889: 
                   7890:                 <li>
                   7891:                   <p><tt class="varname">NO_SRC_ON_FTP</tt></p>
                   7892: 
                   7893:                   <p>Distfiles may not be placed on FTP. Set this
                   7894:                   variable to <tt class=
                   7895:                   "varname">${RESTRICTED}</tt> if re-distribution
                   7896:                   of the source code or other distfile(s) via the
                   7897:                   Internet is not allowed.</p>
                   7898:                 </li>
                   7899:               </ul>
                   7900:             </div>
                   7901: 
                   7902:             <p>Please note that the use of <tt class=
                   7903:             "varname">NO_PACKAGE</tt>, <tt class=
                   7904:             "varname">IGNORE</tt>, <tt class=
                   7905:             "varname">NO_CDROM</tt>, or other generic make
                   7906:             variables to denote restrictions is deprecated, because
                   7907:             they unconditionally prevent users from generating
                   7908:             binary packages!</p>
                   7909:           </div>
                   7910: 
                   7911:           <div class="sect2" lang="en" xml:lang="en">
                   7912:             <div class="titlepage">
                   7913:               <div>
                   7914:                 <div>
                   7915:                   <h3 class="title"><a name="dependencies" id=
                   7916:                   "dependencies"></a>12.1.3.&nbsp;Handling
                   7917:                   dependencies</h3>
                   7918:                 </div>
                   7919:               </div>
                   7920:             </div>
                   7921: 
                   7922:             <p>Your package may depend on some other package being
                   7923:             present - and there are various ways of expressing this
                   7924:             dependency. pkgsrc supports the <tt class=
                   7925:             "varname">BUILD_DEPENDS</tt> and <tt class=
                   7926:             "varname">DEPENDS</tt> definitions, as well as
                   7927:             dependencies via <tt class=
                   7928:             "filename">buildlink3.mk</tt>, which is the preferred
                   7929:             way to handle dependencies, and which uses the
                   7930:             variables named above. See <a href="#buildlink" title=
                   7931:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   7932:             <i>Buildlink methodology</i></a> for more
                   7933:             information.</p>
                   7934: 
                   7935:             <p>The basic difference between the two variables is as
                   7936:             follows: The <tt class="varname">DEPENDS</tt>
                   7937:             definition registers that pre-requisite in the binary
                   7938:             package so it will be pulled in when the binary package
                   7939:             is later installed, whilst the <tt class=
                   7940:             "varname">BUILD_DEPENDS</tt> definition does not,
                   7941:             marking a dependency that is only needed for building
                   7942:             the package.</p>
                   7943: 
                   7944:             <p>This means that if you only need a package present
                   7945:             whilst you are building, it should be noted as a
                   7946:             <tt class="varname">BUILD_DEPENDS</tt>.</p>
                   7947: 
                   7948:             <p>The format for a <tt class=
                   7949:             "varname">BUILD_DEPENDS</tt> and a <tt class=
                   7950:             "varname">DEPENDS</tt> definition is:</p>
                   7951:             <pre class="programlisting">
                   7952: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   7953: </pre>
                   7954: 
                   7955:             <p>Please note that the &#8220;<span class=
                   7956:             "quote">pre-req-package-name</span>&#8221; may include
                   7957:             any of the wildcard version numbers recognised by
                   7958:             <a href=
                   7959:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   7960:             <span class="citerefentry"><span class=
                   7961:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   7962: 
                   7963:             <div class="orderedlist">
                   7964:               <ol type="1">
                   7965:                 <li>
                   7966:                   <p>If your package needs another package's
                   7967:                   binaries or libraries to build or run, and if
                   7968:                   that package has a <tt class=
                   7969:                   "filename">buildlink3.mk</tt> file available, use
                   7970:                   it:</p>
                   7971:                   <pre class="programlisting">
                   7972:     .include "../../graphics/jpeg/buildlink3.mk"
                   7973:     
                   7974: </pre>
                   7975:                 </li>
                   7976: 
                   7977:                 <li>
                   7978:                   <p>If your package needs to use another package
                   7979:                   to build itself and there is no <tt class=
                   7980:                   "filename">buildlink3.mk</tt> file available, use
                   7981:                   the <tt class="varname">BUILD_DEPENDS</tt>
                   7982:                   definition:</p>
                   7983:                   <pre class="programlisting">
                   7984: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   7985: </pre>
                   7986:                 </li>
                   7987: 
                   7988:                 <li>
                   7989:                   <p>If your package needs a library with which to
                   7990:                   link and again there is no <tt class=
                   7991:                   "filename">buildlink3.mk</tt> file available,
                   7992:                   this is specified using the <tt class=
                   7993:                   "varname">DEPENDS</tt> definition. An example of
                   7994:                   this is the <a xmlns=
                   7995:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   7996:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.2     ! hubertf  7997:                      class="pkgname">print/lyx</a> package, which
        !          7998:                      uses the xpm library, version 3.4j to
        !          7999:                      build:</p>
1.1       grant    8000:                   <pre class="programlisting">
                   8001: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   8002: </pre>
                   8003: 
                   8004:                   <p>You can also use wildcards in package
                   8005:                   dependences:</p>
                   8006:                   <pre class="programlisting">
                   8007: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   8008: </pre>
                   8009: 
                   8010:                   <p>Note that such wildcard dependencies are
                   8011:                   retained when creating binary packages. The
                   8012:                   dependency is checked when installing the binary
                   8013:                   package and any package which matches the pattern
                   8014:                   will be used. Wildcard dependencies should be
                   8015:                   used with care.</p>
                   8016: 
                   8017:                   <p>The &#8220;<span class=
                   8018:                   "quote">-[0-9]*</span>&#8221; should be used
                   8019:                   instead of &#8220;<span class=
                   8020:                   "quote">-*</span>&#8221; to avoid potentially
                   8021:                   ambiguous matches such as &#8220;<span class=
                   8022:                   "quote">tk-postgresql</span>&#8221; matching a
                   8023:                   &#8220;<span class="quote">tk-*</span>&#8221;
                   8024:                   <tt class="varname">DEPENDS</tt>.</p>
                   8025: 
                   8026:                   <p>Wildcards can also be used to specify that a
                   8027:                   package will only build against a certain minimum
                   8028:                   version of a pre-requisite:</p>
                   8029:                   <pre class="programlisting">
                   8030: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   8031: </pre>
                   8032: 
                   8033:                   <p>This means that the package will build against
                   8034:                   version 3.5.4 of the tiff library or newer. Such
                   8035:                   a dependency may be warranted if, for example,
                   8036:                   the API of the library has changed with version
                   8037:                   3.5.4 and a package would not compile against an
                   8038:                   earlier version of tiff.</p>
                   8039: 
                   8040:                   <p>Please note that such dependencies should only
                   8041:                   be updated if a package requires a newer
                   8042:                   pre-requisite, but not to denote recommendations
                   8043:                   such as security updates or ABI changes that do
                   8044:                   not prevent a package from building correctly.
                   8045:                   Such recommendations can be expressed using
                   8046:                   <tt class="varname">RECOMMENDED</tt>:</p>
                   8047:                   <pre class="programlisting">
                   8048: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   8049: </pre>
                   8050: 
                   8051:                   <p>In addition to the above <tt class=
                   8052:                   "varname">DEPENDS</tt> line, this denotes that
                   8053:                   while a package will build against
                   8054:                   tiff&gt;=3.5.4, at least version 3.6.1 is
                   8055:                   recommended. <tt class="varname">RECOMMENDED</tt>
                   8056:                   entries will be turned into dependencies unless
                   8057:                   explicitly ignored (in which case a warning will
                   8058:                   be printed). Packages that are built with
                   8059:                   recommendations ignored may not be uploaded to
                   8060:                   ftp.NetBSD.org by developers and should not be
                   8061:                   used across different systems that may have
                   8062:                   different versions of binary packages
                   8063:                   installed.</p>
                   8064: 
                   8065:                   <p>For security fixes, please update the package
                   8066:                   vulnerabilities file as well as setting
                   8067:                   <tt class="varname">RECOMMENDED</tt>, see
                   8068:                   <a href="#security-handling" title=
                   8069:                   "12.1.7.&nbsp;Handling packages with security problems">
                   8070:                   Section 12.1.7, &#8220;Handling packages with
                   8071:                   security problems&#8221;</a> for more
                   8072:                   information.</p>
                   8073:                 </li>
                   8074: 
                   8075:                 <li>
                   8076:                   <p>If your package needs some executable to be
                   8077:                   able to run correctly and if there's agail no
                   8078:                   <tt class="filename">buildlink3.mk</tt> file,
                   8079:                   this is specified using the <tt class=
                   8080:                   "varname">DEPENDS</tt> variable. The <a xmlns=
                   8081:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8082:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.2     ! hubertf  8083:                      class="pkgname">print/lyx</a> package needs to
        !          8084:                      be able to execute the latex binary from the
        !          8085:                      teTeX package when it runs, and that is
        !          8086:                      specified:</p>
1.1       grant    8087:                   <pre class="programlisting">
                   8088: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   8089: </pre>
                   8090: 
                   8091:                   <p>The comment about wildcard dependencies from
                   8092:                   previous paragraph applies here, too.</p>
                   8093:                 </li>
                   8094:               </ol>
                   8095:             </div>
                   8096: 
                   8097:             <p>If your package needs files from another package to
                   8098:             build, see the first part of the &#8220;<span class=
                   8099:             "quote">do-configure</span>&#8221; target <a xmlns=
                   8100:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8101:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.2     ! hubertf  8102:                class="pkgname">print/ghostscript5</a> package (it
        !          8103:                relies on the jpeg sources being present in source
        !          8104:                form during the build):</p>
1.1       grant    8105:             <pre class="programlisting">
                   8106: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   8107:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   8108:     fi
                   8109: </pre>
                   8110: 
                   8111:             <p>If you build any other packages that way, please
                   8112:             make sure the working files are deleted too when this
                   8113:             package's working files are cleaned up. The easiest way
                   8114:             to do so is by adding a pre-clean target:</p>
                   8115:             <pre class="programlisting">
                   8116: pre-clean:
                   8117:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   8118: </pre>
                   8119: 
                   8120:             <p>Please also note the <tt class=
                   8121:             "varname">BUILD_USES_MSGFMT</tt> and <tt class=
                   8122:             "varname">BUILD_USES_GETTEXT_M4</tt> definitions, which
                   8123:             are provided as convenience definitions. The former
                   8124:             works out whether msgfmt(1) is part of the base system,
                   8125:             and, if it isn't, installs the <a xmlns=
                   8126:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8127:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.2     ! hubertf  8128:                class="pkgname">devel/gettext</a> package. The
        !          8129:                latter adds a build dependency on either an
        !          8130:                installed version of an older gettext package, or if
        !          8131:                it isn't, installs the <a xmlns=
        !          8132:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8133:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
        !          8134:                class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    8135:           </div>
                   8136: 
                   8137:           <div class="sect2" lang="en" xml:lang="en">
                   8138:             <div class="titlepage">
                   8139:               <div>
                   8140:                 <div>
1.2     ! hubertf  8141:                   <h3 class="title"><a name="id2571436" id=
        !          8142:                   "id2571436"></a>12.1.4.&nbsp;Handling conflicts
1.1       grant    8143:                   with other packages</h3>
                   8144:                 </div>
                   8145:               </div>
                   8146:             </div>
                   8147: 
                   8148:             <p>Your package may conflict with other packages a user
                   8149:             might already have installed on his system, e.g. if
                   8150:             your package installs the same set of files like
                   8151:             another package in our pkgsrc tree.</p>
                   8152: 
                   8153:             <p>In this case you can set <tt class=
                   8154:             "varname">CONFLICTS</tt> to a space separated list of
                   8155:             packages (including version string) your package
                   8156:             conflicts with.</p>
                   8157: 
                   8158:             <p>For example <a xmlns=
                   8159:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8160:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.2     ! hubertf  8161:                class="pkgname">x11/Xaw3d</a> and <a xmlns=
        !          8162:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8163:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
        !          8164:                class="pkgname">x11/Xaw-Xpm</a> install provide the
        !          8165:                same shared library, thus you set in <tt class=
        !          8166:                "filename">pkgsrc/x11/Xaw3d/Makefile</tt>:</p>
1.1       grant    8167:             <pre class="programlisting">
                   8168: CONFLICTS=      Xaw-Xpm-[0-9]*
                   8169: </pre>
                   8170: 
                   8171:             <p>and in <tt class=
                   8172:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</tt>:</p>
                   8173:             <pre class="programlisting">
                   8174: CONFLICTS=      Xaw3d-[0-9]*
                   8175: </pre>
                   8176: 
                   8177:             <p>Packages will automatically conflict with other
                   8178:             packages with the name prefix and a different version
                   8179:             string. &#8220;<span class=
                   8180:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   8181:             conflict with the older version &#8220;<span class=
                   8182:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   8183:           </div>
                   8184: 
                   8185:           <div class="sect2" lang="en" xml:lang="en">
                   8186:             <div class="titlepage">
                   8187:               <div>
                   8188:                 <div>
1.2     ! hubertf  8189:                   <h3 class="title"><a name="id2571486" id=
        !          8190:                   "id2571486"></a>12.1.5.&nbsp;Packages that cannot
1.1       grant    8191:                   or should not be built</h3>
                   8192:                 </div>
                   8193:               </div>
                   8194:             </div>
                   8195: 
                   8196:             <p>There are several reasons why a package might be
                   8197:             instructed to not build under certain circumstances. If
                   8198:             the package builds and runs on most platforms, the
                   8199:             exceptions should be noted with <tt class=
                   8200:             "varname">NOT_FOR_PLATFORM</tt>. If the package builds
                   8201:             and runs on a small handful of platforms, set
                   8202:             <tt class="varname">ONLY_FOR_PLATFORM</tt> instead. If
                   8203:             the package should be skipped (for example, because it
                   8204:             provides functionality already provided by the system),
                   8205:             set <tt class="varname">PKG_SKIP_REASON</tt> to a
                   8206:             descriptive message. If the package should fail because
                   8207:             some preconditions are not met, set <tt class=
                   8208:             "varname">PKG_FAIL_REASON</tt> to a descriptive
                   8209:             message.</p>
                   8210: 
                   8211:             <p><tt class="varname">IGNORE</tt> is deprecated
                   8212:             because it didn't provide enough information to
                   8213:             determine whether the build should fail.</p>
                   8214:           </div>
                   8215: 
                   8216:           <div class="sect2" lang="en" xml:lang="en">
                   8217:             <div class="titlepage">
                   8218:               <div>
                   8219:                 <div>
1.2     ! hubertf  8220:                   <h3 class="title"><a name="id2571512" id=
        !          8221:                   "id2571512"></a>12.1.6.&nbsp;Packages which
1.1       grant    8222:                   should not be deleted, once installed</h3>
                   8223:                 </div>
                   8224:               </div>
                   8225:             </div>
                   8226: 
                   8227:             <p>To ensure that a package may not be deleted, once it
                   8228:             has been installed, the <tt class=
                   8229:             "varname">PKG_PRESERVE</tt> definition should be set in
                   8230:             the package Makefile. This will be carried into any
                   8231:             binary package that is made from this pkgsrc entry. A
                   8232:             &#8220;<span class="quote">preserved</span>&#8221;
                   8233:             package will not be deleted using <a href=
                   8234:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8235:             <span class="citerefentry"><span class=
                   8236:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   8237:             the &#8220;<span class="quote">-f</span>&#8221; option
                   8238:             is used.</p>
                   8239:           </div>
                   8240: 
                   8241:           <div class="sect2" lang="en" xml:lang="en">
                   8242:             <div class="titlepage">
                   8243:               <div>
                   8244:                 <div>
                   8245:                   <h3 class="title"><a name="security-handling" id=
                   8246:                   "security-handling"></a>12.1.7.&nbsp;Handling
                   8247:                   packages with security problems</h3>
                   8248:                 </div>
                   8249:               </div>
                   8250:             </div>
                   8251: 
                   8252:             <p>When a vulnerability is found, this should be noted
                   8253:             in <tt class=
                   8254:             "filename">localsrc/security/advisories/pkg-vulnerabilities</tt>,
                   8255:             and after the commit of that file, it should be copied
                   8256:             to both <tt class=
                   8257:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</tt>
                   8258:             and <tt class=
                   8259:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</tt>
                   8260:             on ftp.NetBSD.org using <tt class=
                   8261:             "filename">localsrc/security/advisories/Makefile</tt>.
                   8262:             In addition, if a <tt class=
                   8263:             "filename">buildlink3.mk</tt> file exists for an
                   8264:             affected package, bumping <tt class=
                   8265:             "varname">PKGREVISION</tt> and creating a corresponding
                   8266:             <tt class="varname">BUILDLINK_RECOMMENDED.<i class=
                   8267:             "replaceable"><tt>pkg</tt></i></tt> entry should be
                   8268:             considered. See <a href="#buildlink" title=
                   8269:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8270:             <i>Buildlink methodology</i></a> for more information
                   8271:             about writing <tt class="filename">buildlink3.mk</tt>
                   8272:             files and <tt class="varname">BUILDLINK_*</tt>
                   8273:             definitions.</p>
                   8274: 
                   8275:             <p>Also, if the fix should be applied to the stable
                   8276:             pkgsrc branch, be sure to submit a pullup request!</p>
                   8277:           </div>
                   8278: 
                   8279:           <div class="sect2" lang="en" xml:lang="en">
                   8280:             <div class="titlepage">
                   8281:               <div>
                   8282:                 <div>
1.2     ! hubertf  8283:                   <h3 class="title"><a name="id2571604" id=
        !          8284:                   "id2571604"></a>12.1.8.&nbsp;How to handle
1.1       grant    8285:                   compiler bugs</h3>
                   8286:                 </div>
                   8287:               </div>
                   8288:             </div>
                   8289: 
                   8290:             <p>Some source files trigger bugs in the compiler,
                   8291:             based on combinations of compiler version and
                   8292:             architecture and almost always relation to optimisation
                   8293:             being enabled. Common symptoms are gcc internal errors
                   8294:             or never finishing compiling a file.</p>
                   8295: 
                   8296:             <p>Typically a workaround involves testing the
                   8297:             <tt class="varname">MACHINE_ARCH</tt> and compiler
                   8298:             version, disabling optimisation for that
                   8299:             file/<tt class="varname">MACHINE_ARCH</tt>/compiler
                   8300:             combination, and documenting it in <tt class=
                   8301:             "filename">pkgsrc/doc/HACKS</tt>. See that file for a
                   8302:             number of examples!</p>
                   8303:           </div>
                   8304: 
                   8305:           <div class="sect2" lang="en" xml:lang="en">
                   8306:             <div class="titlepage">
                   8307:               <div>
                   8308:                 <div>
1.2     ! hubertf  8309:                   <h3 class="title"><a name="id2571626" id=
        !          8310:                   "id2571626"></a>12.1.9.&nbsp;How to handle
1.1       grant    8311:                   incrementing versions when fixing an existing
                   8312:                   package</h3>
                   8313:                 </div>
                   8314:               </div>
                   8315:             </div>
                   8316: 
                   8317:             <p>When making fixes to an existing package it can be
                   8318:             useful to change the version number in <tt class=
                   8319:             "varname">PKGNAME</tt>. To avoid conflicting with
                   8320:             future versions by the original author, a
                   8321:             &#8220;<span class="quote">nb1</span>&#8221;,
                   8322:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   8323:             suffix can be used on package versions by setting
                   8324:             <tt class="varname">PKGREVISION=1</tt> (2, ...). The
                   8325:             &#8220;<span class="quote">nb</span>&#8221; is treated
                   8326:             like a &#8220;<span class="quote">.</span>&#8221; by
                   8327:             the pkg tools. e.g.</p>
                   8328:             <pre class="programlisting">
                   8329:   DISTNAME= foo-17.42
                   8330:     PKGREVISION=  9
                   8331: </pre>
                   8332: 
                   8333:             <p>will result in a <tt class="varname">PKGNAME</tt> of
                   8334:             &#8220;<span class=
                   8335:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   8336: 
                   8337:             <p>When a new release of the package is released, the
                   8338:             <tt class="varname">PKGREVISION</tt> should be removed.
                   8339:             e.g. on a new minor release of the above package,
                   8340:             things should be like:</p>
                   8341:             <pre class="programlisting">
                   8342: DISTNAME=   foo-17.43
                   8343: </pre>
                   8344:           </div>
                   8345: 
                   8346:           <div class="sect2" lang="en" xml:lang="en">
                   8347:             <div class="titlepage">
                   8348:               <div>
                   8349:                 <div>
1.2     ! hubertf  8350:                   <h3 class="title"><a name="id2571675" id=
        !          8351:                   "id2571675"></a>12.1.10.&nbsp;Portability of
1.1       grant    8352:                   packages</h3>
                   8353:                 </div>
                   8354:               </div>
                   8355:             </div>
                   8356: 
                   8357:             <p>One appealing feature of pkgsrc is that it runs on
                   8358:             many different platforms. As a result, it is important
                   8359:             to ensure, where possible, that packages in pkgsrc are
                   8360:             portable. There are some particular details you should
                   8361:             pay attention to while working on pkgsrc.</p>
                   8362: 
                   8363:             <div class="sect3" lang="en" xml:lang="en">
                   8364:               <div class="titlepage">
                   8365:                 <div>
                   8366:                   <div>
1.2     ! hubertf  8367:                     <h4 class="title"><a name="id2571681" id=
        !          8368:                     "id2571681"></a>12.1.10.1.&nbsp;${INSTALL},
1.1       grant    8369:                     ${INSTALL_DATA_DIR}, ...</h4>
                   8370:                   </div>
                   8371:                 </div>
                   8372:               </div>
                   8373: 
                   8374:               <p>The BSD-compatible <span><b class=
                   8375:               "command">install</b></span> supplied with some
                   8376:               operating systems will not perform more than one
                   8377:               operation at a time. As such, you should call
                   8378:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   8379:               etc. like this:</p>
                   8380:               <pre class="programlisting">
                   8381: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   8382: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   8383: </pre>
                   8384:             </div>
                   8385:           </div>
                   8386:         </div>
                   8387: 
                   8388:         <div class="sect1" lang="en" xml:lang="en">
                   8389:           <div class="titlepage">
                   8390:             <div>
                   8391:               <div>
                   8392:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  8393:                 "id2571700" id="id2571700"></a>12.2.&nbsp;Possible
1.1       grant    8394:                 downloading issues</h2>
                   8395:               </div>
                   8396:             </div>
                   8397:           </div>
                   8398: 
                   8399:           <div class="sect2" lang="en" xml:lang="en">
                   8400:             <div class="titlepage">
                   8401:               <div>
                   8402:                 <div>
1.2     ! hubertf  8403:                   <h3 class="title"><a name="id2571703" id=
        !          8404:                   "id2571703"></a>12.2.1.&nbsp;Packages whose
1.1       grant    8405:                   distfiles aren't available for plain
                   8406:                   downloading</h3>
                   8407:                 </div>
                   8408:               </div>
                   8409:             </div>
                   8410: 
                   8411:             <p>If you need to download from a dynamic URL you can
                   8412:             set <tt class="varname">DYNAMIC_MASTER_SITES</tt> and a
                   8413:             <span><b class="command">make fetch</b></span> will
                   8414:             call <tt class="filename">files/getsite.sh</tt> with
                   8415:             the name of each file to download as an argument,
                   8416:             expecting it to output the URL of the directory from
                   8417:             which to download it. <a xmlns=
                   8418:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8419:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.2     ! hubertf  8420:                class="pkgname">graphics/ns-cult3d</a> is an example
        !          8421:                of this usage.</p>
1.1       grant    8422: 
                   8423:             <p>If the download can't be automated, because the user
                   8424:             must submit personal information to apply for a
                   8425:             password, or must pay for the source, or whatever, you
                   8426:             can set <tt class="varname">_FETCH_MESSAGE</tt> to a
                   8427:             macro which displays a message explaining the
                   8428:             situation. <tt class="varname">_FETCH_MESSAGE</tt> must
                   8429:             be executable shell commands, not just a message.
                   8430:             (Generally, it executes <tt class=
                   8431:             "varname">${ECHO}</tt>). As of this writing, the
                   8432:             following packages use this: <a xmlns=
                   8433:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8434:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.2     ! hubertf  8435:                class="pkgname">audio/realplayer</a>, <a xmlns=
        !          8436:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8437:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
        !          8438:                class="pkgname">cad/simian</a>, <a xmlns=
        !          8439:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8440:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
        !          8441:                class="pkgname">devel/ipv6socket</a>, <a xmlns=
        !          8442:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8443:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
        !          8444:                class="pkgname">emulators/vmware-module</a>,
        !          8445:                <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          8446:                href=
        !          8447:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
        !          8448:                class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
        !          8449:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8450:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
        !          8451:                class="pkgname">sysutils/storage-manager</a>,
        !          8452:                <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
        !          8453:                href=
        !          8454:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
        !          8455:                class="pkgname">www/ap-aolserver</a>, <a xmlns=
        !          8456:                "http://www.w3.org/TR/xhtml1/transitional" href=
        !          8457:                "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
        !          8458:                class="pkgname">www/openacs</a>. Try to be
        !          8459:                consistent with them.</p>
1.1       grant    8460:           </div>
                   8461: 
                   8462:           <div class="sect2" lang="en" xml:lang="en">
                   8463:             <div class="titlepage">
                   8464:               <div>
                   8465:                 <div>
1.2     ! hubertf  8466:                   <h3 class="title"><a name="id2571902" id=
        !          8467:                   "id2571902"></a>12.2.2.&nbsp;How to handle
1.1       grant    8468:                   modified distfiles with the 'old' name</h3>
                   8469:                 </div>
                   8470:               </div>
                   8471:             </div>
                   8472: 
                   8473:             <p>Sometimes authors of a software package make some
                   8474:             modifications after the software was released, and they
                   8475:             put up a new distfile without changing the package's
                   8476:             version number. If a package is already in pkgsrc at
                   8477:             that time, the md5 checksum will no longer match. The
                   8478:             correct way to work around this is to update the
                   8479:             package's md5 checksum to match the package on the
                   8480:             master site (beware, any mirrors may not be up to date
                   8481:             yet!), and to remove the old distfile from
                   8482:             ftp.NetBSD.org's <tt class=
                   8483:             "filename">/pub/NetBSD/packages/distfiles</tt>
                   8484:             directory. Furthermore, a mail to the package's author
                   8485:             seems appropriate making sure the distfile was really
                   8486:             updated on purpose, and that no trojan horse or so
                   8487:             crept in.</p>
                   8488:           </div>
                   8489:         </div>
                   8490: 
                   8491:         <div class="sect1" lang="en" xml:lang="en">
                   8492:           <div class="titlepage">
                   8493:             <div>
                   8494:               <div>
                   8495:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  8496:                 "id2571914" id=
        !          8497:                 "id2571914"></a>12.3.&nbsp;Configuration
1.1       grant    8498:                 gotchas</h2>
                   8499:               </div>
                   8500:             </div>
                   8501:           </div>
                   8502: 
                   8503:           <div class="sect2" lang="en" xml:lang="en">
                   8504:             <div class="titlepage">
                   8505:               <div>
                   8506:                 <div>
                   8507:                   <h3 class="title"><a name="fixes.libtool" id=
                   8508:                   "fixes.libtool"></a>12.3.1.&nbsp;Shared libraries
                   8509:                   - libtool</h3>
                   8510:                 </div>
                   8511:               </div>
                   8512:             </div>
                   8513: 
                   8514:             <p>pkgsrc supports many different machines, with
                   8515:             different object formats like a.out and ELF, and
                   8516:             varying abilities to do shared library and dynamic
                   8517:             loading at all. To accompany this, varying commands and
                   8518:             options have to be passed to the compiler, linker, etc.
                   8519:             to get the Right Thing, which can be pretty annoying
                   8520:             especially if you don't have all the machines at your
                   8521:             hand to test things. The <a xmlns=
                   8522:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8523:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.2     ! hubertf  8524:                class="pkgname">devel/libtool</a> pkg can help here,
        !          8525:                as it just &#8220;<span class=
        !          8526:                "quote">knows</span>&#8221; how to build both static
        !          8527:                and dynamic libraries from a set of source files,
        !          8528:                thus being platform independent.</p>
1.1       grant    8529: 
                   8530:             <p>Here's how to use libtool in a pkg in seven simple
                   8531:             steps:</p>
                   8532: 
                   8533:             <div class="orderedlist">
                   8534:               <ol type="1">
                   8535:                 <li>
                   8536:                   <p>Add <tt class="varname">USE_LIBTOOL=yes</tt>
                   8537:                   to the package Makefile.</p>
                   8538:                 </li>
                   8539: 
                   8540:                 <li>
                   8541:                   <p>For library objects, use &#8220;<span class=
                   8542:                   "quote">${LIBTOOL} --mode=compile
                   8543:                   ${CC}</span>&#8221; in place of
                   8544:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   8545:                   You could even add it to the definition of
                   8546:                   <tt class="varname">CC</tt>, if only libraries
                   8547:                   are being built in a given Makefile. This one
                   8548:                   command will build both PIC and non-PIC library
                   8549:                   objects, so you need not have separate shared and
                   8550:                   non-shared library rules.</p>
                   8551:                 </li>
                   8552: 
                   8553:                 <li>
                   8554:                   <p>For the linking of the library, remove any
                   8555:                   &#8220;<span class="quote">ar</span>&#8221;,
                   8556:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   8557:                   and &#8220;<span class="quote">ld
                   8558:                   -Bshareable</span>&#8221; commands, and instead
                   8559:                   use:</p>
                   8560:                   <pre class="programlisting">
                   8561: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   8562: </pre>
                   8563: 
                   8564:                   <p>Note that the library is changed to have a
                   8565:                   <tt class="filename">.la</tt> extension, and the
                   8566:                   objects are changed to have a <tt class=
                   8567:                   "filename">.lo</tt> extension. Change <tt class=
                   8568:                   "varname">OBJS</tt> as necessary. This
                   8569:                   automatically creates all of the <tt class=
                   8570:                   "filename">.a</tt>, <tt class=
                   8571:                   "filename">.so.major.minor</tt>, and ELF symlinks
                   8572:                   (if necessary) in the build directory. Be sure to
                   8573:                   include &#8220;<span class=
                   8574:                   "quote">-version-info</span>&#8221;, especially
                   8575:                   when major and minor are zero, as libtool will
                   8576:                   otherwise strip off the shared library
                   8577:                   version.</p>
                   8578: 
                   8579:                   <p>From the libtool manual:</p>
                   8580:                   <pre class="programlisting">
                   8581:      So, libtool library versions are described by three integers:
                   8582: 
                   8583: CURRENT
                   8584:        The most recent interface number that this library implements.
                   8585: 
                   8586: REVISION
                   8587:        The implementation number of the CURRENT interface.
                   8588: 
                   8589: AGE
                   8590:        The difference between the newest and oldest interfaces that this
                   8591:        library implements.  In other words, the library implements all the
                   8592:        interface numbers in the range from number `CURRENT - AGE' to
                   8593:        `CURRENT'.
                   8594:        
                   8595:      If two libraries have identical CURRENT and AGE numbers, then the
                   8596: dynamic linker chooses the library with the greater REVISION number. 
                   8597: </pre>
                   8598: 
                   8599:                   <p>The &#8220;<span class=
                   8600:                   "quote">-release</span>&#8221; option will
                   8601:                   produce different results for a.out and ELF
                   8602:                   (excluding symlinks) in only one case. An ELF
                   8603:                   library of the form &#8220;<span class=
                   8604:                   "quote">libfoo-release.so.<span class=
                   8605:                   "emphasis"><em>x</em></span>.<span class=
                   8606:                   "emphasis"><em>y</em></span></span>&#8221; will
                   8607:                   have a symlink of &#8220;<span class=
                   8608:                   "quote">libfoo.so.<span class=
                   8609:                   "emphasis"><em>x</em></span>.<span class=
                   8610:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   8611:                   a.out platform. This is handled
                   8612:                   automatically.</p>
                   8613: 
                   8614:                   <p>The &#8220;<span class="quote">-rpath
                   8615:                   argument</span>&#8221; is the install directory
                   8616:                   of the library being built.</p>
                   8617: 
                   8618:                   <p>In the <tt class="filename">PLIST</tt>,
                   8619:                   include all of the <tt class="filename">.a</tt>,
                   8620:                   <tt class="filename">.la</tt>, and <tt class=
                   8621:                   "filename">.so</tt>, <tt class=
                   8622:                   "filename">.so.<i class=
                   8623:                   "replaceable"><tt>major</tt></i></tt> and
                   8624:                   <tt class="filename">.so.<i class=
                   8625:                   "replaceable"><tt>major</tt></i>.<i class=
                   8626:                   "replaceable"><tt>minor</tt></i></tt> files.</p>
                   8627:                 </li>
                   8628: 
                   8629:                 <li>
                   8630:                   <p>When linking shared object (<tt class=
                   8631:                   "filename">.so</tt>) files, i.e. files that are
                   8632:                   loaded via dlopen(3), NOT shared libraries, use
                   8633:                   &#8220;<span class="quote">-module
                   8634:                   -avoid-version</span>&#8221; to prevent them
                   8635:                   getting version tacked on.</p>
                   8636: 
                   8637:                   <p>The <tt class="filename">PLIST</tt> file gets
                   8638:                   the <tt class="filename">foo.so</tt> entry.</p>
                   8639:                 </li>
                   8640: 
                   8641:                 <li>
                   8642:                   <p>When linking programs that depend on these
                   8643:                   libraries <span class=
                   8644:                   "emphasis"><em>before</em></span> they are
                   8645:                   installed, preface the <a href=
                   8646:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   8647:                   <span class="citerefentry"><span class=
                   8648:                   "refentrytitle">cc</span>(1)</span></a> or
                   8649:                   <a href=
                   8650:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   8651:                   <span class="citerefentry"><span class=
                   8652:                   "refentrytitle">ld</span>(1)</span></a> line with
                   8653:                   &#8220;<span class="quote">${LIBTOOL}
                   8654:                   --mode=link</span>&#8221;, and it will find the
                   8655:                   correct libraries (static or shared), but please
                   8656:                   be aware that libtool will not allow you to
                   8657:                   specify a relative path in -L (such as
                   8658:                   &#8220;<span class=
                   8659:                   "quote">-L../somelib</span>&#8221;), because it
                   8660:                   expects you to change that argument to be the
                   8661:                   <tt class="filename">.la</tt> file. e.g.</p>
                   8662:                   <pre class="programlisting">
                   8663: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   8664: </pre>
                   8665: 
                   8666:                   <p>should be changed to:</p>
                   8667:                   <pre class="programlisting">
                   8668: ${LIBTOOL} --mode=link ${CC} -o <i class=
                   8669: "replaceable"><tt>someprog</tt></i> <i class=
                   8670: "replaceable"><tt>../somelib/somelib.la</tt></i>
                   8671: </pre>
                   8672: 
                   8673:                   <p>and it will do the right thing with the
                   8674:                   libraries.</p>
                   8675:                 </li>
                   8676: 
                   8677:                 <li>
                   8678:                   <p>When installing libraries, preface the
                   8679:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   8680:                   <span class="citerefentry"><span class=
                   8681:                   "refentrytitle">install</span>(1)</span></a> or
                   8682:                   <a href=
                   8683:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   8684:                   <span class="citerefentry"><span class=
                   8685:                   "refentrytitle">cp</span>(1)</span></a> command
                   8686:                   with &#8220;<span class="quote">${LIBTOOL}
                   8687:                   --mode=install</span>&#8221;, and change the
                   8688:                   library name to <tt class="filename">.la</tt>.
                   8689:                   e.g.</p>
                   8690:                   <pre class="programlisting">
                   8691: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   8692: </pre>
                   8693: 
                   8694:                   <p>This will install the static <tt class=
                   8695:                   "filename">.a</tt>, shared library, any needed
                   8696:                   symlinks, and run <a href=
                   8697:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   8698:                   <span class="citerefentry"><span class=
                   8699:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   8700:                 </li>
                   8701: 
                   8702:                 <li>
                   8703:                   <p>In your <tt class="filename">PLIST</tt>,
                   8704:                   include all of the <tt class="filename">.a</tt>,
                   8705:                   <tt class="filename">.la</tt>, and <tt class=
                   8706:                   "filename">.so</tt>, <tt class=
                   8707:                   "filename">.so.CURRENT</tt> and <tt class=
                   8708:                   "filename">.so.CURRENT.REVISION</tt> files (this
                   8709:                   is a change from the previous behaviour).</p>
                   8710:                 </li>
                   8711:               </ol>
                   8712:             </div>
                   8713:           </div>
                   8714: 
                   8715:           <div class="sect2" lang="en" xml:lang="en">
                   8716:             <div class="titlepage">
                   8717:               <div>
                   8718:                 <div>
1.2     ! hubertf  8719:                   <h3 class="title"><a name="id2572390" id=
        !          8720:                   "id2572390"></a>12.3.2.&nbsp;Using libtool on GNU
1.1       grant    8721:                   packages that already support libtool</h3>
                   8722:                 </div>
                   8723:               </div>
                   8724:             </div>
                   8725: 
                   8726:             <p>Add <tt class="varname">USE_LIBTOOL=yes</tt> to the
                   8727:             package Makefile. This will override the package's own
                   8728:             libtool in most cases. For older libtool using
                   8729:             packages, libtool is made by ltconfig script during the
                   8730:             do-configure step; you can check the libtool script
                   8731:             location by doing <span><b class="command">make
                   8732:             configure; find work*/ -name libtool</b></span>.</p>
                   8733: 
                   8734:             <p><tt class="varname">LIBTOOL_OVERRIDE</tt> specifies
                   8735:             which libtool scripts, relative to <tt class=
                   8736:             "varname">WRKSRC</tt>, to override. By default, it is
                   8737:             set to &#8220;<span class="quote">libtool */libtool
                   8738:             */*/libtool</span>&#8221;. If this does not match the
                   8739:             location of the package's libtool script(s), set it as
                   8740:             appropriate.</p>
                   8741: 
                   8742:             <p>If you do not need <tt class="filename">*.a</tt>
                   8743:             static libraries built and installed, then use
                   8744:             <tt class="varname">SHLIBTOOL_OVERRIDE</tt>
                   8745:             instead.</p>
                   8746: 
                   8747:             <p>If your package makes use of the platform
                   8748:             independent library for loading dynamic shared objects,
                   8749:             that comes with libtool (libltdl), you should include
                   8750:             the libtool buildlink3.mk (and set <tt class=
                   8751:             "varname">USE_BUILDLINK3=YES</tt>).</p>
                   8752: 
                   8753:             <p>Some packages use libtool incorrectly so that the
                   8754:             package may not work or build in some circumstances.
                   8755:             Some of the more common errors are:</p>
                   8756: 
                   8757:             <div class="itemizedlist">
                   8758:               <ul type="disc">
                   8759:                 <li>
                   8760:                   <p>The inclusion of a shared object (-module) as
                   8761:                   a dependent library in an executable or library.
                   8762:                   This in itself isn't a problem if one of two
                   8763:                   things has been done:</p>
                   8764: 
                   8765:                   <div class="orderedlist">
                   8766:                     <ol type="1">
                   8767:                       <li>
                   8768:                         <p>The shared object is named correctly,
                   8769:                         i.e. <tt class="filename">libfoo.la</tt>,
                   8770:                         not <tt class="filename">foo.la</tt></p>
                   8771:                       </li>
                   8772: 
                   8773:                       <li>
                   8774:                         <p>The -dlopen option is used when linking
                   8775:                         an executable.</p>
                   8776:                       </li>
                   8777:                     </ol>
                   8778:                   </div>
                   8779:                 </li>
                   8780: 
                   8781:                 <li>
                   8782:                   <p>The use of libltdl without the correct calls
                   8783:                   to initialisation routines. The function
                   8784:                   lt_dlinit() should be called and the macro
                   8785:                   <tt class=
                   8786:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</tt>
                   8787:                   included in executables.</p>
                   8788:                 </li>
                   8789:               </ul>
                   8790:             </div>
                   8791:           </div>
                   8792: 
                   8793:           <div class="sect2" lang="en" xml:lang="en">
                   8794:             <div class="titlepage">
                   8795:               <div>
                   8796:                 <div>
1.2     ! hubertf  8797:                   <h3 class="title"><a name="id2572474" id=
        !          8798:                   "id2572474"></a>12.3.3.&nbsp;GNU
1.1       grant    8799:                   Autoconf/Automake</h3>
                   8800:                 </div>
                   8801:               </div>
                   8802:             </div>
                   8803: 
                   8804:             <p>If a package needs GNU autoconf or automake to be
                   8805:             executed to regenerate the configure script and
                   8806:             Makefile.in makefile templates, then they should be
                   8807:             executed in a pre-configure target. Two Makefile
                   8808:             fragments are provided in <tt class=
                   8809:             "filename">pkgsrc/mk/autoconf.mk</tt> and <tt class=
                   8810:             "filename">pkgsrc/mk/automake.mk</tt> to help dealing
                   8811:             with these tools. See comments in these files for
                   8812:             details.</p>
                   8813: 
                   8814:             <p>For packages that need only autoconf:</p>
                   8815:             <pre class="programlisting">
                   8816: AUTOCONF_REQD=    2.50    # if default version is not good enough
                   8817: ...
                   8818: 
                   8819: pre-configure:
                   8820:           cd ${WRKSRC}; ${AUTOCONF}
                   8821: 
                   8822: ...
                   8823: .include "../../mk/autoconf.mk"
                   8824: </pre>
                   8825: 
                   8826:             <p>and for packages that need automake and
                   8827:             autoconf:</p>
                   8828:             <pre class="programlisting">
                   8829: AUTOMAKE_REQD=  1.7.1   # if default version is not good enough
                   8830: ...
                   8831: 
                   8832: pre-configure:
                   8833:           cd ${WRKSRC};                                           \
                   8834:           ${ACLOCAL};                                             \
                   8835:           ${AUTOHEADER};                                          \
                   8836:           ${AUTOMAKE} -a --foreign -i;                            \
                   8837:           ${AUTOCONF}
                   8838: 
                   8839: ...
                   8840: .include "../mk/automake.mk"
                   8841: </pre>
                   8842: 
                   8843:             <p>Packages which use GNU Automake will almost
                   8844:             certainly require GNU Make, but that's automatically
                   8845:             provided for you in <tt class=
                   8846:             "filename">mk/automake.mk</tt>.</p>
                   8847: 
                   8848:             <p>There are times when the configure process makes
                   8849:             additional changes to the generated files, which then
                   8850:             causes the build process to try to re-execute the
                   8851:             automake sequence. This is prevented by touching
                   8852:             various files in the configure stage. If this causes
                   8853:             problems with your package you can set <tt class=
                   8854:             "varname">AUTOMAKE_OVERRIDE=NO</tt> in the package
                   8855:             Makefile.</p>
                   8856:           </div>
                   8857:         </div>
                   8858: 
                   8859:         <div class="sect1" lang="en" xml:lang="en">
                   8860:           <div class="titlepage">
                   8861:             <div>
                   8862:               <div>
                   8863:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  8864:                 "id2572519" id="id2572519"></a>12.4.&nbsp;Building
1.1       grant    8865:                 considerations</h2>
                   8866:               </div>
                   8867:             </div>
                   8868:           </div>
                   8869: 
                   8870:           <div class="sect2" lang="en" xml:lang="en">
                   8871:             <div class="titlepage">
                   8872:               <div>
                   8873:                 <div>
1.2     ! hubertf  8874:                   <h3 class="title"><a name="id2572522" id=
        !          8875:                   "id2572522"></a>12.4.1.&nbsp;CPP defines</h3>
1.1       grant    8876:                 </div>
                   8877:               </div>
                   8878:             </div>
                   8879: 
                   8880:             <p>To port an application to NetBSD, it's usually
                   8881:             necessary for the compiler to be able to judge the
                   8882:             system on which it's compiling, and we use definitions
                   8883:             so that the C pre-processor can do this.</p>
                   8884: 
                   8885:             <p>To test whether you are working on a 4.4 BSD-derived
                   8886:             system, you should use the BSD definition, which is
                   8887:             defined in <tt class=
                   8888:             "filename">&lt;sys/param.h&gt;</tt> on said
                   8889:             systems.</p>
                   8890:             <pre class="programlisting">
                   8891: #include &lt;sys/param.h&gt;
                   8892: </pre>
                   8893: 
                   8894:             <p>and then you can surround the BSD-specific parts of
                   8895:             your package's C/C++ code using this conditional:</p>
                   8896:             <pre class="programlisting">
                   8897: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   8898:     ...
                   8899: #endif
                   8900: </pre>
                   8901: 
                   8902:             <p>Please use the &#8220;<span class=
                   8903:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   8904:             it should only apply to features of NetBSD that are not
                   8905:             present in other 4.4-lite derived BSDs.</p>
                   8906:           </div>
                   8907:         </div>
                   8908: 
                   8909:         <div class="sect1" lang="en" xml:lang="en">
                   8910:           <div class="titlepage">
                   8911:             <div>
                   8912:               <div>
                   8913:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  8914:                 "id2572552" id="id2572552"></a>12.5.&nbsp;Package
1.1       grant    8915:                 specific actions</h2>
                   8916:               </div>
                   8917:             </div>
                   8918:           </div>
                   8919: 
                   8920:           <div class="sect2" lang="en" xml:lang="en">
                   8921:             <div class="titlepage">
                   8922:               <div>
                   8923:                 <div>
1.2     ! hubertf  8924:                   <h3 class="title"><a name="id2572555" id=
        !          8925:                   "id2572555"></a>12.5.1.&nbsp;Package
1.1       grant    8926:                   configuration files</h3>
                   8927:                 </div>
                   8928:               </div>
                   8929:             </div>
                   8930: 
                   8931:             <p>Packages should be taught to look for their
                   8932:             configuration files in <tt class=
                   8933:             "varname">${PKG_SYSCONFDIR}</tt>, which is passed
                   8934:             through to the configure and build processes.
                   8935:             <tt class="varname">PKG_SYSCONFDIR</tt> may be
                   8936:             customized in various ways by setting other make
                   8937:             variables:</p>
                   8938: 
                   8939:             <div class="itemizedlist">
                   8940:               <ul type="disc">
                   8941:                 <li>
                   8942:                   <p><tt class="varname">PKG_SYSCONFBASE</tt> is
                   8943:                   the main config directory under which all package
                   8944:                   configuration files are to be found. This
                   8945:                   defaults to <tt class=
                   8946:                   "filename">${PREFIX}/etc</tt>, but may be
                   8947:                   overridden in <tt class=
                   8948:                   "filename">/etc/mk.conf</tt>.</p>
                   8949:                 </li>
                   8950: 
                   8951:                 <li>
                   8952:                   <p><tt class="varname">PKG_SYSCONFSUBDIR</tt> is
                   8953:                   the subdirectory of <tt class=
                   8954:                   "varname">PKG_SYSCONFBASE</tt> under which the
                   8955:                   configuration files for a particular package may
                   8956:                   be found, e.g. the Apache configuration files may
                   8957:                   all be found under the <tt class=
                   8958:                   "filename">httpd/</tt> subdirectory of <tt class=
                   8959:                   "varname">${PKG_SYSCONFBASE}</tt>. This should be
                   8960:                   set in the package Makefile.</p>
                   8961:                 </li>
                   8962: 
                   8963:                 <li>
                   8964:                   <p>By default, <tt class=
                   8965:                   "varname">PKG_SYSCONFDIR</tt> is set to
                   8966:                   <tt class="varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</tt>,
                   8967:                   but this may be overridden by setting <tt class=
                   8968:                   "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>
                   8969:                   for a particular package, where <tt class=
                   8970:                   "varname">PKG_SYSCONFVAR</tt> defaults to
                   8971:                   <tt class="varname">${PKGBASE}</tt>. This is not
                   8972:                   meant to be set by a package Makefile, but is
                   8973:                   reserved for users who wish to override the
                   8974:                   <tt class="varname">PKG_SYSCONFDIR</tt> setting
                   8975:                   for a particular package with a special
                   8976:                   location.</p>
                   8977:                 </li>
                   8978:               </ul>
                   8979:             </div>
                   8980: 
                   8981:             <p>The only variables that users should customize are
                   8982:             <tt class="varname">PKG_SYSCONFBASE</tt> and <tt class=
                   8983:             "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</tt>. Users
                   8984:             will typically want to set <tt class=
                   8985:             "varname">PKG_SYSCONFBASE</tt> to <tt class=
                   8986:             "filename">/etc</tt>, or to accept the default location
                   8987:             of <tt class="filename">${PREFIX}/etc</tt>.</p>
                   8988:           </div>
                   8989: 
                   8990:           <div class="sect2" lang="en" xml:lang="en">
                   8991:             <div class="titlepage">
                   8992:               <div>
                   8993:                 <div>
1.2     ! hubertf  8994:                   <h3 class="title"><a name="id2572726" id=
        !          8995:                   "id2572726"></a>12.5.2.&nbsp;User
        !          8996:                   interaction</h3>
1.1       grant    8997:                 </div>
                   8998:               </div>
                   8999:             </div>
                   9000: 
                   9001:             <p>Occasionally, packages require interaction from the
                   9002:             user, and this can be in a number of ways:</p>
                   9003: 
                   9004:             <div class="itemizedlist">
                   9005:               <ul type="disc">
                   9006:                 <li>
                   9007:                   <p>help in fetching the distfiles</p>
                   9008:                 </li>
                   9009: 
                   9010:                 <li>
                   9011:                   <p>help to configure the package before it is
                   9012:                   built</p>
                   9013:                 </li>
                   9014: 
                   9015:                 <li>
                   9016:                   <p>help during the build process</p>
                   9017:                 </li>
                   9018: 
                   9019:                 <li>
                   9020:                   <p>help during the installation of a package</p>
                   9021:                 </li>
                   9022:               </ul>
                   9023:             </div>
                   9024: 
                   9025:             <p>The <tt class="varname">INTERACTIVE_STAGE</tt>
                   9026:             definition is provided to notify the pkgsrc mechanism
                   9027:             of an interactive stage which will be needed, and this
                   9028:             should be set in the package's <tt class=
                   9029:             "filename">Makefile</tt>. e.g.</p>
                   9030:             <pre class="programlisting">
                   9031: INTERACTIVE_STAGE= build
                   9032: </pre>
                   9033: 
                   9034:             <p>Multiple interactive stages can be specified:</p>
                   9035:             <pre class="programlisting">
                   9036: INTERACTIVE_STAGE= configure install
                   9037: </pre>
                   9038:           </div>
                   9039: 
                   9040:           <div class="sect2" lang="en" xml:lang="en">
                   9041:             <div class="titlepage">
                   9042:               <div>
                   9043:                 <div>
1.2     ! hubertf  9044:                   <h3 class="title"><a name="id2572771" id=
        !          9045:                   "id2572771"></a>12.5.3.&nbsp;Handling
1.1       grant    9046:                   licenses</h3>
                   9047:                 </div>
                   9048:               </div>
                   9049:             </div>
                   9050: 
                   9051:             <p>A package may underly a license which the user has
                   9052:             or has not agreed to accept. Usually, packages that
                   9053:             underly well-known Open Source licenses (e.g. the GNU
                   9054:             Public License, GPL) won't have any special license
                   9055:             tags added in pkgsrc which require special action by
                   9056:             the user of such packages, but there are quite a number
                   9057:             of other licenses out there that pkgsrc users may not
                   9058:             be able to follow, for whatever reasons. For these
                   9059:             cases, pkgsrc contains a mechanism to note that a
                   9060:             package underlies a certain license, and the user has
                   9061:             to accept the license before the package can be
                   9062:             installed.</p>
                   9063: 
                   9064:             <p>Placing a certain package under a certain license
                   9065:             works by setting the <tt class="varname">LICENSE</tt>
                   9066:             variable to a string identifying the license, e.g. in
                   9067:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9068:             href=
                   9069:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.2     ! hubertf  9070:                class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    9071:             <pre class="programlisting">
                   9072: LICENSE=        graphviz-license
                   9073: </pre>
                   9074: 
                   9075:             <p>When trying to build, the user will get a notice
                   9076:             that the package underlies a license which he hasn't
                   9077:             accepted (yet):</p>
                   9078:             <pre class="programlisting">
                   9079: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
                   9080: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   9081: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   9082: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   9083: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   9084: *** Error code 1
                   9085: </pre>
                   9086: 
                   9087:             <p>The license can be viewed with <span><b class=
                   9088:             "command">make show-license</b></span>, and if it is
                   9089:             considered appropriate, the line printed above can be
                   9090:             added to <tt class="filename">/etc/mk.conf</tt> to
                   9091:             indicate acceptance of the particular license:</p>
                   9092:             <pre class="programlisting">
                   9093: ACCEPTABLE_LICENSES+=graphviz-license
                   9094: </pre>
                   9095: 
                   9096:             <p>When adding a package with a new license, the
                   9097:             license text should be added to <tt class=
                   9098:             "filename">pkgsrc/licenses</tt> for displaying. A list
                   9099:             of known licenses can be seen in this directory as well
                   9100:             as by looking at the list of (commented out) <tt class=
                   9101:             "varname">ACCEPTABLE_LICENSES</tt> variable settings in
                   9102:             <tt class=
                   9103:             "filename">pkgsrc/mk/bsd.pkg.defaults.mk</tt>.</p>
                   9104: 
                   9105:             <p>Is there is a <span class=
                   9106:             "emphasis"><em>really</em></span> pressing need to
                   9107:             accept all licenses at once, like when trying to
                   9108:             download or mirror all distfiles or doing a bulk build
                   9109:             to test if all packages in pkgsrc build, this can be
                   9110:             done by setting <tt class=
                   9111:             "varname">_ACCEPTABLE=yes</tt>.</p>
                   9112:           </div>
                   9113: 
                   9114:           <div class="sect2" lang="en" xml:lang="en">
                   9115:             <div class="titlepage">
                   9116:               <div>
                   9117:                 <div>
1.2     ! hubertf  9118:                   <h3 class="title"><a name="id2572922" id=
        !          9119:                   "id2572922"></a>12.5.4.&nbsp;Creating an account
1.1       grant    9120:                   from a package</h3>
                   9121:                 </div>
                   9122:               </div>
                   9123:             </div>
                   9124: 
                   9125:             <p>There are two make variables used to control the
                   9126:             creation of package-specific groups and users at
                   9127:             pre-install time. The first is <tt class=
                   9128:             "varname">PKG_GROUPS</tt>, which is a list of
                   9129:             group[:groupid] elements, where the groupid is
                   9130:             optional. The second is <tt class=
                   9131:             "varname">PKG_USERS</tt>, which is a list of elements
                   9132:             of the form:</p>
                   9133:             <pre class="programlisting">
                   9134: user:group[:[userid][:[description][:[home][:shell]]]]
                   9135: </pre>
                   9136: 
                   9137:             <p>where only the user and group are required, the rest
                   9138:             being optional. A simple example is:</p>
                   9139:             <pre class="programlisting">
                   9140:   PKG_GROUPS=       foogroup
                   9141:     PKG_USERS=    foouser:foogroup
                   9142: </pre>
                   9143: 
                   9144:             <p>A more complex example is that creates two groups
                   9145:             and two users is:</p>
                   9146:             <pre class="programlisting">
                   9147:   PKG_GROUPS=       group1 group2:1005
                   9148:     PKG_USERS=    first:group1::First\\ User                      \
                   9149:                   second:group2::Second\\ User:/home/second:${SH}
                   9150: </pre>
                   9151: 
                   9152:             <p>By default, a new user will have home directory
                   9153:             <tt class="filename">/nonexistent</tt>, and login shell
                   9154:             <tt class="filename">/sbin/nologin</tt> unless they are
                   9155:             specified as part of the user element.</p>
                   9156: 
                   9157:             <p>The package <tt class="filename">Makefile</tt> must
                   9158:             also set <tt class="varname">USE_PKGINSTALL=YES</tt>.
                   9159:             This will cause the users and groups to be created at
                   9160:             pre-install time, and the admin will be prompted to
                   9161:             remove them at post-deinstall time. Automatic creation
                   9162:             of the users and groups can be toggled on and off by
                   9163:             setting the <tt class=
                   9164:             "varname">PKG_CREATE_USERGROUP</tt> variable prior to
                   9165:             package installation.</p>
                   9166:           </div>
                   9167: 
                   9168:           <div class="sect2" lang="en" xml:lang="en">
                   9169:             <div class="titlepage">
                   9170:               <div>
                   9171:                 <div>
1.2     ! hubertf  9172:                   <h3 class="title"><a name="id2573052" id=
        !          9173:                   "id2573052"></a>12.5.5.&nbsp;Installing score
1.1       grant    9174:                   files</h3>
                   9175:                 </div>
                   9176:               </div>
                   9177:             </div>
                   9178: 
                   9179:             <p>Certain packages, most of them in the games
                   9180:             category, install a score file that allows all users on
                   9181:             the system to record their highscores. In order for
                   9182:             this to work, the binaries need to be installed setgid
                   9183:             and the score files owned by the appropriate group
                   9184:             and/or owner (traditionally the "games" user/group).
                   9185:             The following variables, documented in more detail in
                   9186:             <tt class="filename">mk/bsd.pkg.defaults.mk</tt>,
                   9187:             control this behaviour: <tt class=
                   9188:             "varname">SETGIDGAME</tt>, <tt class=
                   9189:             "varname">GAMEDATAMODE</tt>, <tt class=
                   9190:             "varname">GAMEGRP</tt>, <tt class=
                   9191:             "varname">GAMEMODE</tt>, <tt class=
                   9192:             "varname">GAMEOWN</tt>.</p>
                   9193: 
                   9194:             <p>Note that per default, setgid installation of games
                   9195:             is disabled; setting <tt class=
                   9196:             "varname">SETGIDGAME=YES</tt> will set all the other
                   9197:             variables accordingly.</p>
                   9198: 
                   9199:             <p>A package should therefor never hard code file
                   9200:             ownership or access permissions but rely on <tt class=
                   9201:             "varname">INSTALL_GAME</tt> and <tt class=
                   9202:             "varname">INSTALL_GAME_DATA</tt> to set these
                   9203:             correctly.</p>
                   9204:           </div>
                   9205: 
                   9206:           <div class="sect2" lang="en" xml:lang="en">
                   9207:             <div class="titlepage">
                   9208:               <div>
                   9209:                 <div>
1.2     ! hubertf  9210:                   <h3 class="title"><a name="id2573096" id=
        !          9211:                   "id2573096"></a>12.5.6.&nbsp;Packages providing
1.1       grant    9212:                   login shells</h3>
                   9213:                 </div>
                   9214:               </div>
                   9215:             </div>
                   9216: 
                   9217:             <p>If the purpose of the package is to provide a login
                   9218:             shell, the variable <tt class="varname">PKG_SHELL</tt>
                   9219:             should contain the full pathname of the shell
                   9220:             executable installed by this package. The package
                   9221:             <tt class="filename">Makefile</tt> must also set
                   9222:             <tt class="varname">USE_PKGINSTALL=YES</tt> to use the
                   9223:             automatically generated <tt class=
                   9224:             "filename">INSTALL</tt>/<tt class=
                   9225:             "filename">DEINSTALL</tt> scripts.</p>
                   9226: 
                   9227:             <p>An example taken from shells/zsh:</p>
                   9228:             <pre class="programlisting">
                   9229:   USE_PKGINSTALL=   YES
                   9230:     PKG_SHELL=    ${PREFIX}/bin/zsh
                   9231: </pre>
                   9232: 
                   9233:             <p>The shell is registered into <tt class=
                   9234:             "filename">/etc/shells</tt> file automatically in the
                   9235:             post-install target by the generated <tt class=
                   9236:             "filename">INSTALL</tt> script and removed in the
                   9237:             deinstall target by the <tt class=
                   9238:             "filename">DEINSTALL</tt> script.</p>
                   9239:           </div>
                   9240: 
                   9241:           <div class="sect2" lang="en" xml:lang="en">
                   9242:             <div class="titlepage">
                   9243:               <div>
                   9244:                 <div>
1.2     ! hubertf  9245:                   <h3 class="title"><a name="id2573222" id=
        !          9246:                   "id2573222"></a>12.5.7.&nbsp;Packages containing
1.1       grant    9247:                   perl scripts</h3>
                   9248:                 </div>
                   9249:               </div>
                   9250:             </div>
                   9251: 
                   9252:             <p>If your package contains interpreted perl scripts,
                   9253:             set <tt class="varname">REPLACE_PERL</tt> to ensure
                   9254:             that the proper interpreter path is set. <tt class=
                   9255:             "varname">REPLACE_PERL</tt> should contain a list of
                   9256:             scripts, relative to <tt class="varname">WRKSRC</tt>,
                   9257:             that you want adjusted.</p>
                   9258:           </div>
                   9259: 
                   9260:           <div class="sect2" lang="en" xml:lang="en">
                   9261:             <div class="titlepage">
                   9262:               <div>
                   9263:                 <div>
1.2     ! hubertf  9264:                   <h3 class="title"><a name="id2573240" id=
        !          9265:                   "id2573240"></a>12.5.8.&nbsp;Packages with
1.1       grant    9266:                   hardcoded paths to other interpreters</h3>
                   9267:                 </div>
                   9268:               </div>
                   9269:             </div>
                   9270: 
                   9271:             <p>Your package may also contain scripts with hardcoded
                   9272:             paths to other interpreters besides (or as well as)
                   9273:             perl. To correct the full pathname to the script
                   9274:             interpreter, you need to set the following definitions
                   9275:             in your <tt class="filename">Makefile</tt> (we shall
                   9276:             use <span><b class="command">tclsh</b></span> in this
                   9277:             example):</p>
                   9278:             <pre class="programlisting">
                   9279:   REPLACE_INTERPRETER+=     tcl
                   9280:     _REPLACE.tcl.old=     .*/bin/tclsh
                   9281:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   9282:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   9283:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   9284: </pre>
                   9285:           </div>
                   9286: 
                   9287:           <div class="sect2" lang="en" xml:lang="en">
                   9288:             <div class="titlepage">
                   9289:               <div>
                   9290:                 <div>
1.2     ! hubertf  9291:                   <h3 class="title"><a name="id2573261" id=
        !          9292:                   "id2573261"></a>12.5.9.&nbsp;Packages installing
1.1       grant    9293:                   perl modules</h3>
                   9294:                 </div>
                   9295:               </div>
                   9296:             </div>
                   9297: 
                   9298:             <p>Makefiles of packages providing perl5 modules should
                   9299:             include the Makefile fragment <tt class=
                   9300:             "filename">../../lang/perl5/module.mk</tt>. It provides
                   9301:             a <span><b class="command">do-configure</b></span>
                   9302:             target for the standard perl configuration for such
                   9303:             modules as well as various hooks to tune this
                   9304:             configuration. See comments in this file for
                   9305:             details.</p>
                   9306: 
                   9307:             <p>Perl5 modules will install into different places
                   9308:             depending on the version of perl used during the build
                   9309:             process. To address this, pkgsrc will append lines to
                   9310:             the <tt class="filename">PLIST</tt> corresponding to
                   9311:             the files listed in the installed <tt class=
                   9312:             "filename">.packlist</tt> file generated by most perl5
                   9313:             modules. This is invoked by defining <tt class=
                   9314:             "varname">PERL5_PACKLIST</tt> to a space-separated list
                   9315:             of paths to packlist files, e.g.:</p>
                   9316:             <pre class="programlisting">
                   9317: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   9318: </pre>
                   9319: 
                   9320:             <p>The variables <tt class=
                   9321:             "varname">PERL5_SITELIB</tt>, <tt class=
                   9322:             "varname">PERL5_SITEARCH</tt>, and <tt class=
                   9323:             "varname">PERL5_ARCHLIB</tt> represent the three
                   9324:             locations in which perl5 modules may be installed, and
                   9325:             may be used by perl5 packages that don't have a
                   9326:             packlist. These three variables are also substituted
                   9327:             for in the <tt class="filename">PLIST</tt>.</p>
                   9328:           </div>
                   9329: 
                   9330:           <div class="sect2" lang="en" xml:lang="en">
                   9331:             <div class="titlepage">
                   9332:               <div>
                   9333:                 <div>
                   9334:                   <h3 class="title"><a name="faq.info-files" id=
                   9335:                   "faq.info-files"></a>12.5.10.&nbsp;Packages
                   9336:                   installing info files</h3>
                   9337:                 </div>
                   9338:               </div>
                   9339:             </div>
                   9340: 
                   9341:             <p>Some packages install info files or use the
                   9342:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   9343:             &#8220;<span class="quote">install-info</span>&#8221;
                   9344:             commands. Each of the info files:</p>
                   9345: 
                   9346:             <div class="itemizedlist">
                   9347:               <ul type="disc">
                   9348:                 <li>
                   9349:                   <p>is considered to be installed in the directory
                   9350:                   <tt class=
                   9351:                   "filename">${PREFIX}/${INFO_DIR}</tt>,</p>
                   9352:                 </li>
                   9353: 
                   9354:                 <li>
                   9355:                   <p>is registered in the Info directory file
                   9356:                   <tt class=
                   9357:                   "filename">${PREFIX}/${INFO_DIR}/dir</tt>,</p>
                   9358:                 </li>
                   9359: 
                   9360:                 <li>
                   9361:                   <p>and must be listed as a filename in the
                   9362:                   <tt class="varname">INFO_FILES</tt> variable in
                   9363:                   the package Makefile.</p>
                   9364:                 </li>
                   9365:               </ul>
                   9366:             </div>
                   9367: 
                   9368:             <p><tt class="varname">INFO_DIR</tt> defaults to
                   9369:             &#8220;<span class="quote">info</span>&#8221; and can
                   9370:             be overridden in the package Makefile. <tt class=
                   9371:             "filename">INSTALL</tt> and <tt class=
                   9372:             "filename">DEINSTALL</tt> scripts will be generated to
                   9373:             handle registration of the info files in the Info
                   9374:             directory file. The &#8220;<span class=
                   9375:             "quote">install-info</span>&#8221; command used for the
                   9376:             info files registration is either provided by the
                   9377:             system, or by a special purpose package automatically
                   9378:             added as dependency if needed.</p>
                   9379: 
                   9380:             <p>A package which needs the &#8220;<span class=
                   9381:             "quote">makeinfo</span>&#8221; command at build time
                   9382:             must define the variable <tt class=
                   9383:             "varname">USE_MAKEINFO</tt> in its Makefile. If a
                   9384:             minimum version of the &#8220;<span class=
                   9385:             "quote">makeinfo</span>&#8221; command is needed it
                   9386:             should be noted with the <tt class=
                   9387:             "varname">TEXINFO_REQD</tt> variable in the package
                   9388:             <tt class="filename">Makefile</tt>. By default, a
                   9389:             minimum version of 3.12 is required. If the system does
                   9390:             not provide a <span><b class=
                   9391:             "command">makeinfo</b></span> command or if it does not
                   9392:             match the required minimum, a build dependency on the
                   9393:             <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   9394:             href=
                   9395:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.2     ! hubertf  9396:                class="pkgname">devel/gtexinfo</a> package will be
        !          9397:                added automatically.</p>
1.1       grant    9398: 
                   9399:             <p>The build and installation process of the software
                   9400:             provided by the package should not use the
                   9401:             <span><b class="command">install-info</b></span>
                   9402:             command as the registration of info files is the task
                   9403:             of the package <tt class="filename">INSTALL</tt>
                   9404:             script, and it must use the appropriate <span><b class=
                   9405:             "command">makeinfo</b></span> command.</p>
                   9406: 
                   9407:             <p>To achieve this goal the pkgsrc infrastructure
                   9408:             creates overriding scripts for the <span><b class=
                   9409:             "command">install-info</b></span> and <span><b class=
                   9410:             "command">makeinfo</b></span> commands in a directory
                   9411:             listed early in <tt class="varname">PATH</tt>.</p>
                   9412: 
                   9413:             <p>The script overriding <span><b class=
                   9414:             "command">install-info</b></span> has no effect except
                   9415:             the logging of a message. The script overriding
                   9416:             <span><b class="command">makeinfo</b></span> logs a
                   9417:             message and according to the value of <tt class=
                   9418:             "varname">USE_MAKEINFO</tt> and <tt class=
                   9419:             "varname">TEXINFO_REQD</tt> either run the appropriate
                   9420:             <span><b class="command">makeinfo</b></span> command or
                   9421:             exit on error.</p>
                   9422:           </div>
                   9423: 
                   9424:           <div class="sect2" lang="en" xml:lang="en">
                   9425:             <div class="titlepage">
                   9426:               <div>
                   9427:                 <div>
1.2     ! hubertf  9428:                   <h3 class="title"><a name="id2573549" id=
        !          9429:                   "id2573549"></a>12.5.11.&nbsp;Packages installing
1.1       grant    9430:                   GConf2 data files</h3>
                   9431:                 </div>
                   9432:               </div>
                   9433:             </div>
                   9434: 
                   9435:             <p>If a package installs <tt class=
                   9436:             "filename">.schemas</tt> or <tt class=
                   9437:             "filename">.entries</tt> files, used by GConf2, you
                   9438:             need to take some extra steps to make sure they get
                   9439:             registered in the database:</p>
                   9440: 
                   9441:             <div class="orderedlist">
                   9442:               <ol type="1">
                   9443:                 <li>
                   9444:                   <p>Include <tt class=
                   9445:                   "filename">../../devel/GConf2/schemas.mk</tt>
                   9446:                   instead of its <tt class=
                   9447:                   "filename">buildlink3.mk</tt> file. This takes
                   9448:                   care of rebuilding the GConf2 database at
                   9449:                   installation and deinstallation time, and tells
                   9450:                   the package where to install GConf2 data files
                   9451:                   using some standard configure arguments. It also
                   9452:                   disallows any access to the database directly
                   9453:                   from the package.</p>
                   9454:                 </li>
                   9455: 
                   9456:                 <li>
                   9457:                   <p>Ensure that the package installs its
                   9458:                   <tt class="filename">.schemas</tt> files under
                   9459:                   <tt class=
                   9460:                   "filename">${PREFIX}/share/gconf/schemas</tt>. If
                   9461:                   they get installed under <tt class=
                   9462:                   "filename">${PREFIX}/etc</tt>, you will need to
                   9463:                   manually patch the package.</p>
                   9464:                 </li>
                   9465: 
                   9466:                 <li>
                   9467:                   <p>Check the PLIST and remove any entries under
                   9468:                   the etc/gconf directory, as they will be handled
                   9469:                   automatically. See <a href="#faq.conf" title=
                   9470:                   "6.13.&nbsp;Configuration files handling and placement">
                   9471:                   Section&nbsp;6.13, &#8220;Configuration files
                   9472:                   handling and placement&#8221;</a> for more
                   9473:                   information.</p>
                   9474:                 </li>
                   9475: 
                   9476:                 <li>
                   9477:                   <p>Define the <tt class=
                   9478:                   "varname">GCONF2_SCHEMAS</tt> variable in your
                   9479:                   <tt class="filename">Makefile</tt> with a list of
                   9480:                   all <tt class="filename">.schemas</tt> files
                   9481:                   installed by the package, if any. Names must not
                   9482:                   contain any directories in them.</p>
                   9483:                 </li>
                   9484: 
                   9485:                 <li>
                   9486:                   <p>Define the <tt class=
                   9487:                   "varname">GCONF2_ENTRIES</tt> variable in your
                   9488:                   <tt class="filename">Makefile</tt> with a list of
                   9489:                   all <tt class="filename">.entries</tt> files
                   9490:                   installed by the package, if any. Names must not
                   9491:                   contain any directories in them.</p>
                   9492:                 </li>
                   9493:               </ol>
                   9494:             </div>
                   9495:           </div>
                   9496: 
                   9497:           <div class="sect2" lang="en" xml:lang="en">
                   9498:             <div class="titlepage">
                   9499:               <div>
                   9500:                 <div>
1.2     ! hubertf  9501:                   <h3 class="title"><a name="id2573650" id=
        !          9502:                   "id2573650"></a>12.5.12.&nbsp;Packages installing
1.1       grant    9503:                   scrollkeeper data files</h3>
                   9504:                 </div>
                   9505:               </div>
                   9506:             </div>
                   9507: 
                   9508:             <p>If a package installs <tt class="filename">.omf</tt>
                   9509:             files, used by scrollkeeper, you need to take some
                   9510:             extra steps to make sure they get registered in the
                   9511:             database:</p>
                   9512: 
                   9513:             <div class="orderedlist">
                   9514:               <ol type="1">
                   9515:                 <li>
                   9516:                   <p>Include <tt class=
                   9517:                   "filename">../../textproc/scrollkeeper/omf.mk</tt>
                   9518:                   instead of its <tt class=
                   9519:                   "filename">buildlink3.mk</tt> file. This takes
                   9520:                   care of rebuilding the scrollkeeper database at
                   9521:                   installation and deinstallation time, and
                   9522:                   disallows any access to it directly from the
                   9523:                   package.</p>
                   9524:                 </li>
                   9525: 
                   9526:                 <li>
                   9527:                   <p>Check the PLIST and remove any entries under
                   9528:                   the <tt class=
                   9529:                   "filename">libdata/scrollkeeper</tt> directory,
                   9530:                   as they will be handled automatically.</p>
                   9531:                 </li>
                   9532: 
                   9533:                 <li>
                   9534:                   <p>Remove the <tt class="filename">share/omf</tt>
                   9535:                   directory from the PLIST. It will be handled by
                   9536:                   scrollkeeper.</p>
                   9537:                 </li>
                   9538:               </ol>
                   9539:             </div>
                   9540:           </div>
                   9541: 
                   9542:           <div class="sect2" lang="en" xml:lang="en">
                   9543:             <div class="titlepage">
                   9544:               <div>
                   9545:                 <div>
1.2     ! hubertf  9546:                   <h3 class="title"><a name="id2573701" id=
        !          9547:                   "id2573701"></a>12.5.13.&nbsp;Packages installing
1.1       grant    9548:                   X11 fonts</h3>
                   9549:                 </div>
                   9550:               </div>
                   9551:             </div>
                   9552: 
                   9553:             <p>If a package installs font files, you will need to
                   9554:             rebuild the fonts database in the directory where they
                   9555:             get installed at installation and deinstallation time.
                   9556:             This can be automatically done by using <tt class=
                   9557:             "filename">mk/fonts.mk</tt>, which you need to include
                   9558:             in your <tt class="filename">Makefile</tt>.</p>
                   9559: 
                   9560:             <p>When the file is included, you can list the
                   9561:             directories where fonts are installed in the <tt class=
                   9562:             "varname">FONTS_<i class=
                   9563:             "replaceable"><tt>type</tt></i>_DIRS</tt> variables,
                   9564:             where <i class="replaceable"><tt>type</tt></i> can be
                   9565:             one of &#8220;<span class="quote">TTF</span>&#8221;,
                   9566:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   9567:             &#8220;<span class="quote">X11</span>&#8221;. Also make
                   9568:             sure that the database file <tt class=
                   9569:             "filename">fonts.dir</tt> is not listed in the
                   9570:             PLIST.</p>
                   9571: 
                   9572:             <p>Note that you should not create new directories for
                   9573:             fonts; instead use the standard ones to avoid that the
                   9574:             user needs to manually configure his X server to find
                   9575:             them.</p>
                   9576:           </div>
                   9577: 
                   9578:           <div class="sect2" lang="en" xml:lang="en">
                   9579:             <div class="titlepage">
                   9580:               <div>
                   9581:                 <div>
1.2     ! hubertf  9582:                   <h3 class="title"><a name="id2573816" id=
        !          9583:                   "id2573816"></a>12.5.14.&nbsp;Packages installing
1.1       grant    9584:                   GTK2 modules</h3>
                   9585:                 </div>
                   9586:               </div>
                   9587:             </div>
                   9588: 
                   9589:             <p>If a package installs gtk2 immodules or loaders, you
                   9590:             need to take some extra steps to get them registered in
                   9591:             the GTK2 database properly:</p>
                   9592: 
                   9593:             <div class="orderedlist">
                   9594:               <ol type="1">
                   9595:                 <li>
                   9596:                   <p>Include <tt class=
                   9597:                   "filename">../../x11/gtk2/modules.mk</tt> instead
                   9598:                   of its <tt class="filename">buildlink3.mk</tt>
                   9599:                   file. This takes care of rebuilding the database
                   9600:                   at installation and deinstallation time.</p>
                   9601:                 </li>
                   9602: 
                   9603:                 <li>
                   9604:                   <p>Set <tt class=
                   9605:                   "varname">GTK2_IMMODULES=YES</tt> if your package
                   9606:                   installs GTK2 immodules.</p>
                   9607:                 </li>
                   9608: 
                   9609:                 <li>
                   9610:                   <p>Set <tt class="varname">GTK2_LOADERS=YES</tt>
                   9611:                   if your package installs GTK2 loaders.</p>
                   9612:                 </li>
                   9613: 
                   9614:                 <li>
                   9615:                   <p>Patch the package to not touch any of the gtk2
                   9616:                   databases directly. These are:</p>
                   9617: 
                   9618:                   <div class="itemizedlist">
                   9619:                     <ul type="disc">
                   9620:                       <li>
                   9621:                         <p><tt class=
                   9622:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</tt></p>
                   9623:                       </li>
                   9624: 
                   9625:                       <li>
                   9626:                         <p><tt class=
                   9627:                         "filename">libdata/gtk-2.0/gtk.immodules</tt></p>
                   9628:                       </li>
                   9629:                     </ul>
                   9630:                   </div>
                   9631:                 </li>
                   9632: 
                   9633:                 <li>
                   9634:                   <p>Check the PLIST and remove any entries under
                   9635:                   the <tt class="filename">libdata/gtk-2.0</tt>
                   9636:                   directory, as they will be handled
                   9637:                   automatically.</p>
                   9638:                 </li>
                   9639:               </ol>
                   9640:             </div>
                   9641:           </div>
                   9642: 
                   9643:           <div class="sect2" lang="en" xml:lang="en">
                   9644:             <div class="titlepage">
                   9645:               <div>
                   9646:                 <div>
1.2     ! hubertf  9647:                   <h3 class="title"><a name="id2573885" id=
        !          9648:                   "id2573885"></a>12.5.15.&nbsp;Packages installing
1.1       grant    9649:                   SGML or XML data</h3>
                   9650:                 </div>
                   9651:               </div>
                   9652:             </div>
                   9653: 
                   9654:             <p>If a package installs SGML or XML data files that
                   9655:             need to be registered in system-wide catalogs (like
                   9656:             DTDs, sub-catalogs, etc.), you need to take some extra
                   9657:             steps:</p>
                   9658: 
                   9659:             <div class="orderedlist">
                   9660:               <ol type="1">
                   9661:                 <li>
                   9662:                   <p>Include <tt class=
                   9663:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</tt>
                   9664:                   in your <tt class="filename">Makefile</tt>, which
                   9665:                   takes care of registering those files in
                   9666:                   system-wide catalogs at installation and
                   9667:                   deinstallation time.</p>
                   9668:                 </li>
                   9669: 
                   9670:                 <li>
                   9671:                   <p>Set <tt class="varname">SGML_CATALOGS</tt> to
                   9672:                   the full path of any SGML catalogs installed by
                   9673:                   the package.</p>
                   9674:                 </li>
                   9675: 
                   9676:                 <li>
                   9677:                   <p>Set <tt class="varname">XML_CATALOGS</tt> to
                   9678:                   the full path of any XML catalogs installed by
                   9679:                   the package.</p>
                   9680:                 </li>
                   9681: 
                   9682:                 <li>
                   9683:                   <p>Set <tt class="varname">SGML_ENTRIES</tt> to
                   9684:                   individual entries to be added to the SGML
                   9685:                   catalog. These come in groups of three strings;
                   9686:                   see xmlcatmgr(1) for more information
                   9687:                   (specifically, arguments recognized by the 'add'
                   9688:                   action). Note that you will normally not use this
                   9689:                   variable.</p>
                   9690:                 </li>
                   9691: 
                   9692:                 <li>
                   9693:                   <p>Set <tt class="varname">XML_ENTRIES</tt> to
                   9694:                   individual entries to be added to the XML
                   9695:                   catalog. These come in groups of three strings;
                   9696:                   see xmlcatmgr(1) for more information
                   9697:                   (specifically, arguments recognized by the 'add'
                   9698:                   action). Note that you will normally not use this
                   9699:                   variable.</p>
                   9700:                 </li>
                   9701:               </ol>
                   9702:             </div>
                   9703:           </div>
                   9704: 
                   9705:           <div class="sect2" lang="en" xml:lang="en">
                   9706:             <div class="titlepage">
                   9707:               <div>
                   9708:                 <div>
1.2     ! hubertf  9709:                   <h3 class="title"><a name="id2573938" id=
        !          9710:                   "id2573938"></a>12.5.16.&nbsp;Packages installing
1.1       grant    9711:                   extensions to the MIME database</h3>
                   9712:                 </div>
                   9713:               </div>
                   9714:             </div>
                   9715: 
                   9716:             <p>If a package provides extensions to the MIME
                   9717:             database by installing <tt class="filename">.xml</tt>
                   9718:             files inside <tt class=
                   9719:             "filename">${PREFIX}/share/mime/packages</tt>, you need
                   9720:             to take some extra steps to ensure that the database is
                   9721:             kept consistent with respect to these new files:</p>
                   9722: 
                   9723:             <div class="orderedlist">
                   9724:               <ol type="1">
                   9725:                 <li>
                   9726:                   <p>Include <tt class=
                   9727:                   "filename">../../databases/shared-mime-info/mimedb.mk</tt>
                   9728:                   (avoid using the <tt class=
                   9729:                   "filename">buildlink3.mk</tt> file from this same
                   9730:                   directory, which is reserved for inclusion from
                   9731:                   other <tt class="filename">buildlink3.mk</tt>
                   9732:                   files). It takes care of rebuilding the MIME
                   9733:                   database at installation and deinstallation time,
                   9734:                   and disallows any access to it directly from the
                   9735:                   package.</p>
                   9736:                 </li>
                   9737: 
                   9738:                 <li>
                   9739:                   <p>Check the PLIST and remove any entries under
                   9740:                   the <tt class="filename">share/mime</tt>
                   9741:                   directory, <span class=
                   9742:                   "emphasis"><em>except</em></span> for files saved
                   9743:                   under <tt class=
                   9744:                   "filename">share/mime/packages</tt>. The former
                   9745:                   are handled automatically by the
                   9746:                   update-mime-database program, but the later are
                   9747:                   package-dependent and must be removed by the
                   9748:                   package that installed them in the first
                   9749:                   place.</p>
                   9750:                 </li>
                   9751: 
                   9752:                 <li>
                   9753:                   <p>Remove any <tt class=
                   9754:                   "filename">share/mime/*</tt> directories from the
                   9755:                   PLIST. They will be handled by the
                   9756:                   shared-mime-info package.</p>
                   9757:                 </li>
                   9758:               </ol>
                   9759:             </div>
                   9760:           </div>
                   9761: 
                   9762:           <div class="sect2" lang="en" xml:lang="en">
                   9763:             <div class="titlepage">
                   9764:               <div>
                   9765:                 <div>
1.2     ! hubertf  9766:                   <h3 class="title"><a name="id2574008" id=
        !          9767:                   "id2574008"></a>12.5.17.&nbsp;Packages using
1.1       grant    9768:                   intltool</h3>
                   9769:                 </div>
                   9770:               </div>
                   9771:             </div>
                   9772: 
                   9773:             <p>If a package uses intltool during its build, include
                   9774:             the <tt class=
                   9775:             "filename">../../textproc/intltool/buildlink3.mk</tt>
                   9776:             file, which forces it to use the intltool package
                   9777:             provided by pkgsrc, instead of the one bundled with the
                   9778:             distribution file.</p>
                   9779: 
                   9780:             <p>This tracks intltool's build-time dependencies and
                   9781:             uses the latest available version; this way, the
                   9782:             package benefits of any bug fixes that may have
                   9783:             appeared since it was released.</p>
                   9784:           </div>
                   9785:         </div>
                   9786: 
                   9787:         <div class="sect1" lang="en" xml:lang="en">
                   9788:           <div class="titlepage">
                   9789:             <div>
                   9790:               <div>
                   9791:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  9792:                 "id2574022" id="id2574022"></a>12.6.&nbsp;Feedback
1.1       grant    9793:                 to the author</h2>
                   9794:               </div>
                   9795:             </div>
                   9796:           </div>
                   9797: 
                   9798:           <p>If you have found any bugs in the package you make
                   9799:           available, if you had to do special steps to make it run
                   9800:           under NetBSD or if you enhanced the software in various
                   9801:           other ways, be sure to report these changes back to the
                   9802:           original author of the program! With that kind of
                   9803:           support, the next release of the program can incorporate
                   9804:           these fixes, and people not using the NetBSD packages
                   9805:           system can win from your efforts.</p>
                   9806: 
                   9807:           <p>Support the idea of free software!</p>
                   9808:         </div>
                   9809:       </div>
                   9810: 
                   9811:       <div class="chapter" lang="en" xml:lang="en">
                   9812:         <div class="titlepage">
                   9813:           <div>
                   9814:             <div>
                   9815:               <h2 class="title"><a name="debug" id=
                   9816:               "debug"></a>Chapter&nbsp;13.&nbsp;Debugging</h2>
                   9817:             </div>
                   9818:           </div>
                   9819:         </div>
                   9820: 
                   9821:         <p>To check out all the gotchas when building a package,
                   9822:         here are the steps that I do in order to get a package
                   9823:         working. Please note this is basically the same as what was
                   9824:         explained in the previous sections, only with some
                   9825:         debugging aids.</p>
                   9826: 
                   9827:         <div class="itemizedlist">
                   9828:           <ul type="disc">
                   9829:             <li>
                   9830:               <p>Be sure to set <tt class=
                   9831:               "varname">PKG_DEVELOPER=1</tt> in <tt class=
                   9832:               "filename">/etc/mk.conf</tt></p>
                   9833:             </li>
                   9834: 
                   9835:             <li>
                   9836:               <p>Install <a xmlns=
                   9837:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   9838:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.2     ! hubertf  9839:                  class="pkgname">pkgtools/url2pkg</a>, create a
        !          9840:                  directory for a new package, change into it, then
        !          9841:                  run <span><b class=
        !          9842:                  "command">url2pkg</b></span>:</p>
1.1       grant    9843:               <pre class="screen">
                   9844: <tt class="prompt">%</tt> <b class=
                   9845: "userinput"><tt>mkdir /usr/pkgsrc/<i class=
                   9846: "replaceable"><tt>category</tt></i>/<i class=
                   9847: "replaceable"><tt>examplepkg</tt></i></tt></b>
                   9848: <tt class="prompt">%</tt> <b class=
                   9849: "userinput"><tt>cd /usr/pkgsrc/<i class=
                   9850: "replaceable"><tt>category</tt></i>/<i class=
                   9851: "replaceable"><tt>examplepkg</tt></i></tt></b>
                   9852: <tt class="prompt">%</tt> <b class=
                   9853: "userinput"><tt>url2pkg http://www.example.com/path/to/distfile.tar.gz</tt></b>
                   9854: </pre>
                   9855:             </li>
                   9856: 
                   9857:             <li>
                   9858:               <p>Edit the <tt class="filename">Makefile</tt> as
                   9859:               requested.</p>
                   9860:             </li>
                   9861: 
                   9862:             <li>
                   9863:               <p>Fill in the <tt class="filename">DESCR</tt>
                   9864:               file</p>
                   9865:             </li>
                   9866: 
                   9867:             <li>
                   9868:               <p>Run <span><b class="command">make
                   9869:               configure</b></span></p>
                   9870:             </li>
                   9871: 
                   9872:             <li>
                   9873:               <p>Add any dependencies glimpsed from documentation
                   9874:               and the configure step to the package's <tt class=
                   9875:               "filename">Makefile</tt>.</p>
                   9876:             </li>
                   9877: 
                   9878:             <li>
                   9879:               <p>Make the package compile, doing multiple rounds
                   9880:               of</p>
                   9881:               <pre class="screen">
                   9882: <tt class="prompt">%</tt> <b class="userinput"><tt>make</tt></b>
                   9883: <tt class="prompt">%</tt> <b class=
                   9884: "userinput"><tt>pkgvi ${WRKSRC}/some/file/that/does/not/compile</tt></b>
                   9885: <tt class="prompt">%</tt> <b class=
                   9886: "userinput"><tt>mkpatches</tt></b>
                   9887: <tt class="prompt">%</tt> <b class=
                   9888: "userinput"><tt>patchdiff</tt></b>
                   9889: <tt class="prompt">%</tt> <b class=
                   9890: "userinput"><tt>mv ${WRKDIR}/.newpatches/* patches</tt></b>
                   9891: <tt class="prompt">%</tt> <b class=
                   9892: "userinput"><tt>make mps</tt></b>
                   9893: <tt class="prompt">%</tt> <b class=
                   9894: "userinput"><tt>make clean</tt></b>
                   9895: </pre>
                   9896: 
                   9897:               <p>Doing as non-root user will ensure that no files
                   9898:               are modified that shouldn't be, especially during the
                   9899:               build phase. <span><b class=
                   9900:               "command">mkpatches</b></span>, <span><b class=
                   9901:               "command">patchdiff</b></span> and <span><b class=
                   9902:               "command">pkgvi</b></span> are from the <a xmlns=
                   9903:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   9904:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.2     ! hubertf  9905:                  class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    9906:             </li>
                   9907: 
                   9908:             <li>
                   9909:               <p>Look at the <tt class="filename">Makefile</tt>,
                   9910:               fix if necessary; see <a href="#components.Makefile"
                   9911:               title="7.1.&nbsp;Makefile">Section&nbsp;7.1,
                   9912:               &#8220;Makefile&#8221;</a>.</p>
                   9913:             </li>
                   9914: 
                   9915:             <li>
                   9916:               <p>Generate a <tt class="filename">PLIST</tt>:</p>
                   9917:               <pre class="screen">
                   9918: <tt class="prompt">#</tt> <b class=
                   9919: "userinput"><tt>make install</tt></b>
                   9920: <tt class="prompt">#</tt> <b class=
                   9921: "userinput"><tt>make print-PLIST &gt;PLIST</tt></b>
                   9922: <tt class="prompt">#</tt> <b class=
                   9923: "userinput"><tt>make deinstall</tt></b>
                   9924: <tt class="prompt">#</tt> <b class=
                   9925: "userinput"><tt>make install</tt></b>
                   9926: <tt class="prompt">#</tt> <b class=
                   9927: "userinput"><tt>make deinstall</tt></b>
                   9928: </pre>
                   9929: 
                   9930:               <p>You usually need to be <tt class=
                   9931:               "username">root</tt> to do this. Look if there are
                   9932:               any files left:</p>
                   9933:               <pre class="screen">
                   9934: <tt class="prompt">#</tt> <b class=
                   9935: "userinput"><tt>make print-PLIST</tt></b>
                   9936: </pre>
                   9937: 
                   9938:               <p>If this reveals any files that are missing in
                   9939:               <tt class="filename">PLIST</tt>, add them.</p>
                   9940:             </li>
                   9941: 
                   9942:             <li>
                   9943:               <p>Now that the <tt class="filename">PLIST</tt> is
                   9944:               OK, install the package again and make a binary
                   9945:               package:</p>
                   9946:               <pre class="screen">
                   9947: <tt class="prompt">#</tt> <b class=
                   9948: "userinput"><tt>make reinstall</tt></b>
                   9949: <tt class="prompt">#</tt> <b class=
                   9950: "userinput"><tt>make package</tt></b>
                   9951: </pre>
                   9952:             </li>
                   9953: 
                   9954:             <li>
                   9955:               <p>Delete the installed package:</p>
                   9956:               <pre class="screen">
                   9957: <tt class="prompt">#</tt> <b class=
                   9958: "userinput"><tt>pkg_delete blub</tt></b>
                   9959: </pre>
                   9960:             </li>
                   9961: 
                   9962:             <li>
                   9963:               <p>Repeat the above <span><b class="command">make
                   9964:               print-PLIST</b></span> command, which shouldn't find
                   9965:               anything now:</p>
                   9966:               <pre class="screen">
                   9967: <tt class="prompt">#</tt> <b class=
                   9968: "userinput"><tt>make print-PLIST</tt></b>
                   9969: </pre>
                   9970:             </li>
                   9971: 
                   9972:             <li>
                   9973:               <p>Reinstall the binary package:</p>
                   9974:               <pre class="screen">
                   9975: <tt class="prompt">#</tt> <b class=
                   9976: "userinput"><tt>pkgadd .../blub.tgz</tt></b>
                   9977: </pre>
                   9978:             </li>
                   9979: 
                   9980:             <li>
                   9981:               <p>Play with it. Make sure everything works.</p>
                   9982:             </li>
                   9983: 
                   9984:             <li>
                   9985:               <p>Run <span><b class="command">pkglint</b></span>
                   9986:               from <a xmlns=
                   9987:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   9988:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.2     ! hubertf  9989:                  class="pkgname">pkgtools/pkglint</a>, and fix the
        !          9990:                  problems it reports:</p>
1.1       grant    9991:               <pre class="screen">
                   9992: <tt class="prompt">#</tt> <b class="userinput"><tt>pkglint</tt></b>
                   9993: </pre>
                   9994:             </li>
                   9995: 
                   9996:             <li>
                   9997:               <p>Submit (or commit, if you have cvs access); see
                   9998:               <a href="#submit" title=
                   9999:               "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter&nbsp;14,
                   10000:               <i>Submitting and Committing</i></a>.</p>
                   10001:             </li>
                   10002:           </ul>
                   10003:         </div>
                   10004:       </div>
                   10005: 
                   10006:       <div class="chapter" lang="en" xml:lang="en">
                   10007:         <div class="titlepage">
                   10008:           <div>
                   10009:             <div>
                   10010:               <h2 class="title"><a name="submit" id=
                   10011:               "submit"></a>Chapter&nbsp;14.&nbsp;Submitting and
                   10012:               Committing</h2>
                   10013:             </div>
                   10014:           </div>
                   10015:         </div>
                   10016: 
                   10017:         <div class="toc">
                   10018:           <p><b>Table of Contents</b></p>
                   10019: 
                   10020:           <dl>
1.2     ! hubertf  10021:             <dt><span class="sect1"><a href="#id2574484">14.1.
1.1       grant    10022:             Submitting your packages</a></span></dt>
                   10023: 
1.2     ! hubertf  10024:             <dt><span class="sect1"><a href="#id2574531">14.2.
1.1       grant    10025:             Committing: Importing a package into
                   10026:             CVS</a></span></dt>
                   10027: 
1.2     ! hubertf  10028:             <dt><span class="sect1"><a href="#id2574730">14.3.
        !          10029:             Updating a package to a newer version</a></span></dt>
1.1       grant    10030: 
1.2     ! hubertf  10031:             <dt><span class="sect1"><a href="#id2574818">14.4.
        !          10032:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    10033:           </dl>
                   10034:         </div>
                   10035: 
                   10036:         <div class="sect1" lang="en" xml:lang="en">
                   10037:           <div class="titlepage">
                   10038:             <div>
                   10039:               <div>
                   10040:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  10041:                 "id2574484" id=
        !          10042:                 "id2574484"></a>14.1.&nbsp;Submitting your
1.1       grant    10043:                 packages</h2>
                   10044:               </div>
                   10045:             </div>
                   10046:           </div>
                   10047: 
                   10048:           <p>You have to separate between binary and
                   10049:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   10050:           packages here:</p>
                   10051: 
                   10052:           <div class="itemizedlist">
                   10053:             <ul type="disc">
                   10054:               <li>
                   10055:                 <p>precompiled binary packages</p>
                   10056: 
                   10057:                 <p>Our policy is that we accept binaries only from
                   10058:                 pkgsrc developers to guarantee that the packages
                   10059:                 don't contain any trojan horses etc. This is not to
                   10060:                 piss anyone off but rather to protect our users!
                   10061:                 You're still free to put up your home-made binary
                   10062:                 packages and tell the world where to get them.</p>
                   10063:               </li>
                   10064: 
                   10065:               <li>
                   10066:                 <p>packages</p>
                   10067: 
                   10068:                 <p>First, check that your package is complete,
                   10069:                 compiles and runs well; see <a href="#debug" title=
                   10070:                 "Chapter&nbsp;13.&nbsp;Debugging">Chapter&nbsp;13,
                   10071:                 <i>Debugging</i></a> and the rest of this document.
                   10072:                 Next, generate an uuencoded gzipped tar(1) archive,
                   10073:                 preferably with all files in a single directory.
                   10074:                 Finally, <span><b class=
                   10075:                 "command">send-pr</b></span> with category
                   10076:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   10077:                 synopsis which includes the package name and
                   10078:                 version number, a short description of your package
                   10079:                 (contents of the COMMENT variable or DESCR file are
                   10080:                 OK) and attach the archive to your PR.</p>
                   10081: 
                   10082:                 <p>If you want to submit several packages, please
                   10083:                 send a separate PR for each one, it's easier for us
                   10084:                 to track things that way.</p>
                   10085: 
                   10086:                 <p>Alternatively, you can also import new packages
                   10087:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   10088:                 work-in-progress</span>&#8221;); see the homepage
                   10089:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   10090:                 target=
                   10091:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   10092:                 details.</p>
                   10093:               </li>
                   10094:             </ul>
                   10095:           </div>
                   10096:         </div>
                   10097: 
                   10098:         <div class="sect1" lang="en" xml:lang="en">
                   10099:           <div class="titlepage">
                   10100:             <div>
                   10101:               <div>
                   10102:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  10103:                 "id2574531" id=
        !          10104:                 "id2574531"></a>14.2.&nbsp;Committing: Importing a
1.1       grant    10105:                 package into CVS</h2>
                   10106:               </div>
                   10107:             </div>
                   10108:           </div>
                   10109: 
                   10110:           <p>This section is only of interest for pkgsrc developers
                   10111:           with write access to the pkgsrc repository. Please
                   10112:           remember that cvs imports files relative to the current
                   10113:           working directory, and that the pathname that you give
                   10114:           the <span><b class="command">cvs import</b></span>
                   10115:           command is so that it knows where to place the files in
                   10116:           the repository. Newly created packages should be imported
                   10117:           with a vendor tag of &#8220;<span class=
                   10118:           "quote">TNF</span>&#8221; and a release tag of
                   10119:           &#8220;<span class="quote">pkgsrc-base</span>&#8221;,
                   10120:           e.g:</p>
                   10121:           <pre class="programlisting">
                   10122:   % cd .../pkgsrc/category/pkgname
                   10123:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   10124: </pre>
                   10125: 
                   10126:           <p>Remember to move the directory from which you imported
                   10127:           out of the way, or cvs will complain the next time you
                   10128:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   10129:           source tree. Also don't forget to add the new package to
                   10130:           the category's <tt class="filename">Makefile</tt>.</p>
                   10131: 
                   10132:           <p>The commit message of the initial import should
                   10133:           include part of the <tt class="filename">DESCR</tt> file,
                   10134:           so people reading the mailing lists know what the package
                   10135:           is/does.</p>
                   10136: 
                   10137:           <p>Please note all package updates/additions in
                   10138:           <tt class="filename">pkgsrc/doc/CHANGES</tt>. It's very
                   10139:           important to keep this file up to date and conforming to
                   10140:           the existing format, because it will be used by scripts
                   10141:           to automatically update pages on <a href=
                   10142:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   10143:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   10144:           file and remove the entry for the package you updated, in
                   10145:           case it was mentioned there.</p>
                   10146: 
                   10147:           <p>For new packages, &#8220;<span class="quote">cvs
                   10148:           import</span>&#8221; is preferred to &#8220;<span class=
                   10149:           "quote">cvs add</span>&#8221; because the former gets
                   10150:           everything with a single command, and provides a
                   10151:           consistent tag.</p>
                   10152:         </div>
                   10153: 
                   10154:         <div class="sect1" lang="en" xml:lang="en">
                   10155:           <div class="titlepage">
                   10156:             <div>
                   10157:               <div>
                   10158:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  10159:                 "id2574730" id="id2574730"></a>14.3.&nbsp;Updating
        !          10160:                 a package to a newer version</h2>
1.1       grant    10161:               </div>
                   10162:             </div>
                   10163:           </div>
                   10164: 
                   10165:           <p>Please always put a concise, appropriate and relevant
                   10166:           summary of the changes between old and new versions into
                   10167:           the commit log when updating a package. There are various
                   10168:           reasons for this:</p>
                   10169: 
                   10170:           <div class="itemizedlist">
                   10171:             <ul type="disc">
                   10172:               <li>
                   10173:                 <p>A URL is volatile, and can change over time. It
                   10174:                 may go away completely or its information may be
                   10175:                 overwritten by newer information.</p>
                   10176:               </li>
                   10177: 
                   10178:               <li>
                   10179:                 <p>Having the change information between old and
                   10180:                 new versions in our CVS repository is very useful
                   10181:                 for people who use either cvs or anoncvs.</p>
                   10182:               </li>
                   10183: 
                   10184:               <li>
                   10185:                 <p>Having the change information between old and
                   10186:                 new versions in our CVS repository is very useful
                   10187:                 for people who read the pkgsrc-changes mailing
                   10188:                 list, so that they can make tactical decisions
                   10189:                 about when to upgrade the package.</p>
                   10190:               </li>
                   10191:             </ul>
                   10192:           </div>
                   10193: 
                   10194:           <p>Please also recognise that, just because a new version
                   10195:           of a package has been released, it should not
                   10196:           automatically be upgraded in the CVS repository. We
                   10197:           prefer to be conservative in the packages that are
                   10198:           included in pkgsrc - development or beta packages are not
                   10199:           really the best thing for most places in which pkgsrc is
                   10200:           used. Please use your judgement about what should go into
                   10201:           pkgsrc, and bear in mind that stability is to be
                   10202:           preferred above new and possibly untested features.</p>
                   10203:         </div>
                   10204: 
                   10205:         <div class="sect1" lang="en" xml:lang="en">
                   10206:           <div class="titlepage">
                   10207:             <div>
                   10208:               <div>
                   10209:                 <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  10210:                 "id2574818" id="id2574818"></a>14.4.&nbsp;Moving a
        !          10211:                 package in pkgsrc</h2>
1.1       grant    10212:               </div>
                   10213:             </div>
                   10214:           </div>
                   10215: 
                   10216:           <div class="orderedlist">
                   10217:             <ol type="1">
                   10218:               <li>
                   10219:                 <p>Make a copy of the directory somewhere else.</p>
                   10220:               </li>
                   10221: 
                   10222:               <li>
                   10223:                 <p>Remove all CVS dirs.</p>
                   10224: 
                   10225:                 <p>Alternatively to the first two steps you can
                   10226:                 also do:</p>
                   10227:                 <pre class="screen">
                   10228: <tt class="prompt">%</tt> <b class=
                   10229: "userinput"><tt>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</tt></b>
                   10230: </pre>
                   10231: 
                   10232:                 <p>and use that for further work.</p>
                   10233:               </li>
                   10234: 
                   10235:               <li>
                   10236:                 <p>Fix <tt class="varname">CATEGORIES</tt> and any
                   10237:                 <tt class="varname">DEPENDS</tt> paths that just
                   10238:                 did &#8220;<span class=
                   10239:                 "quote">../package</span>&#8221; instead of
                   10240:                 &#8220;<span class=
                   10241:                 "quote">../../category/package</span>&#8221;.</p>
                   10242:               </li>
                   10243: 
                   10244:               <li>
                   10245:                 <p><span><b class="command">cvs import</b></span>
                   10246:                 the modified package in the new place.</p>
                   10247:               </li>
                   10248: 
                   10249:               <li>
                   10250:                 <p>Check if any package depends on it:</p>
                   10251:                 <pre class="screen">
                   10252: <tt class="prompt">%</tt> <b class=
                   10253: "userinput"><tt>cd /usr/pkgsrc</tt></b>
                   10254: <tt class="prompt">%</tt> <b class=
                   10255: "userinput"><tt>grep /package */*/Makefile* */*/buildlink*</tt></b>
                   10256: </pre>
                   10257:               </li>
                   10258: 
                   10259:               <li>
                   10260:                 <p>Fix paths in packages from step 5 to point to
                   10261:                 new location.</p>
                   10262:               </li>
                   10263: 
                   10264:               <li>
                   10265:                 <p><span><b class="command">cvs rm (-f)</b></span>
                   10266:                 the package at the old location.</p>
                   10267:               </li>
                   10268: 
                   10269:               <li>
                   10270:                 <p>Remove from <tt class=
                   10271:                 "filename">oldcategory/Makefile</tt>.</p>
                   10272:               </li>
                   10273: 
                   10274:               <li>
                   10275:                 <p>Add to <tt class=
                   10276:                 "filename">newcategory/Makefile</tt>.</p>
                   10277:               </li>
                   10278: 
                   10279:               <li>
                   10280:                 <p>Commit the changed and removed files:</p>
                   10281:                 <pre class="screen">
                   10282: <tt class="prompt">%</tt> <b class=
                   10283: "userinput"><tt>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</tt></b>
                   10284: </pre>
                   10285: 
                   10286:                 <p>(and any packages from step 5, of course).</p>
                   10287:               </li>
                   10288:             </ol>
                   10289:           </div>
                   10290:         </div>
                   10291:       </div>
                   10292:     </div>
                   10293: 
                   10294:     <div class="appendix" lang="en" xml:lang="en">
                   10295:       <div class="titlepage">
                   10296:         <div>
                   10297:           <div>
                   10298:             <h2 class="title"><a name="examples" id=
                   10299:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   10300:             package: bison</h2>
                   10301:           </div>
                   10302:         </div>
                   10303:       </div>
                   10304: 
                   10305:       <div class="toc">
                   10306:         <p><b>Table of Contents</b></p>
                   10307: 
                   10308:         <dl>
1.2     ! hubertf  10309:           <dt><span class="sect1"><a href="#id2575044">A.1.
1.1       grant    10310:           files</a></span></dt>
                   10311: 
                   10312:           <dd>
                   10313:             <dl>
1.2     ! hubertf  10314:               <dt><span class="sect2"><a href="#id2575047">A.1.1.
1.1       grant    10315:               Makefile</a></span></dt>
                   10316: 
1.2     ! hubertf  10317:               <dt><span class="sect2"><a href="#id2575054">A.1.2.
1.1       grant    10318:               DESCR</a></span></dt>
                   10319: 
1.2     ! hubertf  10320:               <dt><span class="sect2"><a href="#id2575069">A.1.3.
1.1       grant    10321:               PLIST</a></span></dt>
                   10322: 
1.2     ! hubertf  10323:               <dt><span class="sect2"><a href="#id2575077">A.1.4.
1.1       grant    10324:               Checking a package with pkglint</a></span></dt>
                   10325:             </dl>
                   10326:           </dd>
                   10327: 
1.2     ! hubertf  10328:           <dt><span class="sect1"><a href="#id2575186">A.2. Steps
1.1       grant    10329:           for building, installing, packaging</a></span></dt>
                   10330:         </dl>
                   10331:       </div>
                   10332: 
                   10333:       <p>We checked to find a piece of software that wasn't in the
                   10334:       packages collection, and picked GNU bison. Quite why someone
                   10335:       would want to have <span><b class="command">bison</b></span>
                   10336:       when Berkeley <span><b class="command">yacc</b></span> is
                   10337:       already present in the tree is beyond us, but it's useful for
                   10338:       the purposes of this exercise.</p>
                   10339: 
                   10340:       <div class="sect1" lang="en" xml:lang="en">
                   10341:         <div class="titlepage">
                   10342:           <div>
                   10343:             <div>
                   10344:               <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  10345:               "id2575044" id="id2575044"></a>A.1.&nbsp;files</h2>
1.1       grant    10346:             </div>
                   10347:           </div>
                   10348:         </div>
                   10349: 
                   10350:         <div class="sect2" lang="en" xml:lang="en">
                   10351:           <div class="titlepage">
                   10352:             <div>
                   10353:               <div>
1.2     ! hubertf  10354:                 <h3 class="title"><a name="id2575047" id=
        !          10355:                 "id2575047"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    10356:               </div>
                   10357:             </div>
                   10358:           </div>
                   10359:           <pre class="programlisting">
                   10360: # $NetBSD$
                   10361: #
                   10362: 
                   10363: DISTNAME=       bison-1.25
                   10364: CATEGORIES=     devel
                   10365: MASTER_SITES=   ${MASTER_SITE_GNU}
                   10366: 
                   10367: MAINTAINER=     thorpej@NetBSD.org
                   10368: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   10369: COMMENT=        GNU yacc clone
                   10370: 
                   10371: GNU_CONFIGURE=  yes
                   10372: INFO_FILES=     bison.info
                   10373: 
                   10374: .include "../../mk/bsd.pkg.mk"
                   10375: </pre>
                   10376:         </div>
                   10377: 
                   10378:         <div class="sect2" lang="en" xml:lang="en">
                   10379:           <div class="titlepage">
                   10380:             <div>
                   10381:               <div>
1.2     ! hubertf  10382:                 <h3 class="title"><a name="id2575054" id=
        !          10383:                 "id2575054"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    10384:               </div>
                   10385:             </div>
                   10386:           </div>
                   10387:           <pre class="programlisting">
                   10388: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   10389: improvements.  Why you would want this when Berkeley <a href=
                   10390: "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
                   10391: of the NetBSD source tree is beyond me.
                   10392: </pre>
                   10393:         </div>
                   10394: 
                   10395:         <div class="sect2" lang="en" xml:lang="en">
                   10396:           <div class="titlepage">
                   10397:             <div>
                   10398:               <div>
1.2     ! hubertf  10399:                 <h3 class="title"><a name="id2575069" id=
        !          10400:                 "id2575069"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    10401:               </div>
                   10402:             </div>
                   10403:           </div>
                   10404:           <pre class="programlisting">
                   10405: @comment $NetBSD$
                   10406: bin/bison
                   10407: man/man1/bison.1.gz
                   10408: info/bison.info
                   10409: info/bison.info-1
                   10410: info/bison.info-2
                   10411: info/bison.info-3
                   10412: info/bison.info-4
                   10413: info/bison.info-5
                   10414: share/bison.simple
                   10415: share/bison.hairy
                   10416: </pre>
                   10417:         </div>
                   10418: 
                   10419:         <div class="sect2" lang="en" xml:lang="en">
                   10420:           <div class="titlepage">
                   10421:             <div>
                   10422:               <div>
1.2     ! hubertf  10423:                 <h3 class="title"><a name="id2575077" id=
        !          10424:                 "id2575077"></a>A.1.4.&nbsp;Checking a package with
1.1       grant    10425:                 <span><b class="command">pkglint</b></span></h3>
                   10426:               </div>
                   10427:             </div>
                   10428:           </div>
                   10429: 
                   10430:           <p>The NetBSD package system comes with <a xmlns=
                   10431:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   10432:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.2     ! hubertf  10433:              class="pkgname">pkgtools/pkglint</a> which helps to
        !          10434:              check the contents of these files. After installation
        !          10435:              it is quite easy to use, just change to the directory
        !          10436:              of the package you wish to examine and execute
        !          10437:              <span><b class="command">pkglint</b></span>:</p>
1.1       grant    10438:           <pre class="screen">
                   10439: <tt class="prompt">$</tt> <b class="userinput"><tt>pkglint</tt></b>
                   10440: OK: checking ./DESCR.
                   10441: OK: checking Makefile.
                   10442: OK: checking distinfo.
                   10443: OK: checking patches/patch-aa.
                   10444: looks fine.
                   10445: </pre>
                   10446: 
                   10447:           <p>Depending on the supplied command line arguments (see
                   10448:           pkglint(1)) more verbose checks will be performed. Use
                   10449:           e.g. <span><b class="command">pkglint -v</b></span> for a
                   10450:           very verbose check.</p>
                   10451:         </div>
                   10452:       </div>
                   10453: 
                   10454:       <div class="sect1" lang="en" xml:lang="en">
                   10455:         <div class="titlepage">
                   10456:           <div>
                   10457:             <div>
                   10458:               <h2 class="title" style="clear: both"><a name=
1.2     ! hubertf  10459:               "id2575186" id="id2575186"></a>A.2.&nbsp;Steps for
1.1       grant    10460:               building, installing, packaging</h2>
                   10461:             </div>
                   10462:           </div>
                   10463:         </div>
                   10464: 
                   10465:         <p>Create the directory where the package lives, plus any
                   10466:         auxiliary directories:</p>
                   10467:         <pre class="screen">
                   10468: <tt class="prompt">#</tt> <b class=
                   10469: "userinput"><tt>cd /usr/pkgsrc/lang</tt></b>
                   10470: <tt class="prompt">#</tt> <b class=
                   10471: "userinput"><tt>mkdir bison</tt></b>
                   10472: <tt class="prompt">#</tt> <b class=
                   10473: "userinput"><tt>cd bison</tt></b>
                   10474: <tt class="prompt">#</tt> <b class=
                   10475: "userinput"><tt>mkdir patches</tt></b>
                   10476: </pre>
                   10477: 
                   10478:         <p>Create <tt class="filename">Makefile</tt>, <tt class=
                   10479:         "filename">DESCR</tt> and <tt class="filename">PLIST</tt>
                   10480:         (see <a href="#components" title=
                   10481:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   10482:         Chapter 7, <i>Package components - files, directories and
                   10483:         contents</i></a>) then continue with fetching the
                   10484:         distfile:</p>
                   10485:         <pre class="screen">
                   10486: <tt class="prompt">#</tt> <b class=
                   10487: "userinput"><tt>make fetch</tt></b>
                   10488: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   10489: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   10490: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10491: ftp: Error retrieving file: 500 Internal error
                   10492: 
                   10493: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   10494: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10495: ftp: Error retrieving file: 500 Internal error
                   10496: 
                   10497: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   10498: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10499: Successfully retrieved file.
                   10500: </pre>
                   10501: 
                   10502:         <p>Generate the checksum of the distfile into <tt class=
                   10503:         "filename">distinfo</tt>:</p>
                   10504:         <pre class="screen">
                   10505: <tt class="prompt">#</tt> <b class=
                   10506: "userinput"><tt>make makesum</tt></b>
                   10507: </pre>
                   10508: 
                   10509:         <p>Now compile:</p>
                   10510:         <pre class="screen">
                   10511: <tt class="prompt">#</tt> <b class="userinput"><tt>make</tt></b>
                   10512: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10513: ===&gt;  Extracting for bison-1.25
                   10514: ===&gt;  Patching for bison-1.25
                   10515: ===&gt;   Ignoring empty patch directory
                   10516: ===&gt;  Configuring for bison-1.25
                   10517: creating cache ./config.cache
                   10518: checking for gcc... cc
                   10519: checking whether we are using GNU C... yes
                   10520: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   10521: checking how to run the C preprocessor... cc -E
                   10522: checking for minix/config.h... no
                   10523: checking for POSIXized ISC... no
                   10524: checking whether cross-compiling... no
                   10525: checking for ANSI C header files... yes
                   10526: checking for string.h... yes
                   10527: checking for stdlib.h... yes
                   10528: checking for memory.h... yes
                   10529: checking for working const... yes
                   10530: checking for working alloca.h... no
                   10531: checking for alloca... yes
                   10532: checking for strerror... yes
                   10533: updating cache ./config.cache
                   10534: creating ./config.status
                   10535: creating Makefile
                   10536: ===&gt;  Building for bison-1.25
                   10537: 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
                   10538: 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
                   10539: 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
                   10540: 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
                   10541: 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
                   10542: 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 
                   10543: 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
                   10544: 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
                   10545: 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
                   10546: 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
                   10547: 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
                   10548: 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
                   10549: 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
                   10550: 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
                   10551: 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
                   10552: 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
                   10553: 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
                   10554: 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
                   10555: 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
                   10556: 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
                   10557: 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
                   10558: 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
                   10559: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   10560: rm -f bison.s1
                   10561: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   10562: </pre>
                   10563: 
                   10564:         <p>Everything seems OK, so install the files:</p>
                   10565:         <pre class="screen">
                   10566: <tt class="prompt">#</tt> <b class=
                   10567: "userinput"><tt>make install</tt></b>
                   10568: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10569: ===&gt;  Installing for bison-1.25
                   10570: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   10571: rm -f /usr/pkg/bin/bison
                   10572: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   10573: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   10574: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   10575: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   10576: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   10577: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   10578: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   10579: ===&gt;  Registering installation for bison-1.25
                   10580: </pre>
                   10581: 
                   10582:         <p>You can now use bison, and also - if you decide so -
                   10583:         remove it with <span><b class="command">pkg_delete
                   10584:         bison</b></span>. Should you decide that you want a binary
                   10585:         package, do this now:</p>
                   10586:         <pre class="screen">
                   10587: <tt class="prompt">#</tt> <b class=
                   10588: "userinput"><tt>make package</tt></b>
                   10589: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10590: ===&gt;  Building package for bison-1.25
                   10591: Creating package bison-1.25.tgz
                   10592: Registering depends:.
                   10593: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   10594: </pre>
                   10595: 
                   10596:         <p>Now that you don't need the source and object files any
                   10597:         more, clean up:</p>
                   10598:         <pre class="screen">
                   10599: <tt class="prompt">#</tt> <b class=
                   10600: "userinput"><tt>make clean</tt></b>
                   10601: ===&gt;  Cleaning for bison-1.25
                   10602: </pre>
                   10603:       </div>
                   10604:     </div>
                   10605: 
                   10606:     <div class="appendix" lang="en" xml:lang="en">
                   10607:       <div class="titlepage">
                   10608:         <div>
                   10609:           <div>
                   10610:             <h2 class="title"><a name="logs" id=
                   10611:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   10612:           </div>
                   10613:         </div>
                   10614:       </div>
                   10615: 
                   10616:       <div class="toc">
                   10617:         <p><b>Table of Contents</b></p>
                   10618: 
                   10619:         <dl>
                   10620:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   10621:           Building figlet</a></span></dt>
                   10622: 
                   10623:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   10624:           Packaging figlet</a></span></dt>
                   10625:         </dl>
                   10626:       </div>
                   10627: 
                   10628:       <div class="sect1" lang="en" xml:lang="en">
                   10629:         <div class="titlepage">
                   10630:           <div>
                   10631:             <div>
                   10632:               <h2 class="title" style="clear: both"><a name=
                   10633:               "logs.building" id=
                   10634:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   10635:             </div>
                   10636:           </div>
                   10637:         </div>
                   10638:         <pre class="screen">
                   10639: <tt class="prompt">#</tt> <b class="userinput"><tt>make</tt></b>
                   10640: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10641: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   10642: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   10643: =&gt; [172219 bytes]
                   10644: Connected to ftp.plig.net.
                   10645: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   10646: 331 Guest login ok, send your complete e-mail address as password.
                   10647: 230-You are user #5 of 500 simultaneous users allowed.
                   10648: 230-
                   10649: 230-  ___ _             _ _                   
                   10650: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   10651: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   10652: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   10653: 230-         |_|   |_|     |___|         |___|
                   10654: 230-
                   10655: 230-** Welcome to ftp.plig.org **
                   10656: 230-
                   10657: 230-Please note that all transfers from this FTP site are logged. If you
                   10658: 230-do not like this, please disconnect now.
                   10659: 230-
                   10660: 230-This arhive is available via
                   10661: 230-
                   10662: 230-HTTP:  http://ftp.plig.org/
                   10663: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   10664: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   10665: 230-
                   10666: 230-Please email comments, bug reports and requests for packages to be
                   10667: 230-mirrored to ftp-admin@plig.org.   
                   10668: 230-
                   10669: 230-
                   10670: 230 Logged in anonymously.
                   10671: Remote system type is UNIX.
                   10672: Using binary mode to transfer files.
                   10673: 200 Type okay.
                   10674: 250 "/pub" is new cwd.
                   10675: 250-"/pub/figlet" is new cwd.
                   10676: 250-
                   10677: 250-Welcome to the figlet archive at ftp.figlet.org
                   10678: 250-    
                   10679: 250-    ftp://ftp.figlet.org/pub/figlet/
                   10680: 250-
                   10681: 250-The official FIGlet web page is:
                   10682: 250-    http://www.figlet.org/
                   10683: 250-
                   10684: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   10685: 250-contribute a font or something else, you can email us.
                   10686: 250 
                   10687: 250 "/pub/figlet/program" is new cwd.
                   10688: 250 "/pub/figlet/program/unix" is new cwd.
                   10689: local: figlet221.tar.gz remote: figlet221.tar.gz
                   10690: 502 Unimplemented command.
                   10691: 227 Entering Passive Mode (195,40,6,41,246,104)
                   10692: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   10693: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   10694: 226 Transfer completed.
                   10695: 172219 bytes received in 00:02 (75.99 KB/s)
                   10696: 221 Goodbye.
                   10697: =&gt; Checksum OK for figlet221.tar.gz.
                   10698: ===&gt; Extracting for figlet-2.2.1nb2
                   10699: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   10700: ===&gt; Patching for figlet-2.2.1nb2
                   10701: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   10702: ===&gt; Overriding tools for figlet-2.2.1nb2
                   10703: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   10704: ===&gt; Configuring for figlet-2.2.1nb2
                   10705: ===&gt; Building for figlet-2.2.1nb2
                   10706: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   10707: chmod a+x figlet
                   10708: gcc -O2 -o chkfont chkfont.c
                   10709: =&gt; Unwrapping files-to-be-installed.
                   10710: <tt class="prompt">#</tt>
                   10711: <tt class="prompt">#</tt> <b class=
                   10712: "userinput"><tt>make install</tt></b>
                   10713: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10714: ===&gt; Installing for figlet-2.2.1nb2
                   10715: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   10716: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   10717: mkdir -p /usr/pkg/share/figlet
                   10718: cp figlet /usr/pkg/bin
                   10719: cp chkfont /usr/pkg/bin
                   10720: chmod 555 figlist showfigfonts
                   10721: cp figlist /usr/pkg/bin
                   10722: cp showfigfonts /usr/pkg/bin
                   10723: cp fonts/*.flf /usr/pkg/share/figlet
                   10724: cp fonts/*.flc /usr/pkg/share/figlet
                   10725: cp figlet.6 /usr/pkg/man/man6
                   10726: ===&gt; Registering installation for figlet-2.2.1nb2
                   10727: <tt class="prompt">#</tt>
                   10728: </pre>
                   10729:       </div>
                   10730: 
                   10731:       <div class="sect1" lang="en" xml:lang="en">
                   10732:         <div class="titlepage">
                   10733:           <div>
                   10734:             <div>
                   10735:               <h2 class="title" style="clear: both"><a name=
                   10736:               "logs.package" id=
                   10737:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   10738:             </div>
                   10739:           </div>
                   10740:         </div>
                   10741:         <pre class="screen">
                   10742: <tt class="prompt">#</tt> <b class=
                   10743: "userinput"><tt>make package</tt></b>
                   10744: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   10745: ===&gt; Packaging figlet-2.2.1nb2
                   10746: ===&gt; Building binary package for figlet-2.2.1nb2
                   10747: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   10748: Using SrcDir value of /usr/pkg
                   10749: Registering depends:.  
                   10750: <tt class="prompt">#</tt>
                   10751: </pre>
                   10752:       </div>
                   10753:     </div>
                   10754: 
                   10755:     <div class="appendix" lang="en" xml:lang="en">
                   10756:       <div class="titlepage">
                   10757:         <div>
                   10758:           <div>
                   10759:             <h2 class="title"><a name="ftp-layout" id=
                   10760:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   10761:             FTP server's package archive</h2>
                   10762:           </div>
                   10763:         </div>
                   10764:       </div>
                   10765: 
                   10766:       <p>Layout for precompiled binary packages on
                   10767:       ftp.NetBSD.org:</p>
                   10768:       <pre class="programlisting">
                   10769: /pub/NetBSD/packages/
                   10770:                 distfiles/
                   10771: 
                   10772:                 # Unpacked pkgsrc trees
                   10773:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   10774:                 pkgsrc-2003Q4 -&gt; N/A
                   10775:                 pkgsrc-2004Q1/pkgsrc
                   10776: 
                   10777:                 # pkgsrc archives
                   10778:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   10779:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   10780:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   10781: 
                   10782:                 # Per pkgsrc-release/OS-release/arch package archives
                   10783:                 pkgsrc-2003Q4/
                   10784:                         NetBSD-1.6.2/
                   10785:                                 i386/
                   10786:                                         All/
                   10787:                                         archivers/
                   10788:                                                 foo -&gt; ../All/foo
                   10789:                                         ...
                   10790:                 pkgsrc-2004Q1/
                   10791:                         NetBSD-1.6.2/
                   10792:                                 i386/
                   10793:                                         All/
                   10794:                                         ...
                   10795:                         NetBSD-2.0/
                   10796:                                 i386/
                   10797:                                         All/
                   10798:                                         ...
                   10799:                         SunOS-5.9/
                   10800:                                 sparc/
                   10801:                                         All/
                   10802:                                         ...
                   10803:                                 x86/
                   10804:                                         All/
                   10805:                                         ...
                   10806: 
                   10807:                 # Per os-release package archive convenience links
                   10808:                 NetBSD-1.6.2 -&gt; 1.6.2
                   10809:                 1.6.2/
                   10810:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   10811:                         m68k/
                   10812:                                 All/
                   10813:                                 archivers/
                   10814:                                         foo -&gt; ../All/foo
                   10815:                                 ...
                   10816:                         amiga -&gt; m68k
                   10817:                         atari -&gt; m68k
                   10818:                         ...
                   10819: 
                   10820:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   10821:                 NetBSD-2.0/
                   10822:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   10823:                 SunOS-5.9/
                   10824:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   10825:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   10826:                         
                   10827: </pre>
                   10828: 
                   10829:       <p>To create:</p>
                   10830: 
                   10831:       <div class="orderedlist">
                   10832:         <ol type="1">
                   10833:           <li>
                   10834:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   10835:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   10836:             5.3, &#8220;Doing a bulk build of all
                   10837:             packages&#8221;</a></p>
                   10838:           </li>
                   10839: 
                   10840:           <li>
                   10841:             <p>Upload /usr/pkgsrc/packages to</p>
                   10842:             <pre class="programlisting">
                   10843:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
                   10844:         pkgsrc-2004Q3/\                         # pkgsrc-branch
                   10845:         `uname -s`-`uname -r`/                  # OS &amp; version
                   10846:         `uname -p`                              # architecture
                   10847:        
                   10848: </pre>
                   10849:           </li>
                   10850: 
                   10851:           <li>
                   10852:             <p>If necessary, create a symlink <span><b class=
                   10853:             "command">ln -s `uname -m` `uname -p`</b></span> (amiga
                   10854:             -&gt; m68k, ...)</p>
                   10855:           </li>
                   10856:         </ol>
                   10857:       </div>
                   10858:     </div>
1.2     ! hubertf  10859: 
        !          10860:     <div class="appendix" lang="en" xml:lang="en">
        !          10861:       <div class="titlepage">
        !          10862:         <div>
        !          10863:           <div>
        !          10864:             <h2 class="title"><a name="editing" id=
        !          10865:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
        !          10866:             for the pkgsrc guide</h2>
        !          10867:           </div>
        !          10868:         </div>
        !          10869:       </div>
        !          10870: 
        !          10871:       <div class="toc">
        !          10872:         <p><b>Table of Contents</b></p>
        !          10873: 
        !          10874:         <dl>
        !          10875:           <dt><span class="sect1"><a href="#id2575900">D.1.
        !          10876:           Targets</a></span></dt>
        !          10877: 
        !          10878:           <dt><span class="sect1"><a href="#id2575949">D.2.
        !          10879:           Procedure</a></span></dt>
        !          10880:         </dl>
        !          10881:       </div>
        !          10882: 
        !          10883:       <p>This section contains information on editing the pkgsrc
        !          10884:       guide itself.</p>
        !          10885: 
        !          10886:       <div class="sect1" lang="en" xml:lang="en">
        !          10887:         <div class="titlepage">
        !          10888:           <div>
        !          10889:             <div>
        !          10890:               <h2 class="title" style="clear: both"><a name=
        !          10891:               "id2575900" id="id2575900"></a>D.1.&nbsp;Targets</h2>
        !          10892:             </div>
        !          10893:           </div>
        !          10894:         </div>
        !          10895: 
        !          10896:         <p>The pkgsrc guide's source code is stored in <tt class=
        !          10897:         "filename">pkgsrc/doc/guide/files</tt>, and several files
        !          10898:         are created from it:</p>
        !          10899: 
        !          10900:         <div class="itemizedlist">
        !          10901:           <ul type="disc">
        !          10902:             <li>
        !          10903:               <p><tt class="filename">pkgsrc/doc/pkgsrc.txt</tt>,
        !          10904:               which replaces <tt class=
        !          10905:               "filename">pkgsrc/Packages.txt</tt></p>
        !          10906:             </li>
        !          10907: 
        !          10908:             <li>
        !          10909:               <p><tt class=
        !          10910:               "filename">pkgsrc/doc/pkgsrc.html</tt></p>
        !          10911:             </li>
        !          10912: 
        !          10913:             <li>
        !          10914:               <p><tt class=
        !          10915:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</tt>:
        !          10916:               the documentation on the NetBSD website will be built
        !          10917:               from pkgsrc and kept up to date on the web server
        !          10918:               itself. This means you <span class=
        !          10919:               "emphasis"><em>must</em></span> make sure that your
        !          10920:               changes haven't broken the build!</p>
        !          10921:             </li>
        !          10922:           </ul>
        !          10923:         </div>
        !          10924:       </div>
        !          10925: 
        !          10926:       <div class="sect1" lang="en" xml:lang="en">
        !          10927:         <div class="titlepage">
        !          10928:           <div>
        !          10929:             <div>
        !          10930:               <h2 class="title" style="clear: both"><a name=
        !          10931:               "id2575949" id=
        !          10932:               "id2575949"></a>D.2.&nbsp;Procedure</h2>
        !          10933:             </div>
        !          10934:           </div>
        !          10935:         </div>
        !          10936: 
        !          10937:         <p>The procedure to edit the pkgsrc guide is:</p>
        !          10938: 
        !          10939:         <div class="itemizedlist">
        !          10940:           <ul type="disc">
        !          10941:             <li>
        !          10942:               <p>Edit the XML file(s) in <tt class=
        !          10943:               "filename">pkgsrc/doc/guide/files</tt></p>
        !          10944:             </li>
        !          10945: 
        !          10946:             <li>
        !          10947:               <p>Run <span><b class="command">make</b></span> in
        !          10948:               <tt class="filename">pkgsrc/doc/guide</tt> to build
        !          10949:               the HTML and ASCII version</p>
        !          10950:             </li>
        !          10951: 
        !          10952:             <li>
        !          10953:               <p>Run <span><b class="command">make
        !          10954:               OUTPUT=pdf</b></span> in <tt class=
        !          10955:               "filename">pkgsrc/doc/guide</tt> to build the PDF
        !          10956:               version. Dont' omit this, as this does a very strict
        !          10957:               SGML test, and doing this properly is important for
        !          10958:               getting proper documentation on the web server!</p>
        !          10959:             </li>
        !          10960: 
        !          10961:             <li>
        !          10962:               <p>If all is well, run <span><b class="command">make
        !          10963:               install-doc</b></span> to put the generated files
        !          10964:               into <tt class="filename">pkgserc/doc</tt>.</p>
        !          10965:             </li>
        !          10966: 
        !          10967:             <li>
        !          10968:               <p><span><b class="command">cvs commit
        !          10969:               pkgsrc/doc/guide/files</b></span></p>
        !          10970:             </li>
        !          10971: 
        !          10972:             <li>
        !          10973:               <p><span><b class="command">cvs commit
        !          10974:               pkgsrc/doc/pkgsrc.{html,txt}</b></span></p>
        !          10975:             </li>
        !          10976:           </ul>
        !          10977:         </div>
        !          10978:       </div>
        !          10979:     </div>
1.1       grant    10980:   </div>
                   10981: </body>
                   10982: </html>

CVSweb <webmaster@jp.NetBSD.org>