[BACK]Return to bsd.port.mk CVS log [TXT][DIR] Up to [local] / src / share / mk

Annotation of src/share/mk/bsd.port.mk, Revision 1.48

1.9       imp         1: #-*- mode: Fundamental; tab-width: 4; -*-
                      2: # ex:ts=4
1.48    ! form        3: #  $OpenBSD: bsd.port.mk,v 1.47 1998/11/05 10:36:14 espie Exp $
1.1       niklas      4: #
                      5: #  bsd.port.mk - 940820 Jordan K. Hubbard.
                      6: #  This file is in the public domain.
                      7: #
1.13      imp         8: # FreeBSD Id: bsd.port.mk,v 1.264 1996/12/25 02:27:44 imp Exp
1.44      marc        9: #  $NetBSD: bsd.port.mk,v 1.62 1998/04/09 12:47:02 hubertf Exp $
1.6       niklas     10: #
1.1       niklas     11: # Please view me with 4 column tabs!
                     12:
1.13      imp        13: # There are two different types of "maintainers" in the whole ports
                     14: # framework concept.  Maintainers of the bsd.port*.mk files
1.32      marc       15: # are listed below in the ${OPSYS}_MAINTAINER entries (this file
1.13      imp        16: # is used by multiple *BSD flavors).  You should consult them directly
                     17: # if you have any questions/suggestions regarding this file since only
                     18: # they are allowed to modify the master copies in the CVS repository!
                     19:
                     20: # For each port, the MAINTAINER variable is what you should consult for
                     21: # contact information on the person(s) to contact if you have questions/
                     22: # suggestions about that specific port.  By default (if no MAINTAINER
                     23: # is listed), a port is maintained by the subscribers of the ports@freebsd.org
1.44      marc       24: # mailing list (OpenBSD: ports@openbsd.org), and any correspondece
                     25: # should be directed there.
1.9       imp        26: #
1.13      imp        27: FreeBSD_MAINTAINER=    asami@FreeBSD.ORG
1.30      marc       28: OpenBSD_MAINTAINER=    marc@OpenBSD.ORG
1.44      marc       29: NetBSD_MAINTAINER= agc@netbsd.org
1.1       niklas     30:
                     31: # Supported Variables and their behaviors:
                     32: #
                     33: # Variables that typically apply to all ports:
                     34: #
1.44      marc       35: # ONLY_FOR_ARCHS - If a port only makes sense to certain architectures, this
1.10      niklas     36: #                is a list containing the names for them.  It is checked
1.44      marc       37: #                against the predefined ${MACHINE_ARCH} value
1.13      imp        38: # ARCH         - The architecture, as returned by "uname -m".
1.9       imp        39: # OPSYS            - Portability clause.  This is the operating system the
                     40: #                makefile is being used on.  Automatically set to
                     41: #                "FreeBSD," "NetBSD," or "OpenBSD" as appropriate.
1.32      marc       42: # OPSYS_VER        - The current version if the operating system
1.9       imp        43: # PORTSDIR     - The root of the ports tree.  Defaults:
1.13      imp        44: #                  FreeBSD/OpenBSD: /usr/ports
1.44      marc       45: #                  NetBSD:          /usr/pkgsrc
1.1       niklas     46: # DISTDIR      - Where to get gzip'd, tarballed copies of original sources
1.9       imp        47: #                (default: ${PORTSDIR}/distfiles).
1.1       niklas     48: # PREFIX       - Where to install things in general (default: /usr/local).
                     49: # MASTER_SITES - Primary location(s) for distribution files if not found
1.9       imp        50: #                locally.
1.44      marc       51: # MASTER_SITE_SUBDIR - Directory that "%SUBDIR%" in MASTER_SITES is
                     52: #                replaced by.
1.1       niklas     53: # PATCH_SITES  - Primary location(s) for distribution patch files
1.9       imp        54: #                (see PATCHFILES below) if not found locally.
1.44      marc       55: # PATCH_SITE_SUBDIR - Directory that "%SUBDIR%" in PATCH_SITES is
                     56: #                replaced by.
1.1       niklas     57: #
1.9       imp        58: # MASTER_SITE_BACKUP - Backup location(s) for distribution files and patch
                     59: #                files if not found locally and ${MASTER_SITES}/${PATCH_SITES}
                     60: #                (default:
1.27      marc       61: #                ftp://ftp.openbsd.org/pub/OpenBSD/distfiles/${DIST_SUBDIR}/
1.34      marc       62: #                ftp://ftp.openbsd.org/pub/OpenBSD/licensed/${DIST_SUBDIR}/
1.9       imp        63: #                ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/)
1.1       niklas     64: # MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this
                     65: #                value.
1.27      marc       66: # MASTER_SITE_OPENBSD - If set, only use ftp.openbsd.org as the
                     67: #                MASTER_SITE_OVERRIDE.
                     68: # MASTER_SITE_FREEBSD - If set, only use ftp.freebsd.org as the
                     69: #                MASTER_SITE_OVERRIDE.
1.1       niklas     70: # PACKAGES     - A top level directory where all packages go (rather than
                     71: #                going locally to each port). (default: ${PORTSDIR}/packages).
                     72: # GMAKE            - Set to path of GNU make if not in $PATH (default: gmake).
                     73: # XMKMF            - Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ).
                     74: # MAINTAINER   - The e-mail address of the contact person for this port
1.44      marc       75: #                Defaults: ports@OpenBSD.ORG      (OpenBSD)
                     76: #                          ports@FreeBSD.ORG      (FreeBSD)
                     77: #                           packages@NetBSD.ORG    (NetBSD)
1.9       imp        78: # CATEGORIES   - A list of descriptive categories into which this port falls.
1.14      niklas     79: # WRKOBJDIR        - A top level directory where, if defined, the separate working
                     80: #                directories will get created, and symbolically linked to from
                     81: #                ${WRKDIR} (see below).  This is useful for building ports on
                     82: #                several architectures, then ${PORTSDIR} can be NFS-mounted
                     83: #                while ${WRKOBJDIR} is local to every arch.
                     84:
1.1       niklas     85: #
                     86: # Variables that typically apply to an individual port.  Non-Boolean
                     87: # variables without defaults are *mandatory*.
                     88: #
                     89: # WRKDIR       - A temporary working directory that gets *clobbered* on clean
                     90: #                (default: ${.CURDIR}/work).
                     91: # WRKSRC       - A subdirectory of ${WRKDIR} where the distribution actually
                     92: #                unpacks to.  (Default: ${WRKDIR}/${DISTNAME} unless
                     93: #                NO_WRKSUBDIR is set, in which case simply ${WRKDIR}).
                     94: # DISTNAME     - Name of port or distribution.
                     95: # DISTFILES        - Name(s) of archive file(s) containing distribution
                     96: #                (default: ${DISTNAME}${EXTRACT_SUFX}).
                     97: # PATCHFILES   - Name(s) of additional files that contain distribution
                     98: #                patches (default: none).  make will look for them at
                     99: #                PATCH_SITES (see above).  They will automatically be
                    100: #                uncompressed before patching if the names end with
                    101: #                ".gz" or ".Z".
1.9       imp       102: # DIST_SUBDIR  - Suffix to ${DISTDIR}.  If set, all ${DISTFILES}
1.1       niklas    103: #                and ${PATCHFILES} will be put in this subdirectory of
                    104: #                ${DISTDIR}.  Also they will be fetched in this subdirectory
                    105: #                from FreeBSD mirror sites.
1.9       imp       106: # ALLFILES     - All of ${DISTFILES} and ${PATCHFILES}.
1.44      marc      107: # MIRROR_DISTFILE  - Whether the distfile is redistributable without restrictions.
                    108: #            Defaults to "yes", set this to "no" if restrictions exist.
1.9       imp       109: # IGNOREFILES  - If some of the ${ALLFILES} are not checksum-able, set
                    110: #                this variable to their names.
1.1       niklas    111: # PKGNAME      - Name of the package file to create if the DISTNAME
                    112: #                isn't really relevant for the port/package
                    113: #                (default: ${DISTNAME}).
                    114: # EXTRACT_ONLY - If defined, a subset of ${DISTFILES} you want to
                    115: #                actually extract.
                    116: # PATCHDIR         - A directory containing any additional patches you made
                    117: #                to port this software to FreeBSD (default:
                    118: #                ${.CURDIR}/patches)
                    119: # SCRIPTDIR    - A directory containing any auxiliary scripts
                    120: #                (default: ${.CURDIR}/scripts)
                    121: # FILESDIR         - A directory containing any miscellaneous additional files.
                    122: #                (default: ${.CURDIR}/files)
                    123: # PKGDIR       - A direction containing any package creation files.
                    124: #                (default: ${.CURDIR}/pkg)
                    125: # PKG_DBDIR        - Where package installation is recorded (default: /var/db/pkg)
                    126: # FORCE_PKG_REGISTER - If set, it will overwrite any existing package
                    127: #                registration information in ${PKG_DBDIR}/${PKGNAME}.
                    128: # NO_MTREE     - If set, will not invoke mtree from bsd.port.mk from
1.13      imp       129: #                the "install" target.
                    130: # MTREE_FILE   - The name of the mtree file (default: /etc/mtree/BSD.x11.dist
                    131: #                if USE_IMAKE or USE_X11 is set, /etc/mtree/BSD.local.dist
                    132: #                otherwise.)
1.26      marc      133: # COMES_WITH   - The first version that a port was made part of the
                    134: #                standard OpenBSD distribution.  If the current OpenBSD
                    135: #                version is >= this version then a notice will be
                    136: #                displayed instead the port being generated.
1.1       niklas    137: #
1.6       niklas    138: # NO_BUILD     - Use a dummy (do-nothing) build target.
                    139: # NO_CONFIGURE - Use a dummy (do-nothing) configure target.
1.9       imp       140: # NO_CDROM     - Port may not go on CDROM.  Set this string to reason.
1.6       niklas    141: # NO_DESCRIBE  - Use a dummy (do-nothing) describe target.
1.1       niklas    142: # NO_EXTRACT   - Use a dummy (do-nothing) extract target.
1.6       niklas    143: # NO_INSTALL   - Use a dummy (do-nothing) install target.
1.1       niklas    144: # NO_PACKAGE   - Use a dummy (do-nothing) package target.
1.6       niklas    145: # NO_PKG_REGISTER - Don't register a port install as a package.
1.1       niklas    146: # NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}.
                    147: # NO_WRKDIR        - There's no work directory at all; port does this someplace
                    148: #                else.
                    149: # NO_DEPENDS   - Don't verify build of dependencies.
1.44      marc      150: # NOCLEANDEPENDS - Don't nuke dependent dirs on make clean (Default: yes)
1.9       imp       151: # BROKEN       - Port is broken.  Set this string to the reason why.
1.1       niklas    152: # RESTRICTED   - Port is restricted.  Set this string to the reason why.
                    153: # USE_GMAKE        - Says that the port uses gmake.
1.13      imp       154: # USE_PERL5        - Says that the port uses perl5 for building and running.
1.1       niklas    155: # USE_IMAKE        - Says that the port uses imake.
1.13      imp       156: # USE_X11      - Says that the port uses X11 (i.e., installs in ${X11BASE}).
1.47      espie     157: # USE_EGCC     - Says that the port needs the egcs C compiler
                    158: # USE_EGXX     - Says that the port needs the egcs C++ compiler
1.1       niklas    159: # NO_INSTALL_MANPAGES - For imake ports that don't like the install.man
                    160: #                      target.
                    161: # HAS_CONFIGURE    - Says that the port has its own configure script.
                    162: # GNU_CONFIGURE    - Set if you are using GNU configure (optional).
                    163: # CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'.
                    164: # CONFIGURE_ARGS - Pass these args to configure if ${HAS_CONFIGURE} is set.
1.13      imp       165: # CONFIGURE_ENV - Pass these env (shell-like) to configure if
1.1       niklas    166: #                ${HAS_CONFIGURE} is set.
1.13      imp       167: # SCRIPTS_ENV  - Additional environment vars passed to scripts in
                    168: #                 ${SCRIPTDIR} executed by bsd.port.mk.
                    169: # MAKE_ENV     - Additional environment vars passed to sub-make in build
                    170: #                stage.
1.1       niklas    171: # IS_INTERACTIVE - Set this if your port needs to interact with the user
                    172: #                during a build.  User can then decide to skip this port by
                    173: #                setting ${BATCH}, or compiling only the interactive ports
                    174: #                by setting ${INTERACTIVE}.
1.7       niklas    175: # FETCH_DEPENDS - A list of "path:dir" pairs of other ports this
                    176: #                package depends in the "fetch" stage.  "path" is the
                    177: #                name of a file if it starts with a slash (/), an
                    178: #                executable otherwise.  make will test for the
                    179: #                existence (if it is a full pathname) or search for
                    180: #                it in your $PATH (if it is an executable) and go
                    181: #                into "dir" to do a "make all install" if it's not
                    182: #                found.
                    183: # BUILD_DEPENDS - A list of "path:dir" pairs of other ports this
                    184: #                package depends to build (between the "extract" and
                    185: #                "build" stages, inclusive).  The test done to
                    186: #                determine the existence of the dependency is the
                    187: #                same as FETCH_DEPENDS.
                    188: # RUN_DEPENDS  - A list of "path:dir" pairs of other ports this
                    189: #                package depends to run.  The test done to determine
                    190: #                the existence of the dependency is the same as
                    191: #                FETCH_DEPENDS.  This will be checked during the
                    192: #                "install" stage and the name of the dependency will
                    193: #                be put into the package as well.
1.1       niklas    194: # LIB_DEPENDS  - A list of "lib:dir" pairs of other ports this package
                    195: #                depends on.  "lib" is the name of a shared library.
                    196: #                make will use "ldconfig -r" to search for the
1.44      marc      197: #                library.  Note that lib can be any regular expression.
                    198: #                In older versions of this file, you need two backslashes
                    199: #                in front of dots (.) to supress its special meaning (e.g.,
                    200: #                use "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*").
                    201: #                No special backslashes are needed to escape regular
                    202: #                expression metacharacters in OpenBSD, and the old backslash
                    203: #                escapes are recognised for backwards compatibility.
1.1       niklas    204: # DEPENDS      - A list of other ports this package depends on being
                    205: #                made first.  Use this for things that don't fall into
                    206: #                the above two categories.
                    207: # EXTRACT_CMD  - Command for extracting archive (default: tar).
                    208: # EXTRACT_SUFX - Suffix for archive names (default: .tar.gz).
                    209: # EXTRACT_BEFORE_ARGS -
                    210: #                Arguments to ${EXTRACT_CMD} before filename
1.13      imp       211: #                (default: -xzf).
1.1       niklas    212: # EXTRACT_AFTER_ARGS -
                    213: #                Arguments to ${EXTRACT_CMD} following filename
                    214: #                (default: none).
                    215: #
1.6       niklas    216: # FETCH_CMD          - Full path to ftp/http fetch command if not in $PATH
1.44      marc      217: #                (default: /usr/bin/ftp).
1.6       niklas    218: # FETCH_BEFORE_ARGS -
                    219: #                Arguments to ${FETCH_CMD} before filename (default: none).
                    220: # FETCH_AFTER_ARGS -
                    221: #                Arguments to ${FETCH_CMD} following filename (default: none).
1.44      marc      222: # NO_IGNORE     - Set this to YES (most probably in a "make fetch" in
                    223: #                 ${PORTSDIR}) if you want to fetch all distfiles,
                    224: #                 even for packages not built due to limitation by
                    225: #                 absent X or Motif or ONLY_FOR_ARCHS...
                    226: # ALL_TARGET   - The target to pass to make in the package when building.
                    227: #                (default: "all")
                    228: # INSTALL_TARGET- The target to pass to make in the package when installing.
                    229: #                (default: "install")
1.1       niklas    230: #
                    231: # Motif support:
                    232: #
                    233: # REQUIRES_MOTIF - Set this in your port if it requires Motif.  It will  be
                    234: #                built only if HAVE_MOTIF is set.
                    235: # HAVE_MOTIF   - If set, means system has Motif.  Typically set in
1.44      marc      236: #                /etc/make.conf (FreeBSD) or
                    237: #                /etc/mk.conf (OpenBSD, NetBSD).
1.1       niklas    238: # MOTIF_STATIC - If set, link libXm statically; otherwise, link it
1.13      imp       239: #                dynamically.  Typically set in
1.44      marc      240: #                /etc/make.conf (FreeBSD) or
                    241: #                /etc/mk.conf (OpenBSD, NetBSD).
1.6       niklas    242: # MOTIFLIB     - Set automatically to appropriate value depending on
                    243: #                ${MOTIF_STATIC}.  Substitute references to -lXm with
                    244: #                patches to make your port conform to our standards.
1.13      imp       245: # MOTIF_ONLY   - If set, build Motif ports only.  (Not much use except for
                    246: #                building packages.)
1.1       niklas    247: #
                    248: # Variables to change if you want a special behavior:
                    249: #
                    250: # ECHO_MSG     - Used to print all the '===>' style prompts - override this
                    251: #                to turn them off (default: /bin/echo).
1.13      imp       252: # DEPENDS_TARGET - The target to execute when a port is calling a
                    253: #                dependency (default: "install").
1.6       niklas    254: # PATCH_DEBUG  - If set, print out more information about the patches as
                    255: #                it attempts to apply them.
                    256: #
1.9       imp       257: # Variables that serve as convenient "aliases" for your *-install targets.
                    258: # Use these like: "${INSTALL_PROGRAM} ${WRKSRC}/prog ${PREFIX}/bin".
1.6       niklas    259: #
1.44      marc      260: # INSTALL_PROGRAM      - A command to install binary executables.
                    261: # INSTALL_SCRIPT       - A command to install executable scripts.
                    262: # INSTALL_DATA         - A command to install sharable data.
                    263: # INSTALL_MAN          - A command to install manpages (doesn't compress).
                    264: # INSTALL_PROGRAM_DIR  - Create a directory for storing programs
                    265: # INSTALL_SCRIPT_DIR   - Create a directory for storing scripts (alias for
                    266: #                        (INSTALL_PROGRAM_DIR)
                    267: # INSTALL_DATA_DIR     - Create a directory for storing arbitrary data
                    268: # INSTALL_MAN_DIR      - Create a directory for storing man pages
                    269: #
                    270: # It is assumed that the port installs manpages uncompressed. If this is
                    271: # not the case, set MANCOMPRESSED in the port and define MAN<sect> and
                    272: # CAT<sect> for the compressed pages.  The pages will then be automagically
                    273: # uncompressed.
1.9       imp       274: #
1.44      marc      275: # MANCOMPRESSED - Indicates that the port installs manpages in a compressed
                    276: #                 form (default: port installs manpages uncompressed).
1.9       imp       277: # MAN<sect>        - A list of manpages, categorized by section.  For
                    278: #                example, if your port has "man/man1/foo.1" and
                    279: #                "man/mann/bar.n", set "MAN1=foo.1" and "MANN=bar.n".
                    280: #                The available sections chars are "123456789LN".
1.44      marc      281: # CAT<sect>     - The same as MAN<sect>, only for formatted manpages.
                    282: # MANPREFIX         -The directory prefix for ${MAN<sect>} (default: ${PREFIX}).
                    283: # CATPREFIX     - The directory prefix for ${CAT<sect>} (default: ${PREFIX}).
1.9       imp       284: #
1.1       niklas    285: # Default targets and their behaviors:
                    286: #
                    287: # fetch            - Retrieves ${DISTFILES} (and ${PATCHFILES} if defined)
                    288: #                into ${DISTDIR} as necessary.
                    289: # fetch-list   - Show list of files that would be retrieved by fetch
                    290: # extract      - Unpacks ${DISTFILES} into ${WRKDIR}.
                    291: # patch            - Apply any provided patches to the source.
                    292: # configure        - Runs either GNU configure, one or more local configure
                    293: #                scripts or nothing, depending on what's available.
                    294: # build            - Actually compile the sources.
                    295: # install      - Install the results of a build.
                    296: # reinstall        - Install the results of a build, ignoring "already installed"
                    297: #                flag.
1.44      marc      298: # deinstall        - Remove the installation.  Alias: uninstall
1.32      marc      299: # plist            - create a file suitable for use as a packing list.  This
                    300: #                is for port maintainers.
1.1       niklas    301: # package      - Create a package from an _installed_ port.
                    302: # describe     - Try to generate a one-line description for each port for
                    303: #                use in INDEX files and the like.
                    304: # checkpatch   - Do a "patch -C" instead of a "patch".  Note that it may
                    305: #                give incorrect results if multiple patches deal with
                    306: #                the same file.
                    307: # checksum     - Use files/md5 to ensure that your distfiles are valid.
                    308: # makesum      - Generate files/md5 (only do this for your own ports!).
1.44      marc      309: # readme       - Create a README.html file describing the category or package
                    310: # mirror-distfiles - Mirror the distfile(s) if they are freely redistributable
                    311: #                Setting MIRROR_DISTFILE to "no" in the package Makefile
                    312: #                will override the default "yes", and the distfile will
                    313: #                not be fetched.
1.1       niklas    314: #
                    315: # Default sequence for "all" is:  fetch checksum extract patch configure build
                    316: #
                    317: # Please read the comments in the targets section below, you
                    318: # should be able to use the pre-* or post-* targets/scripts
                    319: # (which are available for every stage except checksum) or
                    320: # override the do-* targets to do pretty much anything you want.
                    321: #
                    322: # NEVER override the "regular" targets unless you want to open
                    323: # a major can of worms.
                    324:
1.44      marc      325: # Get the architecture
                    326: ARCH!= uname -m
                    327:
1.32      marc      328: # Get the operating system type and version
1.27      marc      329: OPSYS!=    uname -s
1.32      marc      330: OPSYS_VER!=    uname -r
1.27      marc      331:
1.1       niklas    332: .if exists(${.CURDIR}/../Makefile.inc)
                    333: .include "${.CURDIR}/../Makefile.inc"
                    334: .endif
                    335:
1.9       imp       336: .if (${OPSYS} == "OpenBSD")
1.44      marc      337: NOCLEANDEPENDS=    yes
1.10      niklas    338: NOMANCOMPRESS?=    yes
1.14      niklas    339: DEF_UMASK?=        022
1.44      marc      340: .elif (${OPSYS} == "NetBSD")
                    341: DEF_UMASK?=        0022
                    342: NOCLEANDEPENDS=    yes
1.14      niklas    343: .else
                    344: DEF_UMASK?=        0022
1.9       imp       345: .endif
1.6       niklas    346:
1.13      imp       347: .if exists(${.CURDIR}/Makefile.${ARCH}-${OPSYS})
                    348: .include "${.CURDIR}/Makefile.${ARCH}-${OPSYS}"
                    349: .elif exists(${.CURDIR}/Makefile.${OPSYS})
                    350: .include "${.CURDIR}/Makefile.${OPSYS}"
                    351: .elif exists(${.CURDIR}/Makefile.${ARCH})
                    352: .include "${.CURDIR}/Makefile.${ARCH}"
                    353: .endif
                    354:
1.1       niklas    355: # These need to be absolute since we don't know how deep in the ports
                    356: # tree we are and thus can't go relative.  They can, of course, be overridden
1.9       imp       357: # by individual Makefiles or local system make configuration.
                    358: .if (${OPSYS} == "NetBSD")
1.44      marc      359: PORTSDIR?=     /usr/pkgsrc
                    360: LOCALBASE?=        ${DESTDIR}/usr/pkg
1.9       imp       361: .else
1.13      imp       362: PORTSDIR?=     /usr/ports
1.44      marc      363: LOCALBASE?=        ${DESTDIR}/usr/local
1.9       imp       364: .endif
1.13      imp       365: X11BASE?=      ${DESTDIR}/usr/X11R6
1.9       imp       366: DISTDIR?=      ${PORTSDIR}/distfiles
                    367: _DISTDIR?=     ${DISTDIR}/${DIST_SUBDIR}
1.1       niklas    368: PACKAGES?=     ${PORTSDIR}/packages
                    369: TEMPLATES?=        ${PORTSDIR}/templates
1.14      niklas    370:
1.13      imp       371: .if exists(${.CURDIR}/patches.${ARCH}-${OPSYS})
                    372: PATCHDIR?=     ${.CURDIR}/patches.${ARCH}-${OPSYS}
                    373: .elif exists(${.CURDIR}/patches.${OPSYS})
                    374: PATCHDIR?=     ${.CURDIR}/patches.${OPSYS}
                    375: .elif exists(${.CURDIR}/patches.${ARCH})
                    376: PATCHDIR?=     ${.CURDIR}/patches.${ARCH}
                    377: .else
1.1       niklas    378: PATCHDIR?=     ${.CURDIR}/patches
1.13      imp       379: .endif
                    380:
                    381: .if exists(${.CURDIR}/scripts.${ARCH}-${OPSYS})
                    382: SCRIPTDIR?=        ${.CURDIR}/scripts.${ARCH}-${OPSYS}
                    383: .elif exists(${.CURDIR}/scripts.${OPSYS})
                    384: SCRIPTDIR?=        ${.CURDIR}/scripts.${OPSYS}
                    385: .elif exists(${.CURDIR}/scripts.${ARCH})
                    386: SCRIPTDIR?=        ${.CURDIR}/scripts.${ARCH}
                    387: .else
1.1       niklas    388: SCRIPTDIR?=        ${.CURDIR}/scripts
1.13      imp       389: .endif
                    390:
                    391: .if exists(${.CURDIR}/files.${ARCH}-${OPSYS})
                    392: FILESDIR?=     ${.CURDIR}/files.${ARCH}-${OPSYS}
                    393: .elif exists(${.CURDIR}/files.${OPSYS})
                    394: FILESDIR?=     ${.CURDIR}/files.${OPSYS}
                    395: .elif exists(${.CURDIR}/files.${ARCH})
                    396: FILESDIR?=     ${.CURDIR}/files.${ARCH}
                    397: .else
1.1       niklas    398: FILESDIR?=     ${.CURDIR}/files
1.13      imp       399: .endif
                    400:
                    401: .if exists(${.CURDIR}/pkg.${ARCH}-${OPSYS})
                    402: PKGDIR?=       ${.CURDIR}/pkg.${ARCH}-${OPSYS}
                    403: .elif exists(${.CURDIR}/pkg.${OPSYS})
                    404: PKGDIR?=       ${.CURDIR}/pkg.${OPSYS}
                    405: .elif exists(${.CURDIR}/pkg.${ARCH})
                    406: PKGDIR?=       ${.CURDIR}/pkg.${ARCH}
                    407: .else
1.1       niklas    408: PKGDIR?=       ${.CURDIR}/pkg
1.13      imp       409: .endif
                    410:
1.1       niklas    411: .if defined(USE_IMAKE) || defined(USE_X11)
                    412: PREFIX?=       ${X11BASE}
                    413: .else
                    414: PREFIX?=       ${LOCALBASE}
                    415: .endif
                    416: # The following 4 lines should go away as soon as the ports are all updated
                    417: .if defined(EXEC_DEPENDS)
                    418: BUILD_DEPENDS+=    ${EXEC_DEPENDS}
                    419: RUN_DEPENDS+=  ${EXEC_DEPENDS}
                    420: .endif
                    421: .if defined(USE_GMAKE)
1.44      marc      422: BUILD_DEPENDS+=        ${GMAKE}:${PORTSDIR}/devel/gmake
                    423: MAKE_PROGRAM=      ${GMAKE}
                    424: .else
                    425: MAKE_PROGRAM=      ${MAKE}
1.13      imp       426: .endif
1.47      espie     427: .if defined(USE_EGCC)
                    428: BUILD_DEPENDS+=    ${EGCC}:${PORTSDIR}/devel/egcs-stable
                    429: CC=${EGCC}
                    430: .endif
                    431: .if defined(USE_EGXX)
                    432: BUILD_DEPENDS+=    ${EGXX}:${PORTSDIR}/devel/egcs-stable
                    433: CXX=${EGXX}
                    434: .endif
1.44      marc      435:
1.15      niklas    436: # OpenBSD has perl5 in-tree
1.44      marc      437: #
1.15      niklas    438: #.if defined(USE_PERL5)
1.44      marc      439: #BUILD_DEPENDS+=       perl5.00404:${PORTSDIR}/lang/perl5
                    440: #RUN_DEPENDS+=     perl5.00404:${PORTSDIR}/lang/perl5
1.15      niklas    441: #.endif
1.1       niklas    442:
                    443: .if exists(${PORTSDIR}/../Makefile.inc)
                    444: .include "${PORTSDIR}/../Makefile.inc"
                    445: .endif
                    446:
                    447: # Don't change these!!!  These names are built into the _TARGET_USE macro,
                    448: # there is no way to refer to them cleanly from within the macro AFAIK.
                    449: EXTRACT_COOKIE?=   ${WRKDIR}/.extract_done
                    450: CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done
1.32      marc      451: INSTALL_PRE_COOKIE?=${WRKDIR}/.install_started
1.1       niklas    452: INSTALL_COOKIE?=   ${WRKDIR}/.install_done
                    453: BUILD_COOKIE?=     ${WRKDIR}/.build_done
                    454: PATCH_COOKIE?=     ${WRKDIR}/.patch_done
                    455: PACKAGE_COOKIE?=   ${WRKDIR}/.package_done
                    456:
                    457: # Miscellaneous overridable commands:
                    458: GMAKE?=            gmake
1.47      espie     459: EGCC?=         egcc
                    460: EGXX?=         eg++
1.1       niklas    461: XMKMF?=            xmkmf -a
1.13      imp       462: .if exists(/sbin/md5)
                    463: MD5?=          /sbin/md5
1.9       imp       464: .elif exists(/bin/md5)
1.4       deraadt   465: MD5?=          /bin/md5
1.13      imp       466: .elif exists(/usr/bin/md5)
                    467: MD5?=          /usr/bin/md5
1.9       imp       468: .else
1.13      imp       469: MD5?=          md5
1.9       imp       470: .endif
1.1       niklas    471: MD5_FILE?=     ${FILESDIR}/md5
                    472:
                    473: MAKE_FLAGS?=   -f
                    474: MAKEFILE?=     Makefile
1.44      marc      475: MAKE_ENV+=     PATH=${PATH}:${LOCALBASE}/bin:${X11BASE}/bin PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} MOTIFLIB="${MOTIFLIB}" CFLAGS="${CFLAGS}"
1.1       niklas    476:
1.13      imp       477: .if exists(/usr/bin/fetch)
                    478: FETCH_CMD?=        /usr/bin/fetch
                    479: .else
1.6       niklas    480: FETCH_CMD?=        /usr/bin/ftp
1.9       imp       481: .endif
1.1       niklas    482:
1.44      marc      483: # By default, distfiles have no restrictions placed on them
                    484: MIRROR_DISTFILE?=  yes
                    485:
1.1       niklas    486: TOUCH?=            /usr/bin/touch
                    487: TOUCH_FLAGS?=  -f
                    488:
                    489: PATCH?=            /usr/bin/patch
                    490: PATCH_STRIP?=  -p0
                    491: PATCH_DIST_STRIP?= -p0
                    492: .if defined(PATCH_DEBUG)
1.6       niklas    493: PATCH_DEBUG_TMP=   yes
1.1       niklas    494: PATCH_ARGS?=   -d ${WRKSRC} -E ${PATCH_STRIP}
                    495: PATCH_DIST_ARGS?=  -d ${WRKSRC} -E ${PATCH_DIST_STRIP}
                    496: .else
1.6       niklas    497: PATCH_DEBUG_TMP=   no
1.3       niklas    498: PATCH_ARGS?=   -d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP}
                    499: PATCH_DIST_ARGS?=  -d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP}
1.1       niklas    500: .endif
                    501: .if defined(BATCH)
                    502: PATCH_ARGS+=       --batch
                    503: PATCH_DIST_ARGS+=  --batch
                    504: .endif
                    505:
                    506: .if defined(PATCH_CHECK_ONLY)
                    507: PATCH_ARGS+=   -C
                    508: PATCH_DIST_ARGS+=  -C
                    509: .endif
                    510:
1.9       imp       511: .if exists(/bin/tar)
1.5       tholo     512: EXTRACT_CMD?=  /bin/tar
1.9       imp       513: .else
                    514: EXTRACT_CMD?=  /usr/bin/tar
                    515: .endif
1.1       niklas    516: # Backwards compatability.
                    517: .if defined(EXTRACT_ARGS)
                    518: EXTRACT_BEFORE_ARGS?=   ${EXTRACT_ARGS}
                    519: .else
                    520: EXTRACT_BEFORE_ARGS?=   -xzf
                    521: .endif
1.44      marc      522: EXTRACT_SUFX?= .tar.gz
1.1       niklas    523:
                    524: # Figure out where the local mtree file is
1.13      imp       525: .if !defined(MTREE_FILE)
                    526: .if defined(USE_IMAKE) || defined(USE_X11)
                    527: MTREE_FILE=    /etc/mtree/BSD.x11.dist
                    528: .else
1.44      marc      529: .if (${OPSYS} == "NetBSD")
                    530: MTREE_FILE=    /etc/mtree/BSD.pkg.dist
                    531: .else
1.13      imp       532: MTREE_FILE=    /etc/mtree/BSD.local.dist
                    533: .endif
1.1       niklas    534: .endif
1.44      marc      535: .endif
1.1       niklas    536: MTREE_CMD?=    /usr/sbin/mtree
1.43      marc      537: MTREE_ARGS?=   -U -f ${MTREE_FILE} -d -e -q -p
1.1       niklas    538:
1.10      niklas    539: .if (${OPSYS} == "OpenBSD")
                    540: .include <bsd.own.mk>
                    541: MAKE_ENV+= EXTRA_SYS_MK_INCLUDES="<bsd.own.mk>"
1.44      marc      542: .elif (${OPSYS} == "NetBSD")
                    543: NEED_OWN_INSTALL_TARGET=   no
                    544: .include <bsd.own.mk>
                    545: SHAREOWN = ${DOCOWN}
                    546: SHAREGRP = ${DOCGRP}
                    547: SHAREMODE = ${DOCMODE}
                    548: .endif
                    549:
                    550: .if !defined(NO_WRKDIR)
                    551: .if defined(OBJMACHINE)
                    552: WRKDIR?=       ${.CURDIR}/work.${MACHINE_ARCH}
                    553: .else
                    554: WRKDIR?=       ${.CURDIR}/work
                    555: .endif
                    556: .else
                    557: WRKDIR?=       ${.CURDIR}
                    558: .endif
                    559: .if defined(NO_WRKSUBDIR)
                    560: WRKSRC?=       ${WRKDIR}
                    561: .else
                    562: WRKSRC?=       ${WRKDIR}/${DISTNAME}
                    563: .endif
                    564:
                    565: .if defined(WRKOBJDIR)
                    566: # XXX Is pwd -P available in FreeBSD's /bin/sh?
                    567: __canonical_PORTSDIR!= cd ${PORTSDIR}; pwd -P
                    568: __canonical_CURDIR!=   cd ${.CURDIR}; pwd -P
                    569: PORTSUBDIR=        ${__canonical_CURDIR:S,${__canonical_PORTSDIR}/,,}
1.10      niklas    570: .endif
                    571:
1.6       niklas    572: # A few aliases for *-install targets
                    573: INSTALL_PROGRAM= \
1.12      millert   574:    ${INSTALL} ${INSTALL_COPY} ${INSTALL_STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
1.6       niklas    575: INSTALL_SCRIPT= \
1.12      millert   576:    ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
1.6       niklas    577: INSTALL_DATA= \
1.12      millert   578:    ${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE}
1.6       niklas    579: INSTALL_MAN= \
1.12      millert   580:    ${INSTALL} ${INSTALL_COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
1.44      marc      581: INSTALL_PROGRAM_DIR= \
                    582:    ${INSTALL} -d -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
                    583: INSTALL_SCRIPT_DIR= \
                    584:    ${INSTALL_PROGRAM_DIR}
                    585: INSTALL_DATA_DIR= \
                    586:    ${INSTALL} -d -o ${SHAREOWN} -g ${SHAREGRP} -m ${BINMODE}
                    587: INSTALL_MAN_DIR= \
                    588:    ${INSTALL} -d -o ${MANOWN} -g ${MANGRP} -m ${BINMODE}
1.6       niklas    589:
1.13      imp       590: INSTALL_MACROS=    BSD_INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
                    591:            BSD_INSTALL_SCRIPT="${INSTALL_SCRIPT}" \
                    592:            BSD_INSTALL_DATA="${INSTALL_DATA}" \
1.44      marc      593:            BSD_INSTALL_MAN="${INSTALL_MAN}" \
                    594:            BSD_INSTALL_PROGRAM_DIR="${INSTALL_PROGRAM_DIR}" \
                    595:            BSD_INSTALL_SCRIPT_DIR="${INSTALL_SCRIPT_DIR}" \
                    596:            BSD_INSTALL_DATA_DIR="${INSTALL_DATA_DIR}" \
                    597:            BSD_INSTALL_MAN_DIR="${INSTALL_MAN_DIR}"
1.13      imp       598: MAKE_ENV+= ${INSTALL_MACROS}
                    599: SCRIPTS_ENV+=  ${INSTALL_MACROS}
                    600:
1.1       niklas    601: # The user can override the NO_PACKAGE by specifying this from
                    602: # the make command line
                    603: .if defined(FORCE_PACKAGE)
                    604: .undef NO_PACKAGE
                    605: .endif
                    606:
1.31      marc      607: # Support architecture dependent packing lists
                    608: #
1.13      imp       609: COMMENT?=  ${PKGDIR}/COMMENT
                    610: DESCR?=        ${PKGDIR}/DESCR
1.31      marc      611: .if exists(${PKGDIR}/PLIST.${ARCH})
                    612: PLIST?=        ${PKGDIR}/PLIST.${ARCH}
                    613: .else
1.13      imp       614: PLIST?=        ${PKGDIR}/PLIST
1.31      marc      615: .endif
1.13      imp       616:
1.1       niklas    617: PKG_CMD?=      /usr/sbin/pkg_create
                    618: .if !defined(PKG_ARGS)
1.13      imp       619: PKG_ARGS=      -v -c ${COMMENT} -d ${DESCR} -f ${PLIST} -p ${PREFIX} -P "`${MAKE} package-depends|sort -u`"
1.1       niklas    620: .if exists(${PKGDIR}/INSTALL)
                    621: PKG_ARGS+=     -i ${PKGDIR}/INSTALL
                    622: .endif
                    623: .if exists(${PKGDIR}/DEINSTALL)
                    624: PKG_ARGS+=     -k ${PKGDIR}/DEINSTALL
                    625: .endif
                    626: .if exists(${PKGDIR}/REQ)
                    627: PKG_ARGS+=     -r ${PKGDIR}/REQ
                    628: .endif
1.9       imp       629: .if exists(${PKGDIR}/MESSAGE)
                    630: PKG_ARGS+=     -D ${PKGDIR}/MESSAGE
                    631: .endif
1.13      imp       632: .if !defined(NO_MTREE)
                    633: PKG_ARGS+=     -m ${MTREE_FILE}
1.1       niklas    634: .endif
                    635: .endif
                    636: PKG_SUFX?=     .tgz
                    637: # where pkg_add records its dirty deeds.
                    638: PKG_DBDIR?=        /var/db/pkg
                    639:
                    640: # shared/dynamic motif libs
                    641: .if defined(HAVE_MOTIF)
                    642: .if defined(MOTIF_STATIC)
                    643: MOTIFLIB?= ${X11BASE}/lib/libXm.a
                    644: .else
                    645: MOTIFLIB?= -L${X11BASE}/lib -lXm
                    646: .endif
                    647: .endif
                    648:
1.13      imp       649: AWK?=      /usr/bin/awk
                    650: BASENAME?= /usr/bin/basename
1.9       imp       651: CAT?=      /bin/cat
1.1       niklas    652: CP?=       /bin/cp
1.32      marc      653: DIRNAME?=  /usr/bin/dirname
1.13      imp       654: ECHO?=     /bin/echo
1.9       imp       655: FALSE?=        /usr/bin/false
1.44      marc      656: FILE?=     /usr/bin/file
1.9       imp       657: GREP?=     /usr/bin/grep
1.13      imp       658: GUNZIP_CMD?=   /usr/bin/gunzip -f
1.1       niklas    659: GZCAT?=        /usr/bin/gzcat
1.9       imp       660: GZIP?=     -9
                    661: GZIP_CMD?= /usr/bin/gzip -nf ${GZIP}
1.22      niklas    662: LDCONFIG?= [ ! -x /sbin/ldconfig ] || /sbin/ldconfig
1.14      niklas    663: LN?=       /bin/ln
1.13      imp       664: MKDIR?=        /bin/mkdir -p
                    665: MV?=       /bin/mv
1.18      niklas    666: READLINK?= /usr/bin/readlink
1.13      imp       667: RM?=       /bin/rm
                    668: RMDIR?=        /bin/rmdir
1.1       niklas    669: SED?=      /usr/bin/sed
1.44      marc      670: SETENV?=   /usr/bin/env
1.13      imp       671: SH?=       /bin/sh
                    672: TR?=       /usr/bin/tr
1.44      marc      673: TRUE?=     /usr/bin/true
1.1       niklas    674:
                    675: # Used to print all the '===>' style prompts - override this to turn them off.
                    676: ECHO_MSG?=     ${ECHO}
                    677:
1.44      marc      678: # How to do nothing.  Override if you, for some strange reason, would rather
                    679: # do something.
                    680: DO_NADA?=      ${TRUE}
                    681:
1.1       niklas    682: ALL_TARGET?=       all
                    683: INSTALL_TARGET?=   install
                    684:
1.44      marc      685: .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
                    686: INSTALL_TARGET+=   install.man
                    687: .endif
                    688:
1.9       imp       689: # Popular master sites
1.13      imp       690: MASTER_SITE_XCONTRIB+= \
                    691:    ftp://crl.dec.com/pub/X11/contrib/%SUBDIR%/ \
1.44      marc      692:     ftp://ftp.eu.net/X11/contrib/%SUBDIR%/ \
                    693:    ftp://ftp.uni-paderborn.de/pub/X11/contrib/%SUBDIR%/ \
                    694:    ftp://ftp.x.org/contrib/%SUBDIR%/
1.13      imp       695:
                    696: MASTER_SITE_GNU+=  \
                    697:    ftp://prep.ai.mit.edu/pub/gnu/%SUBDIR%/ \
                    698:    ftp://wuarchive.wustl.edu/systems/gnu/%SUBDIR%/
                    699:
                    700: MASTER_SITE_PERL_CPAN+=    \
                    701:    ftp://ftp.digital.com/pub/plan/perl/CPAN/modules/by-module/%SUBDIR%/ \
                    702:    ftp://ftp.cdrom.com/pub/perl/CPAN/modules/by-module/%SUBDIR%/
                    703:
                    704: MASTER_SITE_TEX_CTAN+=  \
                    705:         ftp://ftp.cdrom.com/pub/tex/ctan/%SUBDIR%/  \
                    706:         ftp://wuarchive.wustl.edu/packages/TeX/%SUBDIR%/  \
                    707:         ftp://ftp.funet.fi/pub/TeX/CTAN/%SUBDIR%/  \
                    708:         ftp://ftp.tex.ac.uk/public/ctan/tex-archive/%SUBDIR%/  \
                    709:         ftp://ftp.dante.de/tex-archive/%SUBDIR%/
                    710:
                    711: MASTER_SITE_SUNSITE+=  \
                    712:    ftp://sunsite.unc.edu/pub/Linux/%SUBDIR%/ \
                    713:    ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/%SUBDIR%/ \
                    714:    ftp://ftp.funet.fi/pub/mirrors/sunsite.unc.edu/pub/Linux/%SUBDIR%/
                    715:
                    716: # Empty declaration to avoid "variable MASTER_SITES recursive" error
                    717: MASTER_SITES?=
                    718: PATCH_SITES?=
                    719:
                    720: # Substitute subdirectory names
                    721: MASTER_SITES:= ${MASTER_SITES:S/%SUBDIR%/${MASTER_SITE_SUBDIR}/}
                    722: PATCH_SITES:=  ${PATCH_SITES:S/%SUBDIR%/${PATCH_SITE_SUBDIR}/}
1.9       imp       723:
1.27      marc      724: # Two backup master sites, First one at ftp.openbsd.org
                    725: #
                    726: _MASTER_SITE_OPENBSD?= \
1.34      marc      727:    ftp://ftp.openbsd.org/pub/OpenBSD/distfiles/${DIST_SUBDIR}/ \
                    728:    ftp://ftp.openbsd.org/pub/OpenBSD/licensed/${DIST_SUBDIR}/
1.27      marc      729:
                    730: # The second backup master site is ftp.freebsd.org
                    731: #
                    732: _MASTER_SITE_FREEBSD?= \
                    733:    ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
                    734:
                    735: # set the backup master sites.
                    736: #
1.9       imp       737: MASTER_SITE_BACKUP?=   \
1.27      marc      738:    ${_MASTER_SITE_OPENBSD} ${_MASTER_SITE_FREEBSD}
                    739:
                    740: # If the user has this set, go to the OpenBSD repository for everything.
                    741: #
                    742: .if defined(MASTER_SITE_OPENBSD)
                    743: MASTER_SITE_OVERRIDE=  ${_MASTER_SITE_OPENBSD}
                    744: .endif
1.9       imp       745:
                    746: # If the user has this set, go to the FreeBSD repository for everything.
1.27      marc      747: #
1.1       niklas    748: .if defined(MASTER_SITE_FREEBSD)
1.27      marc      749: MASTER_SITE_OVERRIDE=  ${_MASTER_SITE_FREEBSD}
1.1       niklas    750: .endif
                    751:
1.13      imp       752: # Where to put distfiles that don't have any other master site
1.27      marc      753: # ;;; This is referenced in a few Makefiles -- I'd like to get rid of it
                    754: #
1.13      imp       755: MASTER_SITE_LOCAL?= \
1.44      marc      756:    ftp://ftp.netbsd.org/pub/NetBSD/packages/distfiles/LOCAL_PORTS/ \
1.13      imp       757:    ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/LOCAL_PORTS/
                    758:
1.1       niklas    759: # I guess we're in the master distribution business! :)  As we gain mirror
                    760: # sites for distfiles, add them to this list.
                    761: .if !defined(MASTER_SITE_OVERRIDE)
1.9       imp       762: MASTER_SITES+= ${MASTER_SITE_BACKUP}
                    763: PATCH_SITES+=  ${MASTER_SITE_BACKUP}
1.1       niklas    764: .else
                    765: MASTER_SITES:= ${MASTER_SITE_OVERRIDE} ${MASTER_SITES}
                    766: PATCH_SITES:=  ${MASTER_SITE_OVERRIDE} ${PATCH_SITES}
                    767: .endif
                    768:
1.28      marc      769: # The following is a FreeBSD construct that dopes not work in OpenBSD.
                    770: # Since OpenBSD does not put packages in /cdrom/ports/packages it
                    771: # is safe to leave (but I may remove it in the future).
                    772: #
1.7       niklas    773: # Search CDROM first if mounted, symlink instead of copy if
                    774: # FETCH_SYMLINK_DISTFILES is set
                    775: .if exists(/cdrom/ports/distfiles)
                    776: MASTER_SITES:= file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${MASTER_SITES}
                    777: PATCH_SITES:=  file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${PATCH_SITES}
                    778: .if defined(FETCH_SYMLINK_DISTFILES)
                    779: FETCH_BEFORE_ARGS+=    -l
                    780: .endif
                    781: .endif
                    782:
1.28      marc      783: # OpenBSD code to handle ports distfiles on a CDROM.  The distfiles
                    784: # are located in /cdrom/distfiles/${DIST_SUBDIR}/ (assuming that the
                    785: # CDROM is mounted on /cdrom).
                    786: #
                    787: .if exists(/cdrom/distfiles)
                    788: CDROM_SITE:=   /cdrom/distfiles/${DIST_SUBDIR}
                    789: .if defined(FETCH_SYMLINK_DISTFILES)
                    790: CDROM_COPY:=   ${LN}
                    791: CDROM_OPT=     -s
                    792: .else
                    793: CDROM_COPY:=   ${CP}
                    794: CDROM_OPT=     -f
                    795: .endif
                    796: .endif
                    797:
1.1       niklas    798: # Derived names so that they're easily overridable.
                    799: DISTFILES?=        ${DISTNAME}${EXTRACT_SUFX}
                    800: PKGNAME?=      ${DISTNAME}
                    801:
1.9       imp       802: ALLFILES?= ${DISTFILES} ${PATCHFILES}
                    803:
                    804: .if defined(IGNOREFILES)
                    805: CKSUMFILES!=   \
                    806:    for file in ${ALLFILES}; do \
                    807:        ignore=0; \
                    808:        for tmp in ${IGNOREFILES}; do \
                    809:            if [ "$$file" = "$$tmp" ]; then \
                    810:                ignore=1; \
                    811:            fi; \
                    812:        done; \
                    813:        if [ "$$ignore" = 0 ]; then \
                    814:            echo "$$file"; \
1.44      marc      815:        else \
                    816:            echo ""; \
1.9       imp       817:        fi; \
                    818:    done
                    819: .else
                    820: CKSUMFILES=        ${ALLFILES}
                    821: .endif
                    822:
                    823: # List of all files, with ${DIST_SUBDIR} in front.  Used for checksum.
                    824: .if defined(DIST_SUBDIR)
                    825: _CKSUMFILES?=  ${CKSUMFILES:S/^/${DIST_SUBDIR}\//}
                    826: _IGNOREFILES?= ${IGNOREFILES:S/^/${DIST_SUBDIR}\//}
                    827: .else
                    828: _CKSUMFILES?=  ${CKSUMFILES}
                    829: _IGNOREFILES?= ${IGNOREFILES}
                    830: .endif
                    831:
1.1       niklas    832: # This is what is actually going to be extracted, and is overridable
                    833: #  by user.
                    834: EXTRACT_ONLY?= ${DISTFILES}
                    835:
                    836: # Documentation
1.44      marc      837: .if (${OPSYS} == "OpenBSD")
                    838: MAINTAINER?=   ports@OpenBSD.ORG
                    839: .elif (${OPSYS} == "NetBSD")
                    840: MAINTAINER?=   packages@NetBSD.ORG
                    841: .else
1.1       niklas    842: MAINTAINER?=   ports@FreeBSD.ORG
1.44      marc      843: .endif
1.9       imp       844:
                    845: .if !defined(CATEGORIES)
                    846: .BEGIN:
                    847:    @${ECHO_MSG} "CATEGORIES is mandatory."
                    848:    @${FALSE}
                    849: .endif
1.1       niklas    850:
                    851: # Note this has to start with a capital letter (or more accurately, it
                    852: #  shouldn't match "[a-z]*"), see the target "delete-package-links" below.
                    853: PKGREPOSITORYSUBDIR?=  All
                    854: PKGREPOSITORY?=        ${PACKAGES}/${PKGREPOSITORYSUBDIR}
                    855: .if exists(${PACKAGES})
                    856: PKGFILE?=      ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
                    857: .else
                    858: PKGFILE?=      ${PKGNAME}${PKG_SUFX}
                    859: .endif
                    860:
                    861: CONFIGURE_SCRIPT?= configure
1.44      marc      862: CONFIGURE_ENV+=        PATH=${PATH}:${LOCALBASE}/bin:${X11BASE}/bin
1.1       niklas    863:
                    864: .if defined(GNU_CONFIGURE)
                    865: CONFIGURE_ARGS+=   --prefix=${PREFIX}
                    866: HAS_CONFIGURE=     yes
                    867: .endif
                    868:
1.13      imp       869: # Passed to most of script invocations
1.44      marc      870: SCRIPTS_ENV+= CURDIR=${.CURDIR} DISTDIR=${DISTDIR} \
                    871:           PATH=${PATH}:${LOCALBASE}/bin:${X11BASE}/bin \
1.13      imp       872:          WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} \
                    873:          SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \
                    874:          PORTSDIR=${PORTSDIR} DEPENDS="${DEPENDS}" \
                    875:          PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
                    876:
                    877: .if defined(BATCH)
                    878: SCRIPTS_ENV+=  BATCH=yes
                    879: .endif
                    880:
1.9       imp       881: MANPREFIX?=    ${PREFIX}
1.44      marc      882: CATPREFIX?=    ${PREFIX}
1.9       imp       883:
                    884: .for sect in 1 2 3 4 5 6 7 8 9
                    885: MAN${sect}PREFIX?= ${MANPREFIX}
1.44      marc      886: CAT${sect}PREFIX?= ${CATPREFIX}
1.9       imp       887: .endfor
                    888: MANLPREFIX?=   ${MANPREFIX}
                    889: MANNPREFIX?=   ${MANPREFIX}
1.44      marc      890: CATLPREFIX?=   ${CATPREFIX}
                    891: CATNPREFIX?=   ${CATPREFIX}
1.9       imp       892:
                    893: MANLANG?=  ""  # english only by default
                    894:
                    895: .for lang in ${MANLANG}
                    896:
                    897: .for sect in 1 2 3 4 5 6 7 8 9
                    898: .if defined(MAN${sect})
                    899: _MANPAGES+=    ${MAN${sect}:S%^%${MAN${sect}PREFIX}/man/${lang}/man${sect}/%}
                    900: .endif
1.44      marc      901: .if defined(CAT${sect})
                    902: _CATPAGES+=    ${CAT${sect}:S%^%${CAT${sect}PREFIX}/man/${lang}/cat${sect}/%}
                    903: .endif
1.9       imp       904: .endfor
                    905:
                    906: .if defined(MANL)
                    907: _MANPAGES+=    ${MANL:S%^%${MANLPREFIX}/man/${lang}/manl/%}
                    908: .endif
                    909:
                    910: .if defined(MANN)
                    911: _MANPAGES+=    ${MANN:S%^%${MANNPREFIX}/man/${lang}/mann/%}
                    912: .endif
                    913:
1.44      marc      914: .if defined(CATL)
                    915: _CATPAGES+=    ${CATL:S%^%${CATLPREFIX}/man/${lang}/catl/%}
                    916: .endif
1.9       imp       917:
1.44      marc      918: .if defined(CATN)
                    919: _CATPAGES+=    ${CATN:S%^%${CATNPREFIX}/man/${lang}/catn/%}
1.9       imp       920: .endif
                    921:
1.44      marc      922: .endfor
                    923:
1.1       niklas    924: .MAIN: all
                    925:
                    926: ################################################################
                    927: # Many ways to disable a port.
                    928: #
                    929: # If we're in BATCH mode and the port is interactive, or we're
                    930: # in interactive mode and the port is non-interactive, skip all
                    931: # the important targets.  The reason we have two modes is that
                    932: # one might want to leave a build in BATCH mode running
                    933: # overnight, then come back in the morning and do _only_ the
                    934: # interactive ones that required your intervention.
                    935: #
                    936: # Don't attempt to build ports that require Motif if you don't
                    937: # have Motif.
                    938: #
                    939: # Ignore ports that can't be resold if building for a CDROM.
                    940: #
                    941: # Don't build a port if it's restricted and we don't want to get
                    942: # into that.
                    943: #
                    944: # Don't build a port if it's broken.
1.27      marc      945: #
                    946: # Don't build a port if it comes with the base system.
1.1       niklas    947: ################################################################
                    948:
1.13      imp       949: .if !defined(NO_IGNORE)
1.9       imp       950: .if (defined(IS_INTERACTIVE) && defined(BATCH))
                    951: IGNORE=    "is an interactive port"
                    952: .elif (!defined(IS_INTERACTIVE) && defined(INTERACTIVE))
                    953: IGNORE=    "is not an interactive port"
                    954: .elif (defined(REQUIRES_MOTIF) && !defined(HAVE_MOTIF))
                    955: IGNORE=    "requires Motif"
1.13      imp       956: .elif (defined(MOTIF_ONLY) && !defined(REQUIRES_MOTIF))
                    957: IGNORE=    "does not require Motif"
1.9       imp       958: .elif (defined(NO_CDROM) && defined(FOR_CDROM))
                    959: IGNORE=    "may not be placed on a CDROM: ${NO_CDROM}"
                    960: .elif (defined(RESTRICTED) && defined(NO_RESTRICTED))
                    961: IGNORE=    "is restricted: ${RESTRICTED}"
1.13      imp       962: .elif ((defined(USE_IMAKE) || defined(USE_X11)) && !exists(${X11BASE}))
                    963: IGNORE=    "uses X11, but ${X11BASE} not found"
1.9       imp       964: .elif defined(BROKEN)
                    965: IGNORE=    "is marked as broken: ${BROKEN}"
1.29      marc      966: .elif defined(ONLY_FOR_ARCHS)
                    967: .for __ARCH in ${ONLY_FOR_ARCHS}
1.48    ! form      968: .if (${MACHINE_ARCH} == "${__ARCH}") || (${ARCH} == "${__ARCH}")
1.29      marc      969: __ARCH_OK= 1
                    970: .endif
                    971: .endfor
                    972: .if !defined(__ARCH_OK)
1.48    ! form      973: .if ${MACHINE_ARCH} == "${ARCH}"
1.44      marc      974: IGNORE= "is only for ${ONLY_FOR_ARCHS}, not ${MACHINE_ARCH}"
1.48    ! form      975: .else
        !           976: IGNORE= "is only for ${ONLY_FOR_ARCHS}, not ${MACHINE_ARCH} \(${ARCH}\)"
        !           977: .endif
1.29      marc      978: .endif
1.27      marc      979: .elif defined(COMES_WITH)
1.32      marc      980: .if ( ${OPSYS_VER} >= ${COMES_WITH} )
1.41      marc      981: IGNORE= "-- ${PKGNAME:C/-[0-9].*//g} comes with ${OPSYS} as of release ${COMES_WITH}"
1.27      marc      982: .endif
1.1       niklas    983: .endif
                    984:
                    985: .if defined(IGNORE)
1.9       imp       986: .if defined(IGNORE_SILENT)
                    987: IGNORECMD= ${DO_NADA}
                    988: .else
                    989: IGNORECMD= ${ECHO_MSG} "===>  ${PKGNAME} ${IGNORE}."
                    990: .endif
                    991: fetch:
                    992:    @${IGNORECMD}
                    993: checksum:
                    994:    @${IGNORECMD}
                    995: extract:
                    996:    @${IGNORECMD}
                    997: patch:
                    998:    @${IGNORECMD}
                    999: configure:
                   1000:    @${IGNORECMD}
1.1       niklas   1001: all:
1.9       imp      1002:    @${IGNORECMD}
1.1       niklas   1003: build:
1.9       imp      1004:    @${IGNORECMD}
1.1       niklas   1005: install:
1.9       imp      1006:    @${IGNORECMD}
1.44      marc     1007: uninstall deinstall:
                   1008:    @${IGNORECMD}
1.1       niklas   1009: package:
1.9       imp      1010:    @${IGNORECMD}
1.44      marc     1011: .endif # IGNORE
                   1012: .endif # !NO_IGNORE
1.1       niklas   1013:
                   1014: .if defined(ALL_HOOK)
                   1015: all:
1.6       niklas   1016:    @cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \
1.1       niklas   1017:      DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \
                   1018:      PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
                   1019:      FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
                   1020:      DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \
                   1021:      RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \
                   1022:    ${ALL_HOOK}
                   1023: .endif
                   1024:
                   1025: .if !target(all)
                   1026: all: build
                   1027: .endif
                   1028:
1.13      imp      1029: .if !defined(DEPENDS_TARGET)
                   1030: .if make(reinstall)
                   1031: DEPENDS_TARGET=    reinstall
                   1032: .else
                   1033: DEPENDS_TARGET=    install
1.1       niklas   1034: .endif
                   1035: .endif
                   1036:
                   1037: ################################################################
                   1038: # The following are used to create easy dummy targets for
                   1039: # disabling some bit of default target behavior you don't want.
                   1040: # They still check to see if the target exists, and if so don't
                   1041: # do anything, since you might want to set this globally for a
                   1042: # group of ports in a Makefile.inc, but still be able to
                   1043: # override from an individual Makefile.
                   1044: ################################################################
                   1045:
1.9       imp      1046: # Disable checksum
                   1047: .if defined(NO_CHECKSUM) && !target(checksum)
                   1048: checksum: fetch
                   1049:    @${DO_NADA}
                   1050: .endif
                   1051:
1.1       niklas   1052: # Disable extract
                   1053: .if defined(NO_EXTRACT) && !target(extract)
                   1054: extract: checksum
                   1055:    @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
                   1056: checksum: fetch
                   1057:    @${DO_NADA}
                   1058: makesum:
                   1059:    @${DO_NADA}
                   1060: .endif
                   1061:
1.9       imp      1062: # Disable patch
                   1063: .if defined(NO_PATCH) && !target(patch)
                   1064: patch: extract
                   1065:    @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
                   1066: .endif
                   1067:
1.1       niklas   1068: # Disable configure
                   1069: .if defined(NO_CONFIGURE) && !target(configure)
                   1070: configure: patch
                   1071:    @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
                   1072: .endif
                   1073:
                   1074: # Disable build
                   1075: .if defined(NO_BUILD) && !target(build)
                   1076: build: configure
                   1077:    @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
                   1078: .endif
                   1079:
1.9       imp      1080: # Disable install
                   1081: .if defined(NO_INSTALL) && !target(install)
                   1082: install: build
                   1083:    @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
                   1084: .endif
                   1085:
1.1       niklas   1086: # Disable package
                   1087: .if defined(NO_PACKAGE) && !target(package)
                   1088: package:
1.9       imp      1089: .if defined(IGNORE_SILENT)
1.1       niklas   1090:    @${DO_NADA}
1.9       imp      1091: .else
                   1092:    @${ECHO_MSG} "===>  ${PKGNAME} may not be packaged: ${NO_PACKAGE}."
1.1       niklas   1093: .endif
                   1094: .endif
                   1095:
1.9       imp      1096: # Disable describe
                   1097: .if defined(NO_DESCRIBE) && !target(describe)
                   1098: describe:
                   1099:    @${DO_NADA}
1.1       niklas   1100: .endif
                   1101:
                   1102: ################################################################
                   1103: # More standard targets start here.
                   1104: #
                   1105: # These are the body of the build/install framework.  If you are
                   1106: # not happy with the default actions, and you can't solve it by
                   1107: # adding pre-* or post-* targets/scripts, override these.
                   1108: ################################################################
                   1109:
                   1110: # Fetch
                   1111:
                   1112: .if !target(do-fetch)
                   1113: do-fetch:
1.9       imp      1114:    @${MKDIR} ${_DISTDIR}
                   1115:    @(cd ${_DISTDIR}; \
1.1       niklas   1116:     for file in ${DISTFILES}; do \
                   1117:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                   1118:            if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
1.9       imp      1119:                ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
1.1       niklas   1120:                ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
                   1121:                ${ECHO_MSG} ">> Please correct this problem and try again."; \
                   1122:                exit 1; \
1.28      marc     1123:            fi ; \
                   1124:            if [ ! -z ${CDROM_COPY} ]; then \
                   1125:                if ${CDROM_COPY} ${CDROM_OPT} ${CDROM_SITE}/$$file .; then \
                   1126:                    continue; \
                   1127:                fi ; \
1.1       niklas   1128:            fi ; \
                   1129:            ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
1.46      form     1130:            if [ ! -w ${_DISTDIR}/. ]; then \
                   1131:                ${ECHO_MSG} ">> Can't download to ${_DISTDIR} (permission denied?)."; \
                   1132:                exit 1; \
                   1133:            fi; \
1.1       niklas   1134:            for site in ${MASTER_SITES}; do \
                   1135:                ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6       niklas   1136:                if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1       niklas   1137:                    continue 2; \
                   1138:                fi \
                   1139:            done; \
1.6       niklas   1140:            ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.9       imp      1141:            ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1.1       niklas   1142:            exit 1; \
                   1143:        fi \
                   1144:     done)
                   1145: .if defined(PATCHFILES)
1.9       imp      1146:    @(cd ${_DISTDIR}; \
1.1       niklas   1147:     for file in ${PATCHFILES}; do \
                   1148:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                   1149:            if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
1.9       imp      1150:                ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
1.1       niklas   1151:                ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
                   1152:                ${ECHO_MSG} ">> Please correct this problem and try again."; \
                   1153:                exit 1; \
                   1154:            fi ; \
                   1155:            ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
                   1156:            for site in ${PATCH_SITES}; do \
                   1157:                ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6       niklas   1158:                if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1       niklas   1159:                    continue 2; \
                   1160:                fi \
                   1161:            done; \
1.6       niklas   1162:            ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.9       imp      1163:            ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1.1       niklas   1164:            exit 1; \
                   1165:        fi \
                   1166:     done)
                   1167: .endif
                   1168: .endif
                   1169:
1.44      marc     1170: # This is for the use of sites which store distfiles which others may
                   1171: # fetch - only fetch the distfile if it is allowed to be
                   1172: # re-distributed freely
                   1173: mirror-distfiles:
                   1174: .if (${MIRROR_DISTFILE} == "yes")
                   1175:    @make fetch __ARCH_OK=yes NO_IGNORE=yes
                   1176: .endif
                   1177:
1.1       niklas   1178: # Extract
                   1179:
                   1180: .if !target(do-extract)
                   1181: do-extract:
1.6       niklas   1182: .if !defined(NO_WRKDIR)
1.14      niklas   1183: .if defined(WRKOBJDIR)
                   1184:    @${RM} -rf ${WRKOBJDIR}/${PORTSUBDIR}
1.44      marc     1185:    @${MKDIR} -p ${WRKOBJDIR}/${PORTSUBDIR}
1.18      niklas   1186:    @if [ ! -L ${WRKDIR} ] || \
                   1187:      [ X`${READLINK} ${WRKDIR}` != X${WRKOBJDIR}/${PORTSUBDIR} ]; then \
                   1188:        echo "${WRKDIR} -> ${WRKOBJDIR}/${PORTSUBDIR}"; \
                   1189:        ${RM} -f ${WRKDIR}; \
                   1190:        ${LN} -sf ${WRKOBJDIR}/${PORTSUBDIR} ${WRKDIR}; \
                   1191:    fi
1.14      niklas   1192: .else
1.1       niklas   1193:    @${RM} -rf ${WRKDIR}
1.9       imp      1194:    @${MKDIR} ${WRKDIR}
1.6       niklas   1195: .endif
1.14      niklas   1196: .endif
1.1       niklas   1197:    @for file in ${EXTRACT_ONLY}; do \
1.10      niklas   1198:        if ! (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
1.1       niklas   1199:        then \
                   1200:            exit 1; \
                   1201:        fi \
                   1202:    done
                   1203: .endif
                   1204:
                   1205: # Patch
                   1206:
                   1207: .if !target(do-patch)
                   1208: do-patch:
                   1209: .if defined(PATCHFILES)
                   1210:    @${ECHO_MSG} "===>  Applying distribution patches for ${PKGNAME}"
1.9       imp      1211:    @(cd ${_DISTDIR}; \
1.1       niklas   1212:      for i in ${PATCHFILES}; do \
1.6       niklas   1213:        if [ ${PATCH_DEBUG_TMP} = yes ]; then \
                   1214:            ${ECHO_MSG} "===>   Applying distribution patch $$i" ; \
                   1215:        fi; \
1.1       niklas   1216:        case $$i in \
                   1217:            *.Z|*.gz) \
                   1218:                ${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
                   1219:                ;; \
                   1220:            *) \
                   1221:                ${PATCH} ${PATCH_DIST_ARGS} < $$i; \
                   1222:                ;; \
                   1223:        esac; \
                   1224:      done)
                   1225: .endif
                   1226:    @if [ -d ${PATCHDIR} ]; then \
1.6       niklas   1227:        if [ "`echo ${PATCHDIR}/patch-*`" = "${PATCHDIR}/patch-*" ]; then \
                   1228:            ${ECHO_MSG} "===>   Ignoring empty patch directory"; \
                   1229:            if [ -d ${PATCHDIR}/CVS ]; then \
                   1230:                ${ECHO_MSG} "===>   Perhaps you forgot the -P flag to cvs co or update?"; \
                   1231:            fi; \
                   1232:        else \
1.9       imp      1233:            ${ECHO_MSG} "===>  Applying ${OPSYS} patches for ${PKGNAME}" ; \
1.6       niklas   1234:            for i in ${PATCHDIR}/patch-*; do \
                   1235:                case $$i in \
1.13      imp      1236:                    *.orig|*.rej|*~) \
1.6       niklas   1237:                        ${ECHO_MSG} "===>   Ignoring patchfile $$i" ; \
                   1238:                        ;; \
                   1239:                    *) \
                   1240:                        if [ ${PATCH_DEBUG_TMP} = yes ]; then \
1.9       imp      1241:                            ${ECHO_MSG} "===>   Applying ${OPSYS} patch $$i" ; \
1.6       niklas   1242:                        fi; \
                   1243:                        ${PATCH} ${PATCH_ARGS} < $$i; \
                   1244:                        ;; \
                   1245:                esac; \
                   1246:            done; \
                   1247:        fi; \
1.1       niklas   1248:    fi
                   1249: .endif
                   1250:
                   1251: # Configure
                   1252:
                   1253: .if !target(do-configure)
                   1254: do-configure:
1.7       niklas   1255:    @if [ -f ${SCRIPTDIR}/configure ]; then \
1.13      imp      1256:        cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
                   1257:          ${SCRIPTDIR}/configure; \
1.1       niklas   1258:    fi
                   1259: .if defined(HAS_CONFIGURE)
1.6       niklas   1260:    @(cd ${WRKSRC} && CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \
1.47      espie    1261:        CXX="${CXX}" ac_cv_path_CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" \
1.1       niklas   1262:        INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \
1.6       niklas   1263:        INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
1.1       niklas   1264:        ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS})
                   1265: .endif
                   1266: .if defined(USE_IMAKE)
1.44      marc     1267:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${XMKMF})
1.1       niklas   1268: .endif
                   1269: .endif
                   1270:
                   1271: # Build
                   1272:
                   1273: .if !target(do-build)
                   1274: do-build:
1.44      marc     1275:    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
1.1       niklas   1276: .endif
                   1277:
                   1278: # Install
                   1279:
                   1280: .if !target(do-install)
                   1281: do-install:
1.44      marc     1282:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
1.1       niklas   1283: .endif
                   1284:
                   1285: # Package
                   1286:
                   1287: .if !target(do-package)
                   1288: do-package:
1.13      imp      1289:    @if [ -e ${PLIST} ]; then \
1.1       niklas   1290:        ${ECHO_MSG} "===>  Building package for ${PKGNAME}"; \
                   1291:        if [ -d ${PACKAGES} ]; then \
                   1292:            if [ ! -d ${PKGREPOSITORY} ]; then \
1.9       imp      1293:                if ! ${MKDIR} ${PKGREPOSITORY}; then \
1.1       niklas   1294:                    ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \
                   1295:                    exit 1; \
                   1296:                fi; \
                   1297:            fi; \
                   1298:        fi; \
                   1299:        if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \
                   1300:            if [ -d ${PACKAGES} ]; then \
                   1301:                ${MAKE} ${.MAKEFLAGS} package-links; \
                   1302:            fi; \
                   1303:        else \
                   1304:            ${MAKE} ${.MAKEFLAGS} delete-package; \
                   1305:            exit 1; \
                   1306:        fi; \
                   1307:    fi
                   1308: .endif
                   1309:
                   1310: # Some support rules for do-package
                   1311:
                   1312: .if !target(package-links)
                   1313: package-links:
                   1314:    @${MAKE} ${.MAKEFLAGS} delete-package-links
                   1315:    @for cat in ${CATEGORIES}; do \
                   1316:        if [ ! -d ${PACKAGES}/$$cat ]; then \
1.9       imp      1317:            if ! ${MKDIR} ${PACKAGES}/$$cat; then \
1.1       niklas   1318:                ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \
                   1319:                exit 1; \
                   1320:            fi; \
                   1321:        fi; \
                   1322:        ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
                   1323:    done;
                   1324: .endif
                   1325:
                   1326: .if !target(delete-package-links)
                   1327: delete-package-links:
                   1328:    @${RM} -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX};
                   1329: .endif
                   1330:
                   1331: .if !target(delete-package)
                   1332: delete-package:
                   1333:    @${MAKE} ${.MAKEFLAGS} delete-package-links
                   1334:    @${RM} -f ${PKGFILE}
                   1335: .endif
                   1336:
                   1337: ################################################################
                   1338: # This is the "generic" port target, actually a macro used from the
                   1339: # six main targets.  See below for more.
                   1340: ################################################################
                   1341:
                   1342: _PORT_USE: .USE
                   1343: .if make(real-fetch)
1.6       niklas   1344:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1.1       niklas   1345: .endif
                   1346: .if make(real-extract)
1.6       niklas   1347:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends lib-depends misc-depends
1.1       niklas   1348: .endif
                   1349: .if make(real-install)
1.13      imp      1350: .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
1.40      espie    1351:    @if [ -d ${PKG_DBDIR}/${PKGNAME} -o "X$$(ls -d ${PKG_DBDIR}/${PKGNAME:C/-[0-9].*//g}-* 2> /dev/null)" != "X" ]; then \
1.13      imp      1352:        ${ECHO_MSG} "===>  ${PKGNAME} is already installed - perhaps an older version?"; \
1.44      marc     1353:        ${ECHO_MSG} "      If so, you may wish to \`\`make deinstall'' and install"; \
1.13      imp      1354:        ${ECHO_MSG} "      this port again by \`\`make reinstall'' to upgrade it properly."; \
                   1355:        ${ECHO_MSG} "      If you really wish to overwrite the old port of ${PKGNAME}"; \
                   1356:        ${ECHO_MSG} "      without deleting it first, set the variable \"FORCE_PKG_REGISTER\""; \
                   1357:        ${ECHO_MSG} "      in your environment or the \"make install\" command line."; \
                   1358:        exit 1; \
                   1359:    fi
                   1360: .endif
1.14      niklas   1361:    @if [ `${SH} -c umask` != ${DEF_UMASK} ]; then \
1.13      imp      1362:        ${ECHO_MSG} "===>  Warning: your umask is \"`${SH} -c umask`"\".; \
                   1363:        ${ECHO_MSG} "      If this is not desired, set it to an appropriate value"; \
                   1364:        ${ECHO_MSG} "      and install this port again by \`\`make reinstall''."; \
                   1365:    fi
1.9       imp      1366:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends lib-depends
1.1       niklas   1367: .endif
                   1368: .if make(real-install)
                   1369: .if !defined(NO_MTREE)
                   1370:    @if [ `id -u` = 0 ]; then \
1.13      imp      1371:        if [ ! -f ${MTREE_FILE} ]; then \
                   1372:            ${ECHO_MSG} "Error: mtree file \"${MTREE_FILE}\" is missing."; \
                   1373:            ${ECHO_MSG} "Copy it from a suitable location (e.g., /usr/src/etc/mtree) and try again."; \
                   1374:            exit 1; \
                   1375:        else \
1.44      marc     1376:            if [ ! -d ${PREFIX} ]; then \
                   1377:                mkdir -p ${PREFIX}; \
                   1378:            fi; \
1.13      imp      1379:            ${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \
                   1380:        fi; \
1.1       niklas   1381:    else \
                   1382:        ${ECHO_MSG} "Warning: not superuser, can't run mtree."; \
                   1383:        ${ECHO_MSG} "Become root and try again to ensure correct permissions."; \
                   1384:    fi
                   1385: .endif
                   1386: .endif
1.6       niklas   1387:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/}
1.1       niklas   1388:    @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \
1.13      imp      1389:        cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
                   1390:            ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/}; \
1.1       niklas   1391:    fi
1.6       niklas   1392:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/}
                   1393:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/}
1.1       niklas   1394:    @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \
1.13      imp      1395:        cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
                   1396:            ${SCRIPTDIR}/${.TARGET:S/^real-/post-/}; \
1.1       niklas   1397:    fi
1.44      marc     1398: .if make(real-install) && (defined(_MANPAGES) || defined(_CATPAGES))
1.9       imp      1399: .if defined(MANCOMPRESSED) && defined(NOMANCOMPRESS)
                   1400:    @${ECHO_MSG} "===>   Uncompressing manual pages for ${PKGNAME}"
1.44      marc     1401: .for manpage in ${_MANPAGES} ${_CATPAGES}
                   1402:    @${GUNZIP_CMD} ${manpage}.gz
1.9       imp      1403: .endfor
                   1404: .elif !defined(MANCOMPRESSED) && !defined(NOMANCOMPRESS)
                   1405:    @${ECHO_MSG} "===>   Compressing manual pages for ${PKGNAME}"
1.44      marc     1406: .for manpage in ${_MANPAGES} ${_CATPAGES}
                   1407:    @if [ -L ${manpage} ]; then \
                   1408:        set - `${FILE} ${manpage}`; \
                   1409:        shift `expr $$# - 1`; \
                   1410:        ${LN} -sf $${1}.gz ${manpage}.gz; \
                   1411:        ${RM} ${manpage}; \
                   1412:    else \
                   1413:        ${GZIP_CMD} ${manpage}; \
                   1414:    fi
1.9       imp      1415: .endfor
                   1416: .endif
                   1417: .endif
                   1418: .if make(real-install) && !defined(NO_PKG_REGISTER)
1.6       niklas   1419:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fake-pkg
1.1       niklas   1420: .endif
                   1421: .if !make(real-fetch) \
                   1422:    && (!make(real-patch) || !defined(PATCH_CHECK_ONLY)) \
                   1423:    && (!make(real-package) || !defined(PACKAGE_NOINSTALL))
                   1424:    @${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.${.TARGET:S/^real-//}_done
                   1425: .endif
                   1426:
                   1427: ################################################################
                   1428: # Skeleton targets start here
                   1429: #
                   1430: # You shouldn't have to change these.  Either add the pre-* or
                   1431: # post-* targets/scripts or redefine the do-* targets.  These
                   1432: # targets don't do anything other than checking for cookies and
                   1433: # call the necessary targets/scripts.
                   1434: ################################################################
                   1435:
                   1436: .if !target(fetch)
                   1437: fetch:
1.6       niklas   1438:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-fetch
1.1       niklas   1439: .endif
                   1440:
                   1441: .if !target(extract)
                   1442: extract: checksum ${EXTRACT_COOKIE}
                   1443: .endif
                   1444:
                   1445: .if !target(patch)
                   1446: patch: extract ${PATCH_COOKIE}
                   1447: .endif
                   1448:
                   1449: .if !target(configure)
                   1450: configure: patch ${CONFIGURE_COOKIE}
                   1451: .endif
                   1452:
                   1453: .if !target(build)
                   1454: build: configure ${BUILD_COOKIE}
                   1455: .endif
                   1456:
                   1457: .if !target(install)
                   1458: install: build ${INSTALL_COOKIE}
                   1459: .endif
                   1460:
                   1461: .if !target(package)
                   1462: package: install ${PACKAGE_COOKIE}
                   1463: .endif
                   1464:
                   1465: ${EXTRACT_COOKIE}:
1.6       niklas   1466:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-extract
1.1       niklas   1467: ${PATCH_COOKIE}:
1.6       niklas   1468:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-patch
1.1       niklas   1469: ${CONFIGURE_COOKIE}:
1.6       niklas   1470:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-configure
1.1       niklas   1471: ${BUILD_COOKIE}:
1.6       niklas   1472:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-build
1.1       niklas   1473: ${INSTALL_COOKIE}:
1.32      marc     1474:    @touch ${INSTALL_PRE_COOKIE}
1.6       niklas   1475:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-install
1.1       niklas   1476: ${PACKAGE_COOKIE}:
1.6       niklas   1477:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-package
1.1       niklas   1478:
                   1479: # And call the macros
                   1480:
                   1481: real-fetch: _PORT_USE
                   1482: real-extract: _PORT_USE
                   1483:    @${ECHO_MSG} "===>  Extracting for ${PKGNAME}"
                   1484: real-patch: _PORT_USE
                   1485:    @${ECHO_MSG} "===>  Patching for ${PKGNAME}"
                   1486: real-configure: _PORT_USE
                   1487:    @${ECHO_MSG} "===>  Configuring for ${PKGNAME}"
                   1488: real-build: _PORT_USE
                   1489:    @${ECHO_MSG} "===>  Building for ${PKGNAME}"
                   1490: real-install: _PORT_USE
                   1491:    @${ECHO_MSG} "===>  Installing for ${PKGNAME}"
                   1492: real-package: _PORT_USE
                   1493:
                   1494: # Empty pre-* and post-* targets, note we can't use .if !target()
                   1495: # in the _PORT_USE macro
                   1496:
                   1497: .for name in fetch extract patch configure build install package
                   1498:
                   1499: .if !target(pre-${name})
                   1500: pre-${name}:
                   1501:    @${DO_NADA}
                   1502: .endif
                   1503:
                   1504: .if !target(post-${name})
                   1505: post-${name}:
                   1506:    @${DO_NADA}
                   1507: .endif
                   1508:
                   1509: .endfor
                   1510:
                   1511: # Checkpatch
                   1512: #
                   1513: # Special target to verify patches
                   1514:
                   1515: .if !target(checkpatch)
                   1516: checkpatch:
1.6       niklas   1517:    @cd ${.CURDIR} && ${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch
1.1       niklas   1518: .endif
                   1519:
                   1520: # Reinstall
                   1521: #
                   1522: # Special target to re-run install
                   1523:
                   1524: .if !target(reinstall)
1.13      imp      1525: reinstall:
1.32      marc     1526:    @${RM} -f ${INSTALL_PRE_COOKIE} ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
1.13      imp      1527:    @DEPENDS_TARGET=${DEPENDS_TARGET} ${MAKE} install
1.1       niklas   1528: .endif
                   1529:
1.44      marc     1530: # Deinstall
                   1531: #
                   1532: # Special target to remove installation
                   1533:
                   1534: .if !target(deinstall)
                   1535: uninstall deinstall:
                   1536:    @${ECHO_MSG} "===> Deinstalling for ${PKGNAME}"
                   1537:    @pkg_delete -f ${PKGNAME}
                   1538:    @${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
                   1539: .endif
                   1540:
                   1541:
1.1       niklas   1542: ################################################################
                   1543: # Some more targets supplied for users' convenience
                   1544: ################################################################
                   1545:
                   1546: # Cleaning up
                   1547:
                   1548: .if !target(pre-clean)
                   1549: pre-clean:
                   1550:    @${DO_NADA}
                   1551: .endif
                   1552:
                   1553: .if !target(clean)
                   1554: clean: pre-clean
1.9       imp      1555: .if !defined(NOCLEANDEPENDS)
                   1556:    @${MAKE} clean-depends
                   1557: .endif
1.1       niklas   1558:    @${ECHO_MSG} "===>  Cleaning for ${PKGNAME}"
1.6       niklas   1559: .if !defined(NO_WRKDIR)
1.44      marc     1560: .if  defined(WRKOBJDIR)
                   1561:    @${RM} -rf ${WRKOBJDIR}/${PORTSUBDIR}
                   1562:    @${RM} -f ${WRKDIR}
                   1563: .else
1.9       imp      1564:    @if [ -d ${WRKDIR} ]; then \
                   1565:        if [ -w ${WRKDIR} ]; then \
                   1566:            ${RM} -rf ${WRKDIR}; \
                   1567:        else \
                   1568:            ${ECHO_MSG} "===>   ${WRKDIR} not writable, skipping"; \
                   1569:        fi; \
                   1570:    fi
1.44      marc     1571: .endif
1.6       niklas   1572: .else
1.1       niklas   1573:    @${RM} -f ${WRKDIR}/.*_done
                   1574: .endif
                   1575: .endif
                   1576:
1.9       imp      1577: .if !target(pre-distclean)
                   1578: pre-distclean:
                   1579:    @${DO_NADA}
                   1580: .endif
                   1581:
                   1582: .if !target(distclean)
                   1583: distclean: pre-distclean clean
                   1584:    @${ECHO_MSG} "===>  Dist cleaning for ${PKGNAME}"
1.13      imp      1585:    @(if [ -d ${_DISTDIR} ]; then \
                   1586:        cd ${_DISTDIR}; \
                   1587:        ${RM} -f ${DISTFILES} ${PATCHFILES}; \
                   1588:    fi)
1.9       imp      1589: .if defined(DIST_SUBDIR)
1.13      imp      1590:    -@${RMDIR} ${_DISTDIR}
1.9       imp      1591: .endif
                   1592: .endif
                   1593:
1.1       niklas   1594: # Prints out a list of files to fetch (useful to do a batch fetch)
                   1595:
1.44      marc     1596: # are we called from bsd.port.subdir.mk (i.e. do we scan all dirs anyways)? XXX
                   1597: .ifdef(DIRPRFX)
                   1598: RECURSIVE_FETCH_LIST?= NO
                   1599: .else
                   1600: RECURSIVE_FETCH_LIST?= YES
                   1601: .endif
                   1602:
1.1       niklas   1603: .if !target(fetch-list)
                   1604: fetch-list:
1.44      marc     1605:    @${MAKE} fetch-list-recursive RECURSIVE_FETCH_LIST=${RECURSIVE_FETCH_LIST} | sort -u
                   1606: .endif # !target(fetch-list)
                   1607:
                   1608: .if !target(fetch-list-recursive)
                   1609: fetch-list-recursive:
                   1610:    @${MAKE} fetch-list-one-pkg
                   1611: .if ${RECURSIVE_FETCH_LIST} != "NO"
                   1612:    @for dir in `${ECHO} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS}  ${RUN_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u` `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
                   1613:        (cd $$dir; ${MAKE} fetch-list-recursive; ); \
                   1614:    done
                   1615: .endif # ${RECURSIVE_FETCH_LIST} != "NO"
                   1616: .endif # !target(fetch-list-recursive)
                   1617:
                   1618: .if !target(fetch-list-one-pkg)
                   1619: fetch-list-one-pkg:
1.9       imp      1620:    @${MKDIR} ${_DISTDIR}
1.44      marc     1621:    @[ -z "${_DISTDIR}" ] || ${ECHO} "${MKDIR} ${_DISTDIR}"
1.9       imp      1622:    @(cd ${_DISTDIR}; \
1.1       niklas   1623:     for file in ${DISTFILES}; do \
                   1624:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1.44      marc     1625:            ${ECHO} -n "cd ${_DISTDIR} && [ -f $$file -o -f `${BASENAME} $$file` ] || " ; \
                   1626:            for site in ${MASTER_SITES} ; do \
                   1627:                ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '|| ' ; \
1.1       niklas   1628:            done; \
                   1629:            ${ECHO} "echo $${file} not fetched" ; \
                   1630:        fi \
                   1631:    done)
                   1632: .if defined(PATCHFILES)
1.9       imp      1633:    @(cd ${_DISTDIR}; \
1.1       niklas   1634:     for file in ${PATCHFILES}; do \
                   1635:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1.44      marc     1636:            ${ECHO} -n "cd ${_DISTDIR} && [ -f $$file -o -f `${BASENAME} $$file` ] || " ; \
1.1       niklas   1637:            for site in ${PATCH_SITES}; do \
1.44      marc     1638:                ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '|| ' ; \
1.1       niklas   1639:            done; \
                   1640:            ${ECHO} "echo $${file} not fetched" ; \
                   1641:        fi \
1.44      marc     1642:    done)
                   1643: .endif # defined(PATCHFILES)
                   1644: .endif # !target(fetch-list-one-pkg)
1.1       niklas   1645:
                   1646: # Checksumming utilities
                   1647:
                   1648: .if !target(makesum)
                   1649: makesum: fetch
1.9       imp      1650:    @${MKDIR} ${FILESDIR}
1.1       niklas   1651:    @if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi
                   1652:    @(cd ${DISTDIR}; \
1.9       imp      1653:     for file in ${_CKSUMFILES}; do \
1.1       niklas   1654:        ${MD5} $$file >> ${MD5_FILE}; \
                   1655:     done)
1.9       imp      1656:    @for file in ${_IGNOREFILES}; do \
                   1657:        ${ECHO} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \
                   1658:    done
1.1       niklas   1659: .endif
                   1660:
                   1661: .if !target(checksum)
                   1662: checksum: fetch
                   1663:    @if [ ! -f ${MD5_FILE} ]; then \
                   1664:        ${ECHO_MSG} ">> No MD5 checksum file."; \
                   1665:    else \
1.9       imp      1666:        (cd ${DISTDIR}; OK="true"; \
                   1667:          for file in ${_CKSUMFILES}; do \
1.6       niklas   1668:            CKSUM=`${MD5} < $$file`; \
1.13      imp      1669:            CKSUM2=`${GREP} "^MD5 ($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1.1       niklas   1670:            if [ "$$CKSUM2" = "" ]; then \
1.9       imp      1671:                ${ECHO_MSG} ">> No checksum recorded for $$file."; \
                   1672:                OK="false"; \
                   1673:            elif [ "$$CKSUM2" = "IGNORE" ]; then \
                   1674:                ${ECHO_MSG} ">> Checksum for $$file is set to IGNORE in md5 file even though"; \
                   1675:                ${ECHO_MSG} "   the file is not in the "'$$'"{IGNOREFILES} list."; \
1.1       niklas   1676:                OK="false"; \
1.13      imp      1677:            elif [ "$$CKSUM" = "$$CKSUM2" ]; then \
                   1678:                ${ECHO_MSG} ">> Checksum OK for $$file."; \
                   1679:            else \
1.9       imp      1680:                ${ECHO_MSG} ">> Checksum mismatch for $$file."; \
1.13      imp      1681:                OK="false"; \
1.1       niklas   1682:            fi; \
                   1683:          done; \
1.9       imp      1684:          for file in ${_IGNOREFILES}; do \
                   1685:            CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
                   1686:            if [ "$$CKSUM2" = "" ]; then \
                   1687:                ${ECHO_MSG} ">> No checksum recorded for $$file, file is in "'$$'"{IGNOREFILES} list."; \
                   1688:                OK="false"; \
                   1689:            elif [ "$$CKSUM2" != "IGNORE" ]; then \
                   1690:                ${ECHO_MSG} ">> Checksum for $$file is not set to IGNORE in md5 file even though"; \
                   1691:                ${ECHO_MSG} "   the file is in the "'$$'"{IGNOREFILES} list."; \
                   1692:                OK="false"; \
                   1693:            fi; \
                   1694:          done; \
1.13      imp      1695:          if [ "$$OK" != "true" ]; then \
                   1696:            ${ECHO_MSG} "Make sure the Makefile and md5 file (${MD5_FILE})"; \
                   1697:            ${ECHO_MSG} "are up to date.  If you want to override this check, type"; \
                   1698:            ${ECHO_MSG} "\"make NO_CHECKSUM=yes [other args]\"."; \
                   1699:            exit 1; \
1.1       niklas   1700:          fi) ; \
                   1701:    fi
1.32      marc     1702: .endif
                   1703:
                   1704: # packing list utilities.  This generates a packing list from a recently
                   1705: # installed port.  Not perfect, but pretty close.  The generated file
                   1706: # will have to have some tweaks done by hand.
1.35      marc     1707: # Note: add @comment PACKAGE(arch=${ARCH}, opsys=${OPSYS}, vers=${OPSYS_VER})
                   1708: # when port is installed or package created.
1.32      marc     1709: #
                   1710: .if !target(plist)
                   1711: plist: install
                   1712:    @${MKDIR} ${PKGDIR}
                   1713:    @(dirs=""; \
                   1714:      ld=""; \
1.33      marc     1715:      ${ECHO} "@cwd ${PREFIX}"; \
                   1716:      ${ECHO} "@name ${PKGNAME}"; \
1.32      marc     1717:      for f in `${MAKE} package-depends|sort -u`; do ${ECHO} "@pkgdep $$f"; done; \
                   1718:      for f in `find ${PREFIX} -newer ${INSTALL_PRE_COOKIE} -print 2> /dev/null`; do \
                   1719:       ff=`${ECHO} $$f | ${SED} -e 's|^${PREFIX}/||'`; \
                   1720:       if [ -d $$f ]; then dirs="$$ff $$dirs"; \
                   1721:       else \
                   1722:        ${ECHO} $$ff; \
1.45      marc     1723:        if ${ECHO} $$f | ${GREP} -E -q -e '[^/]+\.so\.[0-9]+\.[0-9]+$$'; then \
1.32      marc     1724:         ld="$$LDCONFIG `${DIRNAME} $$f`"; \
                   1725:        fi; \
                   1726:       fi; \
                   1727:      done; \
                   1728:      for f in $$dirs; do \
                   1729:        if ${GREP} -q -e `${BASENAME} $$f` ${MTREE_FILE}; then \
                   1730:         :; \
                   1731:        else \
                   1732:         ${ECHO} "@dirrm $$f"; \
                   1733:        fi; \
                   1734:       done; \
                   1735:      for f in $$ld; do ${ECHO} "@exec ${LDCONFIG} -m $$f"; done; \
                   1736:    ) > ${PLIST}-auto
1.1       niklas   1737: .endif
                   1738:
                   1739: ################################################################
                   1740: # The special package-building targets
                   1741: # You probably won't need to touch these
                   1742: ################################################################
                   1743:
1.44      marc     1744: HTMLIFY=   ${SED} -e 's/&/\&amp;/g' -e 's/>/\&gt;/g' -e 's/</\&lt;/g'
                   1745:
                   1746: # Set to YES by the README.html target (and passed via depends-list
                   1747: # and package-depends)
                   1748: .ifndef PACKAGE_NAME_AS_LINK
                   1749: PACKAGE_NAME_AS_LINK=NO
                   1750: .endif # PACKAGE_NAME_AS_LINK
                   1751:
                   1752:
1.1       niklas   1753: # Nobody should want to override this unless PKGNAME is simply bogus.
                   1754:
                   1755: .if !target(package-name)
                   1756: package-name:
1.44      marc     1757: .if (${PACKAGE_NAME_AS_LINK} == "YES")
                   1758:    @${ECHO} '<A HREF="../../'`${MAKE} package-path | ${HTMLIFY}`'/README.html">'`echo ${PKGNAME} | ${HTMLIFY}`'</A>'
                   1759: .else
                   1760:    @${ECHO} '${PKGNAME}'
                   1761: .endif # PACKAGE_NAME_AS_LINK != ""
                   1762: .endif # !target(package-name)
                   1763:
                   1764: .if !target(package-path)
                   1765: package-path:
                   1766:    @pwd | sed s@`cd ${PORTSDIR} ; pwd`/@@g
1.1       niklas   1767: .endif
                   1768:
                   1769: # Show (recursively) all the packages this package depends on.
                   1770:
                   1771: .if !target(package-depends)
                   1772: package-depends:
1.13      imp      1773:    @for dir in `${ECHO} ${LIB_DEPENDS} ${RUN_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u` `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
                   1774:        if [ -d $$dir ]; then \
1.44      marc     1775:            (cd $$dir ; ${MAKE} package-name package-depends PACKAGE_NAME_AS_LINK=${PACKAGE_NAME_AS_LINK}); \
1.13      imp      1776:        else \
                   1777:            ${ECHO_MSG} "Warning: \"$$dir\" non-existent -- @pkgdep registration incomplete" >&2; \
                   1778:        fi; \
1.1       niklas   1779:    done
                   1780: .endif
                   1781:
                   1782: # Build a package but don't check the package cookie
                   1783:
                   1784: .if !target(repackage)
                   1785: repackage: pre-repackage package
                   1786:
                   1787: pre-repackage:
                   1788:    @${RM} -f ${PACKAGE_COOKIE}
                   1789: .endif
                   1790:
                   1791: # Build a package but don't check the cookie for installation, also don't
                   1792: # install package cookie
                   1793:
                   1794: .if !target(package-noinstall)
                   1795: package-noinstall:
1.6       niklas   1796:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package
1.1       niklas   1797: .endif
                   1798:
                   1799: ################################################################
                   1800: # Dependency checking
                   1801: ################################################################
                   1802:
                   1803: .if !target(depends)
                   1804: depends: lib-depends misc-depends
1.6       niklas   1805:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
                   1806:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends
                   1807:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends
1.1       niklas   1808:
                   1809: .if make(fetch-depends)
                   1810: DEPENDS_TMP+=  ${FETCH_DEPENDS}
                   1811: .endif
                   1812:
                   1813: .if make(build-depends)
                   1814: DEPENDS_TMP+=  ${BUILD_DEPENDS}
                   1815: .endif
                   1816:
                   1817: .if make(run-depends)
                   1818: DEPENDS_TMP+=  ${RUN_DEPENDS}
                   1819: .endif
                   1820:
                   1821: _DEPENDS_USE:  .USE
                   1822: .if defined(DEPENDS_TMP)
1.13      imp      1823: .if !defined(NO_DEPENDS)
1.44      marc     1824:    @for i in ${DEPENDS_TMP}; do \
1.1       niklas   1825:        prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1.13      imp      1826:        dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
                   1827:        if expr "$$dir" : '.*:' > /dev/null; then \
                   1828:            target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
                   1829:            dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1.1       niklas   1830:        else \
1.13      imp      1831:            target=${DEPENDS_TARGET}; \
1.1       niklas   1832:        fi; \
1.44      marc     1833:        found=not; \
1.1       niklas   1834:        if expr "$$prog" : \\/ >/dev/null; then \
                   1835:            if [ -e "$$prog" ]; then \
                   1836:                ${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - found"; \
1.44      marc     1837:                found=""; \
1.1       niklas   1838:            else \
                   1839:                ${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - not found"; \
                   1840:            fi; \
                   1841:        else \
1.44      marc     1842:            for d in `echo $$PATH | tr ':' ' '`; do \
                   1843:                if [ -x $$d/$$prog ]; then \
                   1844:                    found="$$d/$$prog"; \
                   1845:                    break; \
                   1846:                fi \
                   1847:            done; \
                   1848:            ${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - $$found found"; \
1.1       niklas   1849:        fi; \
1.44      marc     1850:        if [ X"$$found" = Xnot ]; then \
1.13      imp      1851:            ${ECHO_MSG} "===>  Verifying $$target for $$prog in $$dir"; \
1.1       niklas   1852:            if [ ! -d "$$dir" ]; then \
                   1853:                ${ECHO_MSG} ">> No directory for $$prog.  Skipping.."; \
                   1854:            else \
1.13      imp      1855:                (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1       niklas   1856:                ${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
                   1857:            fi; \
                   1858:        fi; \
                   1859:    done
                   1860: .endif
                   1861: .else
                   1862:    @${DO_NADA}
                   1863: .endif
                   1864:
                   1865: fetch-depends: _DEPENDS_USE
                   1866: build-depends: _DEPENDS_USE
                   1867: run-depends:   _DEPENDS_USE
                   1868:
                   1869: lib-depends:
                   1870: .if defined(LIB_DEPENDS)
1.13      imp      1871: .if !defined(NO_DEPENDS)
1.16      niklas   1872: .if (${MACHINE_ARCH} == "alpha")
                   1873:    @for i in ${LIB_DEPENDS}; do \
1.44      marc     1874:        lib=`${ECHO} $$i | ${SED} -e 's/:.*//' -e 's|\([^\\]\)\.|\1\\\\.|g'`; \
1.16      niklas   1875:        dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
                   1876:        if expr "$$dir" : '.*:' > /dev/null; then \
                   1877:            target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
                   1878:            dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
                   1879:        else \
                   1880:            target=${DEPENDS_TARGET}; \
                   1881:        fi; \
1.17      niklas   1882:        tmp=`mktemp /tmp/bpmXXXXXXXXXX`; \
1.42      marc     1883:        if ${LD} -r -o $$tmp -L${LOCALBASE}/lib -L${X11BASE}/lib -l$$lib; then \
1.16      niklas   1884:            ${ECHO_MSG} "===>  ${PKGNAME} depends on library: $$lib - found"; \
                   1885:        else \
                   1886:            ${ECHO_MSG} "===>  ${PKGNAME} depends on library: $$lib - not found"; \
                   1887:            ${ECHO_MSG} "===>  Verifying $$target for $$lib in $$dir"; \
                   1888:            if [ ! -d "$$dir" ]; then \
                   1889:                ${ECHO_MSG} ">> No directory for $$lib.  Skipping.."; \
                   1890:            else \
                   1891:                (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
                   1892:                ${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
                   1893:            fi; \
                   1894:        fi; \
1.17      niklas   1895:        ${RM} -f $$tmp; \
1.16      niklas   1896:    done
                   1897: .else
1.1       niklas   1898:    @for i in ${LIB_DEPENDS}; do \
1.44      marc     1899:        lib=`${ECHO} $$i | ${SED} -e 's/:.*//' -e 's|\([^\\]\)\.|\1\\\\.|g'`; \
1.13      imp      1900:        dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
                   1901:        if expr "$$dir" : '.*:' > /dev/null; then \
                   1902:            target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
                   1903:            dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
                   1904:        else \
                   1905:            target=${DEPENDS_TARGET}; \
                   1906:        fi; \
1.44      marc     1907:        libname=`${ECHO} $$lib | ${SED} -e 's|\\\\||g'`; \
                   1908:        reallib=`${LDCONFIG} -r | ${GREP} -e "-l$$lib" | awk '{ print $$3 }'`; \
                   1909:        if [ "X$$reallib" = X"" ]; then \
                   1910:            ${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$libname - not found"; \
                   1911:            ${ECHO_MSG} "===>  Verifying $$target for $$libname in $$dir"; \
1.1       niklas   1912:            if [ ! -d "$$dir" ]; then \
1.44      marc     1913:                ${ECHO_MSG} ">> No directory for $$libname.  Skipping.."; \
1.1       niklas   1914:            else \
1.13      imp      1915:                (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1       niklas   1916:                ${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
                   1917:            fi; \
1.44      marc     1918:        else \
                   1919:            ${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$libname - $$reallib found"; \
1.1       niklas   1920:        fi; \
                   1921:    done
1.16      niklas   1922: .endif
1.1       niklas   1923: .endif
                   1924: .else
                   1925:    @${DO_NADA}
                   1926: .endif
                   1927:
                   1928: misc-depends:
                   1929: .if defined(DEPENDS)
                   1930: .if !defined(NO_DEPENDS)
1.13      imp      1931:    @for dir in ${DEPENDS}; do \
                   1932:        if expr "$$dir" : '.*:' > /dev/null; then \
                   1933:            target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
                   1934:            dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
                   1935:        else \
                   1936:            target=${DEPENDS_TARGET}; \
                   1937:        fi; \
                   1938:        ${ECHO_MSG} "===>  ${PKGNAME} depends on: $$dir"; \
                   1939:        ${ECHO_MSG} "===>  Verifying $$target for $$dir"; \
                   1940:        if [ ! -d $$dir ]; then \
                   1941:            ${ECHO_MSG} ">> No directory for $$dir.  Skipping.."; \
1.1       niklas   1942:        else \
1.13      imp      1943:            (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1       niklas   1944:        fi \
                   1945:    done
                   1946:    @${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"
                   1947: .endif
                   1948: .else
                   1949:    @${DO_NADA}
                   1950: .endif
                   1951:
                   1952: .endif
                   1953:
1.9       imp      1954: .if !target(clean-depends)
                   1955: clean-depends:
                   1956: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || defined(LIB_DEPENDS) \
                   1957:    || defined(RUN_DEPENDS)
1.13      imp      1958:    @for dir in `${ECHO} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u`; do \
                   1959:        if [ -d $$dir ] ; then \
                   1960:            (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
                   1961:        fi \
1.9       imp      1962:    done
                   1963: .endif
                   1964: .if defined(DEPENDS)
1.13      imp      1965:    @for dir in `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
                   1966:        if [ -d $$dir ] ; then \
                   1967:            (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
                   1968:        fi \
1.9       imp      1969:    done
                   1970: .endif
                   1971: .endif
                   1972:
1.1       niklas   1973: .if !target(depends-list)
                   1974: depends-list:
1.13      imp      1975:    @for dir in `${ECHO} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u` `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
1.44      marc     1976:        (cd $$dir; ${MAKE} package-name depends-list PACKAGE_NAME_AS_LINK=${PACKAGE_NAME_AS_LINK}; ); \
1.1       niklas   1977:    done
                   1978: .endif
                   1979:
                   1980: ################################################################
                   1981: # Everything after here are internal targets and really
                   1982: # shouldn't be touched by anybody but the release engineers.
                   1983: ################################################################
                   1984:
                   1985: # This target generates an index entry suitable for aggregation into
                   1986: # a large index.  Format is:
                   1987: #
                   1988: # distribution-name|port-path|installation-prefix|comment| \
1.44      marc     1989: #  description-file|maintainer|categories|build deps|run deps|for arch
1.1       niklas   1990: #
                   1991: .if !target(describe)
                   1992: describe:
1.13      imp      1993:    @${ECHO} -n "${PKGNAME}|${.CURDIR}|"; \
                   1994:    ${ECHO} -n "${PREFIX}|"; \
                   1995:    if [ -f ${COMMENT} ]; then \
                   1996:        ${ECHO} -n "`${CAT} ${COMMENT}`"; \
1.1       niklas   1997:    else \
                   1998:        ${ECHO} -n "** No Description"; \
1.13      imp      1999:    fi; \
                   2000:    if [ -f ${DESCR} ]; then \
                   2001:        ${ECHO} -n "|${DESCR}"; \
1.1       niklas   2002:    else \
                   2003:        ${ECHO} -n "|/dev/null"; \
1.13      imp      2004:    fi; \
                   2005:    ${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|"; \
                   2006:    case "A${FETCH_DEPENDS}B${BUILD_DEPENDS}C${LIB_DEPENDS}D${DEPENDS}E" in \
                   2007:        ABCDE) ;; \
                   2008:        *) cd ${.CURDIR} && ${ECHO} -n `make depends-list|sort -u`;; \
                   2009:    esac; \
                   2010:    ${ECHO} -n "|"; \
                   2011:    case "A${RUN_DEPENDS}B${LIB_DEPENDS}C${DEPENDS}D" in \
                   2012:        ABCD) ;; \
                   2013:        *) cd ${.CURDIR} && ${ECHO} -n `make package-depends|sort -u`;; \
                   2014:    esac; \
1.44      marc     2015:    ${ECHO} -n "|"; \
                   2016:    if [ "${ONLY_FOR_ARCHS}" = "" ]; then \
                   2017:        ${ECHO} -n "any"; \
                   2018:    else \
                   2019:        ${ECHO} -n "${ONLY_FOR_ARCHS}"; \
                   2020:    fi; \
1.13      imp      2021:    ${ECHO} ""
1.1       niklas   2022: .endif
                   2023:
                   2024: .if !target(readmes)
                   2025: readmes:   readme
                   2026: .endif
                   2027:
                   2028: .if !target(readme)
                   2029: readme:
                   2030:    @rm -f README.html
1.6       niklas   2031:    @cd ${.CURDIR} && make README.html
1.1       niklas   2032: .endif
                   2033:
1.44      marc     2034: .if (${OPSYS} == "NetBSD")
                   2035: README_NAME=   ${TEMPLATES}/README.pkg
                   2036: .else
                   2037: README_NAME=   ${TEMPLATES}/README.port
                   2038: .endif
                   2039:
1.1       niklas   2040: README.html:
                   2041:    @${ECHO_MSG} "===>  Creating README.html for ${PKGNAME}"
1.44      marc     2042:    @${MAKE} depends-list PACKAGE_NAME_AS_LINK=YES >> $@.tmp1
                   2043:    @[ -s $@.tmp1 ] || echo "(none)" >> $@.tmp1
                   2044:    @${MAKE} package-depends PACKAGE_NAME_AS_LINK=YES >> $@.tmp2
                   2045:    @[ -s $@.tmp2 ] || echo "(none)" >> $@.tmp2
                   2046:    @${ECHO} ${PKGNAME} | ${HTMLIFY} >> $@.tmp3
                   2047:    @${CAT} ${README_NAME} | \
                   2048:        ${SED} -e 's|%%PORT%%|'"`${MAKE} package-path | ${HTMLIFY}`"'|g' \
                   2049:            -e '/%%PKG%%/r$@.tmp3' \
                   2050:            -e '/%%PKG%%/d' \
1.1       niklas   2051:            -e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \
                   2052:            -e '/%%COMMENT%%/d' \
1.44      marc     2053:            -e '/%%BUILD_DEPENDS%%/r$@.tmp1' \
                   2054:            -e '/%%BUILD_DEPENDS%%/d' \
                   2055:            -e '/%%RUN_DEPENDS%%/r$@.tmp2' \
                   2056:            -e '/%%RUN_DEPENDS%%/d' \
1.1       niklas   2057:        >> $@
1.44      marc     2058:    @rm -f $@.tmp1 $@.tmp2 $@.tmp3
1.1       niklas   2059:
                   2060: .if !target(print-depends-list)
                   2061: print-depends-list:
                   2062: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \
                   2063:    defined(LIB_DEPENDS) || defined(DEPENDS)
                   2064:    @${ECHO} -n 'This port requires package(s) "'
1.9       imp      2065:    @${ECHO} -n `make depends-list | sort -u`
1.1       niklas   2066:    @${ECHO} '" to build.'
                   2067: .endif
                   2068: .endif
                   2069:
                   2070: .if !target(print-package-depends)
                   2071: print-package-depends:
                   2072: .if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS)
                   2073:    @${ECHO} -n 'This port requires package(s) "'
1.9       imp      2074:    @${ECHO} -n `make package-depends | sort -u`
1.1       niklas   2075:    @${ECHO} '" to run.'
                   2076: .endif
                   2077: .endif
                   2078:
                   2079: # Fake installation of package so that user can pkg_delete it later.
                   2080: # Also, make sure that an installed port is recognized correctly in
                   2081: # accordance to the @pkgdep directive in the packing lists
                   2082:
                   2083: .if !target(fake-pkg)
                   2084: fake-pkg:
1.13      imp      2085:    @if [ ! -f ${PLIST} -o ! -f ${COMMENT} -o ! -f ${DESCR} ]; then ${ECHO} "** Missing package files for ${PKGNAME} - installation not recorded."; exit 1; fi
1.9       imp      2086:    @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi
1.1       niklas   2087: .if defined(FORCE_PKG_REGISTER)
                   2088:    @${RM} -rf ${PKG_DBDIR}/${PKGNAME}
                   2089: .endif
                   2090:    @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
                   2091:        ${ECHO_MSG} "===>  Registering installation for ${PKGNAME}"; \
1.9       imp      2092:        ${MKDIR} ${PKG_DBDIR}/${PKGNAME}; \
1.1       niklas   2093:        ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
1.13      imp      2094:        ${CP} ${DESCR} ${PKG_DBDIR}/${PKGNAME}/+DESC; \
                   2095:        ${CP} ${COMMENT} ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
1.1       niklas   2096:        if [ -f ${PKGDIR}/INSTALL ]; then \
                   2097:            ${CP} ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \
                   2098:        fi; \
                   2099:        if [ -f ${PKGDIR}/DEINSTALL ]; then \
                   2100:            ${CP} ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \
                   2101:        fi; \
                   2102:        if [ -f ${PKGDIR}/REQ ]; then \
                   2103:            ${CP} ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \
                   2104:        fi; \
1.44      marc     2105:        if [ -f ${PKGDIR}/MESSAGE ]; then \
                   2106:            ${CP} ${PKGDIR}/MESSAGE ${PKG_DBDIR}/${PKGNAME}/+DISPLAY; \
                   2107:        fi; \
                   2108:        for dep in `make package-depends ECHO_MSG=${TRUE} | sort -u`; do \
1.13      imp      2109:            if [ -d ${PKG_DBDIR}/$$dep ]; then \
                   2110:                if ! ${GREP} ^${PKGNAME}$$ ${PKG_DBDIR}/$$dep/+REQUIRED_BY \
                   2111:                    >/dev/null 2>&1; then \
                   2112:                    ${ECHO} ${PKGNAME} >> ${PKG_DBDIR}/$$dep/+REQUIRED_BY; \
                   2113:                fi; \
                   2114:            fi; \
                   2115:        done; \
1.1       niklas   2116:    fi
                   2117: .endif
                   2118:
                   2119: # Depend is generally meaningless for arbitrary ports, but if someone wants
                   2120: # one they can override this.  This is just to catch people who've gotten into
                   2121: # the habit of typing `make depend all install' as a matter of course.
                   2122: #
                   2123: .if !target(depend)
                   2124: depend:
                   2125: .endif
                   2126:
                   2127: # Same goes for tags
                   2128: .if !target(tags)
                   2129: tags:
1.10      niklas   2130: .endif
                   2131: