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

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