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

1.9       imp         1: #-*- mode: Fundamental; tab-width: 4; -*-
                      2: # ex:ts=4
1.10    ! niklas      3: #  $OpenBSD: bsd.port.mk,v 1.9 1996/12/25 20:10:09 imp Exp $
1.9       imp         4: #  $NetBSD: $
1.1       niklas      5: #
                      6: #  bsd.port.mk - 940820 Jordan K. Hubbard.
                      7: #  This file is in the public domain.
                      8: #
1.9       imp         9: # FreeBSD Id: bsd.port.mk,v 1.241 1996/12/25 02:27:44 imp Exp
1.6       niklas     10: #
1.1       niklas     11: # Please view me with 4 column tabs!
                     12:
1.6       niklas     13: # This is for this file, not for the ports that includes it, so it's
                     14: # commented out -- the person to contact if you have questions/
                     15: # suggestions about bsd.port.mk.
                     16: #
                     17: # MAINTAINER=  asami@FreeBSD.ORG
                     18: #
1.9       imp        19: # OPENBSD_MAINTAINER=  imp@OpenBSD.ORG
                     20: #
1.1       niklas     21:
                     22: # Supported Variables and their behaviors:
                     23: #
                     24: # Variables that typically apply to all ports:
                     25: #
1.10    ! niklas     26: # ONLY_FOR_ARCHS- If a port only makes sense to certain architectures, this
        !            27: #                is a list containing the names for them.  It is checked
        !            28: #                against the predefined ${MACHINE} value
1.9       imp        29: # OPSYS            - Portability clause.  This is the operating system the
                     30: #                makefile is being used on.  Automatically set to
                     31: #                "FreeBSD," "NetBSD," or "OpenBSD" as appropriate.
                     32: # PORTSDIR     - The root of the ports tree.  Defaults:
                     33: #                  OpenBSD/FreeBSD: /usr/ports
                     34: #                  NetBSD: /usr/opt
1.1       niklas     35: # DISTDIR      - Where to get gzip'd, tarballed copies of original sources
1.9       imp        36: #                (default: ${PORTSDIR}/distfiles).
1.1       niklas     37: # PREFIX       - Where to install things in general (default: /usr/local).
                     38: # MASTER_SITES - Primary location(s) for distribution files if not found
1.9       imp        39: #                locally.
1.1       niklas     40: # PATCH_SITES  - Primary location(s) for distribution patch files
1.9       imp        41: #                (see PATCHFILES below) if not found locally.
1.1       niklas     42: #
1.9       imp        43: # MASTER_SITE_BACKUP - Backup location(s) for distribution files and patch
                     44: #                files if not found locally and ${MASTER_SITES}/${PATCH_SITES}
                     45: #                (default:
                     46: #                ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/)
1.1       niklas     47: # MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this
                     48: #                value.
1.9       imp        49: # MASTER_SITE_FREEBSD - If set, only use ${MASTER_SITE_BACKUP} for
1.1       niklas     50: #                MASTER_SITES.
                     51: # PACKAGES     - A top level directory where all packages go (rather than
                     52: #                going locally to each port). (default: ${PORTSDIR}/packages).
                     53: # GMAKE            - Set to path of GNU make if not in $PATH (default: gmake).
                     54: # XMKMF            - Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ).
                     55: # MAINTAINER   - The e-mail address of the contact person for this port
                     56: #                (default: ports@FreeBSD.ORG).
1.9       imp        57: # CATEGORIES   - A list of descriptive categories into which this port falls.
1.1       niklas     58: #
                     59: # Variables that typically apply to an individual port.  Non-Boolean
                     60: # variables without defaults are *mandatory*.
                     61: #
                     62: # WRKDIR       - A temporary working directory that gets *clobbered* on clean
                     63: #                (default: ${.CURDIR}/work).
                     64: # WRKSRC       - A subdirectory of ${WRKDIR} where the distribution actually
                     65: #                unpacks to.  (Default: ${WRKDIR}/${DISTNAME} unless
                     66: #                NO_WRKSUBDIR is set, in which case simply ${WRKDIR}).
                     67: # DISTNAME     - Name of port or distribution.
                     68: # DISTFILES        - Name(s) of archive file(s) containing distribution
                     69: #                (default: ${DISTNAME}${EXTRACT_SUFX}).
                     70: # PATCHFILES   - Name(s) of additional files that contain distribution
                     71: #                patches (default: none).  make will look for them at
                     72: #                PATCH_SITES (see above).  They will automatically be
                     73: #                uncompressed before patching if the names end with
                     74: #                ".gz" or ".Z".
1.9       imp        75: # DIST_SUBDIR  - Suffix to ${DISTDIR}.  If set, all ${DISTFILES}
1.1       niklas     76: #                and ${PATCHFILES} will be put in this subdirectory of
                     77: #                ${DISTDIR}.  Also they will be fetched in this subdirectory
                     78: #                from FreeBSD mirror sites.
1.9       imp        79: # ALLFILES     - All of ${DISTFILES} and ${PATCHFILES}.
                     80: # IGNOREFILES  - If some of the ${ALLFILES} are not checksum-able, set
                     81: #                this variable to their names.
1.1       niklas     82: # PKGNAME      - Name of the package file to create if the DISTNAME
                     83: #                isn't really relevant for the port/package
                     84: #                (default: ${DISTNAME}).
                     85: # EXTRACT_ONLY - If defined, a subset of ${DISTFILES} you want to
                     86: #                actually extract.
                     87: # PATCHDIR         - A directory containing any additional patches you made
                     88: #                to port this software to FreeBSD (default:
                     89: #                ${.CURDIR}/patches)
                     90: # SCRIPTDIR    - A directory containing any auxiliary scripts
                     91: #                (default: ${.CURDIR}/scripts)
                     92: # FILESDIR         - A directory containing any miscellaneous additional files.
                     93: #                (default: ${.CURDIR}/files)
                     94: # PKGDIR       - A direction containing any package creation files.
                     95: #                (default: ${.CURDIR}/pkg)
                     96: # PKG_DBDIR        - Where package installation is recorded (default: /var/db/pkg)
                     97: # FORCE_PKG_REGISTER - If set, it will overwrite any existing package
                     98: #                registration information in ${PKG_DBDIR}/${PKGNAME}.
                     99: # NO_MTREE     - If set, will not invoke mtree from bsd.port.mk from
                    100: #                the "install" target.  This is the default if
                    101: #                USE_IMAKE or USE_X11 is set.
                    102: #
1.6       niklas    103: # NO_BUILD     - Use a dummy (do-nothing) build target.
                    104: # NO_CONFIGURE - Use a dummy (do-nothing) configure target.
1.9       imp       105: # NO_CDROM     - Port may not go on CDROM.  Set this string to reason.
1.6       niklas    106: # NO_DESCRIBE  - Use a dummy (do-nothing) describe target.
1.1       niklas    107: # NO_EXTRACT   - Use a dummy (do-nothing) extract target.
1.6       niklas    108: # NO_INSTALL   - Use a dummy (do-nothing) install target.
1.1       niklas    109: # NO_PACKAGE   - Use a dummy (do-nothing) package target.
1.6       niklas    110: # NO_PKG_REGISTER - Don't register a port install as a package.
1.1       niklas    111: # NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}.
                    112: # NO_WRKDIR        - There's no work directory at all; port does this someplace
                    113: #                else.
                    114: # NO_DEPENDS   - Don't verify build of dependencies.
1.9       imp       115: # BROKEN       - Port is broken.  Set this string to the reason why.
1.1       niklas    116: # RESTRICTED   - Port is restricted.  Set this string to the reason why.
                    117: # USE_GMAKE        - Says that the port uses gmake.
                    118: # USE_IMAKE        - Says that the port uses imake.
                    119: # USE_X11      - Says that the port uses X11.
                    120: # NO_INSTALL_MANPAGES - For imake ports that don't like the install.man
                    121: #                      target.
                    122: # HAS_CONFIGURE    - Says that the port has its own configure script.
                    123: # GNU_CONFIGURE    - Set if you are using GNU configure (optional).
                    124: # CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'.
                    125: # CONFIGURE_ARGS - Pass these args to configure if ${HAS_CONFIGURE} is set.
                    126: # CONFIGURE_ENV  - Pass these env (shell-like) to configure if
                    127: #                ${HAS_CONFIGURE} is set.
                    128: # IS_INTERACTIVE - Set this if your port needs to interact with the user
                    129: #                during a build.  User can then decide to skip this port by
                    130: #                setting ${BATCH}, or compiling only the interactive ports
                    131: #                by setting ${INTERACTIVE}.
1.7       niklas    132: # FETCH_DEPENDS - A list of "path:dir" pairs of other ports this
                    133: #                package depends in the "fetch" stage.  "path" is the
                    134: #                name of a file if it starts with a slash (/), an
                    135: #                executable otherwise.  make will test for the
                    136: #                existence (if it is a full pathname) or search for
                    137: #                it in your $PATH (if it is an executable) and go
                    138: #                into "dir" to do a "make all install" if it's not
                    139: #                found.
                    140: # BUILD_DEPENDS - A list of "path:dir" pairs of other ports this
                    141: #                package depends to build (between the "extract" and
                    142: #                "build" stages, inclusive).  The test done to
                    143: #                determine the existence of the dependency is the
                    144: #                same as FETCH_DEPENDS.
                    145: # RUN_DEPENDS  - A list of "path:dir" pairs of other ports this
                    146: #                package depends to run.  The test done to determine
                    147: #                the existence of the dependency is the same as
                    148: #                FETCH_DEPENDS.  This will be checked during the
                    149: #                "install" stage and the name of the dependency will
                    150: #                be put into the package as well.
1.1       niklas    151: # LIB_DEPENDS  - A list of "lib:dir" pairs of other ports this package
                    152: #                depends on.  "lib" is the name of a shared library.
                    153: #                make will use "ldconfig -r" to search for the
                    154: #                library.  Note that lib can be any regular expression,
                    155: #                and you need two backslashes in front of dots (.) to
                    156: #                supress its special meaning (e.g., use
                    157: #                "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*").
                    158: # DEPENDS      - A list of other ports this package depends on being
                    159: #                made first.  Use this for things that don't fall into
                    160: #                the above two categories.
                    161: # EXTRACT_CMD  - Command for extracting archive (default: tar).
                    162: # EXTRACT_SUFX - Suffix for archive names (default: .tar.gz).
                    163: # EXTRACT_BEFORE_ARGS -
                    164: #                Arguments to ${EXTRACT_CMD} before filename
                    165: #                (default: -C ${WRKDIR} -xzf).
                    166: # EXTRACT_AFTER_ARGS -
                    167: #                Arguments to ${EXTRACT_CMD} following filename
                    168: #                (default: none).
                    169: #
1.6       niklas    170: # FETCH_CMD          - Full path to ftp/http fetch command if not in $PATH
                    171: #                (default: /usr/bin/fetch).
                    172: # FETCH_BEFORE_ARGS -
                    173: #                Arguments to ${FETCH_CMD} before filename (default: none).
                    174: # FETCH_AFTER_ARGS -
                    175: #                Arguments to ${FETCH_CMD} following filename (default: none).
1.1       niklas    176: #
                    177: # Motif support:
                    178: #
                    179: # REQUIRES_MOTIF - Set this in your port if it requires Motif.  It will  be
                    180: #                built only if HAVE_MOTIF is set.
                    181: # HAVE_MOTIF   - If set, means system has Motif.  Typically set in
                    182: #                /etc/make.conf.
                    183: # MOTIF_STATIC - If set, link libXm statically; otherwise, link it
1.6       niklas    184: #                dynamically.  Typically set in /etc/make.conf.
                    185: # MOTIFLIB     - Set automatically to appropriate value depending on
                    186: #                ${MOTIF_STATIC}.  Substitute references to -lXm with
                    187: #                patches to make your port conform to our standards.
1.1       niklas    188: #
                    189: # Variables to change if you want a special behavior:
                    190: #
                    191: # ECHO_MSG     - Used to print all the '===>' style prompts - override this
                    192: #                to turn them off (default: /bin/echo).
                    193: # IS_DEPENDED_TARGET -
                    194: #                The target to execute when a port is called as a
                    195: #                dependency (default: install).  E.g., "make fetch
                    196: #                IS_DEPENDED_TARGET=fetch" will fetch all the distfiles,
                    197: #                including those of dependencies, without actually building
                    198: #                any of them).
1.6       niklas    199: # PATCH_DEBUG  - If set, print out more information about the patches as
                    200: #                it attempts to apply them.
                    201: #
1.9       imp       202: # Variables that serve as convenient "aliases" for your *-install targets.
                    203: # Use these like: "${INSTALL_PROGRAM} ${WRKSRC}/prog ${PREFIX}/bin".
1.6       niklas    204: #
                    205: # INSTALL_PROGRAM - A command to install binary executables.
                    206: # INSTALL_SCRIPT - A command to install executable scripts.
                    207: # INSTALL_DATA - A command to install sharable data.
                    208: # INSTALL_MAN  - A command to install manpages (doesn't compress).
1.1       niklas    209: #
1.9       imp       210: # If your port doesn't automatically compress manpages, set the following.
                    211: # Depending on the setting of NOMANCOMPRESS, the make rules will compress
                    212: # the manpages for you.
                    213: #
                    214: # MAN<sect>        - A list of manpages, categorized by section.  For
                    215: #                example, if your port has "man/man1/foo.1" and
                    216: #                "man/mann/bar.n", set "MAN1=foo.1" and "MANN=bar.n".
                    217: #                The available sections chars are "123456789LN".
                    218: # MANPREFIX        - The directory prefix for ${MAN<sect>} (default: ${PREFIX}).
                    219: #
1.1       niklas    220: # Default targets and their behaviors:
                    221: #
                    222: # fetch            - Retrieves ${DISTFILES} (and ${PATCHFILES} if defined)
                    223: #                into ${DISTDIR} as necessary.
                    224: # fetch-list   - Show list of files that would be retrieved by fetch
                    225: # extract      - Unpacks ${DISTFILES} into ${WRKDIR}.
                    226: # patch            - Apply any provided patches to the source.
                    227: # configure        - Runs either GNU configure, one or more local configure
                    228: #                scripts or nothing, depending on what's available.
                    229: # build            - Actually compile the sources.
                    230: # install      - Install the results of a build.
                    231: # reinstall        - Install the results of a build, ignoring "already installed"
                    232: #                flag.
                    233: # package      - Create a package from an _installed_ port.
                    234: # describe     - Try to generate a one-line description for each port for
                    235: #                use in INDEX files and the like.
                    236: # checkpatch   - Do a "patch -C" instead of a "patch".  Note that it may
                    237: #                give incorrect results if multiple patches deal with
                    238: #                the same file.
                    239: # checksum     - Use files/md5 to ensure that your distfiles are valid.
                    240: # makesum      - Generate files/md5 (only do this for your own ports!).
                    241: #
                    242: # Default sequence for "all" is:  fetch checksum extract patch configure build
                    243: #
                    244: # Please read the comments in the targets section below, you
                    245: # should be able to use the pre-* or post-* targets/scripts
                    246: # (which are available for every stage except checksum) or
                    247: # override the do-* targets to do pretty much anything you want.
                    248: #
                    249: # NEVER override the "regular" targets unless you want to open
                    250: # a major can of worms.
                    251:
1.10    ! niklas    252: .if defined(ONLY_FOR_ARCHS)
        !           253: .for __ARCH in ${ONLY_FOR_ARCHS}
        !           254: .if ${MACHINE} == "${__ARCH}"
        !           255: __ARCH_OK= 1
        !           256: .endif
        !           257: .endfor
        !           258: .else
        !           259: __ARCH_OK= 1
        !           260: .endif
        !           261:
        !           262: .if !defined(__ARCH_OK)
        !           263: .MAIN: all
        !           264:
        !           265: fetch fetch-list extract patch configure build install reinstall package describe checkpatch checksum makesum all:
        !           266:    @echo "This port is only for ${ONLY_FOR_ARCHS},"
        !           267:    @echo "and you are running ${MACHINE}."
        !           268: .else
        !           269:
1.9       imp       270: # Get the operating system type
                    271: OPSYS!=    uname -s
                    272:
1.1       niklas    273: .if exists(${.CURDIR}/../Makefile.inc)
                    274: .include "${.CURDIR}/../Makefile.inc"
                    275: .endif
                    276:
1.9       imp       277: .if (${OPSYS} == "OpenBSD")
1.10    ! niklas    278: NOMANCOMPRESS?=    yes
1.9       imp       279: .endif
1.6       niklas    280:
1.1       niklas    281: # These need to be absolute since we don't know how deep in the ports
                    282: # tree we are and thus can't go relative.  They can, of course, be overridden
1.9       imp       283: # by individual Makefiles or local system make configuration.
                    284: .if (${OPSYS} == "NetBSD")
                    285: PORTSDIR?=     ${DESTDIR}/usr/opt
                    286: .else
1.1       niklas    287: PORTSDIR?=     ${DESTDIR}/usr/ports
1.9       imp       288: .endif
1.1       niklas    289: LOCALBASE?=        /usr/local
                    290: X11BASE?=      /usr/X11R6
1.9       imp       291: DISTDIR?=      ${PORTSDIR}/distfiles
                    292: _DISTDIR?=     ${DISTDIR}/${DIST_SUBDIR}
1.1       niklas    293: PACKAGES?=     ${PORTSDIR}/packages
                    294: TEMPLATES?=        ${PORTSDIR}/templates
                    295: .if !defined(NO_WRKDIR)
1.10    ! niklas    296: .if defined(OBJMACHINE)
        !           297: WRKDIR?=       ${.CURDIR}/work.${MACHINE}
        !           298: .else
1.1       niklas    299: WRKDIR?=       ${.CURDIR}/work
1.10    ! niklas    300: .endif
1.1       niklas    301: .else
                    302: WRKDIR?=       ${.CURDIR}
                    303: .endif
                    304: .if defined(NO_WRKSUBDIR)
                    305: WRKSRC?=       ${WRKDIR}
                    306: .else
                    307: WRKSRC?=       ${WRKDIR}/${DISTNAME}
                    308: .endif
                    309: PATCHDIR?=     ${.CURDIR}/patches
                    310: SCRIPTDIR?=        ${.CURDIR}/scripts
                    311: FILESDIR?=     ${.CURDIR}/files
                    312: PKGDIR?=       ${.CURDIR}/pkg
                    313: .if defined(USE_IMAKE) || defined(USE_X11)
                    314: PREFIX?=       ${X11BASE}
                    315: .else
                    316: PREFIX?=       ${LOCALBASE}
                    317: .endif
                    318: # The following 4 lines should go away as soon as the ports are all updated
                    319: .if defined(EXEC_DEPENDS)
                    320: BUILD_DEPENDS+=    ${EXEC_DEPENDS}
                    321: RUN_DEPENDS+=  ${EXEC_DEPENDS}
                    322: .endif
                    323: .if defined(USE_GMAKE)
                    324: BUILD_DEPENDS+=               gmake:${PORTSDIR}/devel/gmake
                    325: .endif
                    326:
                    327: .if exists(${PORTSDIR}/../Makefile.inc)
                    328: .include "${PORTSDIR}/../Makefile.inc"
                    329: .endif
                    330:
                    331: # Don't change these!!!  These names are built into the _TARGET_USE macro,
                    332: # there is no way to refer to them cleanly from within the macro AFAIK.
                    333: EXTRACT_COOKIE?=   ${WRKDIR}/.extract_done
                    334: CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done
                    335: INSTALL_COOKIE?=   ${WRKDIR}/.install_done
                    336: BUILD_COOKIE?=     ${WRKDIR}/.build_done
                    337: PATCH_COOKIE?=     ${WRKDIR}/.patch_done
                    338: PACKAGE_COOKIE?=   ${WRKDIR}/.package_done
                    339:
                    340: # How to do nothing.  Override if you, for some strange reason, would rather
                    341: # do something.
1.6       niklas    342: DO_NADA?=      /usr/bin/true
1.1       niklas    343:
                    344: # Miscellaneous overridable commands:
                    345: GMAKE?=            gmake
                    346: XMKMF?=            xmkmf -a
1.9       imp       347: .if exists(/usr/bin/md5)
                    348: MD5?=          /usr/bin/md5
                    349: .elif exists(/bin/md5)
1.4       deraadt   350: MD5?=          /bin/md5
1.9       imp       351: .elif exists(/usr/local/bin/md5)
                    352: MD5?=          /usr/local/bin/md5
                    353: .else
                    354: MD5?=          /sbin/md5
                    355: .endif
1.1       niklas    356: MD5_FILE?=     ${FILESDIR}/md5
                    357:
                    358: MAKE_FLAGS?=   -f
                    359: MAKEFILE?=     Makefile
                    360: MAKE_ENV+=     PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} MOTIFLIB="${MOTIFLIB}" CFLAGS="${CFLAGS}"
                    361:
1.9       imp       362: .if (${OPSYS} == "OpenBSD")
1.6       niklas    363: FETCH_CMD?=        /usr/bin/ftp
1.9       imp       364: .else
                    365: FETCH_CMD?=        /usr/bin/fetch
                    366: .endif
1.1       niklas    367:
                    368: TOUCH?=            /usr/bin/touch
                    369: TOUCH_FLAGS?=  -f
                    370:
                    371: PATCH?=            /usr/bin/patch
                    372: PATCH_STRIP?=  -p0
                    373: PATCH_DIST_STRIP?= -p0
                    374: .if defined(PATCH_DEBUG)
1.6       niklas    375: PATCH_DEBUG_TMP=   yes
1.1       niklas    376: PATCH_ARGS?=   -d ${WRKSRC} -E ${PATCH_STRIP}
                    377: PATCH_DIST_ARGS?=  -d ${WRKSRC} -E ${PATCH_DIST_STRIP}
                    378: .else
1.6       niklas    379: PATCH_DEBUG_TMP=   no
1.3       niklas    380: PATCH_ARGS?=   -d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP}
                    381: PATCH_DIST_ARGS?=  -d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP}
1.1       niklas    382: .endif
                    383: .if defined(BATCH)
                    384: PATCH_ARGS+=       --batch
                    385: PATCH_DIST_ARGS+=  --batch
                    386: .endif
                    387:
                    388: .if defined(PATCH_CHECK_ONLY)
                    389: PATCH_ARGS+=   -C
                    390: PATCH_DIST_ARGS+=  -C
                    391: .endif
                    392:
1.9       imp       393: .if exists(/bin/tar)
1.5       tholo     394: EXTRACT_CMD?=  /bin/tar
1.9       imp       395: .else
                    396: EXTRACT_CMD?=  /usr/bin/tar
                    397: .endif
1.1       niklas    398: EXTRACT_SUFX?= .tar.gz
                    399: # Backwards compatability.
                    400: .if defined(EXTRACT_ARGS)
                    401: EXTRACT_BEFORE_ARGS?=   ${EXTRACT_ARGS}
                    402: .else
                    403: EXTRACT_BEFORE_ARGS?=   -xzf
                    404: .endif
                    405:
                    406: # Figure out where the local mtree file is
                    407: .if !defined(MTREE_LOCAL) && exists(/etc/mtree/BSD.local.dist)
                    408: MTREE_LOCAL=   /etc/mtree/BSD.local.dist
                    409: .endif
                    410: MTREE_CMD?=    /usr/sbin/mtree
                    411: MTREE_ARGS?=   -U -f ${MTREE_LOCAL} -d -e -p
                    412: .if defined(USE_X11) || defined(USE_IMAKE) || !defined(MTREE_LOCAL)
                    413: NO_MTREE=  yes
                    414: .endif
                    415:
1.10    ! niklas    416: .if (${OPSYS} == "OpenBSD")
        !           417: .include <bsd.own.mk>
        !           418: MAKE_ENV+= EXTRA_SYS_MK_INCLUDES="<bsd.own.mk>"
        !           419: .endif
        !           420:
1.6       niklas    421: # A few aliases for *-install targets
                    422: INSTALL_PROGRAM= \
                    423:    ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
                    424: INSTALL_SCRIPT= \
                    425:    ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
                    426: INSTALL_DATA= \
                    427:    ${INSTALL} ${COPY} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE}
                    428: INSTALL_MAN= \
                    429:    ${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
                    430:
1.1       niklas    431: # The user can override the NO_PACKAGE by specifying this from
                    432: # the make command line
                    433: .if defined(FORCE_PACKAGE)
                    434: .undef NO_PACKAGE
                    435: .endif
                    436:
                    437: PKG_CMD?=      /usr/sbin/pkg_create
                    438: .if !defined(PKG_ARGS)
1.9       imp       439: PKG_ARGS=      -v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST -p ${PREFIX} -P "`${MAKE} package-depends|sort -u`"
1.1       niklas    440: .if exists(${PKGDIR}/INSTALL)
                    441: PKG_ARGS+=     -i ${PKGDIR}/INSTALL
                    442: .endif
                    443: .if exists(${PKGDIR}/DEINSTALL)
                    444: PKG_ARGS+=     -k ${PKGDIR}/DEINSTALL
                    445: .endif
                    446: .if exists(${PKGDIR}/REQ)
                    447: PKG_ARGS+=     -r ${PKGDIR}/REQ
                    448: .endif
1.9       imp       449: .if exists(${PKGDIR}/MESSAGE)
                    450: PKG_ARGS+=     -D ${PKGDIR}/MESSAGE
                    451: .endif
1.1       niklas    452: .if !defined(NO_MTREE) && defined(MTREE_LOCAL)
                    453: PKG_ARGS+=     -m ${MTREE_LOCAL}
                    454: .endif
                    455: .endif
                    456: PKG_SUFX?=     .tgz
                    457: # where pkg_add records its dirty deeds.
                    458: PKG_DBDIR?=        /var/db/pkg
                    459:
                    460: # shared/dynamic motif libs
                    461: .if defined(HAVE_MOTIF)
                    462: .if defined(MOTIF_STATIC)
                    463: MOTIFLIB?= ${X11BASE}/lib/libXm.a
                    464: .else
                    465: MOTIFLIB?= -L${X11BASE}/lib -lXm
                    466: .endif
                    467: .endif
                    468:
                    469: ECHO?=     /bin/echo
1.9       imp       470: CAT?=      /bin/cat
1.1       niklas    471: CP?=       /bin/cp
                    472: SETENV?=   /usr/bin/env
                    473: RM?=       /bin/rm
1.9       imp       474: MKDIR?=        /bin/mkdir -p
                    475: RMDIR?=        /bin/rmdir
                    476: AWK?=      /usr/bin/awk
                    477: BASENAME?= /usr/bin/basename
                    478: FALSE?=        /usr/bin/false
                    479: GREP?=     /usr/bin/grep
1.1       niklas    480: GZCAT?=        /usr/bin/gzcat
1.9       imp       481: GZIP?=     -9
                    482: GZIP_CMD?= /usr/bin/gzip -nf ${GZIP}
                    483: GUNZIP_CMD?=   /usr/bin/gunzip -f
1.1       niklas    484: SED?=      /usr/bin/sed
                    485:
                    486: # Used to print all the '===>' style prompts - override this to turn them off.
                    487: ECHO_MSG?=     ${ECHO}
                    488:
                    489: ALL_TARGET?=       all
                    490: INSTALL_TARGET?=   install
                    491:
1.9       imp       492: # Popular master sites
                    493: MASTER_SITE_XCONTRIB?= \
                    494:    ftp://ftp.x.org/contrib/${MASTER_SITE_SUBDIR}/ \
                    495:    ftp://crl.dec.com/pub/X11/contrib/${MASTER_SITE_SUBDIR}/
                    496:
                    497: MASTER_SITE_GNU?=  \
                    498:    ftp://prep.ai.mit.edu/pub/gnu/${MASTER_SITE_SUBDIR}/ \
                    499:    ftp://wuarchive.wustl.edu/systems/gnu/${MASTER_SITE_SUBDIR}/
                    500:
                    501: MASTER_SITE_PERL_CPAN?=    \
                    502:    ftp://ftp.digital.com/pub/plan/perl/CPAN/modules/by-module/${MASTER_SITE_SUBDIR}/ \
                    503:    ftp://ftp.cdrom.com/pub/perl/CPAN/modules/by-module/${MASTER_SITE_SUBDIR}/
                    504:
                    505: MASTER_SITE_TEX_CTAN?=  \
                    506:         ftp://ftp.cdrom.com/pub/tex/ctan/${MASTER_SITE_SUBDIR}/  \
                    507:         ftp://wuarchive.wustl.edu/packages/TeX/${MASTER_SITE_SUBDIR}/  \
                    508:         ftp://ftp.funet.fi/pub/TeX/CTAN/${MASTER_SITE_SUBDIR}/  \
                    509:         ftp.tex.ac.uk/public/ctan/tex-archive/${MASTER_SITE_SUBDIR}/
                    510:
                    511: MASTER_SITE_SUNSITE?=  \
                    512:    ftp://sunsite.unc.edu/pub/Linux/${MASTER_SITE_SUBDIR}/ \
                    513:    ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/${MASTER_SITE_SUBDIR}/ \
                    514:    ftp://ftp.funet.fi/pub/mirrors/sunsite.unc.edu/pub/Linux/${MASTER_SITE_SUBDIR}/
                    515:
                    516: # The primary backup site.
                    517: MASTER_SITE_BACKUP?=   \
                    518:    ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
                    519:
                    520: # If the user has this set, go to the FreeBSD repository for everything.
1.1       niklas    521: .if defined(MASTER_SITE_FREEBSD)
1.9       imp       522: MASTER_SITE_OVERRIDE=  ${MASTER_SITE_BACKUP}
1.1       niklas    523: .endif
                    524:
1.7       niklas    525: # Empty declaration to avoid "variable MASTER_SITES recursive" error
                    526: MASTER_SITES?=
                    527: PATCH_SITES?=
1.1       niklas    528: # I guess we're in the master distribution business! :)  As we gain mirror
                    529: # sites for distfiles, add them to this list.
                    530: .if !defined(MASTER_SITE_OVERRIDE)
1.9       imp       531: MASTER_SITES+= ${MASTER_SITE_BACKUP}
                    532: PATCH_SITES+=  ${MASTER_SITE_BACKUP}
1.1       niklas    533: .else
                    534: MASTER_SITES:= ${MASTER_SITE_OVERRIDE} ${MASTER_SITES}
                    535: PATCH_SITES:=  ${MASTER_SITE_OVERRIDE} ${PATCH_SITES}
                    536: .endif
                    537:
1.7       niklas    538: # Search CDROM first if mounted, symlink instead of copy if
                    539: # FETCH_SYMLINK_DISTFILES is set
                    540: .if exists(/cdrom/ports/distfiles)
                    541: MASTER_SITES:= file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${MASTER_SITES}
                    542: PATCH_SITES:=  file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${PATCH_SITES}
                    543: .if defined(FETCH_SYMLINK_DISTFILES)
                    544: FETCH_BEFORE_ARGS+=    -l
                    545: .endif
                    546: .endif
                    547:
1.1       niklas    548: # Derived names so that they're easily overridable.
                    549: DISTFILES?=        ${DISTNAME}${EXTRACT_SUFX}
                    550: PKGNAME?=      ${DISTNAME}
                    551:
1.9       imp       552: ALLFILES?= ${DISTFILES} ${PATCHFILES}
                    553:
                    554: .if defined(IGNOREFILES)
                    555: CKSUMFILES!=   \
                    556:    for file in ${ALLFILES}; do \
                    557:        ignore=0; \
                    558:        for tmp in ${IGNOREFILES}; do \
                    559:            if [ "$$file" = "$$tmp" ]; then \
                    560:                ignore=1; \
                    561:            fi; \
                    562:        done; \
                    563:        if [ "$$ignore" = 0 ]; then \
                    564:            echo "$$file"; \
                    565:        fi; \
                    566:    done
                    567: .else
                    568: CKSUMFILES=        ${ALLFILES}
                    569: .endif
                    570:
                    571: # List of all files, with ${DIST_SUBDIR} in front.  Used for checksum.
                    572: .if defined(DIST_SUBDIR)
                    573: _CKSUMFILES?=  ${CKSUMFILES:S/^/${DIST_SUBDIR}\//}
                    574: _IGNOREFILES?= ${IGNOREFILES:S/^/${DIST_SUBDIR}\//}
                    575: .else
                    576: _CKSUMFILES?=  ${CKSUMFILES}
                    577: _IGNOREFILES?= ${IGNOREFILES}
                    578: .endif
                    579:
1.1       niklas    580: # This is what is actually going to be extracted, and is overridable
                    581: #  by user.
                    582: EXTRACT_ONLY?= ${DISTFILES}
                    583:
                    584: # Documentation
                    585: MAINTAINER?=   ports@FreeBSD.ORG
1.9       imp       586:
                    587: .if !defined(CATEGORIES)
                    588: .BEGIN:
                    589:    @${ECHO_MSG} "CATEGORIES is mandatory."
                    590:    @${FALSE}
                    591: .endif
1.1       niklas    592:
                    593: # Note this has to start with a capital letter (or more accurately, it
                    594: #  shouldn't match "[a-z]*"), see the target "delete-package-links" below.
                    595: PKGREPOSITORYSUBDIR?=  All
                    596: PKGREPOSITORY?=        ${PACKAGES}/${PKGREPOSITORYSUBDIR}
                    597: .if exists(${PACKAGES})
                    598: PKGFILE?=      ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
                    599: .else
                    600: PKGFILE?=      ${PKGNAME}${PKG_SUFX}
                    601: .endif
                    602:
                    603: CONFIGURE_SCRIPT?= configure
                    604:
                    605: .if defined(GNU_CONFIGURE)
                    606: CONFIGURE_ARGS+=   --prefix=${PREFIX}
                    607: HAS_CONFIGURE=     yes
                    608: .endif
                    609:
1.9       imp       610: MANPREFIX?=    ${PREFIX}
                    611:
                    612: .for sect in 1 2 3 4 5 6 7 8 9
                    613: MAN${sect}PREFIX?= ${MANPREFIX}
                    614: .endfor
                    615: MANLPREFIX?=   ${MANPREFIX}
                    616: MANNPREFIX?=   ${MANPREFIX}
                    617:
                    618: MANLANG?=  ""  # english only by default
                    619:
                    620: .for lang in ${MANLANG}
                    621:
                    622: .for sect in 1 2 3 4 5 6 7 8 9
                    623: .if defined(MAN${sect})
                    624: _MANPAGES+=    ${MAN${sect}:S%^%${MAN${sect}PREFIX}/man/${lang}/man${sect}/%}
                    625: .endif
                    626: .endfor
                    627:
                    628: .if defined(MANL)
                    629: _MANPAGES+=    ${MANL:S%^%${MANLPREFIX}/man/${lang}/manl/%}
                    630: .endif
                    631:
                    632: .if defined(MANN)
                    633: _MANPAGES+=    ${MANN:S%^%${MANNPREFIX}/man/${lang}/mann/%}
                    634: .endif
                    635:
                    636: .endfor
                    637:
                    638: .if defined(_MANPAGES) && defined(MANCOMPRESSED)
                    639: _MANPAGES:=    ${_MANPAGES:S/$/.gz/}
                    640: .endif
                    641:
1.1       niklas    642: .MAIN: all
                    643:
                    644: ################################################################
                    645: # Many ways to disable a port.
                    646: #
                    647: # If we're in BATCH mode and the port is interactive, or we're
                    648: # in interactive mode and the port is non-interactive, skip all
                    649: # the important targets.  The reason we have two modes is that
                    650: # one might want to leave a build in BATCH mode running
                    651: # overnight, then come back in the morning and do _only_ the
                    652: # interactive ones that required your intervention.
                    653: #
                    654: # Don't attempt to build ports that require Motif if you don't
                    655: # have Motif.
                    656: #
                    657: # Ignore ports that can't be resold if building for a CDROM.
                    658: #
                    659: # Don't build a port if it's restricted and we don't want to get
                    660: # into that.
                    661: #
                    662: # Don't build a port if it's broken.
                    663: ################################################################
                    664:
1.9       imp       665: .if (defined(IS_INTERACTIVE) && defined(BATCH))
                    666: IGNORE=    "is an interactive port"
                    667: .elif (!defined(IS_INTERACTIVE) && defined(INTERACTIVE))
                    668: IGNORE=    "is not an interactive port"
                    669: .elif (defined(REQUIRES_MOTIF) && !defined(HAVE_MOTIF))
                    670: IGNORE=    "requires Motif"
                    671: .elif (defined(NO_CDROM) && defined(FOR_CDROM))
                    672: IGNORE=    "may not be placed on a CDROM: ${NO_CDROM}"
                    673: .elif (defined(RESTRICTED) && defined(NO_RESTRICTED))
                    674: IGNORE=    "is restricted: ${RESTRICTED}"
                    675: .elif defined(BROKEN)
                    676: IGNORE=    "is marked as broken: ${BROKEN}"
1.1       niklas    677: .endif
                    678:
                    679: .if defined(IGNORE)
1.9       imp       680: .if defined(IGNORE_SILENT)
                    681: IGNORECMD= ${DO_NADA}
                    682: .else
                    683: IGNORECMD= ${ECHO_MSG} "===>  ${PKGNAME} ${IGNORE}."
                    684: .endif
                    685: fetch:
                    686:    @${IGNORECMD}
                    687: checksum:
                    688:    @${IGNORECMD}
                    689: extract:
                    690:    @${IGNORECMD}
                    691: patch:
                    692:    @${IGNORECMD}
                    693: configure:
                    694:    @${IGNORECMD}
1.1       niklas    695: all:
1.9       imp       696:    @${IGNORECMD}
1.1       niklas    697: build:
1.9       imp       698:    @${IGNORECMD}
1.1       niklas    699: install:
1.9       imp       700:    @${IGNORECMD}
1.1       niklas    701: package:
1.9       imp       702:    @${IGNORECMD}
1.1       niklas    703: .endif
                    704:
                    705: .if defined(ALL_HOOK)
                    706: all:
1.6       niklas    707:    @cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \
1.1       niklas    708:      DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \
                    709:      PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
                    710:      FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
                    711:      DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \
                    712:      RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \
                    713:    ${ALL_HOOK}
                    714: .endif
                    715:
                    716: .if !target(all)
                    717: all: build
                    718: .endif
                    719:
                    720: .if !defined(IS_DEPENDED_TARGET)
                    721: IS_DEPENDED_TARGET=    install
                    722: .endif
                    723:
                    724: .if !target(is_depended)
                    725: is_depended:   ${IS_DEPENDED_TARGET}
                    726: .endif
                    727:
                    728: ################################################################
                    729: # The following are used to create easy dummy targets for
                    730: # disabling some bit of default target behavior you don't want.
                    731: # They still check to see if the target exists, and if so don't
                    732: # do anything, since you might want to set this globally for a
                    733: # group of ports in a Makefile.inc, but still be able to
                    734: # override from an individual Makefile.
                    735: ################################################################
                    736:
1.9       imp       737: # Disable checksum
                    738: .if defined(NO_CHECKSUM) && !target(checksum)
                    739: checksum: fetch
                    740:    @${DO_NADA}
                    741: .endif
                    742:
1.1       niklas    743: # Disable extract
                    744: .if defined(NO_EXTRACT) && !target(extract)
                    745: extract: checksum
                    746:    @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
                    747: checksum: fetch
                    748:    @${DO_NADA}
                    749: makesum:
                    750:    @${DO_NADA}
                    751: .endif
                    752:
1.9       imp       753: # Disable patch
                    754: .if defined(NO_PATCH) && !target(patch)
                    755: patch: extract
                    756:    @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
                    757: .endif
                    758:
1.1       niklas    759: # Disable configure
                    760: .if defined(NO_CONFIGURE) && !target(configure)
                    761: configure: patch
                    762:    @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
                    763: .endif
                    764:
                    765: # Disable build
                    766: .if defined(NO_BUILD) && !target(build)
                    767: build: configure
                    768:    @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
                    769: .endif
                    770:
1.9       imp       771: # Disable install
                    772: .if defined(NO_INSTALL) && !target(install)
                    773: install: build
                    774:    @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
                    775: .endif
                    776:
1.1       niklas    777: # Disable package
                    778: .if defined(NO_PACKAGE) && !target(package)
                    779: package:
1.9       imp       780: .if defined(IGNORE_SILENT)
1.1       niklas    781:    @${DO_NADA}
1.9       imp       782: .else
                    783:    @${ECHO_MSG} "===>  ${PKGNAME} may not be packaged: ${NO_PACKAGE}."
1.1       niklas    784: .endif
                    785: .endif
                    786:
1.9       imp       787: # Disable describe
                    788: .if defined(NO_DESCRIBE) && !target(describe)
                    789: describe:
                    790:    @${DO_NADA}
1.1       niklas    791: .endif
                    792:
                    793: ################################################################
                    794: # More standard targets start here.
                    795: #
                    796: # These are the body of the build/install framework.  If you are
                    797: # not happy with the default actions, and you can't solve it by
                    798: # adding pre-* or post-* targets/scripts, override these.
                    799: ################################################################
                    800:
                    801: # Fetch
                    802:
                    803: .if !target(do-fetch)
                    804: do-fetch:
1.9       imp       805:    @${MKDIR} ${_DISTDIR}
                    806:    @(cd ${_DISTDIR}; \
1.1       niklas    807:     for file in ${DISTFILES}; do \
                    808:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                    809:            if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
1.9       imp       810:                ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
1.1       niklas    811:                ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
                    812:                ${ECHO_MSG} ">> Please correct this problem and try again."; \
                    813:                exit 1; \
                    814:            fi ; \
                    815:            ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
                    816:            for site in ${MASTER_SITES}; do \
                    817:                ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6       niklas    818:                if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1       niklas    819:                    continue 2; \
                    820:                fi \
                    821:            done; \
1.6       niklas    822:            ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.9       imp       823:            ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1.1       niklas    824:            exit 1; \
                    825:        fi \
                    826:     done)
                    827: .if defined(PATCHFILES)
1.9       imp       828:    @(cd ${_DISTDIR}; \
1.1       niklas    829:     for file in ${PATCHFILES}; do \
                    830:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                    831:            if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
1.9       imp       832:                ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
1.1       niklas    833:                ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
                    834:                ${ECHO_MSG} ">> Please correct this problem and try again."; \
                    835:                exit 1; \
                    836:            fi ; \
                    837:            ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
                    838:            for site in ${PATCH_SITES}; do \
                    839:                ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6       niklas    840:                if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1       niklas    841:                    continue 2; \
                    842:                fi \
                    843:            done; \
1.6       niklas    844:            ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.9       imp       845:            ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1.1       niklas    846:            exit 1; \
                    847:        fi \
                    848:     done)
                    849: .endif
                    850: .endif
                    851:
                    852: # Extract
                    853:
                    854: .if !target(do-extract)
                    855: do-extract:
1.6       niklas    856: .if !defined(NO_WRKDIR)
1.1       niklas    857:    @${RM} -rf ${WRKDIR}
1.9       imp       858:    @${MKDIR} ${WRKDIR}
1.6       niklas    859: .endif
1.1       niklas    860:    @for file in ${EXTRACT_ONLY}; do \
1.10    ! niklas    861:        if ! (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
1.1       niklas    862:        then \
                    863:            exit 1; \
                    864:        fi \
                    865:    done
                    866: .endif
                    867:
                    868: # Patch
                    869:
                    870: .if !target(do-patch)
                    871: do-patch:
                    872: .if defined(PATCHFILES)
                    873:    @${ECHO_MSG} "===>  Applying distribution patches for ${PKGNAME}"
1.9       imp       874:    @(cd ${_DISTDIR}; \
1.1       niklas    875:      for i in ${PATCHFILES}; do \
1.6       niklas    876:        if [ ${PATCH_DEBUG_TMP} = yes ]; then \
                    877:            ${ECHO_MSG} "===>   Applying distribution patch $$i" ; \
                    878:        fi; \
1.1       niklas    879:        case $$i in \
                    880:            *.Z|*.gz) \
                    881:                ${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
                    882:                ;; \
                    883:            *) \
                    884:                ${PATCH} ${PATCH_DIST_ARGS} < $$i; \
                    885:                ;; \
                    886:        esac; \
                    887:      done)
                    888: .endif
                    889:    @if [ -d ${PATCHDIR} ]; then \
1.6       niklas    890:        if [ "`echo ${PATCHDIR}/patch-*`" = "${PATCHDIR}/patch-*" ]; then \
                    891:            ${ECHO_MSG} "===>   Ignoring empty patch directory"; \
                    892:            if [ -d ${PATCHDIR}/CVS ]; then \
                    893:                ${ECHO_MSG} "===>   Perhaps you forgot the -P flag to cvs co or update?"; \
                    894:            fi; \
                    895:        else \
1.9       imp       896:            ${ECHO_MSG} "===>  Applying ${OPSYS} patches for ${PKGNAME}" ; \
1.6       niklas    897:            for i in ${PATCHDIR}/patch-*; do \
                    898:                case $$i in \
                    899:                    *.orig|*~) \
                    900:                        ${ECHO_MSG} "===>   Ignoring patchfile $$i" ; \
                    901:                        ;; \
                    902:                    *) \
                    903:                        if [ ${PATCH_DEBUG_TMP} = yes ]; then \
1.9       imp       904:                            ${ECHO_MSG} "===>   Applying ${OPSYS} patch $$i" ; \
1.6       niklas    905:                        fi; \
                    906:                        ${PATCH} ${PATCH_ARGS} < $$i; \
                    907:                        ;; \
                    908:                esac; \
                    909:            done; \
                    910:        fi; \
1.1       niklas    911:    fi
                    912: .endif
                    913:
                    914: # Configure
                    915:
                    916: .if !target(do-configure)
                    917: do-configure:
1.7       niklas    918:    @if [ -f ${SCRIPTDIR}/configure ]; then \
1.6       niklas    919:        cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR}\
                    920:          WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} \
                    921:          SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \
                    922:          PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} DEPENDS="${DEPENDS}" \
1.7       niklas    923:          X11BASE=${X11BASE} /bin/sh ${SCRIPTDIR}/configure; \
1.1       niklas    924:    fi
                    925: .if defined(HAS_CONFIGURE)
1.6       niklas    926:    @(cd ${WRKSRC} && CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \
1.1       niklas    927:        INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \
1.6       niklas    928:        INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
1.1       niklas    929:        ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS})
                    930: .endif
                    931: .if defined(USE_IMAKE)
1.6       niklas    932:    @(cd ${WRKSRC} && ${XMKMF})
1.1       niklas    933: .endif
                    934: .endif
                    935:
                    936: # Build
                    937:
                    938: .if !target(do-build)
                    939: do-build:
                    940: .if defined(USE_GMAKE)
                    941:    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
                    942: .else defined(USE_GMAKE)
                    943:    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
                    944: .endif
                    945: .endif
                    946:
                    947: # Install
                    948:
                    949: .if !target(do-install)
                    950: do-install:
1.6       niklas    951:    @if [ `/bin/sh -c umask` != 0022 ]; then \
1.9       imp       952:        ${ECHO_MSG} "===>  Warning: your umask is \"`/bin/sh -c umask`"\".; \
                    953:        ${ECHO_MSG} "      If this is not desired, set it to an appropriate value"; \
                    954:        ${ECHO_MSG} "      and install this port again by \`\`make reinstall''."; \
1.6       niklas    955:    fi
1.1       niklas    956: .if defined(USE_GMAKE)
1.6       niklas    957:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
1.1       niklas    958: .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
1.6       niklas    959:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
1.1       niklas    960: .endif
                    961: .else defined(USE_GMAKE)
1.6       niklas    962:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
1.1       niklas    963: .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
1.6       niklas    964:    @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
1.1       niklas    965: .endif
                    966: .endif
                    967: .endif
                    968:
                    969: # Package
                    970:
                    971: .if !target(do-package)
                    972: do-package:
                    973:    @if [ -e ${PKGDIR}/PLIST ]; then \
                    974:        ${ECHO_MSG} "===>  Building package for ${PKGNAME}"; \
                    975:        if [ -d ${PACKAGES} ]; then \
                    976:            if [ ! -d ${PKGREPOSITORY} ]; then \
1.9       imp       977:                if ! ${MKDIR} ${PKGREPOSITORY}; then \
1.1       niklas    978:                    ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \
                    979:                    exit 1; \
                    980:                fi; \
                    981:            fi; \
                    982:        fi; \
                    983:        if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \
                    984:            if [ -d ${PACKAGES} ]; then \
                    985:                ${MAKE} ${.MAKEFLAGS} package-links; \
                    986:            fi; \
                    987:        else \
                    988:            ${MAKE} ${.MAKEFLAGS} delete-package; \
                    989:            exit 1; \
                    990:        fi; \
                    991:    fi
                    992: .endif
                    993:
                    994: # Some support rules for do-package
                    995:
                    996: .if !target(package-links)
                    997: package-links:
                    998:    @${MAKE} ${.MAKEFLAGS} delete-package-links
                    999:    @for cat in ${CATEGORIES}; do \
                   1000:        if [ ! -d ${PACKAGES}/$$cat ]; then \
1.9       imp      1001:            if ! ${MKDIR} ${PACKAGES}/$$cat; then \
1.1       niklas   1002:                ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \
                   1003:                exit 1; \
                   1004:            fi; \
                   1005:        fi; \
                   1006:        ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
                   1007:    done;
                   1008: .endif
                   1009:
                   1010: .if !target(delete-package-links)
                   1011: delete-package-links:
                   1012:    @${RM} -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX};
                   1013: .endif
                   1014:
                   1015: .if !target(delete-package)
                   1016: delete-package:
                   1017:    @${MAKE} ${.MAKEFLAGS} delete-package-links
                   1018:    @${RM} -f ${PKGFILE}
                   1019: .endif
                   1020:
                   1021: ################################################################
                   1022: # This is the "generic" port target, actually a macro used from the
                   1023: # six main targets.  See below for more.
                   1024: ################################################################
                   1025:
                   1026: _PORT_USE: .USE
                   1027: .if make(real-fetch)
1.6       niklas   1028:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1.1       niklas   1029: .endif
                   1030: .if make(real-extract)
1.6       niklas   1031:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends lib-depends misc-depends
1.1       niklas   1032: .endif
                   1033: .if make(real-install)
1.9       imp      1034:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends lib-depends
1.1       niklas   1035: .endif
                   1036: .if make(real-install)
                   1037: .if !defined(NO_MTREE)
                   1038:    @if [ `id -u` = 0 ]; then \
                   1039:        ${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \
                   1040:    else \
                   1041:        ${ECHO_MSG} "Warning: not superuser, can't run mtree."; \
                   1042:        ${ECHO_MSG} "Become root and try again to ensure correct permissions."; \
                   1043:    fi
                   1044: .endif
                   1045: .endif
1.6       niklas   1046:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/}
1.1       niklas   1047:    @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \
1.6       niklas   1048:        cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
1.1       niklas   1049:          WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
                   1050:          FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
                   1051:          DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
                   1052:            /bin/sh ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/}; \
                   1053:    fi
1.6       niklas   1054:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/}
                   1055:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/}
1.1       niklas   1056:    @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \
1.6       niklas   1057:        cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR}\
                   1058:          WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} \
                   1059:          SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \
                   1060:          PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} DEPENDS="${DEPENDS}" \
                   1061:          X11BASE=${X11BASE} \
1.1       niklas   1062:            /bin/sh ${SCRIPTDIR}/${.TARGET:S/^real-/post-/}; \
                   1063:    fi
1.9       imp      1064: .if make(real-install) && defined(_MANPAGES)
                   1065: .if defined(MANCOMPRESSED) && defined(NOMANCOMPRESS)
                   1066:    @${ECHO_MSG} "===>   Uncompressing manual pages for ${PKGNAME}"
                   1067: .for manpage in ${_MANPAGES}
                   1068:    @${GUNZIP_CMD} ${manpage}
                   1069: .endfor
                   1070: .elif !defined(MANCOMPRESSED) && !defined(NOMANCOMPRESS)
                   1071:    @${ECHO_MSG} "===>   Compressing manual pages for ${PKGNAME}"
                   1072: .for manpage in ${_MANPAGES}
                   1073:    @${GZIP_CMD} ${manpage}
                   1074: .endfor
                   1075: .endif
                   1076: .endif
                   1077: .if make(real-install) && !defined(NO_PKG_REGISTER)
1.6       niklas   1078:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fake-pkg
1.1       niklas   1079: .endif
                   1080: .if !make(real-fetch) \
                   1081:    && (!make(real-patch) || !defined(PATCH_CHECK_ONLY)) \
                   1082:    && (!make(real-package) || !defined(PACKAGE_NOINSTALL))
                   1083:    @${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.${.TARGET:S/^real-//}_done
                   1084: .endif
                   1085:
                   1086: ################################################################
                   1087: # Skeleton targets start here
                   1088: #
                   1089: # You shouldn't have to change these.  Either add the pre-* or
                   1090: # post-* targets/scripts or redefine the do-* targets.  These
                   1091: # targets don't do anything other than checking for cookies and
                   1092: # call the necessary targets/scripts.
                   1093: ################################################################
                   1094:
                   1095: .if !target(fetch)
                   1096: fetch:
1.6       niklas   1097:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-fetch
1.1       niklas   1098: .endif
                   1099:
                   1100: .if !target(extract)
                   1101: extract: checksum ${EXTRACT_COOKIE}
                   1102: .endif
                   1103:
                   1104: .if !target(patch)
                   1105: patch: extract ${PATCH_COOKIE}
                   1106: .endif
                   1107:
                   1108: .if !target(configure)
                   1109: configure: patch ${CONFIGURE_COOKIE}
                   1110: .endif
                   1111:
                   1112: .if !target(build)
                   1113: build: configure ${BUILD_COOKIE}
                   1114: .endif
                   1115:
                   1116: .if !target(install)
                   1117: install: build ${INSTALL_COOKIE}
                   1118: .endif
                   1119:
                   1120: .if !target(package)
                   1121: package: install ${PACKAGE_COOKIE}
                   1122: .endif
                   1123:
                   1124: ${EXTRACT_COOKIE}:
1.6       niklas   1125:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-extract
1.1       niklas   1126: ${PATCH_COOKIE}:
1.6       niklas   1127:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-patch
1.1       niklas   1128: ${CONFIGURE_COOKIE}:
1.6       niklas   1129:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-configure
1.1       niklas   1130: ${BUILD_COOKIE}:
1.6       niklas   1131:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-build
1.1       niklas   1132: ${INSTALL_COOKIE}:
1.6       niklas   1133:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-install
1.1       niklas   1134: ${PACKAGE_COOKIE}:
1.6       niklas   1135:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-package
1.1       niklas   1136:
                   1137: # And call the macros
                   1138:
                   1139: real-fetch: _PORT_USE
                   1140: real-extract: _PORT_USE
                   1141:    @${ECHO_MSG} "===>  Extracting for ${PKGNAME}"
                   1142: real-patch: _PORT_USE
                   1143:    @${ECHO_MSG} "===>  Patching for ${PKGNAME}"
                   1144: real-configure: _PORT_USE
                   1145:    @${ECHO_MSG} "===>  Configuring for ${PKGNAME}"
                   1146: real-build: _PORT_USE
                   1147:    @${ECHO_MSG} "===>  Building for ${PKGNAME}"
                   1148: real-install: _PORT_USE
                   1149:    @${ECHO_MSG} "===>  Installing for ${PKGNAME}"
                   1150: real-package: _PORT_USE
                   1151:
                   1152: # Empty pre-* and post-* targets, note we can't use .if !target()
                   1153: # in the _PORT_USE macro
                   1154:
                   1155: .for name in fetch extract patch configure build install package
                   1156:
                   1157: .if !target(pre-${name})
                   1158: pre-${name}:
                   1159:    @${DO_NADA}
                   1160: .endif
                   1161:
                   1162: .if !target(post-${name})
                   1163: post-${name}:
                   1164:    @${DO_NADA}
                   1165: .endif
                   1166:
                   1167: .endfor
                   1168:
                   1169: # Checkpatch
                   1170: #
                   1171: # Special target to verify patches
                   1172:
                   1173: .if !target(checkpatch)
                   1174: checkpatch:
1.6       niklas   1175:    @cd ${.CURDIR} && ${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch
1.1       niklas   1176: .endif
                   1177:
                   1178: # Reinstall
                   1179: #
                   1180: # Special target to re-run install
                   1181:
                   1182: .if !target(reinstall)
                   1183: reinstall: pre-reinstall install
                   1184:
                   1185: pre-reinstall:
                   1186:    @${RM} -f ${INSTALL_COOKIE}
                   1187:    @${RM} -f ${PACKAGE_COOKIE}
                   1188: .endif
                   1189:
                   1190: ################################################################
                   1191: # Some more targets supplied for users' convenience
                   1192: ################################################################
                   1193:
                   1194: # Cleaning up
                   1195:
                   1196: .if !target(pre-clean)
                   1197: pre-clean:
                   1198:    @${DO_NADA}
                   1199: .endif
                   1200:
                   1201: .if !target(clean)
                   1202: clean: pre-clean
1.9       imp      1203: .if !defined(NOCLEANDEPENDS)
                   1204:    @${MAKE} clean-depends
                   1205: .endif
1.1       niklas   1206:    @${ECHO_MSG} "===>  Cleaning for ${PKGNAME}"
1.6       niklas   1207: .if !defined(NO_WRKDIR)
1.9       imp      1208:    @if [ -d ${WRKDIR} ]; then \
                   1209:        if [ -w ${WRKDIR} ]; then \
                   1210:            ${RM} -rf ${WRKDIR}; \
                   1211:        else \
                   1212:            ${ECHO_MSG} "===>   ${WRKDIR} not writable, skipping"; \
                   1213:        fi; \
                   1214:    fi
1.6       niklas   1215: .else
1.1       niklas   1216:    @${RM} -f ${WRKDIR}/.*_done
                   1217: .endif
                   1218: .endif
                   1219:
1.9       imp      1220: .if !target(pre-distclean)
                   1221: pre-distclean:
                   1222:    @${DO_NADA}
                   1223: .endif
                   1224:
                   1225: .if !target(distclean)
                   1226: distclean: pre-distclean clean
                   1227:    @${ECHO_MSG} "===>  Dist cleaning for ${PKGNAME}"
                   1228:    @(cd ${_DISTDIR}; \
                   1229:    ${RM} -f ${DISTFILES} ${PATCHFILES})
                   1230: .if defined(DIST_SUBDIR)
                   1231:    @${RMDIR} ${_DISTDIR}
                   1232: .endif
                   1233: .endif
                   1234:
1.1       niklas   1235: # Prints out a list of files to fetch (useful to do a batch fetch)
                   1236:
                   1237: .if !target(fetch-list)
                   1238: fetch-list:
1.9       imp      1239:    @${MKDIR} ${_DISTDIR}
                   1240:    @(cd ${_DISTDIR}; \
1.1       niklas   1241:     for file in ${DISTFILES}; do \
                   1242:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                   1243:            for site in ${MASTER_SITES}; do \
1.6       niklas   1244:                ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1.1       niklas   1245:                    break; \
                   1246:            done; \
                   1247:            ${ECHO} "echo $${file} not fetched" ; \
                   1248:        fi \
                   1249:    done)
                   1250: .if defined(PATCHFILES)
1.9       imp      1251:    @(cd ${_DISTDIR}; \
1.1       niklas   1252:     for file in ${PATCHFILES}; do \
                   1253:        if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
                   1254:            for site in ${PATCH_SITES}; do \
1.6       niklas   1255:                ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1.1       niklas   1256:                    break; \
                   1257:            done; \
                   1258:            ${ECHO} "echo $${file} not fetched" ; \
                   1259:        fi \
                   1260:     done)
                   1261: .endif
                   1262: .endif
                   1263:
                   1264: # Checksumming utilities
                   1265:
                   1266: .if !target(makesum)
                   1267: makesum: fetch
1.9       imp      1268:    @${MKDIR} ${FILESDIR}
1.1       niklas   1269:    @if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi
                   1270:    @(cd ${DISTDIR}; \
1.9       imp      1271:     for file in ${_CKSUMFILES}; do \
1.1       niklas   1272:        ${MD5} $$file >> ${MD5_FILE}; \
                   1273:     done)
1.9       imp      1274:    @for file in ${_IGNOREFILES}; do \
                   1275:        ${ECHO} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \
                   1276:    done
1.1       niklas   1277: .endif
                   1278:
                   1279: .if !target(checksum)
                   1280: checksum: fetch
                   1281:    @if [ ! -f ${MD5_FILE} ]; then \
                   1282:        ${ECHO_MSG} ">> No MD5 checksum file."; \
                   1283:    else \
1.9       imp      1284:        (cd ${DISTDIR}; OK="true"; \
                   1285:          for file in ${_CKSUMFILES}; do \
1.6       niklas   1286:            CKSUM=`${MD5} < $$file`; \
1.1       niklas   1287:            CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
                   1288:            if [ "$$CKSUM2" = "" ]; then \
1.9       imp      1289:                ${ECHO_MSG} ">> No checksum recorded for $$file."; \
                   1290:                OK="false"; \
                   1291:            elif [ "$$CKSUM2" = "IGNORE" ]; then \
                   1292:                ${ECHO_MSG} ">> Checksum for $$file is set to IGNORE in md5 file even though"; \
                   1293:                ${ECHO_MSG} "   the file is not in the "'$$'"{IGNOREFILES} list."; \
1.1       niklas   1294:                OK="false"; \
                   1295:            elif [ "$$CKSUM" != "$$CKSUM2" ]; then \
1.9       imp      1296:                ${ECHO_MSG} ">> Checksum mismatch for $$file."; \
1.1       niklas   1297:                exit 1; \
                   1298:            fi; \
                   1299:          done; \
1.9       imp      1300:          for file in ${_IGNOREFILES}; do \
                   1301:            CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
                   1302:            if [ "$$CKSUM2" = "" ]; then \
                   1303:                ${ECHO_MSG} ">> No checksum recorded for $$file, file is in "'$$'"{IGNOREFILES} list."; \
                   1304:                OK="false"; \
                   1305:            elif [ "$$CKSUM2" != "IGNORE" ]; then \
                   1306:                ${ECHO_MSG} ">> Checksum for $$file is not set to IGNORE in md5 file even though"; \
                   1307:                ${ECHO_MSG} "   the file is in the "'$$'"{IGNOREFILES} list."; \
                   1308:                OK="false"; \
                   1309:            fi; \
                   1310:          done; \
                   1311:          if [ "$$OK" = "true" ]; then \
1.1       niklas   1312:            ${ECHO_MSG} "Checksums OK."; \
                   1313:          else \
1.9       imp      1314:            ${ECHO_MSG} "There may be some inconsistencies, make sure the Makefile and md5 file"; \
                   1315:            ${ECHO_MSG} "(\"${MD5_FILE}\") are up to date."; \
1.1       niklas   1316:          fi) ; \
                   1317:    fi
                   1318: .endif
                   1319:
                   1320: ################################################################
                   1321: # The special package-building targets
                   1322: # You probably won't need to touch these
                   1323: ################################################################
                   1324:
                   1325: # Nobody should want to override this unless PKGNAME is simply bogus.
                   1326:
                   1327: .if !target(package-name)
                   1328: package-name:
                   1329:    @${ECHO} ${PKGNAME}
                   1330: .endif
                   1331:
                   1332: # Show (recursively) all the packages this package depends on.
                   1333:
                   1334: .if !target(package-depends)
                   1335: package-depends:
                   1336:    @for i in ${RUN_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \
                   1337:        dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
                   1338:        (cd $$dir ; ${MAKE} package-name package-depends); \
                   1339:    done
                   1340: .endif
                   1341:
                   1342: # Build a package but don't check the package cookie
                   1343:
                   1344: .if !target(repackage)
                   1345: repackage: pre-repackage package
                   1346:
                   1347: pre-repackage:
                   1348:    @${RM} -f ${PACKAGE_COOKIE}
                   1349: .endif
                   1350:
                   1351: # Build a package but don't check the cookie for installation, also don't
                   1352: # install package cookie
                   1353:
                   1354: .if !target(package-noinstall)
                   1355: package-noinstall:
1.6       niklas   1356:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package
1.1       niklas   1357: .endif
                   1358:
                   1359: ################################################################
                   1360: # Dependency checking
                   1361: ################################################################
                   1362:
                   1363: .if !target(depends)
                   1364: depends: lib-depends misc-depends
1.6       niklas   1365:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
                   1366:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends
                   1367:    @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends
1.1       niklas   1368:
                   1369: .if make(fetch-depends)
                   1370: DEPENDS_TMP+=  ${FETCH_DEPENDS}
                   1371: .endif
                   1372:
                   1373: .if make(build-depends)
                   1374: DEPENDS_TMP+=  ${BUILD_DEPENDS}
                   1375: .endif
                   1376:
                   1377: .if make(run-depends)
                   1378: DEPENDS_TMP+=  ${RUN_DEPENDS}
                   1379: .endif
                   1380:
                   1381: _DEPENDS_USE:  .USE
                   1382: .if defined(DEPENDS_TMP)
                   1383: .if defined(NO_DEPENDS)
                   1384: # Just print out messages
                   1385:    @for i in ${DEPENDS_TMP}; do \
                   1386:        prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
                   1387:        dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
                   1388:        if expr "$$prog" : \\/ >/dev/null; then \
                   1389:            ${ECHO_MSG} "===>  ${PKGNAME} depends on file:  $$prog ($$dir)"; \
                   1390:        else \
                   1391:            ${ECHO_MSG} "===>  ${PKGNAME} depends on executable:  $$prog ($$dir)"; \
                   1392:        fi; \
                   1393:    done
                   1394: .else
                   1395:    @for i in ${DEPENDS_TMP}; do \
                   1396:        prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
                   1397:        dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
                   1398:        if expr "$$prog" : \\/ >/dev/null; then \
                   1399:            if [ -e "$$prog" ]; then \
                   1400:                ${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - found"; \
                   1401:                notfound=0; \
                   1402:            else \
                   1403:                ${ECHO_MSG} "===>  ${PKGNAME} depends on file: $$prog - not found"; \
                   1404:                notfound=1; \
                   1405:            fi; \
                   1406:        else \
1.9       imp      1407:            if which "$$prog" > /dev/null 2>&1 ; then \
1.1       niklas   1408:                ${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - found"; \
                   1409:                notfound=0; \
                   1410:            else \
                   1411:                ${ECHO_MSG} "===>  ${PKGNAME} depends on executable: $$prog - not found"; \
                   1412:                notfound=1; \
                   1413:            fi; \
                   1414:        fi; \
                   1415:        if [ $$notfound != 0 ]; then \
                   1416:            ${ECHO_MSG} "===>  Verifying build for $$prog in $$dir"; \
                   1417:            if [ ! -d "$$dir" ]; then \
                   1418:                ${ECHO_MSG} ">> No directory for $$prog.  Skipping.."; \
                   1419:            else \
                   1420:                (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
                   1421:                ${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
                   1422:            fi; \
                   1423:        fi; \
                   1424:    done
                   1425: .endif
                   1426: .else
                   1427:    @${DO_NADA}
                   1428: .endif
                   1429:
                   1430: fetch-depends: _DEPENDS_USE
                   1431: build-depends: _DEPENDS_USE
                   1432: run-depends:   _DEPENDS_USE
                   1433:
                   1434: lib-depends:
                   1435: .if defined(LIB_DEPENDS)
                   1436: .if defined(NO_DEPENDS)
                   1437: # Just print out messages
                   1438:    @for i in ${LIB_DEPENDS}; do \
                   1439:        lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
                   1440:        dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
                   1441:        ${ECHO_MSG} "===>  ${PKGNAME} depends on shared library:  $$lib ($$dir)"; \
                   1442:    done
                   1443: .else
                   1444:    @for i in ${LIB_DEPENDS}; do \
                   1445:        lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
                   1446:        dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
                   1447:        if /sbin/ldconfig -r | ${GREP} -q -e "-l$$lib"; then \
                   1448:            ${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - found"; \
                   1449:        else \
                   1450:            ${ECHO_MSG} "===>  ${PKGNAME} depends on shared library: $$lib - not found"; \
                   1451:            ${ECHO_MSG} "===>  Verifying build for $$lib in $$dir"; \
                   1452:            if [ ! -d "$$dir" ]; then \
                   1453:                ${ECHO_MSG} ">> No directory for $$lib.  Skipping.."; \
                   1454:            else \
                   1455:                (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
                   1456:                ${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"; \
                   1457:            fi; \
                   1458:        fi; \
                   1459:    done
                   1460: .endif
                   1461: .else
                   1462:    @${DO_NADA}
                   1463: .endif
                   1464:
                   1465: misc-depends:
                   1466: .if defined(DEPENDS)
                   1467:    @${ECHO_MSG} "===>  ${PKGNAME} depends on:  ${DEPENDS}"
                   1468: .if !defined(NO_DEPENDS)
                   1469:    @for i in ${DEPENDS}; do \
                   1470:        ${ECHO_MSG} "===>  Verifying build for $$i"; \
                   1471:        if [ ! -d $$i ]; then \
                   1472:            ${ECHO_MSG} ">> No directory for $$i.  Skipping.."; \
                   1473:        else \
                   1474:            (cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
                   1475:        fi \
                   1476:    done
                   1477:    @${ECHO_MSG} "===>  Returning to build of ${PKGNAME}"
                   1478: .endif
                   1479: .else
                   1480:    @${DO_NADA}
                   1481: .endif
                   1482:
                   1483: .endif
                   1484:
1.9       imp      1485: .if !target(clean-depends)
                   1486: clean-depends:
                   1487: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || defined(LIB_DEPENDS) \
                   1488:    || defined(RUN_DEPENDS)
                   1489:    @for i in ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS}; do \
                   1490:        dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
                   1491:        if [ -d $$dir ] ; then (cd $$dir; ${MAKE} clean); fi \
                   1492:    done
                   1493: .endif
                   1494: .if defined(DEPENDS)
                   1495:    @for dir in ${DEPENDS}; do \
                   1496:        if [ -d $$dir ] ; then (cd $$dir; ${MAKE} clean); fi \
                   1497:    done
                   1498: .endif
                   1499: .endif
                   1500:
1.1       niklas   1501: .if !target(depends-list)
                   1502: depends-list:
1.9       imp      1503:    @for i in ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS}; do \
1.7       niklas   1504:        dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
1.9       imp      1505:        (cd $$dir; ${MAKE} package-name depends-list); \
                   1506:    done
                   1507:    @for dir in ${DEPENDS}; do \
                   1508:        (cd $$dir; ${MAKE} package-name depends-list); \
1.1       niklas   1509:    done
                   1510: .endif
                   1511:
                   1512: ################################################################
                   1513: # Everything after here are internal targets and really
                   1514: # shouldn't be touched by anybody but the release engineers.
                   1515: ################################################################
                   1516:
                   1517: # This target generates an index entry suitable for aggregation into
                   1518: # a large index.  Format is:
                   1519: #
                   1520: # distribution-name|port-path|installation-prefix|comment| \
                   1521: #  description-file|maintainer|categories|build deps|run deps
                   1522: #
                   1523: .if !target(describe)
                   1524: describe:
1.6       niklas   1525:    @${ECHO} -n "${PKGNAME}|${.CURDIR}|"
1.1       niklas   1526:    @${ECHO} -n "${PREFIX}|"
                   1527:    @if [ -f ${PKGDIR}/COMMENT ]; then \
                   1528:        ${ECHO} -n "`${CAT} ${PKGDIR}/COMMENT`"; \
                   1529:    else \
                   1530:        ${ECHO} -n "** No Description"; \
                   1531:    fi
                   1532:    @if [ -f ${PKGDIR}/DESCR ]; then \
                   1533:        ${ECHO} -n "|${PKGDIR}/DESCR"; \
                   1534:    else \
                   1535:        ${ECHO} -n "|/dev/null"; \
                   1536:    fi
                   1537:    @${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|"
1.9       imp      1538:    @cd ${.CURDIR} && ${ECHO} -n `make depends-list|sort -u`
1.1       niklas   1539:    @${ECHO} -n "|"
1.9       imp      1540:    @cd ${.CURDIR} && ${ECHO} -n `make package-depends|sort -u`
1.1       niklas   1541:    @${ECHO} ""
                   1542: .endif
                   1543:
                   1544: .if !target(readmes)
                   1545: readmes:   readme
                   1546: .endif
                   1547:
                   1548: .if !target(readme)
                   1549: readme:
                   1550:    @rm -f README.html
1.6       niklas   1551:    @cd ${.CURDIR} && make README.html
1.1       niklas   1552: .endif
                   1553:
                   1554: README.html:
                   1555:    @${ECHO_MSG} "===>  Creating README.html for ${PKGNAME}"
                   1556:    @${CAT} ${TEMPLATES}/README.port | \
                   1557:        ${SED} -e 's&%%PORT%%&'`${ECHO} ${.CURDIR} | ${SED} -e 's.*/\([^/]*/[^/]*\)$$\1'`'&g' \
                   1558:            -e 's&%%PKG%%&${PKGNAME}&g' \
                   1559:            -e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \
                   1560:            -e '/%%COMMENT%%/d' \
                   1561:            -e 's&%%BUILD_DEPENDS%%&'"`${MAKE} print-depends-list`"'&' \
                   1562:            -e 's&%%RUN_DEPENDS%%&'"`${MAKE} print-package-depends`"'&' \
                   1563:        >> $@
                   1564:
                   1565: .if !target(print-depends-list)
                   1566: print-depends-list:
                   1567: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \
                   1568:    defined(LIB_DEPENDS) || defined(DEPENDS)
                   1569:    @${ECHO} -n 'This port requires package(s) "'
1.9       imp      1570:    @${ECHO} -n `make depends-list | sort -u`
1.1       niklas   1571:    @${ECHO} '" to build.'
                   1572: .endif
                   1573: .endif
                   1574:
                   1575: .if !target(print-package-depends)
                   1576: print-package-depends:
                   1577: .if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS)
                   1578:    @${ECHO} -n 'This port requires package(s) "'
1.9       imp      1579:    @${ECHO} -n `make package-depends | sort -u`
1.1       niklas   1580:    @${ECHO} '" to run.'
                   1581: .endif
                   1582: .endif
                   1583:
                   1584: # Fake installation of package so that user can pkg_delete it later.
                   1585: # Also, make sure that an installed port is recognized correctly in
                   1586: # accordance to the @pkgdep directive in the packing lists
                   1587:
                   1588: .if !target(fake-pkg)
                   1589: fake-pkg:
                   1590:    @if [ ! -f ${PKGDIR}/PLIST -o ! -f ${PKGDIR}/COMMENT -o ! -f ${PKGDIR}/DESCR ]; then ${ECHO} "** Missing package files for ${PKGNAME} - installation not recorded."; exit 1; fi
1.9       imp      1591:    @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi
1.1       niklas   1592: .if defined(FORCE_PKG_REGISTER)
                   1593:    @${RM} -rf ${PKG_DBDIR}/${PKGNAME}
                   1594: .endif
                   1595:    @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
                   1596:        ${ECHO_MSG} "===>  Registering installation for ${PKGNAME}"; \
1.9       imp      1597:        ${MKDIR} ${PKG_DBDIR}/${PKGNAME}; \
1.1       niklas   1598:        ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
                   1599:        ${CP} ${PKGDIR}/DESCR ${PKG_DBDIR}/${PKGNAME}/+DESC; \
                   1600:        ${CP} ${PKGDIR}/COMMENT ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
                   1601:        if [ -f ${PKGDIR}/INSTALL ]; then \
                   1602:            ${CP} ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \
                   1603:        fi; \
                   1604:        if [ -f ${PKGDIR}/DEINSTALL ]; then \
                   1605:            ${CP} ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \
                   1606:        fi; \
                   1607:        if [ -f ${PKGDIR}/REQ ]; then \
                   1608:            ${CP} ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \
                   1609:        fi; \
                   1610:    else \
1.9       imp      1611:        ${ECHO_MSG} "===>  ${PKGNAME} is already installed - perhaps an older version?"; \
                   1612:        ${ECHO_MSG} "      If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \
                   1613:        ${ECHO_MSG} "      this port again by \`\`make reinstall'' to upgrade it properly."; \
1.1       niklas   1614:    fi
                   1615: .endif
                   1616:
                   1617: # Depend is generally meaningless for arbitrary ports, but if someone wants
                   1618: # one they can override this.  This is just to catch people who've gotten into
                   1619: # the habit of typing `make depend all install' as a matter of course.
                   1620: #
                   1621: .if !target(depend)
                   1622: depend:
                   1623: .endif
                   1624:
                   1625: # Same goes for tags
                   1626: .if !target(tags)
                   1627: tags:
1.10    ! niklas   1628: .endif
        !          1629:
1.1       niklas   1630: .endif