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