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

Annotation of pkgsrc/Packages.txt, Revision 1.134

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

CVSweb <webmaster@jp.NetBSD.org>