[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.62

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