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

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