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