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