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