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