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