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