Annotation of src/share/mk/bsd.port.mk, Revision 1.8
1.1 niklas 1: # -*- mode: Fundamental; tab-width: 4; -*-
1.8 ! niklas 2: # $OpenBSD: bsd.port.mk,v 1.7 1996/10/22 14:01:19 niklas Exp $
1.1 niklas 3: #
4: # bsd.port.mk - 940820 Jordan K. Hubbard.
5: # This file is in the public domain.
6: #
1.7 niklas 7: # FreeBSD Id: bsd.port.mk,v 1.226 1996/09/24 06:48:22 asami Exp $
1.6 niklas 8: #
1.1 niklas 9: # Please view me with 4 column tabs!
10:
1.6 niklas 11: # This is for this file, not for the ports that includes it, so it's
12: # commented out -- the person to contact if you have questions/
13: # suggestions about bsd.port.mk.
14: #
15: # MAINTAINER= asami@FreeBSD.ORG
16: #
1.1 niklas 17:
18: # Supported Variables and their behaviors:
19: #
20: # Variables that typically apply to all ports:
21: #
22: # PORTSDIR - The root of the ports tree (default: /usr/ports).
23: # DISTDIR - Where to get gzip'd, tarballed copies of original sources
24: # (default: ${PORTSDIR}/distfiles/${DIST_SUBDIR}).
25: # PREFIX - Where to install things in general (default: /usr/local).
26: # MASTER_SITES - Primary location(s) for distribution files if not found
27: # locally (default:
28: # ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/)
29: # PATCH_SITES - Primary location(s) for distribution patch files
30: # (see PATCHFILES below) if not found locally (default:
31: # ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/)
32: #
33: # MASTER_SITE_OVERRIDE - If set, override the MASTER_SITES setting with this
34: # value.
35: # MASTER_SITE_FREEBSD - If set, only use the FreeBSD master repository for
36: # MASTER_SITES.
37: # PACKAGES - A top level directory where all packages go (rather than
38: # going locally to each port). (default: ${PORTSDIR}/packages).
39: # GMAKE - Set to path of GNU make if not in $PATH (default: gmake).
40: # XMKMF - Set to path of `xmkmf' if not in $PATH (default: xmkmf -a ).
41: # MAINTAINER - The e-mail address of the contact person for this port
42: # (default: ports@FreeBSD.ORG).
43: # CATEGORIES - A list of descriptive categories into which this port falls
44: # (default: orphans).
45: #
46: # Variables that typically apply to an individual port. Non-Boolean
47: # variables without defaults are *mandatory*.
48: #
49: # WRKDIR - A temporary working directory that gets *clobbered* on clean
50: # (default: ${.CURDIR}/work).
51: # WRKSRC - A subdirectory of ${WRKDIR} where the distribution actually
52: # unpacks to. (Default: ${WRKDIR}/${DISTNAME} unless
53: # NO_WRKSUBDIR is set, in which case simply ${WRKDIR}).
54: # DISTNAME - Name of port or distribution.
55: # DISTFILES - Name(s) of archive file(s) containing distribution
56: # (default: ${DISTNAME}${EXTRACT_SUFX}).
57: # PATCHFILES - Name(s) of additional files that contain distribution
58: # patches (default: none). make will look for them at
59: # PATCH_SITES (see above). They will automatically be
60: # uncompressed before patching if the names end with
61: # ".gz" or ".Z".
62: # DIST_SUBDIR - Suffix to ${DISTDIR} (see above). If set, all ${DISTFILES}
63: # and ${PATCHFILES} will be put in this subdirectory of
64: # ${DISTDIR}. Also they will be fetched in this subdirectory
65: # from FreeBSD mirror sites.
66: # PKGNAME - Name of the package file to create if the DISTNAME
67: # isn't really relevant for the port/package
68: # (default: ${DISTNAME}).
69: # EXTRACT_ONLY - If defined, a subset of ${DISTFILES} you want to
70: # actually extract.
71: # PATCHDIR - A directory containing any additional patches you made
72: # to port this software to FreeBSD (default:
73: # ${.CURDIR}/patches)
74: # SCRIPTDIR - A directory containing any auxiliary scripts
75: # (default: ${.CURDIR}/scripts)
76: # FILESDIR - A directory containing any miscellaneous additional files.
77: # (default: ${.CURDIR}/files)
78: # PKGDIR - A direction containing any package creation files.
79: # (default: ${.CURDIR}/pkg)
80: # PKG_DBDIR - Where package installation is recorded (default: /var/db/pkg)
81: # FORCE_PKG_REGISTER - If set, it will overwrite any existing package
82: # registration information in ${PKG_DBDIR}/${PKGNAME}.
83: # NO_MTREE - If set, will not invoke mtree from bsd.port.mk from
84: # the "install" target. This is the default if
85: # USE_IMAKE or USE_X11 is set.
86: #
1.6 niklas 87: # NO_BUILD - Use a dummy (do-nothing) build target.
88: # NO_CONFIGURE - Use a dummy (do-nothing) configure target.
89: # NO_CDROM - Use dummy (do-nothing) targets if FOR_CDROM is set.
90: # NO_DESCRIBE - Use a dummy (do-nothing) describe target.
1.1 niklas 91: # NO_EXTRACT - Use a dummy (do-nothing) extract target.
1.6 niklas 92: # NO_INSTALL - Use a dummy (do-nothing) install target.
1.1 niklas 93: # NO_PACKAGE - Use a dummy (do-nothing) package target.
1.6 niklas 94: # NO_PKG_REGISTER - Don't register a port install as a package.
1.1 niklas 95: # NO_WRKSUBDIR - Assume port unpacks directly into ${WRKDIR}.
96: # NO_WRKDIR - There's no work directory at all; port does this someplace
97: # else.
98: # NO_DEPENDS - Don't verify build of dependencies.
99: # BROKEN - Port is broken.
100: # RESTRICTED - Port is restricted. Set this string to the reason why.
101: # USE_GMAKE - Says that the port uses gmake.
102: # USE_IMAKE - Says that the port uses imake.
103: # USE_X11 - Says that the port uses X11.
104: # NO_INSTALL_MANPAGES - For imake ports that don't like the install.man
105: # target.
106: # HAS_CONFIGURE - Says that the port has its own configure script.
107: # GNU_CONFIGURE - Set if you are using GNU configure (optional).
108: # CONFIGURE_SCRIPT - Name of configure script, defaults to 'configure'.
109: # CONFIGURE_ARGS - Pass these args to configure if ${HAS_CONFIGURE} is set.
110: # CONFIGURE_ENV - Pass these env (shell-like) to configure if
111: # ${HAS_CONFIGURE} is set.
112: # IS_INTERACTIVE - Set this if your port needs to interact with the user
113: # during a build. User can then decide to skip this port by
114: # setting ${BATCH}, or compiling only the interactive ports
115: # by setting ${INTERACTIVE}.
1.7 niklas 116: # FETCH_DEPENDS - A list of "path:dir" pairs of other ports this
117: # package depends in the "fetch" stage. "path" is the
118: # name of a file if it starts with a slash (/), an
119: # executable otherwise. make will test for the
120: # existence (if it is a full pathname) or search for
121: # it in your $PATH (if it is an executable) and go
122: # into "dir" to do a "make all install" if it's not
123: # found.
124: # BUILD_DEPENDS - A list of "path:dir" pairs of other ports this
125: # package depends to build (between the "extract" and
126: # "build" stages, inclusive). The test done to
127: # determine the existence of the dependency is the
128: # same as FETCH_DEPENDS.
129: # RUN_DEPENDS - A list of "path:dir" pairs of other ports this
130: # package depends to run. The test done to determine
131: # the existence of the dependency is the same as
132: # FETCH_DEPENDS. This will be checked during the
133: # "install" stage and the name of the dependency will
134: # be put into the package as well.
1.1 niklas 135: # LIB_DEPENDS - A list of "lib:dir" pairs of other ports this package
136: # depends on. "lib" is the name of a shared library.
137: # make will use "ldconfig -r" to search for the
138: # library. Note that lib can be any regular expression,
139: # and you need two backslashes in front of dots (.) to
140: # supress its special meaning (e.g., use
141: # "foo\\.2\\.:${PORTSDIR}/utils/foo" to match "libfoo.2.*").
142: # DEPENDS - A list of other ports this package depends on being
143: # made first. Use this for things that don't fall into
144: # the above two categories.
145: # EXTRACT_CMD - Command for extracting archive (default: tar).
146: # EXTRACT_SUFX - Suffix for archive names (default: .tar.gz).
147: # EXTRACT_BEFORE_ARGS -
148: # Arguments to ${EXTRACT_CMD} before filename
149: # (default: -C ${WRKDIR} -xzf).
150: # EXTRACT_AFTER_ARGS -
151: # Arguments to ${EXTRACT_CMD} following filename
152: # (default: none).
153: #
1.6 niklas 154: # FETCH_CMD - Full path to ftp/http fetch command if not in $PATH
155: # (default: /usr/bin/fetch).
156: # FETCH_BEFORE_ARGS -
157: # Arguments to ${FETCH_CMD} before filename (default: none).
158: # FETCH_AFTER_ARGS -
159: # Arguments to ${FETCH_CMD} following filename (default: none).
1.1 niklas 160: #
161: # Motif support:
162: #
163: # REQUIRES_MOTIF - Set this in your port if it requires Motif. It will be
164: # built only if HAVE_MOTIF is set.
165: # HAVE_MOTIF - If set, means system has Motif. Typically set in
166: # /etc/make.conf.
167: # MOTIF_STATIC - If set, link libXm statically; otherwise, link it
1.6 niklas 168: # dynamically. Typically set in /etc/make.conf.
169: # MOTIFLIB - Set automatically to appropriate value depending on
170: # ${MOTIF_STATIC}. Substitute references to -lXm with
171: # patches to make your port conform to our standards.
1.1 niklas 172: #
173: # Variables to change if you want a special behavior:
174: #
175: # ECHO_MSG - Used to print all the '===>' style prompts - override this
176: # to turn them off (default: /bin/echo).
177: # IS_DEPENDED_TARGET -
178: # The target to execute when a port is called as a
179: # dependency (default: install). E.g., "make fetch
180: # IS_DEPENDED_TARGET=fetch" will fetch all the distfiles,
181: # including those of dependencies, without actually building
182: # any of them).
1.6 niklas 183: # PATCH_DEBUG - If set, print out more information about the patches as
184: # it attempts to apply them.
185: #
186: # Variables that serve as convenient "aliases" for your *-install targets:
187: #
188: # Use these like: "${INSTALL_PROGRAM} ${WRKSRC}/prog ${PREFIX}/bin".
189: # INSTALL_PROGRAM - A command to install binary executables.
190: # INSTALL_SCRIPT - A command to install executable scripts.
191: # INSTALL_DATA - A command to install sharable data.
192: # INSTALL_MAN - A command to install manpages (doesn't compress).
1.1 niklas 193: #
194: # Default targets and their behaviors:
195: #
196: # fetch - Retrieves ${DISTFILES} (and ${PATCHFILES} if defined)
197: # into ${DISTDIR} as necessary.
198: # fetch-list - Show list of files that would be retrieved by fetch
199: # extract - Unpacks ${DISTFILES} into ${WRKDIR}.
200: # patch - Apply any provided patches to the source.
201: # configure - Runs either GNU configure, one or more local configure
202: # scripts or nothing, depending on what's available.
203: # build - Actually compile the sources.
204: # install - Install the results of a build.
205: # reinstall - Install the results of a build, ignoring "already installed"
206: # flag.
207: # package - Create a package from an _installed_ port.
208: # describe - Try to generate a one-line description for each port for
209: # use in INDEX files and the like.
210: # checkpatch - Do a "patch -C" instead of a "patch". Note that it may
211: # give incorrect results if multiple patches deal with
212: # the same file.
213: # checksum - Use files/md5 to ensure that your distfiles are valid.
214: # makesum - Generate files/md5 (only do this for your own ports!).
215: #
216: # Default sequence for "all" is: fetch checksum extract patch configure build
217: #
218: # Please read the comments in the targets section below, you
219: # should be able to use the pre-* or post-* targets/scripts
220: # (which are available for every stage except checksum) or
221: # override the do-* targets to do pretty much anything you want.
222: #
223: # NEVER override the "regular" targets unless you want to open
224: # a major can of worms.
225:
226: .if exists(${.CURDIR}/../Makefile.inc)
227: .include "${.CURDIR}/../Makefile.inc"
228: .endif
229:
1.8 ! niklas 230: .include <bsd.own.mk>
1.6 niklas 231:
1.1 niklas 232: # These need to be absolute since we don't know how deep in the ports
233: # tree we are and thus can't go relative. They can, of course, be overridden
234: # by individual Makefiles.
235: PORTSDIR?= ${DESTDIR}/usr/ports
236: LOCALBASE?= /usr/local
237: X11BASE?= /usr/X11R6
238: DISTDIR?= ${PORTSDIR}/distfiles/${DIST_SUBDIR}
239: PACKAGES?= ${PORTSDIR}/packages
240: TEMPLATES?= ${PORTSDIR}/templates
241: .if !defined(NO_WRKDIR)
242: WRKDIR?= ${.CURDIR}/work
243: .else
244: WRKDIR?= ${.CURDIR}
245: .endif
246: .if defined(NO_WRKSUBDIR)
247: WRKSRC?= ${WRKDIR}
248: .else
249: WRKSRC?= ${WRKDIR}/${DISTNAME}
250: .endif
251: PATCHDIR?= ${.CURDIR}/patches
252: SCRIPTDIR?= ${.CURDIR}/scripts
253: FILESDIR?= ${.CURDIR}/files
254: PKGDIR?= ${.CURDIR}/pkg
255: .if defined(USE_IMAKE) || defined(USE_X11)
256: PREFIX?= ${X11BASE}
257: .else
258: PREFIX?= ${LOCALBASE}
259: .endif
260: # The following 4 lines should go away as soon as the ports are all updated
261: .if defined(EXEC_DEPENDS)
262: BUILD_DEPENDS+= ${EXEC_DEPENDS}
263: RUN_DEPENDS+= ${EXEC_DEPENDS}
264: .endif
265: .if defined(USE_GMAKE)
266: BUILD_DEPENDS+= gmake:${PORTSDIR}/devel/gmake
267: .endif
268:
269: .if exists(${PORTSDIR}/../Makefile.inc)
270: .include "${PORTSDIR}/../Makefile.inc"
271: .endif
272:
273: # Don't change these!!! These names are built into the _TARGET_USE macro,
274: # there is no way to refer to them cleanly from within the macro AFAIK.
275: EXTRACT_COOKIE?= ${WRKDIR}/.extract_done
276: CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done
277: INSTALL_COOKIE?= ${WRKDIR}/.install_done
278: BUILD_COOKIE?= ${WRKDIR}/.build_done
279: PATCH_COOKIE?= ${WRKDIR}/.patch_done
280: PACKAGE_COOKIE?= ${WRKDIR}/.package_done
281:
282: # How to do nothing. Override if you, for some strange reason, would rather
283: # do something.
1.6 niklas 284: DO_NADA?= /usr/bin/true
1.1 niklas 285:
286: # Miscellaneous overridable commands:
287: GMAKE?= gmake
288: XMKMF?= xmkmf -a
1.4 deraadt 289: MD5?= /bin/md5
1.1 niklas 290: MD5_FILE?= ${FILESDIR}/md5
291:
292: MAKE_FLAGS?= -f
293: MAKEFILE?= Makefile
294: MAKE_ENV+= PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} MOTIFLIB="${MOTIFLIB}" CFLAGS="${CFLAGS}"
295:
1.6 niklas 296: FETCH_CMD?= /usr/bin/ftp
1.1 niklas 297:
298: TOUCH?= /usr/bin/touch
299: TOUCH_FLAGS?= -f
300:
301: PATCH?= /usr/bin/patch
302: PATCH_STRIP?= -p0
303: PATCH_DIST_STRIP?= -p0
304: .if defined(PATCH_DEBUG)
1.6 niklas 305: PATCH_DEBUG_TMP= yes
1.1 niklas 306: PATCH_ARGS?= -d ${WRKSRC} -E ${PATCH_STRIP}
307: PATCH_DIST_ARGS?= -d ${WRKSRC} -E ${PATCH_DIST_STRIP}
308: .else
1.6 niklas 309: PATCH_DEBUG_TMP= no
1.3 niklas 310: PATCH_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_STRIP}
311: PATCH_DIST_ARGS?= -d ${WRKSRC} --forward --quiet -E ${PATCH_DIST_STRIP}
1.1 niklas 312: .endif
313: .if defined(BATCH)
314: PATCH_ARGS+= --batch
315: PATCH_DIST_ARGS+= --batch
316: .endif
317:
318: .if defined(PATCH_CHECK_ONLY)
319: PATCH_ARGS+= -C
320: PATCH_DIST_ARGS+= -C
321: .endif
322:
1.5 tholo 323: EXTRACT_CMD?= /bin/tar
1.1 niklas 324: EXTRACT_SUFX?= .tar.gz
325: # Backwards compatability.
326: .if defined(EXTRACT_ARGS)
327: EXTRACT_BEFORE_ARGS?= ${EXTRACT_ARGS}
328: .else
329: EXTRACT_BEFORE_ARGS?= -xzf
330: .endif
331:
332: # Figure out where the local mtree file is
333: .if !defined(MTREE_LOCAL) && exists(/etc/mtree/BSD.local.dist)
334: MTREE_LOCAL= /etc/mtree/BSD.local.dist
335: .endif
336: MTREE_CMD?= /usr/sbin/mtree
337: MTREE_ARGS?= -U -f ${MTREE_LOCAL} -d -e -p
338: .if defined(USE_X11) || defined(USE_IMAKE) || !defined(MTREE_LOCAL)
339: NO_MTREE= yes
340: .endif
341:
1.6 niklas 342: # A few aliases for *-install targets
343: INSTALL_PROGRAM= \
344: ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
345: INSTALL_SCRIPT= \
346: ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}
347: INSTALL_DATA= \
348: ${INSTALL} ${COPY} -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE}
349: INSTALL_MAN= \
350: ${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
351:
1.1 niklas 352: # The user can override the NO_PACKAGE by specifying this from
353: # the make command line
354: .if defined(FORCE_PACKAGE)
355: .undef NO_PACKAGE
356: .endif
357:
358: PKG_CMD?= /usr/sbin/pkg_create
359: .if !defined(PKG_ARGS)
360: PKG_ARGS= -v -c ${PKGDIR}/COMMENT -d ${PKGDIR}/DESCR -f ${PKGDIR}/PLIST -p ${PREFIX} -P "`${MAKE} package-depends|sort|uniq`"
361: .if exists(${PKGDIR}/INSTALL)
362: PKG_ARGS+= -i ${PKGDIR}/INSTALL
363: .endif
364: .if exists(${PKGDIR}/DEINSTALL)
365: PKG_ARGS+= -k ${PKGDIR}/DEINSTALL
366: .endif
367: .if exists(${PKGDIR}/REQ)
368: PKG_ARGS+= -r ${PKGDIR}/REQ
369: .endif
370: .if !defined(NO_MTREE) && defined(MTREE_LOCAL)
371: PKG_ARGS+= -m ${MTREE_LOCAL}
372: .endif
373: .endif
374: PKG_SUFX?= .tgz
375: # where pkg_add records its dirty deeds.
376: PKG_DBDIR?= /var/db/pkg
377:
378: # shared/dynamic motif libs
379: .if defined(HAVE_MOTIF)
380: .if defined(MOTIF_STATIC)
381: MOTIFLIB?= ${X11BASE}/lib/libXm.a
382: .else
383: MOTIFLIB?= -L${X11BASE}/lib -lXm
384: .endif
385: .endif
386:
387: ECHO?= /bin/echo
388: CAT+= /bin/cat
389: CP?= /bin/cp
390: SETENV?= /usr/bin/env
391: RM?= /bin/rm
392: MKDIR?= /bin/mkdir
393: GZCAT?= /usr/bin/gzcat
394: BASENAME?= /usr/bin/basename
395: SED?= /usr/bin/sed
396: CAT?= /bin/cat
397: GREP?= /usr/bin/grep
398: AWK?= /usr/bin/awk
399:
400: # Used to print all the '===>' style prompts - override this to turn them off.
401: ECHO_MSG?= ${ECHO}
402:
403: ALL_TARGET?= all
404: INSTALL_TARGET?= install
405:
406: # If the user has this set, go to the FreeBSD respository for everything.
407: .if defined(MASTER_SITE_FREEBSD)
408: MASTER_SITE_OVERRIDE= ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
409: .endif
410:
1.7 niklas 411: # Empty declaration to avoid "variable MASTER_SITES recursive" error
412: MASTER_SITES?=
413: PATCH_SITES?=
1.1 niklas 414: # I guess we're in the master distribution business! :) As we gain mirror
415: # sites for distfiles, add them to this list.
416: .if !defined(MASTER_SITE_OVERRIDE)
417: MASTER_SITES+= ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
418: PATCH_SITES+= ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/
419: .else
420: MASTER_SITES:= ${MASTER_SITE_OVERRIDE} ${MASTER_SITES}
421: PATCH_SITES:= ${MASTER_SITE_OVERRIDE} ${PATCH_SITES}
422: .endif
423:
1.7 niklas 424: # Search CDROM first if mounted, symlink instead of copy if
425: # FETCH_SYMLINK_DISTFILES is set
426: .if exists(/cdrom/ports/distfiles)
427: MASTER_SITES:= file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${MASTER_SITES}
428: PATCH_SITES:= file:/cdrom/ports/distfiles/${DIST_SUBDIR}/ ${PATCH_SITES}
429: .if defined(FETCH_SYMLINK_DISTFILES)
430: FETCH_BEFORE_ARGS+= -l
431: .endif
432: .endif
433:
1.1 niklas 434: # Derived names so that they're easily overridable.
435: DISTFILES?= ${DISTNAME}${EXTRACT_SUFX}
436: PKGNAME?= ${DISTNAME}
437:
438: # This is what is actually going to be extracted, and is overridable
439: # by user.
440: EXTRACT_ONLY?= ${DISTFILES}
441:
442: # Documentation
443: MAINTAINER?= ports@FreeBSD.ORG
444: CATEGORIES?= orphans
445:
446: # Note this has to start with a capital letter (or more accurately, it
447: # shouldn't match "[a-z]*"), see the target "delete-package-links" below.
448: PKGREPOSITORYSUBDIR?= All
449: PKGREPOSITORY?= ${PACKAGES}/${PKGREPOSITORYSUBDIR}
450: .if exists(${PACKAGES})
451: PKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
452: .else
453: PKGFILE?= ${PKGNAME}${PKG_SUFX}
454: .endif
455:
456: CONFIGURE_SCRIPT?= configure
457:
458: .if defined(GNU_CONFIGURE)
459: CONFIGURE_ARGS+= --prefix=${PREFIX}
460: HAS_CONFIGURE= yes
461: .endif
462:
463: .MAIN: all
464:
465: ################################################################
466: # Many ways to disable a port.
467: #
468: # If we're in BATCH mode and the port is interactive, or we're
469: # in interactive mode and the port is non-interactive, skip all
470: # the important targets. The reason we have two modes is that
471: # one might want to leave a build in BATCH mode running
472: # overnight, then come back in the morning and do _only_ the
473: # interactive ones that required your intervention.
474: #
475: # Don't attempt to build ports that require Motif if you don't
476: # have Motif.
477: #
478: # Ignore ports that can't be resold if building for a CDROM.
479: #
480: # Don't build a port if it's restricted and we don't want to get
481: # into that.
482: #
483: # Don't build a port if it's broken.
484: ################################################################
485:
486: .if (defined(IS_INTERACTIVE) && defined(BATCH)) || \
487: (!defined(IS_INTERACTIVE) && defined(INTERACTIVE)) || \
488: (defined(REQUIRES_MOTIF) && !defined(HAVE_MOTIF)) || \
489: (defined(NO_CDROM) && defined(FOR_CDROM)) || \
490: (defined(RESTRICTED) && defined(NO_RESTRICTED)) || \
491: defined(BROKEN)
492: IGNORE= yes
493: .endif
494:
495: .if defined(IGNORE)
496: all:
497: @${DO_NADA}
498: build:
499: @${DO_NADA}
500: install:
501: @${DO_NADA}
502: fetch:
503: @${DO_NADA}
504: configure:
505: @${DO_NADA}
506: package:
507: @${DO_NADA}
508: .endif
509:
510: .if defined(ALL_HOOK)
511: all:
1.6 niklas 512: @cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \
1.1 niklas 513: DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \
514: PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
515: FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
516: DEPENDS="${DEPENDS}" BUILD_DEPENDS="${BUILD_DEPENDS}" \
517: RUN_DEPENDS="${RUN_DEPENDS}" X11BASE=${X11BASE} \
518: ${ALL_HOOK}
519: .endif
520:
521: .if !target(all)
522: all: build
523: .endif
524:
525: .if !defined(IS_DEPENDED_TARGET)
526: IS_DEPENDED_TARGET= install
527: .endif
528:
529: .if !target(is_depended)
530: is_depended: ${IS_DEPENDED_TARGET}
531: .endif
532:
533: ################################################################
534: # The following are used to create easy dummy targets for
535: # disabling some bit of default target behavior you don't want.
536: # They still check to see if the target exists, and if so don't
537: # do anything, since you might want to set this globally for a
538: # group of ports in a Makefile.inc, but still be able to
539: # override from an individual Makefile.
540: ################################################################
541:
542: # Disable extract
543: .if defined(NO_EXTRACT) && !target(extract)
544: extract: checksum
545: @${TOUCH} ${TOUCH_FLAGS} ${EXTRACT_COOKIE}
546: checksum: fetch
547: @${DO_NADA}
548: makesum:
549: @${DO_NADA}
550: .endif
551:
552: # Disable configure
553: .if defined(NO_CONFIGURE) && !target(configure)
554: configure: patch
555: @${TOUCH} ${TOUCH_FLAGS} ${CONFIGURE_COOKIE}
556: .endif
557:
1.6 niklas 558: # Disable describe
559: .if defined(NO_DESCRIBE) && !target(describe)
560: describe:
561: @${DO_NADA}
562: .endif
563:
1.1 niklas 564: # Disable build
565: .if defined(NO_BUILD) && !target(build)
566: build: configure
567: @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
568: .endif
569:
570: # Disable package
571: .if defined(NO_PACKAGE) && !target(package)
572: package:
573: @${DO_NADA}
574: .endif
575:
576: # Disable install
577: .if defined(NO_INSTALL) && !target(install)
578: install: build
579: @${TOUCH} ${TOUCH_FLAGS} ${INSTALL_COOKIE}
580: .endif
581:
582: # Disable patch
583: .if defined(NO_PATCH) && !target(patch)
584: patch: extract
585: @${TOUCH} ${TOUCH_FLAGS} ${PATCH_COOKIE}
586: .endif
587:
588: ################################################################
589: # More standard targets start here.
590: #
591: # These are the body of the build/install framework. If you are
592: # not happy with the default actions, and you can't solve it by
593: # adding pre-* or post-* targets/scripts, override these.
594: ################################################################
595:
596: # Fetch
597:
598: .if !target(do-fetch)
599: do-fetch:
600: @if [ ! -d ${DISTDIR} ]; then ${MKDIR} -p ${DISTDIR}; fi
601: @(cd ${DISTDIR}; \
602: for file in ${DISTFILES}; do \
603: if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
604: if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
605: ${ECHO_MSG} ">> ${DISTDIR}/$$file is a broken symlink."; \
606: ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
607: ${ECHO_MSG} ">> Please correct this problem and try again."; \
608: exit 1; \
609: fi ; \
610: ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
611: for site in ${MASTER_SITES}; do \
612: ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6 niklas 613: if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1 niklas 614: continue 2; \
615: fi \
616: done; \
1.6 niklas 617: ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.1 niklas 618: ${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \
619: exit 1; \
620: fi \
621: done)
622: .if defined(PATCHFILES)
623: @if [ ! -d ${DISTDIR} ]; then ${MKDIR} -p ${DISTDIR}; fi
624: @(cd ${DISTDIR}; \
625: for file in ${PATCHFILES}; do \
626: if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
627: if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
628: ${ECHO_MSG} ">> ${DISTDIR}/$$file is a broken symlink."; \
629: ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
630: ${ECHO_MSG} ">> Please correct this problem and try again."; \
631: exit 1; \
632: fi ; \
633: ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
634: for site in ${PATCH_SITES}; do \
635: ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6 niklas 636: if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1 niklas 637: continue 2; \
638: fi \
639: done; \
1.6 niklas 640: ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.1 niklas 641: ${ECHO_MSG} ">> port manually into ${DISTDIR} and try again."; \
642: exit 1; \
643: fi \
644: done)
645: .endif
646: .endif
647:
648: # Extract
649:
650: .if !target(do-extract)
651: do-extract:
1.6 niklas 652: .if !defined(NO_WRKDIR)
1.1 niklas 653: @${RM} -rf ${WRKDIR}
654: @${MKDIR} -p ${WRKDIR}
1.6 niklas 655: .endif
1.1 niklas 656: @for file in ${EXTRACT_ONLY}; do \
1.6 niklas 657: if !(cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
1.1 niklas 658: then \
659: exit 1; \
660: fi \
661: done
662: .endif
663:
664: # Patch
665:
666: .if !target(do-patch)
667: do-patch:
668: .if defined(PATCHFILES)
669: @${ECHO_MSG} "===> Applying distribution patches for ${PKGNAME}"
670: @(cd ${DISTDIR}; \
671: for i in ${PATCHFILES}; do \
1.6 niklas 672: if [ ${PATCH_DEBUG_TMP} = yes ]; then \
673: ${ECHO_MSG} "===> Applying distribution patch $$i" ; \
674: fi; \
1.1 niklas 675: case $$i in \
676: *.Z|*.gz) \
677: ${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
678: ;; \
679: *) \
680: ${PATCH} ${PATCH_DIST_ARGS} < $$i; \
681: ;; \
682: esac; \
683: done)
684: .endif
685: @if [ -d ${PATCHDIR} ]; then \
1.6 niklas 686: if [ "`echo ${PATCHDIR}/patch-*`" = "${PATCHDIR}/patch-*" ]; then \
687: ${ECHO_MSG} "===> Ignoring empty patch directory"; \
688: if [ -d ${PATCHDIR}/CVS ]; then \
689: ${ECHO_MSG} "===> Perhaps you forgot the -P flag to cvs co or update?"; \
690: fi; \
691: else \
692: ${ECHO_MSG} "===> Applying FreeBSD patches for ${PKGNAME}" ; \
693: for i in ${PATCHDIR}/patch-*; do \
694: case $$i in \
695: *.orig|*~) \
696: ${ECHO_MSG} "===> Ignoring patchfile $$i" ; \
697: ;; \
698: *) \
699: if [ ${PATCH_DEBUG_TMP} = yes ]; then \
700: ${ECHO_MSG} "===> Applying FreeBSD patch $$i" ; \
701: fi; \
702: ${PATCH} ${PATCH_ARGS} < $$i; \
703: ;; \
704: esac; \
705: done; \
706: fi; \
1.1 niklas 707: fi
708: .endif
709:
710: # Configure
711:
712: .if !target(do-configure)
713: do-configure:
1.7 niklas 714: @if [ -f ${SCRIPTDIR}/configure ]; then \
1.6 niklas 715: cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR}\
716: WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} \
717: SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \
718: PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} DEPENDS="${DEPENDS}" \
1.7 niklas 719: X11BASE=${X11BASE} /bin/sh ${SCRIPTDIR}/configure; \
1.1 niklas 720: fi
721: .if defined(HAS_CONFIGURE)
1.6 niklas 722: @(cd ${WRKSRC} && CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \
1.1 niklas 723: INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \
1.6 niklas 724: INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
1.1 niklas 725: ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS})
726: .endif
727: .if defined(USE_IMAKE)
1.6 niklas 728: @(cd ${WRKSRC} && ${XMKMF})
1.1 niklas 729: .endif
730: .endif
731:
732: # Build
733:
734: .if !target(do-build)
735: do-build:
736: .if defined(USE_GMAKE)
737: @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
738: .else defined(USE_GMAKE)
739: @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
740: .endif
741: .endif
742:
743: # Install
744:
745: .if !target(do-install)
746: do-install:
1.6 niklas 747: @if [ `/bin/sh -c umask` != 0022 ]; then \
748: ${ECHO_MSG} "===> Warning: your umask is \"`/bin/sh -c umask`"\".; \
749: ${ECHO_MSG} " If this is not desired, set it to an appropriate value"; \
750: ${ECHO_MSG} " and install this port again by \`\`make reinstall''."; \
751: fi
1.1 niklas 752: .if defined(USE_GMAKE)
1.6 niklas 753: @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
1.1 niklas 754: .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
1.6 niklas 755: @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
1.1 niklas 756: .endif
757: .else defined(USE_GMAKE)
1.6 niklas 758: @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
1.1 niklas 759: .if defined(USE_IMAKE) && !defined(NO_INSTALL_MANPAGES)
1.6 niklas 760: @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} install.man)
1.1 niklas 761: .endif
762: .endif
763: .endif
764:
765: # Package
766:
767: .if !target(do-package)
768: do-package:
769: @if [ -e ${PKGDIR}/PLIST ]; then \
770: ${ECHO_MSG} "===> Building package for ${PKGNAME}"; \
771: if [ -d ${PACKAGES} ]; then \
772: if [ ! -d ${PKGREPOSITORY} ]; then \
773: if ! ${MKDIR} -p ${PKGREPOSITORY}; then \
774: ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \
775: exit 1; \
776: fi; \
777: fi; \
778: fi; \
779: if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \
780: if [ -d ${PACKAGES} ]; then \
781: ${MAKE} ${.MAKEFLAGS} package-links; \
782: fi; \
783: else \
784: ${MAKE} ${.MAKEFLAGS} delete-package; \
785: exit 1; \
786: fi; \
787: fi
788: .endif
789:
790: # Some support rules for do-package
791:
792: .if !target(package-links)
793: package-links:
794: @${MAKE} ${.MAKEFLAGS} delete-package-links
795: @for cat in ${CATEGORIES}; do \
796: if [ ! -d ${PACKAGES}/$$cat ]; then \
797: if ! ${MKDIR} -p ${PACKAGES}/$$cat; then \
798: ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \
799: exit 1; \
800: fi; \
801: fi; \
802: ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
803: done;
804: .endif
805:
806: .if !target(delete-package-links)
807: delete-package-links:
808: @${RM} -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX};
809: .endif
810:
811: .if !target(delete-package)
812: delete-package:
813: @${MAKE} ${.MAKEFLAGS} delete-package-links
814: @${RM} -f ${PKGFILE}
815: .endif
816:
817: ################################################################
818: # This is the "generic" port target, actually a macro used from the
819: # six main targets. See below for more.
820: ################################################################
821:
822: _PORT_USE: .USE
823: .if make(real-fetch)
1.6 niklas 824: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1.1 niklas 825: .endif
826: .if make(real-extract)
1.6 niklas 827: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends lib-depends misc-depends
1.1 niklas 828: .endif
829: .if make(real-install)
1.6 niklas 830: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends
1.1 niklas 831: .endif
832: .if make(real-install)
833: .if !defined(NO_MTREE)
834: @if [ `id -u` = 0 ]; then \
835: ${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \
836: else \
837: ${ECHO_MSG} "Warning: not superuser, can't run mtree."; \
838: ${ECHO_MSG} "Become root and try again to ensure correct permissions."; \
839: fi
840: .endif
841: .endif
1.6 niklas 842: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/}
1.1 niklas 843: @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \
1.6 niklas 844: cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} \
1.1 niklas 845: WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
846: FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
847: DEPENDS="${DEPENDS}" X11BASE=${X11BASE} \
848: /bin/sh ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/}; \
849: fi
1.6 niklas 850: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/}
851: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/}
1.1 niklas 852: @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \
1.6 niklas 853: cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTDIR=${DISTDIR}\
854: WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} \
855: SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \
856: PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} DEPENDS="${DEPENDS}" \
857: X11BASE=${X11BASE} \
1.1 niklas 858: /bin/sh ${SCRIPTDIR}/${.TARGET:S/^real-/post-/}; \
859: fi
1.6 niklas 860: .if make(real-install) && !defined(NO_PKG_REGISTER)
861: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fake-pkg
1.1 niklas 862: .endif
863: .if !make(real-fetch) \
864: && (!make(real-patch) || !defined(PATCH_CHECK_ONLY)) \
865: && (!make(real-package) || !defined(PACKAGE_NOINSTALL))
866: @${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.${.TARGET:S/^real-//}_done
867: .endif
868:
869: ################################################################
870: # Skeleton targets start here
871: #
872: # You shouldn't have to change these. Either add the pre-* or
873: # post-* targets/scripts or redefine the do-* targets. These
874: # targets don't do anything other than checking for cookies and
875: # call the necessary targets/scripts.
876: ################################################################
877:
878: .if !target(fetch)
879: fetch:
1.6 niklas 880: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-fetch
1.1 niklas 881: .endif
882:
883: .if !target(extract)
884: extract: checksum ${EXTRACT_COOKIE}
885: .endif
886:
887: .if !target(patch)
888: patch: extract ${PATCH_COOKIE}
889: .endif
890:
891: .if !target(configure)
892: configure: patch ${CONFIGURE_COOKIE}
893: .endif
894:
895: .if !target(build)
896: build: configure ${BUILD_COOKIE}
897: .endif
898:
899: .if !target(install)
900: install: build ${INSTALL_COOKIE}
901: .endif
902:
903: .if !target(package)
904: package: install ${PACKAGE_COOKIE}
905: .endif
906:
907: ${EXTRACT_COOKIE}:
1.6 niklas 908: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-extract
1.1 niklas 909: ${PATCH_COOKIE}:
1.6 niklas 910: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-patch
1.1 niklas 911: ${CONFIGURE_COOKIE}:
1.6 niklas 912: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-configure
1.1 niklas 913: ${BUILD_COOKIE}:
1.6 niklas 914: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-build
1.1 niklas 915: ${INSTALL_COOKIE}:
1.6 niklas 916: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-install
1.1 niklas 917: ${PACKAGE_COOKIE}:
1.6 niklas 918: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-package
1.1 niklas 919:
920: # And call the macros
921:
922: real-fetch: _PORT_USE
923: real-extract: _PORT_USE
924: @${ECHO_MSG} "===> Extracting for ${PKGNAME}"
925: real-patch: _PORT_USE
926: @${ECHO_MSG} "===> Patching for ${PKGNAME}"
927: real-configure: _PORT_USE
928: @${ECHO_MSG} "===> Configuring for ${PKGNAME}"
929: real-build: _PORT_USE
930: @${ECHO_MSG} "===> Building for ${PKGNAME}"
931: real-install: _PORT_USE
932: @${ECHO_MSG} "===> Installing for ${PKGNAME}"
933: real-package: _PORT_USE
934:
935: # Empty pre-* and post-* targets, note we can't use .if !target()
936: # in the _PORT_USE macro
937:
938: .for name in fetch extract patch configure build install package
939:
940: .if !target(pre-${name})
941: pre-${name}:
942: @${DO_NADA}
943: .endif
944:
945: .if !target(post-${name})
946: post-${name}:
947: @${DO_NADA}
948: .endif
949:
950: .endfor
951:
952: # Checkpatch
953: #
954: # Special target to verify patches
955:
956: .if !target(checkpatch)
957: checkpatch:
1.6 niklas 958: @cd ${.CURDIR} && ${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch
1.1 niklas 959: .endif
960:
961: # Reinstall
962: #
963: # Special target to re-run install
964:
965: .if !target(reinstall)
966: reinstall: pre-reinstall install
967:
968: pre-reinstall:
969: @${RM} -f ${INSTALL_COOKIE}
970: @${RM} -f ${PACKAGE_COOKIE}
971: .endif
972:
973: ################################################################
974: # Some more targets supplied for users' convenience
975: ################################################################
976:
977: # Cleaning up
978:
979: .if !target(pre-clean)
980: pre-clean:
981: @${DO_NADA}
982: .endif
983:
984: .if !target(clean)
985: clean: pre-clean
986: @${ECHO_MSG} "===> Cleaning for ${PKGNAME}"
1.6 niklas 987: .if !defined(NO_WRKDIR)
988: @${RM} -rf ${WRKDIR}
989: .else
1.1 niklas 990: @${RM} -f ${WRKDIR}/.*_done
991: .endif
992: .endif
993:
994: # Prints out a list of files to fetch (useful to do a batch fetch)
995:
996: .if !target(fetch-list)
997: fetch-list:
998: @if [ ! -d ${DISTDIR} ]; then ${MKDIR} -p ${DISTDIR}; fi
999: @(cd ${DISTDIR}; \
1000: for file in ${DISTFILES}; do \
1001: if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1002: for site in ${MASTER_SITES}; do \
1.6 niklas 1003: ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1.1 niklas 1004: break; \
1005: done; \
1006: ${ECHO} "echo $${file} not fetched" ; \
1007: fi \
1008: done)
1009: .if defined(PATCHFILES)
1010: @(cd ${DISTDIR}; \
1011: for file in ${PATCHFILES}; do \
1012: if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1013: for site in ${PATCH_SITES}; do \
1.6 niklas 1014: ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
1.1 niklas 1015: break; \
1016: done; \
1017: ${ECHO} "echo $${file} not fetched" ; \
1018: fi \
1019: done)
1020: .endif
1021: .endif
1022:
1023: # Checksumming utilities
1024:
1025: .if !target(makesum)
1026: makesum: fetch
1027: @if [ ! -d ${FILESDIR} ]; then ${MKDIR} -p ${FILESDIR}; fi
1028: @if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi
1029: @(cd ${DISTDIR}; \
1030: for file in ${DISTFILES} ${PATCHFILES}; do \
1031: ${MD5} $$file >> ${MD5_FILE}; \
1032: done)
1033: .endif
1034:
1035: .if !target(checksum)
1036: checksum: fetch
1037: @if [ ! -f ${MD5_FILE} ]; then \
1038: ${ECHO_MSG} ">> No MD5 checksum file."; \
1039: else \
1040: (cd ${DISTDIR}; OK=""; \
1041: for file in ${DISTFILES} ${PATCHFILES}; do \
1.6 niklas 1042: CKSUM=`${MD5} < $$file`; \
1.1 niklas 1043: CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1044: if [ "$$CKSUM2" = "" ]; then \
1045: ${ECHO_MSG} ">> No checksum recorded for $$file"; \
1046: OK="false"; \
1047: elif [ "$$CKSUM" != "$$CKSUM2" ]; then \
1048: ${ECHO_MSG} ">> Checksum mismatch for $$file"; \
1049: exit 1; \
1050: fi; \
1051: done; \
1052: if [ "$$OK" = "" ]; then \
1053: ${ECHO_MSG} "Checksums OK."; \
1054: else \
1055: ${ECHO_MSG} "Checksums OK for files that have them."; \
1056: fi) ; \
1057: fi
1058: .endif
1059:
1060: ################################################################
1061: # The special package-building targets
1062: # You probably won't need to touch these
1063: ################################################################
1064:
1065: # Nobody should want to override this unless PKGNAME is simply bogus.
1066:
1067: .if !target(package-name)
1068: package-name:
1069: @${ECHO} ${PKGNAME}
1070: .endif
1071:
1072: # Show (recursively) all the packages this package depends on.
1073:
1074: .if !target(package-depends)
1075: package-depends:
1076: @for i in ${RUN_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \
1077: dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
1078: (cd $$dir ; ${MAKE} package-name package-depends); \
1079: done
1080: .endif
1081:
1082: # Build a package but don't check the package cookie
1083:
1084: .if !target(repackage)
1085: repackage: pre-repackage package
1086:
1087: pre-repackage:
1088: @${RM} -f ${PACKAGE_COOKIE}
1089: .endif
1090:
1091: # Build a package but don't check the cookie for installation, also don't
1092: # install package cookie
1093:
1094: .if !target(package-noinstall)
1095: package-noinstall:
1.6 niklas 1096: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package
1.1 niklas 1097: .endif
1098:
1099: ################################################################
1100: # Dependency checking
1101: ################################################################
1102:
1103: .if !target(depends)
1104: depends: lib-depends misc-depends
1.6 niklas 1105: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1106: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends
1107: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends
1.1 niklas 1108:
1109: .if make(fetch-depends)
1110: DEPENDS_TMP+= ${FETCH_DEPENDS}
1111: .endif
1112:
1113: .if make(build-depends)
1114: DEPENDS_TMP+= ${BUILD_DEPENDS}
1115: .endif
1116:
1117: .if make(run-depends)
1118: DEPENDS_TMP+= ${RUN_DEPENDS}
1119: .endif
1120:
1121: _DEPENDS_USE: .USE
1122: .if defined(DEPENDS_TMP)
1123: .if defined(NO_DEPENDS)
1124: # Just print out messages
1125: @for i in ${DEPENDS_TMP}; do \
1126: prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1127: dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
1128: if expr "$$prog" : \\/ >/dev/null; then \
1129: ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog ($$dir)"; \
1130: else \
1131: ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog ($$dir)"; \
1132: fi; \
1133: done
1134: .else
1135: @for i in ${DEPENDS_TMP}; do \
1136: prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1137: dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
1138: if expr "$$prog" : \\/ >/dev/null; then \
1139: if [ -e "$$prog" ]; then \
1140: ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - found"; \
1141: notfound=0; \
1142: else \
1143: ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - not found"; \
1144: notfound=1; \
1145: fi; \
1146: else \
1147: if which -s "$$prog"; then \
1148: ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - found"; \
1149: notfound=0; \
1150: else \
1151: ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - not found"; \
1152: notfound=1; \
1153: fi; \
1154: fi; \
1155: if [ $$notfound != 0 ]; then \
1156: ${ECHO_MSG} "===> Verifying build for $$prog in $$dir"; \
1157: if [ ! -d "$$dir" ]; then \
1158: ${ECHO_MSG} ">> No directory for $$prog. Skipping.."; \
1159: else \
1160: (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
1161: ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \
1162: fi; \
1163: fi; \
1164: done
1165: .endif
1166: .else
1167: @${DO_NADA}
1168: .endif
1169:
1170: fetch-depends: _DEPENDS_USE
1171: build-depends: _DEPENDS_USE
1172: run-depends: _DEPENDS_USE
1173:
1174: lib-depends:
1175: .if defined(LIB_DEPENDS)
1176: .if defined(NO_DEPENDS)
1177: # Just print out messages
1178: @for i in ${LIB_DEPENDS}; do \
1179: lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1180: dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
1181: ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib ($$dir)"; \
1182: done
1183: .else
1184: @for i in ${LIB_DEPENDS}; do \
1185: lib=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1186: dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
1187: if /sbin/ldconfig -r | ${GREP} -q -e "-l$$lib"; then \
1188: ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib - found"; \
1189: else \
1190: ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$lib - not found"; \
1191: ${ECHO_MSG} "===> Verifying build for $$lib in $$dir"; \
1192: if [ ! -d "$$dir" ]; then \
1193: ${ECHO_MSG} ">> No directory for $$lib. Skipping.."; \
1194: else \
1195: (cd $$dir; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
1196: ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \
1197: fi; \
1198: fi; \
1199: done
1200: .endif
1201: .else
1202: @${DO_NADA}
1203: .endif
1204:
1205: misc-depends:
1206: .if defined(DEPENDS)
1207: @${ECHO_MSG} "===> ${PKGNAME} depends on: ${DEPENDS}"
1208: .if !defined(NO_DEPENDS)
1209: @for i in ${DEPENDS}; do \
1210: ${ECHO_MSG} "===> Verifying build for $$i"; \
1211: if [ ! -d $$i ]; then \
1212: ${ECHO_MSG} ">> No directory for $$i. Skipping.."; \
1213: else \
1214: (cd $$i; ${MAKE} ${.MAKEFLAGS} is_depended) ; \
1215: fi \
1216: done
1217: @${ECHO_MSG} "===> Returning to build of ${PKGNAME}"
1218: .endif
1219: .else
1220: @${DO_NADA}
1221: .endif
1222:
1223: .endif
1224:
1225: .if !target(depends-list)
1226: depends-list:
1227: @for i in ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${DEPENDS}; do \
1.7 niklas 1228: dir=`${ECHO} $$i | ${SED} -e 's/.*://'`; \
1.1 niklas 1229: (cd $$dir ; ${MAKE} package-name depends-list); \
1230: done
1231: .endif
1232:
1233: ################################################################
1234: # Everything after here are internal targets and really
1235: # shouldn't be touched by anybody but the release engineers.
1236: ################################################################
1237:
1238: # This target generates an index entry suitable for aggregation into
1239: # a large index. Format is:
1240: #
1241: # distribution-name|port-path|installation-prefix|comment| \
1242: # description-file|maintainer|categories|build deps|run deps
1243: #
1244: .if !target(describe)
1245: describe:
1.6 niklas 1246: @${ECHO} -n "${PKGNAME}|${.CURDIR}|"
1.1 niklas 1247: @${ECHO} -n "${PREFIX}|"
1248: @if [ -f ${PKGDIR}/COMMENT ]; then \
1249: ${ECHO} -n "`${CAT} ${PKGDIR}/COMMENT`"; \
1250: else \
1251: ${ECHO} -n "** No Description"; \
1252: fi
1253: @if [ -f ${PKGDIR}/DESCR ]; then \
1254: ${ECHO} -n "|${PKGDIR}/DESCR"; \
1255: else \
1256: ${ECHO} -n "|/dev/null"; \
1257: fi
1258: @${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|"
1.6 niklas 1259: @cd ${.CURDIR} && ${ECHO} -n `make depends-list|sort|uniq`
1.1 niklas 1260: @${ECHO} -n "|"
1.6 niklas 1261: @cd ${.CURDIR} && ${ECHO} -n `make package-depends|sort|uniq`
1.1 niklas 1262: @${ECHO} ""
1263: .endif
1264:
1265: .if !target(readmes)
1266: readmes: readme
1267: .endif
1268:
1269: .if !target(readme)
1270: readme:
1271: @rm -f README.html
1.6 niklas 1272: @cd ${.CURDIR} && make README.html
1.1 niklas 1273: .endif
1274:
1275: README.html:
1276: @${ECHO_MSG} "===> Creating README.html for ${PKGNAME}"
1277: @${CAT} ${TEMPLATES}/README.port | \
1278: ${SED} -e 's&%%PORT%%&'`${ECHO} ${.CURDIR} | ${SED} -e 's.*/\([^/]*/[^/]*\)$$\1'`'&g' \
1279: -e 's&%%PKG%%&${PKGNAME}&g' \
1280: -e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \
1281: -e '/%%COMMENT%%/d' \
1282: -e 's&%%BUILD_DEPENDS%%&'"`${MAKE} print-depends-list`"'&' \
1283: -e 's&%%RUN_DEPENDS%%&'"`${MAKE} print-package-depends`"'&' \
1284: >> $@
1285:
1286: .if !target(print-depends-list)
1287: print-depends-list:
1288: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \
1289: defined(LIB_DEPENDS) || defined(DEPENDS)
1290: @${ECHO} -n 'This port requires package(s) "'
1291: @${ECHO} -n `make depends-list | sort | uniq`
1292: @${ECHO} '" to build.'
1293: .endif
1294: .endif
1295:
1296: .if !target(print-package-depends)
1297: print-package-depends:
1298: .if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS)
1299: @${ECHO} -n 'This port requires package(s) "'
1300: @${ECHO} -n `make package-depends | sort | uniq`
1301: @${ECHO} '" to run.'
1302: .endif
1303: .endif
1304:
1305: # Fake installation of package so that user can pkg_delete it later.
1306: # Also, make sure that an installed port is recognized correctly in
1307: # accordance to the @pkgdep directive in the packing lists
1308:
1309: .if !target(fake-pkg)
1310: fake-pkg:
1311: @if [ ! -f ${PKGDIR}/PLIST -o ! -f ${PKGDIR}/COMMENT -o ! -f ${PKGDIR}/DESCR ]; then ${ECHO} "** Missing package files for ${PKGNAME} - installation not recorded."; exit 1; fi
1312: @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} -p ${PKG_DBDIR}; fi
1313: .if defined(FORCE_PKG_REGISTER)
1314: @${RM} -rf ${PKG_DBDIR}/${PKGNAME}
1315: .endif
1316: @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
1317: ${ECHO_MSG} "===> Registering installation for ${PKGNAME}"; \
1318: ${MKDIR} -p ${PKG_DBDIR}/${PKGNAME}; \
1319: ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
1320: ${CP} ${PKGDIR}/DESCR ${PKG_DBDIR}/${PKGNAME}/+DESC; \
1321: ${CP} ${PKGDIR}/COMMENT ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
1322: if [ -f ${PKGDIR}/INSTALL ]; then \
1323: ${CP} ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \
1324: fi; \
1325: if [ -f ${PKGDIR}/DEINSTALL ]; then \
1326: ${CP} ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \
1327: fi; \
1328: if [ -f ${PKGDIR}/REQ ]; then \
1329: ${CP} ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \
1330: fi; \
1331: else \
1332: ${ECHO_MSG} "===> ${PKGNAME} is already installed - perhaps an older version?"; \
1333: ${ECHO_MSG} " If so, you may wish to \`\`pkg_delete ${PKGNAME}'' and install"; \
1334: ${ECHO_MSG} " this port again by \`\`make reinstall'' to upgrade it properly."; \
1335: fi
1336: .endif
1337:
1338: # Depend is generally meaningless for arbitrary ports, but if someone wants
1339: # one they can override this. This is just to catch people who've gotten into
1340: # the habit of typing `make depend all install' as a matter of course.
1341: #
1342: .if !target(depend)
1343: depend:
1344: .endif
1345:
1346: # Same goes for tags
1347: .if !target(tags)
1348: tags:
1349: .endif