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