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

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