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

1.1       grant       1: <html xmlns="http://www.w3.org/1999/xhtml">
                      2: <head>
                      3:   <meta name="generator" content=
1.14      xtraeme     4:   "HTML Tidy for NetBSD (vers 1st August 2004), see www.w3.org" />
1.1       grant       5:   <meta http-equiv="Content-Type" content=
                      6:   "text/html; charset=us-ascii" />
                      7: 
                      8:   <title>The pkgsrc guide</title>
                      9:   <link rel="stylesheet" href="/NetBSD.css" type="text/css" />
                     10:   <meta name="generator" content=
1.18    ! xtraeme    11:   "DocBook XSL Stylesheets V1.68.1" />
1.1       grant      12:   <meta name="description" content=
                     13:   "Information about using the NetBSD package system (pkgsrc) from both a user view for installing packages as well as from a pkgsrc developers' view for creating new packages." />
                     14:   </head>
                     15: 
                     16: <body bgcolor="white" text="black" link="#0000FF" vlink="#840084"
                     17: alink="#0000FF">
                     18:   <div class="book" lang="en" xml:lang="en">
                     19:     <div class="titlepage">
                     20:       <div>
                     21:         <div>
1.18    ! xtraeme    22:           <h1 class="title"><a name="id2551534" id=
        !            23:           "id2551534"></a>The pkgsrc guide</h1>
1.1       grant      24:         </div>
                     25: 
                     26:         <div>
1.2       hubertf    27:           <h2 class="subtitle">Documentation on the NetBSD packages
1.1       grant      28:           system</h2>
                     29:         </div>
                     30: 
                     31:         <div>
                     32:           <div class="authorgroup">
                     33:             <div class="author">
                     34:               <h3 class="author"><span class=
                     35:               "firstname">Alistair</span> <span class=
                     36:               "surname">Crooks</span></h3>
                     37: 
                     38:               <div class="affiliation">
                     39:                 <div class="address">
1.14      xtraeme    40:                   <p><code class="email">&lt;<a href=
                     41:                   "mailto:agc@NetBSD.org">agc@NetBSD.org</a>&gt;</code></p>
1.1       grant      42:                 </div>
                     43:               </div>
                     44:             </div>
                     45: 
                     46:             <div class="author">
                     47:               <h3 class="author"><span class=
                     48:               "firstname">Hubert</span> <span class=
                     49:               "surname">Feyrer</span></h3>
                     50: 
                     51:               <div class="affiliation">
                     52:                 <div class="address">
1.14      xtraeme    53:                   <p><code class="email">&lt;<a href=
                     54:                   "mailto:hubertf@NetBSD.org">hubertf@NetBSD.org</a>&gt;</code></p>
1.1       grant      55:                 </div>
                     56:               </div>
                     57:             </div>
1.2       hubertf    58: 
1.3       hubertf    59:             <h3 class="corpauthor">The pkgsrc Developers</h3>
1.1       grant      60:           </div>
                     61:         </div>
                     62: 
                     63:         <div>
                     64:           <p class="copyright">Copyright &#169; 1994-2004 The
                     65:           NetBSD Foundation, Inc</p>
                     66:         </div>
                     67: 
                     68:         <div>
1.3       hubertf    69:           <p class="pubdate">$NetBSD: pkgsrc.xml,v 1.3 2004/10/22
                     70:           00:24:48 hubertf Exp $</p>
1.1       grant      71:         </div>
                     72: 
                     73:         <div>
                     74:           <div class="abstract">
                     75:             <p class="title"><b>Abstract</b></p>
                     76: 
                     77:             <p>Information about using the NetBSD package system
                     78:             (pkgsrc) from both a user view for installing packages
                     79:             as well as from a pkgsrc developers' view for creating
                     80:             new packages.</p>
                     81:           </div>
                     82:         </div>
                     83:       </div>
                     84:       <hr />
                     85:     </div>
                     86: 
                     87:     <div class="toc">
                     88:       <p><b>Table of Contents</b></p>
                     89: 
                     90:       <dl>
                     91:         <dt><span class="chapter"><a href="#introduction">1.
                     92:         Introduction</a></span></dt>
                     93: 
                     94:         <dd>
                     95:           <dl>
1.18    ! xtraeme    96:             <dt><span class="sect1"><a href="#id2517094">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.18    ! xtraeme   120:                 <dt><span class="sect1"><a href="#id2517748">2.1.
1.1       grant     121:                 As tar file</a></span></dt>
                    122: 
1.18    ! xtraeme   123:                 <dt><span class="sect1"><a href="#id2517764">2.2.
1.1       grant     124:                 Via SUP</a></span></dt>
                    125: 
1.18    ! xtraeme   126:                 <dt><span class="sect1"><a href="#id2517796">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.18    ! xtraeme   136:                 <dt><span class="sect1"><a href="#id2517906">3.1.
1.1       grant     137:                 Bootstrapping pkgsrc</a></span></dt>
                    138: 
1.18    ! xtraeme   139:                 <dt><span class="sect1"><a href="#id2518155">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.18    ! xtraeme   145:                     "#id2518162">3.2.1. Darwin (Mac OS
1.1       grant     146:                     X)</a></span></dt>
                    147: 
                    148:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   149:                     "#id2518324">3.2.2. FreeBSD</a></span></dt>
1.1       grant     150: 
                    151:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   152:                     "#id2518494">3.2.3. Interix</a></span></dt>
1.1       grant     153: 
                    154:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   155:                     "#id2519063">3.2.4. IRIX</a></span></dt>
1.1       grant     156: 
                    157:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   158:                     "#id2519180">3.2.5. OpenBSD</a></span></dt>
1.1       grant     159: 
                    160:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   161:                     "#id2519292">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.18    ! xtraeme   179:                     "#id2519429">4.1.1. Where to get binary
1.1       grant     180:                     packages</a></span></dt>
                    181: 
                    182:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   183:                     "#id2519469">4.1.2. How to use binary
1.1       grant     184:                     packages</a></span></dt>
                    185: 
                    186:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   187:                     "#id2519604">4.1.3. A word of
1.1       grant     188:                     warning</a></span></dt>
                    189:                   </dl>
                    190:                 </dd>
                    191: 
1.18    ! xtraeme   192:                 <dt><span class="sect1"><a href="#id2519616">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.18    ! xtraeme   198:                     "#id2519625">4.2.1.
1.1       grant     199:                     Requirements</a></span></dt>
                    200: 
                    201:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   202:                     "#id2519645">4.2.2. Fetching
1.1       grant     203:                     distfiles</a></span></dt>
                    204: 
                    205:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   206:                     "#id2519698">4.2.3. How to build and
1.1       grant     207:                     install</a></span></dt>
                    208: 
                    209:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   210:                     "#id2520014">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.18    ! xtraeme   222:                 <dt><span class="sect1"><a href="#id2520101">5.1.
1.1       grant     223:                 Building a single binary package</a></span></dt>
                    224: 
1.18    ! xtraeme   225:                 <dt><span class="sect1"><a href="#id2520247">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.18    ! xtraeme   239:                     "#id2520865">5.3.2. Other environmental
1.1       grant     240:                     considerations</a></span></dt>
                    241: 
                    242:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   243:                     "#id2585963">5.3.3. Operation</a></span></dt>
1.1       grant     244: 
                    245:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   246:                     "#id2586101">5.3.4. What it
1.1       grant     247:                     does</a></span></dt>
                    248: 
                    249:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   250:                     "#id2586157">5.3.5. Disk space
1.1       grant     251:                     requirements</a></span></dt>
                    252: 
                    253:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   254:                     "#id2586184">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.18    ! xtraeme   258:                     "#id2586645">5.3.7. Building a partial set of
1.1       grant     259:                     packages</a></span></dt>
1.13      hubertf   260: 
                    261:                     <dt><span class="sect2"><a href=
                    262:                     "#bulk-upload">5.3.8. Uploading results of a
                    263:                     bulk build</a></span></dt>
1.1       grant     264:                   </dl>
                    265:                 </dd>
                    266: 
1.18    ! xtraeme   267:                 <dt><span class="sect1"><a href="#id2587082">5.4.
1.1       grant     268:                 Creating a multiple CD-ROM packages
                    269:                 collection</a></span></dt>
                    270: 
                    271:                 <dd>
                    272:                   <dl>
                    273:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   274:                     "#id2587097">5.4.1. Example of
1.1       grant     275:                     cdpack</a></span></dt>
                    276:                   </dl>
                    277:                 </dd>
                    278:               </dl>
                    279:             </dd>
                    280: 
                    281:             <dt><span class="chapter"><a href="#faq">6. Frequently
                    282:             Asked Questions</a></span></dt>
                    283: 
                    284:             <dd>
                    285:               <dl>
1.18    ! xtraeme   286:                 <dt><span class="sect1"><a href="#id2587289">6.1.
        !           287:                 Are there any mailing lists for pkg-related
1.1       grant     288:                 discussion?</a></span></dt>
                    289: 
1.18    ! xtraeme   290:                 <dt><span class="sect1"><a href="#id2587492">6.2.
1.1       grant     291:                 Where's the pkgviews documentation?</a></span></dt>
                    292: 
1.5       hubertf   293:                 <dt><span class="sect1"><a href=
                    294:                 "#faq-pkgtools">6.3. Utilities for package
                    295:                 management (pkgtools)</a></span></dt>
1.1       grant     296: 
1.18    ! xtraeme   297:                 <dt><span class="sect1"><a href="#id2587676">6.4.
1.1       grant     298:                 How to use pkgsrc as non-root</a></span></dt>
                    299: 
1.18    ! xtraeme   300:                 <dt><span class="sect1"><a href="#id2587688">6.5.
1.15      xtraeme   301:                 How to resume transfers when fetching
                    302:                 distfiles?</a></span></dt>
1.14      xtraeme   303: 
1.18    ! xtraeme   304:                 <dt><span class="sect1"><a href="#id2587731">6.6.
1.1       grant     305:                 How can I install/use XFree86 from
                    306:                 pkgsrc?</a></span></dt>
                    307: 
1.18    ! xtraeme   308:                 <dt><span class="sect1"><a href="#id2587758">6.7.
1.1       grant     309:                 How can I install/use X.org from
                    310:                 pkgsrc?</a></span></dt>
                    311: 
1.18    ! xtraeme   312:                 <dt><span class="sect1"><a href="#id2587786">6.8.
1.1       grant     313:                 How to fetch files from behind a
                    314:                 firewall</a></span></dt>
                    315: 
1.18    ! xtraeme   316:                 <dt><span class="sect1"><a href="#id2587800">6.9.
1.14      xtraeme   317:                 How do I tell <span><strong class="command">make
                    318:                 fetch</strong></span> to do passive
1.1       grant     319:                 FTP?</a></span></dt>
                    320: 
1.18    ! xtraeme   321:                 <dt><span class="sect1"><a href="#id2587851">6.10.
1.1       grant     322:                 How to fetch all distfiles at once</a></span></dt>
                    323: 
1.18    ! xtraeme   324:                 <dt><span class="sect1"><a href="#id2588059">6.11.
1.14      xtraeme   325:                 What does &#8220;<span class="quote">Don't know how
                    326:                 to make /usr/share/tmac/tmac.andoc</span>&#8221;
                    327:                 mean?</a></span></dt>
1.13      hubertf   328: 
1.18    ! xtraeme   329:                 <dt><span class="sect1"><a href="#id2588098">6.12.
1.14      xtraeme   330:                 What does &#8220;<span class="quote">Could not find
                    331:                 bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant     332: 
1.18    ! xtraeme   333:                 <dt><span class="sect1"><a href="#id2588224">6.13.
1.1       grant     334:                 Using 'sudo' with pkgsrc</a></span></dt>
                    335: 
1.14      xtraeme   336:                 <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant     337:                 Configuration files handling and
                    338:                 placement</a></span></dt>
                    339: 
                    340:                 <dt><span class="sect1"><a href=
1.14      xtraeme   341:                 "#audit-packages">6.15. Automated security
1.1       grant     342:                 checks</a></span></dt>
                    343:               </dl>
                    344:             </dd>
                    345:           </dl>
                    346:         </dd>
                    347: 
1.2       hubertf   348:         <dt><span class="part"><a href="#developers-guide">II. The
1.1       grant     349:         pkgsrc developer's guide</a></span></dt>
                    350: 
                    351:         <dd>
                    352:           <dl>
                    353:             <dt><span class="chapter"><a href="#components">7.
                    354:             Package components - files, directories and
                    355:             contents</a></span></dt>
                    356: 
                    357:             <dd>
                    358:               <dl>
                    359:                 <dt><span class="sect1"><a href=
1.14      xtraeme   360:                 "#components.Makefile">7.1. <code class=
                    361:                 "filename">Makefile</code></a></span></dt>
1.1       grant     362: 
                    363:                 <dt><span class="sect1"><a href=
1.14      xtraeme   364:                 "#components.distinfo">7.2. <code class=
                    365:                 "filename">distinfo</code></a></span></dt>
1.1       grant     366: 
                    367:                 <dt><span class="sect1"><a href=
                    368:                 "#components.patches">7.3.
                    369:                 patches/*</a></span></dt>
                    370: 
1.18    ! xtraeme   371:                 <dt><span class="sect1"><a href="#id2589337">7.4.
1.1       grant     372:                 Other mandatory files</a></span></dt>
                    373: 
                    374:                 <dt><span class="sect1"><a href=
                    375:                 "#components.optional">7.5. Optional
                    376:                 files</a></span></dt>
                    377: 
1.18    ! xtraeme   378:                 <dt><span class="sect1"><a href="#id2589463">7.6.
1.14      xtraeme   379:                 <code class="filename">work*</code></a></span></dt>
1.1       grant     380: 
1.18    ! xtraeme   381:                 <dt><span class="sect1"><a href="#id2589619">7.7.
1.14      xtraeme   382:                 <code class=
                    383:                 "filename">files/*</code></a></span></dt>
1.1       grant     384:               </dl>
                    385:             </dd>
                    386: 
                    387:             <dt><span class="chapter"><a href="#plist">8. PLIST
                    388:             issues</a></span></dt>
                    389: 
                    390:             <dd>
                    391:               <dl>
1.18    ! xtraeme   392:                 <dt><span class="sect1"><a href="#id2589673">8.1.
1.1       grant     393:                 RCS ID</a></span></dt>
                    394: 
1.18    ! xtraeme   395:                 <dt><span class="sect1"><a href="#id2589688">8.2.
1.14      xtraeme   396:                 Semi-automatic <code class="filename">PLIST</code>
                    397:                 generation</a></span></dt>
1.1       grant     398: 
                    399:                 <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme   400:                 Tweaking output of <span><strong class=
                    401:                 "command">make
                    402:                 print-PLIST</strong></span></a></span></dt>
1.1       grant     403: 
                    404:                 <dt><span class="sect1"><a href="#plist.misc">8.4.
                    405:                 Variable substitution in PLIST</a></span></dt>
                    406: 
1.18    ! xtraeme   407:                 <dt><span class="sect1"><a href="#id2590077">8.5.
1.1       grant     408:                 Manpage-compression</a></span></dt>
                    409: 
1.18    ! xtraeme   410:                 <dt><span class="sect1"><a href="#id2590119">8.6.
1.14      xtraeme   411:                 Changing PLIST source with <code class=
                    412:                 "varname">PLIST_SRC</code></a></span></dt>
1.1       grant     413: 
1.18    ! xtraeme   414:                 <dt><span class="sect1"><a href="#id2590136">8.7.
1.1       grant     415:                 Platform specific and differing
                    416:                 PLISTs</a></span></dt>
                    417: 
                    418:                 <dt><span class="sect1"><a href=
                    419:                 "#faq.common-dirs">8.8. Sharing directories between
                    420:                 packages</a></span></dt>
                    421:               </dl>
                    422:             </dd>
                    423: 
                    424:             <dt><span class="chapter"><a href="#buildlink">9.
                    425:             Buildlink methodology</a></span></dt>
                    426: 
                    427:             <dd>
                    428:               <dl>
1.18    ! xtraeme   429:                 <dt><span class="sect1"><a href="#id2590476">9.1.
1.1       grant     430:                 Converting packages to use
                    431:                 buildlink3</a></span></dt>
                    432: 
1.18    ! xtraeme   433:                 <dt><span class="sect1"><a href="#id2590667">9.2.
1.14      xtraeme   434:                 Writing <code class="filename">buildlink3.mk</code>
                    435:                 files</a></span></dt>
1.1       grant     436: 
                    437:                 <dd>
                    438:                   <dl>
                    439:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   440:                     "#id2590737">9.2.1. Anatomy of a buildlink3.mk
1.1       grant     441:                     file</a></span></dt>
                    442: 
                    443:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   444:                     "#id2591177">9.2.2. Updating <code class=
1.14      xtraeme   445:                     "varname">BUILDLINK_DEPENDS.<em class=
                    446:                     "replaceable"><code>pkg</code></em></code> in
                    447:                     <code class="filename">buildlink3.mk</code>
1.1       grant     448:                     files</a></span></dt>
                    449:                   </dl>
                    450:                 </dd>
                    451: 
1.18    ! xtraeme   452:                 <dt><span class="sect1"><a href="#id2591256">9.3.
1.14      xtraeme   453:                 Writing <code class="filename">builtin.mk</code>
                    454:                 files</a></span></dt>
1.1       grant     455: 
                    456:                 <dd>
                    457:                   <dl>
                    458:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   459:                     "#id2591542">9.3.1. Anatomy of a <code class=
1.14      xtraeme   460:                     "filename">builtin.mk</code>
1.1       grant     461:                     file</a></span></dt>
                    462: 
                    463:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   464:                     "#id2591769">9.3.2. Global preferences for
1.1       grant     465:                     native or pkgsrc software</a></span></dt>
                    466:                   </dl>
                    467:                 </dd>
                    468:               </dl>
                    469:             </dd>
                    470: 
                    471:             <dt><span class="chapter"><a href="#options">10.
                    472:             Options handling</a></span></dt>
                    473: 
                    474:             <dd>
                    475:               <dl>
1.18    ! xtraeme   476:                 <dt><span class="sect1"><a href="#id2591842">10.1.
1.1       grant     477:                 Global default options</a></span></dt>
                    478: 
1.18    ! xtraeme   479:                 <dt><span class="sect1"><a href="#id2591857">10.2.
1.14      xtraeme   480:                 Converting packages to use <code class=
                    481:                 "filename">bsd.options.mk</code></a></span></dt>
1.1       grant     482:               </dl>
                    483:             </dd>
                    484: 
                    485:             <dt><span class="chapter"><a href="#build">11. The
                    486:             build process</a></span></dt>
                    487: 
                    488:             <dd>
                    489:               <dl>
                    490:                 <dt><span class="sect1"><a href=
                    491:                 "#build.prefix">11.1. Program
                    492:                 location</a></span></dt>
                    493: 
1.18    ! xtraeme   494:                 <dt><span class="sect1"><a href="#id2592396">11.2.
1.1       grant     495:                 Main targets</a></span></dt>
                    496: 
                    497:                 <dt><span class="sect1"><a href=
                    498:                 "#build.helpful-targets">11.3. Other helpful
                    499:                 targets</a></span></dt>
                    500:               </dl>
                    501:             </dd>
                    502: 
                    503:             <dt><span class="chapter"><a href="#fixes">12. Notes on
                    504:             fixes for packages</a></span></dt>
                    505: 
                    506:             <dd>
                    507:               <dl>
1.18    ! xtraeme   508:                 <dt><span class="sect1"><a href="#id2593797">12.1.
1.1       grant     509:                 General operation</a></span></dt>
                    510: 
                    511:                 <dd>
                    512:                   <dl>
                    513:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   514:                     "#id2593800">12.1.1. How to pull in variables
1.1       grant     515:                     from /etc/mk.conf</a></span></dt>
                    516: 
                    517:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   518:                     "#id2593952">12.1.2. Restricted
1.1       grant     519:                     packages</a></span></dt>
                    520: 
                    521:                     <dt><span class="sect2"><a href=
                    522:                     "#dependencies">12.1.3. Handling
                    523:                     dependencies</a></span></dt>
                    524: 
                    525:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   526:                     "#id2594467">12.1.4. Handling conflicts with
1.1       grant     527:                     other packages</a></span></dt>
                    528: 
                    529:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   530:                     "#id2594517">12.1.5. Packages that cannot or
1.1       grant     531:                     should not be built</a></span></dt>
                    532: 
                    533:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   534:                     "#id2594542">12.1.6. Packages which should not
1.1       grant     535:                     be deleted, once installed</a></span></dt>
                    536: 
                    537:                     <dt><span class="sect2"><a href=
                    538:                     "#security-handling">12.1.7. Handling packages
                    539:                     with security problems</a></span></dt>
                    540: 
                    541:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   542:                     "#id2594702">12.1.8. How to handle compiler
1.1       grant     543:                     bugs</a></span></dt>
                    544: 
                    545:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   546:                     "#id2594725">12.1.9. How to handle incrementing
1.1       grant     547:                     versions when fixing an existing
                    548:                     package</a></span></dt>
                    549: 
                    550:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   551:                     "#id2594774">12.1.10. Portability of
1.1       grant     552:                     packages</a></span></dt>
                    553:                   </dl>
                    554:                 </dd>
                    555: 
1.18    ! xtraeme   556:                 <dt><span class="sect1"><a href="#id2594798">12.2.
1.1       grant     557:                 Possible downloading issues</a></span></dt>
                    558: 
                    559:                 <dd>
                    560:                   <dl>
                    561:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   562:                     "#id2594802">12.2.1. Packages whose distfiles
1.1       grant     563:                     aren't available for plain
                    564:                     downloading</a></span></dt>
                    565: 
                    566:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   567:                     "#id2594865">12.2.2. How to handle modified
1.1       grant     568:                     distfiles with the 'old' name</a></span></dt>
                    569:                   </dl>
                    570:                 </dd>
                    571: 
1.18    ! xtraeme   572:                 <dt><span class="sect1"><a href="#id2594876">12.3.
1.1       grant     573:                 Configuration gotchas</a></span></dt>
                    574: 
                    575:                 <dd>
                    576:                   <dl>
                    577:                     <dt><span class="sect2"><a href=
                    578:                     "#fixes.libtool">12.3.1. Shared libraries -
                    579:                     libtool</a></span></dt>
                    580: 
                    581:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   582:                     "#id2595352">12.3.2. Using libtool on GNU
1.1       grant     583:                     packages that already support
                    584:                     libtool</a></span></dt>
                    585: 
                    586:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   587:                     "#id2595436">12.3.3. GNU
1.1       grant     588:                     Autoconf/Automake</a></span></dt>
                    589:                   </dl>
                    590:                 </dd>
                    591: 
1.18    ! xtraeme   592:                 <dt><span class="sect1"><a href="#id2595481">12.4.
1.1       grant     593:                 Building considerations</a></span></dt>
                    594: 
                    595:                 <dd>
                    596:                   <dl>
                    597:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   598:                     "#id2595484">12.4.1. CPP
1.1       grant     599:                     defines</a></span></dt>
                    600:                   </dl>
                    601:                 </dd>
                    602: 
1.18    ! xtraeme   603:                 <dt><span class="sect1"><a href="#id2595651">12.5.
1.1       grant     604:                 Package specific actions</a></span></dt>
                    605: 
                    606:                 <dd>
                    607:                   <dl>
                    608:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   609:                     "#id2595654">12.5.1. Package configuration
1.1       grant     610:                     files</a></span></dt>
                    611: 
                    612:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   613:                     "#id2595825">12.5.2. User
1.2       hubertf   614:                     interaction</a></span></dt>
1.1       grant     615: 
                    616:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   617:                     "#id2595869">12.5.3. Handling
1.1       grant     618:                     licenses</a></span></dt>
                    619: 
                    620:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   621:                     "#id2596089">12.5.4. Creating an account from a
1.1       grant     622:                     package</a></span></dt>
                    623: 
                    624:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   625:                     "#id2596151">12.5.5. Installing score
1.1       grant     626:                     files</a></span></dt>
                    627: 
                    628:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   629:                     "#id2596195">12.5.6. Packages providing login
1.1       grant     630:                     shells</a></span></dt>
                    631: 
                    632:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   633:                     "#id2596252">12.5.7. Packages containing perl
1.1       grant     634:                     scripts</a></span></dt>
                    635: 
                    636:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   637:                     "#id2596270">12.5.8. Packages with hardcoded
1.1       grant     638:                     paths to other interpreters</a></span></dt>
                    639: 
                    640:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   641:                     "#id2596292">12.5.9. Packages installing perl
1.1       grant     642:                     modules</a></span></dt>
                    643: 
                    644:                     <dt><span class="sect2"><a href=
                    645:                     "#faq.info-files">12.5.10. Packages installing
                    646:                     info files</a></span></dt>
                    647: 
                    648:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   649:                     "#id2596512">12.5.11. Packages installing
1.1       grant     650:                     GConf2 data files</a></span></dt>
                    651: 
                    652:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   653:                     "#id2596612">12.5.12. Packages installing
1.1       grant     654:                     scrollkeeper data files</a></span></dt>
                    655: 
                    656:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   657:                     "#id2596731">12.5.13. Packages installing X11
1.1       grant     658:                     fonts</a></span></dt>
                    659: 
                    660:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   661:                     "#id2596778">12.5.14. Packages installing GTK2
1.1       grant     662:                     modules</a></span></dt>
                    663: 
                    664:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   665:                     "#id2596916">12.5.15. Packages installing SGML
1.1       grant     666:                     or XML data</a></span></dt>
                    667: 
                    668:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   669:                     "#id2596968">12.5.16. Packages installing
1.1       grant     670:                     extensions to the MIME database</a></span></dt>
                    671: 
                    672:                     <dt><span class="sect2"><a href=
1.18    ! xtraeme   673:                     "#id2597107">12.5.17. Packages using
1.1       grant     674:                     intltool</a></span></dt>
1.18    ! xtraeme   675: 
        !           676:                     <dt><span class="sect2"><a href=
        !           677:                     "#id2597121">12.5.18. Packages installing
        !           678:                     startup scripts</a></span></dt>
1.1       grant     679:                   </dl>
                    680:                 </dd>
                    681: 
1.18    ! xtraeme   682:                 <dt><span class="sect1"><a href="#id2597210">12.6.
1.1       grant     683:                 Feedback to the author</a></span></dt>
                    684:               </dl>
                    685:             </dd>
                    686: 
                    687:             <dt><span class="chapter"><a href="#debug">13.
                    688:             Debugging</a></span></dt>
                    689: 
                    690:             <dt><span class="chapter"><a href="#submit">14.
                    691:             Submitting and Committing</a></span></dt>
                    692: 
                    693:             <dd>
                    694:               <dl>
1.18    ! xtraeme   695:                 <dt><span class="sect1"><a href="#id2597672">14.1.
1.1       grant     696:                 Submitting your packages</a></span></dt>
                    697: 
1.18    ! xtraeme   698:                 <dt><span class="sect1"><a href="#id2597723">14.2.
1.1       grant     699:                 Committing: Importing a package into
                    700:                 CVS</a></span></dt>
                    701: 
1.18    ! xtraeme   702:                 <dt><span class="sect1"><a href="#id2597854">14.3.
1.2       hubertf   703:                 Updating a package to a newer
                    704:                 version</a></span></dt>
1.1       grant     705: 
1.18    ! xtraeme   706:                 <dt><span class="sect1"><a href="#id2597874">14.4.
1.2       hubertf   707:                 Moving a package in pkgsrc</a></span></dt>
1.1       grant     708:               </dl>
                    709:             </dd>
                    710:           </dl>
                    711:         </dd>
                    712: 
                    713:         <dt><span class="appendix"><a href="#examples">A. A simple
                    714:         example package: bison</a></span></dt>
                    715: 
                    716:         <dd>
                    717:           <dl>
1.18    ! xtraeme   718:             <dt><span class="sect1"><a href="#id2598100">A.1.
1.1       grant     719:             files</a></span></dt>
                    720: 
                    721:             <dd>
                    722:               <dl>
1.18    ! xtraeme   723:                 <dt><span class="sect2"><a href="#id2598103">A.1.1.
1.1       grant     724:                 Makefile</a></span></dt>
                    725: 
1.18    ! xtraeme   726:                 <dt><span class="sect2"><a href="#id2598110">A.1.2.
1.1       grant     727:                 DESCR</a></span></dt>
                    728: 
1.18    ! xtraeme   729:                 <dt><span class="sect2"><a href="#id2598125">A.1.3.
1.1       grant     730:                 PLIST</a></span></dt>
                    731: 
1.18    ! xtraeme   732:                 <dt><span class="sect2"><a href="#id2598133">A.1.4.
1.14      xtraeme   733:                 Checking a package with <span><strong class=
                    734:                 "command">pkglint</strong></span></a></span></dt>
1.1       grant     735:               </dl>
                    736:             </dd>
                    737: 
1.18    ! xtraeme   738:             <dt><span class="sect1"><a href="#id2598173">A.2. Steps
1.1       grant     739:             for building, installing, packaging</a></span></dt>
                    740:           </dl>
                    741:         </dd>
                    742: 
                    743:         <dt><span class="appendix"><a href="#logs">B. Build
                    744:         logs</a></span></dt>
                    745: 
                    746:         <dd>
                    747:           <dl>
                    748:             <dt><span class="sect1"><a href="#logs.building">B.1.
                    749:             Building figlet</a></span></dt>
                    750: 
                    751:             <dt><span class="sect1"><a href="#logs.package">B.2.
                    752:             Packaging figlet</a></span></dt>
                    753:           </dl>
                    754:         </dd>
                    755: 
                    756:         <dt><span class="appendix"><a href="#ftp-layout">C. Layout
                    757:         of the FTP server's package archive</a></span></dt>
1.2       hubertf   758: 
                    759:         <dt><span class="appendix"><a href="#editing">D. Editing
                    760:         guidelines for the pkgsrc guide</a></span></dt>
                    761: 
                    762:         <dd>
                    763:           <dl>
1.18    ! xtraeme   764:             <dt><span class="sect1"><a href="#id2599093">D.1.
1.2       hubertf   765:             Targets</a></span></dt>
                    766: 
1.18    ! xtraeme   767:             <dt><span class="sect1"><a href="#id2599163">D.2.
1.2       hubertf   768:             Procedure</a></span></dt>
                    769:           </dl>
                    770:         </dd>
1.1       grant     771:       </dl>
                    772:     </div>
                    773: 
                    774:     <div class="chapter" lang="en" xml:lang="en">
                    775:       <div class="titlepage">
                    776:         <div>
                    777:           <div>
                    778:             <h2 class="title"><a name="introduction" id=
                    779:             "introduction"></a>Chapter&nbsp;1.&nbsp;Introduction</h2>
                    780:           </div>
                    781:         </div>
                    782:       </div>
                    783: 
                    784:       <div class="toc">
                    785:         <p><b>Table of Contents</b></p>
                    786: 
                    787:         <dl>
1.18    ! xtraeme   788:           <dt><span class="sect1"><a href="#id2517094">1.1.
1.1       grant     789:           Introduction</a></span></dt>
                    790: 
                    791:           <dt><span class="sect1"><a href="#overview">1.2.
                    792:           Overview</a></span></dt>
                    793: 
                    794:           <dt><span class="sect1"><a href="#terminology">1.3.
                    795:           Terminology</a></span></dt>
                    796: 
                    797:           <dt><span class="sect1"><a href="#typography">1.4.
                    798:           Typography</a></span></dt>
                    799:         </dl>
                    800:       </div>
                    801: 
                    802:       <div class="sect1" lang="en" xml:lang="en">
                    803:         <div class="titlepage">
                    804:           <div>
                    805:             <div>
                    806:               <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme   807:               "id2517094" id=
        !           808:               "id2517094"></a>1.1.&nbsp;Introduction</h2>
1.1       grant     809:             </div>
                    810:           </div>
                    811:         </div>
                    812: 
                    813:         <p>There is a lot of software freely available for Unix
                    814:         based systems, which usually runs on NetBSD and other
                    815:         Unix-flavoured systems, too, sometimes with some
                    816:         modifications. The NetBSD Packages Collection (pkgsrc)
                    817:         incorporates any such changes necessary to make that
                    818:         software run, and makes the installation (and
                    819:         de-installation) of the software package easy by means of a
                    820:         single command.</p>
                    821: 
                    822:         <p>Once the software has been built, it is manipulated with
1.14      xtraeme   823:         the <span><strong class="command">pkg_*</strong></span>
                    824:         tools so that installation and de-installation, printing of
                    825:         an inventory of all installed packages and retrieval of
                    826:         one-line comments or more verbose descriptions are all
                    827:         simple.</p>
1.1       grant     828: 
                    829:         <p>pkgsrc currently contains several thousand packages,
                    830:         including:</p>
                    831: 
                    832:         <div class="itemizedlist">
                    833:           <ul type="disc">
                    834:             <li>
                    835:               <p><a xmlns=
                    836:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    837:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/apache/README.html"
1.14      xtraeme   838:               class="pkgname">www/apache</a> - The Apache web
                    839:               server</p>
1.1       grant     840:             </li>
                    841: 
                    842:             <li>
                    843:               <p><a xmlns=
                    844:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    845:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.14      xtraeme   846:               class="pkgname">www/mozilla</a> - The Mozilla web
                    847:               browser</p>
1.1       grant     848:             </li>
                    849: 
                    850:             <li>
                    851:               <p><a xmlns=
                    852:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    853:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/gnome/README.html"
1.14      xtraeme   854:               class="pkgname">meta-pkgs/gnome</a> - The GNOME
                    855:               Desktop Environment</p>
1.1       grant     856:             </li>
                    857: 
                    858:             <li>
                    859:               <p><a xmlns=
                    860:               "http://www.w3.org/TR/xhtml1/transitional" href=
                    861:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/meta-pkgs/kde3/README.html"
1.14      xtraeme   862:               class="pkgname">meta-pkgs/kde3</a> - The K Desktop
                    863:               Environment</p>
1.1       grant     864:             </li>
                    865:           </ul>
                    866:         </div>
                    867: 
                    868:         <p>...just to name a few.</p>
                    869: 
                    870:         <p>pkgsrc has built-in support for handling varying
                    871:         dependencies, such as pthreads and X11, and extended
                    872:         features such as IPv6 support on a range of platforms.</p>
                    873: 
                    874:         <p>pkgsrc was derived from FreeBSD's ports system, and
                    875:         initially developed for NetBSD only. Since then, pkgsrc has
                    876:         grown a lot, and now supports the following platforms:</p>
                    877: 
                    878:         <div class="itemizedlist">
                    879:           <ul type="disc">
                    880:             <li>
                    881:               <p><a href="http://developer.apple.com/darwin/"
                    882:               target="_top">Darwin</a> (<a href=
                    883:               "http://www.apple.com/macosx/" target="_top">Mac OS
                    884:               X</a>)</p>
                    885:             </li>
                    886: 
                    887:             <li>
1.3       hubertf   888:               <p><a href="http://www.DragonFlyBSD.org/" target=
                    889:               "_top">DragonFlyBSD</a></p>
                    890:             </li>
                    891: 
                    892:             <li>
1.1       grant     893:               <p><a href="http://www.FreeBSD.org/" target=
                    894:               "_top">FreeBSD</a></p>
                    895:             </li>
                    896: 
                    897:             <li>
1.3       hubertf   898:               <p>Microsoft Windows, via <a href=
                    899:               "http://www.microsoft.com/windows/sfu/" target=
                    900:               "_top">Interix</a></p>
1.1       grant     901:             </li>
                    902: 
                    903:             <li>
                    904:               <p><a href="http://www.sgi.com/software/irix6.5/"
                    905:               target="_top">IRIX</a></p>
                    906:             </li>
                    907: 
                    908:             <li>
                    909:               <p><a href="http://www.linux.org/" target=
                    910:               "_top">Linux</a></p>
                    911:             </li>
                    912: 
                    913:             <li>
                    914:               <p><a href="http://www.NetBSD.org/" target=
                    915:               "_top">NetBSD</a> (of course)</p>
                    916:             </li>
                    917: 
                    918:             <li>
1.17      sketch    919:               <p><a href="http://h30097.www3.hp.com/" target=
                    920:               "_top">Tru64</a> (Digital UNIX, OSF1)</p>
                    921:             </li>
                    922: 
                    923:             <li>
1.1       grant     924:               <p><a href="http://www.openbsd.org/" target=
                    925:               "_top">OpenBSD</a></p>
                    926:             </li>
                    927: 
                    928:             <li>
                    929:               <p><a href="http://www.sun.com/solaris/" target=
                    930:               "_top">Solaris</a></p>
                    931:             </li>
                    932:           </ul>
                    933:         </div>
                    934:       </div>
                    935: 
                    936:       <div class="sect1" lang="en" xml:lang="en">
                    937:         <div class="titlepage">
                    938:           <div>
                    939:             <div>
                    940:               <h2 class="title" style="clear: both"><a name=
                    941:               "overview" id="overview"></a>1.2.&nbsp;Overview</h2>
                    942:             </div>
                    943:           </div>
                    944:         </div>
                    945: 
                    946:         <p>This document is divided into two parts. The first,
                    947:         <a href="#users-guide" title=
1.2       hubertf   948:         "Part&nbsp;I.&nbsp;The pkgsrc user's guide">The pkgsrc
                    949:         user's guide</a>, describes how one can use one of the
                    950:         packages in the Package Collection, either by installing a
                    951:         precompiled binary package, or by building one's own copy
                    952:         using the NetBSD package system. The second part, <a href=
1.1       grant     953:         "#developers-guide" title=
1.2       hubertf   954:         "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">The
                    955:         pkgsrc developer's guide</a>, explains how to prepare a
                    956:         package so it can be easily built by other NetBSD users
                    957:         without knowing about the package's building details.</p>
1.1       grant     958: 
                    959:         <p>This document is available in various formats:</p>
                    960: 
                    961:         <div class="itemizedlist">
                    962:           <ul type="disc">
                    963:             <li>
                    964:               <p><a href="index.html" target="_top">HTML</a></p>
                    965:             </li>
                    966: 
                    967:             <li>
                    968:               <p><a href="pkgsrc.pdf" target="_top">PDF</a></p>
                    969:             </li>
                    970: 
                    971:             <li>
                    972:               <p><a href="pkgsrc.ps" target="_top">PS</a></p>
                    973:             </li>
                    974: 
                    975:             <li>
                    976:               <p><a href="pkgsrc.txt" target="_top">TXT</a></p>
                    977:             </li>
                    978:           </ul>
                    979:         </div>
                    980:       </div>
                    981: 
                    982:       <div class="sect1" lang="en" xml:lang="en">
                    983:         <div class="titlepage">
                    984:           <div>
                    985:             <div>
                    986:               <h2 class="title" style="clear: both"><a name=
                    987:               "terminology" id=
                    988:               "terminology"></a>1.3.&nbsp;Terminology</h2>
                    989:             </div>
                    990:           </div>
                    991:         </div>
                    992: 
                    993:         <p>There has been a lot of talk about &#8220;<span class=
                    994:         "quote">ports</span>&#8221;, &#8220;<span class=
                    995:         "quote">packages</span>&#8221;, etc. so far. Here is a
                    996:         description of all the terminology used within this
                    997:         document.</p>
                    998: 
                    999:         <div class="variablelist">
                   1000:           <dl>
                   1001:             <dt><span class="term">Package</span></dt>
                   1002: 
                   1003:             <dd>
                   1004:               <p>A set of files and building instructions that
                   1005:               describe what's necessary to build a certain piece of
                   1006:               software using pkgsrc. Packages are traditionally
1.14      xtraeme  1007:               stored under <code class=
                   1008:               "filename">/usr/pkgsrc</code>.</p>
1.1       grant    1009:             </dd>
                   1010: 
                   1011:             <dt><span class="term">The NetBSD package
                   1012:             system</span></dt>
                   1013: 
                   1014:             <dd>
                   1015:               <p>This is the former name of &#8220;<span class=
                   1016:               "quote">pkgsrc</span>&#8221;. It is part of the
                   1017:               NetBSD operating system and can be bootstrap to run
                   1018:               on non-NetBSD operating systems as well. It handles
                   1019:               building (compiling), installing, and removing of
                   1020:               packages.</p>
                   1021:             </dd>
                   1022: 
                   1023:             <dt><span class="term">Distfile</span></dt>
                   1024: 
                   1025:             <dd>
                   1026:               <p>This term describes the file or files that are
                   1027:               provided by the author of the piece of software to
                   1028:               distribute his work. All the changes necessary to
                   1029:               build on NetBSD are reflected in the corresponding
                   1030:               package. Usually the distfile is in the form of a
                   1031:               compressed tar-archive, but other types are possible,
1.14      xtraeme  1032:               too. Distfiles are usually stored below <code class=
                   1033:               "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    1034:             </dd>
                   1035: 
                   1036:             <dt><span class="term">Port</span></dt>
                   1037: 
                   1038:             <dd>
                   1039:               <p>This is the term used by FreeBSD and OpenBSD
                   1040:               people for what we call a package. In NetBSD
                   1041:               terminology, &#8220;<span class=
                   1042:               "quote">port</span>&#8221; refers to a different
                   1043:               architecture.</p>
                   1044:             </dd>
                   1045: 
                   1046:             <dt><span class="term">Precompiled/binary
                   1047:             package</span></dt>
                   1048: 
                   1049:             <dd>
                   1050:               <p>A set of binaries built with pkgsrc from a
1.14      xtraeme  1051:               distfile and stuffed together in a single
                   1052:               <code class="filename">.tgz</code> file so it can be
                   1053:               installed on machines of the same machine
                   1054:               architecture without the need to recompile. Packages
                   1055:               are usually generated in <code class=
                   1056:               "filename">/usr/pkgsrc/packages</code>; there is also
                   1057:               an archive on <a href=
1.1       grant    1058:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/" target=
                   1059:               "_top">ftp.NetBSD.org</a>.</p>
                   1060: 
                   1061:               <p>Sometimes, this is referred to by the term
                   1062:               &#8220;<span class="quote">package</span>&#8221; too,
                   1063:               especially in the context of precompiled
                   1064:               packages.</p>
                   1065:             </dd>
                   1066: 
                   1067:             <dt><span class="term">Program</span></dt>
                   1068: 
                   1069:             <dd>
                   1070:               <p>The piece of software to be installed which will
                   1071:               be constructed from all the files in the Distfile by
                   1072:               the actions defined in the corresponding package.</p>
                   1073:             </dd>
                   1074:           </dl>
                   1075:         </div>
                   1076:       </div>
                   1077: 
                   1078:       <div class="sect1" lang="en" xml:lang="en">
                   1079:         <div class="titlepage">
                   1080:           <div>
                   1081:             <div>
                   1082:               <h2 class="title" style="clear: both"><a name=
                   1083:               "typography" id=
                   1084:               "typography"></a>1.4.&nbsp;Typography</h2>
                   1085:             </div>
                   1086:           </div>
                   1087:         </div>
                   1088: 
                   1089:         <p>When giving examples for commands, shell prompts are
                   1090:         used to show if the command should/can be issued as root,
                   1091:         or if &#8220;<span class="quote">normal</span>&#8221; user
1.14      xtraeme  1092:         privileges are sufficient. We use a <code class=
                   1093:         "prompt">#</code> for root's shell prompt, and a
                   1094:         <code class="prompt">$</code> for users' shell prompt,
                   1095:         assuming they use the C-shell or tcsh.</p>
1.1       grant    1096:       </div>
                   1097:     </div>
                   1098: 
                   1099:     <div class="part" lang="en" xml:lang="en">
                   1100:       <div class="titlepage">
                   1101:         <div>
                   1102:           <div>
                   1103:             <h1 class="title"><a name="users-guide" id=
1.2       hubertf  1104:             "users-guide"></a>The pkgsrc user's guide</h1>
1.1       grant    1105:           </div>
                   1106:         </div>
                   1107:       </div>
                   1108: 
                   1109:       <div class="toc">
                   1110:         <p><b>Table of Contents</b></p>
                   1111: 
                   1112:         <dl>
                   1113:           <dt><span class="chapter"><a href="#getting">2. Where to
                   1114:           get pkgsrc</a></span></dt>
                   1115: 
                   1116:           <dd>
                   1117:             <dl>
1.18    ! xtraeme  1118:               <dt><span class="sect1"><a href="#id2517748">2.1. As
1.1       grant    1119:               tar file</a></span></dt>
                   1120: 
1.18    ! xtraeme  1121:               <dt><span class="sect1"><a href="#id2517764">2.2. Via
1.1       grant    1122:               SUP</a></span></dt>
                   1123: 
1.18    ! xtraeme  1124:               <dt><span class="sect1"><a href="#id2517796">2.3. Via
1.1       grant    1125:               CVS</a></span></dt>
                   1126:             </dl>
                   1127:           </dd>
                   1128: 
                   1129:           <dt><span class="chapter"><a href="#platforms">3. Using
                   1130:           pkgsrc on systems other than NetBSD</a></span></dt>
                   1131: 
                   1132:           <dd>
                   1133:             <dl>
1.18    ! xtraeme  1134:               <dt><span class="sect1"><a href="#id2517906">3.1.
1.1       grant    1135:               Bootstrapping pkgsrc</a></span></dt>
                   1136: 
1.18    ! xtraeme  1137:               <dt><span class="sect1"><a href="#id2518155">3.2.
1.1       grant    1138:               Platform specific notes</a></span></dt>
                   1139: 
                   1140:               <dd>
                   1141:                 <dl>
                   1142:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1143:                   "#id2518162">3.2.1. Darwin (Mac OS
1.1       grant    1144:                   X)</a></span></dt>
                   1145: 
                   1146:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1147:                   "#id2518324">3.2.2. FreeBSD</a></span></dt>
1.1       grant    1148: 
                   1149:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1150:                   "#id2518494">3.2.3. Interix</a></span></dt>
1.1       grant    1151: 
                   1152:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1153:                   "#id2519063">3.2.4. IRIX</a></span></dt>
1.1       grant    1154: 
                   1155:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1156:                   "#id2519180">3.2.5. OpenBSD</a></span></dt>
1.1       grant    1157: 
                   1158:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1159:                   "#id2519292">3.2.6. Solaris</a></span></dt>
1.1       grant    1160:                 </dl>
                   1161:               </dd>
                   1162:             </dl>
                   1163:           </dd>
                   1164: 
                   1165:           <dt><span class="chapter"><a href="#using">4. Using
                   1166:           pkgsrc</a></span></dt>
                   1167: 
                   1168:           <dd>
                   1169:             <dl>
                   1170:               <dt><span class="sect1"><a href=
                   1171:               "#getting-started">4.1. Working with binary
                   1172:               packages</a></span></dt>
                   1173: 
                   1174:               <dd>
                   1175:                 <dl>
                   1176:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1177:                   "#id2519429">4.1.1. Where to get binary
1.1       grant    1178:                   packages</a></span></dt>
                   1179: 
                   1180:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1181:                   "#id2519469">4.1.2. How to use binary
1.1       grant    1182:                   packages</a></span></dt>
                   1183: 
                   1184:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1185:                   "#id2519604">4.1.3. A word of
1.1       grant    1186:                   warning</a></span></dt>
                   1187:                 </dl>
                   1188:               </dd>
                   1189: 
1.18    ! xtraeme  1190:               <dt><span class="sect1"><a href="#id2519616">4.2.
1.1       grant    1191:               Building packages from source</a></span></dt>
                   1192: 
                   1193:               <dd>
                   1194:                 <dl>
                   1195:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1196:                   "#id2519625">4.2.1. Requirements</a></span></dt>
1.1       grant    1197: 
                   1198:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1199:                   "#id2519645">4.2.2. Fetching
1.1       grant    1200:                   distfiles</a></span></dt>
                   1201: 
                   1202:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1203:                   "#id2519698">4.2.3. How to build and
1.1       grant    1204:                   install</a></span></dt>
                   1205: 
                   1206:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1207:                   "#id2520014">4.2.4. Selecting the
1.1       grant    1208:                   compiler</a></span></dt>
                   1209:                 </dl>
                   1210:               </dd>
                   1211:             </dl>
                   1212:           </dd>
                   1213: 
                   1214:           <dt><span class="chapter"><a href="#binary">5. Creating
                   1215:           binary packages</a></span></dt>
                   1216: 
                   1217:           <dd>
                   1218:             <dl>
1.18    ! xtraeme  1219:               <dt><span class="sect1"><a href="#id2520101">5.1.
1.1       grant    1220:               Building a single binary package</a></span></dt>
                   1221: 
1.18    ! xtraeme  1222:               <dt><span class="sect1"><a href="#id2520247">5.2.
1.1       grant    1223:               Settings for creation of binary
                   1224:               packages</a></span></dt>
                   1225: 
                   1226:               <dt><span class="sect1"><a href="#bulkbuild">5.3.
                   1227:               Doing a bulk build of all packages</a></span></dt>
                   1228: 
                   1229:               <dd>
                   1230:                 <dl>
                   1231:                   <dt><span class="sect2"><a href=
                   1232:                   "#binary.configuration">5.3.1.
                   1233:                   Configuration</a></span></dt>
                   1234: 
                   1235:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1236:                   "#id2520865">5.3.2. Other environmental
1.1       grant    1237:                   considerations</a></span></dt>
                   1238: 
                   1239:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1240:                   "#id2585963">5.3.3. Operation</a></span></dt>
1.1       grant    1241: 
                   1242:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1243:                   "#id2586101">5.3.4. What it does</a></span></dt>
1.1       grant    1244: 
                   1245:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1246:                   "#id2586157">5.3.5. Disk space
1.1       grant    1247:                   requirements</a></span></dt>
                   1248: 
                   1249:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1250:                   "#id2586184">5.3.6. Setting up a sandbox for
1.1       grant    1251:                   chroot'ed builds</a></span></dt>
                   1252: 
                   1253:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1254:                   "#id2586645">5.3.7. Building a partial set of
1.1       grant    1255:                   packages</a></span></dt>
1.13      hubertf  1256: 
                   1257:                   <dt><span class="sect2"><a href=
                   1258:                   "#bulk-upload">5.3.8. Uploading results of a bulk
                   1259:                   build</a></span></dt>
1.1       grant    1260:                 </dl>
                   1261:               </dd>
                   1262: 
1.18    ! xtraeme  1263:               <dt><span class="sect1"><a href="#id2587082">5.4.
1.1       grant    1264:               Creating a multiple CD-ROM packages
                   1265:               collection</a></span></dt>
                   1266: 
                   1267:               <dd>
                   1268:                 <dl>
                   1269:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  1270:                   "#id2587097">5.4.1. Example of
1.1       grant    1271:                   cdpack</a></span></dt>
                   1272:                 </dl>
                   1273:               </dd>
                   1274:             </dl>
                   1275:           </dd>
                   1276: 
                   1277:           <dt><span class="chapter"><a href="#faq">6. Frequently
                   1278:           Asked Questions</a></span></dt>
                   1279: 
                   1280:           <dd>
                   1281:             <dl>
1.18    ! xtraeme  1282:               <dt><span class="sect1"><a href="#id2587289">6.1. Are
        !          1283:               there any mailing lists for pkg-related
1.1       grant    1284:               discussion?</a></span></dt>
                   1285: 
1.18    ! xtraeme  1286:               <dt><span class="sect1"><a href="#id2587492">6.2.
1.1       grant    1287:               Where's the pkgviews documentation?</a></span></dt>
                   1288: 
1.5       hubertf  1289:               <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    1290:               Utilities for package management
                   1291:               (pkgtools)</a></span></dt>
                   1292: 
1.18    ! xtraeme  1293:               <dt><span class="sect1"><a href="#id2587676">6.4. How
1.1       grant    1294:               to use pkgsrc as non-root</a></span></dt>
                   1295: 
1.18    ! xtraeme  1296:               <dt><span class="sect1"><a href="#id2587688">6.5. How
1.15      xtraeme  1297:               to resume transfers when fetching
                   1298:               distfiles?</a></span></dt>
1.14      xtraeme  1299: 
1.18    ! xtraeme  1300:               <dt><span class="sect1"><a href="#id2587731">6.6. How
1.1       grant    1301:               can I install/use XFree86 from
                   1302:               pkgsrc?</a></span></dt>
                   1303: 
1.18    ! xtraeme  1304:               <dt><span class="sect1"><a href="#id2587758">6.7. How
1.1       grant    1305:               can I install/use X.org from pkgsrc?</a></span></dt>
                   1306: 
1.18    ! xtraeme  1307:               <dt><span class="sect1"><a href="#id2587786">6.8. How
1.1       grant    1308:               to fetch files from behind a firewall</a></span></dt>
                   1309: 
1.18    ! xtraeme  1310:               <dt><span class="sect1"><a href="#id2587800">6.9. How
1.14      xtraeme  1311:               do I tell <span><strong class="command">make
                   1312:               fetch</strong></span> to do passive
1.1       grant    1313:               FTP?</a></span></dt>
                   1314: 
1.18    ! xtraeme  1315:               <dt><span class="sect1"><a href="#id2587851">6.10.
1.14      xtraeme  1316:               How to fetch all distfiles at once</a></span></dt>
1.1       grant    1317: 
1.18    ! xtraeme  1318:               <dt><span class="sect1"><a href="#id2588059">6.11.
1.14      xtraeme  1319:               What does &#8220;<span class="quote">Don't know how
                   1320:               to make /usr/share/tmac/tmac.andoc</span>&#8221;
                   1321:               mean?</a></span></dt>
1.13      hubertf  1322: 
1.18    ! xtraeme  1323:               <dt><span class="sect1"><a href="#id2588098">6.12.
1.14      xtraeme  1324:               What does &#8220;<span class="quote">Could not find
                   1325:               bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    1326: 
1.18    ! xtraeme  1327:               <dt><span class="sect1"><a href="#id2588224">6.13.
1.1       grant    1328:               Using 'sudo' with pkgsrc</a></span></dt>
                   1329: 
1.14      xtraeme  1330:               <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    1331:               Configuration files handling and
                   1332:               placement</a></span></dt>
                   1333: 
                   1334:               <dt><span class="sect1"><a href=
1.14      xtraeme  1335:               "#audit-packages">6.15. Automated security
1.1       grant    1336:               checks</a></span></dt>
                   1337:             </dl>
                   1338:           </dd>
                   1339:         </dl>
                   1340:       </div>
                   1341: 
                   1342:       <div class="chapter" lang="en" xml:lang="en">
                   1343:         <div class="titlepage">
                   1344:           <div>
                   1345:             <div>
                   1346:               <h2 class="title"><a name="getting" id=
                   1347:               "getting"></a>Chapter&nbsp;2.&nbsp;Where to get
                   1348:               pkgsrc</h2>
                   1349:             </div>
                   1350:           </div>
                   1351:         </div>
                   1352: 
                   1353:         <div class="toc">
                   1354:           <p><b>Table of Contents</b></p>
                   1355: 
                   1356:           <dl>
1.18    ! xtraeme  1357:             <dt><span class="sect1"><a href="#id2517748">2.1. As
1.1       grant    1358:             tar file</a></span></dt>
                   1359: 
1.18    ! xtraeme  1360:             <dt><span class="sect1"><a href="#id2517764">2.2. Via
1.1       grant    1361:             SUP</a></span></dt>
                   1362: 
1.18    ! xtraeme  1363:             <dt><span class="sect1"><a href="#id2517796">2.3. Via
1.1       grant    1364:             CVS</a></span></dt>
                   1365:           </dl>
                   1366:         </div>
                   1367: 
                   1368:         <p>There are three ways to get pkgsrc. Either as a tar
                   1369:         file, via SUP, or via CVS. All three ways are described
                   1370:         here.</p>
                   1371: 
                   1372:         <div class="sect1" lang="en" xml:lang="en">
                   1373:           <div class="titlepage">
                   1374:             <div>
                   1375:               <div>
                   1376:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  1377:                 "id2517748" id="id2517748"></a>2.1.&nbsp;As tar
1.1       grant    1378:                 file</h2>
                   1379:               </div>
                   1380:             </div>
                   1381:           </div>
                   1382: 
                   1383:           <p>To get pkgsrc going, you need to get the pkgsrc.tar.gz
                   1384:           file from <a href=
1.11      ben      1385:           "ftp://ftp.NetBSD.org/pub/NetBSD/NetBSD-current/tar_files/pkgsrc.tar.gz"
1.14      xtraeme  1386:           target="_top">ftp.NetBSD.org</a> and unpack it into
                   1387:           <code class="filename">/usr/pkgsrc</code>.</p>
1.1       grant    1388:         </div>
                   1389: 
                   1390:         <div class="sect1" lang="en" xml:lang="en">
                   1391:           <div class="titlepage">
                   1392:             <div>
                   1393:               <div>
                   1394:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  1395:                 "id2517764" id="id2517764"></a>2.2.&nbsp;Via
1.1       grant    1396:                 SUP</h2>
                   1397:               </div>
                   1398:             </div>
                   1399:           </div>
                   1400: 
                   1401:           <p>As an alternative to the tar file, you can get pkgsrc
                   1402:           via the Software Update Protocol, SUP. To do so, make
                   1403:           sure your supfile has a line</p>
                   1404:           <pre class="programlisting">
                   1405: release=pkgsrc
                   1406: </pre>
                   1407: 
1.14      xtraeme  1408:           <p>in it, see the examples in <code class=
                   1409:           "filename">/usr/share/examples/supfiles</code>, and that
                   1410:           the <code class="filename">/usr/pkgsrc</code> directory
                   1411:           exists. Then, simply run <span><strong class=
                   1412:           "command">sup -v <em class=
                   1413:           "replaceable"><code>/path/to/your/supfile</code></em></strong></span>.</p>
1.1       grant    1414:         </div>
                   1415: 
                   1416:         <div class="sect1" lang="en" xml:lang="en">
                   1417:           <div class="titlepage">
                   1418:             <div>
                   1419:               <div>
                   1420:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  1421:                 "id2517796" id="id2517796"></a>2.3.&nbsp;Via
1.1       grant    1422:                 CVS</h2>
                   1423:               </div>
                   1424:             </div>
                   1425:           </div>
                   1426: 
                   1427:           <p>To get pkgsrc via CVS, make sure you have
                   1428:           &#8220;<span class="quote">cvs</span>&#8221; installed.
                   1429:           If not present on your system, it can be found as
                   1430:           precompiled binary on ftp.NetBSD.org. To do an initial
                   1431:           (full) checkout of pkgsrc, do the following steps:</p>
                   1432:           <pre class="screen">
1.14      xtraeme  1433: <code class="prompt">%</code> <strong class=
                   1434: "userinput"><code>setenv CVSROOT anoncvs@anoncvs.NetBSD.org:/cvsroot</code></strong>
                   1435: <code class="prompt">%</code> <strong class=
                   1436: "userinput"><code>setenv CVS_RSH ssh</code></strong>
                   1437: <code class="prompt">%</code> <strong class=
                   1438: "userinput"><code>cd /usr</code></strong>
                   1439: <code class="prompt">%</code> <strong class=
                   1440: "userinput"><code>cvs checkout -P pkgsrc</code></strong>
                   1441: </pre>
                   1442: 
                   1443:           <p>This will create the <code class=
                   1444:           "filename">pkgsrc</code> directory in your <code class=
                   1445:           "filename">/usr</code>, and all the package source will
                   1446:           be stored under <code class=
                   1447:           "filename">/usr/pkgsrc</code>. To update pkgsrc after the
                   1448:           initial checkout, make sure you have <code class=
                   1449:           "varname">CVS_RSH</code> set as above, then do:</p>
1.1       grant    1450:           <pre class="screen">
1.14      xtraeme  1451: <code class="prompt">%</code> <strong class=
                   1452: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   1453: <code class="prompt">%</code> <strong class=
                   1454: "userinput"><code>cvs -q update -dP</code></strong>
1.1       grant    1455: </pre>
                   1456: 
                   1457:           <p>Please also note that it is possible to have multiple
                   1458:           copies of the pkgsrc hierarchy in use at any one time -
                   1459:           all work is done relatively within the pkgsrc tree.</p>
                   1460:         </div>
                   1461:       </div>
                   1462: 
                   1463:       <div class="chapter" lang="en" xml:lang="en">
                   1464:         <div class="titlepage">
                   1465:           <div>
                   1466:             <div>
                   1467:               <h2 class="title"><a name="platforms" id=
                   1468:               "platforms"></a>Chapter&nbsp;3.&nbsp;Using pkgsrc on
                   1469:               systems other than NetBSD</h2>
                   1470:             </div>
                   1471:           </div>
                   1472:         </div>
                   1473: 
                   1474:         <div class="toc">
                   1475:           <p><b>Table of Contents</b></p>
                   1476: 
                   1477:           <dl>
1.18    ! xtraeme  1478:             <dt><span class="sect1"><a href="#id2517906">3.1.
1.1       grant    1479:             Bootstrapping pkgsrc</a></span></dt>
                   1480: 
1.18    ! xtraeme  1481:             <dt><span class="sect1"><a href="#id2518155">3.2.
1.1       grant    1482:             Platform specific notes</a></span></dt>
                   1483: 
                   1484:             <dd>
                   1485:               <dl>
1.18    ! xtraeme  1486:                 <dt><span class="sect2"><a href="#id2518162">3.2.1.
1.1       grant    1487:                 Darwin (Mac OS X)</a></span></dt>
                   1488: 
1.18    ! xtraeme  1489:                 <dt><span class="sect2"><a href="#id2518324">3.2.2.
1.1       grant    1490:                 FreeBSD</a></span></dt>
                   1491: 
1.18    ! xtraeme  1492:                 <dt><span class="sect2"><a href="#id2518494">3.2.3.
1.1       grant    1493:                 Interix</a></span></dt>
                   1494: 
1.18    ! xtraeme  1495:                 <dt><span class="sect2"><a href="#id2519063">3.2.4.
1.1       grant    1496:                 IRIX</a></span></dt>
                   1497: 
1.18    ! xtraeme  1498:                 <dt><span class="sect2"><a href="#id2519180">3.2.5.
1.1       grant    1499:                 OpenBSD</a></span></dt>
                   1500: 
1.18    ! xtraeme  1501:                 <dt><span class="sect2"><a href="#id2519292">3.2.6.
1.1       grant    1502:                 Solaris</a></span></dt>
                   1503:               </dl>
                   1504:             </dd>
                   1505:           </dl>
                   1506:         </div>
                   1507: 
                   1508:         <div class="sect1" lang="en" xml:lang="en">
                   1509:           <div class="titlepage">
                   1510:             <div>
                   1511:               <div>
                   1512:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  1513:                 "id2517906" id=
        !          1514:                 "id2517906"></a>3.1.&nbsp;Bootstrapping pkgsrc</h2>
1.1       grant    1515:               </div>
                   1516:             </div>
                   1517:           </div>
                   1518: 
                   1519:           <p>For Operating Systems other than NetBSD, we provide a
                   1520:           bootstrap kit to build the required tools to use pkgsrc
                   1521:           on your platform. Besides support for native NetBSD,
                   1522:           pkgsrc and the bootstrap kit have support for the
                   1523:           following operating systems:</p>
                   1524: 
                   1525:           <div class="itemizedlist">
                   1526:             <ul type="disc">
                   1527:               <li>
                   1528:                 <p>Darwin (Mac OS X)</p>
                   1529:               </li>
                   1530: 
                   1531:               <li>
1.16      grant    1532:                 <p>DragonFlyBSD</p>
                   1533:               </li>
                   1534: 
                   1535:               <li>
1.1       grant    1536:                 <p>FreeBSD</p>
                   1537:               </li>
                   1538: 
                   1539:               <li>
                   1540:                 <p>Interix (Windows 2000, XP, 2003)</p>
                   1541:               </li>
                   1542: 
                   1543:               <li>
                   1544:                 <p>IRIX</p>
                   1545:               </li>
                   1546: 
                   1547:               <li>
                   1548:                 <p>Linux</p>
                   1549:               </li>
                   1550: 
                   1551:               <li>
                   1552:                 <p>OpenBSD</p>
                   1553:               </li>
                   1554: 
                   1555:               <li>
                   1556:                 <p>Solaris</p>
                   1557:               </li>
1.16      grant    1558: 
                   1559:               <li>
                   1560:                 <p>Tru64 (Digital UNIX/OSF1)</p>
                   1561:               </li>
1.1       grant    1562:             </ul>
                   1563:           </div>
                   1564: 
                   1565:           <p>Support for other platforms is under development.</p>
                   1566: 
                   1567:           <p>Installing the bootstrap kit should be as simple
                   1568:           as:</p>
                   1569:           <pre class="screen">
1.14      xtraeme  1570: <code class="prompt">#</code> <strong class=
                   1571: "userinput"><code>env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc</code></strong>
                   1572: <code class="prompt">#</code> <strong class=
                   1573: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1574: <code class="prompt">#</code> <strong class=
                   1575: "userinput"><code>./bootstrap</code></strong>
1.1       grant    1576: </pre>
                   1577: 
                   1578:           <p>See <a href="#getting" title=
                   1579:           "Chapter&nbsp;2.&nbsp;Where to get pkgsrc">Chapter 2,
                   1580:           <i>Where to get pkgsrc</i></a> for other ways to get
1.14      xtraeme  1581:           pkgsrc before bootstrapping. The given
                   1582:           <span><strong class="command">bootstrap</strong></span>
                   1583:           command will use the defaults of <code class=
                   1584:           "filename">/usr/pkg</code> for the <span class=
                   1585:           "emphasis"><em>prefix</em></span> where programs will be
                   1586:           installed in, and <code class=
                   1587:           "filename">/var/db/pkg</code> for the package database
1.1       grant    1588:           directory where pkgsrc will do it's internal bookkeeping.
                   1589:           However, these can also be set using command-line
                   1590:           parameters.</p>
                   1591: 
                   1592:           <p>Binary packages for the pkgsrc tools and an initial
                   1593:           set of packages is available for supported platforms. An
                   1594:           up-to-date list of these can be found on <a href=
                   1595:           "http://www.pkgsrc.org/" target=
                   1596:           "_top">www.pkgsrc.org</a>.</p>
                   1597:         </div>
                   1598: 
                   1599:         <div class="sect1" lang="en" xml:lang="en">
                   1600:           <div class="titlepage">
                   1601:             <div>
                   1602:               <div>
                   1603:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  1604:                 "id2518155" id="id2518155"></a>3.2.&nbsp;Platform
1.1       grant    1605:                 specific notes</h2>
                   1606:               </div>
                   1607:             </div>
                   1608:           </div>
                   1609: 
                   1610:           <p>Here are some platform-specific notes you should be
                   1611:           aware of.</p>
                   1612: 
                   1613:           <div class="sect2" lang="en" xml:lang="en">
                   1614:             <div class="titlepage">
                   1615:               <div>
                   1616:                 <div>
1.18    ! xtraeme  1617:                   <h3 class="title"><a name="id2518162" id=
        !          1618:                   "id2518162"></a>3.2.1.&nbsp;Darwin (Mac OS
1.1       grant    1619:                   X)</h3>
                   1620:                 </div>
                   1621:               </div>
                   1622:             </div>
                   1623: 
                   1624:             <p>Darwin 5.x and 6.x are supported. There are two
                   1625:             methods of using pkgsrc on Mac OS X, by using a
                   1626:             <a href="#platform.osx-image" title=
                   1627:             "3.2.1.1.&nbsp;Using a disk image">disk image</a>, or a
                   1628:             <a href="#platform.osx-ufs" title=
                   1629:             "3.2.1.2.&nbsp;Using a UFS partition">UFS
                   1630:             partition</a>.</p>
                   1631: 
                   1632:             <p>Before you start, you will need to download and
                   1633:             install the Mac OS X Developer Tools from Apple's
                   1634:             Developer Connection. See <a href=
                   1635:             "http://developer.apple.com/macosx/" target=
                   1636:             "_top">http://developer.apple.com/macosx/</a> for
                   1637:             details. Also, make sure you install X11 for Mac OS X
                   1638:             and the X11 SDK from <a href=
                   1639:             "http://www.apple.com/macosx/x11/download/" target=
                   1640:             "_top">http://www.apple.com/macosx/x11/download/</a> if
                   1641:             you intend to build packages that use the X11 Window
                   1642:             System.</p>
                   1643: 
                   1644:             <p>If you already have a UFS partition, or have a spare
                   1645:             partition that you can format as UFS, it is recommended
                   1646:             to use that instead of the disk image. It'll be
                   1647:             somewhat faster and will mount automatically at boot
                   1648:             time, where you must manually mount a disk image.</p>
                   1649: 
                   1650:             <div class="note" style=
                   1651:             "margin-left: 0.5in; margin-right: 0.5in;">
                   1652:               <h3 class="title">Note</h3>
                   1653: 
                   1654:               <p>You cannot use a HFS+ file system for pkgsrc,
                   1655:               because pkgsrc currently requires the filesystem to
                   1656:               be case-sensitive, and HFS+ is not.</p>
                   1657:             </div>
                   1658: 
                   1659:             <div class="sect3" lang="en" xml:lang="en">
                   1660:               <div class="titlepage">
                   1661:                 <div>
                   1662:                   <div>
                   1663:                     <h4 class="title"><a name="platform.osx-image"
                   1664:                     id="platform.osx-image"></a>3.2.1.1.&nbsp;Using
                   1665:                     a disk image</h4>
                   1666:                   </div>
                   1667:                 </div>
                   1668:               </div>
                   1669: 
                   1670:               <p>Create the disk image:</p>
                   1671:               <pre class="screen">
1.14      xtraeme  1672: <code class="prompt">#</code> <strong class=
                   1673: "userinput"><code>cd pkgsrc/bootstrap</code></strong>
                   1674: <code class="prompt">#</code> <strong class=
                   1675: "userinput"><code>./ufsdiskimage create ~/Documents/NetBSD 512</code></strong> # megabytes - season to taste
                   1676: <code class="prompt">#</code> <strong class=
                   1677: "userinput"><code>./ufsdiskimage mount ~/Documents/NetBSD</code></strong>
                   1678: <code class="prompt">#</code> <strong class=
                   1679: "userinput"><code>sudo chown `id -u`:`id -g` /Volumes/NetBSD</code></strong>
1.1       grant    1680: </pre>
                   1681: 
                   1682:               <p>That's it!</p>
                   1683:             </div>
                   1684: 
                   1685:             <div class="sect3" lang="en" xml:lang="en">
                   1686:               <div class="titlepage">
                   1687:                 <div>
                   1688:                   <div>
                   1689:                     <h4 class="title"><a name="platform.osx-ufs"
                   1690:                     id="platform.osx-ufs"></a>3.2.1.2.&nbsp;Using a
                   1691:                     UFS partition</h4>
                   1692:                   </div>
                   1693:                 </div>
                   1694:               </div>
                   1695: 
1.14      xtraeme  1696:               <p>By default, <code class="filename">/usr</code>
                   1697:               will be on your root file system, normally HFS+. It
                   1698:               is possible to use the default <span class=
                   1699:               "emphasis"><em>prefix</em></span> of <code class=
                   1700:               "filename">/usr/pkg</code> by symlinking <code class=
                   1701:               "filename">/usr/pkg</code> to a directory on a UFS
                   1702:               file system. Obviously, another symlink is required
                   1703:               if you want to place the package database directory
                   1704:               outside the <span class=
                   1705:               "emphasis"><em>prefix</em></span>. e.g.</p>
1.1       grant    1706:               <pre class="screen">
1.14      xtraeme  1707: <code class="prompt">#</code> <strong class=
                   1708: "userinput"><code>./bootstrap --pkgdbdir=/usr/pkg/pkgdb --pkgsrcdir=/Volumes/ufs/pkgsrc</code></strong>
1.1       grant    1709: </pre>
                   1710: 
                   1711:               <p>If you created your partitions at the time of
                   1712:               installing Mac OS X and formatted the target
                   1713:               partition as UFS, it should automatically mount on
1.14      xtraeme  1714:               <code class="filename">/Volumes/&lt;volume
                   1715:               name&gt;</code> when the machine boots. If you are
1.1       grant    1716:               (re)formatting a partition as UFS, you need to ensure
                   1717:               that the partition map correctly reflects
                   1718:               &#8220;<span class="quote">Apple_UFS</span>&#8221;
                   1719:               and not &#8220;<span class=
                   1720:               "quote">Apple_HFS</span>&#8221;.</p>
                   1721: 
                   1722:               <p>The problem is that none of the disk tools will
                   1723:               let you touch a disk that is booted from. You can
                   1724:               unmount the partition, but even if you newfs it, the
                   1725:               partition type will be incorrect and the automounter
                   1726:               won't mount it. It can be mounted manually, but it
                   1727:               won't appear in Finder.</p>
                   1728: 
                   1729:               <p>You'll need to boot off of the OS X Installation
                   1730:               (User) CD. When the Installation program starts, go
                   1731:               up to the menu and select Disk Utility. Now, you will
                   1732:               be able to select the partition you want to be UFS,
                   1733:               and Format it Apple UFS. Quit the Disk Utility, quit
                   1734:               the installer which will reboot your machine. The new
                   1735:               UFS file system will appear in Finder.</p>
                   1736: 
                   1737:               <p>Be aware that the permissions on the new file
                   1738:               system will be writable by root only.</p>
                   1739: 
                   1740:               <p>This note is as of 10.2 (Jaguar) and applies to
                   1741:               earlier versions. Hopefully Apple will fix Disk
                   1742:               Utility in 10.3 (Panther).</p>
                   1743:             </div>
                   1744:           </div>
                   1745: 
                   1746:           <div class="sect2" lang="en" xml:lang="en">
                   1747:             <div class="titlepage">
                   1748:               <div>
                   1749:                 <div>
1.18    ! xtraeme  1750:                   <h3 class="title"><a name="id2518324" id=
        !          1751:                   "id2518324"></a>3.2.2.&nbsp;FreeBSD</h3>
1.1       grant    1752:                 </div>
                   1753:               </div>
                   1754:             </div>
                   1755: 
                   1756:             <p>FreeBSD 4.7 and 5.0 have been tested and are
                   1757:             supported, other versions may work.</p>
                   1758: 
                   1759:             <p>Care should be taken so that the tools that this kit
                   1760:             installs do not conflict with the FreeBSD userland
                   1761:             tools. There are several steps:</p>
                   1762: 
                   1763:             <div class="orderedlist">
                   1764:               <ol type="1">
                   1765:                 <li>
                   1766:                   <p>FreeBSD stores its ports pkg database in
1.14      xtraeme  1767:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    1768:                   therefore recommended that you choose a different
1.14      xtraeme  1769:                   location (e.g. <code class=
                   1770:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    1771:                   --pkgdbdir option to the bootstrap script.</p>
                   1772:                 </li>
                   1773: 
                   1774:                 <li>
                   1775:                   <p>If you do not intend to use the FreeBSD ports
                   1776:                   tools, it's probably a good idea to move them out
                   1777:                   of the way to avoid confusion, e.g.</p>
                   1778:                   <pre class="screen">
1.14      xtraeme  1779: <code class="prompt">#</code> <strong class=
                   1780: "userinput"><code>cd /usr/sbin</code></strong>
                   1781: <code class="prompt">#</code> <strong class=
                   1782: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   1783: <code class="prompt">#</code> <strong class=
                   1784: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   1785: <code class="prompt">#</code> <strong class=
                   1786: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   1787: <code class="prompt">#</code> <strong class=
                   1788: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    1789: </pre>
                   1790:                 </li>
                   1791: 
                   1792:                 <li>
1.14      xtraeme  1793:                   <p>An example <code class=
                   1794:                   "filename">/etc/mk.conf</code> file will be
                   1795:                   placed in <code class=
                   1796:                   "filename">/etc/mk.conf.example</code> file when
                   1797:                   you use the bootstrap script.</p>
1.1       grant    1798:                 </li>
                   1799:               </ol>
                   1800:             </div>
                   1801:           </div>
                   1802: 
                   1803:           <div class="sect2" lang="en" xml:lang="en">
                   1804:             <div class="titlepage">
                   1805:               <div>
                   1806:                 <div>
1.18    ! xtraeme  1807:                   <h3 class="title"><a name="id2518494" id=
        !          1808:                   "id2518494"></a>3.2.3.&nbsp;Interix</h3>
1.1       grant    1809:                 </div>
                   1810:               </div>
                   1811:             </div>
                   1812: 
                   1813:             <p>Interix is a POSIX compatible subsystem for the
                   1814:             Windows NT kernel, providing a Unix-like environment
                   1815:             with a tighter kernel integration than available with
                   1816:             Cygwin. It is part of the Windows Services for Unix
                   1817:             package, available for free for any licensed copy of
                   1818:             Windows 2000, XP, or 2003. SFU can be downloaded from
                   1819:             <a href="http://www.microsoft.com/windows/sfu/" target=
                   1820:             "_top">http://www.microsoft.com/windows/sfu/</a>.</p>
                   1821: 
                   1822:             <p>Services for Unix 3.5, current as of this writing,
                   1823:             has been tested. 3.0 or 3.1 may work, but are not
                   1824:             officially supported. (The main difference in 3.0/3.1
                   1825:             is lack of pthreads.)</p>
                   1826: 
                   1827:             <div class="sect3" lang="en" xml:lang="en">
                   1828:               <div class="titlepage">
                   1829:                 <div>
                   1830:                   <div>
                   1831:                     <h4 class="title"><a name=
                   1832:                     "platform.interix-sfu-install" id=
                   1833:                     "platform.interix-sfu-install"></a>3.2.3.1.&nbsp;When
1.2       hubertf  1834:                     installing Interix/SFU</h4>
1.1       grant    1835:                   </div>
                   1836:                 </div>
                   1837:               </div>
                   1838: 
                   1839:               <p>At an absolute minimum, the following packages
                   1840:               must be installed from the Windows Services for Unix
                   1841:               3.5 distribution in order to use pkgsrc:</p>
                   1842: 
                   1843:               <div class="itemizedlist">
                   1844:                 <ul type="disc">
                   1845:                   <li>
                   1846:                     <p>Utilities -&gt; Base Utilities</p>
                   1847:                   </li>
                   1848: 
                   1849:                   <li>
                   1850:                     <p>Interix GNU Components -&gt; (all)</p>
                   1851:                   </li>
                   1852: 
                   1853:                   <li>
                   1854:                     <p>Remote Connectivity</p>
                   1855:                   </li>
                   1856: 
                   1857:                   <li>
                   1858:                     <p>Interix SDK</p>
                   1859:                   </li>
                   1860:                 </ul>
                   1861:               </div>
                   1862: 
                   1863:               <p>When using pkgsrc on Interix, DO NOT install the
                   1864:               Utilities subcomponent "UNIX Perl". That is Perl 5.6
                   1865:               without shared module support, installed to
                   1866:               /usr/local, and will only cause confusion. Instead,
                   1867:               install Perl 5.8 from pkgsrc (or from a binary
                   1868:               package).</p>
                   1869: 
                   1870:               <p>The Remote Connectivity subcomponent "Windows
                   1871:               Remote Shell Service" does not need to be installed,
                   1872:               but Remote Connectivity itself should be installed in
                   1873:               order to have a working inetd.</p>
                   1874: 
                   1875:               <p>Finally, during installation you may be asked
                   1876:               whether to enable setuid behavior for Interix
                   1877:               programs, and whether to make pathnames default to
                   1878:               case-sensitive. Setuid should be enabled, and
                   1879:               case-sensitivity MUST be enabled. (Without
                   1880:               case-sensitivity, a large number of packages
                   1881:               including perl will not build.)</p>
                   1882:             </div>
                   1883: 
                   1884:             <div class="sect3" lang="en" xml:lang="en">
                   1885:               <div class="titlepage">
                   1886:                 <div>
                   1887:                   <div>
                   1888:                     <h4 class="title"><a name=
                   1889:                     "platform.interix-sfu-postinstall" id=
                   1890:                     "platform.interix-sfu-postinstall"></a>3.2.3.2.&nbsp;What
                   1891:                     to do if Interix/SFU is already installed</h4>
                   1892:                   </div>
                   1893:                 </div>
                   1894:               </div>
                   1895: 
                   1896:               <p>If SFU is already installed and you wish to alter
                   1897:               these settings to work with pkgsrc, note the
                   1898:               following things.</p>
                   1899: 
                   1900:               <div class="itemizedlist">
                   1901:                 <ul type="disc">
                   1902:                   <li>
                   1903:                     <p>To uninstall UNIX Perl, use Add/Remove
                   1904:                     Programs, select Microsoft Windows Services for
                   1905:                     UNIX, then click Change. In the installer,
                   1906:                     choose Add or Remove, then uncheck
                   1907:                     Utilities-&gt;UNIX Perl.</p>
                   1908:                   </li>
                   1909: 
                   1910:                   <li>
                   1911:                     <p>To enable case-sensitivity for the
                   1912:                     filesystem, run REGEDIT.EXE, and change the
                   1913:                     following registry key:</p>
                   1914: 
                   1915:                     <p>
                   1916:                     HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
                   1917:                     Manager\kernel</p>
                   1918: 
                   1919:                     <p>Set the DWORD value "obcaseinsensitive" to
                   1920:                     0; then reboot.</p>
                   1921:                   </li>
                   1922: 
                   1923:                   <li>
                   1924:                     <p>To enable setuid binaries (optional), run
                   1925:                     REGEDIT.EXE, and change the following registry
                   1926:                     key:</p>
                   1927: 
                   1928:                     <p>
                   1929:                     HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Services
                   1930:                     for UNIX</p>
                   1931: 
                   1932:                     <p>Set the DWORD value "EnableSetuidBinaries"
                   1933:                     to 1; then reboot.</p>
                   1934:                   </li>
                   1935:                 </ul>
                   1936:               </div>
                   1937:             </div>
                   1938: 
                   1939:             <div class="sect3" lang="en" xml:lang="en">
                   1940:               <div class="titlepage">
                   1941:                 <div>
                   1942:                   <div>
                   1943:                     <h4 class="title"><a name=
                   1944:                     "platform.interix-notes" id=
                   1945:                     "platform.interix-notes"></a>3.2.3.3.&nbsp;Important
                   1946:                     notes for using pkgsrc</h4>
                   1947:                   </div>
                   1948:                 </div>
                   1949:               </div>
                   1950: 
                   1951:               <p>The package imanager (either the pkgsrc "su" user,
                   1952:               or the user running "pkg_add") must be a member of
                   1953:               the local Administrators group. Such a user must also
                   1954:               be used to run the bootstrap. This is slightly
                   1955:               relaxed from the normal pkgsrc requirement of
                   1956:               "root".</p>
                   1957: 
                   1958:               <p>The package manager should use a umask of 002.
                   1959:               "make install" will automatically complain if this is
                   1960:               not the case. This ensures that directories written
                   1961:               in /var/db/pkg are Administrators-group
                   1962:               writeable.</p>
                   1963: 
                   1964:               <p>The popular Interix binary packages from
                   1965:               http://www.interopsystems.com/ use an older version
                   1966:               of pkgsrc's pkg_* tools. Ideally, these should NOT be
                   1967:               used in conjunction with pkgsrc. If you choose to use
                   1968:               them at the same time as the pkgsrc packages, ensure
                   1969:               that you use the proper pkg_* tools for each type of
                   1970:               binary package.</p>
                   1971:             </div>
                   1972:           </div>
                   1973: 
                   1974:           <div class="sect2" lang="en" xml:lang="en">
                   1975:             <div class="titlepage">
                   1976:               <div>
                   1977:                 <div>
1.18    ! xtraeme  1978:                   <h3 class="title"><a name="id2519063" id=
        !          1979:                   "id2519063"></a>3.2.4.&nbsp;IRIX</h3>
1.1       grant    1980:                 </div>
                   1981:               </div>
                   1982:             </div>
                   1983: 
                   1984:             <p>You will need a working C compiler, either gcc or
                   1985:             SGI's MIPS and MIPSpro compiler (cc/c89). Please set
1.14      xtraeme  1986:             the <code class="varname">CC</code> environment
                   1987:             variable according to your preference. If you do not
                   1988:             have a license for the MIPSpro compiler suite, you can
1.1       grant    1989:             download a gcc tardist file from <a href=
                   1990:             "http://freeware.sgi.com/" target=
                   1991:             "_top">http://freeware.sgi.com/</a>.</p>
                   1992: 
                   1993:             <p>Please note that you will need IRIX 6.5.17 or
                   1994:             higher, as this is the earliest version of IRIX
                   1995:             providing support for if_indextoname(3),
                   1996:             if_nametoindex(3), etc.</p>
                   1997: 
                   1998:             <p>At this point in time, pkgsrc only supports one ABI.
                   1999:             That is, you can not switch between the old 32-bit ABI,
                   2000:             the new 32-bit ABI and the 64-bit ABI. If you start out
                   2001:             using "abi=n32", that's what all your packages will be
                   2002:             built with.</p>
                   2003: 
                   2004:             <p>Therefore, please make sure that you have no
1.14      xtraeme  2005:             conflicting <code class="varname">CFLAGS</code> in your
                   2006:             environment or the <code class=
                   2007:             "filename">/etc/mk.conf</code>. Particularly, make sure
1.1       grant    2008:             that you do not try to link n32 object files with lib64
1.14      xtraeme  2009:             or vice versa. Check your <code class=
                   2010:             "filename">/etc/compiler.defaults</code>!</p>
1.1       grant    2011: 
                   2012:             <p>If you have the actual pkgsrc tree mounted via NFS
                   2013:             from a different host, please make sure to set
1.14      xtraeme  2014:             <code class="varname">WRKOBJDIR</code> to a local
1.1       grant    2015:             directory, as it appears that IRIX linker occasionally
                   2016:             runs into issues when trying to link over a network
                   2017:             mounted filesystem.</p>
                   2018: 
                   2019:             <p>The bootstrapping process should set all the right
                   2020:             options for programs such as imake(1), but you may want
                   2021:             to set some options depending on your local setup.
1.14      xtraeme  2022:             Please see <code class=
                   2023:             "filename">pkgsrc/mk/defaults/mk.conf</code> and, of
1.1       grant    2024:             course, your compilers man pages for details.</p>
                   2025:           </div>
                   2026: 
                   2027:           <div class="sect2" lang="en" xml:lang="en">
                   2028:             <div class="titlepage">
                   2029:               <div>
                   2030:                 <div>
1.18    ! xtraeme  2031:                   <h3 class="title"><a name="id2519180" id=
        !          2032:                   "id2519180"></a>3.2.5.&nbsp;OpenBSD</h3>
1.1       grant    2033:                 </div>
                   2034:               </div>
                   2035:             </div>
                   2036: 
                   2037:             <p>OpenBSD 3.0 and 3.2 are tested and supported.</p>
                   2038: 
                   2039:             <p>Care should be taken so that the tools that this kit
                   2040:             installs do not conflict with the OpenBSD userland
                   2041:             tools. There are several steps:</p>
                   2042: 
                   2043:             <div class="orderedlist">
                   2044:               <ol type="1">
                   2045:                 <li>
                   2046:                   <p>OpenBSD stores its ports pkg database in
1.14      xtraeme  2047:                   <code class="filename">/var/db/pkg</code>. It is
1.1       grant    2048:                   therefore recommended that you choose a different
1.14      xtraeme  2049:                   location (e.g. <code class=
                   2050:                   "filename">/usr/pkgdb</code>) by using the
1.1       grant    2051:                   --pkgdbdir option to the bootstrap script.</p>
                   2052:                 </li>
                   2053: 
                   2054:                 <li>
                   2055:                   <p>If you do not intend to use the OpenBSD ports
                   2056:                   tools, it's probably a good idea to move them out
                   2057:                   of the way to avoid confusion, e.g.</p>
                   2058:                   <pre class="screen">
1.14      xtraeme  2059: <code class="prompt">#</code> <strong class=
                   2060: "userinput"><code>cd /usr/sbin</code></strong>
                   2061: <code class="prompt">#</code> <strong class=
                   2062: "userinput"><code>mv pkg_add pkg_add.orig</code></strong>
                   2063: <code class="prompt">#</code> <strong class=
                   2064: "userinput"><code>mv pkg_create pkg_create.orig</code></strong>
                   2065: <code class="prompt">#</code> <strong class=
                   2066: "userinput"><code>mv pkg_delete pkg_delete.orig</code></strong>
                   2067: <code class="prompt">#</code> <strong class=
                   2068: "userinput"><code>mv pkg_info pkg_info.orig</code></strong>
1.1       grant    2069: </pre>
                   2070:                 </li>
                   2071: 
                   2072:                 <li>
1.14      xtraeme  2073:                   <p>An example <code class=
                   2074:                   "filename">/etc/mk.conf</code> file will be
                   2075:                   placed in <code class=
                   2076:                   "filename">/etc/mk.conf.example</code> file when
                   2077:                   you use the bootstrap script. OpenBSD's make
                   2078:                   program uses <code class=
                   2079:                   "filename">/etc/mk.conf</code> as well. You can
1.1       grant    2080:                   work around this by enclosing all the pkgsrc
                   2081:                   specific parts of the file with:</p>
                   2082:                   <pre class="programlisting">
                   2083: .ifdef BSD_PKG_MK
1.11      ben      2084: # pkgsrc stuff, e.g. insert defaults/mk.conf or similar here
1.1       grant    2085: .else
                   2086: # OpenBSD stuff
                   2087: .endif
                   2088: </pre>
                   2089:                 </li>
                   2090:               </ol>
                   2091:             </div>
                   2092:           </div>
                   2093: 
                   2094:           <div class="sect2" lang="en" xml:lang="en">
                   2095:             <div class="titlepage">
                   2096:               <div>
                   2097:                 <div>
1.18    ! xtraeme  2098:                   <h3 class="title"><a name="id2519292" id=
        !          2099:                   "id2519292"></a>3.2.6.&nbsp;Solaris</h3>
1.1       grant    2100:                 </div>
                   2101:               </div>
                   2102:             </div>
                   2103: 
                   2104:             <p>Solaris 2.6 through 9 are supported on both x86 and
                   2105:             sparc. You will need a working C compiler. Both gcc
                   2106:             2.95.3 and Sun WorkShop 5 have been tested.</p>
                   2107: 
                   2108:             <p>The following packages are required on Solaris 8 for
                   2109:             the bootstrap process and to build packages.</p>
                   2110: 
                   2111:             <div class="itemizedlist">
                   2112:               <ul type="disc">
                   2113:                 <li>
                   2114:                   <p>SUNWsprot</p>
                   2115:                 </li>
                   2116: 
                   2117:                 <li>
                   2118:                   <p>SUNWarc</p>
                   2119:                 </li>
                   2120: 
                   2121:                 <li>
                   2122:                   <p>SUNWbtool</p>
                   2123:                 </li>
                   2124: 
                   2125:                 <li>
                   2126:                   <p>SUNWtoo</p>
                   2127:                 </li>
                   2128: 
                   2129:                 <li>
                   2130:                   <p>SUNWlibm</p>
                   2131:                 </li>
                   2132:               </ul>
                   2133:             </div>
                   2134: 
                   2135:             <p>Please note the use of GNU binutils on Solaris is
                   2136:             <span class="emphasis"><em>not</em></span>
                   2137:             supported.</p>
                   2138: 
                   2139:             <div class="sect3" lang="en" xml:lang="en">
                   2140:               <div class="titlepage">
                   2141:                 <div>
                   2142:                   <div>
1.18    ! xtraeme  2143:                     <h4 class="title"><a name="id2519323" id=
        !          2144:                     "id2519323"></a>3.2.6.1.&nbsp;If you are using
1.1       grant    2145:                     gcc</h4>
                   2146:                   </div>
                   2147:                 </div>
                   2148:               </div>
                   2149: 
                   2150:               <p>It makes life much simpler if you only use the
                   2151:               same gcc consistently for building all packages.</p>
                   2152: 
                   2153:               <p>It is recommended that an external gcc be used
                   2154:               only for bootstrapping, then either build gcc from
                   2155:               <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   2156:               href=
                   2157:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/gcc/README.html"
1.14      xtraeme  2158:               class="pkgname">lang/gcc</a> or install a binary gcc
                   2159:               package, then remove gcc used during
                   2160:               bootstrapping.</p>
1.1       grant    2161: 
                   2162:               <p>Binary packages of gcc can be found through
                   2163:               <a href=
                   2164:               "http://www.sun.com/bigadmin/common/freewareSearch.html"
1.14      xtraeme  2165:               target=
                   2166:               "_top">http://www.sun.com/bigadmin/common/freewareSearch.html</a>.</p>
1.1       grant    2167:             </div>
                   2168: 
                   2169:             <div class="sect3" lang="en" xml:lang="en">
                   2170:               <div class="titlepage">
                   2171:                 <div>
                   2172:                   <div>
1.18    ! xtraeme  2173:                     <h4 class="title"><a name="id2519345" id=
        !          2174:                     "id2519345"></a>3.2.6.2.&nbsp;If you are using
1.1       grant    2175:                     Sun WorkShop</h4>
                   2176:                   </div>
                   2177:                 </div>
                   2178:               </div>
                   2179: 
                   2180:               <p>You will need at least the following packages
                   2181:               installed (from WorkShop 5.0)</p>
                   2182: 
                   2183:               <div class="itemizedlist">
                   2184:                 <ul type="disc">
                   2185:                   <li>
                   2186:                     <p>SPROcc - Sun WorkShop Compiler C 5.0</p>
                   2187:                   </li>
                   2188: 
                   2189:                   <li>
                   2190:                     <p>SPROcpl - Sun WorkShop Compiler C++ 5.0</p>
                   2191:                   </li>
                   2192: 
                   2193:                   <li>
                   2194:                     <p>SPROild - Sun WorkShop Incremental
                   2195:                     Linker</p>
                   2196:                   </li>
                   2197: 
                   2198:                   <li>
                   2199:                     <p>SPROlang - Sun WorkShop Compilers common
                   2200:                     components</p>
                   2201:                   </li>
                   2202:                 </ul>
                   2203:               </div>
                   2204: 
1.14      xtraeme  2205:               <p>You should set <code class="varname">CC</code>,
                   2206:               <code class="varname">CXX</code> and optionally,
                   2207:               <code class="varname">CPP</code> in <code class=
                   2208:               "filename">/etc/mk.conf</code>, eg.</p>
1.1       grant    2209:               <pre class="programlisting">
                   2210: CC=        cc
                   2211: CXX=    CC
                   2212: CPP=    /usr/ccs/lib/cpp
                   2213: </pre>
                   2214: 
                   2215:               <p>You may also want to build 64-bit binaries,
                   2216:               eg.</p>
                   2217:               <pre class="programlisting">
                   2218: CFLAGS= -xtarget=ultra -xarch=v9
                   2219: </pre>
                   2220: 
                   2221:               <p>Whichever compiler you use, please ensure the
                   2222:               compiler tools and your $prefix are in your
1.14      xtraeme  2223:               <code class="varname">PATH</code>. This includes
                   2224:               <code class="filename">/usr/ccs/{bin,lib}</code> and
                   2225:               eg. <code class=
                   2226:               "filename">/usr/pkg/{bin,sbin}</code>.</p>
1.1       grant    2227:             </div>
                   2228:           </div>
                   2229:         </div>
                   2230:       </div>
                   2231: 
                   2232:       <div class="chapter" lang="en" xml:lang="en">
                   2233:         <div class="titlepage">
                   2234:           <div>
                   2235:             <div>
                   2236:               <h2 class="title"><a name="using" id=
                   2237:               "using"></a>Chapter&nbsp;4.&nbsp;Using pkgsrc</h2>
                   2238:             </div>
                   2239:           </div>
                   2240:         </div>
                   2241: 
                   2242:         <div class="toc">
                   2243:           <p><b>Table of Contents</b></p>
                   2244: 
                   2245:           <dl>
                   2246:             <dt><span class="sect1"><a href="#getting-started">4.1.
                   2247:             Working with binary packages</a></span></dt>
                   2248: 
                   2249:             <dd>
                   2250:               <dl>
1.18    ! xtraeme  2251:                 <dt><span class="sect2"><a href="#id2519429">4.1.1.
1.1       grant    2252:                 Where to get binary packages</a></span></dt>
                   2253: 
1.18    ! xtraeme  2254:                 <dt><span class="sect2"><a href="#id2519469">4.1.2.
1.1       grant    2255:                 How to use binary packages</a></span></dt>
                   2256: 
1.18    ! xtraeme  2257:                 <dt><span class="sect2"><a href="#id2519604">4.1.3.
1.1       grant    2258:                 A word of warning</a></span></dt>
                   2259:               </dl>
                   2260:             </dd>
                   2261: 
1.18    ! xtraeme  2262:             <dt><span class="sect1"><a href="#id2519616">4.2.
1.1       grant    2263:             Building packages from source</a></span></dt>
                   2264: 
                   2265:             <dd>
                   2266:               <dl>
1.18    ! xtraeme  2267:                 <dt><span class="sect2"><a href="#id2519625">4.2.1.
1.1       grant    2268:                 Requirements</a></span></dt>
                   2269: 
1.18    ! xtraeme  2270:                 <dt><span class="sect2"><a href="#id2519645">4.2.2.
1.1       grant    2271:                 Fetching distfiles</a></span></dt>
                   2272: 
1.18    ! xtraeme  2273:                 <dt><span class="sect2"><a href="#id2519698">4.2.3.
1.1       grant    2274:                 How to build and install</a></span></dt>
                   2275: 
1.18    ! xtraeme  2276:                 <dt><span class="sect2"><a href="#id2520014">4.2.4.
1.1       grant    2277:                 Selecting the compiler</a></span></dt>
                   2278:               </dl>
                   2279:             </dd>
                   2280:           </dl>
                   2281:         </div>
                   2282: 
                   2283:         <div class="sect1" lang="en" xml:lang="en">
                   2284:           <div class="titlepage">
                   2285:             <div>
                   2286:               <div>
                   2287:                 <h2 class="title" style="clear: both"><a name=
                   2288:                 "getting-started" id=
                   2289:                 "getting-started"></a>4.1.&nbsp;Working with binary
                   2290:                 packages</h2>
                   2291:               </div>
                   2292:             </div>
                   2293:           </div>
                   2294: 
                   2295:           <p>This section describes how to find, retrieve and
                   2296:           install a precompiled binary package that someone else
                   2297:           already prepared for your type of machine.</p>
                   2298: 
                   2299:           <div class="sect2" lang="en" xml:lang="en">
                   2300:             <div class="titlepage">
                   2301:               <div>
                   2302:                 <div>
1.18    ! xtraeme  2303:                   <h3 class="title"><a name="id2519429" id=
        !          2304:                   "id2519429"></a>4.1.1.&nbsp;Where to get binary
1.1       grant    2305:                   packages</h3>
                   2306:                 </div>
                   2307:               </div>
                   2308:             </div>
                   2309: 
                   2310:             <p>Precompiled packages are stored on ftp.NetBSD.org
1.14      xtraeme  2311:             and its mirrors in the directory <code class=
                   2312:             "filename">/pub/NetBSD/packages</code> for anonymous
                   2313:             FTP access. Please pick the right subdirectory there as
                   2314:             indicated by <span><strong class="command">uname
                   2315:             -p</strong></span>. In that directory, there is a
1.1       grant    2316:             subdirectory for each category plus a subdirectory
1.14      xtraeme  2317:             <code class="filename">All</code> which includes the
                   2318:             actual binaries in <code class="filename">.tgz</code>
                   2319:             files. The category subdirectories use symbolic links
                   2320:             to those files (this is the same directory layout as in
                   2321:             <code class=
                   2322:             "filename">/usr/pkgsrc/packages</code>).</p>
1.1       grant    2323: 
                   2324:             <p>This same directory layout applies for CDROM
                   2325:             distributions, only that the directory may be rooted
1.14      xtraeme  2326:             somewhere else, probably somewhere below <code class=
                   2327:             "filename">/cdrom</code>. Please consult your CDROMs
1.1       grant    2328:             documentation for the exact location.</p>
                   2329:           </div>
                   2330: 
                   2331:           <div class="sect2" lang="en" xml:lang="en">
                   2332:             <div class="titlepage">
                   2333:               <div>
                   2334:                 <div>
1.18    ! xtraeme  2335:                   <h3 class="title"><a name="id2519469" id=
        !          2336:                   "id2519469"></a>4.1.2.&nbsp;How to use binary
1.1       grant    2337:                   packages</h3>
                   2338:                 </div>
                   2339:               </div>
                   2340:             </div>
                   2341: 
                   2342:             <p>If you have the files on a CDROM or downloaded them
                   2343:             to your hard disk, youcan install them with the
1.14      xtraeme  2344:             following command (be sure to<span><strong class=
                   2345:             "command">su</strong></span> to root first):</p>
1.1       grant    2346:             <pre class="screen">
1.14      xtraeme  2347: <code class="prompt">#</code> <strong class=
                   2348: "userinput"><code>pkg_add /path/to/package.tgz</code></strong>
1.1       grant    2349: </pre>
                   2350: 
                   2351:             <p>If you have FTP access and you don't want to
                   2352:             download the packages via FTP prior to installation,
1.14      xtraeme  2353:             you can do this automatically by giving
                   2354:             <span><strong class="command">pkg_add</strong></span>
                   2355:             an FTP URL:</p>
1.1       grant    2356:             <pre class="screen">
1.14      xtraeme  2357: <code class="prompt">#</code> <strong class=
                   2358: "userinput"><code>pkg_add ftp://ftp.NetBSD.org/pub/NetBSD/packages/&lt;OSvers&gt;/&lt;arch&gt;/All/package.tgz</code></strong>
1.1       grant    2359: </pre>
                   2360: 
                   2361:             <p>If there is any doubt, the uname utility can be used
                   2362:             to determine the &lt;OSvers&gt;, and &lt;arch&gt; by
1.14      xtraeme  2363:             running <span><strong class="command">uname
                   2364:             -rp</strong></span>.</p>
1.1       grant    2365: 
                   2366:             <p>Also note that any prerequisite packages needed to
                   2367:             run the package in question will be installed, too,
                   2368:             assuming they are present where you install from.</p>
                   2369: 
                   2370:             <p>After you've installed packages, be sure to have
1.14      xtraeme  2371:             <code class="filename">/usr/pkg/bin</code> in your
                   2372:             <code class="varname">PATH</code> so you can actually
                   2373:             start the just installed program.</p>
1.1       grant    2374:           </div>
                   2375: 
                   2376:           <div class="sect2" lang="en" xml:lang="en">
                   2377:             <div class="titlepage">
                   2378:               <div>
                   2379:                 <div>
1.18    ! xtraeme  2380:                   <h3 class="title"><a name="id2519604" id=
        !          2381:                   "id2519604"></a>4.1.3.&nbsp;A word of
1.1       grant    2382:                   warning</h3>
                   2383:                 </div>
                   2384:               </div>
                   2385:             </div>
                   2386: 
                   2387:             <p>Please pay very careful attention to the warnings
                   2388:             expressed in the <a href=
                   2389:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2390:             <span class="citerefentry"><span class=
                   2391:             "refentrytitle">pkg_add</span>(1)</span></a> manual
                   2392:             page about the inherent dangers of installing binary
                   2393:             packages which you did not create yourself, and the
                   2394:             security holes that can be introduced onto your system
                   2395:             by indiscriminate adding of such files.</p>
                   2396:           </div>
                   2397:         </div>
                   2398: 
                   2399:         <div class="sect1" lang="en" xml:lang="en">
                   2400:           <div class="titlepage">
                   2401:             <div>
                   2402:               <div>
                   2403:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  2404:                 "id2519616" id="id2519616"></a>4.2.&nbsp;Building
1.1       grant    2405:                 packages from source</h2>
                   2406:               </div>
                   2407:             </div>
                   2408:           </div>
                   2409: 
                   2410:           <p>This assumes that the package is already in pkgsrc. If
                   2411:           it is not, see <a href="#developers-guide" title=
1.2       hubertf  2412:           "Part&nbsp;II.&nbsp;The pkgsrc developer's guide">Part&nbsp;II,
                   2413:           &#8220;The pkgsrc developer's guide&#8221;</a>.</p>
1.1       grant    2414: 
                   2415:           <div class="sect2" lang="en" xml:lang="en">
                   2416:             <div class="titlepage">
                   2417:               <div>
                   2418:                 <div>
1.18    ! xtraeme  2419:                   <h3 class="title"><a name="id2519625" id=
        !          2420:                   "id2519625"></a>4.2.1.&nbsp;Requirements</h3>
1.1       grant    2421:                 </div>
                   2422:               </div>
                   2423:             </div>
                   2424: 
                   2425:             <p>To build packages from source on a NetBSD system the
                   2426:             &#8220;<span class="quote">comp</span>&#8221; and the
                   2427:             &#8220;<span class="quote">text</span>&#8221;
                   2428:             distribution sets must be installed. If you want to
                   2429:             build X11 related packages the &#8220;<span class=
                   2430:             "quote">xbase</span>&#8221; and &#8220;<span class=
                   2431:             "quote">xcomp</span>&#8221; distribution sets are
                   2432:             required, too.</p>
                   2433:           </div>
                   2434: 
                   2435:           <div class="sect2" lang="en" xml:lang="en">
                   2436:             <div class="titlepage">
                   2437:               <div>
                   2438:                 <div>
1.18    ! xtraeme  2439:                   <h3 class="title"><a name="id2519645" id=
        !          2440:                   "id2519645"></a>4.2.2.&nbsp;Fetching
1.1       grant    2441:                   distfiles</h3>
                   2442:                 </div>
                   2443:               </div>
                   2444:             </div>
                   2445: 
                   2446:             <p>The distfile (i.e. the unmodified source) must exist
                   2447:             on your system for the packages system to be able to
                   2448:             build it. If it does not exist, pkgsrc will use
                   2449:             <a href="http://netbsd.gw.com/cgi-bin/man-cgi?ftp+1+NetBSD-current">
                   2450:             <span class="citerefentry"><span class=
                   2451:             "refentrytitle">ftp</span>(1)</span></a> to fetch it
                   2452:             automatically.</p>
                   2453: 
                   2454:             <p>You can overwrite some of the major distribution
                   2455:             sites to fit to sites that are close to your own. Have
1.14      xtraeme  2456:             a look at <code class=
                   2457:             "filename">pkgsrc/mk/defaults/mk.conf</code> to find
                   2458:             some examples - in particular, look for the
                   2459:             <code class="varname">MASTER_SORT</code>, <code class=
                   2460:             "varname">MASTER_SORT_REGEX</code> and <code class=
                   2461:             "varname">INET_COUNTRY</code> definitions. This may
                   2462:             save some of your bandwidth and time.</p>
1.1       grant    2463: 
                   2464:             <p>You can change these settings either in your shell's
                   2465:             environment, or, if you want to keep the settings, by
1.14      xtraeme  2466:             editing the <code class="filename">/etc/mk.conf</code>
1.1       grant    2467:             file, and adding the definitions there.</p>
                   2468: 
                   2469:             <p>If you don't have a permanent Internet connection
                   2470:             and you want to know which files to download,
1.14      xtraeme  2471:             <span><strong class="command">make
                   2472:             fetch-list</strong></span> will tell you what you'll
                   2473:             need. Put these distfiles into <code class=
                   2474:             "filename">/usr/pkgsrc/distfiles</code>.</p>
1.1       grant    2475:           </div>
                   2476: 
                   2477:           <div class="sect2" lang="en" xml:lang="en">
                   2478:             <div class="titlepage">
                   2479:               <div>
                   2480:                 <div>
1.18    ! xtraeme  2481:                   <h3 class="title"><a name="id2519698" id=
        !          2482:                   "id2519698"></a>4.2.3.&nbsp;How to build and
1.1       grant    2483:                   install</h3>
                   2484:                 </div>
                   2485:               </div>
                   2486:             </div>
                   2487: 
                   2488:             <p>Assuming that the distfile has been fetched (see
                   2489:             previous section), become root and change into the
1.14      xtraeme  2490:             relevant directory and running <span><strong class=
                   2491:             "command">make</strong></span>. For example, type</p>
1.1       grant    2492:             <pre class="screen">
1.14      xtraeme  2493: <code class="prompt">%</code> <strong class=
                   2494: "userinput"><code>cd misc/figlet</code></strong>
                   2495: <code class="prompt">%</code> <strong class=
                   2496: "userinput"><code>make</code></strong>
1.1       grant    2497: </pre>
                   2498: 
                   2499:             <p>at the shell prompt to build the various components
                   2500:             of the package, and</p>
                   2501:             <pre class="screen">
1.14      xtraeme  2502: <code class="prompt">#</code> <strong class=
                   2503: "userinput"><code>make install</code></strong>
1.1       grant    2504: </pre>
                   2505: 
                   2506:             <p>to install the various components into the correct
                   2507:             places on your system. Installing the package on your
                   2508:             system requires you to be root. However, pkgsrc has a
                   2509:             <span class="emphasis"><em>just-in-time-su</em></span>
                   2510:             feature, which allows you to only become root for the
                   2511:             actual installation step</p>
                   2512: 
                   2513:             <p>Taking the figlet utility as an example, we can
                   2514:             install it on our system by building as shown in
                   2515:             <a href="#logs" title=
                   2516:             "Appendix&nbsp;B.&nbsp;Build logs">Appendix B, <i>Build
                   2517:             logs</i></a>.</p>
                   2518: 
                   2519:             <p>The program is installed under the default root of
1.14      xtraeme  2520:             the packages tree - <code class=
                   2521:             "filename">/usr/pkg</code>. Should this not conform to
                   2522:             your tastes, set the <code class=
                   2523:             "varname">LOCALBASE</code> variable in your
1.1       grant    2524:             environment, and it will use that value as the root of
1.14      xtraeme  2525:             your packages tree. So, to use <code class=
                   2526:             "filename">/usr/local</code>, set <code class=
                   2527:             "varname">LOCALBASE=/usr/local</code> in your
1.1       grant    2528:             environment. Please note that you should use a
                   2529:             directory which is dedicated to packages and not shared
1.14      xtraeme  2530:             with other programs (ie, do not try and use
                   2531:             <code class="varname">LOCALBASE=/usr</code>). Also, you
                   2532:             should not try to add any of your own files or
                   2533:             directories (such as <code class=
                   2534:             "filename">src/</code>, <code class=
                   2535:             "filename">obj/</code>, or <code class=
                   2536:             "filename">pkgsrc/</code>) below the <code class=
                   2537:             "varname">LOCALBASE</code> tree. This is to prevent
1.1       grant    2538:             possible conflicts between programs and other files
                   2539:             installed by the package system and whatever else may
                   2540:             have been installed there.</p>
                   2541: 
1.14      xtraeme  2542:             <p>Some packages look in <code class=
                   2543:             "filename">/etc/mk.conf</code> to alter some
1.1       grant    2544:             configuration options at build time. Have a look at
1.14      xtraeme  2545:             <code class=
                   2546:             "filename">pkgsrc/mk/defaults/mk.conf</code> to get an
                   2547:             overview of what will be set there by default.
                   2548:             Environment variables such as <code class=
                   2549:             "varname">LOCALBASE</code> can be set in <code class=
                   2550:             "filename">/etc/mk.conf</code> to save having to
                   2551:             remember to set them each time you want to use
                   2552:             pkgsrc.</p>
1.1       grant    2553: 
                   2554:             <p>Occasionally, people want to &#8220;<span class=
                   2555:             "quote">look under the covers</span>&#8221; to see what
                   2556:             is going on when a package is building or being
                   2557:             installed. This may be for debugging purposes, or out
                   2558:             of simple curiosity. A number of utility values have
                   2559:             been added to help with this.</p>
                   2560: 
                   2561:             <div class="orderedlist">
                   2562:               <ol type="1">
                   2563:                 <li>
                   2564:                   <p>If you invoke the <a href=
                   2565:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2566:                   <span class="citerefentry"><span class=
                   2567:                   "refentrytitle">make</span>(1)</span></a> command
1.14      xtraeme  2568:                   with <code class=
                   2569:                   "varname">PKG_DEBUG_LEVEL=2</code>, then a huge
                   2570:                   amount of information will be displayed. For
                   2571:                   example,</p>
1.1       grant    2572:                   <pre class="screen">
1.14      xtraeme  2573: <strong class=
                   2574: "userinput"><code>make patch PKG_DEBUG_LEVEL=2</code></strong>
1.1       grant    2575: </pre>
                   2576: 
                   2577:                   <p>will show all the commands that are invoked,
                   2578:                   up to and including the &#8220;<span class=
                   2579:                   "quote">patch</span>&#8221; stage.</p>
                   2580:                 </li>
                   2581: 
                   2582:                 <li>
                   2583:                   <p>If you want to know the value of a certain
1.14      xtraeme  2584:                   make(1) definition, then the <code class=
                   2585:                   "varname">VARNAME</code> definition should be
                   2586:                   used, in conjunction with the show-var target.
                   2587:                   e.g. to show the expansion of the <a href=
1.1       grant    2588:                   "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   2589:                   <span class="citerefentry"><span class=
                   2590:                   "refentrytitle">make</span>(1)</span></a>
1.14      xtraeme  2591:                   variable <code class=
                   2592:                   "varname">DISTFILES</code>:</p>
1.1       grant    2593:                   <pre class="screen">
1.14      xtraeme  2594: <code class="prompt">%</code> <strong class=
                   2595: "userinput"><code>make show-var VARNAME=LOCALBASE</code></strong>
1.1       grant    2596: /usr/pkg
1.14      xtraeme  2597: <code class="prompt">%</code>
1.1       grant    2598:           
                   2599: </pre>
                   2600:                 </li>
                   2601:               </ol>
                   2602:             </div>
                   2603: 
                   2604:             <p>If you want to install a binary package that you've
                   2605:             either created yourself (see next section), that you
                   2606:             put into pkgsrc/packages manually or that is located on
1.8       wiz      2607:             a remote FTP server, you can use the "bin-install"
1.1       grant    2608:             target. This target will install a binary package - if
                   2609:             available - via <a href=
                   2610:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2611:             <span class="citerefentry"><span class=
                   2612:             "refentrytitle">pkg_add</span>(1)</span></a>, else do a
1.14      xtraeme  2613:             <span><strong class="command">make
                   2614:             package</strong></span>. The list of remote FTP sites
                   2615:             searched is kept in the variable <code class=
                   2616:             "varname">BINPKG_SITES</code>, which defaults to
                   2617:             ftp.NetBSD.org. Any flags that should be added to
                   2618:             <a href=
1.1       grant    2619:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2620:             <span class="citerefentry"><span class=
                   2621:             "refentrytitle">pkg_add</span>(1)</span></a> can be put
1.14      xtraeme  2622:             into <code class="varname">BIN_INSTALL_FLAGS</code>.
                   2623:             See <code class=
                   2624:             "filename">pkgsrc/mk/defaults/mk.conf</code> for more
                   2625:             details.</p>
1.1       grant    2626: 
                   2627:             <p>A final word of warning: If you setup a system that
1.14      xtraeme  2628:             has a non-standard setting for <code class=
                   2629:             "varname">LOCALBASE</code>, be sure to set that before
1.1       grant    2630:             any packages are installed, as you can not use several
                   2631:             directories for the same purpose. Doing so will result
                   2632:             in pkgsrc not being able to properly detect your
                   2633:             installed packages, and fail miserably. Note also that
                   2634:             precompiled binary packages are usually built with the
1.14      xtraeme  2635:             default <code class="varname">LOCALBASE</code> of
                   2636:             <code class="filename">/usr/pkg</code>, and that you
                   2637:             should <span class="emphasis"><em>not</em></span>
                   2638:             install any if you use a non-standard <code class=
                   2639:             "varname">LOCALBASE</code>.</p>
1.1       grant    2640:           </div>
                   2641: 
                   2642:           <div class="sect2" lang="en" xml:lang="en">
                   2643:             <div class="titlepage">
                   2644:               <div>
                   2645:                 <div>
1.18    ! xtraeme  2646:                   <h3 class="title"><a name="id2520014" id=
        !          2647:                   "id2520014"></a>4.2.4.&nbsp;Selecting the
1.1       grant    2648:                   compiler</h3>
                   2649:                 </div>
                   2650:               </div>
                   2651:             </div>
                   2652: 
                   2653:             <p>By default, pkgsrc will use GCC to build packages.
                   2654:             This may be overridden by setting the following
                   2655:             variables in /etc/mk.conf:</p>
                   2656: 
                   2657:             <div class="variablelist">
                   2658:               <dl>
1.14      xtraeme  2659:                 <dt><span class="term"><code class=
                   2660:                 "varname">PKGSRC_COMPILER</code>:</span></dt>
1.1       grant    2661: 
                   2662:                 <dd>
                   2663:                   <p>This is a list of values specifying the chain
                   2664:                   of compilers to invoke when building packages.
                   2665:                   Valid values are:</p>
                   2666: 
                   2667:                   <div class="itemizedlist">
                   2668:                     <ul type="disc">
                   2669:                       <li>
1.14      xtraeme  2670:                         <p><code class="varname">distcc</code>:
1.1       grant    2671:                         distributed C/C++ (chainable)</p>
                   2672:                       </li>
                   2673: 
                   2674:                       <li>
1.14      xtraeme  2675:                         <p><code class="varname">ccache</code>:
1.1       grant    2676:                         compiler cache (chainable)</p>
                   2677:                       </li>
                   2678: 
                   2679:                       <li>
1.14      xtraeme  2680:                         <p><code class="varname">gcc</code>: GNU
                   2681:                         C/C++ Compiler</p>
1.1       grant    2682:                       </li>
                   2683: 
                   2684:                       <li>
1.14      xtraeme  2685:                         <p><code class="varname">mipspro</code>:
1.1       grant    2686:                         Silicon Graphics, Inc. MIPSpro
                   2687:                         (n32/n64)</p>
                   2688:                       </li>
                   2689: 
                   2690:                       <li>
1.14      xtraeme  2691:                         <p><code class="varname">mipspro</code>:
1.1       grant    2692:                         Silicon Graphics, Inc. MIPSpro (o32)</p>
                   2693:                       </li>
                   2694: 
                   2695:                       <li>
1.14      xtraeme  2696:                         <p><code class="varname">sunpro</code>:
1.1       grant    2697:                         Microsystems, Inc. WorkShip/Forte/Sun ONE
                   2698:                         Studio</p>
                   2699:                       </li>
                   2700:                     </ul>
                   2701:                   </div>
                   2702: 
                   2703:                   <p>The default is &#8220;<span class=
1.14      xtraeme  2704:                   "quote"><code class=
                   2705:                   "varname">gcc</code></span>&#8221;. You can use
                   2706:                   <code class="varname">ccache</code> and/or
                   2707:                   <code class="varname">distcc</code> with an
                   2708:                   appropriate <code class=
                   2709:                   "varname">PKGSRC_COMPILER</code> setting, e.g.
                   2710:                   &#8220;<span class="quote"><code class=
                   2711:                   "varname">ccache gcc</code></span>&#8221;. This
1.1       grant    2712:                   variable should always be terminated with a value
                   2713:                   for a real compiler.</p>
                   2714:                 </dd>
                   2715: 
1.14      xtraeme  2716:                 <dt><span class="term"><code class=
                   2717:                 "varname">GCC_REQD</code>:</span></dt>
1.1       grant    2718: 
                   2719:                 <dd>
                   2720:                   <p>This specifies the minimum version of GCC to
                   2721:                   use when building packages. If the system GCC
                   2722:                   doesn't satisfy this requirement, then pkgsrc
                   2723:                   will build and install one of the GCC packages to
                   2724:                   use instead.</p>
                   2725:                 </dd>
                   2726:               </dl>
                   2727:             </div>
                   2728:           </div>
                   2729:         </div>
                   2730:       </div>
                   2731: 
                   2732:       <div class="chapter" lang="en" xml:lang="en">
                   2733:         <div class="titlepage">
                   2734:           <div>
                   2735:             <div>
                   2736:               <h2 class="title"><a name="binary" id=
                   2737:               "binary"></a>Chapter&nbsp;5.&nbsp;Creating binary
                   2738:               packages</h2>
                   2739:             </div>
                   2740:           </div>
                   2741:         </div>
                   2742: 
                   2743:         <div class="toc">
                   2744:           <p><b>Table of Contents</b></p>
                   2745: 
                   2746:           <dl>
1.18    ! xtraeme  2747:             <dt><span class="sect1"><a href="#id2520101">5.1.
1.1       grant    2748:             Building a single binary package</a></span></dt>
                   2749: 
1.18    ! xtraeme  2750:             <dt><span class="sect1"><a href="#id2520247">5.2.
1.1       grant    2751:             Settings for creation of binary
                   2752:             packages</a></span></dt>
                   2753: 
                   2754:             <dt><span class="sect1"><a href="#bulkbuild">5.3. Doing
                   2755:             a bulk build of all packages</a></span></dt>
                   2756: 
                   2757:             <dd>
                   2758:               <dl>
                   2759:                 <dt><span class="sect2"><a href=
                   2760:                 "#binary.configuration">5.3.1.
                   2761:                 Configuration</a></span></dt>
                   2762: 
1.18    ! xtraeme  2763:                 <dt><span class="sect2"><a href="#id2520865">5.3.2.
1.1       grant    2764:                 Other environmental considerations</a></span></dt>
                   2765: 
1.18    ! xtraeme  2766:                 <dt><span class="sect2"><a href="#id2585963">5.3.3.
1.1       grant    2767:                 Operation</a></span></dt>
                   2768: 
1.18    ! xtraeme  2769:                 <dt><span class="sect2"><a href="#id2586101">5.3.4.
1.1       grant    2770:                 What it does</a></span></dt>
                   2771: 
1.18    ! xtraeme  2772:                 <dt><span class="sect2"><a href="#id2586157">5.3.5.
1.1       grant    2773:                 Disk space requirements</a></span></dt>
                   2774: 
1.18    ! xtraeme  2775:                 <dt><span class="sect2"><a href="#id2586184">5.3.6.
1.1       grant    2776:                 Setting up a sandbox for chroot'ed
                   2777:                 builds</a></span></dt>
                   2778: 
1.18    ! xtraeme  2779:                 <dt><span class="sect2"><a href="#id2586645">5.3.7.
1.1       grant    2780:                 Building a partial set of packages</a></span></dt>
1.13      hubertf  2781: 
                   2782:                 <dt><span class="sect2"><a href=
                   2783:                 "#bulk-upload">5.3.8. Uploading results of a bulk
                   2784:                 build</a></span></dt>
1.1       grant    2785:               </dl>
                   2786:             </dd>
                   2787: 
1.18    ! xtraeme  2788:             <dt><span class="sect1"><a href="#id2587082">5.4.
1.1       grant    2789:             Creating a multiple CD-ROM packages
                   2790:             collection</a></span></dt>
                   2791: 
                   2792:             <dd>
                   2793:               <dl>
1.18    ! xtraeme  2794:                 <dt><span class="sect2"><a href="#id2587097">5.4.1.
1.1       grant    2795:                 Example of cdpack</a></span></dt>
                   2796:               </dl>
                   2797:             </dd>
                   2798:           </dl>
                   2799:         </div>
                   2800: 
                   2801:         <div class="sect1" lang="en" xml:lang="en">
                   2802:           <div class="titlepage">
                   2803:             <div>
                   2804:               <div>
                   2805:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  2806:                 "id2520101" id="id2520101"></a>5.1.&nbsp;Building a
1.1       grant    2807:                 single binary package</h2>
                   2808:               </div>
                   2809:             </div>
                   2810:           </div>
                   2811: 
                   2812:           <p>Once you have built and installed a package, you can
                   2813:           create a <span class="emphasis"><em>binary
                   2814:           package</em></span> which can be installed on another
                   2815:           system with <a href=
                   2816:           "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   2817:           <span class="citerefentry"><span class=
                   2818:           "refentrytitle">pkg_add</span>(1)</span></a> This saves
                   2819:           having to build the same package on a group of hosts and
                   2820:           wasting CPU time. It also provides a simple means for
                   2821:           others to install your package, should you distribute
                   2822:           it.</p>
                   2823: 
                   2824:           <p>To create a binary package, change into the
1.14      xtraeme  2825:           appropriate directory in pkgsrc, and run
                   2826:           <span><strong class="command">make
                   2827:           package</strong></span>:</p>
1.1       grant    2828:           <pre class="screen">
1.14      xtraeme  2829: <code class="prompt">#</code> <strong class=
                   2830: "userinput"><code>cd misc/figlet</code></strong>
                   2831: <code class="prompt">#</code> <strong class=
                   2832: "userinput"><code>make package</code></strong>
1.1       grant    2833: </pre>
                   2834: 
                   2835:           <p>This will build and install your package (if not
                   2836:           already done), and then build a binary package from what
1.14      xtraeme  2837:           was installed. You can then use the <span><strong class=
                   2838:           "command">pkg_*</strong></span> tools to manipulate it.
                   2839:           Binary packages are created by default in <code class=
                   2840:           "filename">/usr/pkgsrc/packages</code>, in the form of a
1.1       grant    2841:           gzipped tar file. See <a href="#logs.package" title=
                   2842:           "B.2.&nbsp;Packaging figlet">Section B.2,
                   2843:           &#8220;Packaging figlet&#8221;</a> for a continuation of
                   2844:           the above <a xmlns=
                   2845:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   2846:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/misc/figlet/README.html"
1.14      xtraeme  2847:           class="pkgname">misc/figlet</a> example.</p>
1.1       grant    2848: 
                   2849:           <p>See <a href="#submit" title=
                   2850:           "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter
                   2851:           14, <i>Submitting and Committing</i></a> for information
                   2852:           on how to submit such a binary package.</p>
                   2853:         </div>
                   2854: 
                   2855:         <div class="sect1" lang="en" xml:lang="en">
                   2856:           <div class="titlepage">
                   2857:             <div>
                   2858:               <div>
                   2859:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  2860:                 "id2520247" id="id2520247"></a>5.2.&nbsp;Settings
1.1       grant    2861:                 for creation of binary packages</h2>
                   2862:               </div>
                   2863:             </div>
                   2864:           </div>
                   2865: 
                   2866:           <p>See <a href="#build.helpful-targets" title=
                   2867:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   2868:           &#8220;Other helpful targets&#8221;</a>.</p>
                   2869:         </div>
                   2870: 
                   2871:         <div class="sect1" lang="en" xml:lang="en">
                   2872:           <div class="titlepage">
                   2873:             <div>
                   2874:               <div>
                   2875:                 <h2 class="title" style="clear: both"><a name=
                   2876:                 "bulkbuild" id="bulkbuild"></a>5.3.&nbsp;Doing a
                   2877:                 bulk build of all packages</h2>
                   2878:               </div>
                   2879:             </div>
                   2880:           </div>
                   2881: 
                   2882:           <p>If you want to get a full set of precompiled binary
                   2883:           packages, this section describes how to get them. Beware
                   2884:           that the bulk build will remove all currently installed
                   2885:           packages from your system! Having a FTP server configured
                   2886:           either on the machine doing the bulk builds or on a
                   2887:           nearby NFS server can help to make the packages available
                   2888:           to everyone. See <a href=
                   2889:           "http://netbsd.gw.com/cgi-bin/man-cgi?ftpd+8+NetBSD-current">
                   2890:           <span class="citerefentry"><span class=
                   2891:           "refentrytitle">ftpd</span>(8)</span></a> for more
                   2892:           information. If you use a remote NFS server's storage, be
                   2893:           sure to not actually compile on NFS storage, as this
                   2894:           slows things down a lot.</p>
                   2895: 
                   2896:           <div class="sect2" lang="en" xml:lang="en">
                   2897:             <div class="titlepage">
                   2898:               <div>
                   2899:                 <div>
                   2900:                   <h3 class="title"><a name="binary.configuration"
                   2901:                   id=
                   2902:                   "binary.configuration"></a>5.3.1.&nbsp;Configuration</h3>
                   2903:                 </div>
                   2904:               </div>
                   2905:             </div>
                   2906: 
                   2907:             <div class="sect3" lang="en" xml:lang="en">
                   2908:               <div class="titlepage">
                   2909:                 <div>
                   2910:                   <div>
                   2911:                     <h4 class="title"><a name="binary.mk.conf" id=
                   2912:                     "binary.mk.conf"></a>5.3.1.1.&nbsp;/etc/mk.conf</h4>
                   2913:                   </div>
                   2914:                 </div>
                   2915:               </div>
                   2916: 
1.14      xtraeme  2917:               <p>You may want to set things in <code class=
                   2918:               "filename">/etc/mk.conf</code>. Look at <code class=
                   2919:               "filename">pkgsrc/mk/defaults/mk.conf</code> for
1.1       grant    2920:               details of the default settings. You will want to
1.14      xtraeme  2921:               ensure that <code class=
                   2922:               "varname">ACCEPTABLE_LICENSES</code> meet your local
                   2923:               policy. As used in this example, <code class=
                   2924:               "varname">_ACCEPTABLE=yes</code> accepts <span class=
1.1       grant    2925:               "emphasis"><em>all</em></span> licenses.</p>
                   2926:               <pre class="programlisting">
                   2927: PACKAGES?=      ${_PKGSRCDIR}/packages/${MACHINE_ARCH}
                   2928: WRKOBJDIR?=     /usr/tmp/pkgsrc   # build here instead of in pkgsrc
                   2929: BSDSRCDIR=      /usr/src
                   2930: BSDXSRCDIR=     /usr/xsrc         # for x11/xservers
                   2931: OBJHOSTNAME?=   yes               # use work.`hostname`
                   2932: FAILOVER_FETCH= yes               # insist on the correct checksum
                   2933: PKG_DEVELOPER?= yes
                   2934: _ACCEPTABLE=    yes
                   2935: </pre>
                   2936:             </div>
                   2937: 
                   2938:             <div class="sect3" lang="en" xml:lang="en">
                   2939:               <div class="titlepage">
                   2940:                 <div>
                   2941:                   <div>
1.18    ! xtraeme  2942:                     <h4 class="title"><a name="id2520721" id=
        !          2943:                     "id2520721"></a>5.3.1.2.&nbsp;<code class=
1.14      xtraeme  2944:                     "filename">build.conf</code></h4>
1.1       grant    2945:                   </div>
                   2946:                 </div>
                   2947:               </div>
                   2948: 
1.14      xtraeme  2949:               <p>In <code class="filename">pkgsrc/mk/bulk</code>,
                   2950:               copy <code class="filename">build.conf-example</code>
                   2951:               to <code class="filename">build.conf</code> and edit
                   2952:               it, following the comments in that file. This is the
1.1       grant    2953:               config file that determines where log files are
                   2954:               generated after the build, where to mail the build
                   2955:               report to, where your pkgsrc tree is located and
                   2956:               which user to <a href=
                   2957:               "http://netbsd.gw.com/cgi-bin/man-cgi?su+8+NetBSD-current">
                   2958:               <span class="citerefentry"><span class=
                   2959:               "refentrytitle">su</span>(8)</span></a> to to do a
1.14      xtraeme  2960:               <span><strong class="command">cvs
                   2961:               update</strong></span>.</p>
1.1       grant    2962:             </div>
                   2963: 
                   2964:             <div class="sect3" lang="en" xml:lang="en">
                   2965:               <div class="titlepage">
                   2966:                 <div>
                   2967:                   <div>
1.18    ! xtraeme  2968:                     <h4 class="title"><a name="id2520825" id=
        !          2969:                     "id2520825"></a>5.3.1.3.&nbsp;<code class=
1.14      xtraeme  2970:                     "filename">pre-build.local</code></h4>
1.1       grant    2971:                   </div>
                   2972:                 </div>
                   2973:               </div>
                   2974: 
                   2975:               <p>It is possible to configure the bulk build to
                   2976:               perform certain site specific tasks at the end of the
1.14      xtraeme  2977:               pre-build stage. If the file <code class=
                   2978:               "filename">pre-build.local</code> exists in
                   2979:               <code class="filename">/usr/pkgsrc/mk/bulk</code> it
                   2980:               will be executed (as a sh(1) script) at the end of
                   2981:               the usual pre-build stage. An example use of
                   2982:               <code class="filename">pre-build.local</code> is to
                   2983:               have the line:</p>
1.1       grant    2984:               <pre class="screen">
1.14      xtraeme  2985: <code class="prompt">#</code> <strong class=
                   2986: "userinput"><code>echo "I do not have enough disk space to build this pig." \
                   2987:     &gt; pkgsrc/games/crafty-book-enormous/$BROKENF</code></strong>
1.1       grant    2988: </pre>
                   2989: 
                   2990:               <p>to prevent the system from trying to build a
                   2991:               particular package which requires nearly 3 GB of disk
                   2992:               space.</p>
                   2993:             </div>
                   2994:           </div>
                   2995: 
                   2996:           <div class="sect2" lang="en" xml:lang="en">
                   2997:             <div class="titlepage">
                   2998:               <div>
                   2999:                 <div>
1.18    ! xtraeme  3000:                   <h3 class="title"><a name="id2520865" id=
        !          3001:                   "id2520865"></a>5.3.2.&nbsp;Other environmental
1.1       grant    3002:                   considerations</h3>
                   3003:                 </div>
                   3004:               </div>
                   3005:             </div>
                   3006: 
1.14      xtraeme  3007:             <p>As <code class="filename">/usr/pkg</code> will be
1.1       grant    3008:             completely deleted at the start of bulk builds, make
                   3009:             sure your login shell is placed somewhere else. Either
1.14      xtraeme  3010:             drop it into <code class=
                   3011:             "filename">/usr/local/bin</code> (and adjust your login
                   3012:             shell in the passwd file), or (re-)install it via
                   3013:             <a href=
1.1       grant    3014:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3015:             <span class="citerefentry"><span class=
                   3016:             "refentrytitle">pkg_add</span>(1)</span></a> from
1.14      xtraeme  3017:             <code class="filename">/etc/rc.local</code>, so you can
1.1       grant    3018:             login after a reboot (remember that your current
                   3019:             process won't die if the package is removed, you just
                   3020:             can't start any new instances of the shell any more).
                   3021:             Also, if you use NetBSD earlier than 1.5, or you still
                   3022:             want to use the pkgsrc version of ssh for some reason,
                   3023:             be sure to install ssh before starting it from
1.14      xtraeme  3024:             <code class="filename">rc.local</code>:</p>
1.1       grant    3025:             <pre class="programlisting">
                   3026: ( cd /usr/pkgsrc/security/ssh ; make bulk-install )
                   3027: if [ -f /usr/pkg/etc/rc.d/sshd ]; then
                   3028:     /usr/pkg/etc/rc.d/sshd
                   3029: fi
                   3030: </pre>
                   3031: 
                   3032:             <p>Not doing so will result in you being not able to
                   3033:             log in via ssh after the bulk build is finished or if
                   3034:             the machine gets rebooted or crashes. You have been
                   3035:             warned! :)</p>
                   3036:           </div>
                   3037: 
                   3038:           <div class="sect2" lang="en" xml:lang="en">
                   3039:             <div class="titlepage">
                   3040:               <div>
                   3041:                 <div>
1.18    ! xtraeme  3042:                   <h3 class="title"><a name="id2585963" id=
        !          3043:                   "id2585963"></a>5.3.3.&nbsp;Operation</h3>
1.1       grant    3044:                 </div>
                   3045:               </div>
                   3046:             </div>
                   3047: 
                   3048:             <p>Make sure you don't need any of the packages still
                   3049:             installed.</p>
                   3050: 
                   3051:             <div class="warning" style=
                   3052:             "margin-left: 0.5in; margin-right: 0.5in;">
                   3053:               <h3 class="title">Warning</h3>
                   3054: 
                   3055:               <p>During the bulk build, <span class=
                   3056:               "emphasis"><em>all packages will be
                   3057:               removed!</em></span></p>
                   3058:             </div>
                   3059: 
                   3060:             <p>Be sure to remove all other things that might
                   3061:             interfere with builds, like some libs installed in
1.14      xtraeme  3062:             <code class="filename">/usr/local</code>, etc. then
                   3063:             become root and type:</p>
1.1       grant    3064:             <pre class="screen">
1.14      xtraeme  3065: <code class="prompt">#</code> <strong class=
                   3066: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   3067: <code class="prompt">#</code> <strong class=
                   3068: "userinput"><code>sh mk/bulk/build</code></strong>
1.1       grant    3069: </pre>
                   3070: 
                   3071:             <p>If for some reason your last build didn't complete
                   3072:             (power failure, system panic, ...), you can continue it
                   3073:             by running:</p>
                   3074:             <pre class="screen">
1.14      xtraeme  3075: <code class="prompt">#</code> <strong class=
                   3076: "userinput"><code>sh mk/bulk/build restart</code></strong>
1.1       grant    3077: </pre>
                   3078: 
                   3079:             <p>At the end of the bulk build, you will get a summary
                   3080:             via mail, and find build logs in the directory
1.14      xtraeme  3081:             specified by <code class="varname">FTP</code> in the
                   3082:             <code class="filename">build.conf</code> file.</p>
1.1       grant    3083:           </div>
                   3084: 
                   3085:           <div class="sect2" lang="en" xml:lang="en">
                   3086:             <div class="titlepage">
                   3087:               <div>
                   3088:                 <div>
1.18    ! xtraeme  3089:                   <h3 class="title"><a name="id2586101" id=
        !          3090:                   "id2586101"></a>5.3.4.&nbsp;What it does</h3>
1.1       grant    3091:                 </div>
                   3092:               </div>
                   3093:             </div>
                   3094: 
                   3095:             <p>The bulk builds consist of three steps:</p>
                   3096: 
                   3097:             <div class="variablelist">
                   3098:               <dl>
                   3099:                 <dt><span class="term">1. pre-build</span></dt>
                   3100: 
                   3101:                 <dd>
                   3102:                   <p>The script updates your pkgsrc tree via
                   3103:                   (anon)cvs, then cleans out any broken distfiles,
                   3104:                   and removes all packages installed.</p>
                   3105:                 </dd>
                   3106: 
                   3107:                 <dt><span class="term">2. the bulk
                   3108:                 build</span></dt>
                   3109: 
                   3110:                 <dd>
                   3111:                   <p>This is basically &#8220;<span class=
                   3112:                   "quote">make bulk-package</span>&#8221; with an
                   3113:                   optimised order in which packages will be built.
                   3114:                   Packages that don't require other packages will
                   3115:                   be built first, and packages with many
                   3116:                   dependencies will be built later.</p>
                   3117:                 </dd>
                   3118: 
                   3119:                 <dt><span class="term">3. post-build</span></dt>
                   3120: 
                   3121:                 <dd>
                   3122:                   <p>Generates a report that's placed in the
1.14      xtraeme  3123:                   directory specified in the <code class=
                   3124:                   "filename">build.conf</code> file named
                   3125:                   <code class="filename">broken.html</code>, a
                   3126:                   short version of that report will also be mailed
                   3127:                   to the build's admin.</p>
1.1       grant    3128:                 </dd>
                   3129:               </dl>
                   3130:             </div>
                   3131: 
                   3132:             <p>During the build, a list of broken packages will be
1.14      xtraeme  3133:             compiled in <code class=
                   3134:             "filename">/usr/pkgsrc/.broken</code> (or <code class=
                   3135:             "filename">.../.broken.${MACHINE}</code> if
                   3136:             <code class="varname">OBJMACHINE</code> is set),
                   3137:             individual build logs of broken builds can be found in
                   3138:             the package's directory. These files are used by the
                   3139:             bulk-targets to mark broken builds to not waste time
                   3140:             trying to rebuild them, and they can be used to debug
                   3141:             these broken package builds later.</p>
1.1       grant    3142:           </div>
                   3143: 
                   3144:           <div class="sect2" lang="en" xml:lang="en">
                   3145:             <div class="titlepage">
                   3146:               <div>
                   3147:                 <div>
1.18    ! xtraeme  3148:                   <h3 class="title"><a name="id2586157" id=
        !          3149:                   "id2586157"></a>5.3.5.&nbsp;Disk space
1.1       grant    3150:                   requirements</h3>
                   3151:                 </div>
                   3152:               </div>
                   3153:             </div>
                   3154: 
                   3155:             <p>Currently, roughly the following requirements are
                   3156:             valid for NetBSD 2.0/i386:</p>
                   3157: 
                   3158:             <div class="itemizedlist">
                   3159:               <ul type="disc">
                   3160:                 <li>
                   3161:                   <p>10 GB - distfiles (NFS ok)</p>
                   3162:                 </li>
                   3163: 
                   3164:                 <li>
                   3165:                   <p>8 GB - full set of all binaries (NFS ok)</p>
                   3166:                 </li>
                   3167: 
                   3168:                 <li>
                   3169:                   <p>5 GB - temp space for compiling (local disk
                   3170:                   recommended)</p>
                   3171:                 </li>
                   3172:               </ul>
                   3173:             </div>
                   3174: 
                   3175:             <p>Note that all pkgs will be de-installed as soon as
                   3176:             they are turned into a binary package, and that sources
                   3177:             are removed, so there is no excessively huge demand to
                   3178:             disk space. Afterwards, if the package is needed again,
                   3179:             it will be installed via <a href=
                   3180:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   3181:             <span class="citerefentry"><span class=
                   3182:             "refentrytitle">pkg_add</span>(1)</span></a> instead of
                   3183:             building again, so there are no cycles wasted by
                   3184:             recompiling.</p>
                   3185:           </div>
                   3186: 
                   3187:           <div class="sect2" lang="en" xml:lang="en">
                   3188:             <div class="titlepage">
                   3189:               <div>
                   3190:                 <div>
1.18    ! xtraeme  3191:                   <h3 class="title"><a name="id2586184" id=
        !          3192:                   "id2586184"></a>5.3.6.&nbsp;Setting up a sandbox
1.1       grant    3193:                   for chroot'ed builds</h3>
                   3194:                 </div>
                   3195:               </div>
                   3196:             </div>
                   3197: 
1.12      agc      3198:             <p>If you don't want all the packages nuked from a
                   3199:             machine (rendering it useless for anything but pkg
                   3200:             compiling), there is the possibility of doing the pkg
                   3201:             bulk build inside a chroot environment.</p>
                   3202: 
                   3203:             <p>The first step is to set up a chroot sandbox, e.g.
1.14      xtraeme  3204:             <code class="filename">/usr/sandbox</code>. This can be
1.12      agc      3205:             done by using null mounts, or manually.</p>
                   3206: 
1.14      xtraeme  3207:             <p>There is a shell script called <code class=
                   3208:             "filename">pkgsrc/mk/bulk/mksandbox</code> which will
                   3209:             set up the sandbox environment using null mounts. It
                   3210:             will also create a script called <code class=
                   3211:             "filename">sandbox</code> in the root of the sandbox
1.12      agc      3212:             environment, which will allow the null mounts to be
1.14      xtraeme  3213:             activated using the <span><strong class=
                   3214:             "command">sandbox mount</strong></span> command and
                   3215:             deactivated using the <span><strong class=
                   3216:             "command">sandbox umount</strong></span> command.</p>
1.12      agc      3217: 
                   3218:             <p>To set up a sandbox environment by hand, after
                   3219:             extracting all the sets from a NetBSD installation or
1.14      xtraeme  3220:             doing a <span><strong class="command">make distribution
                   3221:             DESTDIR=/usr/sandbox</strong></span> in <code class=
                   3222:             "filename">/usr/src/etc</code>, be sure the following
1.7       wiz      3223:             items are present and properly configured:</p>
1.1       grant    3224: 
                   3225:             <div class="procedure">
                   3226:               <ol type="1">
                   3227:                 <li>
                   3228:                   <p>Kernel</p>
                   3229:                   <pre class="screen">
1.14      xtraeme  3230: <code class="prompt">#</code> <strong class=
                   3231: "userinput"><code>cp /netbsd /usr/sandbox</code></strong>
1.1       grant    3232: </pre>
                   3233:                 </li>
                   3234: 
                   3235:                 <li>
1.14      xtraeme  3236:                   <p><code class="filename">/dev/*</code></p>
1.1       grant    3237:                   <pre class="screen">
1.14      xtraeme  3238: <code class="prompt">#</code> <strong class=
                   3239: "userinput"><code>cd /usr/sandbox/dev ; sh MAKEDEV all</code></strong>
1.1       grant    3240: </pre>
                   3241:                 </li>
                   3242: 
                   3243:                 <li>
1.14      xtraeme  3244:                   <p><code class="filename">/etc/resolv.conf</code>
1.1       grant    3245:                   (for <a xmlns=
                   3246:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3247:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.14      xtraeme  3248:                   class="pkgname">security/smtpd</a> and mail):</p>
1.1       grant    3249:                   <pre class="screen">
1.14      xtraeme  3250: <code class="prompt">#</code> <strong class=
                   3251: "userinput"><code>cp /etc/resolv.conf /usr/sandbox/etc</code></strong>
1.1       grant    3252: </pre>
                   3253:                 </li>
                   3254: 
                   3255:                 <li>
                   3256:                   <p>Working(!) mail config (hostname,
                   3257:                   sendmail.cf):</p>
                   3258:                   <pre class="screen">
1.14      xtraeme  3259: <code class="prompt">#</code> <strong class=
                   3260: "userinput"><code>cp /etc/mail/sendmail.cf /usr/sandbox/etc/mail</code></strong>
1.1       grant    3261: </pre>
                   3262:                 </li>
                   3263: 
                   3264:                 <li>
1.14      xtraeme  3265:                   <p><code class="filename">/etc/localtime</code>
                   3266:                   (for <a xmlns=
1.1       grant    3267:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3268:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/smtpd/README.html"
1.14      xtraeme  3269:                   class="pkgname">security/smtpd</a>):</p>
1.1       grant    3270:                   <pre class="screen">
1.14      xtraeme  3271: <code class="prompt">#</code> <strong class=
                   3272: "userinput"><code>ln -sf /usr/share/zoneinfo/UTC /usr/sandbox/etc/localtime</code></strong>
1.1       grant    3273: </pre>
                   3274:                 </li>
                   3275: 
                   3276:                 <li>
1.14      xtraeme  3277:                   <p><code class="filename">/usr/src</code> (system
1.1       grant    3278:                   sources, for <a xmlns=
                   3279:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3280:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/aperture/README.html"
1.14      xtraeme  3281:                   class="pkgname">sysutils/aperture</a>, <a xmlns=
                   3282:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   3283:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/net/ppp-mppe/README.html"
                   3284:                   class="pkgname">net/ppp-mppe</a>):</p>
1.1       grant    3285:                   <pre class="screen">
1.14      xtraeme  3286: <code class="prompt">#</code> <strong class=
                   3287: "userinput"><code>ln -s ../disk1/cvs .</code></strong>
                   3288: <code class="prompt">#</code> <strong class=
                   3289: "userinput"><code>ln -s cvs/src-1.6 src</code></strong>
1.1       grant    3290: </pre>
                   3291:                 </li>
                   3292: 
                   3293:                 <li>
1.14      xtraeme  3294:                   <p>Create <code class=
                   3295:                   "filename">/var/db/pkg</code> (not part of
                   3296:                   default install):</p>
1.1       grant    3297:                   <pre class="screen">
1.14      xtraeme  3298: <code class="prompt">#</code> <strong class=
                   3299: "userinput"><code>mkdir /usr/sandbox/var/db/pkg</code></strong>
1.1       grant    3300: </pre>
                   3301:                 </li>
                   3302: 
                   3303:                 <li>
1.14      xtraeme  3304:                   <p>Create <code class="filename">/usr/pkg</code>
                   3305:                   (not part of default install):</p>
1.1       grant    3306:                   <pre class="screen">
1.14      xtraeme  3307: <code class="prompt">#</code> <strong class=
                   3308: "userinput"><code>mkdir /usr/sandbox/usr/pkg</code></strong>
1.1       grant    3309: </pre>
                   3310:                 </li>
                   3311: 
                   3312:                 <li>
1.14      xtraeme  3313:                   <p>Checkout pkgsrc via cvs into <code class=
                   3314:                   "filename">/usr/sandbox/usr/pkgsrc</code>:</p>
1.1       grant    3315:                   <pre class="screen">
1.14      xtraeme  3316: <code class="prompt">#</code> <strong class=
                   3317: "userinput"><code>cd /usr/sandbox/usr</code></strong>
                   3318: <code class="prompt">#</code> <strong class=
                   3319: "userinput"><code>cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -d -P pkgsrc</code></strong>
1.1       grant    3320: </pre>
                   3321: 
                   3322:                   <p>Do not mount/link this to the copy of your
                   3323:                   pkgsrc tree you do development in, as this will
                   3324:                   likely cause problems!</p>
                   3325:                 </li>
                   3326: 
                   3327:                 <li>
1.14      xtraeme  3328:                   <p>Make <code class=
                   3329:                   "filename">/usr/sandbox/usr/pkgsrc/packages</code>
                   3330:                   and <code class="filename">.../distfiles</code>
                   3331:                   point somewhere appropriate. NFS- and/or
                   3332:                   nullfs-mounts may come in handy!</p>
1.1       grant    3333:                 </li>
                   3334: 
                   3335:                 <li>
1.14      xtraeme  3336:                   <p>Edit <code class=
                   3337:                   "filename">/etc/mk.conf</code>, see <a href=
                   3338:                   "#binary.mk.conf" title=
1.1       grant    3339:                   "5.3.1.1.&nbsp;/etc/mk.conf">Section&nbsp;5.3.1.1,
                   3340:                   &#8220;/etc/mk.conf&#8221;</a>.</p>
                   3341:                 </li>
                   3342: 
                   3343:                 <li>
1.14      xtraeme  3344:                   <p>Adjust <code class=
                   3345:                   "filename">mk/bulk/build.conf</code> to suit your
1.1       grant    3346:                   needs.</p>
                   3347:                 </li>
                   3348: 
                   3349:                 <li>
1.14      xtraeme  3350:                   <p>If you have set <code class=
                   3351:                   "varname">CVS_USER</code> in <code class=
                   3352:                   "filename">build.conf</code>, make sure that
                   3353:                   account exists and can do a <span><strong class=
                   3354:                   "command">cvs ${CVS_FLAGS} update</strong></span>
1.1       grant    3355:                   properly!</p>
                   3356:                 </li>
                   3357:               </ol>
                   3358:             </div>
                   3359: 
                   3360:             <p>When the chroot sandbox is setup, you can start the
                   3361:             build with the following steps:</p>
                   3362:             <pre class="screen">
1.14      xtraeme  3363: <code class="prompt">#</code> <strong class=
                   3364: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>
                   3365: <code class="prompt">#</code> <strong class=
                   3366: "userinput"><code>sh mk/bulk/do-sandbox-build</code></strong>
1.1       grant    3367: </pre>
                   3368: 
                   3369:             <p>This will just jump inside the sandbox and start
                   3370:             building. At the end of the build, mail will be sent
                   3371:             with the results of the build. Created binary pkgs will
1.14      xtraeme  3372:             be in <code class=
                   3373:             "filename">/usr/sandbox/usr/pkgsrc/packages</code>
1.1       grant    3374:             (wherever that points/mounts to/from).</p>
                   3375:           </div>
                   3376: 
                   3377:           <div class="sect2" lang="en" xml:lang="en">
                   3378:             <div class="titlepage">
                   3379:               <div>
                   3380:                 <div>
1.18    ! xtraeme  3381:                   <h3 class="title"><a name="id2586645" id=
        !          3382:                   "id2586645"></a>5.3.7.&nbsp;Building a partial
1.1       grant    3383:                   set of packages</h3>
                   3384:                 </div>
                   3385:               </div>
                   3386:             </div>
                   3387: 
                   3388:             <p>In addition to building a complete set of all
1.14      xtraeme  3389:             packages in pkgsrc, the <code class=
                   3390:             "filename">pkgsrc/mk/bulk/build</code> script may be
                   3391:             used to build a subset of the packages contained in
                   3392:             pkgsrc. By setting defining <code class=
                   3393:             "varname">SPECIFIC_PKGS</code> in <code class=
                   3394:             "filename">/etc/mk.conf</code>, the variables</p>
1.1       grant    3395: 
                   3396:             <div class="itemizedlist">
                   3397:               <ul type="disc">
                   3398:                 <li>
                   3399:                   <p>SITE_SPECIFIC_PKGS</p>
                   3400:                 </li>
                   3401: 
                   3402:                 <li>
                   3403:                   <p>HOST_SPECIFIC_PKGS</p>
                   3404:                 </li>
                   3405: 
                   3406:                 <li>
                   3407:                   <p>GROUP_SPECIFIC_PKGS</p>
                   3408:                 </li>
                   3409: 
                   3410:                 <li>
                   3411:                   <p>USER_SPECIFIC_PKGS</p>
                   3412:                 </li>
                   3413:               </ul>
                   3414:             </div>
                   3415: 
                   3416:             <p>will define the set of packages which should be
                   3417:             built. The bulk build code will also include any
                   3418:             packages which are needed as dependencies for the
                   3419:             explicitly listed packages.</p>
                   3420: 
                   3421:             <p>One use of this is to do a bulk build with
1.14      xtraeme  3422:             <code class="varname">SPECIFIC_PKGS</code> in a chroot
1.1       grant    3423:             sandbox periodically to have a complete set of the
                   3424:             binary packages needed for your site available without
                   3425:             the overhead of building extra packages that are not
                   3426:             needed.</p>
                   3427:           </div>
1.13      hubertf  3428: 
                   3429:           <div class="sect2" lang="en" xml:lang="en">
                   3430:             <div class="titlepage">
                   3431:               <div>
                   3432:                 <div>
                   3433:                   <h3 class="title"><a name="bulk-upload" id=
                   3434:                   "bulk-upload"></a>5.3.8.&nbsp;Uploading results
                   3435:                   of a bulk build</h3>
                   3436:                 </div>
                   3437:               </div>
                   3438:             </div>
                   3439: 
                   3440:             <p>This section describes how pkgsrc developers can
                   3441:             upload binary pkgs built by bulk builds to
                   3442:             ftp.NetBSD.org.</p>
                   3443: 
1.17      sketch   3444:             <p>If you would like to automatically create checksum
                   3445:             files for the binary packages you intend to upload,
                   3446:             remember to set <code class="varname">MKSUMS=yes</code>
                   3447:             in your <code class=
                   3448:             "filename">mk/bulk/build.conf</code>.</p>
                   3449: 
                   3450:             <p>If you would like to PGP sign the checksum files
                   3451:             (highly recommended!), remember to set <code class=
                   3452:             "varname">SIGN_AS=username@NetBSD.org</code> in your
                   3453:             <code class="filename">mk/bulk/build.conf</code>. This
                   3454:             will prompt you for your gpg password to sign the files
                   3455:             before uploading everything.</p>
                   3456: 
                   3457:             <p>Then, make sure that you have <code class=
1.14      xtraeme  3458:             "varname">RSYNC_DST</code> set properly in your
                   3459:             <code class="filename">mk/bulk/build.conf</code> file,
                   3460:             i.e. adjust it to something like one of the
                   3461:             following:</p>
1.13      hubertf  3462:             <pre class="screen">
                   3463: RSYNC_DST=$CVS_USER@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3464: </pre>
                   3465: 
                   3466:             <p>Please use appropviate values for "pkgsrc-200xQ4",
                   3467:             "NetBSD-a.b.c" and "arch" here. If your login on
1.14      xtraeme  3468:             ftp.NetBSD.org is different from <code class=
                   3469:             "varname">CVS_USER</code>, write your login directly
                   3470:             into the variable, e.g. my local account is "feyrer",
                   3471:             but for my login "hubertf", I use:</p>
1.13      hubertf  3472:             <pre class="screen">
                   3473: RSYNC_DST=hubertf@ftp.NetBSD.org:/pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload 
                   3474: </pre>
                   3475: 
1.14      xtraeme  3476:             <p>A separate <code class="filename">upload</code>
1.13      hubertf  3477:             directory is used here to allow "closing" the directory
                   3478:             during upload. To do so, run the following command on
                   3479:             ftp.NetBSD.org next:</p>
                   3480:             <pre class="screen">
1.14      xtraeme  3481: nbftp% <strong class=
                   3482: "userinput"><code>mkdir -p -m 750 /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch/upload</code></strong>
1.13      hubertf  3483: </pre>
                   3484: 
1.14      xtraeme  3485:             <p>Please note that <code class=
                   3486:             "filename">/pub/NetBSD/packages</code> is only
1.13      hubertf  3487:             appropriate for packages for the NetBSD operating
                   3488:             system. Binary packages for other operating systems
1.14      xtraeme  3489:             should go into <code class=
                   3490:             "filename">/pub/pkgsrc</code>.</p>
1.13      hubertf  3491: 
                   3492:             <p>Before uploading the binary pkgs, ssh authentication
                   3493:             needs to be setup next. This example shows how to setup
                   3494:             temporary keys for the root account <span class=
                   3495:             "emphasis"><em>inside the sandbox</em></span> (assuming
                   3496:             that no keys should be present there usually):</p>
                   3497:             <pre class="screen">
1.14      xtraeme  3498: <code class="prompt">#</code> <strong class=
                   3499: "userinput"><code>chroot /usr/sandbox</code></strong>        
                   3500: chroot-<code class="prompt">#</code> <strong class=
                   3501: "userinput"><code>rm $HOME/.ssh/id-dsa*</code></strong>        
                   3502: chroot-<code class="prompt">#</code> <strong class=
                   3503: "userinput"><code>ssh-keygen -t dsa</code></strong>        
                   3504: chroot-<code class="prompt">#</code> <strong class=
                   3505: "userinput"><code>cat $HOME/.ssh/id-dsa.pub</code></strong> 
1.13      hubertf  3506: </pre>
                   3507: 
1.14      xtraeme  3508:             <p>Now take the output of <code class=
                   3509:             "filename">id-dsa.pub</code> and append it to your
                   3510:             <code class="filename">~/.ssh/authorized_keys</code>
1.17      sketch   3511:             file on ftp.NetBSD.org. You can remove the key after
1.14      xtraeme  3512:             the upload is done!</p>
1.13      hubertf  3513: 
                   3514:             <p>Next, test if your ssh connection really works:</p>
                   3515:             <pre class="screen">
1.14      xtraeme  3516: chroot-<code class="prompt">#</code> <strong class=
                   3517: "userinput"><code>ssh ftp.NetBSD.org date</code></strong> 
1.13      hubertf  3518: </pre>
                   3519: 
                   3520:             <p>Use "-l yourNetBSDlogin" here as appropriate!</p>
                   3521: 
                   3522:             <p>Now after all this works, you can exit the sandbox
                   3523:             and start the upload:</p>
                   3524:             <pre class="screen">
1.14      xtraeme  3525: chroot-<code class="prompt">#</code> <strong class=
                   3526: "userinput"><code>exit</code></strong>        
                   3527: <code class="prompt">#</code> <strong class=
                   3528: "userinput"><code>cd /usr/sandbox/usr/pkgsrc</code></strong>        
                   3529: <code class="prompt">#</code> <strong class=
                   3530: "userinput"><code>sh mk/bulk/do-sandbox-upload</code></strong> 
1.13      hubertf  3531: </pre>
                   3532: 
                   3533:             <p>The upload process may take quite some time. Use
                   3534:             "ls" or "du" on the FTP server to monitor progress of
                   3535:             the upload.</p>
                   3536: 
                   3537:             <p>After the upload has ended, first thing is to revoke
                   3538:             ssh access:</p>
                   3539:             <pre class="screen">
1.14      xtraeme  3540: nbftp% <strong class=
                   3541: "userinput"><code>vi ~/.ssh/authorized_keys</code></strong>
1.13      hubertf  3542: Gdd:x! 
                   3543: </pre>
                   3544: 
                   3545:             <p>Use whatever is needed to remove the key you've
                   3546:             entered before! Last, move the uploaded packages out of
1.14      xtraeme  3547:             the <code class="filename">upload</code> directory to
                   3548:             have them accessible to everyone:</p>
1.13      hubertf  3549:             <pre class="screen">
1.14      xtraeme  3550: nbftp% <strong class=
                   3551: "userinput"><code>cd /pub/NetBSD/packages/pkgsrc-200xQy/NetBSD-a.b.c/arch</code></strong>
                   3552: nbftp% <strong class=
                   3553: "userinput"><code>mv upload/* .</code></strong>
                   3554: nbftp% <strong class="userinput"><code>rmdir upload</code></strong>
                   3555: nbftp% <strong class="userinput"><code>chmod 755 .</code></strong> 
1.13      hubertf  3556: </pre>
                   3557:           </div>
1.1       grant    3558:         </div>
                   3559: 
                   3560:         <div class="sect1" lang="en" xml:lang="en">
                   3561:           <div class="titlepage">
                   3562:             <div>
                   3563:               <div>
                   3564:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  3565:                 "id2587082" id="id2587082"></a>5.4.&nbsp;Creating a
1.1       grant    3566:                 multiple CD-ROM packages collection</h2>
                   3567:               </div>
                   3568:             </div>
                   3569:           </div>
                   3570: 
                   3571:           <p>After your pkgsrc bulk-build has completed, you may
                   3572:           wish to create a CD-ROM set of the resulting binary
                   3573:           packages to assist in installing packages on other
                   3574:           machines. The <a xmlns=
                   3575:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   3576:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/README.html"
1.14      xtraeme  3577:           class="pkgname">pkgtools/cdpack</a> package provides a
                   3578:           simple tool for creating the ISO 9660 images.
                   3579:           <span><strong class="command">cdpack</strong></span>
                   3580:           arranges the packages on the CD-ROMs in a way that keeps
                   3581:           all the dependencies for given package on the same CD as
                   3582:           that package.</p>
1.1       grant    3583: 
                   3584:           <div class="sect2" lang="en" xml:lang="en">
                   3585:             <div class="titlepage">
                   3586:               <div>
                   3587:                 <div>
1.18    ! xtraeme  3588:                   <h3 class="title"><a name="id2587097" id=
        !          3589:                   "id2587097"></a>5.4.1.&nbsp;Example of
1.1       grant    3590:                   cdpack</h3>
                   3591:                 </div>
                   3592:               </div>
                   3593:             </div>
                   3594: 
                   3595:             <p>Complete documentation for cdpack is found in the
                   3596:             cdpack(1) manpage. The following short example assumes
1.14      xtraeme  3597:             that the binary packages are left in <code class=
                   3598:             "filename">/usr/pkgsrc/packages/All</code> and that
                   3599:             sufficient disk space exists in <code class=
                   3600:             "filename">/u2</code> to hold the ISO 9660 images.</p>
1.1       grant    3601:             <pre class="screen">
1.14      xtraeme  3602: <code class="prompt">#</code> <strong class=
                   3603: "userinput"><code>mkdir /u2/images</code></strong>
                   3604: <code class="prompt">#</code> <strong class=
                   3605: "userinput"><code>pkg_add /usr/pkgsrc/packages/All/cdpack</code></strong>
                   3606: <code class="prompt">#</code> <strong class=
                   3607: "userinput"><code>cdpack /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3608: </pre>
                   3609: 
                   3610:             <p>If you wish to include a common set of files
1.14      xtraeme  3611:             (<code class="filename">COPYRIGHT</code>, <code class=
                   3612:             "filename">README</code>, etc.) on each CD in the
1.1       grant    3613:             collection, then you need to create a directory which
                   3614:             contains these files. e.g.</p>
                   3615:             <pre class="screen">
1.14      xtraeme  3616: <code class="prompt">#</code> <strong class=
                   3617: "userinput"><code>mkdir /tmp/common</code></strong>
                   3618: <code class="prompt">#</code> <strong class=
                   3619: "userinput"><code>echo "This is a README" &gt; /tmp/common/README</code></strong>
                   3620: <code class="prompt">#</code> <strong class=
                   3621: "userinput"><code>echo "Another file" &gt; /tmp/common/COPYING</code></strong>
                   3622: <code class="prompt">#</code> <strong class=
                   3623: "userinput"><code>mkdir /tmp/common/bin</code></strong>
                   3624: <code class="prompt">#</code> <strong class=
                   3625: "userinput"><code>echo "#!/bin/sh" &gt; /tmp/common/bin/myscript</code></strong>
                   3626: <code class="prompt">#</code> <strong class=
                   3627: "userinput"><code>echo "echo Hello world" &gt;&gt; /tmp/common/bin/myscript</code></strong>
                   3628: <code class="prompt">#</code> <strong class=
                   3629: "userinput"><code>chmod 755 /tmp/common/bin/myscript</code></strong>
1.1       grant    3630: </pre>
                   3631: 
                   3632:             <p>Now create the images:</p>
                   3633:             <pre class="screen">
1.14      xtraeme  3634: <code class="prompt">#</code> <strong class=
                   3635: "userinput"><code>cdpack -x /tmp/common /usr/pkgsrc/packages/All /u2/images</code></strong>
1.1       grant    3636: </pre>
                   3637: 
1.14      xtraeme  3638:             <p>Each image will contain <code class=
                   3639:             "filename">README</code>, <code class=
                   3640:             "filename">COPYING</code>, and <code class=
                   3641:             "filename">bin/myscript</code> in their root
1.1       grant    3642:             directories.</p>
                   3643:           </div>
                   3644:         </div>
                   3645:       </div>
                   3646: 
                   3647:       <div class="chapter" lang="en" xml:lang="en">
                   3648:         <div class="titlepage">
                   3649:           <div>
                   3650:             <div>
                   3651:               <h2 class="title"><a name="faq" id=
                   3652:               "faq"></a>Chapter&nbsp;6.&nbsp;Frequently Asked
                   3653:               Questions</h2>
                   3654:             </div>
                   3655:           </div>
                   3656:         </div>
                   3657: 
                   3658:         <div class="toc">
                   3659:           <p><b>Table of Contents</b></p>
                   3660: 
                   3661:           <dl>
1.18    ! xtraeme  3662:             <dt><span class="sect1"><a href="#id2587289">6.1. Are
        !          3663:             there any mailing lists for pkg-related
1.1       grant    3664:             discussion?</a></span></dt>
                   3665: 
1.18    ! xtraeme  3666:             <dt><span class="sect1"><a href="#id2587492">6.2.
1.1       grant    3667:             Where's the pkgviews documentation?</a></span></dt>
                   3668: 
1.5       hubertf  3669:             <dt><span class="sect1"><a href="#faq-pkgtools">6.3.
1.1       grant    3670:             Utilities for package management
                   3671:             (pkgtools)</a></span></dt>
                   3672: 
1.18    ! xtraeme  3673:             <dt><span class="sect1"><a href="#id2587676">6.4. How
1.1       grant    3674:             to use pkgsrc as non-root</a></span></dt>
                   3675: 
1.18    ! xtraeme  3676:             <dt><span class="sect1"><a href="#id2587688">6.5. How
1.15      xtraeme  3677:             to resume transfers when fetching
                   3678:             distfiles?</a></span></dt>
1.14      xtraeme  3679: 
1.18    ! xtraeme  3680:             <dt><span class="sect1"><a href="#id2587731">6.6. How
1.1       grant    3681:             can I install/use XFree86 from pkgsrc?</a></span></dt>
                   3682: 
1.18    ! xtraeme  3683:             <dt><span class="sect1"><a href="#id2587758">6.7. How
1.1       grant    3684:             can I install/use X.org from pkgsrc?</a></span></dt>
                   3685: 
1.18    ! xtraeme  3686:             <dt><span class="sect1"><a href="#id2587786">6.8. How
1.1       grant    3687:             to fetch files from behind a firewall</a></span></dt>
                   3688: 
1.18    ! xtraeme  3689:             <dt><span class="sect1"><a href="#id2587800">6.9. How
1.14      xtraeme  3690:             do I tell <span><strong class="command">make
                   3691:             fetch</strong></span> to do passive
                   3692:             FTP?</a></span></dt>
1.1       grant    3693: 
1.18    ! xtraeme  3694:             <dt><span class="sect1"><a href="#id2587851">6.10. How
1.1       grant    3695:             to fetch all distfiles at once</a></span></dt>
                   3696: 
1.18    ! xtraeme  3697:             <dt><span class="sect1"><a href="#id2588059">6.11. What
1.14      xtraeme  3698:             does &#8220;<span class="quote">Don't know how to make
                   3699:             /usr/share/tmac/tmac.andoc</span>&#8221;
1.1       grant    3700:             mean?</a></span></dt>
                   3701: 
1.18    ! xtraeme  3702:             <dt><span class="sect1"><a href="#id2588098">6.12. What
1.14      xtraeme  3703:             does &#8220;<span class="quote">Could not find
                   3704:             bsd.own.mk</span>&#8221; mean?</a></span></dt>
1.1       grant    3705: 
1.18    ! xtraeme  3706:             <dt><span class="sect1"><a href="#id2588224">6.13.
1.1       grant    3707:             Using 'sudo' with pkgsrc</a></span></dt>
                   3708: 
1.14      xtraeme  3709:             <dt><span class="sect1"><a href="#faq.conf">6.14.
1.1       grant    3710:             Configuration files handling and
                   3711:             placement</a></span></dt>
                   3712: 
1.14      xtraeme  3713:             <dt><span class="sect1"><a href="#audit-packages">6.15.
1.1       grant    3714:             Automated security checks</a></span></dt>
                   3715:           </dl>
                   3716:         </div>
                   3717: 
                   3718:         <p>This section contains hints, tips &amp; tricks on
                   3719:         special things in pkgsrc that we didn't find a better place
                   3720:         for in the previous chapters, and it contains items for
                   3721:         both pkgsrc users and developers.</p>
                   3722: 
                   3723:         <div class="sect1" lang="en" xml:lang="en">
                   3724:           <div class="titlepage">
                   3725:             <div>
                   3726:               <div>
                   3727:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  3728:                 "id2587289" id="id2587289"></a>6.1.&nbsp;Are there
        !          3729:                 any mailing lists for pkg-related discussion?</h2>
1.1       grant    3730:               </div>
                   3731:             </div>
                   3732:           </div>
                   3733: 
1.18    ! xtraeme  3734:           <p>The following mailing lists may be of interest to
        !          3735:           pkgsrc users:</p>
        !          3736: 
        !          3737:           <div class="itemizedlist">
        !          3738:             <ul type="disc">
        !          3739:               <li>
        !          3740:                 <p><a href=
        !          3741:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bugs"
        !          3742:                 target="_top">pkgsrc-bugs</a> -- a list where
        !          3743:                 problem reports related to pkgsrc are sent and
        !          3744:                 discussed</p>
        !          3745:               </li>
        !          3746: 
        !          3747:               <li>
        !          3748:                 <p><a href=
        !          3749:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-bulk"
        !          3750:                 target="_top">pkgsrc-bulk</a> -- a list where the
        !          3751:                 results of pkgsrc bulk builds are sent and
        !          3752:                 discussed</p>
        !          3753:               </li>
        !          3754: 
        !          3755:               <li>
        !          3756:                 <p><a href=
        !          3757:                 "http://www.NetBSD.org/MailingLists/index.html#pkgsrc-changes"
        !          3758:                 target="_top">pkgsrc-changes</a> -- a list where
        !          3759:                 all commit messages to pkgsrc are sent</p>
        !          3760:               </li>
        !          3761: 
        !          3762:               <li>
        !          3763:                 <p><a href=
        !          3764:                 "http://www.NetBSD.org/MailingLists/index.html#tech-pkg"
        !          3765:                 target="_top">tech-pkg</a> -- a general discussion
        !          3766:                 list for all things related to pkgsrc</p>
        !          3767:               </li>
        !          3768:             </ul>
        !          3769:           </div>
        !          3770: 
        !          3771:           <p>To subscribe, do:</p>
1.1       grant    3772:           <pre class="programlisting">
1.18    ! xtraeme  3773: <code class="prompt">%</code> echo subscribe <em class=
        !          3774: "replaceable"><code>listname</code></em> | mail majordomo@NetBSD.org
1.1       grant    3775: </pre>
                   3776: 
1.18    ! xtraeme  3777:           <p>Archives for all these mailing lists are available
        !          3778:           from <a href="http://mail-index.NetBSD.org/" target=
        !          3779:           "_top">http://mail-index.NetBSD.org/</a>.</p>
1.1       grant    3780:         </div>
                   3781: 
                   3782:         <div class="sect1" lang="en" xml:lang="en">
                   3783:           <div class="titlepage">
                   3784:             <div>
                   3785:               <div>
                   3786:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  3787:                 "id2587492" id="id2587492"></a>6.2.&nbsp;Where's
1.1       grant    3788:                 the pkgviews documentation?</h2>
                   3789:               </div>
                   3790:             </div>
                   3791:           </div>
                   3792: 
                   3793:           <p>Pkgviews is tightly integrated with buildlink. You can
1.14      xtraeme  3794:           find a pkgviews User's guide in <code class=
                   3795:           "filename">pkgsrc/mk/buildlink3/PKGVIEWS_UG</code>.</p>
1.1       grant    3796:         </div>
                   3797: 
                   3798:         <div class="sect1" lang="en" xml:lang="en">
                   3799:           <div class="titlepage">
                   3800:             <div>
                   3801:               <div>
                   3802:                 <h2 class="title" style="clear: both"><a name=
1.5       hubertf  3803:                 "faq-pkgtools" id=
                   3804:                 "faq-pkgtools"></a>6.3.&nbsp;Utilities for package
                   3805:                 management (pkgtools)</h2>
1.1       grant    3806:               </div>
                   3807:             </div>
                   3808:           </div>
                   3809: 
1.14      xtraeme  3810:           <p>The <code class="filename">pkgsrc/pkgtools</code>
1.1       grant    3811:           directory pkgtools contains a number of useful utilities
                   3812:           for both users and developers of pkgsrc. This section
                   3813:           attempts only to make the reader aware of the utilities
                   3814:           and when they might be useful, and not to duplicate the
                   3815:           documentation that comes with each package.</p>
                   3816: 
                   3817:           <p>Utilities used by pkgsrc (automatically installed when
                   3818:           needed):</p>
                   3819: 
                   3820:           <div class="itemizedlist">
                   3821:             <ul type="disc">
                   3822:               <li>
                   3823:                 <p><a xmlns=
                   3824:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3825:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/x11-links/README.html"
1.14      xtraeme  3826:                 class="pkgname">pkgtools/x11-links</a>: symlinks
                   3827:                 for use by buildlink</p>
1.1       grant    3828:               </li>
                   3829:             </ul>
                   3830:           </div>
                   3831: 
                   3832:           <p>OS tool augmentation (automatically installed when
                   3833:           needed):</p>
                   3834: 
                   3835:           <div class="itemizedlist">
                   3836:             <ul type="disc">
                   3837:               <li>
                   3838:                 <p><a xmlns=
                   3839:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3840:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.14      xtraeme  3841:                 class="pkgname">pkgtools/digest</a>: calculates
                   3842:                 SHA1 checksums (and other kinds)</p>
1.1       grant    3843:               </li>
                   3844: 
                   3845:               <li>
                   3846:                 <p><a xmlns=
                   3847:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3848:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libnbcompat/README.html"
1.14      xtraeme  3849:                 class="pkgname">pkgtools/libnbcompat</a>: compat
                   3850:                 library for pkg tools</p>
1.1       grant    3851:               </li>
                   3852: 
                   3853:               <li>
                   3854:                 <p><a xmlns=
                   3855:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3856:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/mtree/README.html"
1.14      xtraeme  3857:                 class="pkgname">pkgtools/mtree</a>: installed on
                   3858:                 non-BSD systems due to lack of native mtree</p>
1.1       grant    3859:               </li>
                   3860: 
                   3861:               <li>
                   3862:                 <p><a xmlns=
                   3863:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3864:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14      xtraeme  3865:                 class="pkgname">pkgtools/pkg_install</a>:
                   3866:                 up-to-date replacement for /usr/sbin/pkg_install,
                   3867:                 or for use on operating systems where pkg_install
                   3868:                 is not present</p>
1.1       grant    3869:               </li>
                   3870:             </ul>
                   3871:           </div>
                   3872: 
                   3873:           <p>Utilities used by pkgsrc (not automatically
                   3874:           installed):</p>
                   3875: 
                   3876:           <div class="itemizedlist">
                   3877:             <ul type="disc">
                   3878:               <li>
                   3879:                 <p><a xmlns=
                   3880:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3881:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_tarup/README.html"
1.14      xtraeme  3882:                 class="pkgname">pkgtools/pkg_tarup</a>: create a
                   3883:                 binary package from an already-installed package.
                   3884:                 used by 'make replace' to save the old package</p>
1.1       grant    3885:               </li>
                   3886: 
                   3887:               <li>
                   3888:                 <p><a xmlns=
                   3889:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.5       hubertf  3890:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/dfdisk/README.html"
1.14      xtraeme  3891:                 class="pkgname">pkgtools/dfdisk</a>: adds extra
                   3892:                 functionality to pkgsrc, allowing it to fetch
                   3893:                 distfiles from multiple locations. It currently
                   3894:                 supports the following methods: multiple CD-ROMs
                   3895:                 and network FTP/HTTP connections.</p>
1.5       hubertf  3896:               </li>
                   3897: 
                   3898:               <li>
                   3899:                 <p><a xmlns=
                   3900:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    3901:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.14      xtraeme  3902:                 class="pkgname">pkgtools/xpkgwedge</a>: put X11
                   3903:                 packages someplace else (enabled by default)</p>
1.1       grant    3904:               </li>
1.5       hubertf  3905: 
                   3906:               <li>
                   3907:                 <p><a xmlns=
                   3908:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3909:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.14      xtraeme  3910:                 class="pkgname">devel/cpuflags</a>: will determine
                   3911:                 the best compiler flags to optimise code for your
                   3912:                 current CPU and compiler.</p>
1.5       hubertf  3913:               </li>
1.1       grant    3914:             </ul>
                   3915:           </div>
                   3916: 
                   3917:           <p>Utilities for keeping track of installed packages,
                   3918:           being up to date, etc:</p>
                   3919: 
                   3920:           <div class="itemizedlist">
                   3921:             <ul type="disc">
                   3922:               <li>
                   3923:                 <p><a xmlns=
                   3924:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3925:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_chk/README.html"
1.14      xtraeme  3926:                 class="pkgname">pkgtools/pkg_chk</a>: installs
                   3927:                 pkg_chk, which reports on packages whose installed
                   3928:                 versions do not match the latest pkgsrc entries</p>
1.1       grant    3929:               </li>
                   3930: 
                   3931:               <li>
                   3932:                 <p><a xmlns=
                   3933:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3934:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdep/README.html"
1.14      xtraeme  3935:                 class="pkgname">pkgtools/pkgdep</a>: makes
                   3936:                 dependency graphs of packages, to aid in choosing a
                   3937:                 strategy for updating</p>
1.1       grant    3938:               </li>
                   3939: 
                   3940:               <li>
                   3941:                 <p><a xmlns=
                   3942:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3943:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdepgraph/README.html"
1.14      xtraeme  3944:                 class="pkgname">pkgtools/pkgdepgraph</a>: make
                   3945:                 graph from above (uses graphviz)</p>
1.1       grant    3946:               </li>
                   3947: 
                   3948:               <li>
                   3949:                 <p><a xmlns=
                   3950:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3951:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14      xtraeme  3952:                 class="pkgname">pkgtools/pkglint</a>: This provides
                   3953:                 two distinct abilities: check a pkgsrc entry for
                   3954:                 correctness (pkglint) check for and remove
                   3955:                 out-of-date distfiles and binary packages
                   3956:                 (lintpkgsrc)</p>
1.1       grant    3957:               </li>
                   3958: 
                   3959:               <li>
                   3960:                 <p><a xmlns=
                   3961:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3962:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgsurvey/README.html"
1.14      xtraeme  3963:                 class="pkgname">pkgtools/pkgsurvey</a>: report what
                   3964:                 packages you have installed</p>
1.1       grant    3965:               </li>
                   3966:             </ul>
                   3967:           </div>
                   3968: 
                   3969:           <p>Utilities for people maintaining or creating
                   3970:           individual packages:</p>
                   3971: 
                   3972:           <div class="itemizedlist">
                   3973:             <ul type="disc">
                   3974:               <li>
                   3975:                 <p><a xmlns=
                   3976:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3977:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14      xtraeme  3978:                 class="pkgname">pkgtools/pkgdiff</a>: automate
                   3979:                 making and maintaining patches for a package
                   3980:                 (includes pkgdiff, pkgvi, mkpatches, ...)</p>
1.1       grant    3981:               </li>
                   3982: 
                   3983:               <li>
                   3984:                 <p><a xmlns=
                   3985:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3986:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/rpm2pkg/README.html"
1.14      xtraeme  3987:                 class="pkgname">pkgtools/rpm2pkg</a>, <a xmlns=
                   3988:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3989:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
                   3990:                 class="pkgname">pkgtools/url2pkg</a>: aids in
                   3991:                 converting to pkgsrc</p>
1.1       grant    3992:               </li>
                   3993: 
                   3994:               <li>
                   3995:                 <p><a xmlns=
                   3996:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   3997:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/gensolpkg/README.html"
1.14      xtraeme  3998:                 class="pkgname">pkgtools/gensolpkg</a>: convert
                   3999:                 pkgsrc to a Solaris package</p>
1.1       grant    4000:               </li>
                   4001:             </ul>
                   4002:           </div>
                   4003: 
                   4004:           <p>Utilities for people maintaining pkgsrc (or more
                   4005:           obscure pkg utilities)</p>
                   4006: 
                   4007:           <div class="itemizedlist">
                   4008:             <ul type="disc">
                   4009:               <li>
                   4010:                 <p><a xmlns=
                   4011:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4012:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgconflict/README.html"
1.14      xtraeme  4013:                 class="pkgname">pkgtools/pkgconflict</a>: find
                   4014:                 packages that conflict but aren't marked as
                   4015:                 such</p>
1.1       grant    4016:               </li>
                   4017: 
                   4018:               <li>
                   4019:                 <p><a xmlns=
                   4020:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4021:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_comp/README.html"
1.14      xtraeme  4022:                 class="pkgname">pkgtools/pkg_comp</a>: build
                   4023:                 packages in a chrooted area</p>
1.1       grant    4024:               </li>
                   4025: 
                   4026:               <li>
                   4027:                 <p><a xmlns=
                   4028:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   4029:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/libkver/README.html"
1.14      xtraeme  4030:                 class="pkgname">pkgtools/libkver</a>: spoof kernel
                   4031:                 version for chrooted cross builds</p>
1.1       grant    4032:               </li>
                   4033:             </ul>
                   4034:           </div>
                   4035:         </div>
                   4036: 
                   4037:         <div class="sect1" lang="en" xml:lang="en">
                   4038:           <div class="titlepage">
                   4039:             <div>
                   4040:               <div>
                   4041:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  4042:                 "id2587676" id="id2587676"></a>6.4.&nbsp;How to use
1.1       grant    4043:                 pkgsrc as non-root</h2>
                   4044:               </div>
                   4045:             </div>
                   4046:           </div>
                   4047: 
                   4048:           <p>If you want to use pkgsrc as non-root user, you can
                   4049:           set some variables to make pkgsrc work under these
                   4050:           conditions. Please see <a href=
                   4051:           "http://mail-index.NetBSD.org/tech-pkg/2003/09/27/0023.html"
1.14      xtraeme  4052:           target="_top">this message</a> for more details.</p>
                   4053:         </div>
                   4054: 
                   4055:         <div class="sect1" lang="en" xml:lang="en">
                   4056:           <div class="titlepage">
                   4057:             <div>
                   4058:               <div>
                   4059:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  4060:                 "id2587688" id="id2587688"></a>6.5.&nbsp;How to
1.15      xtraeme  4061:                 resume transfers when fetching distfiles?</h2>
1.14      xtraeme  4062:               </div>
                   4063:             </div>
                   4064:           </div>
                   4065: 
1.15      xtraeme  4066:           <p>By default resuming transfers in pkgsrc is disabled,
                   4067:           but you can enable this feature by adding the option
                   4068:           <code class="varname">PKG_RESUME_TRANSFERS=YES</code>
                   4069:           into <code class="filename">/etc/mk.conf</code>. If,
                   4070:           during a fetch step, an incomplete distfile is found,
                   4071:           pkgsrc will try to resume it.</p>
                   4072: 
                   4073:           <p>You can also use a different program than the default
                   4074:           ftp(1) by changing the <code class=
                   4075:           "varname">FETCH_CMD</code> variable. Don't forget to set
                   4076:           <code class="varname">FETCH_RESUME_ARGS</code> and
                   4077:           <code class="varname">FETCH_OUTPUT_ARGS</code> if you are
                   4078:           not using default values.</p>
1.14      xtraeme  4079: 
                   4080:           <p>For example, if you want to use <code class=
                   4081:           "filename">wget</code> to resume downloads, you'll have
                   4082:           to use something like:</p>
                   4083:           <pre class="programlisting">
                   4084:         FETCH_CMD=wget
                   4085:         .if defined(FETCH_CMD) &amp;&amp; ${FETCH_CMD} == "wget"
                   4086:         FETCH_BEFORE_ARGS=--passive-ftp
                   4087:         FETCH_RESUME_ARGS=-c
                   4088:         FETCH_OUTPUT_ARGS=-O
                   4089:         .endif
                   4090:     
                   4091: </pre>
1.1       grant    4092:         </div>
                   4093: 
                   4094:         <div class="sect1" lang="en" xml:lang="en">
                   4095:           <div class="titlepage">
                   4096:             <div>
                   4097:               <div>
                   4098:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  4099:                 "id2587731" id="id2587731"></a>6.6.&nbsp;How can I
1.1       grant    4100:                 install/use XFree86 from pkgsrc?</h2>
                   4101:               </div>
                   4102:             </div>
                   4103:           </div>
                   4104: 
                   4105:           <p>If you want to use XFree86 from pkgsrc instead of your
1.14      xtraeme  4106:           system's own X11 (<code class=
                   4107:           "filename">/usr/X11R6</code>, <code class=
                   4108:           "filename">/usr/openwin</code>, ...), you will have to
                   4109:           add the following line into <code class=
1.15      xtraeme  4110:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4111:           <pre class="programlisting">
                   4112:       X11_TYPE=XFree86
                   4113:     
                   4114: </pre>
                   4115:         </div>
                   4116: 
                   4117:         <div class="sect1" lang="en" xml:lang="en">
                   4118:           <div class="titlepage">
                   4119:             <div>
                   4120:               <div>
                   4121:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  4122:                 "id2587758" id="id2587758"></a>6.7.&nbsp;How can I
1.1       grant    4123:                 install/use X.org from pkgsrc?</h2>
                   4124:               </div>
                   4125:             </div>
                   4126:           </div>
                   4127: 
                   4128:           <p>If you want to use X.org from pkgsrc instead of your
1.14      xtraeme  4129:           system's own X11 (<code class=
                   4130:           "filename">/usr/X11R6</code>, <code class=
                   4131:           "filename">/usr/openwin</code>, ...) you will have to add
                   4132:           the following line into <code class=
1.15      xtraeme  4133:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4134:           <pre class="programlisting">
                   4135:       X11_TYPE=xorg
                   4136:     
                   4137: </pre>
                   4138:         </div>
                   4139: 
                   4140:         <div class="sect1" lang="en" xml:lang="en">
                   4141:           <div class="titlepage">
                   4142:             <div>
                   4143:               <div>
                   4144:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  4145:                 "id2587786" id="id2587786"></a>6.8.&nbsp;How to
1.1       grant    4146:                 fetch files from behind a firewall</h2>
                   4147:               </div>
                   4148:             </div>
                   4149:           </div>
                   4150: 
                   4151:           <p>If you are sitting behind a firewall which does not
                   4152:           allow direct connections to Internet hosts (i.e.
                   4153:           non-NAT), you may specify the relevant proxy hosts. This
                   4154:           is done using an environment variable in the form of a
                   4155:           URL e.g. in Amdahl, the machine &#8220;<span class=
                   4156:           "quote">orpheus.amdahl.com</span>&#8221; is one of the
                   4157:           firewalls, and it uses port 80 as the proxy port number.
                   4158:           So the proxy environment variables are:</p>
                   4159:           <pre class="programlisting">
                   4160:   ftp_proxy=ftp://orpheus.amdahl.com:80/
                   4161: http_proxy=http://orpheus.amdahl.com:80/
                   4162: </pre>
                   4163:         </div>
                   4164: 
                   4165:         <div class="sect1" lang="en" xml:lang="en">
                   4166:           <div class="titlepage">
                   4167:             <div>
                   4168:               <div>
                   4169:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  4170:                 "id2587800" id="id2587800"></a>6.9.&nbsp;How do I
1.14      xtraeme  4171:                 tell <span><strong class="command">make
                   4172:                 fetch</strong></span> to do passive FTP?</h2>
1.1       grant    4173:               </div>
                   4174:             </div>
                   4175:           </div>
                   4176: 
                   4177:           <p>This depends on which utility is used to retrieve
1.14      xtraeme  4178:           distfiles. From <code class="filename">bsd.pkg.mk</code>,
                   4179:           <code class="varname">FETCH_CMD</code> is assigned the
                   4180:           first available command from the following list:</p>
1.1       grant    4181:           <pre class="programlisting">
                   4182: ${LOCALBASE}/bin/ftp
                   4183: /usr/bin/ftp
                   4184: </pre>
                   4185: 
                   4186:           <p>On a default NetBSD installation, this will be
1.14      xtraeme  4187:           <code class="filename">/usr/bin/ftp</code>, which
1.1       grant    4188:           automatically tries passive connections first, and falls
                   4189:           back to active connections if the server refuses to do
                   4190:           passive. For the other tools, add the following to your
1.14      xtraeme  4191:           <code class="filename">/etc/mk.conf</code> file:
                   4192:           <code class="varname">PASSIVE_FETCH=1</code>.</p>
1.1       grant    4193: 
1.14      xtraeme  4194:           <p>Having that option present will prevent <code class=
                   4195:           "filename">/usr/bin/ftp</code> from falling back to
                   4196:           active transfers.</p>
1.1       grant    4197:         </div>
                   4198: 
                   4199:         <div class="sect1" lang="en" xml:lang="en">
                   4200:           <div class="titlepage">
                   4201:             <div>
                   4202:               <div>
                   4203:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  4204:                 "id2587851" id="id2587851"></a>6.10.&nbsp;How to
1.1       grant    4205:                 fetch all distfiles at once</h2>
                   4206:               </div>
                   4207:             </div>
                   4208:           </div>
                   4209: 
                   4210:           <p>You would like to download all the distfiles in a
                   4211:           single batch from work or university, where you can't run
1.14      xtraeme  4212:           a <span><strong class="command">make
                   4213:           fetch</strong></span>. There is an archive of distfiles
                   4214:           on <a href=
1.1       grant    4215:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/"
                   4216:           target="_top">ftp.NetBSD.org</a>, but downloading the
                   4217:           entire directory may not be appropriate.</p>
                   4218: 
1.14      xtraeme  4219:           <p>The answer here is to do a <span><strong class=
                   4220:           "command">make fetch-list</strong></span> in <code class=
                   4221:           "filename">/usr/pkgsrc</code> or one of it's
1.1       grant    4222:           subdirectories, carry the resulting list to your machine
                   4223:           at work/school and use it there If you don't have a
                   4224:           NetBSD-compatible ftp(1) (like lukemftp) at work, don't
1.14      xtraeme  4225:           forget to set <code class="varname">FETCH_CMD</code> to
1.1       grant    4226:           something that fetches a URL:</p>
                   4227: 
                   4228:           <p>At home:</p>
                   4229:           <pre class="screen">
1.14      xtraeme  4230: <code class="prompt">%</code> <strong class=
                   4231: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   4232: <code class="prompt">%</code> <strong class=
                   4233: "userinput"><code>make fetch-list FETCH_CMD=wget DISTDIR=/tmp/distfiles &gt;/tmp/fetch.sh</code></strong>
                   4234: <code class="prompt">%</code> <strong class=
                   4235: "userinput"><code>scp /tmp/fetch.sh work:/tmp</code></strong>
1.1       grant    4236: </pre>
                   4237: 
                   4238:           <p>At work:</p>
                   4239:           <pre class="screen">
1.14      xtraeme  4240: <code class="prompt">%</code> <strong class=
                   4241: "userinput"><code>sh /tmp/fetch.sh</code></strong>
1.1       grant    4242: </pre>
                   4243: 
1.14      xtraeme  4244:           <p>then tar up <code class=
                   4245:           "filename">/tmp/distfiles</code> and take it home.</p>
1.1       grant    4246: 
                   4247:           <p>If you have a machine running NetBSD, and you want to
                   4248:           get <span class="emphasis"><em>all</em></span> distfiles
                   4249:           (even ones that aren't for your machine architecture),
                   4250:           you can do so by using the above-mentioned
1.14      xtraeme  4251:           <span><strong class="command">make
                   4252:           fetch-list</strong></span> approach, or fetch the
                   4253:           distfiles directly by running:</p>
1.1       grant    4254:           <pre class="screen">
1.14      xtraeme  4255: <code class="prompt">%</code> <strong class=
                   4256: "userinput"><code>make mirror-distfiles</code></strong>
1.1       grant    4257: </pre>
                   4258: 
1.14      xtraeme  4259:           <p>If you even decide to ignore <code class=
                   4260:           "varname">NO_{SRC,BIN}_ON_{FTP,CDROM}</code>, then you
                   4261:           can get everything by running:</p>
1.1       grant    4262:           <pre class="screen">
1.14      xtraeme  4263: <code class="prompt">%</code> <strong class=
                   4264: "userinput"><code>make fetch NO_SKIP=yes</code></strong>
1.1       grant    4265: </pre>
                   4266:         </div>
                   4267: 
                   4268:         <div class="sect1" lang="en" xml:lang="en">
                   4269:           <div class="titlepage">
                   4270:             <div>
                   4271:               <div>
                   4272:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  4273:                 "id2588059" id="id2588059"></a>6.11.&nbsp;What does
1.1       grant    4274:                 &#8220;<span class="quote">Don't know how to make
                   4275:                 /usr/share/tmac/tmac.andoc</span>&#8221; mean?</h2>
                   4276:               </div>
                   4277:             </div>
                   4278:           </div>
                   4279: 
                   4280:           <p>When compiling the <a xmlns=
                   4281:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4282:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14      xtraeme  4283:           class="pkgname">pkgtools/pkg_install</a> package, you get
                   4284:           the error from make that it doesn't know how to make
                   4285:           <code class="filename">/usr/share/tmac/tmac.andoc</code>?
                   4286:           This indicates that you don't have installed the
                   4287:           &#8220;<span class="quote">text</span>&#8221; set on your
                   4288:           machine (nroff, ...). It is recommended to do that to
                   4289:           format manpages.</p>
1.1       grant    4290: 
                   4291:           <p>In the case of the <a xmlns=
                   4292:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4293:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkg_install/README.html"
1.14      xtraeme  4294:           class="pkgname">pkgtools/pkg_install</a> package, you can
                   4295:           get away with setting <code class=
                   4296:           "varname">NOMAN=YES</code> either in the environment or
                   4297:           in <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    4298:         </div>
                   4299: 
                   4300:         <div class="sect1" lang="en" xml:lang="en">
                   4301:           <div class="titlepage">
                   4302:             <div>
                   4303:               <div>
                   4304:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  4305:                 "id2588098" id="id2588098"></a>6.12.&nbsp;What does
1.1       grant    4306:                 &#8220;<span class="quote">Could not find
                   4307:                 bsd.own.mk</span>&#8221; mean?</h2>
                   4308:               </div>
                   4309:             </div>
                   4310:           </div>
                   4311: 
1.14      xtraeme  4312:           <p>You didn't install the compiler set, <code class=
                   4313:           "filename">comp.tgz</code>, when you installed your
                   4314:           NetBSD machine. Please get it and install it, by
                   4315:           extracting it in <code class="filename">/</code>:</p>
1.1       grant    4316:           <pre class="screen">
1.14      xtraeme  4317: <code class="prompt">#</code> <strong class=
                   4318: "userinput"><code>cd /</code></strong>
                   4319: <code class="prompt">#</code> <strong class=
                   4320: "userinput"><code>tar --unlink -zxvpf .../comp.tgz</code></strong>
1.1       grant    4321: </pre>
                   4322: 
1.14      xtraeme  4323:           <p><code class="filename">comp.tgz</code> is part of
                   4324:           every NetBSD release. Get the one that corresponds to
                   4325:           your release (determine via <span><strong class=
                   4326:           "command">uname -r</strong></span>).</p>
1.1       grant    4327:         </div>
                   4328: 
                   4329:         <div class="sect1" lang="en" xml:lang="en">
                   4330:           <div class="titlepage">
                   4331:             <div>
                   4332:               <div>
                   4333:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  4334:                 "id2588224" id="id2588224"></a>6.13.&nbsp;Using
1.1       grant    4335:                 'sudo' with pkgsrc</h2>
                   4336:               </div>
                   4337:             </div>
                   4338:           </div>
                   4339: 
                   4340:           <p>When installing packages as non-root user and using
                   4341:           the just-in-time su(1) feature of pkgsrc, it can become
                   4342:           annoying to type in the root password for each required
                   4343:           package installed. To avoid this, the sudo package can be
                   4344:           used, which does password caching over a limited time. To
                   4345:           use it, install sudo (either as binary package or from
                   4346:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   4347:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/sudo/README.html"
1.14      xtraeme  4348:           class="pkgname">security/sudo</a>) and then put the
                   4349:           following into your <code class=
                   4350:           "filename">/etc/mk.conf</code>:</p>
1.1       grant    4351:           <pre class="programlisting">
                   4352:         .if exists(/usr/pkg/bin/sudo)
                   4353:         SU_CMD=/usr/pkg/bin/sudo /bin/sh -c
                   4354:         .endif
                   4355:     
                   4356: </pre>
                   4357:         </div>
                   4358: 
                   4359:         <div class="sect1" lang="en" xml:lang="en">
                   4360:           <div class="titlepage">
                   4361:             <div>
                   4362:               <div>
                   4363:                 <h2 class="title" style="clear: both"><a name=
                   4364:                 "faq.conf" id=
1.14      xtraeme  4365:                 "faq.conf"></a>6.14.&nbsp;Configuration files
1.1       grant    4366:                 handling and placement</h2>
                   4367:               </div>
                   4368:             </div>
                   4369:           </div>
                   4370: 
1.14      xtraeme  4371:           <p>The global variable <code class=
                   4372:           "varname">PKG_SYSCONFBASE</code> (and some others) can be
                   4373:           set by the system administrator in <code class=
                   4374:           "filename">/etc/mk.conf</code> to define the place where
1.1       grant    4375:           configuration files get installed. Therefore, packages
                   4376:           must be adapted to support this feature. Keep in mind
                   4377:           that you should only install files that are strictly
                   4378:           necessary in the configuration directory, files that can
1.14      xtraeme  4379:           go to <code class="filename">$PREFIX/share</code> should
                   4380:           go there.</p>
1.1       grant    4381: 
                   4382:           <p>We will take a look at available variables first
1.14      xtraeme  4383:           (<code class="filename">bsd.pkg.mk</code> contains more
                   4384:           information). <code class="varname">PKG_SYSCONFDIR</code>
                   4385:           is where the configuration files for a package may be
                   4386:           found (that is, the full path, e.g. <code class=
                   4387:           "filename">/etc</code> or <code class=
                   4388:           "filename">/usr/pkg/etc</code>). This value may be
1.1       grant    4389:           customized in various ways:</p>
                   4390: 
                   4391:           <div class="orderedlist">
                   4392:             <ol type="1">
                   4393:               <li>
1.14      xtraeme  4394:                 <p><code class="varname">PKG_SYSCONFBASE</code> is
                   4395:                 the main config directory under which all package
1.1       grant    4396:                 configuration files are to be found. Users will
1.14      xtraeme  4397:                 typically want to set it to <code class=
                   4398:                 "filename">/etc</code>, or accept the default
                   4399:                 location of <code class=
                   4400:                 "filename">$PREFIX/etc</code>.</p>
1.1       grant    4401:               </li>
                   4402: 
                   4403:               <li>
1.14      xtraeme  4404:                 <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   4405:                 is the subdirectory of <code class=
                   4406:                 "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    4407:                 configuration files for a particular package may be
1.14      xtraeme  4408:                 found. Defaults to <code class=
                   4409:                 "varname">${SYSCONFBASE}</code>.</p>
1.1       grant    4410:               </li>
                   4411: 
                   4412:               <li>
1.14      xtraeme  4413:                 <p><code class="varname">PKG_SYSCONFVAR</code> is
                   4414:                 the special suffix used to distinguish any
                   4415:                 overriding values for a particular package (see
                   4416:                 next item). It defaults to <code class=
                   4417:                 "varname">${PKGBASE}</code>, but for a collection
                   4418:                 of related packages that should all have the same
                   4419:                 <code class="varname">PKG_SYSCONFDIR</code> value,
                   4420:                 it can be set in each of the package Makefiles to a
                   4421:                 common value.</p>
1.1       grant    4422:               </li>
                   4423: 
                   4424:               <li>
1.14      xtraeme  4425:                 <p><code class=
                   4426:                 "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   4427:                 overrides the value of <code class=
                   4428:                 "varname">${PKG_SYSCONFDIR}</code> for packages
                   4429:                 with the same value for <code class=
                   4430:                 "varname">PKG_SYSCONFVAR</code>.</p>
1.1       grant    4431: 
                   4432:                 <p>As an example, all the various KDE packages may
1.14      xtraeme  4433:                 want to set <code class=
                   4434:                 "varname">PKG_SYSCONFVAR</code> to
                   4435:                 &#8220;<span class="quote">kde</span>&#8221; so
                   4436:                 admins can set <code class=
                   4437:                 "varname">PKG_SYSCONFDIR.kde</code> in <code class=
                   4438:                 "filename">/etc/mk.conf</code> to define where to
1.1       grant    4439:                 install KDE config files.</p>
                   4440:               </li>
                   4441:             </ol>
                   4442:           </div>
                   4443: 
                   4444:           <p>Programs' configuration directory should be defined
                   4445:           during the configure stage. Packages that use GNU
                   4446:           autoconf can usually do this by using the
                   4447:           &#8220;<span class="quote">--sysconfdir</span>&#8221;
                   4448:           parameter, but this brings some problems as we will see
                   4449:           now. When you change this pathname in packages, you
                   4450:           should not allow them to install files in that directory
                   4451:           directly. Instead they need to install those files under
1.14      xtraeme  4452:           <code class="filename">share/examples/${PKGNAME}</code>
                   4453:           so <code class="filename">PLIST</code> can register
                   4454:           them.</p>
1.1       grant    4455: 
                   4456:           <p>Once you have the required configuration files in
1.14      xtraeme  4457:           place (under the <code class=
                   4458:           "filename">share/examples</code> directory) the variable
                   4459:           <code class="varname">CONF_FILES</code> should be set to
                   4460:           copy them into <code class=
                   4461:           "varname">PKG_SYSCONFDIR</code>. The contents of this
                   4462:           variable is formed by pairs of filenames; the first
1.1       grant    4463:           element of the pair specifies the file inside the
1.14      xtraeme  4464:           examples directory (registered by <code class=
                   4465:           "filename">PLIST</code>) and the second element specifies
1.1       grant    4466:           the target file. This is done this way to allow binary
                   4467:           packages to place files in the right directory using
1.14      xtraeme  4468:           <code class="filename">INSTALL</code>/<code class=
                   4469:           "filename">DEINSTALL</code> scripts which are created
                   4470:           automatically. The package <code class=
                   4471:           "filename">Makefile</code> must also set <code class=
                   4472:           "varname">USE_PKGINSTALL=YES</code> to use these
1.1       grant    4473:           automatically generated scripts. The automatic copying of
                   4474:           config files can be toggled by setting the environment
1.14      xtraeme  4475:           variable <code class="varname">PKG_CONFIG</code> prior to
1.1       grant    4476:           package installation.</p>
                   4477: 
                   4478:           <p>Here is an example, taken from mail/mutt/Makefile:</p>
                   4479:           <pre class="programlisting">
                   4480:   EGDIR=            ${PREFIX}/share/doc/mutt/samples
                   4481: CONF_FILES=   ${EGDIR}/Muttrc ${PKG_SYSCONFDIR}/Muttrc
                   4482: </pre>
                   4483: 
                   4484:           <p>As you can see, this package installs configuration
1.14      xtraeme  4485:           files inside <code class="varname">EGDIR</code>, which
                   4486:           are registered by <code class="filename">PLIST</code>.
                   4487:           After that, the variable <code class=
                   4488:           "varname">CONF_FILES</code> lists the installed file
                   4489:           first and then the target file. Users will also get an
                   4490:           automatic message when files are installed using this
                   4491:           method.</p>
1.1       grant    4492:         </div>
                   4493: 
                   4494:         <div class="sect1" lang="en" xml:lang="en">
                   4495:           <div class="titlepage">
                   4496:             <div>
                   4497:               <div>
                   4498:                 <h2 class="title" style="clear: both"><a name=
                   4499:                 "audit-packages" id=
1.14      xtraeme  4500:                 "audit-packages"></a>6.15.&nbsp;Automated security
1.1       grant    4501:                 checks</h2>
                   4502:               </div>
                   4503:             </div>
                   4504:           </div>
                   4505: 
                   4506:           <p>Please be aware that there can often be bugs in
                   4507:           third-party software, and some of these bugs can leave a
                   4508:           machine vulnerable to exploitation by attackers. In an
                   4509:           effort to lessen the exposure, the NetBSD packages team
                   4510:           maintains a database of known-exploits to packages which
                   4511:           have at one time been included in pkgsrc. The database
                   4512:           can be downloaded automatically, and a security audit of
                   4513:           all packages installed on a system can take place. To do
                   4514:           this, install the <a xmlns=
                   4515:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   4516:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/security/audit-packages/README.html"
1.14      xtraeme  4517:           class="pkgname">security/audit-packages</a> package. It
                   4518:           has two components:</p>
1.1       grant    4519: 
                   4520:           <div class="orderedlist">
                   4521:             <ol type="1">
                   4522:               <li>
                   4523:                 <p>&#8220;<span class=
                   4524:                 "quote">download-vulnerability-list</span>&#8221;,
                   4525:                 an easy way to download a list of the security
                   4526:                 vulnerabilities information. This list is kept up
                   4527:                 to date by the NetBSD security officer and the
                   4528:                 NetBSD packages team, and is distributed from the
                   4529:                 NetBSD ftp server:</p>
                   4530: 
                   4531:                 <p><a href=
                   4532:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities"
1.14      xtraeme  4533:                 target=
                   4534:                 "_top">ftp://ftp.NetBSD.org/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</a></p>
1.1       grant    4535:               </li>
                   4536: 
                   4537:               <li>
                   4538:                 <p>&#8220;<span class=
                   4539:                 "quote">audit-packages</span>&#8221;, an easy way
                   4540:                 to audit the current machine, checking each
                   4541:                 vulnerability which is known. If a vulnerable
                   4542:                 package is installed, it will be shown by output to
                   4543:                 stdout, including a description of the type of
                   4544:                 vulnerability, and a URL containing more
                   4545:                 information.</p>
                   4546:               </li>
                   4547:             </ol>
                   4548:           </div>
                   4549: 
                   4550:           <p>Use of the audit-packages package is strongly
                   4551:           recommended!</p>
                   4552: 
                   4553:           <p>The following message is displayed as part of the
                   4554:           audit-packages installation procedure:</p>
                   4555:           <pre class="screen">
                   4556: ===========================================================================
1.18    ! xtraeme  4557: $NetBSD: faq.xml,v 1.5 2005/02/24 14:24:32 jschauma Exp $
1.1       grant    4558: 
                   4559: You may wish to have the vulnerabilities file downloaded daily so that
                   4560: it remains current.  This may be done by adding an appropriate entry
                   4561: to the root users crontab(5) entry.  For example the entry
                   4562: 
                   4563: # download vulnerabilities file
                   4564: 0 3 * * * ${PREFIX}/sbin/download-vulnerability-list &gt;/dev/null 2&gt;&amp;1
                   4565: 
                   4566: will update the vulnerability list every day at 3AM. You may wish to do
                   4567: this more often than once a day.
                   4568: 
                   4569: In addition, you may wish to run the package audit from the daily
                   4570: security script.  This may be accomplished by adding the following
                   4571: lines to /etc/security.local
                   4572: 
                   4573: if [ -x ${PREFIX}/sbin/audit-packages ]; then
                   4574:           ${PREFIX}/sbin/audit-packages
                   4575: fi
                   4576: 
                   4577: ===========================================================================
                   4578:     
                   4579: </pre>
                   4580:         </div>
                   4581:       </div>
                   4582:     </div>
                   4583: 
                   4584:     <div class="part" lang="en" xml:lang="en">
                   4585:       <div class="titlepage">
                   4586:         <div>
                   4587:           <div>
                   4588:             <h1 class="title"><a name="developers-guide" id=
1.2       hubertf  4589:             "developers-guide"></a>The pkgsrc developer's
                   4590:             guide</h1>
1.1       grant    4591:           </div>
                   4592:         </div>
                   4593:       </div>
                   4594: 
                   4595:       <div class="toc">
                   4596:         <p><b>Table of Contents</b></p>
                   4597: 
                   4598:         <dl>
                   4599:           <dt><span class="chapter"><a href="#components">7.
                   4600:           Package components - files, directories and
                   4601:           contents</a></span></dt>
                   4602: 
                   4603:           <dd>
                   4604:             <dl>
                   4605:               <dt><span class="sect1"><a href=
1.14      xtraeme  4606:               "#components.Makefile">7.1. <code class=
                   4607:               "filename">Makefile</code></a></span></dt>
1.1       grant    4608: 
                   4609:               <dt><span class="sect1"><a href=
1.14      xtraeme  4610:               "#components.distinfo">7.2. <code class=
                   4611:               "filename">distinfo</code></a></span></dt>
1.1       grant    4612: 
                   4613:               <dt><span class="sect1"><a href=
                   4614:               "#components.patches">7.3. patches/*</a></span></dt>
                   4615: 
1.18    ! xtraeme  4616:               <dt><span class="sect1"><a href="#id2589337">7.4.
1.1       grant    4617:               Other mandatory files</a></span></dt>
                   4618: 
                   4619:               <dt><span class="sect1"><a href=
                   4620:               "#components.optional">7.5. Optional
                   4621:               files</a></span></dt>
                   4622: 
1.18    ! xtraeme  4623:               <dt><span class="sect1"><a href="#id2589463">7.6.
1.14      xtraeme  4624:               <code class="filename">work*</code></a></span></dt>
1.1       grant    4625: 
1.18    ! xtraeme  4626:               <dt><span class="sect1"><a href="#id2589619">7.7.
1.14      xtraeme  4627:               <code class="filename">files/*</code></a></span></dt>
1.1       grant    4628:             </dl>
                   4629:           </dd>
                   4630: 
                   4631:           <dt><span class="chapter"><a href="#plist">8. PLIST
                   4632:           issues</a></span></dt>
                   4633: 
                   4634:           <dd>
                   4635:             <dl>
1.18    ! xtraeme  4636:               <dt><span class="sect1"><a href="#id2589673">8.1. RCS
1.1       grant    4637:               ID</a></span></dt>
                   4638: 
1.18    ! xtraeme  4639:               <dt><span class="sect1"><a href="#id2589688">8.2.
1.14      xtraeme  4640:               Semi-automatic <code class="filename">PLIST</code>
                   4641:               generation</a></span></dt>
1.1       grant    4642: 
                   4643:               <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme  4644:               Tweaking output of <span><strong class="command">make
                   4645:               print-PLIST</strong></span></a></span></dt>
1.1       grant    4646: 
                   4647:               <dt><span class="sect1"><a href="#plist.misc">8.4.
                   4648:               Variable substitution in PLIST</a></span></dt>
                   4649: 
1.18    ! xtraeme  4650:               <dt><span class="sect1"><a href="#id2590077">8.5.
1.1       grant    4651:               Manpage-compression</a></span></dt>
                   4652: 
1.18    ! xtraeme  4653:               <dt><span class="sect1"><a href="#id2590119">8.6.
1.14      xtraeme  4654:               Changing PLIST source with <code class=
                   4655:               "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    4656: 
1.18    ! xtraeme  4657:               <dt><span class="sect1"><a href="#id2590136">8.7.
1.1       grant    4658:               Platform specific and differing
                   4659:               PLISTs</a></span></dt>
                   4660: 
                   4661:               <dt><span class="sect1"><a href=
                   4662:               "#faq.common-dirs">8.8. Sharing directories between
                   4663:               packages</a></span></dt>
                   4664:             </dl>
                   4665:           </dd>
                   4666: 
                   4667:           <dt><span class="chapter"><a href="#buildlink">9.
                   4668:           Buildlink methodology</a></span></dt>
                   4669: 
                   4670:           <dd>
                   4671:             <dl>
1.18    ! xtraeme  4672:               <dt><span class="sect1"><a href="#id2590476">9.1.
1.1       grant    4673:               Converting packages to use buildlink3</a></span></dt>
                   4674: 
1.18    ! xtraeme  4675:               <dt><span class="sect1"><a href="#id2590667">9.2.
1.14      xtraeme  4676:               Writing <code class="filename">buildlink3.mk</code>
                   4677:               files</a></span></dt>
1.1       grant    4678: 
                   4679:               <dd>
                   4680:                 <dl>
                   4681:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4682:                   "#id2590737">9.2.1. Anatomy of a buildlink3.mk
1.1       grant    4683:                   file</a></span></dt>
                   4684: 
                   4685:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4686:                   "#id2591177">9.2.2. Updating <code class=
1.14      xtraeme  4687:                   "varname">BUILDLINK_DEPENDS.<em class=
                   4688:                   "replaceable"><code>pkg</code></em></code> in
                   4689:                   <code class="filename">buildlink3.mk</code>
1.1       grant    4690:                   files</a></span></dt>
                   4691:                 </dl>
                   4692:               </dd>
                   4693: 
1.18    ! xtraeme  4694:               <dt><span class="sect1"><a href="#id2591256">9.3.
1.14      xtraeme  4695:               Writing <code class="filename">builtin.mk</code>
                   4696:               files</a></span></dt>
1.1       grant    4697: 
                   4698:               <dd>
                   4699:                 <dl>
                   4700:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4701:                   "#id2591542">9.3.1. Anatomy of a <code class=
1.14      xtraeme  4702:                   "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    4703: 
                   4704:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4705:                   "#id2591769">9.3.2. Global preferences for native
1.1       grant    4706:                   or pkgsrc software</a></span></dt>
                   4707:                 </dl>
                   4708:               </dd>
                   4709:             </dl>
                   4710:           </dd>
                   4711: 
                   4712:           <dt><span class="chapter"><a href="#options">10. Options
                   4713:           handling</a></span></dt>
                   4714: 
                   4715:           <dd>
                   4716:             <dl>
1.18    ! xtraeme  4717:               <dt><span class="sect1"><a href="#id2591842">10.1.
1.1       grant    4718:               Global default options</a></span></dt>
                   4719: 
1.18    ! xtraeme  4720:               <dt><span class="sect1"><a href="#id2591857">10.2.
1.14      xtraeme  4721:               Converting packages to use <code class=
                   4722:               "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    4723:             </dl>
                   4724:           </dd>
                   4725: 
                   4726:           <dt><span class="chapter"><a href="#build">11. The build
                   4727:           process</a></span></dt>
                   4728: 
                   4729:           <dd>
                   4730:             <dl>
                   4731:               <dt><span class="sect1"><a href="#build.prefix">11.1.
                   4732:               Program location</a></span></dt>
                   4733: 
1.18    ! xtraeme  4734:               <dt><span class="sect1"><a href="#id2592396">11.2.
1.1       grant    4735:               Main targets</a></span></dt>
                   4736: 
                   4737:               <dt><span class="sect1"><a href=
                   4738:               "#build.helpful-targets">11.3. Other helpful
                   4739:               targets</a></span></dt>
                   4740:             </dl>
                   4741:           </dd>
                   4742: 
                   4743:           <dt><span class="chapter"><a href="#fixes">12. Notes on
                   4744:           fixes for packages</a></span></dt>
                   4745: 
                   4746:           <dd>
                   4747:             <dl>
1.18    ! xtraeme  4748:               <dt><span class="sect1"><a href="#id2593797">12.1.
1.1       grant    4749:               General operation</a></span></dt>
                   4750: 
                   4751:               <dd>
                   4752:                 <dl>
                   4753:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4754:                   "#id2593800">12.1.1. How to pull in variables
1.1       grant    4755:                   from /etc/mk.conf</a></span></dt>
                   4756: 
                   4757:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4758:                   "#id2593952">12.1.2. Restricted
1.1       grant    4759:                   packages</a></span></dt>
                   4760: 
                   4761:                   <dt><span class="sect2"><a href=
                   4762:                   "#dependencies">12.1.3. Handling
                   4763:                   dependencies</a></span></dt>
                   4764: 
                   4765:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4766:                   "#id2594467">12.1.4. Handling conflicts with
1.1       grant    4767:                   other packages</a></span></dt>
                   4768: 
                   4769:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4770:                   "#id2594517">12.1.5. Packages that cannot or
1.1       grant    4771:                   should not be built</a></span></dt>
                   4772: 
                   4773:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4774:                   "#id2594542">12.1.6. Packages which should not be
1.1       grant    4775:                   deleted, once installed</a></span></dt>
                   4776: 
                   4777:                   <dt><span class="sect2"><a href=
                   4778:                   "#security-handling">12.1.7. Handling packages
                   4779:                   with security problems</a></span></dt>
                   4780: 
                   4781:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4782:                   "#id2594702">12.1.8. How to handle compiler
1.1       grant    4783:                   bugs</a></span></dt>
                   4784: 
                   4785:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4786:                   "#id2594725">12.1.9. How to handle incrementing
1.1       grant    4787:                   versions when fixing an existing
                   4788:                   package</a></span></dt>
                   4789: 
                   4790:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4791:                   "#id2594774">12.1.10. Portability of
1.1       grant    4792:                   packages</a></span></dt>
                   4793:                 </dl>
                   4794:               </dd>
                   4795: 
1.18    ! xtraeme  4796:               <dt><span class="sect1"><a href="#id2594798">12.2.
1.1       grant    4797:               Possible downloading issues</a></span></dt>
                   4798: 
                   4799:               <dd>
                   4800:                 <dl>
                   4801:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4802:                   "#id2594802">12.2.1. Packages whose distfiles
1.1       grant    4803:                   aren't available for plain
                   4804:                   downloading</a></span></dt>
                   4805: 
                   4806:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4807:                   "#id2594865">12.2.2. How to handle modified
1.1       grant    4808:                   distfiles with the 'old' name</a></span></dt>
                   4809:                 </dl>
                   4810:               </dd>
                   4811: 
1.18    ! xtraeme  4812:               <dt><span class="sect1"><a href="#id2594876">12.3.
1.1       grant    4813:               Configuration gotchas</a></span></dt>
                   4814: 
                   4815:               <dd>
                   4816:                 <dl>
                   4817:                   <dt><span class="sect2"><a href=
                   4818:                   "#fixes.libtool">12.3.1. Shared libraries -
                   4819:                   libtool</a></span></dt>
                   4820: 
                   4821:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4822:                   "#id2595352">12.3.2. Using libtool on GNU
1.1       grant    4823:                   packages that already support
                   4824:                   libtool</a></span></dt>
                   4825: 
                   4826:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4827:                   "#id2595436">12.3.3. GNU
1.1       grant    4828:                   Autoconf/Automake</a></span></dt>
                   4829:                 </dl>
                   4830:               </dd>
                   4831: 
1.18    ! xtraeme  4832:               <dt><span class="sect1"><a href="#id2595481">12.4.
1.1       grant    4833:               Building considerations</a></span></dt>
                   4834: 
                   4835:               <dd>
                   4836:                 <dl>
                   4837:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4838:                   "#id2595484">12.4.1. CPP defines</a></span></dt>
1.1       grant    4839:                 </dl>
                   4840:               </dd>
                   4841: 
1.18    ! xtraeme  4842:               <dt><span class="sect1"><a href="#id2595651">12.5.
1.1       grant    4843:               Package specific actions</a></span></dt>
                   4844: 
                   4845:               <dd>
                   4846:                 <dl>
                   4847:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4848:                   "#id2595654">12.5.1. Package configuration
1.1       grant    4849:                   files</a></span></dt>
                   4850: 
                   4851:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4852:                   "#id2595825">12.5.2. User
1.2       hubertf  4853:                   interaction</a></span></dt>
1.1       grant    4854: 
                   4855:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4856:                   "#id2595869">12.5.3. Handling
1.1       grant    4857:                   licenses</a></span></dt>
                   4858: 
                   4859:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4860:                   "#id2596089">12.5.4. Creating an account from a
1.1       grant    4861:                   package</a></span></dt>
                   4862: 
                   4863:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4864:                   "#id2596151">12.5.5. Installing score
1.1       grant    4865:                   files</a></span></dt>
                   4866: 
                   4867:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4868:                   "#id2596195">12.5.6. Packages providing login
1.1       grant    4869:                   shells</a></span></dt>
                   4870: 
                   4871:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4872:                   "#id2596252">12.5.7. Packages containing perl
1.1       grant    4873:                   scripts</a></span></dt>
                   4874: 
                   4875:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4876:                   "#id2596270">12.5.8. Packages with hardcoded
1.1       grant    4877:                   paths to other interpreters</a></span></dt>
                   4878: 
                   4879:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4880:                   "#id2596292">12.5.9. Packages installing perl
1.1       grant    4881:                   modules</a></span></dt>
                   4882: 
                   4883:                   <dt><span class="sect2"><a href=
                   4884:                   "#faq.info-files">12.5.10. Packages installing
                   4885:                   info files</a></span></dt>
                   4886: 
                   4887:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4888:                   "#id2596512">12.5.11. Packages installing GConf2
1.1       grant    4889:                   data files</a></span></dt>
                   4890: 
                   4891:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4892:                   "#id2596612">12.5.12. Packages installing
1.1       grant    4893:                   scrollkeeper data files</a></span></dt>
                   4894: 
                   4895:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4896:                   "#id2596731">12.5.13. Packages installing X11
1.1       grant    4897:                   fonts</a></span></dt>
                   4898: 
                   4899:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4900:                   "#id2596778">12.5.14. Packages installing GTK2
1.1       grant    4901:                   modules</a></span></dt>
                   4902: 
                   4903:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4904:                   "#id2596916">12.5.15. Packages installing SGML or
1.1       grant    4905:                   XML data</a></span></dt>
                   4906: 
                   4907:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4908:                   "#id2596968">12.5.16. Packages installing
1.1       grant    4909:                   extensions to the MIME database</a></span></dt>
                   4910: 
                   4911:                   <dt><span class="sect2"><a href=
1.18    ! xtraeme  4912:                   "#id2597107">12.5.17. Packages using
1.1       grant    4913:                   intltool</a></span></dt>
1.18    ! xtraeme  4914: 
        !          4915:                   <dt><span class="sect2"><a href=
        !          4916:                   "#id2597121">12.5.18. Packages installing startup
        !          4917:                   scripts</a></span></dt>
1.1       grant    4918:                 </dl>
                   4919:               </dd>
                   4920: 
1.18    ! xtraeme  4921:               <dt><span class="sect1"><a href="#id2597210">12.6.
1.1       grant    4922:               Feedback to the author</a></span></dt>
                   4923:             </dl>
                   4924:           </dd>
                   4925: 
                   4926:           <dt><span class="chapter"><a href="#debug">13.
                   4927:           Debugging</a></span></dt>
                   4928: 
                   4929:           <dt><span class="chapter"><a href="#submit">14.
                   4930:           Submitting and Committing</a></span></dt>
                   4931: 
                   4932:           <dd>
                   4933:             <dl>
1.18    ! xtraeme  4934:               <dt><span class="sect1"><a href="#id2597672">14.1.
1.1       grant    4935:               Submitting your packages</a></span></dt>
                   4936: 
1.18    ! xtraeme  4937:               <dt><span class="sect1"><a href="#id2597723">14.2.
1.1       grant    4938:               Committing: Importing a package into
                   4939:               CVS</a></span></dt>
                   4940: 
1.18    ! xtraeme  4941:               <dt><span class="sect1"><a href="#id2597854">14.3.
1.2       hubertf  4942:               Updating a package to a newer version</a></span></dt>
1.1       grant    4943: 
1.18    ! xtraeme  4944:               <dt><span class="sect1"><a href="#id2597874">14.4.
1.2       hubertf  4945:               Moving a package in pkgsrc</a></span></dt>
1.1       grant    4946:             </dl>
                   4947:           </dd>
                   4948:         </dl>
                   4949:       </div>
                   4950: 
                   4951:       <div class="chapter" lang="en" xml:lang="en">
                   4952:         <div class="titlepage">
                   4953:           <div>
                   4954:             <div>
                   4955:               <h2 class="title"><a name="components" id=
                   4956:               "components"></a>Chapter&nbsp;7.&nbsp;Package
                   4957:               components - files, directories and contents</h2>
                   4958:             </div>
                   4959:           </div>
                   4960:         </div>
                   4961: 
                   4962:         <div class="toc">
                   4963:           <p><b>Table of Contents</b></p>
                   4964: 
                   4965:           <dl>
                   4966:             <dt><span class="sect1"><a href=
1.14      xtraeme  4967:             "#components.Makefile">7.1. <code class=
                   4968:             "filename">Makefile</code></a></span></dt>
1.1       grant    4969: 
                   4970:             <dt><span class="sect1"><a href=
1.14      xtraeme  4971:             "#components.distinfo">7.2. <code class=
                   4972:             "filename">distinfo</code></a></span></dt>
1.1       grant    4973: 
                   4974:             <dt><span class="sect1"><a href=
                   4975:             "#components.patches">7.3. patches/*</a></span></dt>
                   4976: 
1.18    ! xtraeme  4977:             <dt><span class="sect1"><a href="#id2589337">7.4. Other
1.1       grant    4978:             mandatory files</a></span></dt>
                   4979: 
                   4980:             <dt><span class="sect1"><a href=
                   4981:             "#components.optional">7.5. Optional
                   4982:             files</a></span></dt>
                   4983: 
1.18    ! xtraeme  4984:             <dt><span class="sect1"><a href="#id2589463">7.6.
1.14      xtraeme  4985:             <code class="filename">work*</code></a></span></dt>
1.1       grant    4986: 
1.18    ! xtraeme  4987:             <dt><span class="sect1"><a href="#id2589619">7.7.
1.14      xtraeme  4988:             <code class="filename">files/*</code></a></span></dt>
1.1       grant    4989:           </dl>
                   4990:         </div>
                   4991: 
                   4992:         <p>Whenever you're preparing a package, there are a number
                   4993:         of files involved which are described in the following
                   4994:         sections.</p>
                   4995: 
                   4996:         <div class="sect1" lang="en" xml:lang="en">
                   4997:           <div class="titlepage">
                   4998:             <div>
                   4999:               <div>
                   5000:                 <h2 class="title" style="clear: both"><a name=
                   5001:                 "components.Makefile" id=
1.14      xtraeme  5002:                 "components.Makefile"></a>7.1.&nbsp;<code class=
                   5003:                 "filename">Makefile</code></h2>
1.1       grant    5004:               </div>
                   5005:             </div>
                   5006:           </div>
                   5007: 
                   5008:           <p>Building, installation and creation of a binary
1.14      xtraeme  5009:           package are all controlled by the package's <code class=
                   5010:           "filename">Makefile</code>.</p>
1.1       grant    5011: 
1.14      xtraeme  5012:           <p>There is a <code class="filename">Makefile</code> for
                   5013:           each package. This file includes the standard
                   5014:           <code class="filename">bsd.pkg.mk</code> file (referenced
                   5015:           as <code class="filename">../../mk/bsd.pkg.mk</code>),
                   5016:           which sets all the definitions and actions necessary for
                   5017:           the package to compile and install itself. The mandatory
                   5018:           variables are the <code class="varname">DISTNAME</code>
                   5019:           which specifies the base name of the distribution file to
                   5020:           be downloaded from the site on the Internet, <code class=
                   5021:           "varname">MASTER_SITES</code> which specifies that site,
                   5022:           <code class="varname">CATEGORIES</code> which denotes the
                   5023:           categories into which the package falls, <code class=
                   5024:           "varname">PKGNAME</code> which is the name of the
                   5025:           package, the <code class="varname">MAINTAINER</code>'s
                   5026:           name, and the <code class="varname">COMMENT</code>
                   5027:           variable, which should contain a one-line description of
                   5028:           the package (the package name should not appear, it will
                   5029:           be added automatically). The maintainer variable is there
                   5030:           so that anyone who quibbles with the (always completely
                   5031:           correct) decisions taken by the guy who maintains the
                   5032:           package can complain vigorously, or send chocolate as a
                   5033:           sign of appreciation.</p>
1.1       grant    5034: 
1.14      xtraeme  5035:           <p>The <code class="varname">MASTER_SITES</code> may be
                   5036:           set to one of the predefined sites:</p>
1.1       grant    5037:           <pre class="programlisting">
                   5038:         ${MASTER_SITE_APACHE}
                   5039:         ${MASTER_SITE_DEBIAN}
                   5040:         ${MASTER_SITE_GNOME}
                   5041:         ${MASTER_SITE_GNU}
                   5042:         ${MASTER_SITE_GNUSTEP}
1.9       dillo    5043:         ${MASTER_SITE_IFARCHIVE}
1.1       grant    5044:         ${MASTER_SITE_MOZILLA}
                   5045:         ${MASTER_SITE_PERL_CPAN}
                   5046:         ${MASTER_SITE_SOURCEFORGE}
                   5047:         ${MASTER_SITE_SUNSITE}
                   5048:         ${MASTER_SITE_R_CRAN}
                   5049:         ${MASTER_SITE_SUSE}
                   5050:         ${MASTER_SITE_TEX_CTAN}
                   5051:         ${MASTER_SITE_XCONTRIB}
                   5052:         ${MASTER_SITE_XEMACS} 
                   5053: </pre>
                   5054: 
                   5055:           <p>If one of these predefined sites is chosen, you may
                   5056:           require the ability to specify a subdirectory of that
                   5057:           site. Since these macros may expand to more than one
                   5058:           actual site, you <span class=
                   5059:           "emphasis"><em>must</em></span> use the following
                   5060:           construct to specify a subdirectory:</p>
                   5061:           <pre class="programlisting">
                   5062:         ${MASTER_SITE_GNU:=subdirectory/name/}
                   5063:         ${MASTER_SITE_SOURCEFORGE:=project_name/} 
                   5064: </pre>
                   5065: 
                   5066:           <p>Note the trailing slash after the subdirectory
                   5067:           name.</p>
                   5068: 
                   5069:           <div class="note" style=
                   5070:           "margin-left: 0.5in; margin-right: 0.5in;">
                   5071:             <h3 class="title">Note</h3>
                   5072: 
1.14      xtraeme  5073:             <p><code class="varname">MASTER_SITE_SUBDIR</code> has
                   5074:             been deprecated and <span class="emphasis"><em>should
                   5075:             no longer be used</em></span>.</p>
1.1       grant    5076:           </div>
                   5077: 
1.14      xtraeme  5078:           <p>If the package has multiple <code class=
                   5079:           "varname">DISTFILES</code> or multiple <code class=
                   5080:           "varname">PATCHFILES</code> from different sites, set
                   5081:           <code class="varname">SITES_foo</code> to a list of URI's
1.1       grant    5082:           where file &#8220;<span class="quote">foo</span>&#8221;
                   5083:           may be found. &#8220;<span class=
                   5084:           "quote">foo</span>&#8221; includes the suffix, e.g.</p>
                   5085:           <pre class="programlisting">
                   5086: DISTFILES=      ${DISTNAME}${EXTRACT_SUFX}
                   5087: DISTFILES+=     foo-file.tar.gz
                   5088: SITES_foo-file.tar.gz=http://www.somewhere.com/somehow/ \
                   5089:         http://www.somewhereelse.com/mirror/somehow/
                   5090: </pre>
                   5091: 
1.14      xtraeme  5092:           <p>Note that the normal default setting of <code class=
                   5093:           "varname">DISTFILES</code> must be made explicit if you
1.1       grant    5094:           want to add to it (rather than replace it), as you
                   5095:           usually would.</p>
                   5096: 
                   5097:           <p>Currently the following values are available for
1.14      xtraeme  5098:           <code class="varname">CATEGORIES</code>. If more than one
                   5099:           is used, they need to be separated by spaces:</p>
1.1       grant    5100:           <pre class="programlisting">
                   5101: archivers     cross         geography     meta-pkgs     security
                   5102: audio         databases     graphics      misc          shells
                   5103: benchmarks    devel         ham           multimedia    sysutils
                   5104: biology       editors       inputmethod   net           textproc
                   5105: cad           emulators     lang          news          time
                   5106: chat          finance       mail          parallel      wm
                   5107: comms         fonts         math          pkgtools      www
                   5108: converters    games         mbone         print         x11
                   5109: </pre>
                   5110: 
                   5111:           <p>Please pay attention to the following gotchas:</p>
                   5112: 
                   5113:           <div class="itemizedlist">
                   5114:             <ul type="disc">
                   5115:               <li>
1.14      xtraeme  5116:                 <p>Add <code class="varname">MANCOMPRESSED</code>
                   5117:                 if manpages are installed in compressed form by the
                   5118:                 package; see comment in <code class=
                   5119:                 "filename">bsd.pkg.mk</code>.</p>
1.1       grant    5120:               </li>
                   5121: 
                   5122:               <li>
1.14      xtraeme  5123:                 <p>Replace <code class="filename">/usr/local</code>
1.1       grant    5124:                 with &#8220;<span class=
                   5125:                 "quote">${PREFIX}</span>&#8221; in all files (see
                   5126:                 patches, below).</p>
                   5127:               </li>
                   5128: 
                   5129:               <li>
                   5130:                 <p>If the package installs any info files, see
                   5131:                 <a href="#faq.info-files" title=
                   5132:                 "12.5.10.&nbsp;Packages installing info files">Section
                   5133:                 12.5.10, &#8220;Packages installing info
                   5134:                 files&#8221;</a>.</p>
                   5135:               </li>
                   5136: 
                   5137:               <li>
1.14      xtraeme  5138:                 <p>Set <code class="varname">MAINTAINER</code> to
                   5139:                 be yourself. If you really can't maintain the
                   5140:                 package for future updates, set it to <code class=
1.1       grant    5141:                 "email">&lt;<a href=
1.14      xtraeme  5142:                 "mailto:tech-pkg@NetBSD.org">tech-pkg@NetBSD.org</a>&gt;</code>.</p>
1.1       grant    5143:               </li>
                   5144: 
                   5145:               <li>
                   5146:                 <p>If a home page for the software in question
1.14      xtraeme  5147:                 exists, add the variable <code class=
                   5148:                 "varname">HOMEPAGE</code> right after <code class=
                   5149:                 "varname">MAINTAINER</code>. The value of this
1.1       grant    5150:                 variable should be the URL for the home page.</p>
                   5151:               </li>
                   5152: 
                   5153:               <li>
1.14      xtraeme  5154:                 <p>Be sure to set the <code class=
                   5155:                 "varname">COMMENT</code> variable to a short
1.1       grant    5156:                 description of the package, not containing the
                   5157:                 pkg's name.</p>
                   5158:               </li>
                   5159:             </ul>
                   5160:           </div>
                   5161:         </div>
                   5162: 
                   5163:         <div class="sect1" lang="en" xml:lang="en">
                   5164:           <div class="titlepage">
                   5165:             <div>
                   5166:               <div>
                   5167:                 <h2 class="title" style="clear: both"><a name=
                   5168:                 "components.distinfo" id=
1.14      xtraeme  5169:                 "components.distinfo"></a>7.2.&nbsp;<code class=
                   5170:                 "filename">distinfo</code></h2>
1.1       grant    5171:               </div>
                   5172:             </div>
                   5173:           </div>
                   5174: 
                   5175:           <p>Most important, the mandatory message digest, or
                   5176:           checksum, of all the distfiles needed for the package to
                   5177:           compile, confirming they match the original file
                   5178:           distributed by the author. This ensures that the distfile
                   5179:           retrieved from the Internet has not been corrupted during
                   5180:           transfer or altered by a malign force to introduce a
1.14      xtraeme  5181:           security hole. It is generated using the
                   5182:           <span><strong class="command">make
                   5183:           makesum</strong></span> command. The digest algorithm
                   5184:           used was, at one stage, md5, but that was felt lacking
                   5185:           compared to sha1, and so sha1 is now the default
1.1       grant    5186:           algorithm. The distfile size is also generated and stored
                   5187:           in new distinfo files. The <a xmlns=
                   5188:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5189:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/digest/README.html"
1.14      xtraeme  5190:           class="pkgname">pkgtools/digest</a> utility calculates
                   5191:           all of the digests in the distinfo file, and it provides
                   5192:           various different algorithms. At the current time, the
                   5193:           algorithms provided are: <span class=
                   5194:           "emphasis"><em>md5</em></span>, <span class=
                   5195:           "emphasis"><em>rmd160</em></span>, <span class=
                   5196:           "emphasis"><em>sha1</em></span>, <span class=
                   5197:           "emphasis"><em>sha256</em></span>, <span class=
                   5198:           "emphasis"><em>sha384</em></span> and <span class=
                   5199:           "emphasis"><em>sha512</em></span>.</p>
1.1       grant    5200: 
                   5201:           <p>Some packages have different sets of distfiles on a
                   5202:           per architecture basis, for example <a xmlns=
                   5203:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5204:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/navigator/README.html"
1.14      xtraeme  5205:           class="pkgname">www/navigator</a>). These are kept in the
                   5206:           same distinfo file and care should be taken when
                   5207:           upgrading such a package to ensure distfile information
                   5208:           is not lost.</p>
1.1       grant    5209: 
                   5210:           <p>The message digest/checksum for all the official
1.14      xtraeme  5211:           patches found in the <code class=
                   5212:           "filename">patches/</code> directory (see <a href=
                   5213:           "#components.patches" title=
1.1       grant    5214:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   5215:           &#8220;patches/*&#8221;</a>) for the package is also
1.14      xtraeme  5216:           stored in the <code class="filename">distinfo</code>
                   5217:           file. This is a message digest/checksum of all lines in
                   5218:           the patch file except the NetBSD RCS Id. This file is
                   5219:           generated by invoking <span><strong class="command">make
                   5220:           makepatchsum</strong></span> (or <span><strong class=
                   5221:           "command">make mps</strong></span> if you're in a
                   5222:           hurry).</p>
1.1       grant    5223:         </div>
                   5224: 
                   5225:         <div class="sect1" lang="en" xml:lang="en">
                   5226:           <div class="titlepage">
                   5227:             <div>
                   5228:               <div>
                   5229:                 <h2 class="title" style="clear: both"><a name=
                   5230:                 "components.patches" id=
                   5231:                 "components.patches"></a>7.3.&nbsp;patches/*</h2>
                   5232:               </div>
                   5233:             </div>
                   5234:           </div>
                   5235: 
                   5236:           <p>This directory contains files that are used by the
                   5237:           <a href=
                   5238:           "http://netbsd.gw.com/cgi-bin/man-cgi?patch+1+NetBSD-current">
                   5239:           <span class="citerefentry"><span class=
                   5240:           "refentrytitle">patch</span>(1)</span></a> command to
                   5241:           modify the sources as distributed in the distribution
                   5242:           file into a form that will compile and run perfectly on
                   5243:           NetBSD. The files are applied successively in alphabetic
                   5244:           order (as returned by a shell &#8220;<span class=
                   5245:           "quote">patches/patch-*</span>&#8221; glob expansion), so
1.14      xtraeme  5246:           <code class="filename">patch-aa</code> is applied before
                   5247:           <code class="filename">patch-ab</code>, etc.</p>
1.1       grant    5248: 
1.14      xtraeme  5249:           <p>The <code class="filename">patch-*</code> files should
                   5250:           be in <span><strong class="command">diff
                   5251:           -bu</strong></span> format, and apply without a fuzz to
                   5252:           avoid problems. (To force patches to apply with fuzz you
                   5253:           can set <code class=
                   5254:           "varname">PATCH_FUZZ_FACTOR=-F2</code>). Furthermore, do
1.1       grant    5255:           not put changes for more than one file into a single
                   5256:           patch-file, as this will make future modifications more
                   5257:           difficult.</p>
                   5258: 
                   5259:           <p>Similar, a file should be patched at most once, not
                   5260:           several times by several different patches. If a file
                   5261:           needs several patches, they should be combined into one
                   5262:           file.</p>
                   5263: 
                   5264:           <p>One important thing to mention is to pay attention
                   5265:           that no RCS IDs get stored in the patch files, as these
                   5266:           will cause problems when later checked into the NetBSD
1.14      xtraeme  5267:           CVS tree. Use the <span><strong class=
                   5268:           "command">pkgdiff</strong></span> from the <a xmlns=
1.1       grant    5269:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5270:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14      xtraeme  5271:           class="pkgname">pkgtools/pkgdiff</a> package to avoid
                   5272:           these problems.</p>
1.1       grant    5273: 
                   5274:           <p>For even more automation, we recommend using
1.14      xtraeme  5275:           <span><strong class="command">mkpatches</strong></span>
                   5276:           from the same package to make a whole set of patches. You
                   5277:           just have to backup files before you edit them to
                   5278:           <code class="filename">filename.orig</code>, e.g. with
                   5279:           <span><strong class="command">cp -p filename
                   5280:           filename.orig</strong></span> or, easier, by using
                   5281:           <span><strong class="command">pkgvi</strong></span> again
                   5282:           from the same package. If you upgrade a package this way,
                   5283:           you can easily compare the new set of patches with the
                   5284:           previously existing one with <span><strong class=
                   5285:           "command">patchdiff</strong></span>.</p>
1.1       grant    5286: 
                   5287:           <p>When you have finished a package, remember to generate
                   5288:           the checksums for the patch files by using the
1.14      xtraeme  5289:           <span><strong class="command">make
                   5290:           makepatchsum</strong></span> command, see <a href=
                   5291:           "#components.distinfo" title=
1.5       hubertf  5292:           "7.2.&nbsp;distinfo">Section&nbsp;7.2,
1.14      xtraeme  5293:           &#8220;<code class="filename">distinfo</code>&#8221;</a>.</p>
1.1       grant    5294: 
                   5295:           <p>Patch files that are distributed by the author or
1.14      xtraeme  5296:           other maintainers can be listed in <code class=
                   5297:           "varname">$PATCHFILES</code>.</p>
1.1       grant    5298: 
                   5299:           <p>If it is desired to store any patches that should not
                   5300:           be committed into pkgsrc, they can be kept outside the
1.14      xtraeme  5301:           pkgsrc tree in the <code class=
                   5302:           "filename">$LOCALPATCHES</code> directory. The directory
1.1       grant    5303:           tree there is expected to have the same
                   5304:           &#8220;<span class="quote">category/package</span>&#8221;
                   5305:           structure as pkgsrc, and patches are expected to be
1.14      xtraeme  5306:           stored inside these dirs (also known as <code class=
                   5307:           "filename">$LOCALPATCHES/$PKGPATH</code>). For example if
                   5308:           you want to keep a private patch for <code class=
                   5309:           "filename">pkgsrc/graphics/png</code>, keep it in
                   5310:           <code class=
                   5311:           "filename">$LOCALPATCHES/graphics/png/mypatch</code>. All
                   5312:           files in the named directory are expected to be patch
1.1       grant    5313:           files, and <span class="emphasis"><em>they are applied
                   5314:           after pkgsrc patches are applied</em></span>.</p>
                   5315:         </div>
                   5316: 
                   5317:         <div class="sect1" lang="en" xml:lang="en">
                   5318:           <div class="titlepage">
                   5319:             <div>
                   5320:               <div>
                   5321:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  5322:                 "id2589337" id="id2589337"></a>7.4.&nbsp;Other
1.1       grant    5323:                 mandatory files</h2>
                   5324:               </div>
                   5325:             </div>
                   5326:           </div>
                   5327: 
                   5328:           <div class="variablelist">
                   5329:             <dl>
1.14      xtraeme  5330:               <dt><span class="term"><code class=
                   5331:               "filename">DESCR</code></span></dt>
1.1       grant    5332: 
                   5333:               <dd>
                   5334:                 <p>A multi-line description of the piece of
                   5335:                 software. This should include any credits where
                   5336:                 they are due. Please bear in mind that others do
                   5337:                 not share your sense of humour (or spelling
                   5338:                 idiosyncrasies), and that others will read
                   5339:                 everything that you write here.</p>
                   5340:               </dd>
                   5341: 
1.14      xtraeme  5342:               <dt><span class="term"><code class=
                   5343:               "filename">PLIST</code></span></dt>
1.1       grant    5344: 
                   5345:               <dd>
                   5346:                 <p>This file governs the files that are installed
                   5347:                 on your system: all the binaries, manual pages,
                   5348:                 etc. There are other directives which may be
                   5349:                 entered in this file, to control the creation and
                   5350:                 deletion of directories, and the location of
                   5351:                 inserted files. See <a href="#plist" title=
                   5352:                 "Chapter&nbsp;8.&nbsp;PLIST issues">Chapter&nbsp;8,
                   5353:                 <i>PLIST issues</i></a> for more information.</p>
                   5354:               </dd>
                   5355:             </dl>
                   5356:           </div>
                   5357:         </div>
                   5358: 
                   5359:         <div class="sect1" lang="en" xml:lang="en">
                   5360:           <div class="titlepage">
                   5361:             <div>
                   5362:               <div>
                   5363:                 <h2 class="title" style="clear: both"><a name=
                   5364:                 "components.optional" id=
                   5365:                 "components.optional"></a>7.5.&nbsp;Optional
                   5366:                 files</h2>
                   5367:               </div>
                   5368:             </div>
                   5369:           </div>
                   5370: 
                   5371:           <div class="variablelist">
                   5372:             <dl>
1.14      xtraeme  5373:               <dt><span class="term"><code class=
                   5374:               "filename">INSTALL</code></span></dt>
1.1       grant    5375: 
                   5376:               <dd>
                   5377:                 <p>This shell script is invoked twice by <a href=
                   5378:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5379:                 <span class="citerefentry"><span class=
                   5380:                 "refentrytitle">pkg_add</span>(1)</span></a>. First
                   5381:                 time after package extraction and before files are
                   5382:                 moved in place, the second time after the files to
                   5383:                 install are moved in place. This can be used to do
                   5384:                 any custom procedures not possible with @exec
1.14      xtraeme  5385:                 commands in <code class="filename">PLIST</code>.
                   5386:                 See <a href=
1.1       grant    5387:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   5388:                 <span class="citerefentry"><span class=
                   5389:                 "refentrytitle">pkg_add</span>(1)</span></a> and
                   5390:                 <a href=
                   5391:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5392:                 <span class="citerefentry"><span class=
                   5393:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5394:                 more information.</p>
                   5395:               </dd>
                   5396: 
1.14      xtraeme  5397:               <dt><span class="term"><code class=
                   5398:               "filename">DEINSTALL</code></span></dt>
1.1       grant    5399: 
                   5400:               <dd>
                   5401:                 <p>This script is executed before and after any
                   5402:                 files are removed. It is this script's
                   5403:                 responsibility to clean up any additional messy
                   5404:                 details around the package's installation, since
                   5405:                 all pkg_delete knows is how to delete the files
                   5406:                 created in the original distribution. See <a href=
                   5407:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   5408:                 <span class="citerefentry"><span class=
                   5409:                 "refentrytitle">pkg_delete</span>(1)</span></a> and
                   5410:                 <a href=
                   5411:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5412:                 <span class="citerefentry"><span class=
                   5413:                 "refentrytitle">pkg_create</span>(1)</span></a> for
                   5414:                 more information.</p>
                   5415:               </dd>
                   5416: 
1.14      xtraeme  5417:               <dt><span class="term"><code class=
                   5418:               "filename">MESSAGE</code></span></dt>
1.1       grant    5419: 
                   5420:               <dd>
                   5421:                 <p>Display this file after installation of the
                   5422:                 package. Useful for things like legal notices on
                   5423:                 almost-free software and hints for updating config
                   5424:                 files after installing modules for apache, PHP etc.
                   5425:                 Please note that you can modify variables in it
1.14      xtraeme  5426:                 easily by using <code class=
                   5427:                 "varname">MESSAGE_SUBST</code> in the package's
                   5428:                 <code class="filename">Makefile</code>:</p>
1.1       grant    5429:                 <pre class="programlisting">
                   5430: MESSAGE_SUBST+=  SOMEVAR="somevalue"
                   5431: </pre>
                   5432: 
                   5433:                 <p>replaces "${SOMEVAR}" with &#8220;<span class=
1.14      xtraeme  5434:                 "quote">somevalue</span>&#8221; in <code class=
                   5435:                 "filename">MESSAGE</code>.</p>
1.1       grant    5436:               </dd>
                   5437:             </dl>
                   5438:           </div>
                   5439:         </div>
                   5440: 
                   5441:         <div class="sect1" lang="en" xml:lang="en">
                   5442:           <div class="titlepage">
                   5443:             <div>
                   5444:               <div>
                   5445:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  5446:                 "id2589463" id=
        !          5447:                 "id2589463"></a>7.6.&nbsp;<code class=
1.14      xtraeme  5448:                 "filename">work*</code></h2>
1.1       grant    5449:               </div>
                   5450:             </div>
                   5451:           </div>
                   5452: 
1.14      xtraeme  5453:           <p>When you type <span><strong class=
                   5454:           "command">make</strong></span> the distribution files are
                   5455:           unpacked into this directory. It can be removed by
                   5456:           running <span><strong class="command">make
                   5457:           clean</strong></span>. Besides the sources, this
                   5458:           directory is also used to keep various timestamp
1.1       grant    5459:           files.</p>
                   5460: 
                   5461:           <p>If a package doesn't create a subdirectory for itself
                   5462:           (like GNU software does, for instance), but extracts
                   5463:           itself in the current directory, you should set
1.14      xtraeme  5464:           <code class="varname">WRKSRC</code> accordingly, e.g.
1.1       grant    5465:           <a xmlns="http://www.w3.org/TR/xhtml1/transitional" href=
                   5466:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/editors/sam/README.html"
1.14      xtraeme  5467:           class="pkgname">editors/sam</a> again, but the quick
                   5468:           answer is:</p>
1.1       grant    5469:           <pre class="programlisting">
                   5470: WRKSRC=                ${WRKDIR}
                   5471: </pre>
                   5472: 
1.14      xtraeme  5473:           <p>Please note that the old <code class=
                   5474:           "varname">NO_WRKSUBDIR</code> has been deprecated and
1.1       grant    5475:           should not be used. Also, if your package doesn't create
1.14      xtraeme  5476:           a subdir with the name of <code class=
                   5477:           "varname">DISTNAME</code> but some different name, set
                   5478:           <code class="varname">WRKSRC</code> to point to the
                   5479:           proper name in <code class="filename">${WRKDIR}</code>.
                   5480:           See <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5481:           href=
1.1       grant    5482:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/lang/tcl/README.html"
1.14      xtraeme  5483:           class="pkgname">lang/tcl</a> and <a xmlns=
                   5484:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   5485:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/tk/README.html"
                   5486:           class="pkgname">x11/tk</a> for examples, and here is
                   5487:           another one:</p>
1.1       grant    5488:           <pre class="programlisting">
                   5489: WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
                   5490: </pre>
                   5491: 
                   5492:           <p>The name of the working directory created by pkgsrc is
1.14      xtraeme  5493:           <code class="filename">work</code> by default. If the
                   5494:           same pkgsrc tree should be used on several different
                   5495:           platforms, the variable <code class=
                   5496:           "varname">OBJMACHINE</code> can be set in /etc/mk.conf to
1.1       grant    5497:           attach the platform to the directory name, e.g.
1.14      xtraeme  5498:           <code class="filename">work.i386</code> or <code class=
                   5499:           "filename">work.sparc</code>.</p>
1.1       grant    5500:         </div>
                   5501: 
                   5502:         <div class="sect1" lang="en" xml:lang="en">
                   5503:           <div class="titlepage">
                   5504:             <div>
                   5505:               <div>
                   5506:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  5507:                 "id2589619" id=
        !          5508:                 "id2589619"></a>7.7.&nbsp;<code class=
1.14      xtraeme  5509:                 "filename">files/*</code></h2>
1.1       grant    5510:               </div>
                   5511:             </div>
                   5512:           </div>
                   5513: 
                   5514:           <p>If you have any files that you wish to be placed in
                   5515:           the package prior to configuration or building, you could
                   5516:           place these files here and use a &#8220;<span class=
                   5517:           "quote">${CP}</span>&#8221; command in the
                   5518:           &#8220;<span class="quote">pre-configure</span>&#8221;
                   5519:           target to achieve this. Alternatively, you could simply
1.14      xtraeme  5520:           diff the file against <code class=
                   5521:           "filename">/dev/null</code> and use the patch mechanism
                   5522:           to manage the creation of this file.</p>
1.1       grant    5523:         </div>
                   5524:       </div>
                   5525: 
                   5526:       <div class="chapter" lang="en" xml:lang="en">
                   5527:         <div class="titlepage">
                   5528:           <div>
                   5529:             <div>
                   5530:               <h2 class="title"><a name="plist" id=
                   5531:               "plist"></a>Chapter&nbsp;8.&nbsp;PLIST issues</h2>
                   5532:             </div>
                   5533:           </div>
                   5534:         </div>
                   5535: 
                   5536:         <div class="toc">
                   5537:           <p><b>Table of Contents</b></p>
                   5538: 
                   5539:           <dl>
1.18    ! xtraeme  5540:             <dt><span class="sect1"><a href="#id2589673">8.1. RCS
1.1       grant    5541:             ID</a></span></dt>
                   5542: 
1.18    ! xtraeme  5543:             <dt><span class="sect1"><a href="#id2589688">8.2.
1.14      xtraeme  5544:             Semi-automatic <code class="filename">PLIST</code>
                   5545:             generation</a></span></dt>
1.1       grant    5546: 
                   5547:             <dt><span class="sect1"><a href="#print-PLIST">8.3.
1.14      xtraeme  5548:             Tweaking output of <span><strong class="command">make
                   5549:             print-PLIST</strong></span></a></span></dt>
1.1       grant    5550: 
                   5551:             <dt><span class="sect1"><a href="#plist.misc">8.4.
                   5552:             Variable substitution in PLIST</a></span></dt>
                   5553: 
1.18    ! xtraeme  5554:             <dt><span class="sect1"><a href="#id2590077">8.5.
1.1       grant    5555:             Manpage-compression</a></span></dt>
                   5556: 
1.18    ! xtraeme  5557:             <dt><span class="sect1"><a href="#id2590119">8.6.
1.14      xtraeme  5558:             Changing PLIST source with <code class=
                   5559:             "varname">PLIST_SRC</code></a></span></dt>
1.1       grant    5560: 
1.18    ! xtraeme  5561:             <dt><span class="sect1"><a href="#id2590136">8.7.
1.1       grant    5562:             Platform specific and differing PLISTs</a></span></dt>
                   5563: 
                   5564:             <dt><span class="sect1"><a href="#faq.common-dirs">8.8.
                   5565:             Sharing directories between packages</a></span></dt>
                   5566:           </dl>
                   5567:         </div>
                   5568: 
1.14      xtraeme  5569:         <p>The <code class="filename">PLIST</code> file contains a
1.1       grant    5570:         package's &#8220;<span class="quote">packing
                   5571:         list</span>&#8221;, i.e. a list of files that belong to the
1.14      xtraeme  5572:         package (relative to the <code class=
                   5573:         "filename">${PREFIX}</code> directory it's been installed
                   5574:         in) plus some additional statements - see the <a href=
1.1       grant    5575:         "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_create+1+NetBSD-current">
                   5576:         <span class="citerefentry"><span class=
                   5577:         "refentrytitle">pkg_create</span>(1)</span></a> manpage for
                   5578:         a full list. This chapter addresses some issues that need
1.14      xtraeme  5579:         attention when dealing with the <code class=
                   5580:         "filename">PLIST</code> file (or files, see below!).</p>
1.1       grant    5581: 
                   5582:         <div class="sect1" lang="en" xml:lang="en">
                   5583:           <div class="titlepage">
                   5584:             <div>
                   5585:               <div>
                   5586:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  5587:                 "id2589673" id="id2589673"></a>8.1.&nbsp;RCS
1.1       grant    5588:                 ID</h2>
                   5589:               </div>
                   5590:             </div>
                   5591:           </div>
                   5592: 
                   5593:           <p>Be sure to add a RCS ID line as the first thing in any
1.14      xtraeme  5594:           <code class="filename">PLIST</code> file you write:</p>
1.1       grant    5595:           <pre class="programlisting">
1.17      sketch   5596: @comment $NetBSD$
1.1       grant    5597: </pre>
                   5598:         </div>
                   5599: 
                   5600:         <div class="sect1" lang="en" xml:lang="en">
                   5601:           <div class="titlepage">
                   5602:             <div>
                   5603:               <div>
                   5604:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  5605:                 "id2589688" id=
        !          5606:                 "id2589688"></a>8.2.&nbsp;Semi-automatic
1.14      xtraeme  5607:                 <code class="filename">PLIST</code> generation</h2>
1.1       grant    5608:               </div>
                   5609:             </div>
                   5610:           </div>
                   5611: 
1.14      xtraeme  5612:           <p>You can use the <span><strong class="command">make
                   5613:           print-PLIST</strong></span> command to output a PLIST
                   5614:           that matches any new files since the package was
                   5615:           extracted. See <a href="#build.helpful-targets" title=
1.1       grant    5616:           "11.3.&nbsp;Other helpful targets">Section&nbsp;11.3,
                   5617:           &#8220;Other helpful targets&#8221;</a> for more
                   5618:           information on this target.</p>
                   5619:         </div>
                   5620: 
                   5621:         <div class="sect1" lang="en" xml:lang="en">
                   5622:           <div class="titlepage">
                   5623:             <div>
                   5624:               <div>
                   5625:                 <h2 class="title" style="clear: both"><a name=
                   5626:                 "print-PLIST" id=
                   5627:                 "print-PLIST"></a>8.3.&nbsp;Tweaking output of
1.14      xtraeme  5628:                 <span><strong class="command">make
                   5629:                 print-PLIST</strong></span></h2>
1.1       grant    5630:               </div>
                   5631:             </div>
                   5632:           </div>
                   5633: 
                   5634:           <p>If you have used any of the *-dirs packages, as
                   5635:           explained in <a href="#faq.common-dirs" title=
                   5636:           "8.8.&nbsp;Sharing directories between packages">Section&nbsp;8.8,
                   5637:           &#8220;Sharing directories between packages&#8221;</a>,
1.14      xtraeme  5638:           you may have noticed that <span><strong class=
                   5639:           "command">make print-PLIST</strong></span> outputs a set
                   5640:           of <code class="varname">@comment</code>s instead of real
                   5641:           <code class="varname">@dirrm</code> lines. You can also
                   5642:           do this for specific directories and files, so that the
                   5643:           results of that command are very close to reality. This
                   5644:           helps <span class="emphasis"><em>a lot</em></span> during
                   5645:           the update of packages.</p>
                   5646: 
                   5647:           <p>The <code class="varname">PRINT_PLIST_AWK</code>
                   5648:           variable takes a set of AWK patterns and actions that are
                   5649:           used to filter the output of print-PLIST. You can
                   5650:           <span class="emphasis"><em>append</em></span> any chunk
                   5651:           of AWK scripting you like to it, but be careful with
1.1       grant    5652:           quoting.</p>
                   5653: 
1.14      xtraeme  5654:           <p>For example, to get all files inside the <code class=
                   5655:           "filename">libdata/foo</code> directory removed from the
1.1       grant    5656:           resulting PLIST:</p>
                   5657:           <pre class="programlisting">
                   5658:       PRINT_PLIST_AWK+= /^libdata\/foo/ { next; }
                   5659:     
                   5660: </pre>
                   5661: 
1.14      xtraeme  5662:           <p>And to get all the <code class="varname">@dirrm</code>
1.1       grant    5663:           lines referring to a specific (shared) directory
1.14      xtraeme  5664:           converted to <code class="varname">@comment</code>s:</p>
1.1       grant    5665:           <pre class="programlisting">
                   5666:       PRINT_PLIST_AWK+= /^@dirrm share\/specific/ { print "@comment " $$0; next; }
                   5667:     
                   5668: </pre>
                   5669:         </div>
                   5670: 
                   5671:         <div class="sect1" lang="en" xml:lang="en">
                   5672:           <div class="titlepage">
                   5673:             <div>
                   5674:               <div>
                   5675:                 <h2 class="title" style="clear: both"><a name=
                   5676:                 "plist.misc" id="plist.misc"></a>8.4.&nbsp;Variable
                   5677:                 substitution in PLIST</h2>
                   5678:               </div>
                   5679:             </div>
                   5680:           </div>
                   5681: 
                   5682:           <p>A number of variables are substituted automatically in
                   5683:           PLISTs when a package is installed on a system. This
                   5684:           includes the following variables:</p>
                   5685: 
                   5686:           <div class="variablelist">
                   5687:             <dl>
1.14      xtraeme  5688:               <dt><span class="term"><code class=
                   5689:               "varname">${MACHINE_ARCH}</code>, <code class=
                   5690:               "varname">${MACHINE_GNU_ARCH}</code></span></dt>
1.1       grant    5691: 
                   5692:               <dd>
                   5693:                 <p>Some packages like emacs and perl embed
                   5694:                 information about which architecture they were
                   5695:                 built on into the pathnames where they install
                   5696:                 their file. To handle this case, PLIST will be
                   5697:                 preprocessed before actually used, and the symbol
1.14      xtraeme  5698:                 &#8220;<span class="quote"><code class=
                   5699:                 "varname">${MACHINE_ARCH}</code></span>&#8221; will
                   5700:                 be replaced by what <span><strong class=
                   5701:                 "command">uname -p</strong></span> gives. The same
                   5702:                 is done if the string <code class=
                   5703:                 "varname">${MACHINE_GNU_ARCH}</code> is embedded in
                   5704:                 PLIST somewhere - use this on packages that have
                   5705:                 GNU autoconf created configure scripts.</p>
1.1       grant    5706: 
                   5707:                 <div class="note" style=
                   5708:                 "margin-left: 0.5in; margin-right: 0.5in;">
                   5709:                   <h3 class="title">Legacy note</h3>
                   5710: 
                   5711:                   <p>There used to be a symbol &#8220;<span class=
1.14      xtraeme  5712:                   "quote"><code class=
                   5713:                   "varname">$ARCH</code></span>&#8221; that was
                   5714:                   replaced by the output of <span><strong class=
                   5715:                   "command">uname -m</strong></span>, but that's no
1.1       grant    5716:                   longer supported and has been removed.</p>
                   5717:                 </div>
                   5718:               </dd>
                   5719: 
1.14      xtraeme  5720:               <dt><span class="term"><code class=
                   5721:               "varname">${OPSYS}</code>, <code class=
                   5722:               "varname">${LOWER_OPSYS}</code>, <code class=
                   5723:               "varname">${OS_VERSION}</code></span></dt>
1.1       grant    5724: 
                   5725:               <dd>
                   5726:                 <p>Some packages want to embed the OS name and
                   5727:                 version into some paths. To do this, use these
1.14      xtraeme  5728:                 variables in the <code class=
                   5729:                 "filename">PLIST</code>:</p>
1.1       grant    5730: 
                   5731:                 <div class="itemizedlist">
                   5732:                   <ul type="disc">
                   5733:                     <li>
1.14      xtraeme  5734:                       <p><code class="varname">${OPSYS}</code> -
                   5735:                       output of &#8220;<span class=
                   5736:                       "quote"><span><strong class="command">uname
                   5737:                       -s</strong></span></span>&#8221;</p>
1.1       grant    5738:                     </li>
                   5739: 
                   5740:                     <li>
1.14      xtraeme  5741:                       <p><code class=
                   5742:                       "varname">${LOWER_OPSYS}</code> - lowercase
                   5743:                       common name (eg. &#8220;<span class=
                   5744:                       "quote">solaris</span>&#8221;)</p>
1.1       grant    5745:                     </li>
                   5746: 
                   5747:                     <li>
1.14      xtraeme  5748:                       <p><code class="varname">${OS_VERSION}</code>
                   5749:                       - &#8220;<span class=
                   5750:                       "quote"><span><strong class="command">uname
                   5751:                       -r</strong></span></span>&#8221;</p>
1.1       grant    5752:                     </li>
                   5753:                   </ul>
                   5754:                 </div>
                   5755:               </dd>
                   5756: 
1.14      xtraeme  5757:               <dt><span class="term"><code class=
                   5758:               "varname">${PKGLOCALEDIR}</code></span></dt>
1.1       grant    5759: 
                   5760:               <dd>
                   5761:                 <p>Packages that install locale files should list
                   5762:                 them in the PLIST as &#8220;<span class=
                   5763:                 "quote">${PKGLOCALEDIR}/locale/de/LC_MESSAGES/...</span>&#8221;
                   5764:                 instead of &#8220;<span class=
                   5765:                 "quote">share/locale/de/LC_MESSAGES/...</span>&#8221;.
                   5766:                 This properly handles the fact that different
                   5767:                 operating systems expect locale files to be either
1.14      xtraeme  5768:                 in <code class="filename">share</code> or
                   5769:                 <code class="filename">lib</code> by default.</p>
1.1       grant    5770:               </dd>
                   5771:             </dl>
                   5772:           </div>
                   5773: 
                   5774:           <p>For a complete list of values which are replaced by
1.14      xtraeme  5775:           default, please look in <code class=
                   5776:           "filename">bsd.pkg.mk</code> (and search for <span class=
1.1       grant    5777:           "emphasis"><em>PLIST_SUBST</em></span>).</p>
                   5778: 
                   5779:           <p>If you want to change other variables not listed
                   5780:           above, you can add variables and their expansions to this
1.14      xtraeme  5781:           variable in the following way, similar to <code class=
                   5782:           "varname">MESSAGE_SUBST</code> (see <a href=
1.1       grant    5783:           "#components.optional" title=
                   5784:           "7.5.&nbsp;Optional files">Section&nbsp;7.5,
                   5785:           &#8220;Optional files&#8221;</a>):</p>
                   5786:           <pre class="programlisting">
                   5787: PLIST_SUBST+=    SOMEVAR="somevalue"
                   5788: </pre>
                   5789: 
                   5790:           <p>This replaces all occurrences of &#8220;<span class=
                   5791:           "quote">${SOMEVAR}</span>&#8221; in the PLIST with
                   5792:           &#8220;<span class="quote">somevalue</span>&#8221;.</p>
                   5793:         </div>
                   5794: 
                   5795:         <div class="sect1" lang="en" xml:lang="en">
                   5796:           <div class="titlepage">
                   5797:             <div>
                   5798:               <div>
                   5799:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  5800:                 "id2590077" id=
        !          5801:                 "id2590077"></a>8.5.&nbsp;Manpage-compression</h2>
1.1       grant    5802:               </div>
                   5803:             </div>
                   5804:           </div>
                   5805: 
                   5806:           <p>Manpages should be installed in compressed form if
1.14      xtraeme  5807:           <code class="varname">MANZ</code> is set (in <code class=
                   5808:           "filename">bsd.own.mk</code>), and uncompressed
                   5809:           otherwise. To handle this in the <code class=
                   5810:           "filename">PLIST</code> file, the suffix
                   5811:           &#8220;<span class="quote">.gz</span>&#8221; is
                   5812:           appended/removed automatically for manpages according to
                   5813:           <code class="varname">MANZ</code> and <code class=
                   5814:           "varname">MANCOMPRESSED</code> being set or not, see
                   5815:           above for details. This modification of the <code class=
                   5816:           "filename">PLIST</code> file is done on a copy of it, not
                   5817:           <code class="filename">PLIST</code> itself.</p>
1.1       grant    5818:         </div>
                   5819: 
                   5820:         <div class="sect1" lang="en" xml:lang="en">
                   5821:           <div class="titlepage">
                   5822:             <div>
                   5823:               <div>
                   5824:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  5825:                 "id2590119" id="id2590119"></a>8.6.&nbsp;Changing
1.14      xtraeme  5826:                 PLIST source with <code class=
                   5827:                 "varname">PLIST_SRC</code></h2>
1.1       grant    5828:               </div>
                   5829:             </div>
                   5830:           </div>
                   5831: 
1.14      xtraeme  5832:           <p>To use one or more files as source for the
                   5833:           <code class="filename">PLIST</code> used in generating
                   5834:           the binary package, set the variable <code class=
                   5835:           "varname">PLIST_SRC</code> to the names of that file(s).
1.1       grant    5836:           The files are later concatenated using cat(1), and order
                   5837:           of things is important.</p>
                   5838:         </div>
                   5839: 
                   5840:         <div class="sect1" lang="en" xml:lang="en">
                   5841:           <div class="titlepage">
                   5842:             <div>
                   5843:               <div>
                   5844:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  5845:                 "id2590136" id="id2590136"></a>8.7.&nbsp;Platform
1.1       grant    5846:                 specific and differing PLISTs</h2>
                   5847:               </div>
                   5848:             </div>
                   5849:           </div>
                   5850: 
                   5851:           <p>Some packages decide to install a different set of
                   5852:           files based on the operating system being used. These
                   5853:           differences can be automatically handled by using the
                   5854:           following files:</p>
                   5855: 
                   5856:           <div class="itemizedlist">
                   5857:             <ul type="disc">
                   5858:               <li>
1.14      xtraeme  5859:                 <p><code class="filename">PLIST.common</code></p>
1.1       grant    5860:               </li>
                   5861: 
                   5862:               <li>
1.14      xtraeme  5863:                 <p><code class="filename">PLIST.${OPSYS}</code></p>
1.1       grant    5864:               </li>
                   5865: 
                   5866:               <li>
1.14      xtraeme  5867:                 <p><code class=
                   5868:                 "filename">PLIST.common_end</code></p>
1.1       grant    5869:               </li>
                   5870:             </ul>
                   5871:           </div>
                   5872: 
1.14      xtraeme  5873:           <p>If <code class="filename">PLIST.${OPSYS}</code>
                   5874:           exists, these files are used instead of <code class=
                   5875:           "filename">PLIST</code>. This allows packages which
                   5876:           behave in this way to be handled gracefully. Manually
                   5877:           overriding <code class="varname">PLIST_SRC</code> for
                   5878:           other more exotic uses is also possible.</p>
1.1       grant    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=
                   5886:                 "faq.common-dirs" id=
                   5887:                 "faq.common-dirs"></a>8.8.&nbsp;Sharing directories
                   5888:                 between packages</h2>
                   5889:               </div>
                   5890:             </div>
                   5891:           </div>
                   5892: 
                   5893:           <p>A &#8220;<span class="quote">shared
                   5894:           directory</span>&#8221; is a directory where multiple
                   5895:           (and unrelated) packages install files. These directories
                   5896:           are problematic because you have to add special tricks in
                   5897:           the PLIST to conditionally remove them, or have some
                   5898:           centralized package handle them.</p>
                   5899: 
                   5900:           <p>Within pkgsrc, you'll find both approaches. If a
                   5901:           directory is shared by a few unrelated packages, it's
                   5902:           often not worth to add an extra package to remove it.
                   5903:           Therefore, one simply does:</p>
                   5904:           <pre class="programlisting">
                   5905:       @unexec ${RMDIR} %D/path/to/shared/directory 2&gt;/dev/null || ${TRUE}
                   5906:     
                   5907: </pre>
                   5908: 
                   5909:           <p>in the PLISTs of all affected packages, instead of the
                   5910:           regular "@dirrm" line.</p>
                   5911: 
                   5912:           <p>However, if the directory is shared across many
                   5913:           packages, two different solutions are available:</p>
                   5914: 
                   5915:           <div class="orderedlist">
                   5916:             <ol type="1">
                   5917:               <li>
                   5918:                 <p>If the packages have a common dependency, the
                   5919:                 directory can be removed in that. For example, see
                   5920:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   5921:                 href=
                   5922:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/textproc/scrollkeeper/README.html"
1.14      xtraeme  5923:                 class="pkgname">textproc/scrollkeeper</a>, which
                   5924:                 removes the shared directory <code class=
                   5925:                 "filename">share/omf</code>.</p>
1.1       grant    5926:               </li>
                   5927: 
                   5928:               <li>
                   5929:                 <p>If the packages using the directory are not
                   5930:                 related at all (they have no common dependencies),
                   5931:                 a *-dirs package is used.</p>
                   5932:               </li>
                   5933:             </ol>
                   5934:           </div>
                   5935: 
                   5936:           <p>From now on, we'll discuss the second solution. To get
                   5937:           an idea of the *-dirs packages available, issue:</p>
                   5938:           <pre class="programlisting">
1.14      xtraeme  5939:       <code class="prompt">%</code> cd .../pkgsrc
                   5940:       <code class="prompt">%</code> ls -d */*-dirs
1.1       grant    5941:     
                   5942: </pre>
                   5943: 
                   5944:           <p>Their use from other packages is very simple. The
1.14      xtraeme  5945:           <code class="varname">USE_DIRS</code> variable takes a
                   5946:           list of package names (without the &#8220;<span class=
1.1       grant    5947:           "quote">-dirs</span>&#8221; part) together with the
                   5948:           required version number (always pick the latest one when
                   5949:           writting new packages).</p>
                   5950: 
                   5951:           <p>For example, if a package installs files under
1.14      xtraeme  5952:           <code class="filename">share/applications</code>, it
                   5953:           should have the following line in it:</p>
1.1       grant    5954:           <pre class="programlisting">
                   5955:       USE_DIRS+= xdg-1.1
                   5956:     
                   5957: </pre>
                   5958: 
1.14      xtraeme  5959:           <p>After regenerating the PLIST using
                   5960:           <span><strong class="command">make
                   5961:           print-PLIST</strong></span>, you should get the right
                   5962:           (commented out) lines.</p>
1.1       grant    5963: 
1.14      xtraeme  5964:           <p>Note that, even if your package is using <code class=
                   5965:           "filename">$X11BASE</code>, it must not depend on the
1.1       grant    5966:           *-x11-dirs packages. Just specify the name without that
1.14      xtraeme  5967:           part and pkgsrc (in particular, <code class=
                   5968:           "filename">mk/dirs.mk</code>) will take care of it.</p>
1.1       grant    5969:         </div>
                   5970:       </div>
                   5971: 
                   5972:       <div class="chapter" lang="en" xml:lang="en">
                   5973:         <div class="titlepage">
                   5974:           <div>
                   5975:             <div>
                   5976:               <h2 class="title"><a name="buildlink" id=
                   5977:               "buildlink"></a>Chapter&nbsp;9.&nbsp;Buildlink
                   5978:               methodology</h2>
                   5979:             </div>
                   5980:           </div>
                   5981:         </div>
                   5982: 
                   5983:         <div class="toc">
                   5984:           <p><b>Table of Contents</b></p>
                   5985: 
                   5986:           <dl>
1.18    ! xtraeme  5987:             <dt><span class="sect1"><a href="#id2590476">9.1.
1.1       grant    5988:             Converting packages to use buildlink3</a></span></dt>
                   5989: 
1.18    ! xtraeme  5990:             <dt><span class="sect1"><a href="#id2590667">9.2.
1.14      xtraeme  5991:             Writing <code class="filename">buildlink3.mk</code>
                   5992:             files</a></span></dt>
1.1       grant    5993: 
                   5994:             <dd>
                   5995:               <dl>
1.18    ! xtraeme  5996:                 <dt><span class="sect2"><a href="#id2590737">9.2.1.
1.1       grant    5997:                 Anatomy of a buildlink3.mk file</a></span></dt>
                   5998: 
1.18    ! xtraeme  5999:                 <dt><span class="sect2"><a href="#id2591177">9.2.2.
1.14      xtraeme  6000:                 Updating <code class=
                   6001:                 "varname">BUILDLINK_DEPENDS.<em class=
                   6002:                 "replaceable"><code>pkg</code></em></code> in
                   6003:                 <code class="filename">buildlink3.mk</code>
1.1       grant    6004:                 files</a></span></dt>
                   6005:               </dl>
                   6006:             </dd>
                   6007: 
1.18    ! xtraeme  6008:             <dt><span class="sect1"><a href="#id2591256">9.3.
1.14      xtraeme  6009:             Writing <code class="filename">builtin.mk</code>
                   6010:             files</a></span></dt>
1.1       grant    6011: 
                   6012:             <dd>
                   6013:               <dl>
1.18    ! xtraeme  6014:                 <dt><span class="sect2"><a href="#id2591542">9.3.1.
1.14      xtraeme  6015:                 Anatomy of a <code class=
                   6016:                 "filename">builtin.mk</code> file</a></span></dt>
1.1       grant    6017: 
1.18    ! xtraeme  6018:                 <dt><span class="sect2"><a href="#id2591769">9.3.2.
1.1       grant    6019:                 Global preferences for native or pkgsrc
                   6020:                 software</a></span></dt>
                   6021:               </dl>
                   6022:             </dd>
                   6023:           </dl>
                   6024:         </div>
                   6025: 
                   6026:         <p>Buildlink is a framework in pkgsrc that controls what
                   6027:         headers and libraries are seen by a package's configure and
                   6028:         build processes. This is implemented in a two step
                   6029:         process:</p>
                   6030: 
                   6031:         <div class="orderedlist">
                   6032:           <ol type="1">
                   6033:             <li>
                   6034:               <p>Symlink headers and libraries for dependencies
1.14      xtraeme  6035:               into <code class="varname">BUILDLINK_DIR</code>,
                   6036:               which by default is a subdirectory of <code class=
                   6037:               "varname">WRKDIR</code>.</p>
1.1       grant    6038:             </li>
                   6039: 
                   6040:             <li>
                   6041:               <p>Create wrapper scripts that are used in place of
1.14      xtraeme  6042:               the normal compiler tools that translate <code class=
                   6043:               "option">-I${LOCALBASE}/include</code> and
                   6044:               <code class="option">-L${LOCALBASE}/lib</code> into
                   6045:               references to <code class=
                   6046:               "varname">BUILDLINK_DIR</code>. The wrapper scripts
                   6047:               also make native compiler on some operating systems
                   6048:               look like GCC, so that packages that expect GCC won't
                   6049:               require modifications to build with those native
                   6050:               compilers.</p>
1.1       grant    6051:             </li>
                   6052:           </ol>
                   6053:         </div>
                   6054: 
                   6055:         <p>This normalizes the environment in which a package is
                   6056:         built so that the package may be built consistently despite
                   6057:         what other software may be installed. Please note that the
1.14      xtraeme  6058:         normal system header and library paths, e.g. <code class=
                   6059:         "filename">/usr/include</code>, <code class=
                   6060:         "filename">/usr/lib</code>, etc., are always searched --
1.1       grant    6061:         buildlink3 is designed to insulate the package build from
                   6062:         non-system-supplied software.</p>
                   6063: 
                   6064:         <div class="sect1" lang="en" xml:lang="en">
                   6065:           <div class="titlepage">
                   6066:             <div>
                   6067:               <div>
                   6068:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  6069:                 "id2590476" id="id2590476"></a>9.1.&nbsp;Converting
1.1       grant    6070:                 packages to use buildlink3</h2>
                   6071:               </div>
                   6072:             </div>
                   6073:           </div>
                   6074: 
                   6075:           <p>The process of converting packages to use the
                   6076:           buildlink3 framework (&#8220;<span class=
                   6077:           "quote">bl3ifying</span>&#8221;) is fairly
                   6078:           straightforward. The things to keep in mind are:</p>
                   6079: 
                   6080:           <div class="orderedlist">
                   6081:             <ol type="1">
                   6082:               <li>
1.14      xtraeme  6083:                 <p>Set <code class="varname">USE_BUILDLINK3</code>
                   6084:                 to &#8220;<span class=
                   6085:                 "quote">yes</span>&#8221;.</p>
1.1       grant    6086:               </li>
                   6087: 
                   6088:               <li>
                   6089:                 <p>Ensure that the build always calls the wrapper
                   6090:                 scripts instead of the actual toolchain. Some
                   6091:                 packages are tricky, and the only way to know for
1.14      xtraeme  6092:                 sure is the check <code class=
                   6093:                 "filename">${WRKDIR}/.work.log</code> to see if the
1.1       grant    6094:                 wrappers are being invoked.</p>
                   6095:               </li>
                   6096: 
                   6097:               <li>
1.14      xtraeme  6098:                 <p>Don't override <code class=
                   6099:                 "varname">PREFIX</code> from within the package
                   6100:                 Makefile, e.g. Java VMs, standalone shells, etc.,
                   6101:                 because the code to symlink files into <code class=
                   6102:                 "filename">${BUILDLINK_DIR}</code> looks for files
1.1       grant    6103:                 relative to &#8220;<span class="quote">pkg_info -qp
1.14      xtraeme  6104:                 <em class=
                   6105:                 "replaceable"><code>pkgname</code></em></span>&#8221;.</p>
1.1       grant    6106:               </li>
                   6107: 
                   6108:               <li>
                   6109:                 <p>Remember that <span class=
1.14      xtraeme  6110:                 "emphasis"><em>only</em></span> the <code class=
                   6111:                 "filename">buildlink3.mk</code> files that you list
1.1       grant    6112:                 in a package's Makefile are added as dependencies
                   6113:                 for that package.</p>
                   6114:               </li>
                   6115:             </ol>
                   6116:           </div>
                   6117: 
                   6118:           <p>If a dependency on a particular package is required
                   6119:           for its libraries and headers, then we replace:</p>
                   6120:           <pre class="programlisting">
                   6121: DEPENDS+=       foo&gt;=1.1.0:../../category/foo
                   6122: </pre>
                   6123: 
                   6124:           <p>with</p>
                   6125:           <pre class="programlisting">
                   6126: .include "../../category/foo/buildlink3.mk"
                   6127: </pre>
                   6128: 
1.14      xtraeme  6129:           <p>There are several <code class=
                   6130:           "filename">buildlink3.mk</code> files in <code class=
                   6131:           "filename">pkgsrc/mk</code> that handle special package
1.1       grant    6132:           issues:</p>
                   6133: 
                   6134:           <div class="itemizedlist">
                   6135:             <ul type="disc">
                   6136:               <li>
1.14      xtraeme  6137:                 <p><code class="filename">bdb.buildlink3.mk</code>
1.1       grant    6138:                 chooses either the native or a pkgsrc Berkeley DB
1.14      xtraeme  6139:                 implementation based on the values of <code class=
                   6140:                 "varname">BDB_ACCEPTED</code> and <code class=
                   6141:                 "varname">BDB_DEFAULT</code>.</p>
1.1       grant    6142:               </li>
                   6143: 
                   6144:               <li>
1.14      xtraeme  6145:                 <p><code class=
                   6146:                 "filename">curses.buildlink3.mk</code> If the
                   6147:                 system comes with neither Curses nor NCurses, this
                   6148:                 will take care to install the <a xmlns=
                   6149:                 "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    6150:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ncurses/README.html"
1.14      xtraeme  6151:                 class="pkgname">devel/ncurses</a> package.</p>
1.1       grant    6152:               </li>
                   6153: 
                   6154:               <li>
1.14      xtraeme  6155:                 <p><code class="filename">krb5.buildlink3.mk</code>
                   6156:                 uses the value of <code class=
                   6157:                 "varname">KRB5_ACCEPTED</code> to choose between
1.1       grant    6158:                 adding a dependency on Heimdal or MIT-krb5 for
                   6159:                 packages that require a Kerberos 5
                   6160:                 implementation.</p>
                   6161:               </li>
                   6162: 
                   6163:               <li>
1.14      xtraeme  6164:                 <p><code class=
                   6165:                 "filename">motif.buildlink3.mk</code> checks for a
                   6166:                 system-provided Motif installation or adds a
                   6167:                 dependency on <a xmlns=
1.1       grant    6168:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6169:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/lesstif/README.html"
1.14      xtraeme  6170:                 class="pkgname">x11/lesstif</a> or <a xmlns=
                   6171:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6172:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/openmotif/README.html"
                   6173:                 class="pkgname">x11/openmotif</a>;</p>
1.1       grant    6174:               </li>
                   6175: 
                   6176:               <li>
1.14      xtraeme  6177:                 <p><code class=
                   6178:                 "filename">ossaudio.buildlink3.mk</code> defines
                   6179:                 several variables that may be used by packages that
                   6180:                 use the Open Sound System (OSS) API;</p>
1.1       grant    6181:               </li>
                   6182: 
                   6183:               <li>
1.14      xtraeme  6184:                 <p><code class=
                   6185:                 "filename">pgsql.buildlink3.mk</code> will accept
                   6186:                 either Postgres 7.3 or 7.4, whichever is found
                   6187:                 installed. See the file for more information.</p>
1.1       grant    6188:               </li>
                   6189: 
                   6190:               <li>
1.14      xtraeme  6191:                 <p><code class=
                   6192:                 "filename">pthread.buildlink3.mk</code> uses the
                   6193:                 value of <code class="varname">PTHREAD_OPTS</code>
                   6194:                 and checks for native pthreads or adds a dependency
                   6195:                 on <a xmlns=
1.1       grant    6196:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   6197:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/pth/README.html"
1.14      xtraeme  6198:                 class="pkgname">devel/pth</a> as needed;</p>
1.1       grant    6199:               </li>
                   6200: 
                   6201:               <li>
1.14      xtraeme  6202:                 <p><code class="filename">xaw.buildlink3.mk</code>
                   6203:                 uses the value of <code class=
                   6204:                 "varname">XAW_TYPE</code> to choose a particular
                   6205:                 Athena widgets library.</p>
1.1       grant    6206:               </li>
                   6207:             </ul>
                   6208:           </div>
                   6209: 
1.14      xtraeme  6210:           <p>The comments in those <code class=
                   6211:           "filename">buildlink3.mk</code> files provide a more
1.1       grant    6212:           complete description of how to use them properly.</p>
                   6213:         </div>
                   6214: 
                   6215:         <div class="sect1" lang="en" xml:lang="en">
                   6216:           <div class="titlepage">
                   6217:             <div>
                   6218:               <div>
                   6219:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  6220:                 "id2590667" id="id2590667"></a>9.2.&nbsp;Writing
1.14      xtraeme  6221:                 <code class="filename">buildlink3.mk</code>
                   6222:                 files</h2>
1.1       grant    6223:               </div>
                   6224:             </div>
                   6225:           </div>
                   6226: 
1.14      xtraeme  6227:           <p>A package's <code class=
                   6228:           "filename">buildlink3.mk</code> file is included by
                   6229:           Makefiles to indicate the need to compile and link
                   6230:           against header files and libraries provided by the
                   6231:           package. A <code class="filename">buildlink3.mk</code>
                   6232:           file should always provide enough information to add the
                   6233:           correct type of dependency relationship and include any
                   6234:           other <code class="filename">buildlink3.mk</code> files
                   6235:           that it needs to find headers and libraries that it needs
                   6236:           in turn.</p>
1.1       grant    6237: 
1.14      xtraeme  6238:           <p>To generate an initial <code class=
                   6239:           "filename">buildlink3.mk</code> file for further editing,
1.1       grant    6240:           Rene Hexel's <a xmlns=
                   6241:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   6242:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/createbuildlink/README.html"
1.14      xtraeme  6243:           class="pkgname">pkgtools/createbuildlink</a> package is
                   6244:           highly recommended. For most packages, the following
                   6245:           command will generate a good starting point for
                   6246:           <code class="filename">buildlink3.mk</code> files:</p>
1.1       grant    6247:           <pre class="screen">
1.14      xtraeme  6248: <code class="prompt">%</code> <strong class=
                   6249: "userinput"><code>cd pkgsrc/<em class=
                   6250: "replaceable"><code>category</code></em>/<em class=
                   6251: "replaceable"><code>pkgdir</code></em>
                   6252: <code class=
                   6253: "prompt">%</code> createbuildlink -3 &gt;buildlink3.mk</code></strong>
1.1       grant    6254: </pre>
                   6255: 
                   6256:           <div class="sect2" lang="en" xml:lang="en">
                   6257:             <div class="titlepage">
                   6258:               <div>
                   6259:                 <div>
1.18    ! xtraeme  6260:                   <h3 class="title"><a name="id2590737" id=
        !          6261:                   "id2590737"></a>9.2.1. Anatomy of a buildlink3.mk
1.1       grant    6262:                   file</h3>
                   6263:                 </div>
                   6264:               </div>
                   6265:             </div>
                   6266: 
1.14      xtraeme  6267:             <p>The following real-life example <code class=
                   6268:             "filename">buildlink3.mk</code> is taken from
                   6269:             <code class="filename">pkgsrc/graphics/tiff</code>:</p>
1.1       grant    6270:             <pre class="programlisting">
1.17      sketch   6271: # $NetBSD: buildlink3.mk,v 1.7 2004/03/18 09:12:12 jlam Exp $
1.1       grant    6272: 
                   6273: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH}+
                   6274: TIFF_BUILDLINK3_MK:=    ${TIFF_BUILDLINK3_MK}+
                   6275: 
                   6276: .if !empty(BUILDLINK_DEPTH:M+)
                   6277: BUILDLINK_DEPENDS+=     tiff
                   6278: .endif
                   6279: 
                   6280: BUILDLINK_PACKAGES:=    ${BUILDLINK_PACKAGES:Ntiff}
                   6281: BUILDLINK_PACKAGES+=    tiff
                   6282: 
                   6283: .if !empty(TIFF_BUILDLINK3_MK:M+)
                   6284: BUILDLINK_DEPENDS.tiff+=        tiff&gt;=3.6.1
                   6285: BUILDLINK_PKGSRCDIR.tiff?=      ../../graphics/tiff
                   6286: .endif  # TIFF_BUILDLINK3_MK
                   6287: 
                   6288: .include "../../devel/zlib/buildlink3.mk"
                   6289: .include "../../graphics/jpeg/buildlink3.mk"
                   6290: 
                   6291: BUILDLINK_DEPTH:=       ${BUILDLINK_DEPTH:S/+$//} 
                   6292: </pre>
                   6293: 
1.14      xtraeme  6294:             <p>The header and footer manipulate <code class=
                   6295:             "varname">BUILDLINK_DEPTH</code>, which is common
                   6296:             across all <code class="filename">buildlink3.mk</code>
                   6297:             files and is used to track at what depth we are
                   6298:             including <code class="filename">buildlink3.mk</code>
                   6299:             files.</p>
1.1       grant    6300: 
                   6301:             <p>The first section controls if the dependency on
1.14      xtraeme  6302:             <em class="replaceable"><code>pkg</code></em> is added.
                   6303:             <code class="varname">BUILDLINK_DEPENDS</code> is the
1.1       grant    6304:             global list of packages for which dependencies are
                   6305:             added by buildlink3.</p>
                   6306: 
                   6307:             <p>The second section advises pkgsrc that the
1.14      xtraeme  6308:             <code class="filename">buildlink3.mk</code> file for
                   6309:             <em class="replaceable"><code>pkg</code></em> has been
                   6310:             included at some point. <code class=
                   6311:             "varname">BUILDLINK_PACKAGES</code> is the global list
                   6312:             of packages for which <code class=
                   6313:             "filename">buildlink3.mk</code> files have been
                   6314:             included. It must <span class=
                   6315:             "emphasis"><em>always</em></span> be appended to within
                   6316:             a <code class="filename">buildlink3.mk</code> file.</p>
1.1       grant    6317: 
                   6318:             <p>The third section is protected from multiple
1.14      xtraeme  6319:             inclusion and controls how the dependency on <em class=
                   6320:             "replaceable"><code>pkg</code></em> is added. Several
1.1       grant    6321:             important variables are set in the section:</p>
                   6322: 
                   6323:             <div class="itemizedlist">
                   6324:               <ul type="disc">
                   6325:                 <li>
1.14      xtraeme  6326:                   <p><code class=
                   6327:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6328:                   "replaceable"><code>pkg</code></em></code> is the
                   6329:                   actual dependency recorded in the installed
                   6330:                   package; this should always be set using
                   6331:                   <span><strong class="command">+=</strong></span>
                   6332:                   to ensure that we're appending to any
                   6333:                   pre-existing list of values. This variable should
                   6334:                   be set to the first version of the package that
                   6335:                   had the last change in the major number of a
                   6336:                   shared library or that had a major API
                   6337:                   change.</p>
1.1       grant    6338:                 </li>
                   6339: 
                   6340:                 <li>
1.14      xtraeme  6341:                   <p><code class=
                   6342:                   "varname">BUILDLINK_PKGSRCDIR.<em class=
                   6343:                   "replaceable"><code>pkg</code></em></code> is the
                   6344:                   location of the <em class=
                   6345:                   "replaceable"><code>pkg</code></em> pkgsrc
1.1       grant    6346:                   directory;</p>
                   6347:                 </li>
                   6348: 
                   6349:                 <li>
1.14      xtraeme  6350:                   <p><code class=
                   6351:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6352:                   "replaceable"><code>pkg</code></em></code> (not
                   6353:                   shown above) controls whether we use <code class=
                   6354:                   "varname">BUILD_DEPENDS</code> or <code class=
                   6355:                   "varname">DEPENDS</code> to add the dependency on
                   6356:                   <em class="replaceable"><code>pkg</code></em>.
                   6357:                   The build dependency is selected by setting
                   6358:                   <code class=
                   6359:                   "varname">BUILDLINK_DEPMETHOD.<em class=
                   6360:                   "replaceable"><code>pkg</code></em></code> to
1.1       grant    6361:                   &#8220;<span class="quote">build</span>&#8221;.
                   6362:                   By default, the full dependency is used.</p>
                   6363:                 </li>
                   6364: 
                   6365:                 <li>
1.14      xtraeme  6366:                   <p><code class=
                   6367:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6368:                   "replaceable"><code>pkg</code></em></code> and
                   6369:                   <code class=
                   6370:                   "varname">BUILDLINK_LIBDIRS.<em class="replaceable">
                   6371:                   <code>pkg</code></em></code> (not shown above)
                   6372:                   are lists of subdirectories of <code class=
                   6373:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6374:                   "replaceable"><code>pkg</code></em>}</code> to
                   6375:                   add to the header and library search paths. These
1.1       grant    6376:                   default to &#8220;<span class=
                   6377:                   "quote">include</span>&#8221; and
                   6378:                   &#8220;<span class="quote">lib</span>&#8221;
                   6379:                   respectively.</p>
                   6380:                 </li>
                   6381: 
                   6382:                 <li>
1.14      xtraeme  6383:                   <p><code class=
                   6384:                   "varname">BUILDLINK_CPPFLAGS.<em class=
                   6385:                   "replaceable"><code>pkg</code></em></code> (not
                   6386:                   shown above) is the list of preprocessor flags to
                   6387:                   add to <code class="varname">CPPFLAGS</code>,
                   6388:                   which are passed on to the configure and build
                   6389:                   phases. The &#8220;<span class=
                   6390:                   "quote">-I</span>&#8221; option should be avoided
                   6391:                   and instead be handled using <code class=
                   6392:                   "varname">BUILDLINK_INCDIRS.<em class=
                   6393:                   "replaceable"><code>pkg</code></em></code> as
                   6394:                   above.</p>
1.1       grant    6395:                 </li>
                   6396:               </ul>
                   6397:             </div>
                   6398: 
                   6399:             <p>The following variables are all optionally defined
                   6400:             within this second section (protected against multiple
                   6401:             inclusion) and control which package files are
1.14      xtraeme  6402:             symlinked into <code class=
                   6403:             "filename">${BUILDLINK_DIR}</code> and how their names
1.1       grant    6404:             are transformed during the symlinking:</p>
                   6405: 
                   6406:             <div class="itemizedlist">
                   6407:               <ul type="disc">
                   6408:                 <li>
1.14      xtraeme  6409:                   <p><code class=
                   6410:                   "varname">BUILDLINK_FILES.<em class=
                   6411:                   "replaceable"><code>pkg</code></em></code> (not
                   6412:                   shown above) is a shell glob pattern relative to
                   6413:                   <code class=
                   6414:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6415:                   "replaceable"><code>pkg</code></em>}</code> to be
                   6416:                   symlinked into <code class=
                   6417:                   "filename">${BUILDLINK_DIR}</code>, e.g.
                   6418:                   <code class="filename">include/*.h</code>.</p>
1.1       grant    6419:                 </li>
                   6420: 
                   6421:                 <li>
1.14      xtraeme  6422:                   <p><code class=
                   6423:                   "varname">BUILDLINK_FILES_CMD.<em class=
                   6424:                   "replaceable"><code>pkg</code></em></code> (not
                   6425:                   shown above) is a shell pipeline that outputs to
                   6426:                   stdout a list of files relative to <code class=
                   6427:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6428:                   "replaceable"><code>pkg</code></em>}</code>. The
1.1       grant    6429:                   resulting files are to be symlinked into
1.14      xtraeme  6430:                   <code class="filename">${BUILDLINK_DIR}</code>.
                   6431:                   By default, this takes the <code class=
                   6432:                   "filename">+CONTENTS</code> of a <em class=
                   6433:                   "replaceable"><code>pkg</code></em> and filters
                   6434:                   it through <code class=
                   6435:                   "varname">${BUILDLINK_CONTENTS_FILTER.<em class=
                   6436:                   "replaceable"><code>pkg</code></em>}</code>.</p>
1.1       grant    6437:                 </li>
                   6438: 
                   6439:                 <li>
1.14      xtraeme  6440:                   <p><code class=
                   6441:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6442:                   "replaceable"><code>pkg</code></em></code> (not
                   6443:                   shown above) is a filter command that filters
                   6444:                   <code class="filename">+CONTENTS</code> input
                   6445:                   into a list of files relative to <code class=
                   6446:                   "filename">${BUILDLINK_PREFIX.<em class=
                   6447:                   "replaceable"><code>pkg</code></em>}</code> on
                   6448:                   stdout. By default for overwrite packages,
                   6449:                   <code class=
                   6450:                   "varname">BUILDLINK_CONTENTS_FILTER.<em class=
                   6451:                   "replaceable"><code>pkg</code></em></code>
                   6452:                   outputs the contents of the <code class=
                   6453:                   "filename">include</code> and <code class=
                   6454:                   "filename">lib</code> directories in the package
                   6455:                   <code class="filename">+CONTENTS</code>, and for
                   6456:                   pkgviews packages, it outputs any libtool
                   6457:                   archives in <code class="filename">lib</code>
1.1       grant    6458:                   directories.</p>
                   6459:                 </li>
                   6460: 
                   6461:                 <li>
1.14      xtraeme  6462:                   <p><code class=
                   6463:                   "varname">BUILDLINK_TRANSFORM.<em class=
                   6464:                   "replaceable"><code>pkg</code></em></code> (not
                   6465:                   shown above) is a list of sed arguments used to
1.1       grant    6466:                   transform the name of the source filename into a
1.14      xtraeme  6467:                   destination filename, e.g. <span><strong class=
1.1       grant    6468:                   "command">-e
1.14      xtraeme  6469:                   "s|/curses.h|/ncurses.h|g"</strong></span>.</p>
1.1       grant    6470:                 </li>
                   6471:               </ul>
                   6472:             </div>
                   6473: 
1.14      xtraeme  6474:             <p>The last section includes any <code class=
                   6475:             "filename">buildlink3.mk</code> needed for <em class=
                   6476:             "replaceable"><code>pkg</code></em>'s library
                   6477:             dependencies. Including these <code class=
                   6478:             "filename">buildlink3.mk</code> files means that the
                   6479:             headers and libraries for these dependencies are also
                   6480:             symlinked into <code class=
                   6481:             "filename">${BUILDLINK_DIR}</code> whenever the
                   6482:             <em class="replaceable"><code>pkg</code></em>
                   6483:             <code class="filename">buildlink3.mk</code> file is
                   6484:             included.</p>
1.1       grant    6485:           </div>
                   6486: 
                   6487:           <div class="sect2" lang="en" xml:lang="en">
                   6488:             <div class="titlepage">
                   6489:               <div>
                   6490:                 <div>
1.18    ! xtraeme  6491:                   <h3 class="title"><a name="id2591177" id=
        !          6492:                   "id2591177"></a>9.2.2. Updating <code class=
1.14      xtraeme  6493:                   "varname">BUILDLINK_DEPENDS.<em class=
                   6494:                   "replaceable"><code>pkg</code></em></code> in
                   6495:                   <code class="filename">buildlink3.mk</code>
                   6496:                   files</h3>
1.1       grant    6497:                 </div>
                   6498:               </div>
                   6499:             </div>
                   6500: 
                   6501:             <p>There are two situations that require increasing the
1.14      xtraeme  6502:             dependency listed in <code class=
                   6503:             "varname">BUILDLINK_DEPENDS.<em class=
                   6504:             "replaceable"><code>pkg</code></em></code> after a
                   6505:             package update:</p>
1.1       grant    6506: 
                   6507:             <div class="orderedlist">
                   6508:               <ol type="1">
                   6509:                 <li>
                   6510:                   <p>if the sonames (major number of the library
                   6511:                   version) of any installed shared libraries
                   6512:                   change;</p>
                   6513:                 </li>
                   6514: 
                   6515:                 <li>
                   6516:                   <p>if the API or interface to the header files
                   6517:                   change.</p>
                   6518:                 </li>
                   6519:               </ol>
                   6520:             </div>
                   6521: 
1.14      xtraeme  6522:             <p>In these cases, <code class=
                   6523:             "varname">BUILDLINK_DEPENDS.<em class=
                   6524:             "replaceable"><code>pkg</code></em></code> should be
                   6525:             adjusted to require at least the new package version.
                   6526:             In some cases, the packages that depend on this new
                   6527:             version may need their <code class=
                   6528:             "varname">PKGREVISION</code>s increased and, if they
                   6529:             have <code class="filename">buildlink3.mk</code> files,
                   6530:             their <code class=
                   6531:             "varname">BUILDLINK_DEPENDS.<em class="replaceable"><code>
                   6532:             pkg</code></em></code> adjusted, too. This is needed so
                   6533:             that binary packages made using it will require the
                   6534:             correct package dependency and not settle for an older
                   6535:             one which will not contain the necessary shared
                   6536:             libraries.</p>
1.1       grant    6537: 
                   6538:             <p>Please take careful consideration before adjusting
1.14      xtraeme  6539:             <code class="varname">BUILDLINK_DEPENDS.<em class=
                   6540:             "replaceable"><code>pkg</code></em></code> as we don't
                   6541:             want to cause unneeded package deletions and rebuilds.
                   6542:             In many cases, new versions of packages work just fine
                   6543:             with older dependencies. See <a href="#dependencies"
                   6544:             title="12.1.3.&nbsp;Handling dependencies">Section
                   6545:             12.1.3, &#8220;Handling dependencies&#8221;</a> and
                   6546:             <a href="#buildlink" title=
1.1       grant    6547:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter 9,
                   6548:             <i>Buildlink methodology</i></a> for more information
                   6549:             about dependencies on other packages, including the
1.14      xtraeme  6550:             <code class="varname">BUILDLINK_RECOMMENDED</code> and
                   6551:             <code class="varname">RECOMMENDED</code>
                   6552:             definitions.</p>
1.1       grant    6553:           </div>
                   6554:         </div>
                   6555: 
                   6556:         <div class="sect1" lang="en" xml:lang="en">
                   6557:           <div class="titlepage">
                   6558:             <div>
                   6559:               <div>
                   6560:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  6561:                 "id2591256" id="id2591256"></a>9.3.&nbsp;Writing
1.14      xtraeme  6562:                 <code class="filename">builtin.mk</code> files</h2>
1.1       grant    6563:               </div>
                   6564:             </div>
                   6565:           </div>
                   6566: 
                   6567:           <p>Some packages in pkgsrc install headers and libraries
                   6568:           that coincide with headers and libraries present in the
1.14      xtraeme  6569:           base system. Aside from a <code class=
                   6570:           "filename">buildlink3.mk</code> file, these packages
                   6571:           should also include a <code class=
                   6572:           "filename">builtin.mk</code> file that includes the
                   6573:           necessary checks to decide whether using the built-in
                   6574:           software or the pkgsrc software is appropriate.</p>
1.1       grant    6575: 
                   6576:           <p>The only requirements of a builtin.mk file for
1.14      xtraeme  6577:           <em class="replaceable"><code>pkg</code></em> are:</p>
1.1       grant    6578: 
                   6579:           <div class="orderedlist">
                   6580:             <ol type="1">
                   6581:               <li>
1.14      xtraeme  6582:                 <p>It should set <code class=
                   6583:                 "varname">USE_BUILTIN.<em class=
                   6584:                 "replaceable"><code>pkg</code></em></code> to
                   6585:                 either &#8220;<span class="quote">yes</span>&#8221;
                   6586:                 or &#8220;<span class="quote">no</span>&#8221;
                   6587:                 after it is included.</p>
1.1       grant    6588:               </li>
                   6589: 
                   6590:               <li>
                   6591:                 <p>It should <span class=
                   6592:                 "emphasis"><em>not</em></span> override any
1.14      xtraeme  6593:                 <code class="varname">USE_BUILTIN.<em class=
                   6594:                 "replaceable"><code>pkg</code></em></code> which is
                   6595:                 already set before the <code class=
                   6596:                 "filename">builtin.mk</code> file is included.</p>
1.1       grant    6597:               </li>
                   6598: 
                   6599:               <li>
                   6600:                 <p>It should be written to allow multiple
                   6601:                 inclusion. This is <span class=
                   6602:                 "emphasis"><em>very</em></span> important and takes
1.14      xtraeme  6603:                 careful attention to <code class=
                   6604:                 "filename">Makefile</code> coding.</p>
1.1       grant    6605:               </li>
                   6606:             </ol>
                   6607:           </div>
                   6608: 
                   6609:           <div class="sect2" lang="en" xml:lang="en">
                   6610:             <div class="titlepage">
                   6611:               <div>
                   6612:                 <div>
1.18    ! xtraeme  6613:                   <h3 class="title"><a name="id2591542" id=
        !          6614:                   "id2591542"></a>9.3.1.&nbsp;Anatomy of a
1.14      xtraeme  6615:                   <code class="filename">builtin.mk</code>
                   6616:                   file</h3>
1.1       grant    6617:                 </div>
                   6618:               </div>
                   6619:             </div>
                   6620: 
                   6621:             <p>The following is the recommended template for
                   6622:             builtin.mk files:</p>
                   6623:             <pre class="programlisting">
                   6624: .if !defined(IS_BUILTIN.foo)
                   6625: #
                   6626: # IS_BUILTIN.foo is set to "yes" or "no" depending on whether "foo"
                   6627: # genuinely exists in the system or not.
                   6628: #
                   6629: IS_BUILTIN.foo?=        no
                   6630: 
                   6631: # BUILTIN_PKG.foo should be set here if "foo" is built-in and its package
                   6632: # version can be determined.
                   6633: #
                   6634: .  if !empty(IS_BUILTIN.foo:M[yY][eE][sS])
                   6635: BUILTIN_PKG.foo?=       foo-1.0
                   6636: .  endif
                   6637: .endif  # IS_BUILTIN.foo
                   6638: 
                   6639: .if !defined(USE_BUILTIN.foo)
                   6640: USE_BUILTIN.foo?=       ${IS_BUILTIN.foo}
                   6641: .  if defined(BUILTIN_PKG.foo)
                   6642: .    for _depend_ in ${BUILDLINK_DEPENDS.foo}
                   6643: .      if !empty(USE_BUILTIN.foo:M[yY][eE][sS])
                   6644: USE_BUILTIN.foo!=                                                       \
                   6645:       if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.foo}; then     \
                   6646:               ${ECHO} "yes";                                            \
                   6647:       else                                                              \
                   6648:               ${ECHO} "no";                                             \
                   6649:       fi
                   6650: .      endif
                   6651: .    endfor
                   6652: .  endif
                   6653: .endif  # USE_BUILTIN.foo
                   6654: 
                   6655: CHECK_BUILTIN.foo?=     no
                   6656: .if !empty(CHECK_BUILTIN.foo:M[nN][oO])
                   6657: #
                   6658: # Here we place code that depends on whether USE_BUILTIN.foo is set to
                   6659: # "yes" or "no".
                   6660: #
                   6661: .endif  # CHECK_BUILTIN.foo
                   6662:       
                   6663: </pre>
                   6664: 
1.14      xtraeme  6665:             <p>The first section sets <code class=
                   6666:             "varname">IS_BUILTIN.<em class=
                   6667:             "replaceable"><code>pkg</code></em></code> depending on
                   6668:             if <em class="replaceable"><code>pkg</code></em> really
                   6669:             exists in the base system. This should not be a base
                   6670:             system software with similar functionality to
                   6671:             <em class="replaceable"><code>pkg</code></em>; it
                   6672:             should only be &#8220;<span class=
                   6673:             "quote">yes</span>&#8221; if the actual package is
                   6674:             included as part of the base system. This variable is
                   6675:             only used internally within the <code class=
                   6676:             "filename">builtin.mk</code> file.</p>
                   6677: 
                   6678:             <p>The second section sets <code class=
                   6679:             "varname">BUILTIN_PKG.<em class=
                   6680:             "replaceable"><code>pkg</code></em></code> to the
                   6681:             version of <em class=
                   6682:             "replaceable"><code>pkg</code></em> in the base system
                   6683:             if it exists (if <code class=
                   6684:             "varname">IS_BUILTIN.<em class=
                   6685:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6686:             &#8220;<span class="quote">yes</span>&#8221;). This
1.14      xtraeme  6687:             variable is only used internally within the
                   6688:             <code class="filename">builtin.mk</code> file.</p>
1.1       grant    6689: 
1.14      xtraeme  6690:             <p>The third section sets <code class=
                   6691:             "varname">USE_BUILTIN.<em class=
                   6692:             "replaceable"><code>pkg</code></em></code> and is
                   6693:             <span class="emphasis"><em>required</em></span> in all
                   6694:             <code class="filename">builtin.mk</code> files. The
                   6695:             code in this section must make the determination
                   6696:             whether the built-in software is adequate to satisfy
                   6697:             the dependencies listed in <code class=
                   6698:             "varname">BUILDLINK_DEPENDS.<em class=
                   6699:             "replaceable"><code>pkg</code></em></code>. This is
                   6700:             typically done by comparing <code class=
                   6701:             "varname">BUILTIN_PKG.<em class=
                   6702:             "replaceable"><code>pkg</code></em></code> against each
                   6703:             of the dependencies in <code class=
                   6704:             "varname">BUILDLINK_DEPENDS.<em class=
                   6705:             "replaceable"><code>pkg</code></em></code>.
                   6706:             <code class="varname">USE_BUILTIN.<em class=
                   6707:             "replaceable"><code>pkg</code></em></code> <span class=
1.1       grant    6708:             "emphasis"><em>must</em></span> be set to the correct
1.14      xtraeme  6709:             value by the end of the <code class=
                   6710:             "filename">builtin.mk</code> file. Note that
                   6711:             <code class="varname">USE_BUILTIN.<em class=
                   6712:             "replaceable"><code>pkg</code></em></code> may be
1.1       grant    6713:             &#8220;<span class="quote">yes</span>&#8221; even if
1.14      xtraeme  6714:             <code class="varname">IS_BUILTIN.<em class=
                   6715:             "replaceable"><code>pkg</code></em></code> is
1.1       grant    6716:             &#8220;<span class="quote">no</span>&#8221; because we
                   6717:             may make the determination that the built-in version of
                   6718:             the software is similar enough to be used as a
                   6719:             replacement.</p>
                   6720: 
1.14      xtraeme  6721:             <p>The last section is guarded by <code class=
                   6722:             "varname">CHECK_BUILTIN.<em class=
                   6723:             "replaceable"><code>pkg</code></em></code>, and
                   6724:             includes code that uses the value of <code class=
                   6725:             "varname">USE_BUILTIN.<em class=
                   6726:             "replaceable"><code>pkg</code></em></code> set in the
                   6727:             previous section. This typically includes, e.g., adding
1.1       grant    6728:             additional dependency restrictions and listing
1.14      xtraeme  6729:             additional files to symlink into <code class=
                   6730:             "filename">${BUILDLINK_DIR}</code> (via <code class=
                   6731:             "varname">BUILDLINK_FILES.<em class=
                   6732:             "replaceable"><code>pkg</code></em></code>).</p>
1.1       grant    6733:           </div>
                   6734: 
                   6735:           <div class="sect2" lang="en" xml:lang="en">
                   6736:             <div class="titlepage">
                   6737:               <div>
                   6738:                 <div>
1.18    ! xtraeme  6739:                   <h3 class="title"><a name="id2591769" id=
        !          6740:                   "id2591769"></a>9.3.2.&nbsp;Global preferences
1.1       grant    6741:                   for native or pkgsrc software</h3>
                   6742:                 </div>
                   6743:               </div>
                   6744:             </div>
                   6745: 
                   6746:             <p>When building packages, it's possible to choose
                   6747:             whether to set a global preference for using either the
                   6748:             built-in (native) version or the pkgsrc version of
                   6749:             software to satisfy a dependency. This is controlled by
1.14      xtraeme  6750:             setting <code class="varname">PREFER_PKGSRC</code> and
                   6751:             <code class="varname">PREFER_NATIVE</code>. These
                   6752:             variables take values of either &#8220;<span class=
1.1       grant    6753:             "quote">yes</span>&#8221;, &#8220;<span class=
                   6754:             "quote">no</span>&#8221;, or a list of packages.
1.14      xtraeme  6755:             <code class="varname">PREFER_PKGSRC</code> tells pkgsrc
                   6756:             to use the pkgsrc versions of software, while
                   6757:             <code class="varname">PREFER_NATIVE</code> tells pkgsrc
                   6758:             to use the built-in versions. Preferences are
                   6759:             determined by the most specific instance of the package
                   6760:             in either <code class="varname">PREFER_PKGSRC</code> or
                   6761:             <code class="varname">PREFER_NATIVE</code>. If a
                   6762:             package is specified in neither or in both variables,
                   6763:             then <code class="varname">PREFER_PKGSRC</code> has
                   6764:             precedence over <code class=
                   6765:             "varname">PREFER_NATIVE</code>. For example, to require
                   6766:             using pkgsrc versions of software for all but the most
                   6767:             basic bits on a NetBSD system, you can set:</p>
1.1       grant    6768:             <pre class="programlisting">
                   6769:         PREFER_PKGSRC=  yes
                   6770:         PREFER_NATIVE=  getopt skey tcp_wrappers
                   6771:       
                   6772: </pre>
                   6773: 
                   6774:             <p>A package <span class=
1.14      xtraeme  6775:             "emphasis"><em>must</em></span> have a <code class=
                   6776:             "filename">builtin.mk</code> file to be listed in
                   6777:             <code class="varname">PREFER_NATIVE</code>, otherwise
                   6778:             it is simply ignored in that list.</p>
1.1       grant    6779:           </div>
                   6780:         </div>
                   6781:       </div>
                   6782: 
                   6783:       <div class="chapter" lang="en" xml:lang="en">
                   6784:         <div class="titlepage">
                   6785:           <div>
                   6786:             <div>
                   6787:               <h2 class="title"><a name="options" id=
                   6788:               "options"></a>Chapter&nbsp;10.&nbsp;Options
                   6789:               handling</h2>
                   6790:             </div>
                   6791:           </div>
                   6792:         </div>
                   6793: 
                   6794:         <div class="toc">
                   6795:           <p><b>Table of Contents</b></p>
                   6796: 
                   6797:           <dl>
1.18    ! xtraeme  6798:             <dt><span class="sect1"><a href="#id2591842">10.1.
1.1       grant    6799:             Global default options</a></span></dt>
                   6800: 
1.18    ! xtraeme  6801:             <dt><span class="sect1"><a href="#id2591857">10.2.
1.14      xtraeme  6802:             Converting packages to use <code class=
                   6803:             "filename">bsd.options.mk</code></a></span></dt>
1.1       grant    6804:           </dl>
                   6805:         </div>
                   6806: 
                   6807:         <p>Many packages have the ability to be built to support
1.14      xtraeme  6808:         different sets of features. <code class=
                   6809:         "filename">bsd.options.mk</code> is a framework in pkgsrc
1.1       grant    6810:         that provides generic handling of those options that
                   6811:         determine different ways in which the packages can be
                   6812:         built. It's possible for the user to specify exactly which
                   6813:         sets of options will be built into a package or to allow a
                   6814:         set of global default options apply.</p>
                   6815: 
                   6816:         <div class="sect1" lang="en" xml:lang="en">
                   6817:           <div class="titlepage">
                   6818:             <div>
                   6819:               <div>
                   6820:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  6821:                 "id2591842" id="id2591842"></a>10.1.&nbsp;Global
1.1       grant    6822:                 default options</h2>
                   6823:               </div>
                   6824:             </div>
                   6825:           </div>
                   6826: 
1.14      xtraeme  6827:           <p>Global default options are listed in <code class=
                   6828:           "varname">PKG_DEFAULT_OPTIONS</code>, which is a list of
1.1       grant    6829:           the options that should be built into every package if
                   6830:           that option is supported. This variable should be set in
1.14      xtraeme  6831:           <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    6832:         </div>
                   6833: 
                   6834:         <div class="sect1" lang="en" xml:lang="en">
                   6835:           <div class="titlepage">
                   6836:             <div>
                   6837:               <div>
                   6838:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  6839:                 "id2591857" id=
        !          6840:                 "id2591857"></a>10.2.&nbsp;Converting packages to
1.14      xtraeme  6841:                 use <code class=
                   6842:                 "filename">bsd.options.mk</code></h2>
1.1       grant    6843:               </div>
                   6844:             </div>
                   6845:           </div>
                   6846: 
1.14      xtraeme  6847:           <p>The following example shows how <code class=
                   6848:           "filename">bsd.options.mk</code> should be use in a
                   6849:           package <code class="filename">Makefile</code>, or in a
                   6850:           file, e.g. <code class="filename">options.mk</code>, that
                   6851:           is included by the main package <code class=
                   6852:           "filename">Makefile</code>.</p>
1.1       grant    6853:           <pre class="programlisting">
                   6854: # Global and legacy options
                   6855: .if defined(WIBBLE_USE_OPENLDAP) &amp;&amp; !empty(WIBBLE_USE_OPENLDAP:M[yY][eE][sS])
                   6856: PKG_DEFAULT_OPTIONS+=   ldap
                   6857: .endif
                   6858: .if defined(USE_SASL2) &amp;&amp; !empty(USE_SASL2:M[yY][eE][sS])
                   6859: PKG_DEFAULT_OPTIONS+=   sasl
                   6860: .endif
                   6861: 
                   6862: PKG_OPTIONS_VAR=        PKG_OPTIONS.wibble
                   6863: PKG_SUPPORTED_OPTIONS=  ldap sasl
                   6864: #
                   6865: # Default options for "wibble" package.
                   6866: #
                   6867: .if !defined(PKG_OPTIONS.wibble)
                   6868: PKG_DEFAULT_OPTIONS+=   sasl
                   6869: endif
                   6870: .include "../../mk/bsd.options.mk"
                   6871: 
                   6872: # Package-specific option-handling
                   6873: 
                   6874: ###
                   6875: ### LDAP support
                   6876: ###
                   6877: .if !empty(PKG_OPTIONS:Mldap)
                   6878: .  include "../../databases/openldap/buildlink3.mk"
                   6879: CONFIGURE_ARGS+=      --enable-ldap=${BUILDLINK_PREFIX.openldap}
                   6880: .endif
                   6881: 
                   6882: ###
                   6883: ### SASL authentication
                   6884: ###
                   6885: .if !empty(PKG_OPTIONS:Msasl)
                   6886: .  include "../../security/cyrus-sasl2/buildlink3.mk"
                   6887: CONFIGURE_ARGS+=        --enable-sasl=${BUILDLINK_PREFIX.sasl}
                   6888: .endif
                   6889:       
                   6890: </pre>
                   6891: 
                   6892:           <p>The first section only exists if you are converting a
                   6893:           package that had its own ad-hoc options handling to use
1.14      xtraeme  6894:           <code class="filename">bsd.options.mk</code>. It converts
1.1       grant    6895:           global or legacy options variables into an equivalent
1.14      xtraeme  6896:           <code class="varname">PKG_OPTIONS.<em class=
                   6897:           "replaceable"><code>pkg</code></em></code> value. These
                   6898:           sections will be removed over time as the old options are
                   6899:           in turn deprecated and removed.</p>
1.1       grant    6900: 
                   6901:           <p>The second section contains the information about
                   6902:           which build options are supported by the package, and any
                   6903:           default options settings if needed.</p>
                   6904: 
                   6905:           <div class="orderedlist">
                   6906:             <ol type="1">
                   6907:               <li>
1.14      xtraeme  6908:                 <p><code class="varname">PKG_OPTIONS_VAR</code> is
                   6909:                 a list of the name of the <a href=
1.1       grant    6910:                 "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   6911:                 <span class="citerefentry"><span class=
                   6912:                 "refentrytitle">make</span>(1)</span></a> variables
                   6913:                 that contain the options the user wishes to select.
                   6914:                 The recommended value is &#8220;<span class=
1.14      xtraeme  6915:                 "quote">PKG_OPTIONS.<em class=
                   6916:                 "replaceable"><code>pkg</code></em></span>&#8221;
                   6917:                 but any package-specific value may be used. This
1.1       grant    6918:                 variable should be set in a package Makefile.</p>
                   6919:               </li>
                   6920: 
                   6921:               <li>
1.14      xtraeme  6922:                 <p><code class=
                   6923:                 "varname">PKG_SUPPORTED_OPTIONS</code> is a list of
                   6924:                 build options supported by the package. This
                   6925:                 variable should be set in a package Makefile.</p>
1.1       grant    6926:               </li>
                   6927: 
                   6928:               <li>
1.14      xtraeme  6929:                 <p><code class="varname">${PKG_OPTIONS_VAR}</code>
                   6930:                 (the variables named in <code class=
                   6931:                 "varname">PKG_OPTIONS_VAR</code>) are variables
                   6932:                 that list the selected build options and override
                   6933:                 any default options given in <code class=
                   6934:                 "varname">PKG_DEFAULT_OPTIONS</code>. If any of the
1.1       grant    6935:                 options begin with a &#8220;<span class=
                   6936:                 "quote">-</span>&#8221;, then that option is always
                   6937:                 removed from the selected build options, e.g.</p>
                   6938:                 <pre class="programlisting">
                   6939:         PKG_DEFAULT_OPTIONS=    kerberos ldap sasl
                   6940:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6941:         WIBBLE_OPTIONS=         ${PKG_DEFAULT_OPTIONS} -sasl
                   6942:         # implies PKG_OPTIONS == "kerberos ldap"
                   6943:           
                   6944: </pre>
                   6945: 
                   6946:                 <p>or</p>
                   6947:                 <pre class="programlisting">
                   6948:         PKG_OPTIONS_VAR=        WIBBLE_OPTIONS
                   6949:         WIBBLE_OPTIONS=         kerberos -ldap ldap
                   6950:         # implies PKG_OPTIONS == "kerberos"
                   6951:           
                   6952: </pre>
                   6953: 
1.14      xtraeme  6954:                 <p>This variable should be set in <code class=
                   6955:                 "filename">/etc/mk.conf</code>.</p>
1.1       grant    6956:               </li>
                   6957:             </ol>
                   6958:           </div>
                   6959: 
                   6960:           <p>After the inclusion of bsd.options.mk, the following
                   6961:           variables are set:</p>
                   6962: 
                   6963:           <div class="itemizedlist">
                   6964:             <ul type="disc">
                   6965:               <li>
1.14      xtraeme  6966:                 <p><code class="varname">PKG_OPTIONS</code>
                   6967:                 contains the list of the selected build options,
                   6968:                 properly filtered to remove unsupported and
                   6969:                 duplicate options.</p>
1.1       grant    6970:               </li>
                   6971:             </ul>
                   6972:           </div>
                   6973: 
                   6974:           <p>The remaining sections contain the logic that is
                   6975:           specific to each option. There should be a check for
1.14      xtraeme  6976:           every option listed in <code class=
                   6977:           "varname">PKG_SUPPORTED_OPTIONS</code>, and there should
                   6978:           be clear documentation on what turning on the option will
                   6979:           do in the comments preceding each section. The correct
                   6980:           way to check for an option is to check whether it is
                   6981:           listed in <code class="varname">PKG_OPTIONS</code>.</p>
1.1       grant    6982:         </div>
                   6983:       </div>
                   6984: 
                   6985:       <div class="chapter" lang="en" xml:lang="en">
                   6986:         <div class="titlepage">
                   6987:           <div>
                   6988:             <div>
                   6989:               <h2 class="title"><a name="build" id=
                   6990:               "build"></a>Chapter&nbsp;11.&nbsp;The build
                   6991:               process</h2>
                   6992:             </div>
                   6993:           </div>
                   6994:         </div>
                   6995: 
                   6996:         <div class="toc">
                   6997:           <p><b>Table of Contents</b></p>
                   6998: 
                   6999:           <dl>
                   7000:             <dt><span class="sect1"><a href="#build.prefix">11.1.
                   7001:             Program location</a></span></dt>
                   7002: 
1.18    ! xtraeme  7003:             <dt><span class="sect1"><a href="#id2592396">11.2. Main
1.1       grant    7004:             targets</a></span></dt>
                   7005: 
                   7006:             <dt><span class="sect1"><a href=
                   7007:             "#build.helpful-targets">11.3. Other helpful
                   7008:             targets</a></span></dt>
                   7009:           </dl>
                   7010:         </div>
                   7011: 
                   7012:         <p>The basic steps for building a program are always the
                   7013:         same. First the program's source (<span class=
                   7014:         "emphasis"><em>distfile</em></span>) must be brought to the
                   7015:         local system and then extracted. After any patches to
                   7016:         compile properly on NetBSD are applied, the software can be
                   7017:         configured, then built (usually by compiling), and finally
                   7018:         the generated binaries, etc. can be put into place on the
                   7019:         system. These are exactly the steps performed by the NetBSD
                   7020:         package system, which is implemented as a series of targets
1.14      xtraeme  7021:         in a central Makefile, <code class=
                   7022:         "filename">pkgsrc/mk/bsd.pkg.mk</code>.</p>
1.1       grant    7023: 
                   7024:         <div class="sect1" lang="en" xml:lang="en">
                   7025:           <div class="titlepage">
                   7026:             <div>
                   7027:               <div>
                   7028:                 <h2 class="title" style="clear: both"><a name=
                   7029:                 "build.prefix" id=
                   7030:                 "build.prefix"></a>11.1.&nbsp;Program location</h2>
                   7031:               </div>
                   7032:             </div>
                   7033:           </div>
                   7034: 
                   7035:           <p>Before outlining the process performed by the NetBSD
                   7036:           package system in the next section, here's a brief
                   7037:           discussion on where programs are installed, and which
                   7038:           variables influence this.</p>
                   7039: 
1.14      xtraeme  7040:           <p>The automatic variable <code class=
                   7041:           "varname">PREFIX</code> indicates where all files of the
                   7042:           final program shall be installed. It is usually set to
                   7043:           <code class="varname">LOCALBASE</code> (<code class=
                   7044:           "filename">/usr/pkg</code>), or <code class=
                   7045:           "varname">CROSSBASE</code> for pkgs in the
1.1       grant    7046:           &#8220;<span class="quote">cross</span>&#8221; category.
1.14      xtraeme  7047:           The value of <code class="varname">PREFIX</code> needs to
                   7048:           be put into the various places in the program's source
                   7049:           where paths to these files are encoded. See <a href=
1.1       grant    7050:           "#components.patches" title=
                   7051:           "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   7052:           &#8220;patches/*&#8221;</a> and <a href="#fixes.libtool"
                   7053:           title=
                   7054:           "12.3.1.&nbsp;Shared libraries - libtool">Section&nbsp;12.3.1,
                   7055:           &#8220;Shared libraries - libtool&#8221;</a> for more
                   7056:           details.</p>
                   7057: 
                   7058:           <p>When choosing which of these variables to use, follow
                   7059:           the following rules:</p>
                   7060: 
                   7061:           <div class="itemizedlist">
                   7062:             <ul type="disc">
                   7063:               <li>
1.14      xtraeme  7064:                 <p><code class="varname">PREFIX</code> always
                   7065:                 points to the location where the current pkg will
                   7066:                 be installed. When referring to a pkg's own
1.1       grant    7067:                 installation path, use &#8220;<span class=
                   7068:                 "quote">${PREFIX}</span>&#8221;.</p>
                   7069:               </li>
                   7070: 
                   7071:               <li>
1.14      xtraeme  7072:                 <p><code class="varname">LOCALBASE</code> is where
                   7073:                 all non-X11 pkgs are installed. If you need to
1.1       grant    7074:                 construct a -I or -L argument to the compiler to
                   7075:                 find includes and libraries installed by another
                   7076:                 non-X11 pkg, use &#8220;<span class=
                   7077:                 "quote">${LOCALBASE}</span>&#8221;.</p>
                   7078:               </li>
                   7079: 
                   7080:               <li>
1.14      xtraeme  7081:                 <p><code class="varname">X11BASE</code> is where
                   7082:                 the actual X11 distribution (from xsrc, etc.) is
1.1       grant    7083:                 installed. When looking for <span class=
                   7084:                 "emphasis"><em>standard</em></span> X11 includes
                   7085:                 (not those installed by a pkg), use
                   7086:                 &#8220;<span class=
                   7087:                 "quote">${X11BASE}</span>&#8221;.</p>
                   7088:               </li>
                   7089: 
                   7090:               <li>
                   7091:                 <p>X11 based are special in that they may be
1.14      xtraeme  7092:                 installed in either <code class=
                   7093:                 "varname">X11BASE</code> or <code class=
                   7094:                 "varname">LOCALBASE</code>.</p>
1.1       grant    7095: 
                   7096:                 <p>Usually, X11 packages should be installed under
1.14      xtraeme  7097:                 <code class="varname">LOCALBASE</code> whenever
                   7098:                 possible. Note that you will need to set
                   7099:                 <code class="varname">USE_X11</code> in them to
                   7100:                 request the presence of X11 and to get the right
                   7101:                 compilation flags.</p>
1.1       grant    7102: 
                   7103:                 <p>Even though, there are some packages that cannot
1.14      xtraeme  7104:                 be installed under <code class=
                   7105:                 "varname">LOCALBASE</code>: those that come with
1.1       grant    7106:                 app-defaults files. These packages are special and
1.14      xtraeme  7107:                 they must be placed under <code class=
                   7108:                 "varname">X11BASE</code>. To accomplish this, set
                   7109:                 either <code class="varname">USE_X11BASE</code> or
                   7110:                 <code class="varname">USE_IMAKE</code> in your
1.1       grant    7111:                 package.</p>
                   7112: 
1.14      xtraeme  7113:                 <p>Some notes: <code class="varname">USE_X11</code>
                   7114:                 and <code class="varname">USE_X11BASE</code> are
                   7115:                 mutually exclusive. If you need to find includes or
                   7116:                 libraries installed by a pkg that has <code class=
                   7117:                 "varname">USE_IMAKE</code> or <code class=
                   7118:                 "varname">USE_X11BASE</code> in its pkg
                   7119:                 <code class="filename">Makefile</code>, you need to
                   7120:                 use <span class="emphasis"><em>both</em></span>
                   7121:                 <code class="filename">${X11BASE}</code> and
                   7122:                 <code class="filename">${LOCALBASE}</code>. To
                   7123:                 force installation of all X11 packages in
                   7124:                 <code class="varname">LOCALBASE</code>, the
                   7125:                 <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   7126:                 href=
1.1       grant    7127:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/xpkgwedge/README.html"
1.14      xtraeme  7128:                 class="pkgname">pkgtools/xpkgwedge</a> is enabled
                   7129:                 by default.</p>
1.1       grant    7130:               </li>
                   7131: 
                   7132:               <li>
1.14      xtraeme  7133:                 <p><code class="varname">X11PREFIX</code> should be
1.1       grant    7134:                 used to refer to the installed location of an X11
1.14      xtraeme  7135:                 package. <code class="varname">X11PREFIX</code>
                   7136:                 will be set to <code class="varname">X11BASE</code>
                   7137:                 if xpkgwedge is not installed, and to <code class=
                   7138:                 "varname">LOCALBASE</code> if xpkgwedge is
1.1       grant    7139:                 installed.</p>
                   7140:               </li>
                   7141: 
                   7142:               <li>
                   7143:                 <p>If xpkgwedge is installed, it is possible to
1.14      xtraeme  7144:                 have some packages installed in <code class=
                   7145:                 "varname">X11BASE</code> and some in <code class=
                   7146:                 "varname">LOCALBASE</code>. To determine the prefix
                   7147:                 of an installed package, the <code class=
                   7148:                 "varname">EVAL_PREFIX</code> definition can be
                   7149:                 used. It takes pairs in the format
                   7150:                 &#8220;<span class=
1.1       grant    7151:                 "quote">DIRNAME=&lt;package&gt;</span>&#8221;, and
1.14      xtraeme  7152:                 the make(1) variable <code class=
                   7153:                 "varname">DIRNAME</code> will be set to the prefix
                   7154:                 of the installed package &lt;package&gt;, or
1.1       grant    7155:                 &#8220;<span class=
                   7156:                 "quote">${X11PREFIX}</span>&#8221; if the package
                   7157:                 is not installed.</p>
                   7158: 
                   7159:                 <p>This is best illustrated by example.</p>
                   7160: 
1.14      xtraeme  7161:                 <p>The following lines are taken from <code class=
                   7162:                 "filename">pkgsrc/wm/scwm/Makefile</code>:</p>
1.1       grant    7163:                 <pre class="programlisting">
1.14      xtraeme  7164: EVAL_PREFIX+=           GTKDIR=gtk+
1.1       grant    7165: CONFIGURE_ARGS+=        --with-guile-prefix=${LOCALBASE}        \
                   7166:                         --with-gtk-prefix="${GTKDIR}"           \
                   7167:                         --enable-multibyte
                   7168: </pre>
                   7169: 
                   7170:                 <p>Specific defaults can be defined for the
1.14      xtraeme  7171:                 packages evaluated using <code class=
                   7172:                 "varname">EVAL_PREFIX</code>, by using a definition
1.1       grant    7173:                 of the form:</p>
                   7174:                 <pre class="programlisting">
                   7175: GTKDIR_DEFAULT= ${LOCALBASE}
                   7176: </pre>
                   7177: 
1.14      xtraeme  7178:                 <p>where <code class="varname">GTKDIR</code>
1.1       grant    7179:                 corresponds to the first definition in the
1.14      xtraeme  7180:                 <code class="varname">EVAL_PREFIX</code> pair.</p>
1.1       grant    7181:               </li>
                   7182: 
                   7183:               <li>
1.14      xtraeme  7184:                 <p>Within <code class="filename">${PREFIX}</code>,
1.1       grant    7185:                 packages should install files according to hier(7),
                   7186:                 with the exception that manual pages go into
1.14      xtraeme  7187:                 <code class="filename">${PREFIX}/man</code>, not
                   7188:                 <code class=
                   7189:                 "filename">${PREFIX}/share/man</code>.</p>
1.1       grant    7190:               </li>
                   7191:             </ul>
                   7192:           </div>
                   7193:         </div>
                   7194: 
                   7195:         <div class="sect1" lang="en" xml:lang="en">
                   7196:           <div class="titlepage">
                   7197:             <div>
                   7198:               <div>
                   7199:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  7200:                 "id2592396" id="id2592396"></a>11.2.&nbsp;Main
1.1       grant    7201:                 targets</h2>
                   7202:               </div>
                   7203:             </div>
                   7204:           </div>
                   7205: 
                   7206:           <p>The main targets used during the build process defined
1.14      xtraeme  7207:           in <code class="filename">bsd.pkg.mk</code> are:</p>
1.1       grant    7208: 
                   7209:           <div class="variablelist">
                   7210:             <dl>
                   7211:               <dt><span class="term">fetch</span></dt>
                   7212: 
                   7213:               <dd>
                   7214:                 <p>This will check if the file(s) given in the
1.14      xtraeme  7215:                 variables <code class="varname">DISTFILES</code>
                   7216:                 and <code class="varname">PATCHFILES</code> (as
                   7217:                 defined in the package's Makefile) are present on
                   7218:                 the local system in <code class=
                   7219:                 "filename">/usr/pkgsrc/distfiles</code>. If they
                   7220:                 are not present, an attempt will be made to fetch
                   7221:                 them using commands of the form:</p>
1.1       grant    7222:                 <pre class="programlisting">
                   7223: ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${site}${file} ${FETCH_AFTER_ARGS}
                   7224: </pre>
                   7225: 
                   7226:                 <p>where ${site} varies through several
1.14      xtraeme  7227:                 possibilities in turn: first, <code class=
                   7228:                 "varname">MASTER_SITE_OVERRIDE</code> is tried,
                   7229:                 then the sites specified in either <code class=
                   7230:                 "varname">SITES_file</code> if defined, else
                   7231:                 <code class="varname">MASTER_SITES</code> or
                   7232:                 <code class="varname">PATCH_SITES</code>, as
                   7233:                 applies, then finally the value of <code class=
                   7234:                 "varname">MASTER_SITE_BACKUP</code>. The order of
                   7235:                 all except the first can be optionally sorted by
                   7236:                 the user, via setting either <code class=
                   7237:                 "varname">MASTER_SORT_AWK</code> or <code class=
                   7238:                 "varname">MASTER_SORT_REGEX</code>.</p>
1.1       grant    7239:               </dd>
                   7240: 
                   7241:               <dt><span class="term">checksum</span></dt>
                   7242: 
                   7243:               <dd>
                   7244:                 <p>After the distfile(s) are fetched, their
                   7245:                 checksum is generated and compared with the
                   7246:                 checksums stored in the distinfo file. If the
                   7247:                 checksums don't match, the build is aborted. This
                   7248:                 is to ensure the same distfile is used for
                   7249:                 building, and that the distfile wasn't changed,
                   7250:                 e.g. by some malign force, deliberately changed
                   7251:                 distfiles on the master distribution site or
                   7252:                 network lossage.</p>
                   7253:               </dd>
                   7254: 
                   7255:               <dt><span class="term">extract</span></dt>
                   7256: 
                   7257:               <dd>
                   7258:                 <p>When the distfiles are present on the local
                   7259:                 system, they need to be extracted, as they are
                   7260:                 usually in the form of some compressed archive
1.14      xtraeme  7261:                 format, most commonly <code class=
                   7262:                 "filename">.tar.gz</code>.</p>
1.1       grant    7263: 
                   7264:                 <p>If only some of the distfiles need to be
                   7265:                 uncompressed, the files to be uncompressed should
1.14      xtraeme  7266:                 be put into <code class=
                   7267:                 "varname">EXTRACT_ONLY</code>.</p>
1.1       grant    7268: 
1.14      xtraeme  7269:                 <p>If the distfiles are not in <code class=
                   7270:                 "filename">.tar.gz</code> format, they can be
                   7271:                 extracted by setting either <code class=
                   7272:                 "varname">EXTRACT_SUFX</code>, or <code class=
                   7273:                 "varname">EXTRACT_CMD</code>, <code class=
                   7274:                 "varname">EXTRACT_BEFORE_ARGS</code> and
                   7275:                 <code class="varname">EXTRACT_AFTER_ARGS</code>. In
                   7276:                 the former case, pkgsrc knows how to extract a
                   7277:                 number of suffixes (<code class=
                   7278:                 "filename">.tar.gz</code>, <code class=
                   7279:                 "filename">.tgz</code>, <code class=
                   7280:                 "filename">.tar.gz2</code>, <code class=
                   7281:                 "filename">.tbz</code>, <code class=
                   7282:                 "filename">.tar.Z</code>, <code class=
                   7283:                 "filename">.tar</code>, <code class=
                   7284:                 "filename">.shar.gz</code>, <code class=
                   7285:                 "filename">.shar.bz2</code>, <code class=
                   7286:                 "filename">.shar.Z</code>, <code class=
                   7287:                 "filename">.shar</code>, <code class=
                   7288:                 "filename">.Z</code>, <code class=
                   7289:                 "filename">.bz2</code> and <code class=
                   7290:                 "filename">.gz</code>; see the definition of the
                   7291:                 various <code class="varname">DECOMPRESS_CMD</code>
                   7292:                 variables <code class="filename">bsd.pkg.mk</code>
                   7293:                 for a complete list). Here's an example on how to
                   7294:                 use the other variables for a program that comes
                   7295:                 with a compressed shell archive whose name ends in
                   7296:                 <code class="filename">.msg.gz</code>:</p>
1.1       grant    7297:                 <pre class="programlisting">
                   7298:      EXTRACT_SUFX=   .msg.gz
                   7299:      EXTRACT_CMD=            zcat
                   7300:      EXTRACT_BEFORE_ARGS=
                   7301:      EXTRACT_AFTER_ARGS=     |sh
                   7302: </pre>
                   7303:               </dd>
                   7304: 
                   7305:               <dt><span class="term">patch</span></dt>
                   7306: 
                   7307:               <dd>
                   7308:                 <p>After extraction, all the patches named by the
1.14      xtraeme  7309:                 <code class="varname">PATCHFILES</code>, those
                   7310:                 present in the patches subdirectory of the package
                   7311:                 as well as in $LOCALPATCHES/$PKGPATH (e.g.
                   7312:                 <code class=
                   7313:                 "filename">/usr/local/patches/graphics/png</code>)
                   7314:                 are applied. Patchfiles ending in <code class=
                   7315:                 "filename">.Z</code> or <code class=
                   7316:                 "filename">.gz</code> are uncompressed before they
                   7317:                 are applied, files ending in <code class=
                   7318:                 "filename">.orig</code> or <code class=
                   7319:                 "filename">.rej</code> are ignored. Any special
                   7320:                 options to patch(1) can be handed in <code class=
                   7321:                 "varname">PATCH_DIST_ARGS</code>. See <a href=
                   7322:                 "#components.patches" title=
1.1       grant    7323:                 "7.3.&nbsp;patches/*">Section&nbsp;7.3,
                   7324:                 &#8220;patches/*&#8221;</a> for more details.</p>
                   7325: 
                   7326:                 <p>By default patch(1) is given special args to
                   7327:                 make it fail if the patches apply with some lines
                   7328:                 of fuzz. Please fix (regen) the patches so that
                   7329:                 they apply cleanly. The rationale behind this is
                   7330:                 that patches that don't apply cleanly may end up
                   7331:                 being applied in the wrong place, and cause severe
                   7332:                 harm there.</p>
                   7333:               </dd>
                   7334: 
                   7335:               <dt><span class="term">configure</span></dt>
                   7336: 
                   7337:               <dd>
                   7338:                 <p>Most pieces of software need information on the
                   7339:                 header files, system calls, and library routines
                   7340:                 which are available in NetBSD. This is the process
                   7341:                 known as configuration, and is usually automated.
                   7342:                 In most cases, a script is supplied with the
                   7343:                 source, and its invocation results in generation of
                   7344:                 header files, Makefiles, etc.</p>
                   7345: 
                   7346:                 <p>If the program's distfile contains its own
                   7347:                 configure script, this can be invoked by setting
1.14      xtraeme  7348:                 <code class="varname">HAS_CONFIGURE</code>. If the
1.1       grant    7349:                 configure script is a GNU autoconf script,
1.14      xtraeme  7350:                 <code class="varname">GNU_CONFIGURE</code> should
                   7351:                 be specified instead. In either case, any arguments
                   7352:                 to the configure script can be specified in the
                   7353:                 <code class="varname">CONFIGURE_ARGS</code>
                   7354:                 variable, and the configure script's name can be
                   7355:                 set in <code class=
                   7356:                 "varname">CONFIGURE_SCRIPT</code> if it differs
                   7357:                 from the default &#8220;<span class=
1.1       grant    7358:                 "quote">configure</span>&#8221;. Here's an example
                   7359:                 from the <a xmlns=
                   7360:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7361:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/top/README.html"
1.14      xtraeme  7362:                 class="pkgname">sysutils/top</a> package:</p>
1.1       grant    7363:                 <pre class="programlisting">
                   7364: HAS_CONFIGURE=          yes
                   7365: CONFIGURE_SCRIPT=       Configure
                   7366: CONFIGURE_ARGS+=        netbsd13
                   7367: </pre>
                   7368: 
                   7369:                 <p>If the program uses an Imakefile for
                   7370:                 configuration, the appropriate steps can be invoked
1.14      xtraeme  7371:                 by setting <code class="varname">USE_IMAKE</code>
                   7372:                 to &#8220;<span class="quote">YES</span>&#8221;.
                   7373:                 (If you only want the package installed in
                   7374:                 <code class="varname">$X11PREFIX</code> but xmkmf
                   7375:                 not being run, set <code class=
                   7376:                 "varname">USE_X11BASE</code> instead!)</p>
1.1       grant    7377:               </dd>
                   7378: 
                   7379:               <dt><span class="term">build</span></dt>
                   7380: 
                   7381:               <dd>
                   7382:                 <p>Once configuration has taken place, the software
1.14      xtraeme  7383:                 will be built by invoking <code class=
                   7384:                 "varname">$MAKE_PROGRAM</code> on <code class=
                   7385:                 "varname">$MAKEFILE</code> with <code class=
                   7386:                 "varname">$BUILD_TARGET</code> as the target to
                   7387:                 build. The default <code class=
                   7388:                 "varname">MAKE_PROGRAM</code> is
                   7389:                 &#8220;<span class="quote">gmake</span>&#8221; if
                   7390:                 <code class="varname">USE_GNU_TOOLS</code> contains
1.7       wiz      7391:                 &#8220;<span class="quote">make</span>&#8221;,
1.1       grant    7392:                 &#8220;<span class="quote">make</span>&#8221;
1.14      xtraeme  7393:                 otherwise. <code class="varname">MAKEFILE</code> is
                   7394:                 set to &#8220;<span class=
1.1       grant    7395:                 "quote">Makefile</span>&#8221; by default, and
1.14      xtraeme  7396:                 <code class="varname">BUILD_TARGET</code> defaults
                   7397:                 to &#8220;<span class="quote">all</span>&#8221;.
                   7398:                 Any of these variables can be set in the package's
1.1       grant    7399:                 Makefile to change the default build process.</p>
                   7400:               </dd>
                   7401: 
                   7402:               <dt><span class="term">install</span></dt>
                   7403: 
                   7404:               <dd>
                   7405:                 <p>Once the build stage has completed, the final
                   7406:                 step is to install the software in public
                   7407:                 directories, so users can access the programs and
1.14      xtraeme  7408:                 files. As in the build-target, <code class=
                   7409:                 "varname">$MAKE_PROGRAM</code> is invoked on
                   7410:                 <code class="varname">$MAKEFILE</code> here, but
                   7411:                 with the <code class=
                   7412:                 "varname">$INSTALL_TARGET</code> instead, the
                   7413:                 latter defaulting to &#8220;<span class=
                   7414:                 "quote">install</span>&#8221; (plus
                   7415:                 &#8220;<span class=
                   7416:                 "quote">install.man</span>&#8221;, if <code class=
                   7417:                 "varname">USE_IMAKE</code> is set).</p>
1.1       grant    7418:               </dd>
                   7419:             </dl>
                   7420:           </div>
                   7421: 
                   7422:           <p>If no target is specified, the default is
                   7423:           &#8220;<span class="quote">build</span>&#8221;. If a
                   7424:           subsequent stage is requested, all prior stages are made:
1.14      xtraeme  7425:           e.g. <span><strong class="command">make
                   7426:           build</strong></span> will also perform the equivalent
                   7427:           of:</p>
1.1       grant    7428:           <pre class="programlisting">
                   7429: make fetch
                   7430: make checksum
                   7431: make extract
                   7432: make patch
                   7433: make configure
                   7434: make build
                   7435: </pre>
                   7436:         </div>
                   7437: 
                   7438:         <div class="sect1" lang="en" xml:lang="en">
                   7439:           <div class="titlepage">
                   7440:             <div>
                   7441:               <div>
                   7442:                 <h2 class="title" style="clear: both"><a name=
                   7443:                 "build.helpful-targets" id=
                   7444:                 "build.helpful-targets"></a>11.3.&nbsp;Other
                   7445:                 helpful targets</h2>
                   7446:               </div>
                   7447:             </div>
                   7448:           </div>
                   7449: 
                   7450:           <div class="variablelist">
                   7451:             <dl>
                   7452:               <dt><span class="term">pre/post-*</span></dt>
                   7453: 
                   7454:               <dd>
                   7455:                 <p>For any of the main targets described in the
                   7456:                 previous section, two auxiliary targets exist with
                   7457:                 &#8220;<span class="quote">pre-</span>&#8221; and
                   7458:                 &#8220;<span class="quote">post-</span>&#8221; used
                   7459:                 as a prefix for the main target's name. These
                   7460:                 targets are invoked before and after the main
                   7461:                 target is called, allowing extra configuration or
                   7462:                 installation steps be performed from a package's
                   7463:                 Makefile, for example, which a program's configure
                   7464:                 script or install target omitted.</p>
                   7465:               </dd>
                   7466: 
                   7467:               <dt><span class="term">do-*</span></dt>
                   7468: 
                   7469:               <dd>
                   7470:                 <p>Should one of the main targets do the wrong
                   7471:                 thing, and should there be no variable to fix this,
                   7472:                 you can redefine it with the do-* target. (Note
                   7473:                 that redefining the target itself instead of the
                   7474:                 do-* target is a bad idea, as the pre-* and post-*
                   7475:                 targets won't be called anymore, etc.) You will not
                   7476:                 usually need to do this.</p>
                   7477:               </dd>
                   7478: 
                   7479:               <dt><span class="term">reinstall</span></dt>
                   7480: 
                   7481:               <dd>
1.14      xtraeme  7482:                 <p>If you did a <span><strong class="command">make
                   7483:                 install</strong></span> and you noticed some file
                   7484:                 was not installed properly, you can repeat the
1.1       grant    7485:                 installation with this target, which will ignore
                   7486:                 the &#8220;<span class="quote">already
                   7487:                 installed</span>&#8221; flag.</p>
                   7488:               </dd>
                   7489: 
                   7490:               <dt><span class="term">deinstall</span></dt>
                   7491: 
                   7492:               <dd>
                   7493:                 <p>This target does a pkg_delete(1) in the current
                   7494:                 directory, effectively de-installing the package.
                   7495:                 The following variables can be used to tune the
                   7496:                 behaviour:</p>
                   7497: 
                   7498:                 <div class="variablelist">
                   7499:                   <dl>
1.14      xtraeme  7500:                     <dt><span class="term"><code class=
                   7501:                     "varname">PKG_VERBOSE</code></span></dt>
1.1       grant    7502: 
                   7503:                     <dd>
                   7504:                       <p>Add a "-v" to the <a href=
                   7505:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7506:                       <span class="citerefentry"><span class=
                   7507:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7508:                       command.</p>
                   7509:                     </dd>
                   7510: 
1.14      xtraeme  7511:                     <dt><span class="term"><code class=
                   7512:                     "varname">DEINSTALLDEPENDS</code></span></dt>
1.1       grant    7513: 
                   7514:                     <dd>
                   7515:                       <p>Remove all packages that require (depend
                   7516:                       on) the given package. This can be used to
                   7517:                       remove any packages that may have been pulled
                   7518:                       in by a given package, e.g. if
1.14      xtraeme  7519:                       <span><strong class="command">make deinstall
                   7520:                       DEINSTALLDEPENDS=1</strong></span> is done in
                   7521:                       <code class="filename">pkgsrc/x11/kde</code>,
1.1       grant    7522:                       this is likely to remove whole KDE. Works by
                   7523:                       adding &#8220;<span class=
                   7524:                       "quote">-R</span>&#8221; to the <a href=
                   7525:                       "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   7526:                       <span class="citerefentry"><span class=
                   7527:                       "refentrytitle">pkg_delete</span>(1)</span></a>
                   7528:                       command line.</p>
                   7529:                     </dd>
                   7530:                   </dl>
                   7531:                 </div>
                   7532:               </dd>
                   7533: 
                   7534:               <dt><span class="term">update</span></dt>
                   7535: 
                   7536:               <dd>
                   7537:                 <p>This target causes the current package to be
                   7538:                 updated to the latest version. The package and all
                   7539:                 depending packages first get de-installed, then
                   7540:                 current versions of the corresponding packages get
                   7541:                 compiled and installed. This is similar to manually
                   7542:                 noting which packages are currently installed, then
1.14      xtraeme  7543:                 performing a series of <span><strong class=
                   7544:                 "command">make deinstall</strong></span> and
                   7545:                 <span><strong class="command">make
                   7546:                 install</strong></span> (or whatever <code class=
                   7547:                 "varname">UPDATE_TARGET</code> is set to) for these
                   7548:                 packages.</p>
1.1       grant    7549: 
                   7550:                 <p>You can use the &#8220;<span class=
                   7551:                 "quote">update</span>&#8221; target to resume
1.14      xtraeme  7552:                 package updating in case a previous
                   7553:                 <span><strong class="command">make
                   7554:                 update</strong></span> was interrupted for some
                   7555:                 reason. However, in this case, make sure you don't
                   7556:                 call <span><strong class="command">make
                   7557:                 clean</strong></span> or otherwise remove the list
                   7558:                 of dependent packages in <code class=
                   7559:                 "varname">WRKDIR</code>. Otherwise you lose the
1.1       grant    7560:                 ability to automatically update the current package
                   7561:                 along with the dependent packages you have
                   7562:                 installed.</p>
                   7563: 
1.14      xtraeme  7564:                 <p>Resuming an interrupted <span><strong class=
                   7565:                 "command">make update</strong></span> will only
                   7566:                 work as long as the package tree remains unchanged.
                   7567:                 If the source code for one of the packages to be
                   7568:                 updated has been changed, resuming
                   7569:                 <span><strong class="command">make
                   7570:                 update</strong></span> will most certainly
                   7571:                 fail!</p>
1.1       grant    7572: 
                   7573:                 <p>The following variables can be used either on
1.14      xtraeme  7574:                 the command line or in <code class=
                   7575:                 "filename">/etc/mk.conf</code> to alter the
                   7576:                 behaviour of <span><strong class="command">make
                   7577:                 update</strong></span>:</p>
1.1       grant    7578: 
                   7579:                 <div class="variablelist">
                   7580:                   <dl>
1.14      xtraeme  7581:                     <dt><span class="term"><code class=
                   7582:                     "varname">UPDATE_TARGET</code></span></dt>
1.1       grant    7583: 
                   7584:                     <dd>
                   7585:                       <p>Install target to recursively use for the
                   7586:                       updated package and the dependent packages.
1.14      xtraeme  7587:                       Defaults to <code class=
                   7588:                       "varname">DEPENDS_TARGET</code> if set,
1.1       grant    7589:                       &#8220;<span class=
                   7590:                       "quote">install</span>&#8221; otherwise for
1.14      xtraeme  7591:                       <span><strong class="command">make
                   7592:                       update</strong></span>. e.g.
                   7593:                       <span><strong class="command">make update
                   7594:                       UPDATE_TARGET=package</strong></span></p>
1.1       grant    7595:                     </dd>
                   7596: 
1.14      xtraeme  7597:                     <dt><span class="term"><code class=
                   7598:                     "varname">NOCLEAN</code></span></dt>
1.1       grant    7599: 
                   7600:                     <dd>
                   7601:                       <p>Don't clean up after updating. Useful if
                   7602:                       you want to leave the work sources of the
                   7603:                       updated packages around for inspection or
                   7604:                       other purposes. Be sure you eventually clean
                   7605:                       up the source tree (see the
                   7606:                       &#8220;<span class=
                   7607:                       "quote">clean-update</span>&#8221; target
                   7608:                       below) or you may run into troubles with old
                   7609:                       source code still lying around on your next
1.14      xtraeme  7610:                       <span><strong class=
                   7611:                       "command">make</strong></span> or
                   7612:                       <span><strong class="command">make
                   7613:                       update</strong></span>.</p>
1.1       grant    7614:                     </dd>
                   7615: 
1.14      xtraeme  7616:                     <dt><span class="term"><code class=
                   7617:                     "varname">REINSTALL</code></span></dt>
1.1       grant    7618: 
                   7619:                     <dd>
                   7620:                       <p>Deinstall each package before installing
1.14      xtraeme  7621:                       (making <code class=
                   7622:                       "varname">DEPENDS_TARGET</code>). This may be
1.1       grant    7623:                       necessary if the &#8220;<span class=
                   7624:                       "quote">clean-update</span>&#8221; target
                   7625:                       (see below) was called after interrupting a
1.14      xtraeme  7626:                       running <span><strong class="command">make
                   7627:                       update</strong></span>.</p>
1.1       grant    7628:                     </dd>
                   7629: 
1.14      xtraeme  7630:                     <dt><span class="term"><code class=
                   7631:                     "varname">DEPENDS_TARGET</code></span></dt>
1.1       grant    7632: 
                   7633:                     <dd>
                   7634:                       <p>Allows you to disable recursion and
                   7635:                       hardcode the target for packages. The default
                   7636:                       is &#8220;<span class=
                   7637:                       "quote">update</span>&#8221; for the update
                   7638:                       target, facilitating a recursive update of
1.14      xtraeme  7639:                       prerequisite packages. Only set <code class=
                   7640:                       "varname">DEPENDS_TARGET</code> if you want
                   7641:                       to disable recursive updates. Use
                   7642:                       <code class="varname">UPDATE_TARGET</code>
                   7643:                       instead to just set a specific target for
                   7644:                       each package to be installed during
                   7645:                       <span><strong class="command">make
                   7646:                       update</strong></span> (see above).</p>
1.1       grant    7647:                     </dd>
                   7648:                   </dl>
                   7649:                 </div>
                   7650:               </dd>
                   7651: 
                   7652:               <dt><span class="term">clean-update</span></dt>
                   7653: 
                   7654:               <dd>
                   7655:                 <p>Clean the source tree for all packages that
1.14      xtraeme  7656:                 would get updated if <span><strong class=
                   7657:                 "command">make update</strong></span> was called
                   7658:                 from the current directory. This target should not
                   7659:                 be used if the current package (or any of its
                   7660:                 depending packages) have already been de-installed
                   7661:                 (e.g., after calling <span><strong class=
                   7662:                 "command">make update</strong></span>) or you may
                   7663:                 lose some packages you intended to update. As a
                   7664:                 rule of thumb: only use this target <span class=
                   7665:                 "emphasis"><em>before</em></span> the first time
                   7666:                 you run <span><strong class="command">make
                   7667:                 update</strong></span> and only if you have a dirty
                   7668:                 package tree (e.g., if you used <code class=
                   7669:                 "varname">NOCLEAN</code>).</p>
1.1       grant    7670: 
                   7671:                 <p>If you unsure about whether your tree is clean
1.14      xtraeme  7672:                 you can either perform a <span><strong class=
                   7673:                 "command">make clean</strong></span> at the top of
                   7674:                 the tree, or use the following sequence of commands
1.1       grant    7675:                 from the directory of the package you want to
                   7676:                 update (<span class=
                   7677:                 "emphasis"><em>before</em></span> running
1.14      xtraeme  7678:                 <span><strong class="command">make
                   7679:                 update</strong></span> for the first time,
                   7680:                 otherwise you lose all the packages you wanted to
                   7681:                 update!):</p>
1.1       grant    7682:                 <pre class="screen">
1.14      xtraeme  7683: <code class="prompt">#</code> <strong class=
                   7684: "userinput"><code>make clean-update</code></strong>
                   7685: <code class="prompt">#</code> <strong class=
                   7686: "userinput"><code>make clean CLEANDEPENDS=YES</code></strong>
                   7687: <code class="prompt">#</code> <strong class=
                   7688: "userinput"><code>make update</code></strong>
1.1       grant    7689: </pre>
                   7690: 
                   7691:                 <p>The following variables can be used either on
1.14      xtraeme  7692:                 the command line or in <code class=
                   7693:                 "filename">/etc/mk.conf</code> to alter the
                   7694:                 behaviour of <span><strong class="command">make
                   7695:                 clean-update</strong></span>:</p>
1.1       grant    7696: 
                   7697:                 <div class="variablelist">
                   7698:                   <dl>
1.14      xtraeme  7699:                     <dt><span class="term"><code class=
                   7700:                     "varname">CLEAR_DIRLIST</code></span></dt>
1.1       grant    7701: 
                   7702:                     <dd>
1.14      xtraeme  7703:                       <p>After <span><strong class="command">make
                   7704:                       clean</strong></span>, do not reconstruct the
                   7705:                       list of directories to update for this
                   7706:                       package. Only use this if
                   7707:                       <span><strong class="command">make
                   7708:                       update</strong></span> successfully installed
                   7709:                       all packages you wanted to update. Normally,
                   7710:                       this is done automatically on
                   7711:                       <span><strong class="command">make
                   7712:                       update</strong></span>, but may have been
                   7713:                       suppressed by the <code class=
                   7714:                       "varname">NOCLEAN</code> variable (see
1.1       grant    7715:                       above).</p>
                   7716:                     </dd>
                   7717:                   </dl>
                   7718:                 </div>
                   7719:               </dd>
                   7720: 
                   7721:               <dt><span class="term">info</span></dt>
                   7722: 
                   7723:               <dd>
                   7724:                 <p>This target invokes <a href=
                   7725:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   7726:                 <span class="citerefentry"><span class=
                   7727:                 "refentrytitle">pkg_info</span>(1)</span></a> for
                   7728:                 the current package. You can use this to check
                   7729:                 which version of a package is installed.</p>
                   7730:               </dd>
                   7731: 
                   7732:               <dt><span class="term">readme</span></dt>
                   7733: 
                   7734:               <dd>
1.14      xtraeme  7735:                 <p>This target generates a <code class=
                   7736:                 "filename">README.html</code> file, which can be
1.1       grant    7737:                 viewed using a browser such as <a xmlns=
                   7738:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7739:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/mozilla/README.html"
1.14      xtraeme  7740:                 class="pkgname">www/mozilla</a> or <a xmlns=
                   7741:                 "http://www.w3.org/TR/xhtml1/transitional" href=
                   7742:                 "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/links/README.html"
                   7743:                 class="pkgname">www/links</a>. The generated files
                   7744:                 contain references to any packages which are in the
                   7745:                 <code class="varname">PACKAGES</code> directory on
                   7746:                 the local host. The generated files can be made to
                   7747:                 refer to URLs based on <code class=
                   7748:                 "varname">FTP_PKG_URL_HOST</code> and <code class=
                   7749:                 "varname">FTP_PKG_URL_DIR</code>. For example, if I
                   7750:                 wanted to generate <code class=
                   7751:                 "filename">README.html</code> files which pointed
                   7752:                 to binary packages on the local machine, in the
                   7753:                 directory <code class=
                   7754:                 "filename">/usr/packages</code>, set <code class=
                   7755:                 "varname">FTP_PKG_URL_HOST=file://localhost</code>
                   7756:                 and <code class=
                   7757:                 "varname">FTP_PKG_URL_DIR=/usr/packages</code>. The
                   7758:                 <code class="varname">${PACKAGES}</code> directory
                   7759:                 and its subdirectories will be searched for all the
                   7760:                 binary packages.</p>
1.1       grant    7761:               </dd>
                   7762: 
                   7763:               <dt><span class="term">readme-all</span></dt>
                   7764: 
                   7765:               <dd>
1.14      xtraeme  7766:                 <p>Use this target to create a file <code class=
                   7767:                 "filename">README-all.html</code> which contains a
1.1       grant    7768:                 list of all packages currently available in the
                   7769:                 NetBSD Packages Collection, together with the
                   7770:                 category they belong to and a short description.
1.14      xtraeme  7771:                 This file is compiled from the <code class=
                   7772:                 "filename">pkgsrc/*/README.html</code> files, so be
1.1       grant    7773:                 sure to run this <span class=
1.14      xtraeme  7774:                 "emphasis"><em>after</em></span> a
                   7775:                 <span><strong class="command">make
                   7776:                 readme</strong></span>.</p>
1.1       grant    7777:               </dd>
                   7778: 
                   7779:               <dt><span class="term">cdrom-readme</span></dt>
                   7780: 
                   7781:               <dd>
                   7782:                 <p>This is very much the same as the
                   7783:                 &#8220;<span class="quote">readme</span>&#8221;
                   7784:                 target (see above), but is to be used when
                   7785:                 generating a pkgsrc tree to be written to a CD-ROM.
1.14      xtraeme  7786:                 This target also produces <code class=
                   7787:                 "filename">README.html</code> files, and can be
                   7788:                 made to refer to URLs based on <code class=
                   7789:                 "varname">CDROM_PKG_URL_HOST</code> and
                   7790:                 <code class="varname">CDROM_PKG_URL_DIR</code>.</p>
1.1       grant    7791:               </dd>
                   7792: 
                   7793:               <dt><span class="term">show-distfiles</span></dt>
                   7794: 
                   7795:               <dd>
                   7796:                 <p>This target shows which distfiles and patchfiles
1.14      xtraeme  7797:                 are needed to build the package. (<code class=
                   7798:                 "varname">DISTFILES</code> and <code class=
                   7799:                 "varname">PATCHFILES</code>, but not <code class=
                   7800:                 "filename">patches/*</code>)</p>
1.1       grant    7801:               </dd>
                   7802: 
                   7803:               <dt><span class="term">show-downlevel</span></dt>
                   7804: 
                   7805:               <dd>
                   7806:                 <p>This target shows nothing if the package is not
                   7807:                 installed. If a version of this package is
                   7808:                 installed, but is not the version provided in this
                   7809:                 version of pkgsrc, then a warning message is
                   7810:                 displayed. This target can be used to show which of
                   7811:                 your installed packages are downlevel, and so the
                   7812:                 old versions can be deleted, and the current ones
                   7813:                 added.</p>
                   7814:               </dd>
                   7815: 
                   7816:               <dt><span class="term">show-pkgsrc-dir</span></dt>
                   7817: 
                   7818:               <dd>
                   7819:                 <p>This target shows the directory in the pkgsrc
                   7820:                 hierarchy from which the package can be built and
                   7821:                 installed. This may not be the same directory as
                   7822:                 the one from which the package was installed. This
                   7823:                 target is intended to be used by people who may
                   7824:                 wish to upgrade many packages on a single host, and
                   7825:                 can be invoked from the top-level pkgsrc Makefile
                   7826:                 by using the &#8220;<span class=
                   7827:                 "quote">show-host-specific-pkgs</span>&#8221;
                   7828:                 target.</p>
                   7829:               </dd>
                   7830: 
                   7831:               <dt><span class=
                   7832:               "term">show-installed-depends</span></dt>
                   7833: 
                   7834:               <dd>
                   7835:                 <p>This target shows which installed packages match
1.14      xtraeme  7836:                 the current package's <code class=
                   7837:                 "varname">DEPENDS</code>. Useful if out of date
1.1       grant    7838:                 dependencies are causing build problems.</p>
                   7839:               </dd>
                   7840: 
                   7841:               <dt><span class="term">check-shlibs</span></dt>
                   7842: 
                   7843:               <dd>
                   7844:                 <p>After a package is installed, check all its
                   7845:                 binaries and (on ELF platforms) shared libraries to
                   7846:                 see if they find the shared libs they need. Run by
1.14      xtraeme  7847:                 default if <code class=
                   7848:                 "varname">PKG_DEVELOPER</code> is set in
                   7849:                 <code class="filename">/etc/mk.conf</code>.</p>
1.1       grant    7850:               </dd>
                   7851: 
                   7852:               <dt><span class="term">print-PLIST</span></dt>
                   7853: 
                   7854:               <dd>
                   7855:                 <p>After a &#8220;<span class="quote">make
                   7856:                 install</span>&#8221; from a new or upgraded pkg,
                   7857:                 this prints out an attempt to generate a new
1.14      xtraeme  7858:                 <code class="filename">PLIST</code> from a
                   7859:                 <span><strong class="command">find -newer
                   7860:                 work/.extract_done</strong></span>. An attempt is
                   7861:                 made to care for shared libs etc., but it is
1.1       grant    7862:                 <span class="emphasis"><em>strongly</em></span>
                   7863:                 recommended to review the result before putting it
1.14      xtraeme  7864:                 into <code class="filename">PLIST</code>. On
                   7865:                 upgrades, it's useful to diff the output of this
                   7866:                 command against an already existing <code class=
                   7867:                 "filename">PLIST</code> file.</p>
1.1       grant    7868: 
                   7869:                 <p>If the package installs files via tar(1) or
                   7870:                 other methods that don't update file access times,
                   7871:                 be sure to add these files manually to your
1.14      xtraeme  7872:                 <code class="filename">PLIST</code>, as the
1.1       grant    7873:                 &#8220;<span class="quote">find
                   7874:                 -newer</span>&#8221; command used by this target
                   7875:                 won't catch them!</p>
                   7876: 
                   7877:                 <p>See <a href="#print-PLIST" title=
                   7878:                 "8.3.&nbsp;Tweaking output of make print-PLIST">Section&nbsp;8.3,
1.14      xtraeme  7879:                 &#8220;Tweaking output of <span><strong class=
                   7880:                 "command">make
                   7881:                 print-PLIST</strong></span>&#8221;</a> for more
                   7882:                 information on this target.</p>
1.1       grant    7883:               </dd>
                   7884: 
                   7885:               <dt><span class="term">bulk-package</span></dt>
                   7886: 
                   7887:               <dd>
                   7888:                 <p>Used to do bulk builds. If an appropriate binary
                   7889:                 package already exists, no action is taken. If not,
                   7890:                 this target will compile, install and package it
1.14      xtraeme  7891:                 (and it's depends, if <code class=
                   7892:                 "varname">PKG_DEPENDS</code> is set properly. See
1.1       grant    7893:                 <a href="#binary.configuration" title=
                   7894:                 "5.3.1.&nbsp;Configuration">Section&nbsp;5.3.1,
                   7895:                 &#8220;Configuration&#8221;</a>. After creating the
                   7896:                 binary package, the sources, the just-installed
                   7897:                 package and it's required packages are removed,
                   7898:                 preserving free disk space.</p>
                   7899: 
                   7900:                 <p><span class="emphasis"><em>Beware that this
                   7901:                 target may deinstall all packages installed on a
                   7902:                 system!</em></span></p>
                   7903:               </dd>
                   7904: 
                   7905:               <dt><span class="term">bulk-install</span></dt>
                   7906: 
                   7907:               <dd>
                   7908:                 <p>Used during bulk-installs to install required
                   7909:                 packages. If an upto-date binary package is
                   7910:                 available, it will be installed via <a href=
                   7911:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7912:                 <span class="citerefentry"><span class=
                   7913:                 "refentrytitle">pkg_add</span>(1)</span></a>. If
1.14      xtraeme  7914:                 not, <span><strong class="command">make
                   7915:                 bulk-package</strong></span> will be executed, but
                   7916:                 the installed binary not be removed.</p>
1.1       grant    7917: 
                   7918:                 <p>A binary package is considered
                   7919:                 &#8220;<span class="quote">upto-date</span>&#8221;
                   7920:                 to be installed via <a href=
                   7921:                 "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_add+1+NetBSD-current">
                   7922:                 <span class="citerefentry"><span class=
                   7923:                 "refentrytitle">pkg_add</span>(1)</span></a>
                   7924:                 if:</p>
                   7925: 
                   7926:                 <div class="itemizedlist">
                   7927:                   <ul type="disc">
                   7928:                     <li>
1.14      xtraeme  7929:                       <p>None of the package's files (<code class=
                   7930:                       "filename">Makefile</code>, ...) were
                   7931:                       modified since it was built.</p>
1.1       grant    7932:                     </li>
                   7933: 
                   7934:                     <li>
                   7935:                       <p>None of the package's required (binary)
                   7936:                       packages were modified since it was
                   7937:                       built.</p>
                   7938:                     </li>
                   7939:                   </ul>
                   7940:                 </div>
                   7941: 
                   7942:                 <p><span class="emphasis"><em>Beware that this
                   7943:                 target may deinstall all packages installed on a
                   7944:                 system!</em></span></p>
                   7945:               </dd>
                   7946:             </dl>
                   7947:           </div>
                   7948:         </div>
                   7949:       </div>
                   7950: 
                   7951:       <div class="chapter" lang="en" xml:lang="en">
                   7952:         <div class="titlepage">
                   7953:           <div>
                   7954:             <div>
                   7955:               <h2 class="title"><a name="fixes" id=
                   7956:               "fixes"></a>Chapter&nbsp;12.&nbsp;Notes on fixes for
                   7957:               packages</h2>
                   7958:             </div>
                   7959:           </div>
                   7960:         </div>
                   7961: 
                   7962:         <div class="toc">
                   7963:           <p><b>Table of Contents</b></p>
                   7964: 
                   7965:           <dl>
1.18    ! xtraeme  7966:             <dt><span class="sect1"><a href="#id2593797">12.1.
1.1       grant    7967:             General operation</a></span></dt>
                   7968: 
                   7969:             <dd>
                   7970:               <dl>
                   7971:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  7972:                 "#id2593800">12.1.1. How to pull in variables from
1.1       grant    7973:                 /etc/mk.conf</a></span></dt>
                   7974: 
                   7975:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  7976:                 "#id2593952">12.1.2. Restricted
1.1       grant    7977:                 packages</a></span></dt>
                   7978: 
                   7979:                 <dt><span class="sect2"><a href=
                   7980:                 "#dependencies">12.1.3. Handling
                   7981:                 dependencies</a></span></dt>
                   7982: 
                   7983:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  7984:                 "#id2594467">12.1.4. Handling conflicts with other
1.1       grant    7985:                 packages</a></span></dt>
                   7986: 
                   7987:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  7988:                 "#id2594517">12.1.5. Packages that cannot or should
1.1       grant    7989:                 not be built</a></span></dt>
                   7990: 
                   7991:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  7992:                 "#id2594542">12.1.6. Packages which should not be
1.1       grant    7993:                 deleted, once installed</a></span></dt>
                   7994: 
                   7995:                 <dt><span class="sect2"><a href=
                   7996:                 "#security-handling">12.1.7. Handling packages with
                   7997:                 security problems</a></span></dt>
                   7998: 
                   7999:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8000:                 "#id2594702">12.1.8. How to handle compiler
1.1       grant    8001:                 bugs</a></span></dt>
                   8002: 
                   8003:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8004:                 "#id2594725">12.1.9. How to handle incrementing
1.1       grant    8005:                 versions when fixing an existing
                   8006:                 package</a></span></dt>
                   8007: 
                   8008:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8009:                 "#id2594774">12.1.10. Portability of
1.1       grant    8010:                 packages</a></span></dt>
                   8011:               </dl>
                   8012:             </dd>
                   8013: 
1.18    ! xtraeme  8014:             <dt><span class="sect1"><a href="#id2594798">12.2.
1.1       grant    8015:             Possible downloading issues</a></span></dt>
                   8016: 
                   8017:             <dd>
                   8018:               <dl>
                   8019:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8020:                 "#id2594802">12.2.1. Packages whose distfiles
1.1       grant    8021:                 aren't available for plain
                   8022:                 downloading</a></span></dt>
                   8023: 
                   8024:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8025:                 "#id2594865">12.2.2. How to handle modified
1.1       grant    8026:                 distfiles with the 'old' name</a></span></dt>
                   8027:               </dl>
                   8028:             </dd>
                   8029: 
1.18    ! xtraeme  8030:             <dt><span class="sect1"><a href="#id2594876">12.3.
1.1       grant    8031:             Configuration gotchas</a></span></dt>
                   8032: 
                   8033:             <dd>
                   8034:               <dl>
                   8035:                 <dt><span class="sect2"><a href=
                   8036:                 "#fixes.libtool">12.3.1. Shared libraries -
                   8037:                 libtool</a></span></dt>
                   8038: 
                   8039:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8040:                 "#id2595352">12.3.2. Using libtool on GNU packages
1.1       grant    8041:                 that already support libtool</a></span></dt>
                   8042: 
                   8043:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8044:                 "#id2595436">12.3.3. GNU
1.1       grant    8045:                 Autoconf/Automake</a></span></dt>
                   8046:               </dl>
                   8047:             </dd>
                   8048: 
1.18    ! xtraeme  8049:             <dt><span class="sect1"><a href="#id2595481">12.4.
1.1       grant    8050:             Building considerations</a></span></dt>
                   8051: 
                   8052:             <dd>
                   8053:               <dl>
                   8054:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8055:                 "#id2595484">12.4.1. CPP defines</a></span></dt>
1.1       grant    8056:               </dl>
                   8057:             </dd>
                   8058: 
1.18    ! xtraeme  8059:             <dt><span class="sect1"><a href="#id2595651">12.5.
1.1       grant    8060:             Package specific actions</a></span></dt>
                   8061: 
                   8062:             <dd>
                   8063:               <dl>
                   8064:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8065:                 "#id2595654">12.5.1. Package configuration
1.1       grant    8066:                 files</a></span></dt>
                   8067: 
                   8068:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8069:                 "#id2595825">12.5.2. User
1.2       hubertf  8070:                 interaction</a></span></dt>
1.1       grant    8071: 
                   8072:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8073:                 "#id2595869">12.5.3. Handling
1.1       grant    8074:                 licenses</a></span></dt>
                   8075: 
                   8076:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8077:                 "#id2596089">12.5.4. Creating an account from a
1.1       grant    8078:                 package</a></span></dt>
                   8079: 
                   8080:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8081:                 "#id2596151">12.5.5. Installing score
1.1       grant    8082:                 files</a></span></dt>
                   8083: 
                   8084:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8085:                 "#id2596195">12.5.6. Packages providing login
1.1       grant    8086:                 shells</a></span></dt>
                   8087: 
                   8088:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8089:                 "#id2596252">12.5.7. Packages containing perl
1.1       grant    8090:                 scripts</a></span></dt>
                   8091: 
                   8092:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8093:                 "#id2596270">12.5.8. Packages with hardcoded paths
1.1       grant    8094:                 to other interpreters</a></span></dt>
                   8095: 
                   8096:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8097:                 "#id2596292">12.5.9. Packages installing perl
1.1       grant    8098:                 modules</a></span></dt>
                   8099: 
                   8100:                 <dt><span class="sect2"><a href=
                   8101:                 "#faq.info-files">12.5.10. Packages installing info
                   8102:                 files</a></span></dt>
                   8103: 
                   8104:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8105:                 "#id2596512">12.5.11. Packages installing GConf2
1.1       grant    8106:                 data files</a></span></dt>
                   8107: 
                   8108:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8109:                 "#id2596612">12.5.12. Packages installing
1.1       grant    8110:                 scrollkeeper data files</a></span></dt>
                   8111: 
                   8112:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8113:                 "#id2596731">12.5.13. Packages installing X11
1.1       grant    8114:                 fonts</a></span></dt>
                   8115: 
                   8116:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8117:                 "#id2596778">12.5.14. Packages installing GTK2
1.1       grant    8118:                 modules</a></span></dt>
                   8119: 
                   8120:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8121:                 "#id2596916">12.5.15. Packages installing SGML or
1.1       grant    8122:                 XML data</a></span></dt>
                   8123: 
                   8124:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8125:                 "#id2596968">12.5.16. Packages installing
1.1       grant    8126:                 extensions to the MIME database</a></span></dt>
                   8127: 
                   8128:                 <dt><span class="sect2"><a href=
1.18    ! xtraeme  8129:                 "#id2597107">12.5.17. Packages using
1.1       grant    8130:                 intltool</a></span></dt>
1.18    ! xtraeme  8131: 
        !          8132:                 <dt><span class="sect2"><a href=
        !          8133:                 "#id2597121">12.5.18. Packages installing startup
        !          8134:                 scripts</a></span></dt>
1.1       grant    8135:               </dl>
                   8136:             </dd>
                   8137: 
1.18    ! xtraeme  8138:             <dt><span class="sect1"><a href="#id2597210">12.6.
1.1       grant    8139:             Feedback to the author</a></span></dt>
                   8140:           </dl>
                   8141:         </div>
                   8142: 
                   8143:         <div class="sect1" lang="en" xml:lang="en">
                   8144:           <div class="titlepage">
                   8145:             <div>
                   8146:               <div>
                   8147:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  8148:                 "id2593797" id="id2593797"></a>12.1.&nbsp;General
1.1       grant    8149:                 operation</h2>
                   8150:               </div>
                   8151:             </div>
                   8152:           </div>
                   8153: 
                   8154:           <div class="sect2" lang="en" xml:lang="en">
                   8155:             <div class="titlepage">
                   8156:               <div>
                   8157:                 <div>
1.18    ! xtraeme  8158:                   <h3 class="title"><a name="id2593800" id=
        !          8159:                   "id2593800"></a>12.1.1.&nbsp;How to pull in
1.1       grant    8160:                   variables from /etc/mk.conf</h3>
                   8161:                 </div>
                   8162:               </div>
                   8163:             </div>
                   8164: 
                   8165:             <p>The problem with package-defined variables that can
1.14      xtraeme  8166:             be overridden via <code class="varname">MAKECONF</code>
                   8167:             or <code class="filename">/etc/mk.conf</code> is that
                   8168:             <a href=
1.1       grant    8169:             "http://netbsd.gw.com/cgi-bin/man-cgi?make+1+NetBSD-current">
                   8170:             <span class="citerefentry"><span class=
                   8171:             "refentrytitle">make</span>(1)</span></a> expands a
                   8172:             variable as it is used, but evaluates preprocessor like
                   8173:             statements (.if, .ifdef and .ifndef) as they are read.
1.14      xtraeme  8174:             So, to use any variable (which may be set in
                   8175:             <code class="filename">/etc/mk.conf</code>) in one of
                   8176:             the .if* statements, the file <code class=
                   8177:             "filename">/etc/mk.conf</code> must be included before
1.1       grant    8178:             that .if* statement.</p>
                   8179: 
                   8180:             <p>Rather than have a number of ad-hoc ways of
1.14      xtraeme  8181:             including <code class="filename">/etc/mk.conf</code>,
                   8182:             should it exist, or <code class=
                   8183:             "varname">MAKECONF</code>, should it exist, include the
                   8184:             <code class="filename">pkgsrc/mk/bsd.prefs.mk</code>
                   8185:             file in the package Makefile before any
                   8186:             preprocessor-like .if, .ifdef, or .ifndef
                   8187:             statements:</p>
1.1       grant    8188:             <pre class="programlisting">
                   8189: .include "../../mk/bsd.prefs.mk"
                   8190:     
                   8191:     .if defined(USE_MENUS)
                   8192:       ...
                   8193:     .endif
                   8194: </pre>
                   8195: 
1.14      xtraeme  8196:             <p>If you wish to set the <code class=
                   8197:             "varname">CFLAGS</code> variable in <code class=
                   8198:             "filename">/etc/mk.conf</code> please make sure to
1.1       grant    8199:             use:</p>
                   8200:             <pre class="programlisting">
                   8201: CFLAGS+=  -your -flags
                   8202: </pre>
                   8203: 
1.14      xtraeme  8204:             <p>Using <code class="varname">CFLAGS=</code> (i.e.
                   8205:             without the &#8220;<span class="quote">+</span>&#8221;)
                   8206:             may lead to problems with packages that need to add
                   8207:             their own flags. Also, you may want to take a look at
                   8208:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
1.1       grant    8209:             href=
                   8210:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/cpuflags/README.html"
1.14      xtraeme  8211:             class="pkgname">devel/cpuflags</a> package if you're
                   8212:             interested in optimization for the current CPU.</p>
1.1       grant    8213:           </div>
                   8214: 
                   8215:           <div class="sect2" lang="en" xml:lang="en">
                   8216:             <div class="titlepage">
                   8217:               <div>
                   8218:                 <div>
1.18    ! xtraeme  8219:                   <h3 class="title"><a name="id2593952" id=
        !          8220:                   "id2593952"></a>12.1.2.&nbsp;Restricted
1.1       grant    8221:                   packages</h3>
                   8222:                 </div>
                   8223:               </div>
                   8224:             </div>
                   8225: 
                   8226:             <p>Some licenses restrict how software may be
                   8227:             re-distributed. In order to satisfy these restrictions,
                   8228:             the package system defines five make variables that can
                   8229:             be set to note these restrictions:</p>
                   8230: 
                   8231:             <div class="itemizedlist">
                   8232:               <ul type="disc">
                   8233:                 <li>
1.14      xtraeme  8234:                   <p><code class="varname">RESTRICTED</code></p>
1.1       grant    8235: 
                   8236:                   <p>This variable should be set whenever a
                   8237:                   restriction exists (regardless of its kind). Set
                   8238:                   this variable to a string containing the reason
                   8239:                   for the restriction.</p>
                   8240:                 </li>
                   8241: 
                   8242:                 <li>
1.14      xtraeme  8243:                   <p><code class=
                   8244:                   "varname">NO_BIN_ON_CDROM</code></p>
1.1       grant    8245: 
                   8246:                   <p>Binaries may not be placed on CD-ROM. Set this
1.14      xtraeme  8247:                   variable to <code class=
                   8248:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8249:                   package may not be included on a CD-ROM.</p>
                   8250:                 </li>
                   8251: 
                   8252:                 <li>
1.14      xtraeme  8253:                   <p><code class="varname">NO_BIN_ON_FTP</code></p>
1.1       grant    8254: 
                   8255:                   <p>Binaries may not be placed on an FTP server.
1.14      xtraeme  8256:                   Set this variable to <code class=
                   8257:                   "varname">${RESTRICTED}</code> whenever a binary
1.1       grant    8258:                   package may not not be made available on the
                   8259:                   Internet.</p>
                   8260:                 </li>
                   8261: 
                   8262:                 <li>
1.14      xtraeme  8263:                   <p><code class=
                   8264:                   "varname">NO_SRC_ON_CDROM</code></p>
1.1       grant    8265: 
                   8266:                   <p>Distfiles may not be placed on CD-ROM. Set
1.14      xtraeme  8267:                   this variable to <code class=
                   8268:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8269:                   of the source code or other distfile(s) is not
                   8270:                   allowed on CD-ROMs.</p>
                   8271:                 </li>
                   8272: 
                   8273:                 <li>
1.14      xtraeme  8274:                   <p><code class="varname">NO_SRC_ON_FTP</code></p>
1.1       grant    8275: 
                   8276:                   <p>Distfiles may not be placed on FTP. Set this
1.14      xtraeme  8277:                   variable to <code class=
                   8278:                   "varname">${RESTRICTED}</code> if re-distribution
1.1       grant    8279:                   of the source code or other distfile(s) via the
                   8280:                   Internet is not allowed.</p>
                   8281:                 </li>
                   8282:               </ul>
                   8283:             </div>
                   8284: 
1.14      xtraeme  8285:             <p>Please note that the use of <code class=
                   8286:             "varname">NO_PACKAGE</code>, <code class=
                   8287:             "varname">IGNORE</code>, <code class=
                   8288:             "varname">NO_CDROM</code>, or other generic make
1.1       grant    8289:             variables to denote restrictions is deprecated, because
                   8290:             they unconditionally prevent users from generating
                   8291:             binary packages!</p>
                   8292:           </div>
                   8293: 
                   8294:           <div class="sect2" lang="en" xml:lang="en">
                   8295:             <div class="titlepage">
                   8296:               <div>
                   8297:                 <div>
                   8298:                   <h3 class="title"><a name="dependencies" id=
                   8299:                   "dependencies"></a>12.1.3.&nbsp;Handling
                   8300:                   dependencies</h3>
                   8301:                 </div>
                   8302:               </div>
                   8303:             </div>
                   8304: 
                   8305:             <p>Your package may depend on some other package being
                   8306:             present - and there are various ways of expressing this
1.14      xtraeme  8307:             dependency. pkgsrc supports the <code class=
                   8308:             "varname">BUILD_DEPENDS</code> and <code class=
                   8309:             "varname">DEPENDS</code> definitions, as well as
                   8310:             dependencies via <code class=
                   8311:             "filename">buildlink3.mk</code>, which is the preferred
1.1       grant    8312:             way to handle dependencies, and which uses the
                   8313:             variables named above. See <a href="#buildlink" title=
                   8314:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8315:             <i>Buildlink methodology</i></a> for more
                   8316:             information.</p>
                   8317: 
                   8318:             <p>The basic difference between the two variables is as
1.14      xtraeme  8319:             follows: The <code class="varname">DEPENDS</code>
1.1       grant    8320:             definition registers that pre-requisite in the binary
                   8321:             package so it will be pulled in when the binary package
1.14      xtraeme  8322:             is later installed, whilst the <code class=
                   8323:             "varname">BUILD_DEPENDS</code> definition does not,
1.1       grant    8324:             marking a dependency that is only needed for building
                   8325:             the package.</p>
                   8326: 
                   8327:             <p>This means that if you only need a package present
                   8328:             whilst you are building, it should be noted as a
1.14      xtraeme  8329:             <code class="varname">BUILD_DEPENDS</code>.</p>
1.1       grant    8330: 
1.14      xtraeme  8331:             <p>The format for a <code class=
                   8332:             "varname">BUILD_DEPENDS</code> and a <code class=
                   8333:             "varname">DEPENDS</code> definition is:</p>
1.1       grant    8334:             <pre class="programlisting">
                   8335: &lt;pre-req-package-name&gt;:../../&lt;category&gt;/&lt;pre-req-package&gt;
                   8336: </pre>
                   8337: 
                   8338:             <p>Please note that the &#8220;<span class=
                   8339:             "quote">pre-req-package-name</span>&#8221; may include
1.18    ! xtraeme  8340:             any of the wildcard version numbers recognized by
1.1       grant    8341:             <a href=
                   8342:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_info+1+NetBSD-current">
                   8343:             <span class="citerefentry"><span class=
                   8344:             "refentrytitle">pkg_info</span>(1)</span></a>.</p>
                   8345: 
                   8346:             <div class="orderedlist">
                   8347:               <ol type="1">
                   8348:                 <li>
                   8349:                   <p>If your package needs another package's
                   8350:                   binaries or libraries to build or run, and if
1.14      xtraeme  8351:                   that package has a <code class=
                   8352:                   "filename">buildlink3.mk</code> file available,
                   8353:                   use it:</p>
1.1       grant    8354:                   <pre class="programlisting">
                   8355:     .include "../../graphics/jpeg/buildlink3.mk"
                   8356:     
                   8357: </pre>
                   8358:                 </li>
                   8359: 
                   8360:                 <li>
                   8361:                   <p>If your package needs to use another package
1.14      xtraeme  8362:                   to build itself and there is no <code class=
                   8363:                   "filename">buildlink3.mk</code> file available,
                   8364:                   use the <code class=
                   8365:                   "varname">BUILD_DEPENDS</code> definition:</p>
1.1       grant    8366:                   <pre class="programlisting">
                   8367: BUILD_DEPENDS+=  autoconf-2.13:../../devel/autoconf
                   8368: </pre>
                   8369:                 </li>
                   8370: 
                   8371:                 <li>
                   8372:                   <p>If your package needs a library with which to
1.14      xtraeme  8373:                   link and again there is no <code class=
                   8374:                   "filename">buildlink3.mk</code> file available,
                   8375:                   this is specified using the <code class=
                   8376:                   "varname">DEPENDS</code> definition. An example
                   8377:                   of this is the <a xmlns=
1.1       grant    8378:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8379:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.14      xtraeme  8380:                   class="pkgname">print/lyx</a> package, which uses
                   8381:                   the xpm library, version 3.4j to build:</p>
1.1       grant    8382:                   <pre class="programlisting">
                   8383: DEPENDS+=       xpm-3.4j:../../graphics/xpm
                   8384: </pre>
                   8385: 
                   8386:                   <p>You can also use wildcards in package
                   8387:                   dependences:</p>
                   8388:                   <pre class="programlisting">
                   8389: DEPENDS+=       xpm-[0-9]*:../../graphics/xpm
                   8390: </pre>
                   8391: 
                   8392:                   <p>Note that such wildcard dependencies are
                   8393:                   retained when creating binary packages. The
                   8394:                   dependency is checked when installing the binary
                   8395:                   package and any package which matches the pattern
                   8396:                   will be used. Wildcard dependencies should be
                   8397:                   used with care.</p>
                   8398: 
                   8399:                   <p>The &#8220;<span class=
                   8400:                   "quote">-[0-9]*</span>&#8221; should be used
                   8401:                   instead of &#8220;<span class=
                   8402:                   "quote">-*</span>&#8221; to avoid potentially
                   8403:                   ambiguous matches such as &#8220;<span class=
                   8404:                   "quote">tk-postgresql</span>&#8221; matching a
                   8405:                   &#8220;<span class="quote">tk-*</span>&#8221;
1.14      xtraeme  8406:                   <code class="varname">DEPENDS</code>.</p>
1.1       grant    8407: 
                   8408:                   <p>Wildcards can also be used to specify that a
                   8409:                   package will only build against a certain minimum
                   8410:                   version of a pre-requisite:</p>
                   8411:                   <pre class="programlisting">
                   8412: DEPENDS+=       tiff&gt;=3.5.4:../../graphics/tiff
                   8413: </pre>
                   8414: 
                   8415:                   <p>This means that the package will build against
                   8416:                   version 3.5.4 of the tiff library or newer. Such
                   8417:                   a dependency may be warranted if, for example,
                   8418:                   the API of the library has changed with version
                   8419:                   3.5.4 and a package would not compile against an
                   8420:                   earlier version of tiff.</p>
                   8421: 
                   8422:                   <p>Please note that such dependencies should only
                   8423:                   be updated if a package requires a newer
                   8424:                   pre-requisite, but not to denote recommendations
                   8425:                   such as security updates or ABI changes that do
                   8426:                   not prevent a package from building correctly.
                   8427:                   Such recommendations can be expressed using
1.14      xtraeme  8428:                   <code class="varname">RECOMMENDED</code>:</p>
1.1       grant    8429:                   <pre class="programlisting">
                   8430: RECOMMENDED+=   tiff&gt;=3.6.1:../../graphics/tiff
                   8431: </pre>
                   8432: 
1.14      xtraeme  8433:                   <p>In addition to the above <code class=
                   8434:                   "varname">DEPENDS</code> line, this denotes that
1.1       grant    8435:                   while a package will build against
                   8436:                   tiff&gt;=3.5.4, at least version 3.6.1 is
1.14      xtraeme  8437:                   recommended. <code class=
                   8438:                   "varname">RECOMMENDED</code> entries will be
                   8439:                   turned into dependencies unless explicitly
                   8440:                   ignored (in which case a warning will be
                   8441:                   printed). Packages that are built with
1.1       grant    8442:                   recommendations ignored may not be uploaded to
                   8443:                   ftp.NetBSD.org by developers and should not be
                   8444:                   used across different systems that may have
                   8445:                   different versions of binary packages
                   8446:                   installed.</p>
                   8447: 
                   8448:                   <p>For security fixes, please update the package
                   8449:                   vulnerabilities file as well as setting
1.14      xtraeme  8450:                   <code class="varname">RECOMMENDED</code>, see
1.1       grant    8451:                   <a href="#security-handling" title=
                   8452:                   "12.1.7.&nbsp;Handling packages with security problems">
                   8453:                   Section 12.1.7, &#8220;Handling packages with
                   8454:                   security problems&#8221;</a> for more
                   8455:                   information.</p>
                   8456:                 </li>
                   8457: 
                   8458:                 <li>
                   8459:                   <p>If your package needs some executable to be
1.17      sketch   8460:                   able to run correctly and if there's no
1.14      xtraeme  8461:                   <code class="filename">buildlink3.mk</code> file,
                   8462:                   this is specified using the <code class=
                   8463:                   "varname">DEPENDS</code> variable. The <a xmlns=
1.1       grant    8464:                   "http://www.w3.org/TR/xhtml1/transitional" href=
                   8465:                   "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/lyx/README.html"
1.14      xtraeme  8466:                   class="pkgname">print/lyx</a> package needs to be
                   8467:                   able to execute the latex binary from the teTeX
                   8468:                   package when it runs, and that is specified:</p>
1.1       grant    8469:                   <pre class="programlisting">
                   8470: DEPENDS+=        teTeX-[0-9]*:../../print/teTeX
                   8471: </pre>
                   8472: 
                   8473:                   <p>The comment about wildcard dependencies from
                   8474:                   previous paragraph applies here, too.</p>
                   8475:                 </li>
                   8476:               </ol>
                   8477:             </div>
                   8478: 
                   8479:             <p>If your package needs files from another package to
                   8480:             build, see the first part of the &#8220;<span class=
                   8481:             "quote">do-configure</span>&#8221; target <a xmlns=
                   8482:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8483:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/print/ghostscript5/README.html"
1.14      xtraeme  8484:             class="pkgname">print/ghostscript5</a> package (it
                   8485:             relies on the jpeg sources being present in source form
                   8486:             during the build):</p>
1.1       grant    8487:             <pre class="programlisting">
                   8488: if [ ! -e ${_PKGSRCDIR}/graphics/jpeg/${WRKDIR:T}/jpeg-6b ]; then \
                   8489:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} extract;              \
                   8490:     fi
                   8491: </pre>
                   8492: 
                   8493:             <p>If you build any other packages that way, please
                   8494:             make sure the working files are deleted too when this
                   8495:             package's working files are cleaned up. The easiest way
                   8496:             to do so is by adding a pre-clean target:</p>
                   8497:             <pre class="programlisting">
                   8498: pre-clean:
                   8499:           cd ${_PKGSRCDIR}/../../graphics/jpeg &amp;&amp; ${MAKE} clean
                   8500: </pre>
                   8501: 
1.14      xtraeme  8502:             <p>Please also note the <code class=
                   8503:             "varname">BUILD_USES_MSGFMT</code> and <code class=
                   8504:             "varname">BUILD_USES_GETTEXT_M4</code> definitions,
                   8505:             which are provided as convenience definitions. The
                   8506:             former works out whether msgfmt(1) is part of the base
                   8507:             system, and, if it isn't, installs the <a xmlns=
1.1       grant    8508:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8509:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext/README.html"
1.14      xtraeme  8510:             class="pkgname">devel/gettext</a> package. The latter
                   8511:             adds a build dependency on either an installed version
                   8512:             of an older gettext package, or if it isn't, installs
                   8513:             the <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8514:             href=
                   8515:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gettext-m4/README.html"
                   8516:             class="pkgname">devel/gettext-m4</a> package.</p>
1.1       grant    8517:           </div>
                   8518: 
                   8519:           <div class="sect2" lang="en" xml:lang="en">
                   8520:             <div class="titlepage">
                   8521:               <div>
                   8522:                 <div>
1.18    ! xtraeme  8523:                   <h3 class="title"><a name="id2594467" id=
        !          8524:                   "id2594467"></a>12.1.4.&nbsp;Handling conflicts
1.1       grant    8525:                   with other packages</h3>
                   8526:                 </div>
                   8527:               </div>
                   8528:             </div>
                   8529: 
                   8530:             <p>Your package may conflict with other packages a user
                   8531:             might already have installed on his system, e.g. if
                   8532:             your package installs the same set of files like
                   8533:             another package in our pkgsrc tree.</p>
                   8534: 
1.14      xtraeme  8535:             <p>In this case you can set <code class=
                   8536:             "varname">CONFLICTS</code> to a space separated list of
1.1       grant    8537:             packages (including version string) your package
                   8538:             conflicts with.</p>
                   8539: 
                   8540:             <p>For example <a xmlns=
                   8541:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8542:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw3d/README.html"
1.14      xtraeme  8543:             class="pkgname">x11/Xaw3d</a> and <a xmlns=
                   8544:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8545:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/x11/Xaw-Xpm/README.html"
                   8546:             class="pkgname">x11/Xaw-Xpm</a> install provide the
                   8547:             same shared library, thus you set in <code class=
                   8548:             "filename">pkgsrc/x11/Xaw3d/Makefile</code>:</p>
1.1       grant    8549:             <pre class="programlisting">
                   8550: CONFLICTS=      Xaw-Xpm-[0-9]*
                   8551: </pre>
                   8552: 
1.14      xtraeme  8553:             <p>and in <code class=
                   8554:             "filename">pkgsrc/x11/Xaw-Xpm/Makefile</code>:</p>
1.1       grant    8555:             <pre class="programlisting">
                   8556: CONFLICTS=      Xaw3d-[0-9]*
                   8557: </pre>
                   8558: 
                   8559:             <p>Packages will automatically conflict with other
                   8560:             packages with the name prefix and a different version
                   8561:             string. &#8220;<span class=
                   8562:             "quote">Xaw3d-1.5</span>&#8221; e.g. will automatically
                   8563:             conflict with the older version &#8220;<span class=
                   8564:             "quote">Xaw3d-1.3</span>&#8221;.</p>
                   8565:           </div>
                   8566: 
                   8567:           <div class="sect2" lang="en" xml:lang="en">
                   8568:             <div class="titlepage">
                   8569:               <div>
                   8570:                 <div>
1.18    ! xtraeme  8571:                   <h3 class="title"><a name="id2594517" id=
        !          8572:                   "id2594517"></a>12.1.5.&nbsp;Packages that cannot
1.1       grant    8573:                   or should not be built</h3>
                   8574:                 </div>
                   8575:               </div>
                   8576:             </div>
                   8577: 
                   8578:             <p>There are several reasons why a package might be
                   8579:             instructed to not build under certain circumstances. If
                   8580:             the package builds and runs on most platforms, the
1.14      xtraeme  8581:             exceptions should be noted with <code class=
                   8582:             "varname">NOT_FOR_PLATFORM</code>. If the package
                   8583:             builds and runs on a small handful of platforms, set
                   8584:             <code class="varname">ONLY_FOR_PLATFORM</code> instead.
                   8585:             If the package should be skipped (for example, because
                   8586:             it provides functionality already provided by the
                   8587:             system), set <code class=
                   8588:             "varname">PKG_SKIP_REASON</code> to a descriptive
                   8589:             message. If the package should fail because some
                   8590:             preconditions are not met, set <code class=
                   8591:             "varname">PKG_FAIL_REASON</code> to a descriptive
1.1       grant    8592:             message.</p>
                   8593: 
1.14      xtraeme  8594:             <p><code class="varname">IGNORE</code> is deprecated
1.1       grant    8595:             because it didn't provide enough information to
                   8596:             determine whether the build should fail.</p>
                   8597:           </div>
                   8598: 
                   8599:           <div class="sect2" lang="en" xml:lang="en">
                   8600:             <div class="titlepage">
                   8601:               <div>
                   8602:                 <div>
1.18    ! xtraeme  8603:                   <h3 class="title"><a name="id2594542" id=
        !          8604:                   "id2594542"></a>12.1.6.&nbsp;Packages which
1.1       grant    8605:                   should not be deleted, once installed</h3>
                   8606:                 </div>
                   8607:               </div>
                   8608:             </div>
                   8609: 
                   8610:             <p>To ensure that a package may not be deleted, once it
1.14      xtraeme  8611:             has been installed, the <code class=
                   8612:             "varname">PKG_PRESERVE</code> definition should be set
                   8613:             in the package Makefile. This will be carried into any
1.1       grant    8614:             binary package that is made from this pkgsrc entry. A
                   8615:             &#8220;<span class="quote">preserved</span>&#8221;
                   8616:             package will not be deleted using <a href=
                   8617:             "http://netbsd.gw.com/cgi-bin/man-cgi?pkg_delete+1+NetBSD-current">
                   8618:             <span class="citerefentry"><span class=
                   8619:             "refentrytitle">pkg_delete</span>(1)</span></a> unless
                   8620:             the &#8220;<span class="quote">-f</span>&#8221; option
                   8621:             is used.</p>
                   8622:           </div>
                   8623: 
                   8624:           <div class="sect2" lang="en" xml:lang="en">
                   8625:             <div class="titlepage">
                   8626:               <div>
                   8627:                 <div>
                   8628:                   <h3 class="title"><a name="security-handling" id=
                   8629:                   "security-handling"></a>12.1.7.&nbsp;Handling
                   8630:                   packages with security problems</h3>
                   8631:                 </div>
                   8632:               </div>
                   8633:             </div>
                   8634: 
                   8635:             <p>When a vulnerability is found, this should be noted
1.14      xtraeme  8636:             in <code class=
                   8637:             "filename">localsrc/security/advisories/pkg-vulnerabilities</code>,
1.1       grant    8638:             and after the commit of that file, it should be copied
1.14      xtraeme  8639:             to both <code class=
                   8640:             "filename">/pub/NetBSD/packages/distfiles/pkg-vulnerabilities</code>
                   8641:             and <code class=
                   8642:             "filename">/pub/NetBSD/packages/distfiles/vulnerabilities</code>
                   8643:             on ftp.NetBSD.org using <code class=
                   8644:             "filename">localsrc/security/advisories/Makefile</code>.
                   8645:             In addition, if a <code class=
                   8646:             "filename">buildlink3.mk</code> file exists for an
                   8647:             affected package, bumping <code class=
                   8648:             "varname">PKGREVISION</code> and creating a
                   8649:             corresponding <code class=
                   8650:             "varname">BUILDLINK_RECOMMENDED.<em class=
                   8651:             "replaceable"><code>pkg</code></em></code> entry should
                   8652:             be considered. See <a href="#buildlink" title=
1.1       grant    8653:             "Chapter&nbsp;9.&nbsp;Buildlink methodology">Chapter&nbsp;9,
                   8654:             <i>Buildlink methodology</i></a> for more information
1.14      xtraeme  8655:             about writing <code class=
                   8656:             "filename">buildlink3.mk</code> files and <code class=
                   8657:             "varname">BUILDLINK_*</code> definitions.</p>
1.1       grant    8658: 
                   8659:             <p>Also, if the fix should be applied to the stable
                   8660:             pkgsrc branch, be sure to submit a pullup request!</p>
                   8661:           </div>
                   8662: 
                   8663:           <div class="sect2" lang="en" xml:lang="en">
                   8664:             <div class="titlepage">
                   8665:               <div>
                   8666:                 <div>
1.18    ! xtraeme  8667:                   <h3 class="title"><a name="id2594702" id=
        !          8668:                   "id2594702"></a>12.1.8.&nbsp;How to handle
1.1       grant    8669:                   compiler bugs</h3>
                   8670:                 </div>
                   8671:               </div>
                   8672:             </div>
                   8673: 
                   8674:             <p>Some source files trigger bugs in the compiler,
                   8675:             based on combinations of compiler version and
                   8676:             architecture and almost always relation to optimisation
                   8677:             being enabled. Common symptoms are gcc internal errors
                   8678:             or never finishing compiling a file.</p>
                   8679: 
                   8680:             <p>Typically a workaround involves testing the
1.14      xtraeme  8681:             <code class="varname">MACHINE_ARCH</code> and compiler
1.1       grant    8682:             version, disabling optimisation for that
1.14      xtraeme  8683:             file/<code class="varname">MACHINE_ARCH</code>/compiler
                   8684:             combination, and documenting it in <code class=
                   8685:             "filename">pkgsrc/doc/HACKS</code>. See that file for a
1.1       grant    8686:             number of examples!</p>
                   8687:           </div>
                   8688: 
                   8689:           <div class="sect2" lang="en" xml:lang="en">
                   8690:             <div class="titlepage">
                   8691:               <div>
                   8692:                 <div>
1.18    ! xtraeme  8693:                   <h3 class="title"><a name="id2594725" id=
        !          8694:                   "id2594725"></a>12.1.9.&nbsp;How to handle
1.1       grant    8695:                   incrementing versions when fixing an existing
                   8696:                   package</h3>
                   8697:                 </div>
                   8698:               </div>
                   8699:             </div>
                   8700: 
                   8701:             <p>When making fixes to an existing package it can be
1.14      xtraeme  8702:             useful to change the version number in <code class=
                   8703:             "varname">PKGNAME</code>. To avoid conflicting with
1.1       grant    8704:             future versions by the original author, a
                   8705:             &#8220;<span class="quote">nb1</span>&#8221;,
                   8706:             &#8220;<span class="quote">nb2</span>&#8221;, ...
                   8707:             suffix can be used on package versions by setting
1.14      xtraeme  8708:             <code class="varname">PKGREVISION=1</code> (2, ...).
                   8709:             The &#8220;<span class="quote">nb</span>&#8221; is
                   8710:             treated like a &#8220;<span class=
                   8711:             "quote">.</span>&#8221; by the pkg tools. e.g.</p>
1.1       grant    8712:             <pre class="programlisting">
                   8713:   DISTNAME= foo-17.42
                   8714:     PKGREVISION=  9
                   8715: </pre>
                   8716: 
1.14      xtraeme  8717:             <p>will result in a <code class=
                   8718:             "varname">PKGNAME</code> of &#8220;<span class=
1.1       grant    8719:             "quote">foo-17.42nb9</span>&#8221;.</p>
                   8720: 
                   8721:             <p>When a new release of the package is released, the
1.14      xtraeme  8722:             <code class="varname">PKGREVISION</code> should be
                   8723:             removed. e.g. on a new minor release of the above
                   8724:             package, things should be like:</p>
1.1       grant    8725:             <pre class="programlisting">
                   8726: DISTNAME=   foo-17.43
                   8727: </pre>
                   8728:           </div>
                   8729: 
                   8730:           <div class="sect2" lang="en" xml:lang="en">
                   8731:             <div class="titlepage">
                   8732:               <div>
                   8733:                 <div>
1.18    ! xtraeme  8734:                   <h3 class="title"><a name="id2594774" id=
        !          8735:                   "id2594774"></a>12.1.10.&nbsp;Portability of
1.1       grant    8736:                   packages</h3>
                   8737:                 </div>
                   8738:               </div>
                   8739:             </div>
                   8740: 
                   8741:             <p>One appealing feature of pkgsrc is that it runs on
                   8742:             many different platforms. As a result, it is important
                   8743:             to ensure, where possible, that packages in pkgsrc are
                   8744:             portable. There are some particular details you should
                   8745:             pay attention to while working on pkgsrc.</p>
                   8746: 
                   8747:             <div class="sect3" lang="en" xml:lang="en">
                   8748:               <div class="titlepage">
                   8749:                 <div>
                   8750:                   <div>
1.18    ! xtraeme  8751:                     <h4 class="title"><a name="id2594779" id=
        !          8752:                     "id2594779"></a>12.1.10.1.&nbsp;${INSTALL},
1.1       grant    8753:                     ${INSTALL_DATA_DIR}, ...</h4>
                   8754:                   </div>
                   8755:                 </div>
                   8756:               </div>
                   8757: 
1.14      xtraeme  8758:               <p>The BSD-compatible <span><strong class=
                   8759:               "command">install</strong></span> supplied with some
1.1       grant    8760:               operating systems will not perform more than one
                   8761:               operation at a time. As such, you should call
                   8762:               &#8220;<span class="quote">${INSTALL}</span>&#8221;,
                   8763:               etc. like this:</p>
                   8764:               <pre class="programlisting">
                   8765: ${INSTALL_DATA_DIR} ${PREFIX}/dir1
                   8766: ${INSTALL_DATA_DIR} ${PREFIX}/dir2
                   8767: </pre>
                   8768:             </div>
                   8769:           </div>
                   8770:         </div>
                   8771: 
                   8772:         <div class="sect1" lang="en" xml:lang="en">
                   8773:           <div class="titlepage">
                   8774:             <div>
                   8775:               <div>
                   8776:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  8777:                 "id2594798" id="id2594798"></a>12.2.&nbsp;Possible
1.1       grant    8778:                 downloading issues</h2>
                   8779:               </div>
                   8780:             </div>
                   8781:           </div>
                   8782: 
                   8783:           <div class="sect2" lang="en" xml:lang="en">
                   8784:             <div class="titlepage">
                   8785:               <div>
                   8786:                 <div>
1.18    ! xtraeme  8787:                   <h3 class="title"><a name="id2594802" id=
        !          8788:                   "id2594802"></a>12.2.1.&nbsp;Packages whose
1.1       grant    8789:                   distfiles aren't available for plain
                   8790:                   downloading</h3>
                   8791:                 </div>
                   8792:               </div>
                   8793:             </div>
                   8794: 
                   8795:             <p>If you need to download from a dynamic URL you can
1.14      xtraeme  8796:             set <code class="varname">DYNAMIC_MASTER_SITES</code>
                   8797:             and a <span><strong class="command">make
                   8798:             fetch</strong></span> will call <code class=
                   8799:             "filename">files/getsite.sh</code> with the name of
                   8800:             each file to download as an argument, expecting it to
                   8801:             output the URL of the directory from which to download
                   8802:             it. <a xmlns="http://www.w3.org/TR/xhtml1/transitional"
                   8803:             href=
1.1       grant    8804:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/ns-cult3d/README.html"
1.14      xtraeme  8805:             class="pkgname">graphics/ns-cult3d</a> is an example of
                   8806:             this usage.</p>
1.1       grant    8807: 
                   8808:             <p>If the download can't be automated, because the user
                   8809:             must submit personal information to apply for a
                   8810:             password, or must pay for the source, or whatever, you
1.14      xtraeme  8811:             can set <code class="varname">_FETCH_MESSAGE</code> to
                   8812:             a macro which displays a message explaining the
                   8813:             situation. <code class="varname">_FETCH_MESSAGE</code>
                   8814:             must be executable shell commands, not just a message.
                   8815:             (Generally, it executes <code class=
                   8816:             "varname">${ECHO}</code>). As of this writing, the
1.1       grant    8817:             following packages use this: <a xmlns=
                   8818:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8819:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/audio/realplayer/README.html"
1.14      xtraeme  8820:             class="pkgname">audio/realplayer</a>, <a xmlns=
                   8821:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8822:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/cad/simian/README.html"
                   8823:             class="pkgname">cad/simian</a>, <a xmlns=
                   8824:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8825:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/ipv6socket/README.html"
                   8826:             class="pkgname">devel/ipv6socket</a>, <a xmlns=
                   8827:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8828:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/emulators/vmware-module/README.html"
                   8829:             class="pkgname">emulators/vmware-module</a>, <a xmlns=
                   8830:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8831:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/fonts/acroread-jpnfont/README.html"
                   8832:             class="pkgname">fonts/acroread-jpnfont</a>, <a xmlns=
                   8833:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8834:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/sysutils/storage-manager/README.html"
                   8835:             class="pkgname">sysutils/storage-manager</a>, <a xmlns=
                   8836:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8837:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/ap-aolserver/README.html"
                   8838:             class="pkgname">www/ap-aolserver</a>, <a xmlns=
                   8839:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8840:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/www/openacs/README.html"
                   8841:             class="pkgname">www/openacs</a>. Try to be consistent
                   8842:             with them.</p>
1.1       grant    8843:           </div>
                   8844: 
                   8845:           <div class="sect2" lang="en" xml:lang="en">
                   8846:             <div class="titlepage">
                   8847:               <div>
                   8848:                 <div>
1.18    ! xtraeme  8849:                   <h3 class="title"><a name="id2594865" id=
        !          8850:                   "id2594865"></a>12.2.2.&nbsp;How to handle
1.1       grant    8851:                   modified distfiles with the 'old' name</h3>
                   8852:                 </div>
                   8853:               </div>
                   8854:             </div>
                   8855: 
                   8856:             <p>Sometimes authors of a software package make some
                   8857:             modifications after the software was released, and they
                   8858:             put up a new distfile without changing the package's
                   8859:             version number. If a package is already in pkgsrc at
                   8860:             that time, the md5 checksum will no longer match. The
                   8861:             correct way to work around this is to update the
                   8862:             package's md5 checksum to match the package on the
                   8863:             master site (beware, any mirrors may not be up to date
                   8864:             yet!), and to remove the old distfile from
1.14      xtraeme  8865:             ftp.NetBSD.org's <code class=
                   8866:             "filename">/pub/NetBSD/packages/distfiles</code>
1.1       grant    8867:             directory. Furthermore, a mail to the package's author
                   8868:             seems appropriate making sure the distfile was really
                   8869:             updated on purpose, and that no trojan horse or so
                   8870:             crept in.</p>
                   8871:           </div>
                   8872:         </div>
                   8873: 
                   8874:         <div class="sect1" lang="en" xml:lang="en">
                   8875:           <div class="titlepage">
                   8876:             <div>
                   8877:               <div>
                   8878:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  8879:                 "id2594876" id=
        !          8880:                 "id2594876"></a>12.3.&nbsp;Configuration
1.1       grant    8881:                 gotchas</h2>
                   8882:               </div>
                   8883:             </div>
                   8884:           </div>
                   8885: 
                   8886:           <div class="sect2" lang="en" xml:lang="en">
                   8887:             <div class="titlepage">
                   8888:               <div>
                   8889:                 <div>
                   8890:                   <h3 class="title"><a name="fixes.libtool" id=
                   8891:                   "fixes.libtool"></a>12.3.1.&nbsp;Shared libraries
                   8892:                   - libtool</h3>
                   8893:                 </div>
                   8894:               </div>
                   8895:             </div>
                   8896: 
                   8897:             <p>pkgsrc supports many different machines, with
                   8898:             different object formats like a.out and ELF, and
                   8899:             varying abilities to do shared library and dynamic
                   8900:             loading at all. To accompany this, varying commands and
                   8901:             options have to be passed to the compiler, linker, etc.
                   8902:             to get the Right Thing, which can be pretty annoying
                   8903:             especially if you don't have all the machines at your
                   8904:             hand to test things. The <a xmlns=
                   8905:             "http://www.w3.org/TR/xhtml1/transitional" href=
                   8906:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/libtool/README.html"
1.14      xtraeme  8907:             class="pkgname">devel/libtool</a> pkg can help here, as
                   8908:             it just &#8220;<span class="quote">knows</span>&#8221;
                   8909:             how to build both static and dynamic libraries from a
                   8910:             set of source files, thus being platform
                   8911:             independent.</p>
1.1       grant    8912: 
                   8913:             <p>Here's how to use libtool in a pkg in seven simple
                   8914:             steps:</p>
                   8915: 
                   8916:             <div class="orderedlist">
                   8917:               <ol type="1">
                   8918:                 <li>
1.14      xtraeme  8919:                   <p>Add <code class=
                   8920:                   "varname">USE_LIBTOOL=yes</code> to the package
                   8921:                   Makefile.</p>
1.1       grant    8922:                 </li>
                   8923: 
                   8924:                 <li>
                   8925:                   <p>For library objects, use &#8220;<span class=
                   8926:                   "quote">${LIBTOOL} --mode=compile
                   8927:                   ${CC}</span>&#8221; in place of
                   8928:                   &#8220;<span class="quote">${CC}</span>&#8221;.
                   8929:                   You could even add it to the definition of
1.14      xtraeme  8930:                   <code class="varname">CC</code>, if only
                   8931:                   libraries are being built in a given Makefile.
                   8932:                   This one command will build both PIC and non-PIC
                   8933:                   library objects, so you need not have separate
                   8934:                   shared and non-shared library rules.</p>
1.1       grant    8935:                 </li>
                   8936: 
                   8937:                 <li>
                   8938:                   <p>For the linking of the library, remove any
                   8939:                   &#8220;<span class="quote">ar</span>&#8221;,
                   8940:                   &#8220;<span class="quote">ranlib</span>&#8221;,
                   8941:                   and &#8220;<span class="quote">ld
                   8942:                   -Bshareable</span>&#8221; commands, and instead
                   8943:                   use:</p>
                   8944:                   <pre class="programlisting">
                   8945: ${LIBTOOL} --mode=link ${CC} -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
                   8946: </pre>
                   8947: 
                   8948:                   <p>Note that the library is changed to have a
1.14      xtraeme  8949:                   <code class="filename">.la</code> extension, and
                   8950:                   the objects are changed to have a <code class=
                   8951:                   "filename">.lo</code> extension. Change
                   8952:                   <code class="varname">OBJS</code> as necessary.
                   8953:                   This automatically creates all of the
                   8954:                   <code class="filename">.a</code>, <code class=
                   8955:                   "filename">.so.major.minor</code>, and ELF
                   8956:                   symlinks (if necessary) in the build directory.
                   8957:                   Be sure to include &#8220;<span class=
1.1       grant    8958:                   "quote">-version-info</span>&#8221;, especially
                   8959:                   when major and minor are zero, as libtool will
                   8960:                   otherwise strip off the shared library
                   8961:                   version.</p>
                   8962: 
                   8963:                   <p>From the libtool manual:</p>
                   8964:                   <pre class="programlisting">
                   8965:      So, libtool library versions are described by three integers:
                   8966: 
                   8967: CURRENT
                   8968:        The most recent interface number that this library implements.
                   8969: 
                   8970: REVISION
                   8971:        The implementation number of the CURRENT interface.
                   8972: 
                   8973: AGE
                   8974:        The difference between the newest and oldest interfaces that this
                   8975:        library implements.  In other words, the library implements all the
                   8976:        interface numbers in the range from number `CURRENT - AGE' to
                   8977:        `CURRENT'.
                   8978:        
                   8979:      If two libraries have identical CURRENT and AGE numbers, then the
                   8980: dynamic linker chooses the library with the greater REVISION number. 
                   8981: </pre>
                   8982: 
                   8983:                   <p>The &#8220;<span class=
                   8984:                   "quote">-release</span>&#8221; option will
                   8985:                   produce different results for a.out and ELF
                   8986:                   (excluding symlinks) in only one case. An ELF
                   8987:                   library of the form &#8220;<span class=
                   8988:                   "quote">libfoo-release.so.<span class=
                   8989:                   "emphasis"><em>x</em></span>.<span class=
                   8990:                   "emphasis"><em>y</em></span></span>&#8221; will
                   8991:                   have a symlink of &#8220;<span class=
                   8992:                   "quote">libfoo.so.<span class=
                   8993:                   "emphasis"><em>x</em></span>.<span class=
                   8994:                   "emphasis"><em>y</em></span></span>&#8221; on an
                   8995:                   a.out platform. This is handled
                   8996:                   automatically.</p>
                   8997: 
                   8998:                   <p>The &#8220;<span class="quote">-rpath
                   8999:                   argument</span>&#8221; is the install directory
                   9000:                   of the library being built.</p>
                   9001: 
1.14      xtraeme  9002:                   <p>In the <code class="filename">PLIST</code>,
                   9003:                   include all of the <code class=
                   9004:                   "filename">.a</code>, <code class=
                   9005:                   "filename">.la</code>, and <code class=
                   9006:                   "filename">.so</code>, <code class=
                   9007:                   "filename">.so.<em class=
                   9008:                   "replaceable"><code>major</code></em></code> and
                   9009:                   <code class="filename">.so.<em class=
                   9010:                   "replaceable"><code>major</code></em>.<em class=
                   9011:                   "replaceable"><code>minor</code></em></code>
                   9012:                   files.</p>
1.1       grant    9013:                 </li>
                   9014: 
                   9015:                 <li>
1.14      xtraeme  9016:                   <p>When linking shared object (<code class=
                   9017:                   "filename">.so</code>) files, i.e. files that are
1.1       grant    9018:                   loaded via dlopen(3), NOT shared libraries, use
                   9019:                   &#8220;<span class="quote">-module
                   9020:                   -avoid-version</span>&#8221; to prevent them
                   9021:                   getting version tacked on.</p>
                   9022: 
1.14      xtraeme  9023:                   <p>The <code class="filename">PLIST</code> file
                   9024:                   gets the <code class="filename">foo.so</code>
                   9025:                   entry.</p>
1.1       grant    9026:                 </li>
                   9027: 
                   9028:                 <li>
                   9029:                   <p>When linking programs that depend on these
                   9030:                   libraries <span class=
                   9031:                   "emphasis"><em>before</em></span> they are
                   9032:                   installed, preface the <a href=
                   9033:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cc+1+NetBSD-current">
                   9034:                   <span class="citerefentry"><span class=
                   9035:                   "refentrytitle">cc</span>(1)</span></a> or
                   9036:                   <a href=
                   9037:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ld+1+NetBSD-current">
                   9038:                   <span class="citerefentry"><span class=
                   9039:                   "refentrytitle">ld</span>(1)</span></a> line with
                   9040:                   &#8220;<span class="quote">${LIBTOOL}
                   9041:                   --mode=link</span>&#8221;, and it will find the
                   9042:                   correct libraries (static or shared), but please
                   9043:                   be aware that libtool will not allow you to
                   9044:                   specify a relative path in -L (such as
                   9045:                   &#8220;<span class=
                   9046:                   "quote">-L../somelib</span>&#8221;), because it
                   9047:                   expects you to change that argument to be the
1.14      xtraeme  9048:                   <code class="filename">.la</code> file. e.g.</p>
1.1       grant    9049:                   <pre class="programlisting">
                   9050: ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
                   9051: </pre>
                   9052: 
                   9053:                   <p>should be changed to:</p>
                   9054:                   <pre class="programlisting">
1.14      xtraeme  9055: ${LIBTOOL} --mode=link ${CC} -o <em class=
                   9056: "replaceable"><code>someprog</code></em> <em class=
                   9057: "replaceable"><code>../somelib/somelib.la</code></em>
1.1       grant    9058: </pre>
                   9059: 
                   9060:                   <p>and it will do the right thing with the
                   9061:                   libraries.</p>
                   9062:                 </li>
                   9063: 
                   9064:                 <li>
                   9065:                   <p>When installing libraries, preface the
                   9066:                   <a href="http://netbsd.gw.com/cgi-bin/man-cgi?install+1+NetBSD-current">
                   9067:                   <span class="citerefentry"><span class=
                   9068:                   "refentrytitle">install</span>(1)</span></a> or
                   9069:                   <a href=
                   9070:                   "http://netbsd.gw.com/cgi-bin/man-cgi?cp+1+NetBSD-current">
                   9071:                   <span class="citerefentry"><span class=
                   9072:                   "refentrytitle">cp</span>(1)</span></a> command
                   9073:                   with &#8220;<span class="quote">${LIBTOOL}
                   9074:                   --mode=install</span>&#8221;, and change the
1.14      xtraeme  9075:                   library name to <code class=
                   9076:                   "filename">.la</code>. e.g.</p>
1.1       grant    9077:                   <pre class="programlisting">
                   9078: ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
                   9079: </pre>
                   9080: 
1.14      xtraeme  9081:                   <p>This will install the static <code class=
                   9082:                   "filename">.a</code>, shared library, any needed
1.1       grant    9083:                   symlinks, and run <a href=
                   9084:                   "http://netbsd.gw.com/cgi-bin/man-cgi?ldconfig+8+NetBSD-current">
                   9085:                   <span class="citerefentry"><span class=
                   9086:                   "refentrytitle">ldconfig</span>(8)</span></a>.</p>
                   9087:                 </li>
                   9088: 
                   9089:                 <li>
1.14      xtraeme  9090:                   <p>In your <code class="filename">PLIST</code>,
                   9091:                   include all of the <code class=
                   9092:                   "filename">.a</code>, <code class=
                   9093:                   "filename">.la</code>, and <code class=
                   9094:                   "filename">.so</code>, <code class=
                   9095:                   "filename">.so.CURRENT</code> and <code class=
                   9096:                   "filename">.so.CURRENT.REVISION</code> files
                   9097:                   (this is a change from the previous
                   9098:                   behaviour).</p>
1.1       grant    9099:                 </li>
                   9100:               </ol>
                   9101:             </div>
                   9102:           </div>
                   9103: 
                   9104:           <div class="sect2" lang="en" xml:lang="en">
                   9105:             <div class="titlepage">
                   9106:               <div>
                   9107:                 <div>
1.18    ! xtraeme  9108:                   <h3 class="title"><a name="id2595352" id=
        !          9109:                   "id2595352"></a>12.3.2.&nbsp;Using libtool on GNU
1.1       grant    9110:                   packages that already support libtool</h3>
                   9111:                 </div>
                   9112:               </div>
                   9113:             </div>
                   9114: 
1.14      xtraeme  9115:             <p>Add <code class="varname">USE_LIBTOOL=yes</code> to
                   9116:             the package Makefile. This will override the package's
                   9117:             own libtool in most cases. For older libtool using
1.1       grant    9118:             packages, libtool is made by ltconfig script during the
                   9119:             do-configure step; you can check the libtool script
1.14      xtraeme  9120:             location by doing <span><strong class="command">make
                   9121:             configure; find work*/ -name
                   9122:             libtool</strong></span>.</p>
                   9123: 
                   9124:             <p><code class="varname">LIBTOOL_OVERRIDE</code>
                   9125:             specifies which libtool scripts, relative to
                   9126:             <code class="varname">WRKSRC</code>, to override. By
                   9127:             default, it is set to &#8220;<span class=
                   9128:             "quote">libtool */libtool */*/libtool</span>&#8221;. If
                   9129:             this does not match the location of the package's
                   9130:             libtool script(s), set it as appropriate.</p>
1.13      hubertf  9131: 
1.14      xtraeme  9132:             <p>If you do not need <code class="filename">*.a</code>
1.1       grant    9133:             static libraries built and installed, then use
1.14      xtraeme  9134:             <code class="varname">SHLIBTOOL_OVERRIDE</code>
1.1       grant    9135:             instead.</p>
                   9136: 
                   9137:             <p>If your package makes use of the platform
                   9138:             independent library for loading dynamic shared objects,
                   9139:             that comes with libtool (libltdl), you should include
1.14      xtraeme  9140:             the libtool buildlink3.mk (and set <code class=
                   9141:             "varname">USE_BUILDLINK3=YES</code>).</p>
1.1       grant    9142: 
                   9143:             <p>Some packages use libtool incorrectly so that the
                   9144:             package may not work or build in some circumstances.
                   9145:             Some of the more common errors are:</p>
                   9146: 
                   9147:             <div class="itemizedlist">
                   9148:               <ul type="disc">
                   9149:                 <li>
                   9150:                   <p>The inclusion of a shared object (-module) as
                   9151:                   a dependent library in an executable or library.
                   9152:                   This in itself isn't a problem if one of two
                   9153:                   things has been done:</p>
                   9154: 
                   9155:                   <div class="orderedlist">
                   9156:                     <ol type="1">
                   9157:                       <li>
                   9158:                         <p>The shared object is named correctly,
1.14      xtraeme  9159:                         i.e. <code class=
                   9160:                         "filename">libfoo.la</code>, not
                   9161:                         <code class="filename">foo.la</code></p>
1.1       grant    9162:                       </li>
                   9163: 
                   9164:                       <li>
                   9165:                         <p>The -dlopen option is used when linking
                   9166:                         an executable.</p>
                   9167:                       </li>
                   9168:                     </ol>
                   9169:                   </div>
                   9170:                 </li>
                   9171: 
                   9172:                 <li>
                   9173:                   <p>The use of libltdl without the correct calls
                   9174:                   to initialisation routines. The function
                   9175:                   lt_dlinit() should be called and the macro
1.14      xtraeme  9176:                   <code class=
                   9177:                   "varname">LTDL_SET_PRELOADED_SYMBOLS</code>
1.1       grant    9178:                   included in executables.</p>
                   9179:                 </li>
                   9180:               </ul>
                   9181:             </div>
                   9182:           </div>
                   9183: 
                   9184:           <div class="sect2" lang="en" xml:lang="en">
                   9185:             <div class="titlepage">
                   9186:               <div>
                   9187:                 <div>
1.18    ! xtraeme  9188:                   <h3 class="title"><a name="id2595436" id=
        !          9189:                   "id2595436"></a>12.3.3.&nbsp;GNU
1.1       grant    9190:                   Autoconf/Automake</h3>
                   9191:                 </div>
                   9192:               </div>
                   9193:             </div>
                   9194: 
                   9195:             <p>If a package needs GNU autoconf or automake to be
                   9196:             executed to regenerate the configure script and
                   9197:             Makefile.in makefile templates, then they should be
                   9198:             executed in a pre-configure target. Two Makefile
1.14      xtraeme  9199:             fragments are provided in <code class=
                   9200:             "filename">pkgsrc/mk/autoconf.mk</code> and
                   9201:             <code class="filename">pkgsrc/mk/automake.mk</code> to
                   9202:             help dealing with these tools. See comments in these
                   9203:             files for details.</p>
1.1       grant    9204: 
                   9205:             <p>For packages that need only autoconf:</p>
                   9206:             <pre class="programlisting">
                   9207: AUTOCONF_REQD=    2.50    # if default version is not good enough
                   9208: ...
                   9209: 
                   9210: pre-configure:
                   9211:           cd ${WRKSRC}; ${AUTOCONF}
                   9212: 
                   9213: ...
                   9214: .include "../../mk/autoconf.mk"
                   9215: </pre>
                   9216: 
                   9217:             <p>and for packages that need automake and
                   9218:             autoconf:</p>
                   9219:             <pre class="programlisting">
                   9220: AUTOMAKE_REQD=  1.7.1   # if default version is not good enough
                   9221: ...
                   9222: 
                   9223: pre-configure:
                   9224:           cd ${WRKSRC};                                           \
                   9225:           ${ACLOCAL};                                             \
                   9226:           ${AUTOHEADER};                                          \
                   9227:           ${AUTOMAKE} -a --foreign -i;                            \
                   9228:           ${AUTOCONF}
                   9229: 
                   9230: ...
                   9231: .include "../mk/automake.mk"
                   9232: </pre>
                   9233: 
                   9234:             <p>Packages which use GNU Automake will almost
                   9235:             certainly require GNU Make, but that's automatically
1.14      xtraeme  9236:             provided for you in <code class=
                   9237:             "filename">mk/automake.mk</code>.</p>
1.1       grant    9238: 
                   9239:             <p>There are times when the configure process makes
                   9240:             additional changes to the generated files, which then
                   9241:             causes the build process to try to re-execute the
                   9242:             automake sequence. This is prevented by touching
                   9243:             various files in the configure stage. If this causes
1.14      xtraeme  9244:             problems with your package you can set <code class=
                   9245:             "varname">AUTOMAKE_OVERRIDE=NO</code> in the package
1.1       grant    9246:             Makefile.</p>
                   9247:           </div>
                   9248:         </div>
                   9249: 
                   9250:         <div class="sect1" lang="en" xml:lang="en">
                   9251:           <div class="titlepage">
                   9252:             <div>
                   9253:               <div>
                   9254:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  9255:                 "id2595481" id="id2595481"></a>12.4.&nbsp;Building
1.1       grant    9256:                 considerations</h2>
                   9257:               </div>
                   9258:             </div>
                   9259:           </div>
                   9260: 
                   9261:           <div class="sect2" lang="en" xml:lang="en">
                   9262:             <div class="titlepage">
                   9263:               <div>
                   9264:                 <div>
1.18    ! xtraeme  9265:                   <h3 class="title"><a name="id2595484" id=
        !          9266:                   "id2595484"></a>12.4.1.&nbsp;CPP defines</h3>
1.1       grant    9267:                 </div>
                   9268:               </div>
                   9269:             </div>
                   9270: 
                   9271:             <p>To port an application to NetBSD, it's usually
                   9272:             necessary for the compiler to be able to judge the
                   9273:             system on which it's compiling, and we use definitions
                   9274:             so that the C pre-processor can do this.</p>
                   9275: 
                   9276:             <p>To test whether you are working on a 4.4 BSD-derived
                   9277:             system, you should use the BSD definition, which is
1.14      xtraeme  9278:             defined in <code class=
                   9279:             "filename">&lt;sys/param.h&gt;</code> on said
1.1       grant    9280:             systems.</p>
                   9281:             <pre class="programlisting">
                   9282: #include &lt;sys/param.h&gt;
                   9283: </pre>
                   9284: 
                   9285:             <p>and then you can surround the BSD-specific parts of
                   9286:             your package's C/C++ code using this conditional:</p>
                   9287:             <pre class="programlisting">
                   9288: #if (defined(BSD) &amp;&amp; BSD &gt;= 199306)
                   9289:     ...
                   9290: #endif
                   9291: </pre>
                   9292: 
                   9293:             <p>Please use the &#8220;<span class=
                   9294:             "quote">__NetBSD__</span>&#8221; definition sparingly -
                   9295:             it should only apply to features of NetBSD that are not
                   9296:             present in other 4.4-lite derived BSDs.</p>
                   9297:           </div>
                   9298:         </div>
                   9299: 
                   9300:         <div class="sect1" lang="en" xml:lang="en">
                   9301:           <div class="titlepage">
                   9302:             <div>
                   9303:               <div>
                   9304:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  9305:                 "id2595651" id="id2595651"></a>12.5.&nbsp;Package
1.1       grant    9306:                 specific actions</h2>
                   9307:               </div>
                   9308:             </div>
                   9309:           </div>
                   9310: 
                   9311:           <div class="sect2" lang="en" xml:lang="en">
                   9312:             <div class="titlepage">
                   9313:               <div>
                   9314:                 <div>
1.18    ! xtraeme  9315:                   <h3 class="title"><a name="id2595654" id=
        !          9316:                   "id2595654"></a>12.5.1.&nbsp;Package
1.1       grant    9317:                   configuration files</h3>
                   9318:                 </div>
                   9319:               </div>
                   9320:             </div>
                   9321: 
                   9322:             <p>Packages should be taught to look for their
1.14      xtraeme  9323:             configuration files in <code class=
                   9324:             "varname">${PKG_SYSCONFDIR}</code>, which is passed
1.1       grant    9325:             through to the configure and build processes.
1.14      xtraeme  9326:             <code class="varname">PKG_SYSCONFDIR</code> may be
1.1       grant    9327:             customized in various ways by setting other make
                   9328:             variables:</p>
                   9329: 
                   9330:             <div class="itemizedlist">
                   9331:               <ul type="disc">
                   9332:                 <li>
1.14      xtraeme  9333:                   <p><code class="varname">PKG_SYSCONFBASE</code>
                   9334:                   is the main config directory under which all
                   9335:                   package configuration files are to be found. This
                   9336:                   defaults to <code class=
                   9337:                   "filename">${PREFIX}/etc</code>, but may be
                   9338:                   overridden in <code class=
                   9339:                   "filename">/etc/mk.conf</code>.</p>
1.1       grant    9340:                 </li>
                   9341: 
                   9342:                 <li>
1.14      xtraeme  9343:                   <p><code class="varname">PKG_SYSCONFSUBDIR</code>
                   9344:                   is the subdirectory of <code class=
                   9345:                   "varname">PKG_SYSCONFBASE</code> under which the
1.1       grant    9346:                   configuration files for a particular package may
                   9347:                   be found, e.g. the Apache configuration files may
1.14      xtraeme  9348:                   all be found under the <code class=
                   9349:                   "filename">httpd/</code> subdirectory of
                   9350:                   <code class="varname">${PKG_SYSCONFBASE}</code>.
                   9351:                   This should be set in the package Makefile.</p>
1.1       grant    9352:                 </li>
                   9353: 
                   9354:                 <li>
1.14      xtraeme  9355:                   <p>By default, <code class=
                   9356:                   "varname">PKG_SYSCONFDIR</code> is set to
                   9357:                   <code class=
                   9358:                   "varname">${PKG_SYSCONFBASE}/${PKG_SYSCONFSUBDIR}</code>,
                   9359:                   but this may be overridden by setting
                   9360:                   <code class="varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>
                   9361:                   for a particular package, where <code class=
                   9362:                   "varname">PKG_SYSCONFVAR</code> defaults to
                   9363:                   <code class="varname">${PKGBASE}</code>. This is
                   9364:                   not meant to be set by a package Makefile, but is
1.1       grant    9365:                   reserved for users who wish to override the
1.14      xtraeme  9366:                   <code class="varname">PKG_SYSCONFDIR</code>
                   9367:                   setting for a particular package with a special
1.1       grant    9368:                   location.</p>
                   9369:                 </li>
                   9370:               </ul>
                   9371:             </div>
                   9372: 
                   9373:             <p>The only variables that users should customize are
1.14      xtraeme  9374:             <code class="varname">PKG_SYSCONFBASE</code> and
                   9375:             <code class=
                   9376:             "varname">PKG_SYSCONFDIR.${PKG_SYSCONFVAR}</code>.
                   9377:             Users will typically want to set <code class=
                   9378:             "varname">PKG_SYSCONFBASE</code> to <code class=
                   9379:             "filename">/etc</code>, or to accept the default
                   9380:             location of <code class=
                   9381:             "filename">${PREFIX}/etc</code>.</p>
1.1       grant    9382:           </div>
                   9383: 
                   9384:           <div class="sect2" lang="en" xml:lang="en">
                   9385:             <div class="titlepage">
                   9386:               <div>
                   9387:                 <div>
1.18    ! xtraeme  9388:                   <h3 class="title"><a name="id2595825" id=
        !          9389:                   "id2595825"></a>12.5.2.&nbsp;User
1.2       hubertf  9390:                   interaction</h3>
1.1       grant    9391:                 </div>
                   9392:               </div>
                   9393:             </div>
                   9394: 
                   9395:             <p>Occasionally, packages require interaction from the
                   9396:             user, and this can be in a number of ways:</p>
                   9397: 
                   9398:             <div class="itemizedlist">
                   9399:               <ul type="disc">
                   9400:                 <li>
                   9401:                   <p>help in fetching the distfiles</p>
                   9402:                 </li>
                   9403: 
                   9404:                 <li>
                   9405:                   <p>help to configure the package before it is
                   9406:                   built</p>
                   9407:                 </li>
                   9408: 
                   9409:                 <li>
                   9410:                   <p>help during the build process</p>
                   9411:                 </li>
                   9412: 
                   9413:                 <li>
                   9414:                   <p>help during the installation of a package</p>
                   9415:                 </li>
                   9416:               </ul>
                   9417:             </div>
                   9418: 
1.14      xtraeme  9419:             <p>The <code class="varname">INTERACTIVE_STAGE</code>
1.1       grant    9420:             definition is provided to notify the pkgsrc mechanism
                   9421:             of an interactive stage which will be needed, and this
1.14      xtraeme  9422:             should be set in the package's <code class=
                   9423:             "filename">Makefile</code>. e.g.</p>
1.1       grant    9424:             <pre class="programlisting">
                   9425: INTERACTIVE_STAGE= build
                   9426: </pre>
                   9427: 
                   9428:             <p>Multiple interactive stages can be specified:</p>
                   9429:             <pre class="programlisting">
                   9430: INTERACTIVE_STAGE= configure install
                   9431: </pre>
                   9432:           </div>
                   9433: 
                   9434:           <div class="sect2" lang="en" xml:lang="en">
                   9435:             <div class="titlepage">
                   9436:               <div>
                   9437:                 <div>
1.18    ! xtraeme  9438:                   <h3 class="title"><a name="id2595869" id=
        !          9439:                   "id2595869"></a>12.5.3.&nbsp;Handling
1.1       grant    9440:                   licenses</h3>
                   9441:                 </div>
                   9442:               </div>
                   9443:             </div>
                   9444: 
                   9445:             <p>A package may underly a license which the user has
                   9446:             or has not agreed to accept. Usually, packages that
                   9447:             underly well-known Open Source licenses (e.g. the GNU
                   9448:             Public License, GPL) won't have any special license
                   9449:             tags added in pkgsrc which require special action by
                   9450:             the user of such packages, but there are quite a number
                   9451:             of other licenses out there that pkgsrc users may not
                   9452:             be able to follow, for whatever reasons. For these
                   9453:             cases, pkgsrc contains a mechanism to note that a
                   9454:             package underlies a certain license, and the user has
                   9455:             to accept the license before the package can be
                   9456:             installed.</p>
                   9457: 
                   9458:             <p>Placing a certain package under a certain license
1.14      xtraeme  9459:             works by setting the <code class=
                   9460:             "varname">LICENSE</code> variable to a string
                   9461:             identifying the license, e.g. in <a xmlns=
                   9462:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9463:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/graphics/graphviz/README.html"
1.14      xtraeme  9464:             class="pkgname">graphics/graphviz</a>:</p>
1.1       grant    9465:             <pre class="programlisting">
                   9466: LICENSE=        graphviz-license
                   9467: </pre>
                   9468: 
                   9469:             <p>When trying to build, the user will get a notice
                   9470:             that the package underlies a license which he hasn't
                   9471:             accepted (yet):</p>
                   9472:             <pre class="programlisting">
1.14      xtraeme  9473: <code class="prompt">%</code> <strong class=
                   9474: "userinput"><code>make</code></strong>
1.1       grant    9475: ===&gt; graphviz-1.12 has an unacceptable license: graphviz-license.
                   9476: ===&gt;     To build this package, add this line to your /etc/mk.conf:
                   9477: ===&gt;     ACCEPTABLE_LICENSES+=graphviz-license
                   9478: ===&gt;     To view the license, enter "/usr/bin/make show-license".
                   9479: *** Error code 1
                   9480: </pre>
                   9481: 
1.14      xtraeme  9482:             <p>The license can be viewed with <span><strong class=
                   9483:             "command">make show-license</strong></span>, and if it
                   9484:             is considered appropriate, the line printed above can
                   9485:             be added to <code class="filename">/etc/mk.conf</code>
                   9486:             to indicate acceptance of the particular license:</p>
1.1       grant    9487:             <pre class="programlisting">
                   9488: ACCEPTABLE_LICENSES+=graphviz-license
                   9489: </pre>
                   9490: 
                   9491:             <p>When adding a package with a new license, the
1.14      xtraeme  9492:             license text should be added to <code class=
                   9493:             "filename">pkgsrc/licenses</code> for displaying. A
                   9494:             list of known licenses can be seen in this directory as
                   9495:             well as by looking at the list of (commented out)
                   9496:             <code class="varname">ACCEPTABLE_LICENSES</code>
                   9497:             variable settings in <code class=
                   9498:             "filename">pkgsrc/mk/defaults/mk.conf</code>.</p>
1.1       grant    9499: 
1.17      sketch   9500:             <p>If there is a <span class=
1.1       grant    9501:             "emphasis"><em>really</em></span> pressing need to
                   9502:             accept all licenses at once, like when trying to
                   9503:             download or mirror all distfiles or doing a bulk build
                   9504:             to test if all packages in pkgsrc build, this can be
1.14      xtraeme  9505:             done by setting <code class=
                   9506:             "varname">_ACCEPTABLE=yes</code>.</p>
1.1       grant    9507:           </div>
                   9508: 
                   9509:           <div class="sect2" lang="en" xml:lang="en">
                   9510:             <div class="titlepage">
                   9511:               <div>
                   9512:                 <div>
1.18    ! xtraeme  9513:                   <h3 class="title"><a name="id2596089" id=
        !          9514:                   "id2596089"></a>12.5.4.&nbsp;Creating an account
1.1       grant    9515:                   from a package</h3>
                   9516:                 </div>
                   9517:               </div>
                   9518:             </div>
                   9519: 
                   9520:             <p>There are two make variables used to control the
                   9521:             creation of package-specific groups and users at
1.14      xtraeme  9522:             pre-install time. The first is <code class=
                   9523:             "varname">PKG_GROUPS</code>, which is a list of
1.1       grant    9524:             group[:groupid] elements, where the groupid is
1.14      xtraeme  9525:             optional. The second is <code class=
                   9526:             "varname">PKG_USERS</code>, which is a list of elements
1.1       grant    9527:             of the form:</p>
                   9528:             <pre class="programlisting">
                   9529: user:group[:[userid][:[description][:[home][:shell]]]]
                   9530: </pre>
                   9531: 
                   9532:             <p>where only the user and group are required, the rest
                   9533:             being optional. A simple example is:</p>
                   9534:             <pre class="programlisting">
                   9535:   PKG_GROUPS=       foogroup
                   9536:     PKG_USERS=    foouser:foogroup
                   9537: </pre>
                   9538: 
                   9539:             <p>A more complex example is that creates two groups
                   9540:             and two users is:</p>
                   9541:             <pre class="programlisting">
                   9542:   PKG_GROUPS=       group1 group2:1005
                   9543:     PKG_USERS=    first:group1::First\\ User                      \
                   9544:                   second:group2::Second\\ User:/home/second:${SH}
                   9545: </pre>
                   9546: 
                   9547:             <p>By default, a new user will have home directory
1.14      xtraeme  9548:             <code class="filename">/nonexistent</code>, and login
                   9549:             shell <code class="filename">/sbin/nologin</code>
                   9550:             unless they are specified as part of the user
                   9551:             element.</p>
1.1       grant    9552: 
1.14      xtraeme  9553:             <p>The package <code class="filename">Makefile</code>
                   9554:             must also set <code class=
                   9555:             "varname">USE_PKGINSTALL=YES</code>. This will cause
                   9556:             the users and groups to be created at pre-install time,
                   9557:             and the admin will be prompted to remove them at
                   9558:             post-deinstall time. Automatic creation of the users
                   9559:             and groups can be toggled on and off by setting the
                   9560:             <code class="varname">PKG_CREATE_USERGROUP</code>
                   9561:             variable prior to package installation.</p>
1.1       grant    9562:           </div>
                   9563: 
                   9564:           <div class="sect2" lang="en" xml:lang="en">
                   9565:             <div class="titlepage">
                   9566:               <div>
                   9567:                 <div>
1.18    ! xtraeme  9568:                   <h3 class="title"><a name="id2596151" id=
        !          9569:                   "id2596151"></a>12.5.5.&nbsp;Installing score
1.1       grant    9570:                   files</h3>
                   9571:                 </div>
                   9572:               </div>
                   9573:             </div>
                   9574: 
                   9575:             <p>Certain packages, most of them in the games
                   9576:             category, install a score file that allows all users on
                   9577:             the system to record their highscores. In order for
                   9578:             this to work, the binaries need to be installed setgid
                   9579:             and the score files owned by the appropriate group
                   9580:             and/or owner (traditionally the "games" user/group).
                   9581:             The following variables, documented in more detail in
1.14      xtraeme  9582:             <code class="filename">mk/defaults/mk.conf</code>,
                   9583:             control this behaviour: <code class=
                   9584:             "varname">SETGIDGAME</code>, <code class=
                   9585:             "varname">GAMEDATAMODE</code>, <code class=
                   9586:             "varname">GAMEGRP</code>, <code class=
                   9587:             "varname">GAMEMODE</code>, <code class=
                   9588:             "varname">GAMEOWN</code>.</p>
1.1       grant    9589: 
                   9590:             <p>Note that per default, setgid installation of games
1.14      xtraeme  9591:             is disabled; setting <code class=
                   9592:             "varname">SETGIDGAME=YES</code> will set all the other
1.1       grant    9593:             variables accordingly.</p>
                   9594: 
                   9595:             <p>A package should therefor never hard code file
1.14      xtraeme  9596:             ownership or access permissions but rely on
                   9597:             <code class="varname">INSTALL_GAME</code> and
                   9598:             <code class="varname">INSTALL_GAME_DATA</code> to set
                   9599:             these correctly.</p>
1.1       grant    9600:           </div>
                   9601: 
                   9602:           <div class="sect2" lang="en" xml:lang="en">
                   9603:             <div class="titlepage">
                   9604:               <div>
                   9605:                 <div>
1.18    ! xtraeme  9606:                   <h3 class="title"><a name="id2596195" id=
        !          9607:                   "id2596195"></a>12.5.6.&nbsp;Packages providing
1.1       grant    9608:                   login shells</h3>
                   9609:                 </div>
                   9610:               </div>
                   9611:             </div>
                   9612: 
                   9613:             <p>If the purpose of the package is to provide a login
1.14      xtraeme  9614:             shell, the variable <code class=
                   9615:             "varname">PKG_SHELL</code> should contain the full
                   9616:             pathname of the shell executable installed by this
                   9617:             package. The package <code class=
                   9618:             "filename">Makefile</code> must also set <code class=
                   9619:             "varname">USE_PKGINSTALL=YES</code> to use the
                   9620:             automatically generated <code class=
                   9621:             "filename">INSTALL</code>/<code class=
                   9622:             "filename">DEINSTALL</code> scripts.</p>
1.1       grant    9623: 
                   9624:             <p>An example taken from shells/zsh:</p>
                   9625:             <pre class="programlisting">
                   9626:   USE_PKGINSTALL=   YES
                   9627:     PKG_SHELL=    ${PREFIX}/bin/zsh
                   9628: </pre>
                   9629: 
1.14      xtraeme  9630:             <p>The shell is registered into <code class=
                   9631:             "filename">/etc/shells</code> file automatically in the
                   9632:             post-install target by the generated <code class=
                   9633:             "filename">INSTALL</code> script and removed in the
                   9634:             deinstall target by the <code class=
                   9635:             "filename">DEINSTALL</code> script.</p>
1.1       grant    9636:           </div>
                   9637: 
                   9638:           <div class="sect2" lang="en" xml:lang="en">
                   9639:             <div class="titlepage">
                   9640:               <div>
                   9641:                 <div>
1.18    ! xtraeme  9642:                   <h3 class="title"><a name="id2596252" id=
        !          9643:                   "id2596252"></a>12.5.7.&nbsp;Packages containing
1.1       grant    9644:                   perl scripts</h3>
                   9645:                 </div>
                   9646:               </div>
                   9647:             </div>
                   9648: 
                   9649:             <p>If your package contains interpreted perl scripts,
1.14      xtraeme  9650:             set <code class="varname">REPLACE_PERL</code> to ensure
                   9651:             that the proper interpreter path is set. <code class=
                   9652:             "varname">REPLACE_PERL</code> should contain a list of
                   9653:             scripts, relative to <code class=
                   9654:             "varname">WRKSRC</code>, that you want adjusted.</p>
1.1       grant    9655:           </div>
                   9656: 
                   9657:           <div class="sect2" lang="en" xml:lang="en">
                   9658:             <div class="titlepage">
                   9659:               <div>
                   9660:                 <div>
1.18    ! xtraeme  9661:                   <h3 class="title"><a name="id2596270" id=
        !          9662:                   "id2596270"></a>12.5.8.&nbsp;Packages with
1.1       grant    9663:                   hardcoded paths to other interpreters</h3>
                   9664:                 </div>
                   9665:               </div>
                   9666:             </div>
                   9667: 
                   9668:             <p>Your package may also contain scripts with hardcoded
                   9669:             paths to other interpreters besides (or as well as)
                   9670:             perl. To correct the full pathname to the script
                   9671:             interpreter, you need to set the following definitions
1.14      xtraeme  9672:             in your <code class="filename">Makefile</code> (we
                   9673:             shall use <span><strong class=
                   9674:             "command">tclsh</strong></span> in this example):</p>
1.1       grant    9675:             <pre class="programlisting">
                   9676:   REPLACE_INTERPRETER+=     tcl
                   9677:     _REPLACE.tcl.old=     .*/bin/tclsh
                   9678:     _REPLACE.tcl.new=     ${PREFIX}/bin/tclsh
                   9679:     _REPLACE_FILES.tcl=   ...list of tcl scripts which need to be fixed,
                   9680:                           relative to ${WRKSRC}, just as in REPLACE_PERL
                   9681: </pre>
                   9682:           </div>
                   9683: 
                   9684:           <div class="sect2" lang="en" xml:lang="en">
                   9685:             <div class="titlepage">
                   9686:               <div>
                   9687:                 <div>
1.18    ! xtraeme  9688:                   <h3 class="title"><a name="id2596292" id=
        !          9689:                   "id2596292"></a>12.5.9.&nbsp;Packages installing
1.1       grant    9690:                   perl modules</h3>
                   9691:                 </div>
                   9692:               </div>
                   9693:             </div>
                   9694: 
                   9695:             <p>Makefiles of packages providing perl5 modules should
1.14      xtraeme  9696:             include the Makefile fragment <code class=
                   9697:             "filename">../../lang/perl5/module.mk</code>. It
                   9698:             provides a <span><strong class=
                   9699:             "command">do-configure</strong></span> target for the
                   9700:             standard perl configuration for such modules as well as
                   9701:             various hooks to tune this configuration. See comments
                   9702:             in this file for details.</p>
1.1       grant    9703: 
                   9704:             <p>Perl5 modules will install into different places
                   9705:             depending on the version of perl used during the build
                   9706:             process. To address this, pkgsrc will append lines to
1.14      xtraeme  9707:             the <code class="filename">PLIST</code> corresponding
                   9708:             to the files listed in the installed <code class=
                   9709:             "filename">.packlist</code> file generated by most
                   9710:             perl5 modules. This is invoked by defining <code class=
                   9711:             "varname">PERL5_PACKLIST</code> to a space-separated
                   9712:             list of paths to packlist files, e.g.:</p>
1.1       grant    9713:             <pre class="programlisting">
                   9714: PERL5_PACKLIST=   ${PERL5_SITEARCH}/auto/Pg/.packlist
                   9715: </pre>
                   9716: 
1.14      xtraeme  9717:             <p>The variables <code class=
                   9718:             "varname">PERL5_SITELIB</code>, <code class=
                   9719:             "varname">PERL5_SITEARCH</code>, and <code class=
                   9720:             "varname">PERL5_ARCHLIB</code> represent the three
1.1       grant    9721:             locations in which perl5 modules may be installed, and
                   9722:             may be used by perl5 packages that don't have a
                   9723:             packlist. These three variables are also substituted
1.14      xtraeme  9724:             for in the <code class="filename">PLIST</code>.</p>
1.1       grant    9725:           </div>
                   9726: 
                   9727:           <div class="sect2" lang="en" xml:lang="en">
                   9728:             <div class="titlepage">
                   9729:               <div>
                   9730:                 <div>
                   9731:                   <h3 class="title"><a name="faq.info-files" id=
                   9732:                   "faq.info-files"></a>12.5.10.&nbsp;Packages
                   9733:                   installing info files</h3>
                   9734:                 </div>
                   9735:               </div>
                   9736:             </div>
                   9737: 
                   9738:             <p>Some packages install info files or use the
                   9739:             &#8220;<span class="quote">makeinfo</span>&#8221; or
                   9740:             &#8220;<span class="quote">install-info</span>&#8221;
                   9741:             commands. Each of the info files:</p>
                   9742: 
                   9743:             <div class="itemizedlist">
                   9744:               <ul type="disc">
                   9745:                 <li>
                   9746:                   <p>is considered to be installed in the directory
1.14      xtraeme  9747:                   <code class=
                   9748:                   "filename">${PREFIX}/${INFO_DIR}</code>,</p>
1.1       grant    9749:                 </li>
                   9750: 
                   9751:                 <li>
                   9752:                   <p>is registered in the Info directory file
1.14      xtraeme  9753:                   <code class=
                   9754:                   "filename">${PREFIX}/${INFO_DIR}/dir</code>,</p>
1.1       grant    9755:                 </li>
                   9756: 
                   9757:                 <li>
                   9758:                   <p>and must be listed as a filename in the
1.14      xtraeme  9759:                   <code class="varname">INFO_FILES</code> variable
                   9760:                   in the package Makefile.</p>
1.1       grant    9761:                 </li>
                   9762:               </ul>
                   9763:             </div>
                   9764: 
1.14      xtraeme  9765:             <p><code class="varname">INFO_DIR</code> defaults to
1.1       grant    9766:             &#8220;<span class="quote">info</span>&#8221; and can
1.14      xtraeme  9767:             be overridden in the package Makefile. <code class=
                   9768:             "filename">INSTALL</code> and <code class=
                   9769:             "filename">DEINSTALL</code> scripts will be generated
                   9770:             to handle registration of the info files in the Info
1.1       grant    9771:             directory file. The &#8220;<span class=
                   9772:             "quote">install-info</span>&#8221; command used for the
                   9773:             info files registration is either provided by the
                   9774:             system, or by a special purpose package automatically
                   9775:             added as dependency if needed.</p>
                   9776: 
                   9777:             <p>A package which needs the &#8220;<span class=
                   9778:             "quote">makeinfo</span>&#8221; command at build time
1.14      xtraeme  9779:             must define the variable <code class=
                   9780:             "varname">USE_MAKEINFO</code> in its Makefile. If a
1.1       grant    9781:             minimum version of the &#8220;<span class=
                   9782:             "quote">makeinfo</span>&#8221; command is needed it
1.14      xtraeme  9783:             should be noted with the <code class=
                   9784:             "varname">TEXINFO_REQD</code> variable in the package
                   9785:             <code class="filename">Makefile</code>. By default, a
1.1       grant    9786:             minimum version of 3.12 is required. If the system does
1.14      xtraeme  9787:             not provide a <span><strong class=
                   9788:             "command">makeinfo</strong></span> command or if it
                   9789:             does not match the required minimum, a build dependency
                   9790:             on the <a xmlns=
                   9791:             "http://www.w3.org/TR/xhtml1/transitional" href=
1.1       grant    9792:             "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/devel/gtexinfo/README.html"
1.14      xtraeme  9793:             class="pkgname">devel/gtexinfo</a> package will be
                   9794:             added automatically.</p>
1.1       grant    9795: 
                   9796:             <p>The build and installation process of the software
                   9797:             provided by the package should not use the
1.14      xtraeme  9798:             <span><strong class=
                   9799:             "command">install-info</strong></span> command as the
                   9800:             registration of info files is the task of the package
                   9801:             <code class="filename">INSTALL</code> script, and it
                   9802:             must use the appropriate <span><strong class=
                   9803:             "command">makeinfo</strong></span> command.</p>
1.1       grant    9804: 
                   9805:             <p>To achieve this goal the pkgsrc infrastructure
1.14      xtraeme  9806:             creates overriding scripts for the <span><strong class=
                   9807:             "command">install-info</strong></span> and
                   9808:             <span><strong class="command">makeinfo</strong></span>
                   9809:             commands in a directory listed early in <code class=
                   9810:             "varname">PATH</code>.</p>
1.1       grant    9811: 
1.14      xtraeme  9812:             <p>The script overriding <span><strong class=
                   9813:             "command">install-info</strong></span> has no effect
                   9814:             except the logging of a message. The script overriding
                   9815:             <span><strong class="command">makeinfo</strong></span>
                   9816:             logs a message and according to the value of
                   9817:             <code class="varname">USE_MAKEINFO</code> and
                   9818:             <code class="varname">TEXINFO_REQD</code> either run
                   9819:             the appropriate <span><strong class=
                   9820:             "command">makeinfo</strong></span> command or exit on
                   9821:             error.</p>
1.1       grant    9822:           </div>
                   9823: 
                   9824:           <div class="sect2" lang="en" xml:lang="en">
                   9825:             <div class="titlepage">
                   9826:               <div>
                   9827:                 <div>
1.18    ! xtraeme  9828:                   <h3 class="title"><a name="id2596512" id=
        !          9829:                   "id2596512"></a>12.5.11.&nbsp;Packages installing
1.1       grant    9830:                   GConf2 data files</h3>
                   9831:                 </div>
                   9832:               </div>
                   9833:             </div>
                   9834: 
1.14      xtraeme  9835:             <p>If a package installs <code class=
                   9836:             "filename">.schemas</code> or <code class=
                   9837:             "filename">.entries</code> files, used by GConf2, you
1.1       grant    9838:             need to take some extra steps to make sure they get
                   9839:             registered in the database:</p>
                   9840: 
                   9841:             <div class="orderedlist">
                   9842:               <ol type="1">
                   9843:                 <li>
1.14      xtraeme  9844:                   <p>Include <code class=
                   9845:                   "filename">../../devel/GConf2/schemas.mk</code>
                   9846:                   instead of its <code class=
                   9847:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9848:                   care of rebuilding the GConf2 database at
                   9849:                   installation and deinstallation time, and tells
                   9850:                   the package where to install GConf2 data files
                   9851:                   using some standard configure arguments. It also
                   9852:                   disallows any access to the database directly
                   9853:                   from the package.</p>
                   9854:                 </li>
                   9855: 
                   9856:                 <li>
                   9857:                   <p>Ensure that the package installs its
1.14      xtraeme  9858:                   <code class="filename">.schemas</code> files
                   9859:                   under <code class=
                   9860:                   "filename">${PREFIX}/share/gconf/schemas</code>.
                   9861:                   If they get installed under <code class=
                   9862:                   "filename">${PREFIX}/etc</code>, you will need to
1.1       grant    9863:                   manually patch the package.</p>
                   9864:                 </li>
                   9865: 
                   9866:                 <li>
                   9867:                   <p>Check the PLIST and remove any entries under
                   9868:                   the etc/gconf directory, as they will be handled
                   9869:                   automatically. See <a href="#faq.conf" title=
1.14      xtraeme  9870:                   "6.14.&nbsp;Configuration files handling and placement">
                   9871:                   Section&nbsp;6.14, &#8220;Configuration files
1.1       grant    9872:                   handling and placement&#8221;</a> for more
                   9873:                   information.</p>
                   9874:                 </li>
                   9875: 
                   9876:                 <li>
1.14      xtraeme  9877:                   <p>Define the <code class=
                   9878:                   "varname">GCONF2_SCHEMAS</code> variable in your
                   9879:                   <code class="filename">Makefile</code> with a
                   9880:                   list of all <code class=
                   9881:                   "filename">.schemas</code> files installed by the
                   9882:                   package, if any. Names must not contain any
                   9883:                   directories in them.</p>
1.1       grant    9884:                 </li>
                   9885: 
                   9886:                 <li>
1.14      xtraeme  9887:                   <p>Define the <code class=
                   9888:                   "varname">GCONF2_ENTRIES</code> variable in your
                   9889:                   <code class="filename">Makefile</code> with a
                   9890:                   list of all <code class=
                   9891:                   "filename">.entries</code> files installed by the
                   9892:                   package, if any. Names must not contain any
                   9893:                   directories in them.</p>
1.1       grant    9894:                 </li>
                   9895:               </ol>
                   9896:             </div>
                   9897:           </div>
                   9898: 
                   9899:           <div class="sect2" lang="en" xml:lang="en">
                   9900:             <div class="titlepage">
                   9901:               <div>
                   9902:                 <div>
1.18    ! xtraeme  9903:                   <h3 class="title"><a name="id2596612" id=
        !          9904:                   "id2596612"></a>12.5.12.&nbsp;Packages installing
1.1       grant    9905:                   scrollkeeper data files</h3>
                   9906:                 </div>
                   9907:               </div>
                   9908:             </div>
                   9909: 
1.14      xtraeme  9910:             <p>If a package installs <code class=
                   9911:             "filename">.omf</code> files, used by scrollkeeper, you
                   9912:             need to take some extra steps to make sure they get
                   9913:             registered in the database:</p>
1.1       grant    9914: 
                   9915:             <div class="orderedlist">
                   9916:               <ol type="1">
                   9917:                 <li>
1.14      xtraeme  9918:                   <p>Include <code class=
                   9919:                   "filename">../../textproc/scrollkeeper/omf.mk</code>
                   9920:                   instead of its <code class=
                   9921:                   "filename">buildlink3.mk</code> file. This takes
1.1       grant    9922:                   care of rebuilding the scrollkeeper database at
                   9923:                   installation and deinstallation time, and
                   9924:                   disallows any access to it directly from the
                   9925:                   package.</p>
                   9926:                 </li>
                   9927: 
                   9928:                 <li>
                   9929:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  9930:                   the <code class=
                   9931:                   "filename">libdata/scrollkeeper</code> directory,
1.1       grant    9932:                   as they will be handled automatically.</p>
                   9933:                 </li>
                   9934: 
                   9935:                 <li>
1.14      xtraeme  9936:                   <p>Remove the <code class=
                   9937:                   "filename">share/omf</code> directory from the
                   9938:                   PLIST. It will be handled by scrollkeeper.</p>
1.1       grant    9939:                 </li>
                   9940:               </ol>
                   9941:             </div>
                   9942:           </div>
                   9943: 
                   9944:           <div class="sect2" lang="en" xml:lang="en">
                   9945:             <div class="titlepage">
                   9946:               <div>
                   9947:                 <div>
1.18    ! xtraeme  9948:                   <h3 class="title"><a name="id2596731" id=
        !          9949:                   "id2596731"></a>12.5.13.&nbsp;Packages installing
1.1       grant    9950:                   X11 fonts</h3>
                   9951:                 </div>
                   9952:               </div>
                   9953:             </div>
                   9954: 
                   9955:             <p>If a package installs font files, you will need to
                   9956:             rebuild the fonts database in the directory where they
                   9957:             get installed at installation and deinstallation time.
1.14      xtraeme  9958:             This can be automatically done by using <code class=
                   9959:             "filename">mk/fonts.mk</code>, which you need to
                   9960:             include in your <code class=
                   9961:             "filename">Makefile</code>.</p>
1.1       grant    9962: 
                   9963:             <p>When the file is included, you can list the
1.14      xtraeme  9964:             directories where fonts are installed in the
                   9965:             <code class="varname">FONTS_<em class=
                   9966:             "replaceable"><code>type</code></em>_DIRS</code>
                   9967:             variables, where <em class=
                   9968:             "replaceable"><code>type</code></em> can be one of
                   9969:             &#8220;<span class="quote">TTF</span>&#8221;,
1.1       grant    9970:             &#8220;<span class="quote">TYPE1</span>&#8221; or
                   9971:             &#8220;<span class="quote">X11</span>&#8221;. Also make
1.14      xtraeme  9972:             sure that the database file <code class=
                   9973:             "filename">fonts.dir</code> is not listed in the
1.1       grant    9974:             PLIST.</p>
                   9975: 
                   9976:             <p>Note that you should not create new directories for
                   9977:             fonts; instead use the standard ones to avoid that the
                   9978:             user needs to manually configure his X server to find
                   9979:             them.</p>
                   9980:           </div>
                   9981: 
                   9982:           <div class="sect2" lang="en" xml:lang="en">
                   9983:             <div class="titlepage">
                   9984:               <div>
                   9985:                 <div>
1.18    ! xtraeme  9986:                   <h3 class="title"><a name="id2596778" id=
        !          9987:                   "id2596778"></a>12.5.14.&nbsp;Packages installing
1.1       grant    9988:                   GTK2 modules</h3>
                   9989:                 </div>
                   9990:               </div>
                   9991:             </div>
                   9992: 
                   9993:             <p>If a package installs gtk2 immodules or loaders, you
                   9994:             need to take some extra steps to get them registered in
                   9995:             the GTK2 database properly:</p>
                   9996: 
                   9997:             <div class="orderedlist">
                   9998:               <ol type="1">
                   9999:                 <li>
1.14      xtraeme  10000:                   <p>Include <code class=
                   10001:                   "filename">../../x11/gtk2/modules.mk</code>
                   10002:                   instead of its <code class=
                   10003:                   "filename">buildlink3.mk</code> file. This takes
                   10004:                   care of rebuilding the database at installation
                   10005:                   and deinstallation time.</p>
1.1       grant    10006:                 </li>
                   10007: 
                   10008:                 <li>
1.14      xtraeme  10009:                   <p>Set <code class=
                   10010:                   "varname">GTK2_IMMODULES=YES</code> if your
                   10011:                   package installs GTK2 immodules.</p>
1.1       grant    10012:                 </li>
                   10013: 
                   10014:                 <li>
1.14      xtraeme  10015:                   <p>Set <code class=
                   10016:                   "varname">GTK2_LOADERS=YES</code> if your package
                   10017:                   installs GTK2 loaders.</p>
1.1       grant    10018:                 </li>
                   10019: 
                   10020:                 <li>
                   10021:                   <p>Patch the package to not touch any of the gtk2
                   10022:                   databases directly. These are:</p>
                   10023: 
                   10024:                   <div class="itemizedlist">
                   10025:                     <ul type="disc">
                   10026:                       <li>
1.14      xtraeme  10027:                         <p><code class=
                   10028:                         "filename">libdata/gtk-2.0/gdk-pixbuf.loaders</code></p>
1.1       grant    10029:                       </li>
                   10030: 
                   10031:                       <li>
1.14      xtraeme  10032:                         <p><code class=
                   10033:                         "filename">libdata/gtk-2.0/gtk.immodules</code></p>
1.1       grant    10034:                       </li>
                   10035:                     </ul>
                   10036:                   </div>
                   10037:                 </li>
                   10038: 
                   10039:                 <li>
                   10040:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10041:                   the <code class="filename">libdata/gtk-2.0</code>
1.1       grant    10042:                   directory, as they will be handled
                   10043:                   automatically.</p>
                   10044:                 </li>
                   10045:               </ol>
                   10046:             </div>
                   10047:           </div>
                   10048: 
                   10049:           <div class="sect2" lang="en" xml:lang="en">
                   10050:             <div class="titlepage">
                   10051:               <div>
                   10052:                 <div>
1.18    ! xtraeme  10053:                   <h3 class="title"><a name="id2596916" id=
        !          10054:                   "id2596916"></a>12.5.15.&nbsp;Packages installing
1.1       grant    10055:                   SGML or XML data</h3>
                   10056:                 </div>
                   10057:               </div>
                   10058:             </div>
                   10059: 
                   10060:             <p>If a package installs SGML or XML data files that
                   10061:             need to be registered in system-wide catalogs (like
                   10062:             DTDs, sub-catalogs, etc.), you need to take some extra
                   10063:             steps:</p>
                   10064: 
                   10065:             <div class="orderedlist">
                   10066:               <ol type="1">
                   10067:                 <li>
1.14      xtraeme  10068:                   <p>Include <code class=
                   10069:                   "filename">../../textproc/xmlcatmgr/catalogs.mk</code>
                   10070:                   in your <code class="filename">Makefile</code>,
                   10071:                   which takes care of registering those files in
1.1       grant    10072:                   system-wide catalogs at installation and
                   10073:                   deinstallation time.</p>
                   10074:                 </li>
                   10075: 
                   10076:                 <li>
1.14      xtraeme  10077:                   <p>Set <code class="varname">SGML_CATALOGS</code>
                   10078:                   to the full path of any SGML catalogs installed
                   10079:                   by the package.</p>
1.1       grant    10080:                 </li>
                   10081: 
                   10082:                 <li>
1.14      xtraeme  10083:                   <p>Set <code class="varname">XML_CATALOGS</code>
                   10084:                   to the full path of any XML catalogs installed by
1.1       grant    10085:                   the package.</p>
                   10086:                 </li>
                   10087: 
                   10088:                 <li>
1.14      xtraeme  10089:                   <p>Set <code class="varname">SGML_ENTRIES</code>
                   10090:                   to individual entries to be added to the SGML
1.1       grant    10091:                   catalog. These come in groups of three strings;
                   10092:                   see xmlcatmgr(1) for more information
                   10093:                   (specifically, arguments recognized by the 'add'
                   10094:                   action). Note that you will normally not use this
                   10095:                   variable.</p>
                   10096:                 </li>
                   10097: 
                   10098:                 <li>
1.14      xtraeme  10099:                   <p>Set <code class="varname">XML_ENTRIES</code>
                   10100:                   to individual entries to be added to the XML
1.1       grant    10101:                   catalog. These come in groups of three strings;
                   10102:                   see xmlcatmgr(1) for more information
                   10103:                   (specifically, arguments recognized by the 'add'
                   10104:                   action). Note that you will normally not use this
                   10105:                   variable.</p>
                   10106:                 </li>
                   10107:               </ol>
                   10108:             </div>
                   10109:           </div>
                   10110: 
                   10111:           <div class="sect2" lang="en" xml:lang="en">
                   10112:             <div class="titlepage">
                   10113:               <div>
                   10114:                 <div>
1.18    ! xtraeme  10115:                   <h3 class="title"><a name="id2596968" id=
        !          10116:                   "id2596968"></a>12.5.16.&nbsp;Packages installing
1.1       grant    10117:                   extensions to the MIME database</h3>
                   10118:                 </div>
                   10119:               </div>
                   10120:             </div>
                   10121: 
                   10122:             <p>If a package provides extensions to the MIME
1.14      xtraeme  10123:             database by installing <code class=
                   10124:             "filename">.xml</code> files inside <code class=
                   10125:             "filename">${PREFIX}/share/mime/packages</code>, you
                   10126:             need to take some extra steps to ensure that the
                   10127:             database is kept consistent with respect to these new
                   10128:             files:</p>
1.1       grant    10129: 
                   10130:             <div class="orderedlist">
                   10131:               <ol type="1">
                   10132:                 <li>
1.14      xtraeme  10133:                   <p>Include <code class=
                   10134:                   "filename">../../databases/shared-mime-info/mimedb.mk</code>
                   10135:                   (avoid using the <code class=
                   10136:                   "filename">buildlink3.mk</code> file from this
                   10137:                   same directory, which is reserved for inclusion
                   10138:                   from other <code class=
                   10139:                   "filename">buildlink3.mk</code> files). It takes
                   10140:                   care of rebuilding the MIME database at
                   10141:                   installation and deinstallation time, and
                   10142:                   disallows any access to it directly from the
1.1       grant    10143:                   package.</p>
                   10144:                 </li>
                   10145: 
                   10146:                 <li>
                   10147:                   <p>Check the PLIST and remove any entries under
1.14      xtraeme  10148:                   the <code class="filename">share/mime</code>
1.1       grant    10149:                   directory, <span class=
                   10150:                   "emphasis"><em>except</em></span> for files saved
1.14      xtraeme  10151:                   under <code class=
                   10152:                   "filename">share/mime/packages</code>. The former
1.1       grant    10153:                   are handled automatically by the
                   10154:                   update-mime-database program, but the later are
                   10155:                   package-dependent and must be removed by the
                   10156:                   package that installed them in the first
                   10157:                   place.</p>
                   10158:                 </li>
                   10159: 
                   10160:                 <li>
1.14      xtraeme  10161:                   <p>Remove any <code class=
                   10162:                   "filename">share/mime/*</code> directories from
                   10163:                   the PLIST. They will be handled by the
1.1       grant    10164:                   shared-mime-info package.</p>
                   10165:                 </li>
                   10166:               </ol>
                   10167:             </div>
                   10168:           </div>
                   10169: 
                   10170:           <div class="sect2" lang="en" xml:lang="en">
                   10171:             <div class="titlepage">
                   10172:               <div>
                   10173:                 <div>
1.18    ! xtraeme  10174:                   <h3 class="title"><a name="id2597107" id=
        !          10175:                   "id2597107"></a>12.5.17.&nbsp;Packages using
1.1       grant    10176:                   intltool</h3>
                   10177:                 </div>
                   10178:               </div>
                   10179:             </div>
                   10180: 
                   10181:             <p>If a package uses intltool during its build, include
1.14      xtraeme  10182:             the <code class=
                   10183:             "filename">../../textproc/intltool/buildlink3.mk</code>
1.1       grant    10184:             file, which forces it to use the intltool package
                   10185:             provided by pkgsrc, instead of the one bundled with the
                   10186:             distribution file.</p>
                   10187: 
                   10188:             <p>This tracks intltool's build-time dependencies and
                   10189:             uses the latest available version; this way, the
                   10190:             package benefits of any bug fixes that may have
                   10191:             appeared since it was released.</p>
                   10192:           </div>
1.18    ! xtraeme  10193: 
        !          10194:           <div class="sect2" lang="en" xml:lang="en">
        !          10195:             <div class="titlepage">
        !          10196:               <div>
        !          10197:                 <div>
        !          10198:                   <h3 class="title"><a name="id2597121" id=
        !          10199:                   "id2597121"></a>12.5.18.&nbsp;Packages installing
        !          10200:                   startup scripts</h3>
        !          10201:                 </div>
        !          10202:               </div>
        !          10203:             </div>
        !          10204: 
        !          10205:             <p>If a package contains a rc.d script, it won't be
        !          10206:             copied into the startup directory by default, but you
        !          10207:             can enable it, by adding the option <code class=
        !          10208:             "varname">PKG_RCD_SCRIPTS=YES</code> in <code class=
        !          10209:             "filename">/etc/mk.conf</code>. This option will copy
        !          10210:             the scripts into <code class=
        !          10211:             "filename">/etc/rc.d</code> when a package is
        !          10212:             installed, and it will automatically remove the scripts
        !          10213:             when the package is deinstalled.</p>
        !          10214:           </div>
1.1       grant    10215:         </div>
                   10216: 
                   10217:         <div class="sect1" lang="en" xml:lang="en">
                   10218:           <div class="titlepage">
                   10219:             <div>
                   10220:               <div>
                   10221:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  10222:                 "id2597210" id="id2597210"></a>12.6.&nbsp;Feedback
1.1       grant    10223:                 to the author</h2>
                   10224:               </div>
                   10225:             </div>
                   10226:           </div>
                   10227: 
                   10228:           <p>If you have found any bugs in the package you make
                   10229:           available, if you had to do special steps to make it run
                   10230:           under NetBSD or if you enhanced the software in various
                   10231:           other ways, be sure to report these changes back to the
                   10232:           original author of the program! With that kind of
                   10233:           support, the next release of the program can incorporate
                   10234:           these fixes, and people not using the NetBSD packages
                   10235:           system can win from your efforts.</p>
                   10236: 
                   10237:           <p>Support the idea of free software!</p>
                   10238:         </div>
                   10239:       </div>
                   10240: 
                   10241:       <div class="chapter" lang="en" xml:lang="en">
                   10242:         <div class="titlepage">
                   10243:           <div>
                   10244:             <div>
                   10245:               <h2 class="title"><a name="debug" id=
                   10246:               "debug"></a>Chapter&nbsp;13.&nbsp;Debugging</h2>
                   10247:             </div>
                   10248:           </div>
                   10249:         </div>
                   10250: 
                   10251:         <p>To check out all the gotchas when building a package,
                   10252:         here are the steps that I do in order to get a package
                   10253:         working. Please note this is basically the same as what was
                   10254:         explained in the previous sections, only with some
                   10255:         debugging aids.</p>
                   10256: 
                   10257:         <div class="itemizedlist">
                   10258:           <ul type="disc">
                   10259:             <li>
1.14      xtraeme  10260:               <p>Be sure to set <code class=
                   10261:               "varname">PKG_DEVELOPER=1</code> in <code class=
                   10262:               "filename">/etc/mk.conf</code></p>
1.1       grant    10263:             </li>
                   10264: 
                   10265:             <li>
                   10266:               <p>Install <a xmlns=
                   10267:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10268:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/url2pkg/README.html"
1.14      xtraeme  10269:               class="pkgname">pkgtools/url2pkg</a>, create a
                   10270:               directory for a new package, change into it, then run
                   10271:               <span><strong class=
                   10272:               "command">url2pkg</strong></span>:</p>
1.1       grant    10273:               <pre class="screen">
1.14      xtraeme  10274: <code class="prompt">%</code> <strong class=
                   10275: "userinput"><code>mkdir /usr/pkgsrc/<em class=
                   10276: "replaceable"><code>category</code></em>/<em class=
                   10277: "replaceable"><code>examplepkg</code></em></code></strong>
                   10278: <code class="prompt">%</code> <strong class=
                   10279: "userinput"><code>cd /usr/pkgsrc/<em class=
                   10280: "replaceable"><code>category</code></em>/<em class=
                   10281: "replaceable"><code>examplepkg</code></em></code></strong>
                   10282: <code class="prompt">%</code> <strong class=
                   10283: "userinput"><code>url2pkg http://www.example.com/path/to/distfile.tar.gz</code></strong>
1.1       grant    10284: </pre>
                   10285:             </li>
                   10286: 
                   10287:             <li>
1.14      xtraeme  10288:               <p>Edit the <code class="filename">Makefile</code> as
1.1       grant    10289:               requested.</p>
                   10290:             </li>
                   10291: 
                   10292:             <li>
1.14      xtraeme  10293:               <p>Fill in the <code class="filename">DESCR</code>
1.1       grant    10294:               file</p>
                   10295:             </li>
                   10296: 
                   10297:             <li>
1.14      xtraeme  10298:               <p>Run <span><strong class="command">make
                   10299:               configure</strong></span></p>
1.1       grant    10300:             </li>
                   10301: 
                   10302:             <li>
                   10303:               <p>Add any dependencies glimpsed from documentation
1.14      xtraeme  10304:               and the configure step to the package's <code class=
                   10305:               "filename">Makefile</code>.</p>
1.1       grant    10306:             </li>
                   10307: 
                   10308:             <li>
                   10309:               <p>Make the package compile, doing multiple rounds
                   10310:               of</p>
                   10311:               <pre class="screen">
1.14      xtraeme  10312: <code class="prompt">%</code> <strong class=
                   10313: "userinput"><code>make</code></strong>
                   10314: <code class="prompt">%</code> <strong class=
                   10315: "userinput"><code>pkgvi ${WRKSRC}/some/file/that/does/not/compile</code></strong>
                   10316: <code class="prompt">%</code> <strong class=
                   10317: "userinput"><code>mkpatches</code></strong>
                   10318: <code class="prompt">%</code> <strong class=
                   10319: "userinput"><code>patchdiff</code></strong>
                   10320: <code class="prompt">%</code> <strong class=
                   10321: "userinput"><code>mv ${WRKDIR}/.newpatches/* patches</code></strong>
                   10322: <code class="prompt">%</code> <strong class=
                   10323: "userinput"><code>make mps</code></strong>
                   10324: <code class="prompt">%</code> <strong class=
                   10325: "userinput"><code>make clean</code></strong>
1.1       grant    10326: </pre>
                   10327: 
                   10328:               <p>Doing as non-root user will ensure that no files
                   10329:               are modified that shouldn't be, especially during the
1.14      xtraeme  10330:               build phase. <span><strong class=
                   10331:               "command">mkpatches</strong></span>,
                   10332:               <span><strong class=
                   10333:               "command">patchdiff</strong></span> and
                   10334:               <span><strong class="command">pkgvi</strong></span>
                   10335:               are from the <a xmlns=
1.1       grant    10336:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10337:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkgdiff/README.html"
1.14      xtraeme  10338:               class="pkgname">pkgtools/pkgdiff</a> package.</p>
1.1       grant    10339:             </li>
                   10340: 
                   10341:             <li>
1.14      xtraeme  10342:               <p>Look at the <code class=
                   10343:               "filename">Makefile</code>, fix if necessary; see
                   10344:               <a href="#components.Makefile" title=
                   10345:               "7.1.&nbsp;Makefile">Section&nbsp;7.1,
                   10346:               &#8220;<code class=
                   10347:               "filename">Makefile</code>&#8221;</a>.</p>
1.1       grant    10348:             </li>
                   10349: 
                   10350:             <li>
1.14      xtraeme  10351:               <p>Generate a <code class=
                   10352:               "filename">PLIST</code>:</p>
1.1       grant    10353:               <pre class="screen">
1.14      xtraeme  10354: <code class="prompt">#</code> <strong class=
                   10355: "userinput"><code>make install</code></strong>
                   10356: <code class="prompt">#</code> <strong class=
                   10357: "userinput"><code>make print-PLIST &gt;PLIST</code></strong>
                   10358: <code class="prompt">#</code> <strong class=
                   10359: "userinput"><code>make deinstall</code></strong>
                   10360: <code class="prompt">#</code> <strong class=
                   10361: "userinput"><code>make install</code></strong>
                   10362: <code class="prompt">#</code> <strong class=
                   10363: "userinput"><code>make deinstall</code></strong>
1.1       grant    10364: </pre>
                   10365: 
1.14      xtraeme  10366:               <p>You usually need to be <code class=
                   10367:               "username">root</code> to do this. Look if there are
1.1       grant    10368:               any files left:</p>
                   10369:               <pre class="screen">
1.14      xtraeme  10370: <code class="prompt">#</code> <strong class=
                   10371: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10372: </pre>
                   10373: 
                   10374:               <p>If this reveals any files that are missing in
1.14      xtraeme  10375:               <code class="filename">PLIST</code>, add them.</p>
1.1       grant    10376:             </li>
                   10377: 
                   10378:             <li>
1.14      xtraeme  10379:               <p>Now that the <code class="filename">PLIST</code>
                   10380:               is OK, install the package again and make a binary
1.1       grant    10381:               package:</p>
                   10382:               <pre class="screen">
1.14      xtraeme  10383: <code class="prompt">#</code> <strong class=
                   10384: "userinput"><code>make reinstall</code></strong>
                   10385: <code class="prompt">#</code> <strong class=
                   10386: "userinput"><code>make package</code></strong>
1.1       grant    10387: </pre>
                   10388:             </li>
                   10389: 
                   10390:             <li>
                   10391:               <p>Delete the installed package:</p>
                   10392:               <pre class="screen">
1.14      xtraeme  10393: <code class="prompt">#</code> <strong class=
                   10394: "userinput"><code>pkg_delete blub</code></strong>
1.1       grant    10395: </pre>
                   10396:             </li>
                   10397: 
                   10398:             <li>
1.14      xtraeme  10399:               <p>Repeat the above <span><strong class=
                   10400:               "command">make print-PLIST</strong></span> command,
                   10401:               which shouldn't find anything now:</p>
1.1       grant    10402:               <pre class="screen">
1.14      xtraeme  10403: <code class="prompt">#</code> <strong class=
                   10404: "userinput"><code>make print-PLIST</code></strong>
1.1       grant    10405: </pre>
                   10406:             </li>
                   10407: 
                   10408:             <li>
                   10409:               <p>Reinstall the binary package:</p>
                   10410:               <pre class="screen">
1.14      xtraeme  10411: <code class="prompt">#</code> <strong class=
                   10412: "userinput"><code>pkgadd .../blub.tgz</code></strong>
1.1       grant    10413: </pre>
                   10414:             </li>
                   10415: 
                   10416:             <li>
                   10417:               <p>Play with it. Make sure everything works.</p>
                   10418:             </li>
                   10419: 
                   10420:             <li>
1.14      xtraeme  10421:               <p>Run <span><strong class=
                   10422:               "command">pkglint</strong></span> from <a xmlns=
1.1       grant    10423:               "http://www.w3.org/TR/xhtml1/transitional" href=
                   10424:               "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14      xtraeme  10425:               class="pkgname">pkgtools/pkglint</a>, and fix the
                   10426:               problems it reports:</p>
1.1       grant    10427:               <pre class="screen">
1.14      xtraeme  10428: <code class="prompt">#</code> <strong class=
                   10429: "userinput"><code>pkglint</code></strong>
1.1       grant    10430: </pre>
                   10431:             </li>
                   10432: 
                   10433:             <li>
                   10434:               <p>Submit (or commit, if you have cvs access); see
                   10435:               <a href="#submit" title=
                   10436:               "Chapter&nbsp;14.&nbsp;Submitting and Committing">Chapter&nbsp;14,
                   10437:               <i>Submitting and Committing</i></a>.</p>
                   10438:             </li>
                   10439:           </ul>
                   10440:         </div>
                   10441:       </div>
                   10442: 
                   10443:       <div class="chapter" lang="en" xml:lang="en">
                   10444:         <div class="titlepage">
                   10445:           <div>
                   10446:             <div>
                   10447:               <h2 class="title"><a name="submit" id=
                   10448:               "submit"></a>Chapter&nbsp;14.&nbsp;Submitting and
                   10449:               Committing</h2>
                   10450:             </div>
                   10451:           </div>
                   10452:         </div>
                   10453: 
                   10454:         <div class="toc">
                   10455:           <p><b>Table of Contents</b></p>
                   10456: 
                   10457:           <dl>
1.18    ! xtraeme  10458:             <dt><span class="sect1"><a href="#id2597672">14.1.
1.1       grant    10459:             Submitting your packages</a></span></dt>
                   10460: 
1.18    ! xtraeme  10461:             <dt><span class="sect1"><a href="#id2597723">14.2.
1.1       grant    10462:             Committing: Importing a package into
                   10463:             CVS</a></span></dt>
                   10464: 
1.18    ! xtraeme  10465:             <dt><span class="sect1"><a href="#id2597854">14.3.
1.2       hubertf  10466:             Updating a package to a newer version</a></span></dt>
1.1       grant    10467: 
1.18    ! xtraeme  10468:             <dt><span class="sect1"><a href="#id2597874">14.4.
1.2       hubertf  10469:             Moving a package in pkgsrc</a></span></dt>
1.1       grant    10470:           </dl>
                   10471:         </div>
                   10472: 
                   10473:         <div class="sect1" lang="en" xml:lang="en">
                   10474:           <div class="titlepage">
                   10475:             <div>
                   10476:               <div>
                   10477:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  10478:                 "id2597672" id=
        !          10479:                 "id2597672"></a>14.1.&nbsp;Submitting your
1.1       grant    10480:                 packages</h2>
                   10481:               </div>
                   10482:             </div>
                   10483:           </div>
                   10484: 
                   10485:           <p>You have to separate between binary and
                   10486:           &#8220;<span class="quote">normal</span>&#8221; (source)
                   10487:           packages here:</p>
                   10488: 
                   10489:           <div class="itemizedlist">
                   10490:             <ul type="disc">
                   10491:               <li>
                   10492:                 <p>precompiled binary packages</p>
                   10493: 
                   10494:                 <p>Our policy is that we accept binaries only from
                   10495:                 pkgsrc developers to guarantee that the packages
                   10496:                 don't contain any trojan horses etc. This is not to
1.13      hubertf  10497:                 annoy anyone but rather to protect our users!
1.1       grant    10498:                 You're still free to put up your home-made binary
1.13      hubertf  10499:                 packages and tell the world where to get them.
                   10500:                 NetBSD developers doing bulk builds and wanting to
                   10501:                 upload them please see <a href="#bulk-upload"
                   10502:                 title="5.3.8.&nbsp;Uploading results of a bulk build">
                   10503:                 Section&nbsp;5.3.8, &#8220;Uploading results of a
                   10504:                 bulk build&#8221;</a>.</p>
1.1       grant    10505:               </li>
                   10506: 
                   10507:               <li>
                   10508:                 <p>packages</p>
                   10509: 
                   10510:                 <p>First, check that your package is complete,
                   10511:                 compiles and runs well; see <a href="#debug" title=
                   10512:                 "Chapter&nbsp;13.&nbsp;Debugging">Chapter&nbsp;13,
                   10513:                 <i>Debugging</i></a> and the rest of this document.
                   10514:                 Next, generate an uuencoded gzipped tar(1) archive,
                   10515:                 preferably with all files in a single directory.
1.14      xtraeme  10516:                 Finally, <span><strong class=
                   10517:                 "command">send-pr</strong></span> with category
1.1       grant    10518:                 &#8220;<span class="quote">pkg</span>&#8221;, a
                   10519:                 synopsis which includes the package name and
                   10520:                 version number, a short description of your package
                   10521:                 (contents of the COMMENT variable or DESCR file are
                   10522:                 OK) and attach the archive to your PR.</p>
                   10523: 
                   10524:                 <p>If you want to submit several packages, please
                   10525:                 send a separate PR for each one, it's easier for us
                   10526:                 to track things that way.</p>
                   10527: 
                   10528:                 <p>Alternatively, you can also import new packages
                   10529:                 into pkgsrc-wip (&#8220;<span class="quote">pkgsrc
                   10530:                 work-in-progress</span>&#8221;); see the homepage
                   10531:                 at <a href="http://pkgsrc-wip.sourceforge.net/"
                   10532:                 target=
                   10533:                 "_top">http://pkgsrc-wip.sourceforge.net/</a> for
                   10534:                 details.</p>
                   10535:               </li>
                   10536:             </ul>
                   10537:           </div>
                   10538:         </div>
                   10539: 
                   10540:         <div class="sect1" lang="en" xml:lang="en">
                   10541:           <div class="titlepage">
                   10542:             <div>
                   10543:               <div>
                   10544:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  10545:                 "id2597723" id=
        !          10546:                 "id2597723"></a>14.2.&nbsp;Committing: Importing a
1.1       grant    10547:                 package into CVS</h2>
                   10548:               </div>
                   10549:             </div>
                   10550:           </div>
                   10551: 
                   10552:           <p>This section is only of interest for pkgsrc developers
                   10553:           with write access to the pkgsrc repository. Please
                   10554:           remember that cvs imports files relative to the current
                   10555:           working directory, and that the pathname that you give
1.14      xtraeme  10556:           the <span><strong class="command">cvs
                   10557:           import</strong></span> command is so that it knows where
                   10558:           to place the files in the repository. Newly created
                   10559:           packages should be imported with a vendor tag of
                   10560:           &#8220;<span class="quote">TNF</span>&#8221; and a
                   10561:           release tag of &#8220;<span class=
                   10562:           "quote">pkgsrc-base</span>&#8221;, e.g:</p>
1.1       grant    10563:           <pre class="programlisting">
                   10564:   % cd .../pkgsrc/category/pkgname
                   10565:   % cvs import pkgsrc/category/pkgname TNF pkgsrc-base
                   10566: </pre>
                   10567: 
                   10568:           <p>Remember to move the directory from which you imported
                   10569:           out of the way, or cvs will complain the next time you
                   10570:           &#8220;<span class="quote">cvs update</span>&#8221; your
                   10571:           source tree. Also don't forget to add the new package to
1.14      xtraeme  10572:           the category's <code class=
                   10573:           "filename">Makefile</code>.</p>
1.1       grant    10574: 
                   10575:           <p>The commit message of the initial import should
1.14      xtraeme  10576:           include part of the <code class="filename">DESCR</code>
                   10577:           file, so people reading the mailing lists know what the
                   10578:           package is/does.</p>
1.1       grant    10579: 
                   10580:           <p>Please note all package updates/additions in
1.14      xtraeme  10581:           <code class="filename">pkgsrc/doc/CHANGES</code>. It's
                   10582:           very important to keep this file up to date and
                   10583:           conforming to the existing format, because it will be
                   10584:           used by scripts to automatically update pages on <a href=
1.1       grant    10585:           "http://www.NetBSD.org/" target="_top">www.NetBSD.org</a>
                   10586:           and other sites. Additionally, check the pkgsrc/doc/TODO
                   10587:           file and remove the entry for the package you updated, in
                   10588:           case it was mentioned there.</p>
                   10589: 
                   10590:           <p>For new packages, &#8220;<span class="quote">cvs
                   10591:           import</span>&#8221; is preferred to &#8220;<span class=
                   10592:           "quote">cvs add</span>&#8221; because the former gets
                   10593:           everything with a single command, and provides a
                   10594:           consistent tag.</p>
                   10595:         </div>
                   10596: 
                   10597:         <div class="sect1" lang="en" xml:lang="en">
                   10598:           <div class="titlepage">
                   10599:             <div>
                   10600:               <div>
                   10601:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  10602:                 "id2597854" id="id2597854"></a>14.3.&nbsp;Updating
1.2       hubertf  10603:                 a package to a newer version</h2>
1.1       grant    10604:               </div>
                   10605:             </div>
                   10606:           </div>
                   10607: 
                   10608:           <p>Please always put a concise, appropriate and relevant
                   10609:           summary of the changes between old and new versions into
                   10610:           the commit log when updating a package. There are various
                   10611:           reasons for this:</p>
                   10612: 
                   10613:           <div class="itemizedlist">
                   10614:             <ul type="disc">
                   10615:               <li>
                   10616:                 <p>A URL is volatile, and can change over time. It
                   10617:                 may go away completely or its information may be
                   10618:                 overwritten by newer information.</p>
                   10619:               </li>
                   10620: 
                   10621:               <li>
                   10622:                 <p>Having the change information between old and
                   10623:                 new versions in our CVS repository is very useful
                   10624:                 for people who use either cvs or anoncvs.</p>
                   10625:               </li>
                   10626: 
                   10627:               <li>
                   10628:                 <p>Having the change information between old and
                   10629:                 new versions in our CVS repository is very useful
                   10630:                 for people who read the pkgsrc-changes mailing
                   10631:                 list, so that they can make tactical decisions
                   10632:                 about when to upgrade the package.</p>
                   10633:               </li>
                   10634:             </ul>
                   10635:           </div>
                   10636: 
1.18    ! xtraeme  10637:           <p>Please also recognize that, just because a new version
1.1       grant    10638:           of a package has been released, it should not
                   10639:           automatically be upgraded in the CVS repository. We
                   10640:           prefer to be conservative in the packages that are
                   10641:           included in pkgsrc - development or beta packages are not
                   10642:           really the best thing for most places in which pkgsrc is
                   10643:           used. Please use your judgement about what should go into
                   10644:           pkgsrc, and bear in mind that stability is to be
                   10645:           preferred above new and possibly untested features.</p>
                   10646:         </div>
                   10647: 
                   10648:         <div class="sect1" lang="en" xml:lang="en">
                   10649:           <div class="titlepage">
                   10650:             <div>
                   10651:               <div>
                   10652:                 <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  10653:                 "id2597874" id="id2597874"></a>14.4.&nbsp;Moving a
1.2       hubertf  10654:                 package in pkgsrc</h2>
1.1       grant    10655:               </div>
                   10656:             </div>
                   10657:           </div>
                   10658: 
                   10659:           <div class="orderedlist">
                   10660:             <ol type="1">
                   10661:               <li>
                   10662:                 <p>Make a copy of the directory somewhere else.</p>
                   10663:               </li>
                   10664: 
                   10665:               <li>
                   10666:                 <p>Remove all CVS dirs.</p>
                   10667: 
                   10668:                 <p>Alternatively to the first two steps you can
                   10669:                 also do:</p>
                   10670:                 <pre class="screen">
1.14      xtraeme  10671: <code class="prompt">%</code> <strong class=
                   10672: "userinput"><code>cvs -d user@cvs.NetBSD.org:/cvsroot export -D today pkgsrc/category/package</code></strong>
1.1       grant    10673: </pre>
                   10674: 
                   10675:                 <p>and use that for further work.</p>
                   10676:               </li>
                   10677: 
                   10678:               <li>
1.14      xtraeme  10679:                 <p>Fix <code class="varname">CATEGORIES</code> and
                   10680:                 any <code class="varname">DEPENDS</code> paths that
                   10681:                 just did &#8220;<span class=
1.1       grant    10682:                 "quote">../package</span>&#8221; instead of
                   10683:                 &#8220;<span class=
                   10684:                 "quote">../../category/package</span>&#8221;.</p>
                   10685:               </li>
                   10686: 
                   10687:               <li>
1.14      xtraeme  10688:                 <p><span><strong class="command">cvs
                   10689:                 import</strong></span> the modified package in the
                   10690:                 new place.</p>
1.1       grant    10691:               </li>
                   10692: 
                   10693:               <li>
                   10694:                 <p>Check if any package depends on it:</p>
                   10695:                 <pre class="screen">
1.14      xtraeme  10696: <code class="prompt">%</code> <strong class=
                   10697: "userinput"><code>cd /usr/pkgsrc</code></strong>
                   10698: <code class="prompt">%</code> <strong class=
                   10699: "userinput"><code>grep /package */*/Makefile* */*/buildlink*</code></strong>
1.1       grant    10700: </pre>
                   10701:               </li>
                   10702: 
                   10703:               <li>
                   10704:                 <p>Fix paths in packages from step 5 to point to
                   10705:                 new location.</p>
                   10706:               </li>
                   10707: 
                   10708:               <li>
1.14      xtraeme  10709:                 <p><span><strong class="command">cvs rm
                   10710:                 (-f)</strong></span> the package at the old
                   10711:                 location.</p>
1.1       grant    10712:               </li>
                   10713: 
                   10714:               <li>
1.14      xtraeme  10715:                 <p>Remove from <code class=
                   10716:                 "filename">oldcategory/Makefile</code>.</p>
1.1       grant    10717:               </li>
                   10718: 
                   10719:               <li>
1.14      xtraeme  10720:                 <p>Add to <code class=
                   10721:                 "filename">newcategory/Makefile</code>.</p>
1.1       grant    10722:               </li>
                   10723: 
                   10724:               <li>
                   10725:                 <p>Commit the changed and removed files:</p>
                   10726:                 <pre class="screen">
1.14      xtraeme  10727: <code class="prompt">%</code> <strong class=
                   10728: "userinput"><code>cvs commit oldcategory/package oldcategory/Makefile newcategory/Makefile</code></strong>
1.1       grant    10729: </pre>
                   10730: 
                   10731:                 <p>(and any packages from step 5, of course).</p>
                   10732:               </li>
                   10733:             </ol>
                   10734:           </div>
                   10735:         </div>
                   10736:       </div>
                   10737:     </div>
                   10738: 
                   10739:     <div class="appendix" lang="en" xml:lang="en">
                   10740:       <div class="titlepage">
                   10741:         <div>
                   10742:           <div>
                   10743:             <h2 class="title"><a name="examples" id=
                   10744:             "examples"></a>Appendix&nbsp;A.&nbsp;A simple example
                   10745:             package: bison</h2>
                   10746:           </div>
                   10747:         </div>
                   10748:       </div>
                   10749: 
                   10750:       <div class="toc">
                   10751:         <p><b>Table of Contents</b></p>
                   10752: 
                   10753:         <dl>
1.18    ! xtraeme  10754:           <dt><span class="sect1"><a href="#id2598100">A.1.
1.1       grant    10755:           files</a></span></dt>
                   10756: 
                   10757:           <dd>
                   10758:             <dl>
1.18    ! xtraeme  10759:               <dt><span class="sect2"><a href="#id2598103">A.1.1.
1.1       grant    10760:               Makefile</a></span></dt>
                   10761: 
1.18    ! xtraeme  10762:               <dt><span class="sect2"><a href="#id2598110">A.1.2.
1.1       grant    10763:               DESCR</a></span></dt>
                   10764: 
1.18    ! xtraeme  10765:               <dt><span class="sect2"><a href="#id2598125">A.1.3.
1.1       grant    10766:               PLIST</a></span></dt>
                   10767: 
1.18    ! xtraeme  10768:               <dt><span class="sect2"><a href="#id2598133">A.1.4.
1.14      xtraeme  10769:               Checking a package with <span><strong class=
                   10770:               "command">pkglint</strong></span></a></span></dt>
1.1       grant    10771:             </dl>
                   10772:           </dd>
                   10773: 
1.18    ! xtraeme  10774:           <dt><span class="sect1"><a href="#id2598173">A.2. Steps
1.1       grant    10775:           for building, installing, packaging</a></span></dt>
                   10776:         </dl>
                   10777:       </div>
                   10778: 
                   10779:       <p>We checked to find a piece of software that wasn't in the
                   10780:       packages collection, and picked GNU bison. Quite why someone
1.14      xtraeme  10781:       would want to have <span><strong class=
                   10782:       "command">bison</strong></span> when Berkeley
                   10783:       <span><strong class="command">yacc</strong></span> is already
                   10784:       present in the tree is beyond us, but it's useful for the
                   10785:       purposes of this exercise.</p>
1.1       grant    10786: 
                   10787:       <div class="sect1" lang="en" xml:lang="en">
                   10788:         <div class="titlepage">
                   10789:           <div>
                   10790:             <div>
                   10791:               <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  10792:               "id2598100" id="id2598100"></a>A.1.&nbsp;files</h2>
1.1       grant    10793:             </div>
                   10794:           </div>
                   10795:         </div>
                   10796: 
                   10797:         <div class="sect2" lang="en" xml:lang="en">
                   10798:           <div class="titlepage">
                   10799:             <div>
                   10800:               <div>
1.18    ! xtraeme  10801:                 <h3 class="title"><a name="id2598103" id=
        !          10802:                 "id2598103"></a>A.1.1.&nbsp;Makefile</h3>
1.1       grant    10803:               </div>
                   10804:             </div>
                   10805:           </div>
                   10806:           <pre class="programlisting">
1.17      sketch   10807: # $NetBSD$
1.1       grant    10808: #
                   10809: 
                   10810: DISTNAME=       bison-1.25
                   10811: CATEGORIES=     devel
                   10812: MASTER_SITES=   ${MASTER_SITE_GNU}
                   10813: 
                   10814: MAINTAINER=     thorpej@NetBSD.org
                   10815: HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
                   10816: COMMENT=        GNU yacc clone
                   10817: 
                   10818: GNU_CONFIGURE=  yes
                   10819: INFO_FILES=     bison.info
                   10820: 
                   10821: .include "../../mk/bsd.pkg.mk"
                   10822: </pre>
                   10823:         </div>
                   10824: 
                   10825:         <div class="sect2" lang="en" xml:lang="en">
                   10826:           <div class="titlepage">
                   10827:             <div>
                   10828:               <div>
1.18    ! xtraeme  10829:                 <h3 class="title"><a name="id2598110" id=
        !          10830:                 "id2598110"></a>A.1.2.&nbsp;DESCR</h3>
1.1       grant    10831:               </div>
                   10832:             </div>
                   10833:           </div>
                   10834:           <pre class="programlisting">
                   10835: GNU version of yacc.  Can make re-entrant parsers, and numerous other
                   10836: improvements.  Why you would want this when Berkeley <a href=
                   10837: "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
                   10838: of the NetBSD source tree is beyond me.
                   10839: </pre>
                   10840:         </div>
                   10841: 
                   10842:         <div class="sect2" lang="en" xml:lang="en">
                   10843:           <div class="titlepage">
                   10844:             <div>
                   10845:               <div>
1.18    ! xtraeme  10846:                 <h3 class="title"><a name="id2598125" id=
        !          10847:                 "id2598125"></a>A.1.3.&nbsp;PLIST</h3>
1.1       grant    10848:               </div>
                   10849:             </div>
                   10850:           </div>
                   10851:           <pre class="programlisting">
1.17      sketch   10852: @comment $NetBSD$
1.1       grant    10853: bin/bison
                   10854: man/man1/bison.1.gz
                   10855: share/bison.simple
                   10856: share/bison.hairy
                   10857: </pre>
                   10858:         </div>
                   10859: 
                   10860:         <div class="sect2" lang="en" xml:lang="en">
                   10861:           <div class="titlepage">
                   10862:             <div>
                   10863:               <div>
1.18    ! xtraeme  10864:                 <h3 class="title"><a name="id2598133" id=
        !          10865:                 "id2598133"></a>A.1.4.&nbsp;Checking a package with
1.14      xtraeme  10866:                 <span><strong class=
                   10867:                 "command">pkglint</strong></span></h3>
1.1       grant    10868:               </div>
                   10869:             </div>
                   10870:           </div>
                   10871: 
                   10872:           <p>The NetBSD package system comes with <a xmlns=
                   10873:           "http://www.w3.org/TR/xhtml1/transitional" href=
                   10874:           "ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/pkglint/README.html"
1.14      xtraeme  10875:           class="pkgname">pkgtools/pkglint</a> which helps to check
                   10876:           the contents of these files. After installation it is
                   10877:           quite easy to use, just change to the directory of the
                   10878:           package you wish to examine and execute
                   10879:           <span><strong class=
                   10880:           "command">pkglint</strong></span>:</p>
1.1       grant    10881:           <pre class="screen">
1.14      xtraeme  10882: <code class="prompt">$</code> <strong class=
                   10883: "userinput"><code>pkglint</code></strong>
1.1       grant    10884: OK: checking ./DESCR.
                   10885: OK: checking Makefile.
                   10886: OK: checking distinfo.
                   10887: OK: checking patches/patch-aa.
                   10888: looks fine.
                   10889: </pre>
                   10890: 
                   10891:           <p>Depending on the supplied command line arguments (see
                   10892:           pkglint(1)) more verbose checks will be performed. Use
1.14      xtraeme  10893:           e.g. <span><strong class="command">pkglint
                   10894:           -v</strong></span> for a very verbose check.</p>
1.1       grant    10895:         </div>
                   10896:       </div>
                   10897: 
                   10898:       <div class="sect1" lang="en" xml:lang="en">
                   10899:         <div class="titlepage">
                   10900:           <div>
                   10901:             <div>
                   10902:               <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  10903:               "id2598173" id="id2598173"></a>A.2.&nbsp;Steps for
1.1       grant    10904:               building, installing, packaging</h2>
                   10905:             </div>
                   10906:           </div>
                   10907:         </div>
                   10908: 
                   10909:         <p>Create the directory where the package lives, plus any
                   10910:         auxiliary directories:</p>
                   10911:         <pre class="screen">
1.14      xtraeme  10912: <code class="prompt">#</code> <strong class=
                   10913: "userinput"><code>cd /usr/pkgsrc/lang</code></strong>
                   10914: <code class="prompt">#</code> <strong class=
                   10915: "userinput"><code>mkdir bison</code></strong>
                   10916: <code class="prompt">#</code> <strong class=
                   10917: "userinput"><code>cd bison</code></strong>
                   10918: <code class="prompt">#</code> <strong class=
                   10919: "userinput"><code>mkdir patches</code></strong>
1.1       grant    10920: </pre>
                   10921: 
1.14      xtraeme  10922:         <p>Create <code class="filename">Makefile</code>,
                   10923:         <code class="filename">DESCR</code> and <code class=
                   10924:         "filename">PLIST</code> (see <a href="#components" title=
1.1       grant    10925:         "Chapter&nbsp;7.&nbsp;Package components - files, directories and contents">
                   10926:         Chapter 7, <i>Package components - files, directories and
                   10927:         contents</i></a>) then continue with fetching the
                   10928:         distfile:</p>
                   10929:         <pre class="screen">
1.14      xtraeme  10930: <code class="prompt">#</code> <strong class=
                   10931: "userinput"><code>make fetch</code></strong>
1.1       grant    10932: &gt;&gt; bison-1.25.tar.gz doesn't seem to exist on this system.
                   10933: &gt;&gt; Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
                   10934: Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10935: ftp: Error retrieving file: 500 Internal error
                   10936: 
                   10937: &gt;&gt; Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
                   10938: Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10939: ftp: Error retrieving file: 500 Internal error
                   10940: 
                   10941: &gt;&gt; Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
                   10942: Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
                   10943: Successfully retrieved file.
                   10944: </pre>
                   10945: 
1.14      xtraeme  10946:         <p>Generate the checksum of the distfile into <code class=
                   10947:         "filename">distinfo</code>:</p>
1.1       grant    10948:         <pre class="screen">
1.14      xtraeme  10949: <code class="prompt">#</code> <strong class=
                   10950: "userinput"><code>make makesum</code></strong>
1.1       grant    10951: </pre>
                   10952: 
                   10953:         <p>Now compile:</p>
                   10954:         <pre class="screen">
1.14      xtraeme  10955: <code class="prompt">#</code> <strong class=
                   10956: "userinput"><code>make</code></strong>
1.1       grant    10957: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   10958: ===&gt;  Extracting for bison-1.25
                   10959: ===&gt;  Patching for bison-1.25
                   10960: ===&gt;   Ignoring empty patch directory
                   10961: ===&gt;  Configuring for bison-1.25
                   10962: creating cache ./config.cache
                   10963: checking for gcc... cc
                   10964: checking whether we are using GNU C... yes
                   10965: checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
                   10966: checking how to run the C preprocessor... cc -E
                   10967: checking for minix/config.h... no
                   10968: checking for POSIXized ISC... no
                   10969: checking whether cross-compiling... no
                   10970: checking for ANSI C header files... yes
                   10971: checking for string.h... yes
                   10972: checking for stdlib.h... yes
                   10973: checking for memory.h... yes
                   10974: checking for working const... yes
                   10975: checking for working alloca.h... no
                   10976: checking for alloca... yes
                   10977: checking for strerror... yes
                   10978: updating cache ./config.cache
                   10979: creating ./config.status
                   10980: creating Makefile
                   10981: ===&gt;  Building for bison-1.25
                   10982: 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
                   10983: 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
                   10984: 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
                   10985: 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
                   10986: 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
                   10987: 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 
                   10988: 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
                   10989: 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
                   10990: 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
                   10991: 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
                   10992: 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
                   10993: 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
                   10994: 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
                   10995: 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
                   10996: 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
                   10997: 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
                   10998: 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
                   10999: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g warshall.c
                   11000: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g version.c
                   11001: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g getopt.c
                   11002: cc -c -DSTDC_HEADERS=1 -DHAVE_STRING_H=1 -DHAVE_STDLIB_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ALLOCA=1 -DHAVE_STRERROR=1 -I./../include  -g getopt1.c
                   11003: 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
                   11004: ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
                   11005: rm -f bison.s1
                   11006: sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" &lt; ./bison.simple &gt; bison.s1
                   11007: </pre>
                   11008: 
                   11009:         <p>Everything seems OK, so install the files:</p>
                   11010:         <pre class="screen">
1.14      xtraeme  11011: <code class="prompt">#</code> <strong class=
                   11012: "userinput"><code>make install</code></strong>
1.1       grant    11013: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11014: ===&gt;  Installing for bison-1.25
                   11015: sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
                   11016: rm -f /usr/pkg/bin/bison
                   11017: cd /usr/pkg/share; rm -f bison.simple bison.hairy
                   11018: rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
                   11019: install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
                   11020: /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
                   11021: /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
                   11022: cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
                   11023: /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
                   11024: ===&gt;  Registering installation for bison-1.25
                   11025: </pre>
                   11026: 
                   11027:         <p>You can now use bison, and also - if you decide so -
1.14      xtraeme  11028:         remove it with <span><strong class="command">pkg_delete
                   11029:         bison</strong></span>. Should you decide that you want a
                   11030:         binary package, do this now:</p>
1.1       grant    11031:         <pre class="screen">
1.14      xtraeme  11032: <code class="prompt">#</code> <strong class=
                   11033: "userinput"><code>make package</code></strong>
1.1       grant    11034: &gt;&gt; Checksum OK for bison-1.25.tar.gz.
                   11035: ===&gt;  Building package for bison-1.25
                   11036: Creating package bison-1.25.tgz
                   11037: Registering depends:.
                   11038: Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
                   11039: </pre>
                   11040: 
                   11041:         <p>Now that you don't need the source and object files any
                   11042:         more, clean up:</p>
                   11043:         <pre class="screen">
1.14      xtraeme  11044: <code class="prompt">#</code> <strong class=
                   11045: "userinput"><code>make clean</code></strong>
1.1       grant    11046: ===&gt;  Cleaning for bison-1.25
                   11047: </pre>
                   11048:       </div>
                   11049:     </div>
                   11050: 
                   11051:     <div class="appendix" lang="en" xml:lang="en">
                   11052:       <div class="titlepage">
                   11053:         <div>
                   11054:           <div>
                   11055:             <h2 class="title"><a name="logs" id=
                   11056:             "logs"></a>Appendix&nbsp;B.&nbsp;Build logs</h2>
                   11057:           </div>
                   11058:         </div>
                   11059:       </div>
                   11060: 
                   11061:       <div class="toc">
                   11062:         <p><b>Table of Contents</b></p>
                   11063: 
                   11064:         <dl>
                   11065:           <dt><span class="sect1"><a href="#logs.building">B.1.
                   11066:           Building figlet</a></span></dt>
                   11067: 
                   11068:           <dt><span class="sect1"><a href="#logs.package">B.2.
                   11069:           Packaging figlet</a></span></dt>
                   11070:         </dl>
                   11071:       </div>
                   11072: 
                   11073:       <div class="sect1" lang="en" xml:lang="en">
                   11074:         <div class="titlepage">
                   11075:           <div>
                   11076:             <div>
                   11077:               <h2 class="title" style="clear: both"><a name=
                   11078:               "logs.building" id=
                   11079:               "logs.building"></a>B.1.&nbsp;Building figlet</h2>
                   11080:             </div>
                   11081:           </div>
                   11082:         </div>
                   11083:         <pre class="screen">
1.14      xtraeme  11084: <code class="prompt">#</code> <strong class=
                   11085: "userinput"><code>make</code></strong>
1.1       grant    11086: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11087: =&gt; figlet221.tar.gz doesn't seem to exist on this system.
                   11088: =&gt; Attempting to fetch figlet221.tar.gz from ftp://ftp.figlet.org/pub/figlet/program/unix/.
                   11089: =&gt; [172219 bytes]
                   11090: Connected to ftp.plig.net.
                   11091: 220 ftp.plig.org NcFTPd Server (licensed copy) ready.
                   11092: 331 Guest login ok, send your complete e-mail address as password.
                   11093: 230-You are user #5 of 500 simultaneous users allowed.
                   11094: 230-
                   11095: 230-  ___ _             _ _                   
                   11096: 230- |  _| |_ ___   ___| |_|___   ___ ___ ___ 
                   11097: 230- |  _|  _| . |_| . | | | . |_| . |  _| . |
                   11098: 230- |_| |_| |  _|_|  _|_|_|_  |_|___|_| |_  |
                   11099: 230-         |_|   |_|     |___|         |___|
                   11100: 230-
                   11101: 230-** Welcome to ftp.plig.org **
                   11102: 230-
                   11103: 230-Please note that all transfers from this FTP site are logged. If you
                   11104: 230-do not like this, please disconnect now.
                   11105: 230-
                   11106: 230-This arhive is available via
                   11107: 230-
                   11108: 230-HTTP:  http://ftp.plig.org/
                   11109: 230-FTP:   ftp://ftp.plig.org/     (max 500 connections)
                   11110: 230-RSYNC: rsync://ftp.plig.org/   (max  30 connections)
                   11111: 230-
                   11112: 230-Please email comments, bug reports and requests for packages to be
                   11113: 230-mirrored to ftp-admin@plig.org.   
                   11114: 230-
                   11115: 230-
                   11116: 230 Logged in anonymously.
                   11117: Remote system type is UNIX.
                   11118: Using binary mode to transfer files.
                   11119: 200 Type okay.
                   11120: 250 "/pub" is new cwd.
                   11121: 250-"/pub/figlet" is new cwd.
                   11122: 250-
                   11123: 250-Welcome to the figlet archive at ftp.figlet.org
                   11124: 250-    
                   11125: 250-    ftp://ftp.figlet.org/pub/figlet/
                   11126: 250-
                   11127: 250-The official FIGlet web page is:
                   11128: 250-    http://www.figlet.org/
                   11129: 250-
                   11130: 250-If you have questions, please mailto:info@figlet.org. If you want to
                   11131: 250-contribute a font or something else, you can email us.
                   11132: 250 
                   11133: 250 "/pub/figlet/program" is new cwd.
                   11134: 250 "/pub/figlet/program/unix" is new cwd.
                   11135: local: figlet221.tar.gz remote: figlet221.tar.gz
                   11136: 502 Unimplemented command.
                   11137: 227 Entering Passive Mode (195,40,6,41,246,104)
                   11138: 150 Data connection accepted from 84.128.86.72:65131; transfer starting for figlet221.tar.gz (172219 bytes).
                   11139: 38% |**************                       | 65800      64.16 KB/s    00:01 ETA
                   11140: 226 Transfer completed.
                   11141: 172219 bytes received in 00:02 (75.99 KB/s)
                   11142: 221 Goodbye.
                   11143: =&gt; Checksum OK for figlet221.tar.gz.
                   11144: ===&gt; Extracting for figlet-2.2.1nb2
                   11145: ===&gt; Required installed package ccache-[0-9]*: ccache-2.3nb1 found
                   11146: ===&gt; Patching for figlet-2.2.1nb2
                   11147: ===&gt; Applying pkgsrc patches for figlet-2.2.1nb2
                   11148: ===&gt; Overriding tools for figlet-2.2.1nb2
                   11149: ===&gt; Creating toolchain wrappers for figlet-2.2.1nb2
                   11150: ===&gt; Configuring for figlet-2.2.1nb2
                   11151: ===&gt; Building for figlet-2.2.1nb2
                   11152: gcc -O2 -DDEFAULTFONTDIR=\"/usr/pkg/share/figlet\"  -DDEFAULTFONTFILE=\"standard.flf\"  figlet.c zipio.c crc.c inflate.c -o figlet
                   11153: chmod a+x figlet
                   11154: gcc -O2 -o chkfont chkfont.c
                   11155: =&gt; Unwrapping files-to-be-installed.
1.14      xtraeme  11156: <code class="prompt">#</code>
                   11157: <code class="prompt">#</code> <strong class=
                   11158: "userinput"><code>make install</code></strong>
1.1       grant    11159: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11160: ===&gt; Installing for figlet-2.2.1nb2
                   11161: install -d -o root -g wheel -m 755 /usr/pkg/bin
                   11162: install -d -o root -g wheel -m 755 /usr/pkg/man/man6
                   11163: mkdir -p /usr/pkg/share/figlet
                   11164: cp figlet /usr/pkg/bin
                   11165: cp chkfont /usr/pkg/bin
                   11166: chmod 555 figlist showfigfonts
                   11167: cp figlist /usr/pkg/bin
                   11168: cp showfigfonts /usr/pkg/bin
                   11169: cp fonts/*.flf /usr/pkg/share/figlet
                   11170: cp fonts/*.flc /usr/pkg/share/figlet
                   11171: cp figlet.6 /usr/pkg/man/man6
                   11172: ===&gt; Registering installation for figlet-2.2.1nb2
1.14      xtraeme  11173: <code class="prompt">#</code>
1.1       grant    11174: </pre>
                   11175:       </div>
                   11176: 
                   11177:       <div class="sect1" lang="en" xml:lang="en">
                   11178:         <div class="titlepage">
                   11179:           <div>
                   11180:             <div>
                   11181:               <h2 class="title" style="clear: both"><a name=
                   11182:               "logs.package" id=
                   11183:               "logs.package"></a>B.2.&nbsp;Packaging figlet</h2>
                   11184:             </div>
                   11185:           </div>
                   11186:         </div>
                   11187:         <pre class="screen">
1.14      xtraeme  11188: <code class="prompt">#</code> <strong class=
                   11189: "userinput"><code>make package</code></strong>
1.1       grant    11190: ===&gt; Checking for vulnerabilities in figlet-2.2.1nb2
                   11191: ===&gt; Packaging figlet-2.2.1nb2
                   11192: ===&gt; Building binary package for figlet-2.2.1nb2
                   11193: Creating package /home/cvs/pkgsrc/packages/i386/All/figlet-2.2.1nb2.tgz
                   11194: Using SrcDir value of /usr/pkg
                   11195: Registering depends:.  
1.14      xtraeme  11196: <code class="prompt">#</code>
1.1       grant    11197: </pre>
                   11198:       </div>
                   11199:     </div>
                   11200: 
                   11201:     <div class="appendix" lang="en" xml:lang="en">
                   11202:       <div class="titlepage">
                   11203:         <div>
                   11204:           <div>
                   11205:             <h2 class="title"><a name="ftp-layout" id=
                   11206:             "ftp-layout"></a>Appendix&nbsp;C.&nbsp;Layout of the
                   11207:             FTP server's package archive</h2>
                   11208:           </div>
                   11209:         </div>
                   11210:       </div>
                   11211: 
                   11212:       <p>Layout for precompiled binary packages on
                   11213:       ftp.NetBSD.org:</p>
                   11214:       <pre class="programlisting">
                   11215: /pub/NetBSD/packages/
                   11216:                 distfiles/
                   11217: 
                   11218:                 # Unpacked pkgsrc trees
                   11219:                 pkgsrc-current -&gt; /pub/NetBSD/NetBSD-current/pkgsrc
                   11220:                 pkgsrc-2003Q4 -&gt; N/A
                   11221:                 pkgsrc-2004Q1/pkgsrc
                   11222: 
                   11223:                 # pkgsrc archives
                   11224:                 pkgsrc-current.tar.gz -&gt; ../NetBSD-current/tar_files/pkgsrc.tar.gz
                   11225:                 pkgsrc-2003Q4.tar.gz -&gt; N/A
                   11226:                 pkgsrc-2004Q1.tar.gz -&gt; N/A
                   11227: 
                   11228:                 # Per pkgsrc-release/OS-release/arch package archives
                   11229:                 pkgsrc-2003Q4/
                   11230:                         NetBSD-1.6.2/
                   11231:                                 i386/
                   11232:                                         All/
                   11233:                                         archivers/
                   11234:                                                 foo -&gt; ../All/foo
                   11235:                                         ...
                   11236:                 pkgsrc-2004Q1/
                   11237:                         NetBSD-1.6.2/
                   11238:                                 i386/
                   11239:                                         All/
                   11240:                                         ...
                   11241:                         NetBSD-2.0/
                   11242:                                 i386/
                   11243:                                         All/
                   11244:                                         ...
                   11245:                         SunOS-5.9/
                   11246:                                 sparc/
                   11247:                                         All/
                   11248:                                         ...
                   11249:                                 x86/
                   11250:                                         All/
                   11251:                                         ...
                   11252: 
                   11253:                 # Per os-release package archive convenience links
                   11254:                 NetBSD-1.6.2 -&gt; 1.6.2
                   11255:                 1.6.2/
                   11256:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-1.6.2/i386
                   11257:                         m68k/
                   11258:                                 All/
                   11259:                                 archivers/
                   11260:                                         foo -&gt; ../All/foo
                   11261:                                 ...
                   11262:                         amiga -&gt; m68k
                   11263:                         atari -&gt; m68k
                   11264:                         ...
                   11265: 
                   11266:                 2.0 -&gt; NetBSD-2.0       # backward compat, historic
                   11267:                 NetBSD-2.0/
                   11268:                         i386 -&gt; ../pkgsrc-2004Q1/NetBSD-2.0/i386
                   11269:                 SunOS-5.9/
                   11270:                         sparc -&gt; ../pkgsrc-2004Q1/SunOS-5.9/sparc
                   11271:                         x86 -&gt; ../pkgsrc-2004Q1/SunOS-5.9/x86
                   11272:                         
                   11273: </pre>
                   11274: 
                   11275:       <p>To create:</p>
                   11276: 
                   11277:       <div class="orderedlist">
                   11278:         <ol type="1">
                   11279:           <li>
                   11280:             <p>Run bulk build, see <a href="#bulkbuild" title=
                   11281:             "5.3.&nbsp;Doing a bulk build of all packages">Section
                   11282:             5.3, &#8220;Doing a bulk build of all
                   11283:             packages&#8221;</a></p>
                   11284:           </li>
                   11285: 
                   11286:           <li>
                   11287:             <p>Upload /usr/pkgsrc/packages to</p>
                   11288:             <pre class="programlisting">
                   11289:     ftp://ftp.NetBSD.org/pub/NetBSD/packages/\
1.13      hubertf  11290:         pkgsrc-2004Q4/\                         # pkgsrc-branch
1.1       grant    11291:         `uname -s`-`uname -r`/                  # OS &amp; version
                   11292:         `uname -p`                              # architecture
                   11293:        
                   11294: </pre>
                   11295:           </li>
                   11296: 
                   11297:           <li>
1.14      xtraeme  11298:             <p>If necessary, create a symlink <span><strong class=
                   11299:             "command">ln -s `uname -m` `uname -p`</strong></span>
                   11300:             (amiga -&gt; m68k, ...)</p>
1.1       grant    11301:           </li>
                   11302:         </ol>
                   11303:       </div>
                   11304:     </div>
1.2       hubertf  11305: 
                   11306:     <div class="appendix" lang="en" xml:lang="en">
                   11307:       <div class="titlepage">
                   11308:         <div>
                   11309:           <div>
                   11310:             <h2 class="title"><a name="editing" id=
                   11311:             "editing"></a>Appendix&nbsp;D.&nbsp;Editing guidelines
                   11312:             for the pkgsrc guide</h2>
                   11313:           </div>
                   11314:         </div>
                   11315:       </div>
                   11316: 
                   11317:       <div class="toc">
                   11318:         <p><b>Table of Contents</b></p>
                   11319: 
                   11320:         <dl>
1.18    ! xtraeme  11321:           <dt><span class="sect1"><a href="#id2599093">D.1.
1.2       hubertf  11322:           Targets</a></span></dt>
                   11323: 
1.18    ! xtraeme  11324:           <dt><span class="sect1"><a href="#id2599163">D.2.
1.2       hubertf  11325:           Procedure</a></span></dt>
                   11326:         </dl>
                   11327:       </div>
                   11328: 
                   11329:       <p>This section contains information on editing the pkgsrc
                   11330:       guide itself.</p>
                   11331: 
                   11332:       <div class="sect1" lang="en" xml:lang="en">
                   11333:         <div class="titlepage">
                   11334:           <div>
                   11335:             <div>
                   11336:               <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  11337:               "id2599093" id="id2599093"></a>D.1.&nbsp;Targets</h2>
1.2       hubertf  11338:             </div>
                   11339:           </div>
                   11340:         </div>
                   11341: 
1.14      xtraeme  11342:         <p>The pkgsrc guide's source code is stored in <code class=
                   11343:         "filename">pkgsrc/doc/guide/files</code>, and several files
1.2       hubertf  11344:         are created from it:</p>
                   11345: 
                   11346:         <div class="itemizedlist">
                   11347:           <ul type="disc">
                   11348:             <li>
1.14      xtraeme  11349:               <p><code class=
                   11350:               "filename">pkgsrc/doc/pkgsrc.txt</code>, which
                   11351:               replaces <code class=
                   11352:               "filename">pkgsrc/Packages.txt</code></p>
1.2       hubertf  11353:             </li>
                   11354: 
                   11355:             <li>
1.14      xtraeme  11356:               <p><code class=
                   11357:               "filename">pkgsrc/doc/pkgsrc.html</code></p>
1.2       hubertf  11358:             </li>
                   11359: 
                   11360:             <li>
1.14      xtraeme  11361:               <p><code class=
                   11362:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/</code>:
1.2       hubertf  11363:               the documentation on the NetBSD website will be built
                   11364:               from pkgsrc and kept up to date on the web server
                   11365:               itself. This means you <span class=
                   11366:               "emphasis"><em>must</em></span> make sure that your
                   11367:               changes haven't broken the build!</p>
                   11368:             </li>
1.6       hubertf  11369: 
                   11370:             <li>
1.14      xtraeme  11371:               <p><code class=
                   11372:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.pdf</code>:
1.6       hubertf  11373:               PDF version of the pkgsrc guide.</p>
                   11374:             </li>
                   11375: 
                   11376:             <li>
1.14      xtraeme  11377:               <p><code class=
                   11378:               "filename">http://www.NetBSD.org/Documentation/pkgsrc/pkgsrc.ps</code>:
1.6       hubertf  11379:               PostScript version of the pkgsrc guide.</p>
                   11380:             </li>
1.2       hubertf  11381:           </ul>
                   11382:         </div>
                   11383:       </div>
                   11384: 
                   11385:       <div class="sect1" lang="en" xml:lang="en">
                   11386:         <div class="titlepage">
                   11387:           <div>
                   11388:             <div>
                   11389:               <h2 class="title" style="clear: both"><a name=
1.18    ! xtraeme  11390:               "id2599163" id=
        !          11391:               "id2599163"></a>D.2.&nbsp;Procedure</h2>
1.2       hubertf  11392:             </div>
                   11393:           </div>
                   11394:         </div>
                   11395: 
                   11396:         <p>The procedure to edit the pkgsrc guide is:</p>
                   11397: 
                   11398:         <div class="itemizedlist">
                   11399:           <ul type="disc">
                   11400:             <li>
1.6       hubertf  11401:               <p>Make sure you have the packages needed to
                   11402:               re-generate the pkgsrc guide (and other XML-based
                   11403:               NetBSD documentation) installed. These are
1.11      ben      11404:               &#8220;<span class="quote">netbsd-doc</span>&#8221;
1.6       hubertf  11405:               for creating the ASCII- and HTML-version, and
                   11406:               &#8220;<span class=
1.11      ben      11407:               "quote">netbsd-doc-print</span>&#8221;for the
1.6       hubertf  11408:               PostScript- and PDF version. You will need both
                   11409:               packages installed, to make sure documentation is
                   11410:               consistent across all formats. The packages can be
1.14      xtraeme  11411:               found in <code class=
                   11412:               "filename">pkgsrc/meta-pkgs/netbsd-doc</code> and
                   11413:               <code class=
                   11414:               "filename">pkgsrc/meta-pkgs/netbsd-doc-print</code>.</p>
1.6       hubertf  11415:             </li>
                   11416: 
                   11417:             <li>
1.14      xtraeme  11418:               <p>Edit the XML file(s) in <code class=
                   11419:               "filename">pkgsrc/doc/guide/files</code>.</p>
1.2       hubertf  11420:             </li>
                   11421: 
                   11422:             <li>
1.14      xtraeme  11423:               <p>Run <span><strong class="command">make extract
                   11424:               &amp;&amp; make do-lint</strong></span> in
                   11425:               <code class="filename">pkgsrc/doc/guide</code> to
                   11426:               check the XML syntax, and fix it if needed.</p>
1.4       hubertf  11427:             </li>
                   11428: 
                   11429:             <li>
1.14      xtraeme  11430:               <p>Run <span><strong class=
                   11431:               "command">make</strong></span> in <code class=
                   11432:               "filename">pkgsrc/doc/guide</code> to build the HTML
                   11433:               and ASCII version.</p>
1.2       hubertf  11434:             </li>
                   11435: 
                   11436:             <li>
1.14      xtraeme  11437:               <p>If all is well, run <span><strong class=
                   11438:               "command">make install-doc</strong></span> to put the
                   11439:               generated files into <code class=
                   11440:               "filename">pkgsrc/doc</code>.</p>
1.2       hubertf  11441:             </li>
                   11442: 
                   11443:             <li>
1.14      xtraeme  11444:               <p><span><strong class="command">cvs commit
                   11445:               pkgsrc/doc/guide/files</strong></span></p>
1.2       hubertf  11446:             </li>
                   11447: 
                   11448:             <li>
1.14      xtraeme  11449:               <p><span><strong class="command">cvs commit -m
                   11450:               re-generate
                   11451:               pkgsrc/doc/pkgsrc.{html,txt}</strong></span></p>
1.2       hubertf  11452:             </li>
1.4       hubertf  11453: 
                   11454:             <li>
                   11455:               <p>Until the webserver on www.NetBSD.org is really
                   11456:               updated automatically to pick up changes to the
1.14      xtraeme  11457:               pkgsrc guide automatically, also run
1.18    ! xtraeme  11458:               <span><strong class="command">make install-htdocs
1.14      xtraeme  11459:               HTDOCSDIR=../../../htdocs</strong></span> (or
                   11460:               similar, adjust <code class=
                   11461:               "varname">HTDOCSDIR</code>!).</p>
1.4       hubertf  11462:             </li>
                   11463: 
                   11464:             <li>
1.14      xtraeme  11465:               <p><span><strong class="command">cvs commit
                   11466:               htdocs/Documentation/pkgsrc</strong></span></p>
1.4       hubertf  11467:             </li>
1.2       hubertf  11468:           </ul>
                   11469:         </div>
                   11470:       </div>
                   11471:     </div>
1.1       grant    11472:   </div>
                   11473: </body>
                   11474: </html>

CVSweb <webmaster@jp.NetBSD.org>