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