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

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