[BACK]Return to Packages.txt CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc

Annotation of pkgsrc/Packages.txt, Revision 1.54

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

CVSweb <webmaster@jp.NetBSD.org>