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