Merge from vendor branch TNF:
[pkgsrcv2.git] / Packages.txt
1 # $NetBSD: Packages.txt,v 1.93 2000/07/01 20:12:03 hubertf Exp $
2 ###########################################################################
3
4                         ==========================
5                            Documentation on the
6                            NetBSD Package System
7                         ==========================
8
9                       Hubert Feyrer, Alistair Crooks
10
11
12 Table of contents:
13 ==================
14
15  grep -B1 '^.====' Packages.txt | egrep -v '^.[-=]'
16
17
18  0 Intro
19  ========
20
21 There is a lot of software freely available for Unix based systems, which
22 usually runs on NetBSD, too, sometimes with some modifications. The NetBSD
23 packages collection incorporates any such changes necessary to make that
24 software run on NetBSD, and makes the installation (and reinstallation) of
25 the software package easy by means of a single command.
26
27 The NetBSD package system is used to enable such freely available
28 third-party software to be built easily on NetBSD hosts. Once the software
29 has been built, it is manipulated with the pkg_* tools so that installation
30 and de-installation, printing of an inventory of all installed packages and
31 retrieval of one-line comments or more verbose descriptions are all simple.
32
33 Both the NetBSD packages collection and the NetBSD package system are
34 derived from FreeBSD.
35
36
37  0.1 Overview
38  =============
39
40 This document is divided into two parts.  The first, "User's Guide",
41 describes how one can use one of the packages in the Package
42 Collection, either by installing a precompiled binary package, or by
43 building your own copy using the NetBSD package system.  The second
44 part, "Package Constructor's Guide", explains how to prepare a package so
45 it can be easily built by other NetBSD users without knowing about the
46 package's building details.
47
48
49  0.2 Terminology
50  ===============
51
52 There has been a lot of talk about "ports", "packages", etc. so far. Here
53 is a description of all the terminology used within this document:
54
55  * Package:
56    A set of files and building instructions that describe what's necessary
57    to build a certain piece of software using the NetBSD package
58    system. Packages are traditionally stored under /usr/pkgsrc.
59
60  * The NetBSD package system:
61    This is the part of the NetBSD operating system handling building
62    (compiling), installing, and removing of packages.
63
64  * Distfile:
65    This term describes the file or files that are provided by the author
66    of the piece of freely available software to distribute his work. All
67    the changes necessary to build on NetBSD are reflected in the
68    corresponding package. Usually the distfile is in the form of a
69    compressed tar-archive, but other types are possible, too. Distfiles
70    are stored below /usr/pkgsrc/distfiles.
71
72  * Port:
73    This is the term used by FreeBSD people for what we call a package.
74    In NetBSD terminology, "port" refers to a different architecture.
75
76  * Precompiled (binary) package:
77    A set of binaries built by the NetBSD package system from a distfile
78    using the NetBSD package system and stuffed together in a single .tgz
79    file so it can be installed on machines of the same machine architecture
80    without the need to recompile. Packages are generated in
81    /usr/pkgsrc/packages by the NetBSD package system; there is also an
82    archive on ftp.netbsd.org.
83
84    Sometimes, this is referred to by the term "package" too,
85    especially in the context of precompiled packages.
86
87  * Program:
88    The piece of software to be installed which will be constructed from
89    all the files in the Distfile by the actions defined in the
90    corresponding package. 
91
92  * NetBSD RCS IDs:
93    Some files in a package contain RCS IDs to reflect which version of
94    that file this is (inserted automatically by cvs). These IDs are used
95    in several examples within this document, but as this document itself
96    is managed by CVS, it can't list the RCS IDs in plaintext. Instead, the
97    $s are written as <$>, resulting in <$>NetBSD<$> and <$>Id<$>.
98
99
100 ====================
101 Part I: User's Guide
102 ====================
103
104  1 Installing a precompiled binary package
105  =========================================
106
107 This section describes how to find, retrieve and install a precompiled
108 binary package that someone else already prepared for your type of machine.
109
110
111  1.1 Where to get
112  ================
113
114 Precompiled packages are stored on ftp.netbsd.org and its mirrors in the
115 directory /pub/NetBSD/packages for anon FTP access. Please pick the right
116 subdirectory there as indicated by "sysctl hw.machine_arch". In that
117 directory, there is a subdirectory for each category plus a subdirectory
118 "All" which includes the actual binaries in .tgz-files. The category
119 subdirectories use symbolic links to those files. (This is the same
120 directory layout as in /usr/pkgsrc/packages).
121
122 This same directory layout applies for CDROM distributions, only that the
123 directory may be rooted somewhere else, probably somewhere below /cdrom.
124 Please consult your CDROM's documentation for the exact location!
125
126
127  1.2 How to use
128  ==============
129
130 If you have the files on a CDROM or downloaded them to your hard disk, you
131 can install them with the following command (be sure to su to root first):
132
133         pkg_add /path/to/package.tgz
134
135 If you have FTP access and you don't want to download the packages via FTP
136 prior to installation, you can do this automatically by giving pkg_add an
137 ftp-URL:
138
139         pkg_add ftp://ftp.netbsd.org/pub/NetBSD/packages/<OS Ver>/<arch>/All/package.tgz
140
141 If there is any doubt, the sysctl utility can be used to determine the
142 <OS Ver>, and <arch> by running "sysctl kern.osrelease hw.machine_arch".
143
144 Also note that any prerequisite packages needed to run the package in
145 question will be installed, too, assuming they are present where you install
146 from.
147
148 After you've installed packages, be sure to have /usr/pkg in your $PATH so
149 you can actually start the just installed program.
150
151
152  1.3 A word of warning
153  =====================
154
155 Please pay very careful attention to the warnings expressed in that manual
156 page about the inherent dangers of installing binary packages which you did
157 not create yourself, and the security holes that can be introduced onto
158 your system by indiscriminate adding of such files.
159
160
161  2 Installing by Building
162  ========================
163
164 This assumes that the package is already part of the NetBSD package system.
165 If it is not, then you are advised to read part II of this document,
166 "Package Constructor's Guide".
167
168
169  2.1 Where to get pkgsrc
170  =======================
171
172 To get the package source going, you need to get the pkgsrc.tar.gz file
173 from ftp://ftp.netbsd.org/pub/NetBSD-current/tar_files/pkgsrc.tar.gz and
174 unpack it into /usr/pkgsrc.
175
176 As an alternative, you can get pkgsrc via the Software Update Protocol,
177 SUP. To do so, make sure your supfile has a line saying "release=pkgsrc" in
178 it, see the examples in /usr/share/examples/supfiles, and that the
179 directory /usr/pkgsrc does exist. Then, simply start "sup -v
180 /path/to/your/supfile".
181
182
183  2.2 Fetching distfiles
184  ======================
185
186 There is one gotcha: The distribution file (i.e. the unmodified source)
187 must exist on your system for the packages system to be able to build it.
188 If it does not, then ftp(1) is used to fetch the distribution files
189 automatically.
190
191 You can overwrite some of the major distribution sites to fit to sites
192 that are close to your own. Have a look at /usr/pkgsrc/mk/mk.conf.example
193 to find some examples. This may save some of your bandwidth and time.
194
195 When you have selected your settings, install your configuration into
196 /etc/mk.conf
197
198 If you don't have a permanent Internet connection and you want to know
199 which files to download, "make fetch-list" will tell you what you'll need.
200 Put these distfiles into /usr/pkgsrc/distfiles.
201
202
203  2.3 How to build and install
204  ============================
205
206 Assuming that has been done, become root and change into the relevant
207 directory. Then you can type
208
209         make
210
211 at the shell prompt to build the various components of the package, and
212
213         make install
214
215 at the shell prompt to install the various components into the correct
216 places on your system.
217
218 Taking the top system utility as an example, we can install it on our
219 system by building as shown in appendix A.1.
220
221 The program is installed under the default root of the packages tree -
222 /usr/pkg. Should this not conform to your tastes, simply set the LOCALBASE
223 variable in your environment, and it will use that value as the root of
224 your packages tree. So, to use /usr/local, set
225
226         LOCALBASE=/usr/local
227
228 in your environment.  There is, of course, one exception to this - X11
229 packages are traditionally installed in the X11 tree. The definition
230 used to identify the root of the X11 tree is the X11BASE definition.
231
232 It is possible to install X11 packages in the LOCALBASE tree, for
233 which you must install the xpkgwedge package
234 (pkgsrc/pkgtools/xpkgwedge) - see section 7.1 for further details.
235
236 Some packages look in /etc/mk.conf to alter some configuration options
237 at build time.  Have a look at /usr/pkgsrc/mk/mk.conf.example to get
238 an overview of what you can set there.  Environment variables such as
239 LOCALBASE, and X11BASE can also be set in /etc/mk.conf to save having
240 to remember to set them each time you want to use pkgsrc.
241
242
243  3 Making a precompiled package
244  ==============================
245
246 Once you have built and installed the package as mentioned above, you can
247 build it into a "binary package" - you might want to do this so that you
248 can use the binaries you have just built on another NetBSD system, or to
249 provide a simple means for others to use your binary package instead of
250 wasting CPU time - this is done by changing to the appropriate directory in
251 the pkgsrc tree, and typing the command
252
253         make package
254
255 at the shell prompt. This will build and install your package (if not
256 already done), and then construct a binary package out of the results so
257 that you can use the pkg_* tools to manipulate this. The binary package is
258 stored under /usr/pkgsrc/packages, it's in the form of a gzipped file at
259 the present time. See appendix A.2 for a continuation of the above top
260 example.
261
262 Please see the "submitting" section later in this document on how to submit
263 such a binary package.
264
265
266 ====================================
267 Part II: Package Constructor's Guide
268 ====================================
269
270  4 Package components - files, directories and contents
271  ======================================================
272
273 Whenever you're preparing a package from the FreeBSD ports collection or
274 doing it from scratch, there are a number of files involved which are
275 described in the following sections. Special directions are given for what
276 differs from FreeBSD ports for each file.
277
278
279  4.1 Makefile
280  ============
281
282 Building, installation and creation of a binary package are all controlled
283 by the package's Makefile.
284
285 There is a Makefile for each package. This file includes the standard
286 bsd.pkg.mk file (referenced as "../../mk/bsd.pkg.mk"), which sets all the
287 definitions and actions necessary for the package to compile and install
288 itself. The mandatory fields are the DISTNAME which specifies the base name
289 of the distribution file to be downloaded from the site on the Internet,
290 MASTER_SITES which specifies that site, CATEGORIES which denotes the
291 categories into which the package falls, PKGNAME which is the name of the
292 package and the MAINTAINER name. This is so that anyone who quibbles with
293 the (always completely correct) decisions taken by the guy who maintains
294 the port can complain vigorously.
295
296 The MASTER_SITES may be set to one of the predefined sites:
297
298         ${MASTER_SITE_XCONTRIB}
299         ${MASTER_SITE_GNU}
300         ${MASTER_SITE_PERL_CPAN}
301         ${MASTER_SITE_TEX_CTAN}
302         ${MASTER_SITE_SUNSITE}
303
304 If one of these predefined sites is chosen, you may require the ability to
305 specify a subdirectory of that site.  Since these macros may expand to
306 more than one actual site, you MUST use the following construct to specify
307 a subdirectory:
308
309         ${MASTER_SITE_GNU:=subdirectory/name/}
310
311 (Note the trailing slash after the subdirectory name.) Use of the deprecated
312 MASTER_SITE_SUBDIR will not work.
313
314 Currently the following values are available for CATEGORIES. If more than
315 one is used, they need to be separated by spaces:
316
317         archivers   databases   ham         net         security
318         audio       devel       japanese    news        shells
319         benchmarks  distfiles   lang        packages    sysutils
320         biology     editors     mail        parallel    templates
321         cad         emulators   math        pkglocate   textproc
322         comms       fonts       mbone       pkgtools    www
323         converters  games       meta-pkgs   plan9       x11
324         cross       graphics    misc        print
325
326 See the NetBSD packages(7) manual page for a description of all available
327 options and variables.
328
329 Please pay attention to the following gotchas, especially when preparing a
330 package from the FreeBSD ports collection:
331
332  - Remove all MANx and CATx definitions from the package Makefile -
333    NetBSD has implemented automatic manual page handling, and these
334    definitions are now obsolete.
335  - Add MANCOMPRESSED (if not already there) if manpages are installed in
336    compressed form by the package; see comment in bsd.pkg.mk
337  - Replace /usr/local by ${PREFIX} in all files  (see patches below)
338  - Delete any ldconfig commands - this will be done automatically for you
339    if the NetBSD platform supports ldconfig, and other measures will be
340    taken on platforms which do not support ldconfig (e.g. NetBSD/Alpha)
341  - If modifying a package from the FreeBSD ports collection, preserve
342    their RCS ID: remove the '$'s around the FreeBSD RCS Id, and insert the
343    word FreeBSD, then add a <$>NetBSD<$> (Without the <>s, please remember
344    the Terminology section), i.e.:
345
346    before:
347         # <$>Id: Makefile,v 1.17 1997/06/16 06:39:51 max Exp <$>
348
349    after:
350         # <$>NetBSD<$>
351         # FreeBSD Id: Makefile,v 1.17 1997/06/16 06:39:51 max Exp
352  - If the package installs any info files, the main info directory file
353    needs to be updated to reflect this fact. NetBSD now has an INFO_FILES
354    definition, which is used to do this. For example, to install the
355    indent.info entry into the info directory file, simply use the
356
357         INFO_FILES=     indent.info
358
359    definition in the package Makefile. If the package does this insertion
360    for you, you should specify USE_GTEXINFO in the package Makefile, to
361    ensure that the pre-requisite GNU texinfo package is installed on your
362    system.
363  - Adjust MAINTAINER to be either yourself, if you plan to maintain the
364    package for future updates, or set it to the default MAINTAINER
365    packages@netbsd.org, as it is unlikely that the FreeBSD people will
366    care about NetBSD packages.
367  - If there exists a home page for the software in question, please
368    add the variable HOMEPAGE right after MAINTAINER. The value of this
369    variable should be the URL for the home page.
370
371  4.2 files/*
372  ===========
373
374  * files/md5:
375    Most important, the mandatory md5 checksum of all the distfiles needed for
376    the package to compile, confirming they match the original file any patches
377    were generated against. This ensures that the distfile retrieved from the
378    Internet has not been corrupted during transfer or altered by a malign force
379    to introduce a security hole. It can be generated by hand using the md5(1)
380    command or by invoking "make makesum".
381
382  * files/patch-sum:
383    The checksum file for all the official patches for the package, found in the
384    patches/ directory (see section 4.3). This checksum file includes an MD5
385    checksum of all lines in the patch file except the NetBSD RCS Id. This file
386    is generated by invoking "make makepatchsum".
387
388 Besides that, if you have any files that you wish to be placed in the
389 package prior to configuration or building, you could place these files
390 here and use a ${CP} command in the pre-configure target to achieve this.
391 Alternatively, you could simply diff the file against /dev/null and use the
392 patch mechanism to manage the creation of this file.
393
394
395  4.3 patches/*
396  =============
397
398 This directory contains files that are used by the patch(1) command to
399 modify the sources as distributed in the distribution file into a form that
400 will compile and run perfectly on NetBSD. The files are applied
401 successively in alphabetic order (as returned by a shell "patches/patch-*"
402 glob expansion), so patch-aa is applied before patch-ab etc.
403
404 The patch-?? files should be in diff -bu format, and apply without
405 a fuzz to avoid problems. (The latter condition is ensured by
406 setting PKG_DEVELOPER in /etc/mk.conf - the build will fail if a
407 patch applies with fuzz only).  Furthermore, do not put changes
408 for more than one file into a single patch-file, as this will make
409 future modifications more difficult.
410
411 One important thing to mention is to pay attention that no RCS IDs get
412 stored in the patch files, as these will cause problems when later checked
413 into the NetBSD CVS tree. To avoid this, use the "-U 2" or -U 1" option to
414 diff.
415
416 If you don't want to worry about the problems in the last two paragraphs
417 yourself, use pkgdiff from the pkgtools/pkgdiff package, which takes care
418 of any RCS Ids by itself.
419
420 For even more automation, we recommend using mkpatches from the same
421 package to make a whole set of patches. You just have to backup files
422 before you edit them to "filename.orig", e.g. with "cp -p filename
423 filename.orig". If you upgrade a package this way, you can easily compare
424 the new set of patches with the previously existing one with patchdiff.
425
426 When preparing a FreeBSD port for the NetBSD packages system, it's likely
427 that the FreeBSD port will work on NetBSD. However, check that the person
428 who ported the software to FreeBSD has not played fast and loose with the
429 __FreeBSD__ cpp definition without good cause - a simple way to do this is
430 to do
431
432         grep -i freebsd patches/patch-??
433
434 in the package directory.
435
436 Besides taking care of any FreeBSDisms, be sure to provide patches to
437 replace any occurrence of /usr/local in any "Makefile"s in the original
438 package with ${PREFIX}.
439
440 When you have finished a package, remember to generate the checksums
441 for the patch files by using the "make makepatchsum" command, see
442 section 4.2.
443
444
445  4.4 pkg/*
446  =========
447
448 This directory contains several files used to manage the creation of binary
449 packages. Files from this directory are used in the binary package itself,
450 and will thus be installed on other machines, so you should be aware that
451 there is a wider audience than you might think for your comments and
452 witticisms.
453
454  4.4.1 Mandatory files
455  =====================
456
457  * pkg/COMMENT:
458    A one-line description of the piece of software. There is no need to
459    mention the package's name - this will automatically be added by the
460    pkg_* tools when they are invoked.
461
462  * pkg/DESCR:
463    A multi-line description of the piece of software.  This should include
464    any credits where they are due.  Please bear in mind that others do not
465    share your sense of humour (or spelling idiosyncrasies), and that others
466    will read everything that you write here.
467
468  * pkg/PLIST:
469    This file governs the files that are installed on your system: all the
470    binaries, manual pages, etc. There are other directives which may be
471    entered in this file, to control the creation and deletion of
472    directories, and the location of inserted files.
473
474 If you're updating a FreeBSD package to work for NetBSD, please pay special
475 attention to the following things in pkg/PLIST:
476
477  - If there are any "@exec ldconfig ..." statements, or any "@unexec
478    ldconfig ...", delete them. NetBSD works out automatically whether to
479    call ldconfig, since some NetBSD architectures do not have ldconfig.
480  - Add any missing @dirrm statements
481  - Remove any MANx= definitions in the package Makefile
482
483 You could also investigate the port2pkg package (pkgsrc/pkgtools/port2pkg),
484 which does a lot of the donkey work for you.
485
486
487  4.4.2 Optional files
488  ====================
489
490  * pkg/INSTALL:
491    Shell script invoked twice during pkg_add. First time after package
492    extraction and before files are moved in place, the second time after
493    the files to install are moved in place. This can be used to do any
494    custom procedures not possible with @exec commands in PLIST. See
495    pkg_add(1) and pkg_create(1) for more information.
496
497  * pkg/DEINSTALL:
498    This script is executed before and after any files are removed.  It is
499    this script's responsibility to clean up any additional messy details
500    around the package's installation, since all pkg_delete knows is how to
501    delete the files created in the original distribution. See pkg_delete(1)
502    and pkg_create(1) for more information.
503
504  * pkg/REQ:
505    Require-script that is invoked before installation and de-installation
506    to ensure things like certain accounts being available, user/sysadmin
507    agreeing with usage policy, etc.
508
509  * pkg/MESSAGE
510    Display this file after installation of the package.
511    Useful for things like legal notices on almost-free software,
512    etc.
513
514
515  4.5 scripts/*
516  =============
517
518 This directory contains any files that are necessary for configuration of
519 your software, etc. If a script with any of the following names is present,
520 it will be executed at the appropriate time during the build process:
521
522   pre-fetch          post-fetch
523   pre-extract        post-extract
524   pre-patch          post-patch
525   pre-configure      post-configure     configure
526   pre-build          post-build
527   pre-install        post-install
528   pre-package        post-package
529
530 Note that you should NOT define a pre-* or post-* target in the Makefile
531 which executes the matching scripts/[pre|post]-* script. bsd.pkg.mk runs
532 any existing Makefile target first, then searches for scripts/* and runs
533 it using sh(1). Running the script from the Makefile would cause it to
534 be run twice.
535
536 See section 7 for a description of the build process.
537
538
539  4.6 work/*
540  ==========
541
542 When you type "make" the distribution files are unpacked into this
543 directory.  It can be removed by typing
544
545         make clean
546
547 at the shell prompt. Also, this directory is used to keep various
548 timestamp files. 
549
550
551  4.7 importing the package into CVS
552  ==================================
553
554 Newly created packages should be imported with a vendor tag of "TNF" and
555 a release tag of "pkgsrc-base", e.g::
556
557         cvs import pkgsrc/<category>/frobnitz TNF pkgsrc-base
558
559 Packages derived from a FreeBSD port should be imported with a vendor tag
560 of "FREEBSD" and a release tag of "FreeBSD-current-YYYY-MM-DD" (YYYY-MM-DD
561 being the date when the snapshot of the port were taken form the FreeBSD
562 tree), and then doing the necessary modifications by normal CVS operations.
563 E.g:
564
565         cvs import pkgsrc/<category>/mumbler FREEBSD FreeBSD-current-1998-04-01
566         cvs rm patches/patch-a
567         cvs add patches/patch-aa
568         cvs ci
569
570 Please note all package updates/additions in doc/pkg-CHANGES! It's very
571 important to keep this file up to date and conforming to the existing
572 format, because it will be used by scripts to automatically update pages on
573 www.netbsd.org.
574
575
576  5 PLIST* issues
577  ===============
578
579 This section addresses some special issues that one needs to pay attention
580 to when dealing with the PLIST file (or files, see below!).
581
582
583  5.1 Miscellaneous
584  =================
585
586  * NetBSD RCS Id:
587    Be sure to add a RCS ID line as the first thing in any PLIST file you
588    write:
589
590         @comment <$>NetBSD<$>
591
592  * ranlib:
593    Don't put any ranlib commands into your PLIST files, as they will cause
594    troubles when the package is removed. Just make sure the build-process
595    does run ranlib - it usually does - and you can leave this out. This is
596    usually only a problem when using ports from FreeBSD.
597
598  * ldconfig:
599    Don't put any ldconfig commands into your PLIST files, as they will
600    cause problems.  All shared object caching is done automatically in
601    NetBSD (this takes place when you see the "Automatic shared object
602    handling" message), and so you can leave this out.  If any shared
603    objects are found in the package, they will be dealt with
604    automatically, running ldconfig on platforms which need it, and not
605    otherwise.  This is usually only a problem when using ports from
606    FreeBSD.
607
608  * ${MACHINE_ARCH}, ${MACHINE_GNU_ARCH}:
609    Some packages like emacs and perl embed information about which
610    architecture they were built on into the pathnames where they install
611    their file. To handle this case, PLIST will be preprocessed before
612    actually used, and the symbol "${MACHINE_ARCH}" will be replaced by
613    what "sysctl -n hw.machine_arch" gives. The same is done if the string
614    ${MACHINE_GNU_ARCH} is embedded in PLIST somewhere - use this on
615    packages that use GNU autoconfigure.
616
617    Legacy note: There used to be a symbol "<$ARCH>" that was replaced by
618    the output of "uname -m", but that's no longer supported and has been
619    removed.
620
621  * ${OPSYS}, ${OS_VERSION}:
622    Some packages want to embed the OS name and version into some paths.
623    to do this, use these two variables in PLIST. ${OPSYS} will be replaced
624    by output from "uname -s", ${OS_VERSION} will be set to what "uname -r"
625    gives.
626
627  * Manpage-compression:
628    Manpages should be installed in compressed form if MANZ is set (in
629    bsd.own.mk), and uncompressed otherwise. To handle this in the PLIST
630    file, the suffix ".gz" is appended/removed automatically for manpages
631    according to MANZ and MANCOMPRESSED being set or not, see above for
632    details. This modification of the PLIST file is done on a copy of it,
633    not pkg/PLIST itself.
634
635  * Semi-automatic PLIST generation:
636    You can use the "make print-PLIST" command to output a PLIST that matches
637    any new files since the package was extracted. If the package installs
638    files via tar(1) or other methods that don't update file access times, be
639    sure to add these files manually to your pkg/PLIST!
640
641
642  5.2 MD/MI vs. general PLIST
643  ===========================
644
645 Sometimes the packaging list in pkg/PLIST differs between platforms, e.g.
646 if one of them supports shared libs and the other does not. To address
647 this, a hook has been introduced into the NetBSD packages system to provide
648 a PLIST file defined on conditions set freely in the package's Makefile.
649
650
651  5.2.1 $PLIST_SRC
652  ================
653
654 To use one or more files as source for the PLIST used in generating the
655 binary package, set the variable PLIST_SRC to the names of that file(s).
656 The files are later concatenated using cat(1), and order of things is an
657 important issue, see below.
658
659
660  5.2.2 PLIST-mi, PLIST-md.shared, PLIST-md.static
661  ================================================
662
663 If PLIST_SRC is not set (the usual case), and if there is no pkg/PLIST, the
664 packages system looks for pkg/PLIST-mi, and pkg/PLIST-md.shared or
665 pkg/PLIST-md.static to handle differences due to the platform being able to
666 handle shared libs or not. PLIST-mi contains machine independent files,
667 PLIST-md.* contain machine dependent files, which may differ between
668 architectures that don't support dynamic libs/shared loading. Currently,
669 this is only used in the perl-packages, and as perl5 on alpha doesn't
670 support dynamic loading of extensions like perl/Tk yet, PLIST.mi-static is
671 also used on the alpha (besides pmax and powerpc). Alpha will hopefully be
672 removed soon when perl's fixed for dynamic loading.
673
674 (This handling of MI/MD PLIST files is implemented by setting PLIST_SRC to
675 either "PLIST-mi PLIST-md.static" or "PLIST-mi PLIST-md.shared", see
676 /usr/pkgsrc/mk/bsd.pkg.mk).
677
678
679  5.2.3 Order in the PLIST* file(s)
680  =================================
681
682 There is one gotcha regarding the ordering of @dirrm statements: any MI
683 @dirrm directives that follow any MD @dirrm's *must* go into the PLIST.md-*
684 files, as the files PLIST-mi and PLIST.md-{shared/static} are concatenated
685 in exactly this order. If the MI directory would be listed in PLIST-mi, it
686 would be removed before the MD directory, which wouldn't work.
687
688 E.g. if you have the following dirs:
689         foo/mi
690         foo/mi/md
691
692 then PLIST-mi contains:
693         <nothing>
694
695 and PLIST-md.* contain:
696         @dirrm foo/mi/md
697         @dirrm foo/mi
698
699 This will lead to some @dirrm statements being duplicated, but it's the
700 only way to ensure everything is properly removed. The same care must be
701 taken when PLIST_SRC is set to some package-specific settings.
702   
703
704  6 Notes on fixes for packages
705  =============================
706
707  6.1 CPP defines
708  ===============
709
710 To port an application to NetBSD, it's usually necessary for the compiler
711 to be able to judge the system on which it's compiling, and we use
712 definitions so that the C pre-processor can do this.
713
714 The really impatient should just note that a number of the FreeBSD ports
715 (which are called packages in the NetBSD world) rely on the CPP definition
716 __FreeBSD__. This should be used sparingly, for FreeBSD-specific features,
717 but unfortunately this is not always the case. A number also rely on the
718 fact that the CPU type is an Intel-based little-endian CPU.
719
720 To test whether you are working on a 4.4 BSD-derived system, you should use
721 the BSD definition, which is defined in <sys/param.h> on said systems.
722
723         #include <sys/param.h>
724
725 and then you can surround the BSD-specific parts of your port using the
726 conditional:
727
728         #if (defined(BSD) && BSD >= 199306)
729         ...
730         #endif
731
732 Please use the __NetBSD__ definition sparingly - it should only apply to
733 features of NetBSD that are not present in other 4.4-lite derived BSDs.
734
735 You should also avoid defining __FreeBSD__=1 and then simply using the
736 FreeBSD port, if only from an aesthetic viewpoint.
737
738
739  6.2 Shared libraries - libtool
740  ==============================
741
742 NetBSD supports many different machines, with different object formats
743 like a.out and ELF, and varying abilities to do shared library and
744 dynamic loading at all. To accompany this, varying commands and options
745 have to be passed to the compiler, linker etc. to get the Right Thing,
746 which can be pretty annoying especially if you don't have all the
747 machines at your hand to test things.  The "libtool" pkg can help
748 here, as it just "knows" how to build both static and dynamic
749 libraries from a set our source files, thus being platform
750 independent. 
751
752 Here's how to use libtool in a pkg in six simple steps:
753
754 1. Add USE_LIBTOOL= yes to the package Makefile.
755
756 2. For library objects, use "${LIBTOOL} --mode=compile ${CC}" in place of
757    ${CC}.  You could even add it to the definition of CC, if only
758    libraries are being built in a given Makefile.  This one command will
759    build both PIC and non-PIC library objects, so you need not have
760    separate shared and non-shared library rules.
761
762 3. For the linking of the library, remove any "ar", "ranlib", and "ld
763    -Bshareable" commands, and use instead:
764
765         ${LIBTOOL} --mode=link cc -o ${.TARGET:.a=.la} ${OBJS:.o=.lo} -rpath ${PREFIX}/lib -version-info major:minor
766
767    Note that the library is changed to have a .la extension, and the
768    objects are changed to have a .lo extension.  Change OBJS as necessary.
769    This automatically creates all of the .a, .so.major.minor, and ELF
770    symlinks (if necessary) in the build directory.
771
772 4. When linking programs that depend on these libraries _before_ they are
773    installed, preface the cc or ld line with "${LIBTOOL} --mode=link", and
774    it will find the correct libraries (static or shared), but please be
775    aware that libtool will not allow you to specify a relative path in -L
776    (such as -L../somelib), because it is trying to force you to change
777    that argument to be the .la file.  For example:
778
779         ${LIBTOOL} --mode=link ${CC} -o someprog -L../somelib -lsomelib
780
781    won't work; it needs to be changed to:
782
783         ${LIBTOOL} --mode=link ${CC} -o someprog ../somelib/somelib.la
784
785    and it will DTRT with the libraries.  If you *must* use a relative path 
786    with -L, and you are not going to run this program before installing
787    it, you can omit the use of libtool during link and install of this
788    program if you add the subdirectory ".libs" in your -L command:
789
790         ${CC} -o someprog -L../somelib/.libs -lsomelib
791
792 5. When installing libraries, preface the install or cp command with
793    "${LIBTOOL} --mode=install", and change the library name to .la.  For
794    example:
795
796         ${LIBTOOL} --mode=install ${BSD_INSTALL_DATA} ${SOMELIB:.a=.la} ${PREFIX}/lib
797
798    This will install the static .a, shared library, any needed symlinks,
799    and run "ldconfig."
800
801 6. In your PLIST, include the .a, .la, and .so.major.minor files.  Don't
802    include the ELF symlink files; those are automatic. 
803
804 Do not use pkglibtool!  Previously, the package system used its
805 own version of libtool from pkgtools.  However, over time, this
806 version became outdated and is now deprecated.  You may see some
807 definitions of USE_PKGLIBTOOL in existing packages that still use
808 this outdated version of libtool.  Please do not use this definition
809 in new packages!
810
811  6.3 Using libtool on GNU packages that already support libtool
812  ==============================================================
813
814 Add USE_LIBTOOL=yes and LTCONFIG_OVERRIDE=${WRKSRC}/ltconfig to the
815 package Makefile as the quick way to bypass the pkg's own libtool.
816 The pkg's own libtool is made by ltconfig script at do-configure target.
817 If USE_LIBTOOL and LTCONFIG_OVERRIDE are defined, the specified ltconfig is
818 overridden, using the devel/libtool instead of the pkg's own libtool.
819 If the pkg already has an original "libtool" which we can replace with
820 devel/libtool you may have to specify LIBTOOL_OVERRIDE to the package
821 Makefile.
822
823  6.4 Gotchas of FreeBSD ports
824  ============================
825
826 See section 4.1 for Makefile issues (MANx, CATx, MANCOMPRESSED, ldconfig,
827 RCS IDs) and section 4.3 for gotchas on using patches from FreeBSD ports.
828
829 One of the biggest problems with FreeBSD ports is that too many of
830 them assume they will install into /usr/local, instead of honouring
831 any ${PREFIX} setting properly.  To change this, add something like the
832 following into your package Makefile:
833
834 pre-configure:
835         for f in `find ${WRKDIR} -type f -print|xargs grep -l '/usr/local'`; do
836 \
837                 ${SED} -e 's:/usr/local:'${PREFIX}':g' < $$f > $$f.pdone && ${MV} $
838 $f.pdone $$f; \
839         done
840
841 This is taken from the sysutils/rtty package; be sure this works for your
842 package - it may actually make sense to look for some things in /usr/local,
843 for example. So don't blindly replace all occurrences of /usr/local!
844
845 FreeBSD has decided to list manual pages in the package Makefile, with
846 no corresponding entry in the PLIST.  You will thus need to add any
847 MAN[1-8ln] files to the PLIST, before deleting the MAN[1-8ln]
848 definition.  Similarly with MLINKS and CAT[1-8ln] entries.
849
850 Side note on manpages in PLIST:  we don't take any notice of any .gz
851 suffix there, as many FreeBSD ports seem to have .gz pages in PLIST
852 even when they install manpages without compressing them; rather, we
853 add our own .gz suffix there according to MANZ.  In short, it does not
854 matter whether the manual page name in the PLIST has a .gz suffix or
855 not - if it needs one which is not already there, it will be appended
856 automatically, and if there is a .gz suffix which is not needed, it
857 will be deleted automatically.
858
859 Some packages use bsd-style .mk files when building, and so any manual
860 pages that are installed will be gzip-compressed, if MANZ is set, or
861 not if MANZ is not set.  If the package uses bsd-style .mk files, the
862 variable MANCOMPRESSED_IF_MANZ should be set to a value of "yes" in
863 the package Makefile.
864
865
866  6.5 Feedback to the author
867  ==========================
868
869 If you have found any bugs in the package you make available, if you had to
870 do special steps to make it run under NetBSD or if you enhanced the software
871 in various other ways, be sure to report these changes back to the original
872 author of the program! With that kind of support, the next release of the
873 program can incorporate these fixes, and people not using the NetBSD packages
874 system can win from your efforts.
875
876 Support the idea of free software!
877
878
879  7 The build process
880  ===================
881
882 The basic steps for building a program are always the same.  First the
883 program's source (distfile) must be brought to the local system and
884 then extracted.  After any patches to compile properly on NetBSD are
885 applied, the software can be configured, then built (usually by
886 compiling), and finally the generated binaries etc.  can be put into
887 place on the system.  These are exactly the steps performed by the
888 NetBSD package system, which is implemented as a series of targets in
889 a central Makefile, /usr/pkgsrc/mk/bsd.pkg.mk.
890
891
892  7.1 Program location
893  ====================
894
895 Before outlining the process performed by the NetBSD package system in the
896 next section, here's a brief discussion on where programs are installed,
897 and which variables influence this.
898
899 The automatic variable PREFIX indicates where all files of the final
900 program shall be installed.  It is usually set to $LOCALBASE (/usr/pkg),
901 or $CROSSBASE for pkgs in the "cross" category, though its value becomes
902 that of $X11BASE if USE_IMAKE, USE_MOTIF, or USE_X11BASE is set.  The value
903 ${PREFIX} needs to be put into the various places in the program's source
904 where paths to these files are encoded; see sections 4.3 and 6.2 for
905 details on this.
906
907 When choosing which of these variables to use, follow the following rules:
908
909  * ${PREFIX} always points to the location where the current pkg will be
910    installed.  When referring to a pkg's own installation path, use ${PREFIX}.
911
912  * ${LOCALBASE} is where all non-X11 pkgs are installed.  If you need to
913    construct a -I or -L argument to the compiler to find includes and
914    libraries installed by another non-X11 pkg, use ${LOCALBASE}.
915
916  * ${X11BASE} is where the actual X11 distribution is installed.  When looking
917    for _standard_ X11 includes (not those installed by a pkg), use ${X11BASE}.
918
919  * X11 based pkgs are special in that they may be installed in either
920    X11BASE or LOCALBASE. To install X11 packages in LOCALBASE, simply
921    install the xpkgwedge package (pkgsrc/pkgtools/xpkgwedge).
922    If you need to find includes or libraries installed by a pkg that has
923    USE_IMAKE, USE_MOTIF, or USE_X11BASE in its pkg Makefile, you need to use
924    _both_ ${X11BASE} and ${LOCALBASE}.
925
926  * ${X11BASE} points to the root of the installed X11 tree. To refer to the
927    installed location of an X11 package, use the ${X11PREFIX} definition (this
928    will be ${X11BASE} if xpkgwedge is not installed, and ${LOCALBASE} if
929    xpkgwedge is installed).
930
931
932  7.2 Main targets
933  ================
934
935 The main targets used during the build process defined in bsd.pkg.mk are:
936
937  * fetch:
938    This will check if the file(s) given in the variables DISTFILES and
939    PATCHFILES (as defined in the package's Makefile) are present on the
940    local system in /usr/pkgsrc/distfiles. If they are not present, they
941    will be fetched using ftp(1) from the site(s) given in the variable
942    PATCH_SITES. The location(s) in PATCH_SITES are in the form of URLs
943    and can be ftp://- and http://-URLs, as ftp(1) understands both of
944    them.
945
946  * checksum:
947    After the distfile(s) are fetched, their MD5 checksum is generated and
948    compared with the checksums stored in the files/md5 file. If the
949    checksums don't match, the build is aborted. This is to ensure the same
950    distfile is used for building, and that the distfile wasn't changed,
951    e.g. by some malign force, deliberately changed distfiles on the master
952    distribution site or network lossage. 
953
954  * extract:
955    When the distfiles are present on the local system, they need to be
956    extracted, as they are usually in the form of some compressed archive
957    format, most commonly .tar.gz. If only some of the distfiles need to be
958    uncompressed, the files to be uncompressed should be put into
959    EXTRACT_ONLY. If the distfiles are not in .tar.gz format, they can be
960    extracted by setting EXTRACT_CMD, EXTRACT_BEFORE_ARGS and/or
961    EXTRACT_AFTER_ARGS. 
962
963  * patch:
964    After extraction, all the patches named by the PATCHFILES and those
965    present in the patches subdirectory of the package are applied. 
966    Patchfiles ending in .Z or .gz are uncompressed before they are
967    applied, files ending in .orig or .rej are ignored.  Any special
968    options to patch(1) can be handed in PATCH_DIST_ARGS.  See section
969    4.3 for more details.
970    
971    If PKG_DEVELOPER is set in /etc/mk.conf, patch is given special args
972    to make it fail if the patches with some lines of fuzz. Please fix
973    (regen) the patches so that they apply cleanly. The rationale behind
974    this is that patches that apply cleanly may end up being applied in the
975    wrong place, and cause severe harm there.
976
977  * configure:
978    Most pieces of software need information on the header files,
979    system calls, and library routines which are available in NetBSD. 
980    This is the process known as configuration, and is usually
981    automated.  In most cases, a script is supplied with the source,
982    and its invocation results in generation of header files,
983    Makefiles, etc.
984
985    If the program doesn't come with its own configure script, one can be
986    placed in the package's scripts directory, called "configure". If so, it
987    is executed using sh(1).
988
989    If the program's distfile contains its own configure script, this can
990    be invoked by setting HAS_CONFIGURE. If the configure script is a GNU
991    autoconf script, GNU_CONFIGURE should be specified instead. In either
992    case, any arguments to the configure script can be specified in the
993    CONFIGURE_ARGS variable, and the configure script's name can be set in
994    CONFIGURE_SCRIPT if it differs from the default "configure".
995
996    If the program uses an Imakefile for configuration, the appropriate
997    steps can be invoked by setting USE_IMAKE to YES. (If you only want the
998    package installed in $X11PREFIX but xmkmf not being run, set USE_X11BASE
999    instead!)
1000
1001  * build:
1002    Once configuration has taken place, the software can be built on
1003    NetBSD by invoking $MAKE_PROGRAM on $MAKEFILE with $ALL_TARGET as
1004    the target to build.  The default MAKE_PROGRAM is "gmake" if
1005    USE_GMAKE is set, "make" otherwise.  MAKEFILE is set to "Makefile"
1006    by default, and ALL_TARGET defaults to "all".  Any of these
1007    variables can be set to change the default build process.
1008
1009  * install:
1010    Once the build stage has completed, the final step is to install
1011    the software in public directories, for users.  As in the
1012    build-target, $MAKE_PROGRAM is invoked on $MAKEFILE here, but with
1013    the $INSTALL_TARGET instead, the latter defaulting to "install"
1014    (plus "install.man", if USE_IMAKE is set). 
1015
1016 If no target is specified, the default is "build". If a subsequent stage
1017 is requested, all prior stages are made: e.g. "make build" will also
1018 perform the equivalent of:
1019
1020         make fetch
1021         make checksum
1022         make extract
1023         make patch
1024         make configure
1025         make build
1026
1027
1028  7.3 Other helpful targets
1029  =========================
1030
1031  * pre/post-*
1032    For any of the main targets described in the previous section, two
1033    auxiliary targets exist with "pre-" and "post-" used as a prefix
1034    for the main target's name.  These targets are invoked before and
1035    after the main target is called, allowing extra configuration or
1036    installation steps, for example, which program's configure script
1037    or install target omitted.  For any of these auxiliary targets,
1038    scripts of the same name can be placed in the package's
1039    scripts-subdirectory that will be executed at the given time, see
1040    section 4.5.
1041
1042  * do-*:
1043    Should one of the main targets do the wrong thing, and should there
1044    be no variable to fix this, you can redefine it with the do-*
1045    target.  (Note that redefining the target itself instead of the
1046    do-* target is a bad idea, as the pre-* and post-* targets won't be
1047    called anymore, etc.) You will not usually need to do this.
1048
1049  * reinstall:
1050    If you did a "make install" and you noticed some file was not installed
1051    properly, you can repeat the installation with this target, which will
1052    ignore the "already installed" flag. 
1053
1054  * deinstall:
1055    This target does a pkg_delete(1) in the current directory,
1056    effectively de-installing the package. The following variables can
1057    be used either on the command line or in /etc/mk.conf to tune the
1058    behaviour: 
1059
1060     - PKG_VERBOSE:
1061       Add a "-v" to the pkg_delete(1) command.
1062       
1063     - DEINSTALLDEPENDS:
1064       Remove all packages that require (depend on) the given package.
1065       This can be used to remove any packages that may have been pulled in
1066       by a given package, e.g. if "make deinstall DEINSTALLDEPENDS=1" is
1067       done in x11/kde, this is likely to remove whole KDE. Works by adding
1068       a "-R" to the pkg_delete command line.
1069
1070  * update:
1071    This target causes the current package to be updated to the latest
1072    version.  The package and all depending packages first get deinstalled,
1073    then current versions of the corresponding packages get compiled and
1074    installed.  This is similar to manually noting which packages are
1075    currently installed, then performing a series of "make deinstall" and
1076    and "make install" (or whatever DEPENDS_TARGET is set to) for these
1077    packages.
1078
1079    You can use the "update" target to resume package updating in case a
1080    previous "make update" was interrupted for some reason.  However, in
1081    this case, make sure you don't call "make clean" or otherwise remove
1082    the list of dependent packages in ${WRKDIR}.  Otherwise you lose the
1083    ability to automatically update the current package along with the
1084    dependent packages you have installed.
1085
1086    Resuming an interrupted 'make update' will only work as long as the
1087    package tree remains unchanged.  If the source code for one of the
1088    packages to be updated has been changed, resuming 'make update' will
1089    most certainly fail!
1090
1091    The following variables can be used either on the command line or in
1092    /etc/mk.conf to alter the behaviour of "make update":
1093
1094     - DEPENDS_TARGET:
1095       Install target to use for the updated package and the
1096       dependent packages.  Defaults to "install".  E.g.
1097       "make update DEPENDS_TARGET=package"
1098
1099     - NOCLEAN:
1100       Don't clean up after updating.  Useful if you want to leave the
1101       work sources of the updated packages around for inspection or
1102       other purposes.  Be sure you eventually clean up the source
1103       tree (see the "clean-update" target below) or you may run into
1104       troubles with old source code still lying around on your next
1105       "make" or "make update".
1106
1107     - REINSTALL:
1108       Use "reinstall" instead of ${DEPENDS_TARGET} for every package
1109       that gets updated.  Be sure you know the implications of using
1110       the "reinstall" target when using this variable.
1111
1112  * clean-update:
1113    Clean the source tree for all packages that would get updated if
1114    "make update" was called from the current directory.  This target
1115    should not be used if the current package (or any of its depending
1116    packages) have already been deinstalled (e.g., after calling "make
1117    update") or you may lose some packages you intended to update.
1118    As a rule of thumb: only use this target _before_ the first time
1119    you call "make update" and only if you have a dirty package tree
1120    (e.g., if you used NOCLEAN).  The following variables can be used
1121    either on the command line or in /etc/mk.conf to alter the behaviour
1122    of "make clean-update":
1123
1124     - CLEAR_DIRLIST:
1125       After "make clean", do not reconstruct the list of directories to
1126       update for this package.  Only use this if "make update" successfully
1127       installed all packages you wanted to update.  Normally, this is done
1128       automatically on "make update", but may have been suppressed by the
1129       NOCLEAN variable (see above).
1130
1131  * readme:
1132    This target generates a README.html file, which can be viewed using a
1133    browser such as netscape (pkgsrc/www/mozilla) or lynx (pkgsrc/www/lynx).
1134    The generated files contain references to any packages which are in the
1135    ${PACKAGES} directory on the local host.  The generated files can
1136    be made to refer to URLs based on FTP_PKG_URL_HOST and
1137    FTP_PKG_URL_DIR.  (For example, if I wanted to generate README.html
1138    files which pointed to binary packages on the local machine, in the
1139    directory /usr/packages, set FTP_PKG_URL_HOST=file://localhost and
1140    FTP_PKG_URL_DIR=/usr/packages. The ${PACKAGES} directory and its
1141    subdirectories will be searched for all the binary packages.)
1142
1143  * readme-all: 
1144    Use this target to create a file README-all.html which contains a
1145    list of all packages currently available in the NetBSD Packages
1146    Collection, together with the category they belong to and a short
1147    description. This file is compiled from the pkgsrc/*/README.html
1148    files, so be sure to run this _after_ a "make readme".
1149
1150  * cdrom-readme:
1151    This is very much the same as the readme: target (see above), but is
1152    to be used when generating a pkgsrc tree to be written to a CD-ROM.
1153    This target also produces README.html files, and can be made to refer
1154    to URLs based on CDROM_PKG_URL_HOST and CDROM_PKG_URL_DIR.
1155
1156  * show-distfiles:
1157    This target shows which distfiles and patchfiles are needed to build
1158    the package. (DISTFILES and PATCHFILES, but not patches/*)
1159
1160  * show-downlevel:
1161    This target shows nothing if the package is not installed. If a version
1162    of this package is installed, but is not the version provided in this
1163    version of pkgsrc, then a warning message is displayed. This target can
1164    be used to show which of your installed packages are downlevel, and so
1165    the old versions can be deleted, and the current ones added.
1166
1167  * show-pkgsrc-dir:
1168    This target shows the directory in the pkgsrc hierarchy from which the
1169    package can be built and installed. This may not be the same directory
1170    as the one from which the package was installed. This target is intended
1171    to be used by people who may wish to upgrade many packages on a single
1172    host, and can be invoked from the top-level pkgsrc Makefile by using the
1173    target "show-host-specific-pkgs"
1174
1175  * check-shlibs:
1176    After a package is installed, check all it's binaries and (on ELF 
1177    platforms) shared libraries if they find the shared libs they need.
1178    Run by default if PKG_DEVELOPER is set in /etc/mk.conf.
1179
1180
1181  8 Debugging
1182  ===========
1183
1184 To check out all the gotchas when building a package (wither from
1185 a FreeBSD port, or from scratch), here are the steps that I do in
1186 order to get a package working. Please note this is basically the
1187 same as what was explained in the previous sections, only with some
1188 debugging aids.
1189
1190  - Make sure PKG_DEVELOPER=1 is in /etc/mk.conf
1191  - Retrieve port from FreeBSD collection
1192  - Fix RCS-ID in the package's Makefile, see section 4.1. 
1193  - Import unchanged FreeBSD source (ONLY if you have cvs access, not needed
1194    otherwise):
1195    (cd .../pkgsrc/category/pkgname ; cvs import pkgsrc/category/pkgname \
1196         FREEBSD FreeBSD-current-yyyy-mm-dd)
1197  - If you did a CVS import, check it out to apply the following fixes
1198    (not needed if you don't have CVS access!)
1199  - Look at Makefile, fix if necessary; see section 4.1. 
1200  - Look at patches, remember if not appropriate
1201  - Have a look at pkg/PLIST, add a "@comment <$>NetBSD<$>" line at the
1202    beginning of any PLIST file (see section 5). 
1203  - make
1204  - If something is not ok, fix; for patches: fix the file, then re-generate
1205    the diff: 'diff -bu foo.orig foo >../../patches/patch-xx' (mv patch-xx
1206    patch-xx.orig before); If there's no foo.orig from a previous patch, be
1207    sure to have an old version of the file somewhere; re-iterate :)
1208  - If all builds OK: touch /tmp/bla
1209  - make install
1210  - find /usr/pkg/ /usr/X11R6/ -newer /tmp/bla >/tmp/x
1211    (or whatever you set LOCALBASE and X11BASE to)
1212  - pkg_delete blub
1213  - find /usr/pkg/ /usr/X11R6/ -newer /tmp/bla (or diff against output of
1214    'make print-PLIST'): if this brings up any files, that are missing in
1215    pkg/PLIST*; add them.
1216  - Compare pkg/PLIST* against /tmp/x, fix the former one
1217    ( sort /tmp/x >/tmp/x2 ; sort pkg/PLIST >/tmp/P ; sdiff /tmp/x2 /tmp/P )
1218  - make reinstall && make package
1219  - pkg_delete blub
1220  - "find /usr/pkg/ /usr/X11R6/ -type f -newer /tmp/bla" shouldn't find anything
1221    now
1222  - pkg_add .../blub.tgz
1223  - Play with it :)
1224  - pkg_delete - still no file should be left (re-run above find)
1225  - make clean && touch /tmp/bla && make install && make clean && make deinstall
1226    then run the find again. Yes, some software authors write Makefiles that
1227    install files during the build target. Sigh. Re-run the find, and fix the
1228    PLIST. Repeat until certain the software does not install any files that
1229    aren't in PLIST.
1230  - submit (or commit, if you have cvs access); see section 10.
1231
1232
1233  9 FAQs & features of the package system
1234  =======================================
1235
1236  9.1 Packages using GNU autoconfig
1237  9.2  Other distrib methods than .tar.gz
1238  9.3  Packages not creating their own subdirectory
1239  9.4  Custom configuration process
1240  9.5  Packages not building in their DISTNAME directory
1241  9.6  How to fetch all distfiles at once
1242  9.7  How to fetch files from behind a firewall
1243  9.8  If your patch contains an RCS ID
1244  9.9  How to pull in variables from /etc/mk.conf
1245  9.10 Is there a mailing list for pkg-related discussion?
1246  9.11 How do i tell "make fetch" to do passive FTP?
1247  9.12 Dependencies on other packages
1248  9.13 Conflicts with other packages
1249  9.14 Software which has a WWW Home Page
1250  9.15 How to handle modified distfiles with the 'old' name
1251
1252
1253  9.1 Packages using GNU autoconfig
1254  =================================
1255
1256 If your package uses GNU autoconf, add the following to your package's
1257 Makefile:
1258
1259 > GNU_CONFIGURE= yes
1260
1261 Note that this appends --prefix=${PREFIX} to CONFIGURE_ARGS, so you don't
1262 have to do that yourself, and this may not be what you want.
1263
1264
1265  9.2 Other distrib methods than .tar.gz
1266  ======================================
1267
1268 If your package uses a different distribution method from .tar.gz, take a
1269 look at the package for plan9/sam, which uses a gzipped shell archive
1270 (shar), but the quick solution is to set EXTRACT_SUFX to the name after the
1271 DISTNAME field, and add the following to your package's Makefile:
1272
1273 > EXTRACT_SUFX=   .msg.gz
1274 > EXTRACT_CMD=            zcat
1275 > EXTRACT_BEFORE_ARGS=
1276 > EXTRACT_AFTER_ARGS=     |sh
1277
1278
1279  9.3 Packages not creating their own subdirectory
1280  ================================================
1281
1282 Your package doesn't create a subdirectory for itself (like GNU software
1283 does, for instance), but extracts itself in the current directory: see
1284 plan9/sam again, but the quick answer is:
1285
1286 > NO_WRKSUBDIR=   yes
1287
1288
1289  9.4 Custom configuration process
1290  ================================
1291
1292 Your package uses a weird Configure script: See the top package, but the
1293 quick answer is:
1294
1295 > HAS_CONFIGURE=          yes
1296 > CONFIGURE_SCRIPT=       Configure
1297 > CONFIGURE_ARGS+=        netbsd13
1298
1299
1300  9.5 Packages not building in their DISTNAME directory
1301  ======================================================
1302
1303 Your package builds in a different directory from its base DISTNAME - see
1304 tcl and tk packages:
1305
1306 > WRKSRC=         ${WRKDIR}/${DISTNAME}/unix
1307
1308
1309  9.6 How to fetch all distfiles at once
1310  ======================================
1311
1312 You would like to download all the distfiles in a single batch from work or
1313 university, where you can't run a "make fetch". But there's no archive of
1314 the distfiles on ftp.netbsd.org and the one on ftp.freebsd.org contains
1315 many distfiles for which there are no ports (yet).
1316
1317 The answer here is to do a "make fetch-list" in /usr/pkgsrc and use the
1318 resulting list.
1319
1320
1321  9.7 How to fetch files from behind a firewall
1322  =============================================
1323
1324 If you are sitting behind a firewall which does not allow direct connections
1325 to Internet hosts (i.e. non-NAT), you may specify the relevant proxy hosts.
1326 This is done using an environment variable in the form of a URL
1327 e.g. in Amdahl, the machine orpheus.amdahl.com is one of the firewalls, and
1328 it uses port 80 as the proxy port number. So the proxy environment
1329 variables look like:
1330
1331         ftp_proxy=ftp://orpheus.amdahl.com:80/
1332         http_proxy=http://orpheus.amdahl.com:80/
1333
1334
1335  9.8 If your patch contains an RCS ID
1336  ====================================
1337
1338 See section 4.3 on how to remove RCS IDs from patch files. 
1339
1340
1341  9.9 How to pull in variables from /etc/mk.conf
1342  ==============================================
1343
1344 The problem with package-defined variables that can be overridden via
1345 MAKECONF or /etc/mk.conf is that make(1) expands a variable as it is
1346 used, but evaluates preprocessor like statements (.if, .ifdef and
1347 .ifndef) as they are read.  So, to use any variable (which may be set
1348 in /etc/mk.conf) in one of the .if* statements, the file /etc/mk.conf
1349 must be included before that .if* statement.
1350
1351 Rather than have a number of ad-hoc ways of including /etc/mk.conf,
1352 should it exist, or MAKECONF, should it exist, include the
1353 pkgsrc/mk/bsd.prefs.mk file in the package Makefile before any
1354 preprocessor-like .if, .ifdef, or .ifndef statements:
1355
1356         .include "../../mk/bsd.prefs.mk"
1357
1358         .if defined(USE_MENUS)
1359         ...
1360         .endif
1361
1362
1363  9.10 Is there a mailing list for pkg-related discussion?
1364  ========================================================
1365
1366 Yes. We are using tech-pkg@netbsd.org for discussing package related
1367 issues. To subscribe do:
1368
1369     echo subscribe tech-pkg | mail majordomo@netbsd.org
1370
1371
1372  9.11 How do i tell "make fetch" to do passive FTP?
1373  ==================================================
1374
1375 This depends on which utility is used to retrieve distfiles. From
1376 bsd.pkg.mk, FETCH_CMD is assigned the first available command from the
1377 following list:
1378
1379 /usr/bin/fetch
1380 ${LOCALBASE}/bsd/bin/ftp
1381 /usr/bin/ftp
1382
1383 On a default NetBSD install, this will be /usr/bin/ftp, which automatically
1384 tries passive connections first, and falls back to active connections if the
1385 server refuses to do passive. For the other tools, add the following to your
1386 /etc/mk.conf file: PASSIVE_FETCH=1
1387
1388 Having that option present will prevent /usr/bin/ftp from falling back to
1389 active transfers.
1390
1391
1392  9.12 Dependencies on other packages
1393  ===================================
1394
1395 Your package may depend on some other package being present - and there are
1396 various ways of expressing this dependency. NetBSD supports the
1397 BUILD_DEPENDS and DEPENDS definitions (beware: the DEPENDS definition is
1398 not the same as FreeBSD's deprecated one, and NetBSD does not use the
1399 FreeBSD LIB_DEPENDS definition any more - it proved problematic on ELF
1400 NetBSD platforms).
1401
1402 [In the following examples, the BUILD_DEPENDS dependencies have the format:
1403 <file>:<directory containing package to build>[:<stage>] If the <stage>
1404 isn't specified, it defaults to ``install''. If the file contains a '/', it
1405 is interpreted as a regular file - otherwise, the name is taken to be an
1406 executable file, and the PATH is searched for <file>. If the regular file
1407 is not found, or the executable file is not in the path, then the
1408 pre-requisite package will be built from the sources in <directory
1409 containing the package to build>. The DEPENDS definition specifies a
1410 package name (which contains its version number), and the directory
1411 containing the package to build if this version of the package is not
1412 installed.]
1413
1414 (a) If your package needs files from another package to build, see the
1415 print/ghostscript5 package (it relies on the jpeg sources being
1416 present in source form during the build):
1417
1418 BUILD_DEPENDS+=  ../../graphics/jpeg/${WRKDIR:T}/jpeg-6a:../../graphics/jpeg:extract
1419
1420 (b) If your package needs to use another package to build itself, this
1421 is specified using the BUILD_DEPENDS definition, but without
1422 specifying the stage ``:extract'' in (a) above.  An example is the
1423 print/lyx package, which uses the latex binary during its build
1424 process:
1425
1426 BUILD_DEPENDS+=  latex:../../print/teTeX
1427
1428 (c) If your package needs a library with which to link, this is
1429 specified using the DEPENDS definition.  An example of this is the
1430 print/lyx package, which uses the xpm library, version 3.4j to build.
1431
1432 DEPENDS+=       xpm-3.4j:../../graphics/xpm
1433
1434 You can also use wildcards in package dependences:
1435
1436 DEPENDS+=       xpm-*:../../graphics/xpm
1437
1438 Note that such wildcard dependencies are retained when creating
1439 binary package. The dependency is checked when installing the binary
1440 package and any package which matches the pattern would be used.
1441 Beware that wildard dependencies should be used with a bit of care.
1442 Simple example for package which needs some version of Tk installed,
1443 but doesn't care which exactly - dependency
1444
1445 DEPENDS+=       tk-*:../../x11/tk80
1446
1447 would also match e.g. tk-postgresql-6.5.3, which is not what was
1448 needed. ALWAYS ensure that the wildcard doesn't match more than it should.
1449
1450 (d) If your package needs some executable to be able to run correctly, this
1451 is specified using the DEPENDS definition. The print/lyx package needs to
1452 be able to execute the latex binary from the teTex package when it runs,
1453 and that is specified:
1454
1455 DEPENDS+=        teTex-*:../../print/teTeX 
1456
1457 The comment about wildcard dependencies from previous paragraph
1458 applies here, too.
1459
1460
1461  9.13 Conflicts with other packages
1462  ==================================
1463
1464 Your package may conflict with other packages a user might already have
1465 installed on his system, e.g. if your package installs the same set of
1466 files like another package in our pkgsrc tree.
1467
1468 In this case you can set CONFLICTS to a space separated list of packages
1469 (including version string) your package conflicts with.
1470
1471 For example pkgsrc/x11/Xaw3d and pkgsrc/x11/Xaw-Xpm install provide the
1472 same shared library, thus you set in pkgsrc/x11/Xaw3d/Makefile:
1473
1474 CONFLICTS=      Xaw-Xpm-*
1475
1476 and in pkgsrc/x11/Xaw-Xpm/Makefile:
1477
1478 CONFLICTS=      Xaw3d-*
1479
1480 Packages will automatically conflict with other packages with the name prefix
1481 and a different version string. "Xaw3d-1.5" e.g. will automatically conflict
1482 with the older version "Xaw3d-1.3".
1483
1484  9.14 Software which has a WWW Home Page
1485  =======================================
1486
1487 The NetBSD packages system now supports a variable called HOMEPAGE.
1488 If the software being packaged has a home page, the Makefile should
1489 include the URL for that page in the HOMEPAGE variable. The definition
1490 of the variable should be placed immediately after the MAINTAINER
1491 variable.
1492
1493  9.15 How to handle modified distfiles with the 'old' name
1494  =========================================================
1495
1496 Sometimes authors of a software package make some modifications after the
1497 software was released, and they put up a new distfile without changing the
1498 package's version number. If a package is already in pkgsrc at that time, 
1499 the md5 checksum will no longer match. The correct way to work around this
1500 is to update the package's md5 checksum to match the package on the master
1501 site (beware, any mirrors may not be up to date yet!), and to remove the 
1502 old distfile from ftp.netbsd.org's /pub/NetBSD/packages/distfiles directory.
1503 Furthermore, a mail to the package's author seems appropriate making sure
1504 the distfile was really updated on purpose, and that no trojan horse or so
1505 crept in.
1506
1507  9.16 What does "Don't know how to make /usr/share/tmac/tmac.andoc" mean?
1508  ========================================================================
1509
1510 When compiling the pkgsrc/pkgtools/pkg_install package, you get the error
1511 from make that it doesn't know how to make /usr/share/tmac/tmac.andoc? This
1512 indicates that you don't have installed the "text" set on your machine
1513 (nroff, ...). Please do that.
1514
1515  9.17 How to handle incrementing versions when fixing an existing package
1516  ========================================================================
1517
1518 When making fixes to an existing package it can be useful to change
1519 the version number in PKGNAME. To avoid conflicting with future versions
1520 by the original author, use a 'nb1' suffix (later versions should
1521 increment this to give 'nb2' and so on).
1522
1523  9.18 "Could not find bsd.own.mk" - what's wrong?
1524  ================================================
1525
1526 You didn't install the compiler set, comp.tgz, when you installed your
1527 NetBSD machine. Please get it and install it, by extracting it in /:
1528
1529         tar --unlink -pvxf .../comp.tgz
1530
1531 comp.tgz is part of every NetBSD release, please get the one matching 
1532 the release you have installed (determine via "uname -r").
1533
1534
1535  10 Submitting
1536  =============
1537
1538  * precompiled binary packages:
1539    Our policy is that we accept binaries from only NetBSD developers to
1540    guarantee that the packages don't contain any trojan horses etc. 
1541    This is not to piss anyone off but rather to protect our users!
1542    You're still free to put up your home-made binary packages and tell
1543    the world where to get them. 
1544
1545  * packages:
1546    First, check that your package is complete, compiles and runs well; see
1547    section 8 and the rest of this document. Then, generate a gzipped
1548    tar-file of all the files needed for the package, preferably with all
1549    files in a single directory. Place this tar-file to a place where the
1550    package maintainers can fetch it using FTP or HTTP (WWW). Finally,
1551    send-pr with category "pkg", a synopsis which includes the package name
1552    and version number, a short description of your package
1553    (contents of pkg/COMMENT are OK) and the URL of your tar-file.
1554
1555    You will be notified if your send-pr has been addressed so you can remove
1556    the tar-file. 
1557
1558
1559  11 A simple example of a package: bison
1560  =======================================
1561
1562 I checked to find a piece of software that isn't in the FreeBSD ports
1563 collection, and picked GNU bison. Quite why someone would want to have
1564 bison when Berkeley yacc is already present in the tree is beyond me, but
1565 it's useful for the purposes of this exercise.
1566
1567
1568  11.1 files
1569  ==========
1570
1571 The file contents in this section must be used without the "> " prefix.
1572
1573
1574  11.1.1 Makefile
1575  ===============
1576
1577 > # <$>NetBSD<$>
1578 >  
1579 > DISTNAME=       bison-1.25
1580 > CATEGORIES=     devel
1581 > MASTER_SITES=   ${MASTER_SITE_GNU}
1582 >
1583 > MAINTAINER=     thorpej@netbsd.org
1584 > HOMEPAGE=       http://www.gnu.org/software/bison/bison.html
1585 >  
1586 > GNU_CONFIGURE=  yes
1587 > INFO_FILES=     bison.info
1588 >  
1589 > .include "../../mk/bsd.pkg.mk"
1590
1591
1592  11.1.2 pkg/COMMENT
1593  ==================
1594
1595 > GNU yacc clone.
1596
1597
1598  11.1.3 pkg/DESCR
1599  ================
1600
1601 > GNU version of yacc.  Can make re-entrant parsers, and numerous other
1602 > improvements.  Why you would want this when Berkeley yacc(1) is part
1603 > of the NetBSD source tree is beyond me.
1604
1605
1606  11.1.4 pkg/PLIST
1607  ================
1608
1609 > @comment <$>NetBSD<$>
1610 > bin/bison
1611 > man/man1/bison.1.gz
1612 > @unexec install-info --delete %D/info/bison.info %D/info/dir
1613 > info/bison.info
1614 > info/bison.info-1
1615 > info/bison.info-2
1616 > info/bison.info-3
1617 > info/bison.info-4
1618 > info/bison.info-5
1619 > @exec install-info %D/info/bison.info %D/info/dir
1620 > share/bison.simple
1621 > share/bison.hairy
1622
1623
1624  11.1.5 Checking a package "pkglint"
1625  ===================================
1626
1627 The NetBSD package system comes with a tool called "pkglint" (located in the
1628 directory "pkgsrc/pkgtools/pkglint") which helps to check the contents of these
1629 files. After installation it is quite easy to use, just change to the
1630 directory of the package you which to examine and execute "pkglint":
1631
1632 > tron@lyssa:/usr/pkgsrc/devel/bison>pkglint
1633 > OK: checking pkg/COMMENT.
1634 > OK: checking pkg/DESCR.
1635 > OK: checking Makefile.
1636 > OK: checking files/md5.
1637 > OK: checking patches/patch-aa.
1638 > looks fine.
1639
1640 Depending on the supplied command line arguments (see "man pkglint") more
1641 intensive checks will be performed. Use e.g. "pkglint -a -v" for a very
1642 detailed and verbose check.
1643
1644
1645  11.2 Steps for building, installing, packaging
1646  ==============================================
1647
1648 Create the directory where the package lives, plus any auxiliary directories:
1649
1650 > root@pumpy:/u/pkgsrc/lang(1765)# cd /usr/pkgsrc/lang
1651 > root@pumpy:/u/pkgsrc/lang(1765)# mkdir bison
1652 > root@pumpy:/u/pkgsrc/lang(1766)# cd bison
1653 > root@pumpy:/u/pkgsrc/lang/bison(1768)# mkdir files patches pkg
1654
1655 Create Makefile, pkg/COMMENT, pkg/DESCR and pkg/PLIST as in section 11.1,
1656 then continue with fetching the distfile:
1657
1658 > root@pumpy:/u/pkgsrc/lang/bison(1769)# make fetch
1659 > >> bison-1.25.tar.gz doesn't seem to exist on this system.
1660 > >> Attempting to fetch from ftp://prep.ai.mit.edu/pub/gnu//.
1661 > Requesting ftp://prep.ai.mit.edu/pub/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
1662 > ftp: Error retrieving file: 500 Internal error
1663 >  
1664 > >> Attempting to fetch from ftp://wuarchive.wustl.edu/systems/gnu//.
1665 > Requesting ftp://wuarchive.wustl.edu/systems/gnu//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
1666 > ftp: Error retrieving file: 500 Internal error
1667 >  
1668 > >> Attempting to fetch from ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//.
1669 > Requesting ftp://ftp.freebsd.org/pub/FreeBSD/distfiles//bison-1.25.tar.gz (via ftp://orpheus.amdahl.com:80/)
1670 > Successfully retrieved file.
1671
1672 Generate the checksum of the distfile into files/md5:
1673
1674 > root@pumpy:/u/pkgsrc/lang/bison(1770)# make makesum
1675
1676 Now compile:
1677
1678 > root@pumpy:/u/pkgsrc/lang/bison(1777)# make
1679 > >> Checksum OK for bison-1.25.tar.gz.
1680 > ===>  Extracting for bison-1.25
1681 > ===>  Patching for bison-1.25
1682 > ===>   Ignoring empty patch directory
1683 > ===>  Configuring for bison-1.25
1684 > creating cache ./config.cache
1685 > checking for gcc... cc
1686 > checking whether we are using GNU C... yes
1687 > checking for a BSD compatible install... /usr/bin/install -c -o bin -g bin
1688 > checking how to run the C preprocessor... cc -E
1689 > checking for minix/config.h... no
1690 > checking for POSIXized ISC... no
1691 > checking whether cross-compiling... no
1692 > checking for ANSI C header files... yes
1693 > checking for string.h... yes
1694 > checking for stdlib.h... yes
1695 > checking for memory.h... yes
1696 > checking for working const... yes
1697 > checking for working alloca.h... no
1698 > checking for alloca... yes
1699 > checking for strerror... yes
1700 > updating cache ./config.cache
1701 > creating ./config.status
1702 > creating Makefile
1703 > ===>  Building for bison-1.25
1704 > 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
1705 > 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
1706 > 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
1707 > 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
1708 > 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
1709 > 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 
1710 > 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
1711 > 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
1712 > 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
1713 > 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
1714 > 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
1715 > 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
1716 > 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
1717 > 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
1718 > 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
1719 > 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
1720 > 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
1721 > 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
1722 > 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
1723 > 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
1724 > 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
1725 > 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                        
1726                     getopt.o getopt1.o  
1727 > ./files.c:240: warning: mktemp() possibly used unsafely, consider using mkstemp()
1728 > rm -f bison.s1
1729 > sed -e "/^#line/ s|bison|/usr/pkg/share/bison|" < ./bison.simple > bison.s1
1730
1731 Everything seems OK, so install the files:
1732
1733 > root@pumpy:/u/pkgsrc/lang/bison(1785)# make install
1734 > >> Checksum OK for bison-1.25.tar.gz.
1735 > ===>  Installing for bison-1.25
1736 > sh ./mkinstalldirs /usr/pkg/bin /usr/pkg/share  /usr/pkg/info /usr/pkg/man/man1
1737 > rm -f /usr/pkg/bin/bison
1738 > cd /usr/pkg/share; rm -f bison.simple bison.hairy
1739 > rm -f /usr/pkg/man/man1/bison.1 /usr/pkg/info/bison.info*
1740 > install -c  -o bin -g bin -m 555 bison /usr/pkg/bin/bison
1741 > /usr/bin/install -c -o bin -g bin -m 644 bison.s1 /usr/pkg/share/bison.simple
1742 > /usr/bin/install -c -o bin -g bin -m 644 ./bison.hairy /usr/pkg/share/bison.hairy
1743 > cd .; for f in bison.info*;  do /usr/bin/install -c -o bin -g bin -m 644 $f /usr/pkg/info/$f; done
1744 > /usr/bin/install -c -o bin -g bin -m 644 ./bison.1 /usr/pkg/man/man1/bison.1
1745 > ===>  Registering installation for bison-1.25
1746
1747 You can now use bison, and also - if you decide so - remove it with
1748 "pkg_delete bison-1.25". Should you decide that you want a binary package,
1749 do this now:
1750
1751 > root@pumpy:/u/pkgsrc/lang/bison(1786)# make package
1752 > >> Checksum OK for bison-1.25.tar.gz.
1753 > ===>  Building package for bison-1.25
1754 > Creating package bison-1.25.tgz
1755 > Registering depends:.
1756 > Creating gzip'd tar ball in '/u/pkgsrc/lang/bison/bison-1.25.tgz'
1757
1758 Now that you don't need the source and object files any more, clean up:
1759
1760 > root@pumpy:/u/pkgsrc/lang/bison(1787)# make clean
1761 > ===>  Cleaning for bison-1.25
1762
1763
1764 ======================
1765 Appendix A: build logs
1766 ======================
1767
1768  A.1 Building top
1769  ================
1770
1771 > Script started on Fri Oct  3 13:22:31 1997
1772 > root@pumpy:/u/pkgsrc/sysutils/top(1342)# make
1773 > >> top-3.5beta5.tar.gz doesn't seem to exist on this system.
1774 > >> Attempting to fetch from ftp://ftp.groupsys.com/pub/top/.
1775 > Requesting ftp://ftp.groupsys.com/pub/top/top-3.5beta5.tar.gz (via ftp://orpheus.amdahl.com:80/)
1776 > Successfully retrieved file.
1777 > >> Checksum OK for top-3.5beta5.tar.gz.
1778 > ===>  Extracting for top-3.5beta5
1779 > ===>  Patching for top-3.5beta5
1780 > ===>  Applying NetBSD patches for top-3.5beta5
1781 > ===>  Configuring for top-3.5beta5
1782 > /bin/cp /u/pkgsrc/sysutils/top/files/defaults /u/pkgsrc/sysutils/top/work/top-3.5beta5/.defaults
1783 > chmod a-x /u/pkgsrc/sysutils/top/work/top-3.5beta5/install
1784
1785 > Reading configuration from last time...
1786
1787 > Using these settings:
1788 >         Bourne Shell   /bin/sh
1789 >           C compiler   cc
1790 >     Compiler options   -DHAVE_GETOPT -O
1791 >          Awk command   awk
1792 >      Install command   /usr/bin/install
1793
1794 >               Module   netbsd13
1795 >              LoadMax   5.0
1796 >         Default TOPN   -1
1797 >         Nominal TOPN   18
1798 >        Default Delay   2
1799 > Random passwd access   yes
1800 >           Table Size   47
1801 >                Owner   root
1802 >          Group Owner   kmem
1803 >                 Mode   2755
1804 >        bin directory   $(PREFIX)/bin
1805 >        man directory   $(PREFIX)/man/man1
1806 >        man extension   1
1807 >        man style       man
1808
1809 > Building Makefile...
1810 > Building top.local.h...
1811 > Building top.1...
1812 > Doing a "make clean".
1813 > rm -f *.o top core core.* sigdesc.h
1814 > To create the executable, type "make".
1815 > To install the executable, type "make install".
1816 > ===>  Building for top-3.5beta5
1817 > cc -DHAVE_GETOPT -DORDER -DHAVE_GETOPT -O  -c top.c
1818 > awk -f sigconv.awk /usr/include/sys/signal.h >sigdesc.h
1819 > cc -DHAVE_GETOPT -DORDER -DHAVE_GETOPT -O  -c commands.c
1820 > cc -DHAVE_GETOPT -DORDER -DHAVE_GETOPT -O  -c display.c
1821 > cc -DHAVE_GETOPT -DORDER -DHAVE_GETOPT -O  -c screen.c
1822 > cc -DHAVE_GETOPT -DORDER -DHAVE_GETOPT -O  -c username.c
1823 > cc -DHAVE_GETOPT -DORDER -DHAVE_GETOPT -O  -c utils.c
1824 > utils.c: In function `errmsg':
1825 > utils.c:348: warning: return discards `const' from pointer target type
1826 > cc -DHAVE_GETOPT -DORDER -DHAVE_GETOPT -O  -c version.c
1827 > cc -DHAVE_GETOPT -DORDER -DHAVE_GETOPT -O  -c getopt.c
1828 > cc "-DOSREV=12G" -DHAVE_GETOPT -DORDER -DHAVE_GETOPT -O -c machine.c
1829 > rm -f top
1830 > cc -o top top.o commands.o display.o screen.o username.o  utils.o version.o getopt.o machine.o -ltermcap -lm -lkvm
1831 > root@pumpy:/u/pkgsrc/sysutils/top(1343)# make install
1832 > >> Checksum OK for top-3.5beta5.tar.gz.
1833 > ===>  Installing for top-3.5beta5
1834 > /usr/bin/install -o root -m 2755 -g kmem top /usr/pkg/bin
1835 > /usr/bin/install top.1 /usr/pkg/man/man1/top.1
1836 > strip /usr/pkg/bin/top
1837 > ===>  Registering installation for top-3.5beta5
1838 > root@pumpy:/u/pkgsrc/sysutils/top(1344)# 
1839
1840
1841  A.2 Packaging top
1842  =================
1843
1844 > root@pumpy:/u/pkgsrc/sysutils/top(1344)# make package
1845  > >> Checksum OK for top-3.5beta5.tar.gz.
1846 > ===>  Building package for top-3.5beta5
1847 > Creating package top-3.5beta5.tgz
1848 > Registering depends:.
1849 > Creating gzip'd tar ball in '/u/pkgsrc/sysutils/top/top-3.5beta5.tgz'
1850 > root@pumpy:/u/pkgsrc/sysutils/top(1345)#
1851
1852
1853 ======================================================
1854 Appendix B: Layout of the FTP server's package archive
1855 ======================================================
1856
1857 Layout for precompiled binary packages on ftp.netbsd.org:
1858
1859 /pub/NetBSD/packages/
1860                 README
1861                 distfiles/
1862                 pkgsrc -> /pub/NetBSD/NetBSD-current/pkgsrc
1863                 1.3/
1864                         i386/
1865                                 All/
1866                                 archivers/
1867                                         foo -> ../All/foo
1868                                 ...
1869                         m68k/
1870                                 All/
1871                                 archivers/
1872                                         foo -> ../All/foo
1873                                 ...
1874                         amiga -> m68k
1875                         atari -> m68k
1876                         ...
1877
1878
1879 To create:
1880  - cd /usr/pkgsrc ; make install ; make package
1881  - upload /usr/pkgsrc/packages to
1882    ftp://ftp.netbsd.org/pub/NetBSD/packages/`uname -r`/`sysctl -n hw.machine_arch`
1883  - if necessary ln -s `sysctl -n hw.machine` `sysctl -n hw.machine_arch`
1884
1885 Disk space needed: unknown.
1886
1887
1888 ###########################################################################
1889 # Local Variables:
1890 # mode:                         Text
1891 # fill-column:                  75
1892 # sentence-end-double-space:    nil
1893 # End: