Annotation of src/share/mk/bsd.port.mk, Revision 1.30
1.9 imp 1: #-*- mode: Fundamental; tab-width: 4; -*-
2: # ex:ts=4
1.30 ! marc 3: # $OpenBSD: bsd.port.mk,v 1.29 1998/04/28 19:19:29 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.13 imp 519: COMMENT?= ${PKGDIR}/COMMENT
520: DESCR?= ${PKGDIR}/DESCR
521: PLIST?= ${PKGDIR}/PLIST
522:
1.1 niklas 523: PKG_CMD?= /usr/sbin/pkg_create
524: .if !defined(PKG_ARGS)
1.13 imp 525: PKG_ARGS= -v -c ${COMMENT} -d ${DESCR} -f ${PLIST} -p ${PREFIX} -P "`${MAKE} package-depends|sort -u`"
1.1 niklas 526: .if exists(${PKGDIR}/INSTALL)
527: PKG_ARGS+= -i ${PKGDIR}/INSTALL
528: .endif
529: .if exists(${PKGDIR}/DEINSTALL)
530: PKG_ARGS+= -k ${PKGDIR}/DEINSTALL
531: .endif
532: .if exists(${PKGDIR}/REQ)
533: PKG_ARGS+= -r ${PKGDIR}/REQ
534: .endif
1.9 imp 535: .if exists(${PKGDIR}/MESSAGE)
536: PKG_ARGS+= -D ${PKGDIR}/MESSAGE
537: .endif
1.13 imp 538: .if !defined(NO_MTREE)
539: PKG_ARGS+= -m ${MTREE_FILE}
1.1 niklas 540: .endif
541: .endif
542: PKG_SUFX?= .tgz
543: # where pkg_add records its dirty deeds.
544: PKG_DBDIR?= /var/db/pkg
545:
546: # shared/dynamic motif libs
547: .if defined(HAVE_MOTIF)
548: .if defined(MOTIF_STATIC)
549: MOTIFLIB?= ${X11BASE}/lib/libXm.a
550: .else
551: MOTIFLIB?= -L${X11BASE}/lib -lXm
552: .endif
553: .endif
554:
1.13 imp 555: AWK?= /usr/bin/awk
556: BASENAME?= /usr/bin/basename
1.9 imp 557: CAT?= /bin/cat
1.1 niklas 558: CP?= /bin/cp
1.13 imp 559: ECHO?= /bin/echo
1.9 imp 560: FALSE?= /usr/bin/false
561: GREP?= /usr/bin/grep
1.13 imp 562: GUNZIP_CMD?= /usr/bin/gunzip -f
1.1 niklas 563: GZCAT?= /usr/bin/gzcat
1.9 imp 564: GZIP?= -9
565: GZIP_CMD?= /usr/bin/gzip -nf ${GZIP}
1.22 niklas 566: LDCONFIG?= [ ! -x /sbin/ldconfig ] || /sbin/ldconfig
1.14 niklas 567: LN?= /bin/ln
1.13 imp 568: MKDIR?= /bin/mkdir -p
569: MV?= /bin/mv
1.18 niklas 570: READLINK?= /usr/bin/readlink
1.13 imp 571: RM?= /bin/rm
572: RMDIR?= /bin/rmdir
1.1 niklas 573: SED?= /usr/bin/sed
1.20 todd 574: PORTSPATH?= ${PATH}:${X11BASE}/bin:${LOCALBASE}/bin
575: SETENV?= /usr/bin/env PATH=${PORTSPATH}
1.13 imp 576: SH?= /bin/sh
577: TR?= /usr/bin/tr
1.1 niklas 578:
579: # Used to print all the '===>' style prompts - override this to turn them off.
580: ECHO_MSG?= ${ECHO}
581:
582: ALL_TARGET?= all
583: INSTALL_TARGET?= install
584:
1.9 imp 585: # Popular master sites
1.13 imp 586: MASTER_SITE_XCONTRIB+= \
587: ftp://crl.dec.com/pub/X11/contrib/%SUBDIR%/ \
588: ftp://ftp.eu.net/X11/contrib/%SUBDIR%/
589:
590: MASTER_SITE_GNU+= \
591: ftp://prep.ai.mit.edu/pub/gnu/%SUBDIR%/ \
592: ftp://wuarchive.wustl.edu/systems/gnu/%SUBDIR%/
593:
594: MASTER_SITE_PERL_CPAN+= \
595: ftp://ftp.digital.com/pub/plan/perl/CPAN/modules/by-module/%SUBDIR%/ \
596: ftp://ftp.cdrom.com/pub/perl/CPAN/modules/by-module/%SUBDIR%/
597:
598: MASTER_SITE_TEX_CTAN+= \
599: ftp://ftp.cdrom.com/pub/tex/ctan/%SUBDIR%/ \
600: ftp://wuarchive.wustl.edu/packages/TeX/%SUBDIR%/ \
601: ftp://ftp.funet.fi/pub/TeX/CTAN/%SUBDIR%/ \
602: ftp://ftp.tex.ac.uk/public/ctan/tex-archive/%SUBDIR%/ \
603: ftp://ftp.dante.de/tex-archive/%SUBDIR%/
604:
605: MASTER_SITE_SUNSITE+= \
606: ftp://sunsite.unc.edu/pub/Linux/%SUBDIR%/ \
607: ftp://ftp.infomagic.com/pub/mirrors/linux/sunsite/%SUBDIR%/ \
608: ftp://ftp.funet.fi/pub/mirrors/sunsite.unc.edu/pub/Linux/%SUBDIR%/
609:
610: # Empty declaration to avoid "variable MASTER_SITES recursive" error
611: MASTER_SITES?=
612: PATCH_SITES?=
613:
614: # Substitute subdirectory names
615: MASTER_SITES:= ${MASTER_SITES:S/%SUBDIR%/${MASTER_SITE_SUBDIR}/}
616: PATCH_SITES:= ${PATCH_SITES:S/%SUBDIR%/${PATCH_SITE_SUBDIR}/}
1.9 imp 617:
1.27 marc 618: # Two backup master sites, First one at ftp.openbsd.org
619: #
620: _MASTER_SITE_OPENBSD?= \
621: ftp://ftp.openbsd.org/pub/OpenBSD/distfiles/${DIST_SUBDIR}/
622:
623: # The second backup master site is ftp.freebsd.org
624: #
625: _MASTER_SITE_FREEBSD?= \
626: ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
627:
628: # set the backup master sites.
629: #
1.9 imp 630: MASTER_SITE_BACKUP?= \
1.27 marc 631: ${_MASTER_SITE_OPENBSD} ${_MASTER_SITE_FREEBSD}
632:
633: # If the user has this set, go to the OpenBSD repository for everything.
634: #
635: .if defined(MASTER_SITE_OPENBSD)
636: MASTER_SITE_OVERRIDE= ${_MASTER_SITE_OPENBSD}
637: .endif
1.9 imp 638:
639: # If the user has this set, go to the FreeBSD repository for everything.
1.27 marc 640: #
1.1 niklas 641: .if defined(MASTER_SITE_FREEBSD)
1.27 marc 642: MASTER_SITE_OVERRIDE= ${_MASTER_SITE_FREEBSD}
1.1 niklas 643: .endif
644:
1.13 imp 645: # Where to put distfiles that don't have any other master site
1.27 marc 646: # ;;; This is referenced in a few Makefiles -- I'd like to get rid of it
647: #
1.13 imp 648: MASTER_SITE_LOCAL?= \
649: ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/LOCAL_PORTS/
650:
1.1 niklas 651: # I guess we're in the master distribution business! :) As we gain mirror
652: # sites for distfiles, add them to this list.
653: .if !defined(MASTER_SITE_OVERRIDE)
1.9 imp 654: MASTER_SITES+= ${MASTER_SITE_BACKUP}
655: PATCH_SITES+= ${MASTER_SITE_BACKUP}
1.1 niklas 656: .else
657: MASTER_SITES:= ${MASTER_SITE_OVERRIDE} ${MASTER_SITES}
658: PATCH_SITES:= ${MASTER_SITE_OVERRIDE} ${PATCH_SITES}
659: .endif
660:
1.28 marc 661: # The following is a FreeBSD construct that dopes not work in OpenBSD.
662: # Since OpenBSD does not put packages in /cdrom/ports/packages it
663: # is safe to leave (but I may remove it in the future).
664: #
1.7 niklas 665: # Search CDROM first if mounted, symlink instead of copy if
666: # FETCH_SYMLINK_DISTFILES is set
667: .if exists(/cdrom/ports/distfiles)
668: MASTER_SITES:= file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${MASTER_SITES}
669: PATCH_SITES:= file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${PATCH_SITES}
670: .if defined(FETCH_SYMLINK_DISTFILES)
671: FETCH_BEFORE_ARGS+= -l
672: .endif
673: .endif
674:
1.28 marc 675: # OpenBSD code to handle ports distfiles on a CDROM. The distfiles
676: # are located in /cdrom/distfiles/${DIST_SUBDIR}/ (assuming that the
677: # CDROM is mounted on /cdrom).
678: #
679: .if exists(/cdrom/distfiles)
680: CDROM_SITE:= /cdrom/distfiles/${DIST_SUBDIR}
681: .if defined(FETCH_SYMLINK_DISTFILES)
682: CDROM_COPY:= ${LN}
683: CDROM_OPT= -s
684: .else
685: CDROM_COPY:= ${CP}
686: CDROM_OPT= -f
687: .endif
688: .endif
689:
1.1 niklas 690: # Derived names so that they're easily overridable.
691: DISTFILES?= ${DISTNAME}${EXTRACT_SUFX}
692: PKGNAME?= ${DISTNAME}
693:
1.9 imp 694: ALLFILES?= ${DISTFILES} ${PATCHFILES}
695:
696: .if defined(IGNOREFILES)
697: CKSUMFILES!= \
698: for file in ${ALLFILES}; do \
699: ignore=0; \
700: for tmp in ${IGNOREFILES}; do \
701: if [ "$$file" = "$$tmp" ]; then \
702: ignore=1; \
703: fi; \
704: done; \
705: if [ "$$ignore" = 0 ]; then \
706: echo "$$file"; \
707: fi; \
708: done
709: .else
710: CKSUMFILES= ${ALLFILES}
711: .endif
712:
713: # List of all files, with ${DIST_SUBDIR} in front. Used for checksum.
714: .if defined(DIST_SUBDIR)
715: _CKSUMFILES?= ${CKSUMFILES:S/^/${DIST_SUBDIR}\//}
716: _IGNOREFILES?= ${IGNOREFILES:S/^/${DIST_SUBDIR}\//}
717: .else
718: _CKSUMFILES?= ${CKSUMFILES}
719: _IGNOREFILES?= ${IGNOREFILES}
720: .endif
721:
1.1 niklas 722: # This is what is actually going to be extracted, and is overridable
723: # by user.
724: EXTRACT_ONLY?= ${DISTFILES}
725:
726: # Documentation
727: MAINTAINER?= ports@FreeBSD.ORG
1.9 imp 728:
729: .if !defined(CATEGORIES)
730: .BEGIN:
731: @${ECHO_MSG} "CATEGORIES is mandatory."
732: @${FALSE}
733: .endif
1.1 niklas 734:
735: # Note this has to start with a capital letter (or more accurately, it
736: # shouldn't match "[a-z]*"), see the target "delete-package-links" below.
737: PKGREPOSITORYSUBDIR?= All
738: PKGREPOSITORY?= ${PACKAGES}/${PKGREPOSITORYSUBDIR}
739: .if exists(${PACKAGES})
740: PKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
741: .else
742: PKGFILE?= ${PKGNAME}${PKG_SUFX}
743: .endif
744:
745: CONFIGURE_SCRIPT?= configure
746:
747: .if defined(GNU_CONFIGURE)
748: CONFIGURE_ARGS+= --prefix=${PREFIX}
749: HAS_CONFIGURE= yes
750: .endif
751:
1.13 imp 752: # Passed to most of script invocations
753: SCRIPTS_ENV+= CURDIR=${.CURDIR} DISTDIR=${DISTDIR} \
754: WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} \
755: SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \
756: PORTSDIR=${PORTSDIR} DEPENDS="${DEPENDS}" \
757: PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
758:
759: .if defined(BATCH)
760: SCRIPTS_ENV+= BATCH=yes
761: .endif
762:
1.9 imp 763: MANPREFIX?= ${PREFIX}
764:
765: .for sect in 1 2 3 4 5 6 7 8 9
766: MAN${sect}PREFIX?= ${MANPREFIX}
767: .endfor
768: MANLPREFIX?= ${MANPREFIX}
769: MANNPREFIX?= ${MANPREFIX}
770:
771: MANLANG?= "" # english only by default
772:
773: .for lang in ${MANLANG}
774:
775: .for sect in 1 2 3 4 5 6 7 8 9
776: .if defined(MAN${sect})
777: _MANPAGES+= ${MAN${sect}:S%^%${MAN${sect}PREFIX}/man/${lang}/man${sect}/%}
778: .endif
779: .endfor
780:
781: .if defined(MANL)
782: _MANPAGES+= ${MANL:S%^%${MANLPREFIX}/man/${lang}/manl/%}
783: .endif
784:
785: .if defined(MANN)
786: _MANPAGES+= ${MANN:S%^%${MANNPREFIX}/man/${lang}/mann/%}
787: .endif
788:
789: .endfor
790:
791: .if defined(_MANPAGES) && defined(MANCOMPRESSED)
792: _MANPAGES:= ${_MANPAGES:S/$/.gz/}
793: .endif
794:
1.1 niklas 795: .MAIN: all
796:
797: ################################################################
798: # Many ways to disable a port.
799: #
800: # If we're in BATCH mode and the port is interactive, or we're
801: # in interactive mode and the port is non-interactive, skip all
802: # the important targets. The reason we have two modes is that
803: # one might want to leave a build in BATCH mode running
804: # overnight, then come back in the morning and do _only_ the
805: # interactive ones that required your intervention.
806: #
807: # Don't attempt to build ports that require Motif if you don't
808: # have Motif.
809: #
810: # Ignore ports that can't be resold if building for a CDROM.
811: #
812: # Don't build a port if it's restricted and we don't want to get
813: # into that.
814: #
815: # Don't build a port if it's broken.
1.27 marc 816: #
817: # Don't build a port if it comes with the base system.
1.1 niklas 818: ################################################################
819:
1.13 imp 820: .if !defined(NO_IGNORE)
1.9 imp 821: .if (defined(IS_INTERACTIVE) && defined(BATCH))
822: IGNORE= "is an interactive port"
823: .elif (!defined(IS_INTERACTIVE) && defined(INTERACTIVE))
824: IGNORE= "is not an interactive port"
825: .elif (defined(REQUIRES_MOTIF) && !defined(HAVE_MOTIF))
826: IGNORE= "requires Motif"
1.13 imp 827: .elif (defined(MOTIF_ONLY) && !defined(REQUIRES_MOTIF))
828: IGNORE= "does not require Motif"
1.9 imp 829: .elif (defined(NO_CDROM) && defined(FOR_CDROM))
830: IGNORE= "may not be placed on a CDROM: ${NO_CDROM}"
831: .elif (defined(RESTRICTED) && defined(NO_RESTRICTED))
832: IGNORE= "is restricted: ${RESTRICTED}"
1.13 imp 833: .elif ((defined(USE_IMAKE) || defined(USE_X11)) && !exists(${X11BASE}))
834: IGNORE= "uses X11, but ${X11BASE} not found"
1.9 imp 835: .elif defined(BROKEN)
836: IGNORE= "is marked as broken: ${BROKEN}"
1.29 marc 837: .elif defined(ONLY_FOR_ARCHS)
838: .for __ARCH in ${ONLY_FOR_ARCHS}
839: .if ${MACHINE} == "${__ARCH}"
840: __ARCH_OK= 1
841: .endif
842: .endfor
843: .if !defined(__ARCH_OK)
844: IGNORE= "is only for ${ONLY_FOR_ARCHS}, not ${MACHINE}"
845: .endif
1.27 marc 846: .elif defined(COMES_WITH)
847: OS_VER!= uname -r
848: .if ( ${OS_VER} >= ${COMES_WITH} )
849: IGNORE= "comes with ${OPSYS} as of release ${COMES_WITH}"
850: .endif
1.1 niklas 851: .endif
852:
853: .if defined(IGNORE)
1.9 imp 854: .if defined(IGNORE_SILENT)
855: IGNORECMD= ${DO_NADA}
856: .else
857: IGNORECMD= ${ECHO_MSG} "===> ${PKGNAME} ${IGNORE}."
858: .endif
859: fetch:
860: @${IGNORECMD}
861: checksum:
862: @${IGNORECMD}
863: extract:
864: @${IGNORECMD}
865: patch:
866: @${IGNORECMD}
867: configure:
868: @${IGNORECMD}
1.1 niklas 869: all:
1.9 imp 870: @${IGNORECMD}
1.1 niklas 871: build:
1.9 imp 872: @${IGNORECMD}
1.1 niklas 873: install:
1.9 imp 874: @${IGNORECMD}
1.1 niklas 875: package:
1.9 imp 876: @${IGNORECMD}
1.1 niklas 877: .endif
1.13 imp 878: .endif
1.1 niklas 879:
880: .if defined(ALL_HOOK)
881: all:
1.6 niklas 882: @cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \
1.1 niklas 883: DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \
884: PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
885: FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
886: DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \
887: RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \
888: ${ALL_HOOK}
889: .endif
890:
891: .if !target(all)
892: all: build
893: .endif
894:
1.13 imp 895: .if !defined(DEPENDS_TARGET)
896: .if make(reinstall)
897: DEPENDS_TARGET= reinstall
898: .else
899: DEPENDS_TARGET= install
1.1 niklas 900: .endif
901: .endif
902:
903: ################################################################
904: # The following are used to create easy dummy targets for
905: # disabling some bit of default target behavior you don't want.
906: # They still check to see if the target exists, and if so don't
907: # do anything, since you might want to set this globally for a
908: # group of ports in a Makefile.inc, but still be able to
909: # override from an individual Makefile.
910: ################################################################
911:
1.9 imp 912: # Disable checksum
913: .if defined(NO_CHECKSUM) && !target(checksum)
914: checksum: fetch
915: @${DO_NADA}
916: .endif
917:
1.1 niklas 918: # Disable extract
919: .if defined(NO_EXTRACT) && !target(extract)
920: extract: checksum
921: @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
922: checksum: fetch
923: @${DO_NADA}
924: makesum:
925: @${DO_NADA}
926: .endif
927:
1.9 imp 928: # Disable patch
929: .if defined(NO_PATCH) && !target(patch)
930: patch: extract
931: @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
932: .endif
933:
1.1 niklas 934: # Disable configure
935: .if defined(NO_CONFIGURE) && !target(configure)
936: configure: patch
937: @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
938: .endif
939:
940: # Disable build
941: .if defined(NO_BUILD) && !target(build)
942: build: configure
943: @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
944: .endif
945:
1.9 imp 946: # Disable install
947: .if defined(NO_INSTALL) && !target(install)
948: install: build
949: @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
950: .endif
951:
1.1 niklas 952: # Disable package
953: .if defined(NO_PACKAGE) && !target(package)
954: package:
1.9 imp 955: .if defined(IGNORE_SILENT)
1.1 niklas 956: @${DO_NADA}
1.9 imp 957: .else
958: @${ECHO_MSG} "===> ${PKGNAME} may not be packaged: ${NO_PACKAGE}."
1.1 niklas 959: .endif
960: .endif
961:
1.9 imp 962: # Disable describe
963: .if defined(NO_DESCRIBE) && !target(describe)
964: describe:
965: @${DO_NADA}
1.1 niklas 966: .endif
967:
968: ################################################################
969: # More standard targets start here.
970: #
971: # These are the body of the build/install framework. If you are
972: # not happy with the default actions, and you can't solve it by
973: # adding pre-* or post-* targets/scripts, override these.
974: ################################################################
975:
976: # Fetch
977:
978: .if !target(do-fetch)
979: do-fetch:
1.9 imp 980: @${MKDIR} ${_DISTDIR}
981: @(cd ${_DISTDIR}; \
1.1 niklas 982: for file in ${DISTFILES}; do \
983: if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
984: if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
1.9 imp 985: ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
1.1 niklas 986: ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
987: ${ECHO_MSG} ">> Please correct this problem and try again."; \
988: exit 1; \
1.28 marc 989: fi ; \
990: if [ ! -z ${CDROM_COPY} ]; then \
991: if ${CDROM_COPY} ${CDROM_OPT} ${CDROM_SITE}/$$file .; then \
992: continue; \
993: fi ; \
1.1 niklas 994: fi ; \
995: ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
996: for site in ${MASTER_SITES}; do \
997: ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6 niklas 998: if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1 niklas 999: continue 2; \
1000: fi \
1001: done; \
1.6 niklas 1002: ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.9 imp 1003: ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1.1 niklas 1004: exit 1; \
1005: fi \
1006: done)
1007: .if defined(PATCHFILES)
1.9 imp 1008: @(cd ${_DISTDIR}; \
1.1 niklas 1009: for file in ${PATCHFILES}; do \
1010: if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1011: if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
1.9 imp 1012: ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
1.1 niklas 1013: ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
1014: ${ECHO_MSG} ">> Please correct this problem and try again."; \
1015: exit 1; \
1016: fi ; \
1017: ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
1018: for site in ${PATCH_SITES}; do \
1019: ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6 niklas 1020: if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1 niklas 1021: continue 2; \
1022: fi \
1023: done; \
1.6 niklas 1024: ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.9 imp 1025: ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1.1 niklas 1026: exit 1; \
1027: fi \
1028: done)
1029: .endif
1030: .endif
1031:
1032: # Extract
1033:
1034: .if !target(do-extract)
1035: do-extract:
1.6 niklas 1036: .if !defined(NO_WRKDIR)
1.14 niklas 1037: .if defined(WRKOBJDIR)
1038: @${RM} -rf ${WRKOBJDIR}/${PORTSUBDIR}
1.18 niklas 1039: @${MKDIR} ${WRKOBJDIR}/${PORTSUBDIR}
1040: @if [ ! -L ${WRKDIR} ] || \
1041: [ X`${READLINK} ${WRKDIR}` != X${WRKOBJDIR}/${PORTSUBDIR} ]; then \
1042: echo "${WRKDIR} -> ${WRKOBJDIR}/${PORTSUBDIR}"; \
1043: ${RM} -f ${WRKDIR}; \
1044: ${LN} -sf ${WRKOBJDIR}/${PORTSUBDIR} ${WRKDIR}; \
1045: fi
1.14 niklas 1046: .else
1.1 niklas 1047: @${RM} -rf ${WRKDIR}
1.9 imp 1048: @${MKDIR} ${WRKDIR}
1.6 niklas 1049: .endif
1.14 niklas 1050: .endif
1.1 niklas 1051: @for file in ${EXTRACT_ONLY}; do \
1.10 niklas 1052: if ! (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
1.1 niklas 1053: then \
1054: exit 1; \
1055: fi \
1056: done
1057: .endif
1058:
1059: # Patch
1060:
1061: .if !target(do-patch)
1062: do-patch:
1063: .if defined(PATCHFILES)
1064: @${ECHO_MSG} "===> Applying distribution patches for ${PKGNAME}"
1.9 imp 1065: @(cd ${_DISTDIR}; \
1.1 niklas 1066: for i in ${PATCHFILES}; do \
1.6 niklas 1067: if [ ${PATCH_DEBUG_TMP} = yes ]; then \
1068: ${ECHO_MSG} "===> Applying distribution patch $$i" ; \
1069: fi; \
1.1 niklas 1070: case $$i in \
1071: *.Z|*.gz) \
1072: ${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
1073: ;; \
1074: *) \
1075: ${PATCH} ${PATCH_DIST_ARGS} < $$i; \
1076: ;; \
1077: esac; \
1078: done)
1079: .endif
1080: @if [ -d ${PATCHDIR} ]; then \
1.6 niklas 1081: if [ "`echo ${PATCHDIR}/patch-*`" = "${PATCHDIR}/patch-*" ]; then \
1082: ${ECHO_MSG} "===> Ignoring empty patch directory"; \
1083: if [ -d ${PATCHDIR}/CVS ]; then \
1084: ${ECHO_MSG} "===> Perhaps you forgot the -P flag to cvs co or update?"; \
1085: fi; \
1086: else \
1.9 imp 1087: ${ECHO_MSG} "===> Applying ${OPSYS} patches for ${PKGNAME}" ; \
1.6 niklas 1088: for i in ${PATCHDIR}/patch-*; do \
1089: case $$i in \
1.13 imp 1090: *.orig|*.rej|*~) \
1.6 niklas 1091: ${ECHO_MSG} "===> Ignoring patchfile $$i" ; \
1092: ;; \
1093: *) \
1094: if [ ${PATCH_DEBUG_TMP} = yes ]; then \
1.9 imp 1095: ${ECHO_MSG} "===> Applying ${OPSYS} patch $$i" ; \
1.6 niklas 1096: fi; \
1097: ${PATCH} ${PATCH_ARGS} < $$i; \
1098: ;; \
1099: esac; \
1100: done; \
1101: fi; \
1.1 niklas 1102: fi
1103: .endif
1104:
1105: # Configure
1106:
1107: .if !target(do-configure)
1108: do-configure:
1.7 niklas 1109: @if [ -f ${SCRIPTDIR}/configure ]; then \
1.13 imp 1110: cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
1111: ${SCRIPTDIR}/configure; \
1.1 niklas 1112: fi
1113: .if defined(HAS_CONFIGURE)
1.6 niklas 1114: @(cd ${WRKSRC} && CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \
1.1 niklas 1115: INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \
1.6 niklas 1116: INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
1.1 niklas 1117: ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS})
1118: .endif
1119: .if defined(USE_IMAKE)
1.20 todd 1120: @(cd ${WRKSRC} && ${SETENV} ${XMKMF})
1.1 niklas 1121: .endif
1122: .endif
1123:
1124: # Build
1125:
1126: .if !target(do-build)
1127: do-build:
1128: .if defined(USE_GMAKE)
1129: @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
1130: .else defined(USE_GMAKE)
1131: @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
1132: .endif
1133: .endif
1134:
1135: # Install
1136:
1137: .if !target(do-install)
1138: do-install:
1139: .if defined(USE_GMAKE)
1.6 niklas 1140: @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
1.1 niklas 1141: .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
1.6 niklas 1142: @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
1.1 niklas 1143: .endif
1144: .else defined(USE_GMAKE)
1.6 niklas 1145: @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
1.1 niklas 1146: .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
1.6 niklas 1147: @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
1.1 niklas 1148: .endif
1149: .endif
1150: .endif
1151:
1152: # Package
1153:
1154: .if !target(do-package)
1155: do-package:
1.13 imp 1156: @if [ -e ${PLIST} ]; then \
1.1 niklas 1157: ${ECHO_MSG} "===> Building package for ${PKGNAME}"; \
1158: if [ -d ${PACKAGES} ]; then \
1159: if [ ! -d ${PKGREPOSITORY} ]; then \
1.9 imp 1160: if ! ${MKDIR} ${PKGREPOSITORY}; then \
1.1 niklas 1161: ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \
1162: exit 1; \
1163: fi; \
1164: fi; \
1165: fi; \
1166: if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \
1167: if [ -d ${PACKAGES} ]; then \
1168: ${MAKE} ${.MAKEFLAGS} package-links; \
1169: fi; \
1170: else \
1171: ${MAKE} ${.MAKEFLAGS} delete-package; \
1172: exit 1; \
1173: fi; \
1174: fi
1175: .endif
1176:
1177: # Some support rules for do-package
1178:
1179: .if !target(package-links)
1180: package-links:
1181: @${MAKE} ${.MAKEFLAGS} delete-package-links
1182: @for cat in ${CATEGORIES}; do \
1183: if [ ! -d ${PACKAGES}/$$cat ]; then \
1.9 imp 1184: if ! ${MKDIR} ${PACKAGES}/$$cat; then \
1.1 niklas 1185: ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \
1186: exit 1; \
1187: fi; \
1188: fi; \
1189: ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
1190: done;
1191: .endif
1192:
1193: .if !target(delete-package-links)
1194: delete-package-links:
1195: @${RM} -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX};
1196: .endif
1197:
1198: .if !target(delete-package)
1199: delete-package:
1200: @${MAKE} ${.MAKEFLAGS} delete-package-links
1201: @${RM} -f ${PKGFILE}
1202: .endif
1203:
1204: ################################################################
1205: # This is the "generic" port target, actually a macro used from the
1206: # six main targets. See below for more.
1207: ################################################################
1208:
1209: _PORT_USE: .USE
1210: .if make(real-fetch)
1.6 niklas 1211: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1.1 niklas 1212: .endif
1213: .if make(real-extract)
1.6 niklas 1214: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends lib-depends misc-depends
1.1 niklas 1215: .endif
1216: .if make(real-install)
1.13 imp 1217: .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
1218: @if [ -d ${PKG_DBDIR}/${PKGNAME} ]; then \
1219: ${ECHO_MSG} "===> ${PKGNAME} is already installed - perhaps an older version?"; \
1220: ${ECHO_MSG} " If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \
1221: ${ECHO_MSG} " this port again by \`\`make reinstall'' to upgrade it properly."; \
1222: ${ECHO_MSG} " If you really wish to overwrite the old port of ${PKGNAME}"; \
1223: ${ECHO_MSG} " without deleting it first, set the variable \"FORCE_PKG_REGISTER\""; \
1224: ${ECHO_MSG} " in your environment or the \"make install\" command line."; \
1225: exit 1; \
1226: fi
1227: .endif
1.14 niklas 1228: @if [ `${SH} -c umask` != ${DEF_UMASK} ]; then \
1.13 imp 1229: ${ECHO_MSG} "===> Warning: your umask is \"`${SH} -c umask`"\".; \
1230: ${ECHO_MSG} " If this is not desired, set it to an appropriate value"; \
1231: ${ECHO_MSG} " and install this port again by \`\`make reinstall''."; \
1232: fi
1.9 imp 1233: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends lib-depends
1.1 niklas 1234: .endif
1235: .if make(real-install)
1236: .if !defined(NO_MTREE)
1237: @if [ `id -u` = 0 ]; then \
1.13 imp 1238: if [ ! -f ${MTREE_FILE} ]; then \
1239: ${ECHO_MSG} "Error: mtree file \"${MTREE_FILE}\" is missing."; \
1240: ${ECHO_MSG} "Copy it from a suitable location (e.g., /usr/src/etc/mtree) and try again."; \
1241: exit 1; \
1242: else \
1243: ${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \
1244: fi; \
1.1 niklas 1245: else \
1246: ${ECHO_MSG} "Warning: not superuser, can't run mtree."; \
1247: ${ECHO_MSG} "Become root and try again to ensure correct permissions."; \
1248: fi
1249: .endif
1250: .endif
1.6 niklas 1251: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/}
1.1 niklas 1252: @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \
1.13 imp 1253: cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
1254: ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/}; \
1.1 niklas 1255: fi
1.6 niklas 1256: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/}
1257: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/}
1.1 niklas 1258: @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \
1.13 imp 1259: cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
1260: ${SCRIPTDIR}/${.TARGET:S/^real-/post-/}; \
1.1 niklas 1261: fi
1.9 imp 1262: .if make(real-install) && defined(_MANPAGES)
1263: .if defined(MANCOMPRESSED) && defined(NOMANCOMPRESS)
1264: @${ECHO_MSG} "===> Uncompressing manual pages for ${PKGNAME}"
1265: .for manpage in ${_MANPAGES}
1266: @${GUNZIP_CMD} ${manpage}
1267: .endfor
1268: .elif !defined(MANCOMPRESSED) && !defined(NOMANCOMPRESS)
1269: @${ECHO_MSG} "===> Compressing manual pages for ${PKGNAME}"
1270: .for manpage in ${_MANPAGES}
1271: @${GZIP_CMD} ${manpage}
1272: .endfor
1273: .endif
1274: .endif
1275: .if make(real-install) && !defined(NO_PKG_REGISTER)
1.6 niklas 1276: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fake-pkg
1.1 niklas 1277: .endif
1278: .if !make(real-fetch) \
1279: && (!make(real-patch) || !defined(PATCH_CHECK_ONLY)) \
1280: && (!make(real-package) || !defined(PACKAGE_NOINSTALL))
1281: @${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.${.TARGET:S/^real-//}_done
1282: .endif
1283:
1284: ################################################################
1285: # Skeleton targets start here
1286: #
1287: # You shouldn't have to change these. Either add the pre-* or
1288: # post-* targets/scripts or redefine the do-* targets. These
1289: # targets don't do anything other than checking for cookies and
1290: # call the necessary targets/scripts.
1291: ################################################################
1292:
1293: .if !target(fetch)
1294: fetch:
1.6 niklas 1295: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-fetch
1.1 niklas 1296: .endif
1297:
1298: .if !target(extract)
1299: extract: checksum ${EXTRACT_COOKIE}
1300: .endif
1301:
1302: .if !target(patch)
1303: patch: extract ${PATCH_COOKIE}
1304: .endif
1305:
1306: .if !target(configure)
1307: configure: patch ${CONFIGURE_COOKIE}
1308: .endif
1309:
1310: .if !target(build)
1311: build: configure ${BUILD_COOKIE}
1312: .endif
1313:
1314: .if !target(install)
1315: install: build ${INSTALL_COOKIE}
1316: .endif
1317:
1318: .if !target(package)
1319: package: install ${PACKAGE_COOKIE}
1320: .endif
1321:
1322: ${EXTRACT_COOKIE}:
1.6 niklas 1323: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-extract
1.1 niklas 1324: ${PATCH_COOKIE}:
1.6 niklas 1325: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-patch
1.1 niklas 1326: ${CONFIGURE_COOKIE}:
1.6 niklas 1327: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-configure
1.1 niklas 1328: ${BUILD_COOKIE}:
1.6 niklas 1329: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-build
1.1 niklas 1330: ${INSTALL_COOKIE}:
1.6 niklas 1331: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-install
1.1 niklas 1332: ${PACKAGE_COOKIE}:
1.6 niklas 1333: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-package
1.1 niklas 1334:
1335: # And call the macros
1336:
1337: real-fetch: _PORT_USE
1338: real-extract: _PORT_USE
1339: @${ECHO_MSG} "===> Extracting for ${PKGNAME}"
1340: real-patch: _PORT_USE
1341: @${ECHO_MSG} "===> Patching for ${PKGNAME}"
1342: real-configure: _PORT_USE
1343: @${ECHO_MSG} "===> Configuring for ${PKGNAME}"
1344: real-build: _PORT_USE
1345: @${ECHO_MSG} "===> Building for ${PKGNAME}"
1346: real-install: _PORT_USE
1347: @${ECHO_MSG} "===> Installing for ${PKGNAME}"
1348: real-package: _PORT_USE
1349:
1350: # Empty pre-* and post-* targets, note we can't use .if !target()
1351: # in the _PORT_USE macro
1352:
1353: .for name in fetch extract patch configure build install package
1354:
1355: .if !target(pre-${name})
1356: pre-${name}:
1357: @${DO_NADA}
1358: .endif
1359:
1360: .if !target(post-${name})
1361: post-${name}:
1362: @${DO_NADA}
1363: .endif
1364:
1365: .endfor
1366:
1367: # Checkpatch
1368: #
1369: # Special target to verify patches
1370:
1371: .if !target(checkpatch)
1372: checkpatch:
1.6 niklas 1373: @cd ${.CURDIR} && ${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch
1.1 niklas 1374: .endif
1375:
1376: # Reinstall
1377: #
1378: # Special target to re-run install
1379:
1380: .if !target(reinstall)
1.13 imp 1381: reinstall:
1382: @${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
1383: @DEPENDS_TARGET=${DEPENDS_TARGET} ${MAKE} install
1.1 niklas 1384: .endif
1385:
1386: ################################################################
1387: # Some more targets supplied for users' convenience
1388: ################################################################
1389:
1390: # Cleaning up
1391:
1392: .if !target(pre-clean)
1393: pre-clean:
1394: @${DO_NADA}
1395: .endif
1396:
1397: .if !target(clean)
1398: clean: pre-clean
1.9 imp 1399: .if !defined(NOCLEANDEPENDS)
1400: @${MAKE} clean-depends
1401: .endif
1.1 niklas 1402: @${ECHO_MSG} "===> Cleaning for ${PKGNAME}"
1.6 niklas 1403: .if !defined(NO_WRKDIR)
1.9 imp 1404: @if [ -d ${WRKDIR} ]; then \
1405: if [ -w ${WRKDIR} ]; then \
1406: ${RM} -rf ${WRKDIR}; \
1407: else \
1408: ${ECHO_MSG} "===> ${WRKDIR} not writable, skipping"; \
1409: fi; \
1410: fi
1.6 niklas 1411: .else
1.1 niklas 1412: @${RM} -f ${WRKDIR}/.*_done
1413: .endif
1414: .endif
1415:
1.9 imp 1416: .if !target(pre-distclean)
1417: pre-distclean:
1418: @${DO_NADA}
1419: .endif
1420:
1421: .if !target(distclean)
1422: distclean: pre-distclean clean
1423: @${ECHO_MSG} "===> Dist cleaning for ${PKGNAME}"
1.13 imp 1424: @(if [ -d ${_DISTDIR} ]; then \
1425: cd ${_DISTDIR}; \
1426: ${RM} -f ${DISTFILES} ${PATCHFILES}; \
1427: fi)
1.9 imp 1428: .if defined(DIST_SUBDIR)
1.13 imp 1429: -@${RMDIR} ${_DISTDIR}
1.9 imp 1430: .endif
1431: .endif
1432:
1.1 niklas 1433: # Prints out a list of files to fetch (useful to do a batch fetch)
1434:
1435: .if !target(fetch-list)
1436: fetch-list:
1.9 imp 1437: @${MKDIR} ${_DISTDIR}
1438: @(cd ${_DISTDIR}; \
1.1 niklas 1439: for file in ${DISTFILES}; do \
1440: if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1441: for site in ${MASTER_SITES}; do \
1.6 niklas 1442: ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1.1 niklas 1443: break; \
1444: done; \
1445: ${ECHO} "echo $${file} not fetched" ; \
1446: fi \
1447: done)
1448: .if defined(PATCHFILES)
1.9 imp 1449: @(cd ${_DISTDIR}; \
1.1 niklas 1450: for file in ${PATCHFILES}; do \
1451: if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1452: for site in ${PATCH_SITES}; do \
1.6 niklas 1453: ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1.1 niklas 1454: break; \
1455: done; \
1456: ${ECHO} "echo $${file} not fetched" ; \
1457: fi \
1458: done)
1459: .endif
1460: .endif
1461:
1462: # Checksumming utilities
1463:
1464: .if !target(makesum)
1465: makesum: fetch
1.9 imp 1466: @${MKDIR} ${FILESDIR}
1.1 niklas 1467: @if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi
1468: @(cd ${DISTDIR}; \
1.9 imp 1469: for file in ${_CKSUMFILES}; do \
1.1 niklas 1470: ${MD5} $$file >> ${MD5_FILE}; \
1471: done)
1.9 imp 1472: @for file in ${_IGNOREFILES}; do \
1473: ${ECHO} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \
1474: done
1.1 niklas 1475: .endif
1476:
1477: .if !target(checksum)
1478: checksum: fetch
1479: @if [ ! -f ${MD5_FILE} ]; then \
1480: ${ECHO_MSG} ">> No MD5 checksum file."; \
1481: else \
1.9 imp 1482: (cd ${DISTDIR}; OK="true"; \
1483: for file in ${_CKSUMFILES}; do \
1.6 niklas 1484: CKSUM=`${MD5} < $$file`; \
1.13 imp 1485: CKSUM2=`${GREP} "^MD5 ($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1.1 niklas 1486: if [ "$$CKSUM2" = "" ]; then \
1.9 imp 1487: ${ECHO_MSG} ">> No checksum recorded for $$file."; \
1488: OK="false"; \
1489: elif [ "$$CKSUM2" = "IGNORE" ]; then \
1490: ${ECHO_MSG} ">> Checksum for $$file is set to IGNORE in md5 file even though"; \
1491: ${ECHO_MSG} " the file is not in the "'$$'"{IGNOREFILES} list."; \
1.1 niklas 1492: OK="false"; \
1.13 imp 1493: elif [ "$$CKSUM" = "$$CKSUM2" ]; then \
1494: ${ECHO_MSG} ">> Checksum OK for $$file."; \
1495: else \
1.9 imp 1496: ${ECHO_MSG} ">> Checksum mismatch for $$file."; \
1.13 imp 1497: OK="false"; \
1.1 niklas 1498: fi; \
1499: done; \
1.9 imp 1500: for file in ${_IGNOREFILES}; do \
1501: CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1502: if [ "$$CKSUM2" = "" ]; then \
1503: ${ECHO_MSG} ">> No checksum recorded for $$file, file is in "'$$'"{IGNOREFILES} list."; \
1504: OK="false"; \
1505: elif [ "$$CKSUM2" != "IGNORE" ]; then \
1506: ${ECHO_MSG} ">> Checksum for $$file is not set to IGNORE in md5 file even though"; \
1507: ${ECHO_MSG} " the file is in the "'$$'"{IGNOREFILES} list."; \
1508: OK="false"; \
1509: fi; \
1510: done; \
1.13 imp 1511: if [ "$$OK" != "true" ]; then \
1512: ${ECHO_MSG} "Make sure the Makefile and md5 file (${MD5_FILE})"; \
1513: ${ECHO_MSG} "are up to date. If you want to override this check, type"; \
1514: ${ECHO_MSG} "\"make NO_CHECKSUM=yes [other args]\"."; \
1515: exit 1; \
1.1 niklas 1516: fi) ; \
1517: fi
1518: .endif
1519:
1520: ################################################################
1521: # The special package-building targets
1522: # You probably won't need to touch these
1523: ################################################################
1524:
1525: # Nobody should want to override this unless PKGNAME is simply bogus.
1526:
1527: .if !target(package-name)
1528: package-name:
1529: @${ECHO} ${PKGNAME}
1530: .endif
1531:
1532: # Show (recursively) all the packages this package depends on.
1533:
1534: .if !target(package-depends)
1535: package-depends:
1.13 imp 1536: @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 \
1537: if [ -d $$dir ]; then \
1538: (cd $$dir ; ${MAKE} package-name package-depends); \
1539: else \
1540: ${ECHO_MSG} "Warning: \"$$dir\" non-existent -- @pkgdep registration incomplete" >&2; \
1541: fi; \
1.1 niklas 1542: done
1543: .endif
1544:
1545: # Build a package but don't check the package cookie
1546:
1547: .if !target(repackage)
1548: repackage: pre-repackage package
1549:
1550: pre-repackage:
1551: @${RM} -f ${PACKAGE_COOKIE}
1552: .endif
1553:
1554: # Build a package but don't check the cookie for installation, also don't
1555: # install package cookie
1556:
1557: .if !target(package-noinstall)
1558: package-noinstall:
1.6 niklas 1559: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package
1.1 niklas 1560: .endif
1561:
1562: ################################################################
1563: # Dependency checking
1564: ################################################################
1565:
1566: .if !target(depends)
1567: depends: lib-depends misc-depends
1.6 niklas 1568: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1569: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends
1570: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends
1.1 niklas 1571:
1572: .if make(fetch-depends)
1573: DEPENDS_TMP+= ${FETCH_DEPENDS}
1574: .endif
1575:
1576: .if make(build-depends)
1577: DEPENDS_TMP+= ${BUILD_DEPENDS}
1578: .endif
1579:
1580: .if make(run-depends)
1581: DEPENDS_TMP+= ${RUN_DEPENDS}
1582: .endif
1583:
1584: _DEPENDS_USE: .USE
1585: .if defined(DEPENDS_TMP)
1.13 imp 1586: .if !defined(NO_DEPENDS)
1.20 todd 1587: @PATH=${PORTSPATH}; for i in ${DEPENDS_TMP}; do \
1.1 niklas 1588: prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1.13 imp 1589: dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
1590: if expr "$$dir" : '.*:' > /dev/null; then \
1591: target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
1592: dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1.1 niklas 1593: else \
1.13 imp 1594: target=${DEPENDS_TARGET}; \
1.1 niklas 1595: fi; \
1596: if expr "$$prog" : \\/ >/dev/null; then \
1597: if [ -e "$$prog" ]; then \
1598: ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - found"; \
1599: notfound=0; \
1600: else \
1601: ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - not found"; \
1602: notfound=1; \
1603: fi; \
1604: else \
1.9 imp 1605: if which "$$prog" > /dev/null 2>&1 ; then \
1.1 niklas 1606: ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - found"; \
1607: notfound=0; \
1608: else \
1609: ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - not found"; \
1610: notfound=1; \
1611: fi; \
1612: fi; \
1613: if [ $$notfound != 0 ]; then \
1.13 imp 1614: ${ECHO_MSG} "===> Verifying $$target for $$prog in $$dir"; \
1.1 niklas 1615: if [ ! -d "$$dir" ]; then \
1616: ${ECHO_MSG} ">> No directory for $$prog. Skipping.."; \
1617: else \
1.13 imp 1618: (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1 niklas 1619: ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \
1620: fi; \
1621: fi; \
1622: done
1623: .endif
1624: .else
1625: @${DO_NADA}
1626: .endif
1627:
1628: fetch-depends: _DEPENDS_USE
1629: build-depends: _DEPENDS_USE
1630: run-depends: _DEPENDS_USE
1631:
1632: lib-depends:
1633: .if defined(LIB_DEPENDS)
1.13 imp 1634: .if !defined(NO_DEPENDS)
1.16 niklas 1635: .if (${MACHINE_ARCH} == "alpha")
1636: @for i in ${LIB_DEPENDS}; do \
1.24 niklas 1637: lib=`${ECHO} $$i | ${SED} -e 's/\\\.[0-9][0-9]*\\\.[0-9]*:.*//'`; \
1.16 niklas 1638: dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
1639: if expr "$$dir" : '.*:' > /dev/null; then \
1640: target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
1641: dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1642: else \
1643: target=${DEPENDS_TARGET}; \
1644: fi; \
1.17 niklas 1645: tmp=`mktemp /tmp/bpmXXXXXXXXXX`; \
1646: if ${LD} -r -o $$tmp -l$$lib; then \
1.16 niklas 1647: ${ECHO_MSG} "===> ${PKGNAME} depends on library: $$lib - found"; \
1648: else \
1649: ${ECHO_MSG} "===> ${PKGNAME} depends on library: $$lib - not found"; \
1650: ${ECHO_MSG} "===> Verifying $$target for $$lib in $$dir"; \
1651: if [ ! -d "$$dir" ]; then \
1652: ${ECHO_MSG} ">> No directory for $$lib. Skipping.."; \
1653: else \
1654: (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1655: ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \
1656: fi; \
1657: fi; \
1.17 niklas 1658: ${RM} -f $$tmp; \
1.16 niklas 1659: done
1660: .else
1.1 niklas 1661: @for i in ${LIB_DEPENDS}; do \
1662: lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1.13 imp 1663: dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
1664: if expr "$$dir" : '.*:' > /dev/null; then \
1665: target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
1666: dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1667: else \
1668: target=${DEPENDS_TARGET}; \
1669: fi; \
1.1 niklas 1670: if /sbin/ldconfig -r | ${GREP} -q -e "-l$$lib"; then \
1671: ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib - found"; \
1672: else \
1673: ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib - not found"; \
1.13 imp 1674: ${ECHO_MSG} "===> Verifying $$target for $$lib in $$dir"; \
1.1 niklas 1675: if [ ! -d "$$dir" ]; then \
1676: ${ECHO_MSG} ">> No directory for $$lib. Skipping.."; \
1677: else \
1.13 imp 1678: (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1 niklas 1679: ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \
1680: fi; \
1681: fi; \
1682: done
1.16 niklas 1683: .endif
1.1 niklas 1684: .endif
1685: .else
1686: @${DO_NADA}
1687: .endif
1688:
1689: misc-depends:
1690: .if defined(DEPENDS)
1691: .if !defined(NO_DEPENDS)
1.13 imp 1692: @for dir in ${DEPENDS}; do \
1693: if expr "$$dir" : '.*:' > /dev/null; then \
1694: target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
1695: dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1696: else \
1697: target=${DEPENDS_TARGET}; \
1698: fi; \
1699: ${ECHO_MSG} "===> ${PKGNAME} depends on: $$dir"; \
1700: ${ECHO_MSG} "===> Verifying $$target for $$dir"; \
1701: if [ ! -d $$dir ]; then \
1702: ${ECHO_MSG} ">> No directory for $$dir. Skipping.."; \
1.1 niklas 1703: else \
1.13 imp 1704: (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1 niklas 1705: fi \
1706: done
1707: @${ECHO_MSG} "===> Returning to build of ${PKGNAME}"
1708: .endif
1709: .else
1710: @${DO_NADA}
1711: .endif
1712:
1713: .endif
1714:
1.9 imp 1715: .if !target(clean-depends)
1716: clean-depends:
1717: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || defined(LIB_DEPENDS) \
1718: || defined(RUN_DEPENDS)
1.13 imp 1719: @for dir in `${ECHO} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u`; do \
1720: if [ -d $$dir ] ; then \
1721: (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
1722: fi \
1.9 imp 1723: done
1724: .endif
1725: .if defined(DEPENDS)
1.13 imp 1726: @for dir in `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
1727: if [ -d $$dir ] ; then \
1728: (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
1729: fi \
1.9 imp 1730: done
1731: .endif
1732: .endif
1733:
1.1 niklas 1734: .if !target(depends-list)
1735: depends-list:
1.13 imp 1736: @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 1737: (cd $$dir; ${MAKE} package-name depends-list); \
1.1 niklas 1738: done
1739: .endif
1740:
1741: ################################################################
1742: # Everything after here are internal targets and really
1743: # shouldn't be touched by anybody but the release engineers.
1744: ################################################################
1745:
1746: # This target generates an index entry suitable for aggregation into
1747: # a large index. Format is:
1748: #
1749: # distribution-name|port-path|installation-prefix|comment| \
1750: # description-file|maintainer|categories|build deps|run deps
1751: #
1752: .if !target(describe)
1753: describe:
1.13 imp 1754: @${ECHO} -n "${PKGNAME}|${.CURDIR}|"; \
1755: ${ECHO} -n "${PREFIX}|"; \
1756: if [ -f ${COMMENT} ]; then \
1757: ${ECHO} -n "`${CAT} ${COMMENT}`"; \
1.1 niklas 1758: else \
1759: ${ECHO} -n "** No Description"; \
1.13 imp 1760: fi; \
1761: if [ -f ${DESCR} ]; then \
1762: ${ECHO} -n "|${DESCR}"; \
1.1 niklas 1763: else \
1764: ${ECHO} -n "|/dev/null"; \
1.13 imp 1765: fi; \
1766: ${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|"; \
1767: case "A${FETCH_DEPENDS}B${BUILD_DEPENDS}C${LIB_DEPENDS}D${DEPENDS}E" in \
1768: ABCDE) ;; \
1769: *) cd ${.CURDIR} && ${ECHO} -n `make depends-list|sort -u`;; \
1770: esac; \
1771: ${ECHO} -n "|"; \
1772: case "A${RUN_DEPENDS}B${LIB_DEPENDS}C${DEPENDS}D" in \
1773: ABCD) ;; \
1774: *) cd ${.CURDIR} && ${ECHO} -n `make package-depends|sort -u`;; \
1775: esac; \
1776: ${ECHO} ""
1.1 niklas 1777: .endif
1778:
1779: .if !target(readmes)
1780: readmes: readme
1781: .endif
1782:
1783: .if !target(readme)
1784: readme:
1785: @rm -f README.html
1.6 niklas 1786: @cd ${.CURDIR} && make README.html
1.1 niklas 1787: .endif
1788:
1789: README.html:
1790: @${ECHO_MSG} "===> Creating README.html for ${PKGNAME}"
1791: @${CAT} ${TEMPLATES}/README.port | \
1792: ${SED} -e 's&%%PORT%%&'`${ECHO} ${.CURDIR} | ${SED} -e 's.*/\([^/]*/[^/]*\)$$\1'`'&g' \
1793: -e 's&%%PKG%%&${PKGNAME}&g' \
1794: -e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \
1795: -e '/%%COMMENT%%/d' \
1796: -e 's&%%BUILD_DEPENDS%%&'"`${MAKE} print-depends-list`"'&' \
1797: -e 's&%%RUN_DEPENDS%%&'"`${MAKE} print-package-depends`"'&' \
1798: >> $@
1799:
1800: .if !target(print-depends-list)
1801: print-depends-list:
1802: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \
1803: defined(LIB_DEPENDS) || defined(DEPENDS)
1804: @${ECHO} -n 'This port requires package(s) "'
1.9 imp 1805: @${ECHO} -n `make depends-list | sort -u`
1.1 niklas 1806: @${ECHO} '" to build.'
1807: .endif
1808: .endif
1809:
1810: .if !target(print-package-depends)
1811: print-package-depends:
1812: .if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS)
1813: @${ECHO} -n 'This port requires package(s) "'
1.9 imp 1814: @${ECHO} -n `make package-depends | sort -u`
1.1 niklas 1815: @${ECHO} '" to run.'
1816: .endif
1817: .endif
1818:
1819: # Fake installation of package so that user can pkg_delete it later.
1820: # Also, make sure that an installed port is recognized correctly in
1821: # accordance to the @pkgdep directive in the packing lists
1822:
1823: .if !target(fake-pkg)
1824: fake-pkg:
1.13 imp 1825: @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 1826: @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi
1.1 niklas 1827: .if defined(FORCE_PKG_REGISTER)
1828: @${RM} -rf ${PKG_DBDIR}/${PKGNAME}
1829: .endif
1830: @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
1831: ${ECHO_MSG} "===> Registering installation for ${PKGNAME}"; \
1.9 imp 1832: ${MKDIR} ${PKG_DBDIR}/${PKGNAME}; \
1.1 niklas 1833: ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
1.13 imp 1834: ${CP} ${DESCR} ${PKG_DBDIR}/${PKGNAME}/+DESC; \
1835: ${CP} ${COMMENT} ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
1.1 niklas 1836: if [ -f ${PKGDIR}/INSTALL ]; then \
1837: ${CP} ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \
1838: fi; \
1839: if [ -f ${PKGDIR}/DEINSTALL ]; then \
1840: ${CP} ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \
1841: fi; \
1842: if [ -f ${PKGDIR}/REQ ]; then \
1843: ${CP} ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \
1844: fi; \
1.13 imp 1845: for dep in `make package-depends ECHO_MSG=/usr/bin/true | sort -u`; do \
1846: if [ -d ${PKG_DBDIR}/$$dep ]; then \
1847: if ! ${GREP} ^${PKGNAME}$$ ${PKG_DBDIR}/$$dep/+REQUIRED_BY \
1848: >/dev/null 2>&1; then \
1849: ${ECHO} ${PKGNAME} >> ${PKG_DBDIR}/$$dep/+REQUIRED_BY; \
1850: fi; \
1851: fi; \
1852: done; \
1.1 niklas 1853: fi
1854: .endif
1855:
1856: # Depend is generally meaningless for arbitrary ports, but if someone wants
1857: # one they can override this. This is just to catch people who've gotten into
1858: # the habit of typing `make depend all install' as a matter of course.
1859: #
1860: .if !target(depend)
1861: depend:
1862: .endif
1863:
1864: # Same goes for tags
1865: .if !target(tags)
1866: tags:
1.10 niklas 1867: .endif
1868: