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

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