Annotation of src/share/mk/bsd.port.mk, Revision 1.44
1.9 imp 1: #-*- mode: Fundamental; tab-width: 4; -*-
2: # ex:ts=4
1.44 ! marc 3: # $OpenBSD: bsd.port.mk,v 1.43 1998/08/24 04:46:14 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."; \
1114: for site in ${MASTER_SITES}; do \
1115: ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6 niklas 1116: if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1 niklas 1117: continue 2; \
1118: fi \
1119: done; \
1.6 niklas 1120: ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.9 imp 1121: ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1.1 niklas 1122: exit 1; \
1123: fi \
1124: done)
1125: .if defined(PATCHFILES)
1.9 imp 1126: @(cd ${_DISTDIR}; \
1.1 niklas 1127: for file in ${PATCHFILES}; do \
1128: if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1129: if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
1.9 imp 1130: ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
1.1 niklas 1131: ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \
1132: ${ECHO_MSG} ">> Please correct this problem and try again."; \
1133: exit 1; \
1134: fi ; \
1135: ${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
1136: for site in ${PATCH_SITES}; do \
1137: ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
1.6 niklas 1138: if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
1.1 niklas 1139: continue 2; \
1140: fi \
1141: done; \
1.6 niklas 1142: ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
1.9 imp 1143: ${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
1.1 niklas 1144: exit 1; \
1145: fi \
1146: done)
1147: .endif
1148: .endif
1149:
1.44 ! marc 1150: # This is for the use of sites which store distfiles which others may
! 1151: # fetch - only fetch the distfile if it is allowed to be
! 1152: # re-distributed freely
! 1153: mirror-distfiles:
! 1154: .if (${MIRROR_DISTFILE} == "yes")
! 1155: @make fetch __ARCH_OK=yes NO_IGNORE=yes
! 1156: .endif
! 1157:
1.1 niklas 1158: # Extract
1159:
1160: .if !target(do-extract)
1161: do-extract:
1.6 niklas 1162: .if !defined(NO_WRKDIR)
1.14 niklas 1163: .if defined(WRKOBJDIR)
1164: @${RM} -rf ${WRKOBJDIR}/${PORTSUBDIR}
1.44 ! marc 1165: @${MKDIR} -p ${WRKOBJDIR}/${PORTSUBDIR}
1.18 niklas 1166: @if [ ! -L ${WRKDIR} ] || \
1167: [ X`${READLINK} ${WRKDIR}` != X${WRKOBJDIR}/${PORTSUBDIR} ]; then \
1168: echo "${WRKDIR} -> ${WRKOBJDIR}/${PORTSUBDIR}"; \
1169: ${RM} -f ${WRKDIR}; \
1170: ${LN} -sf ${WRKOBJDIR}/${PORTSUBDIR} ${WRKDIR}; \
1171: fi
1.14 niklas 1172: .else
1.1 niklas 1173: @${RM} -rf ${WRKDIR}
1.9 imp 1174: @${MKDIR} ${WRKDIR}
1.6 niklas 1175: .endif
1.14 niklas 1176: .endif
1.1 niklas 1177: @for file in ${EXTRACT_ONLY}; do \
1.10 niklas 1178: if ! (cd ${WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
1.1 niklas 1179: then \
1180: exit 1; \
1181: fi \
1182: done
1183: .endif
1184:
1185: # Patch
1186:
1187: .if !target(do-patch)
1188: do-patch:
1189: .if defined(PATCHFILES)
1190: @${ECHO_MSG} "===> Applying distribution patches for ${PKGNAME}"
1.9 imp 1191: @(cd ${_DISTDIR}; \
1.1 niklas 1192: for i in ${PATCHFILES}; do \
1.6 niklas 1193: if [ ${PATCH_DEBUG_TMP} = yes ]; then \
1194: ${ECHO_MSG} "===> Applying distribution patch $$i" ; \
1195: fi; \
1.1 niklas 1196: case $$i in \
1197: *.Z|*.gz) \
1198: ${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
1199: ;; \
1200: *) \
1201: ${PATCH} ${PATCH_DIST_ARGS} < $$i; \
1202: ;; \
1203: esac; \
1204: done)
1205: .endif
1206: @if [ -d ${PATCHDIR} ]; then \
1.6 niklas 1207: if [ "`echo ${PATCHDIR}/patch-*`" = "${PATCHDIR}/patch-*" ]; then \
1208: ${ECHO_MSG} "===> Ignoring empty patch directory"; \
1209: if [ -d ${PATCHDIR}/CVS ]; then \
1210: ${ECHO_MSG} "===> Perhaps you forgot the -P flag to cvs co or update?"; \
1211: fi; \
1212: else \
1.9 imp 1213: ${ECHO_MSG} "===> Applying ${OPSYS} patches for ${PKGNAME}" ; \
1.6 niklas 1214: for i in ${PATCHDIR}/patch-*; do \
1215: case $$i in \
1.13 imp 1216: *.orig|*.rej|*~) \
1.6 niklas 1217: ${ECHO_MSG} "===> Ignoring patchfile $$i" ; \
1218: ;; \
1219: *) \
1220: if [ ${PATCH_DEBUG_TMP} = yes ]; then \
1.9 imp 1221: ${ECHO_MSG} "===> Applying ${OPSYS} patch $$i" ; \
1.6 niklas 1222: fi; \
1223: ${PATCH} ${PATCH_ARGS} < $$i; \
1224: ;; \
1225: esac; \
1226: done; \
1227: fi; \
1.1 niklas 1228: fi
1229: .endif
1230:
1231: # Configure
1232:
1233: .if !target(do-configure)
1234: do-configure:
1.7 niklas 1235: @if [ -f ${SCRIPTDIR}/configure ]; then \
1.13 imp 1236: cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
1237: ${SCRIPTDIR}/configure; \
1.1 niklas 1238: fi
1239: .if defined(HAS_CONFIGURE)
1.6 niklas 1240: @(cd ${WRKSRC} && CC="${CC}" ac_cv_path_CC="${CC}" CFLAGS="${CFLAGS}" \
1.1 niklas 1241: INSTALL="/usr/bin/install -c -o ${BINOWN} -g ${BINGRP}" \
1.6 niklas 1242: INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
1.1 niklas 1243: ${CONFIGURE_ENV} ./${CONFIGURE_SCRIPT} ${CONFIGURE_ARGS})
1244: .endif
1245: .if defined(USE_IMAKE)
1.44 ! marc 1246: @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${XMKMF})
1.1 niklas 1247: .endif
1248: .endif
1249:
1250: # Build
1251:
1252: .if !target(do-build)
1253: do-build:
1.44 ! marc 1254: @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} ${MAKEFILE} ${ALL_TARGET})
1.1 niklas 1255: .endif
1256:
1257: # Install
1258:
1259: .if !target(do-install)
1260: do-install:
1.44 ! marc 1261: @(cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} ${MAKEFILE} ${INSTALL_TARGET})
1.1 niklas 1262: .endif
1263:
1264: # Package
1265:
1266: .if !target(do-package)
1267: do-package:
1.13 imp 1268: @if [ -e ${PLIST} ]; then \
1.1 niklas 1269: ${ECHO_MSG} "===> Building package for ${PKGNAME}"; \
1270: if [ -d ${PACKAGES} ]; then \
1271: if [ ! -d ${PKGREPOSITORY} ]; then \
1.9 imp 1272: if ! ${MKDIR} ${PKGREPOSITORY}; then \
1.1 niklas 1273: ${ECHO_MSG} ">> Can't create directory ${PKGREPOSITORY}."; \
1274: exit 1; \
1275: fi; \
1276: fi; \
1277: fi; \
1278: if ${PKG_CMD} ${PKG_ARGS} ${PKGFILE}; then \
1279: if [ -d ${PACKAGES} ]; then \
1280: ${MAKE} ${.MAKEFLAGS} package-links; \
1281: fi; \
1282: else \
1283: ${MAKE} ${.MAKEFLAGS} delete-package; \
1284: exit 1; \
1285: fi; \
1286: fi
1287: .endif
1288:
1289: # Some support rules for do-package
1290:
1291: .if !target(package-links)
1292: package-links:
1293: @${MAKE} ${.MAKEFLAGS} delete-package-links
1294: @for cat in ${CATEGORIES}; do \
1295: if [ ! -d ${PACKAGES}/$$cat ]; then \
1.9 imp 1296: if ! ${MKDIR} ${PACKAGES}/$$cat; then \
1.1 niklas 1297: ${ECHO_MSG} ">> Can't create directory ${PACKAGES}/$$cat."; \
1298: exit 1; \
1299: fi; \
1300: fi; \
1301: ln -s ../${PKGREPOSITORYSUBDIR}/${PKGNAME}${PKG_SUFX} ${PACKAGES}/$$cat; \
1302: done;
1303: .endif
1304:
1305: .if !target(delete-package-links)
1306: delete-package-links:
1307: @${RM} -f ${PACKAGES}/[a-z]*/${PKGNAME}${PKG_SUFX};
1308: .endif
1309:
1310: .if !target(delete-package)
1311: delete-package:
1312: @${MAKE} ${.MAKEFLAGS} delete-package-links
1313: @${RM} -f ${PKGFILE}
1314: .endif
1315:
1316: ################################################################
1317: # This is the "generic" port target, actually a macro used from the
1318: # six main targets. See below for more.
1319: ################################################################
1320:
1321: _PORT_USE: .USE
1322: .if make(real-fetch)
1.6 niklas 1323: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1.1 niklas 1324: .endif
1325: .if make(real-extract)
1.6 niklas 1326: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends lib-depends misc-depends
1.1 niklas 1327: .endif
1328: .if make(real-install)
1.13 imp 1329: .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
1.40 espie 1330: @if [ -d ${PKG_DBDIR}/${PKGNAME} -o "X$$(ls -d ${PKG_DBDIR}/${PKGNAME:C/-[0-9].*//g}-* 2> /dev/null)" != "X" ]; then \
1.13 imp 1331: ${ECHO_MSG} "===> ${PKGNAME} is already installed - perhaps an older version?"; \
1.44 ! marc 1332: ${ECHO_MSG} " If so, you may wish to \`\`make deinstall'' and install"; \
1.13 imp 1333: ${ECHO_MSG} " this port again by \`\`make reinstall'' to upgrade it properly."; \
1334: ${ECHO_MSG} " If you really wish to overwrite the old port of ${PKGNAME}"; \
1335: ${ECHO_MSG} " without deleting it first, set the variable \"FORCE_PKG_REGISTER\""; \
1336: ${ECHO_MSG} " in your environment or the \"make install\" command line."; \
1337: exit 1; \
1338: fi
1339: .endif
1.14 niklas 1340: @if [ `${SH} -c umask` != ${DEF_UMASK} ]; then \
1.13 imp 1341: ${ECHO_MSG} "===> Warning: your umask is \"`${SH} -c umask`"\".; \
1342: ${ECHO_MSG} " If this is not desired, set it to an appropriate value"; \
1343: ${ECHO_MSG} " and install this port again by \`\`make reinstall''."; \
1344: fi
1.9 imp 1345: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends lib-depends
1.1 niklas 1346: .endif
1347: .if make(real-install)
1348: .if !defined(NO_MTREE)
1349: @if [ `id -u` = 0 ]; then \
1.13 imp 1350: if [ ! -f ${MTREE_FILE} ]; then \
1351: ${ECHO_MSG} "Error: mtree file \"${MTREE_FILE}\" is missing."; \
1352: ${ECHO_MSG} "Copy it from a suitable location (e.g., /usr/src/etc/mtree) and try again."; \
1353: exit 1; \
1354: else \
1.44 ! marc 1355: if [ ! -d ${PREFIX} ]; then \
! 1356: mkdir -p ${PREFIX}; \
! 1357: fi; \
1.13 imp 1358: ${MTREE_CMD} ${MTREE_ARGS} ${PREFIX}/; \
1359: fi; \
1.1 niklas 1360: else \
1361: ${ECHO_MSG} "Warning: not superuser, can't run mtree."; \
1362: ${ECHO_MSG} "Become root and try again to ensure correct permissions."; \
1363: fi
1364: .endif
1365: .endif
1.6 niklas 1366: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/pre-/}
1.1 niklas 1367: @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/} ]; then \
1.13 imp 1368: cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
1369: ${SCRIPTDIR}/${.TARGET:S/^real-/pre-/}; \
1.1 niklas 1370: fi
1.6 niklas 1371: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/do-/}
1372: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} ${.TARGET:S/^real-/post-/}
1.1 niklas 1373: @if [ -f ${SCRIPTDIR}/${.TARGET:S/^real-/post-/} ]; then \
1.13 imp 1374: cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
1375: ${SCRIPTDIR}/${.TARGET:S/^real-/post-/}; \
1.1 niklas 1376: fi
1.44 ! marc 1377: .if make(real-install) && (defined(_MANPAGES) || defined(_CATPAGES))
1.9 imp 1378: .if defined(MANCOMPRESSED) && defined(NOMANCOMPRESS)
1379: @${ECHO_MSG} "===> Uncompressing manual pages for ${PKGNAME}"
1.44 ! marc 1380: .for manpage in ${_MANPAGES} ${_CATPAGES}
! 1381: @${GUNZIP_CMD} ${manpage}.gz
1.9 imp 1382: .endfor
1383: .elif !defined(MANCOMPRESSED) && !defined(NOMANCOMPRESS)
1384: @${ECHO_MSG} "===> Compressing manual pages for ${PKGNAME}"
1.44 ! marc 1385: .for manpage in ${_MANPAGES} ${_CATPAGES}
! 1386: @if [ -L ${manpage} ]; then \
! 1387: set - `${FILE} ${manpage}`; \
! 1388: shift `expr $$# - 1`; \
! 1389: ${LN} -sf $${1}.gz ${manpage}.gz; \
! 1390: ${RM} ${manpage}; \
! 1391: else \
! 1392: ${GZIP_CMD} ${manpage}; \
! 1393: fi
1.9 imp 1394: .endfor
1395: .endif
1396: .endif
1397: .if make(real-install) && !defined(NO_PKG_REGISTER)
1.6 niklas 1398: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fake-pkg
1.1 niklas 1399: .endif
1400: .if !make(real-fetch) \
1401: && (!make(real-patch) || !defined(PATCH_CHECK_ONLY)) \
1402: && (!make(real-package) || !defined(PACKAGE_NOINSTALL))
1403: @${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.${.TARGET:S/^real-//}_done
1404: .endif
1405:
1406: ################################################################
1407: # Skeleton targets start here
1408: #
1409: # You shouldn't have to change these. Either add the pre-* or
1410: # post-* targets/scripts or redefine the do-* targets. These
1411: # targets don't do anything other than checking for cookies and
1412: # call the necessary targets/scripts.
1413: ################################################################
1414:
1415: .if !target(fetch)
1416: fetch:
1.6 niklas 1417: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-fetch
1.1 niklas 1418: .endif
1419:
1420: .if !target(extract)
1421: extract: checksum ${EXTRACT_COOKIE}
1422: .endif
1423:
1424: .if !target(patch)
1425: patch: extract ${PATCH_COOKIE}
1426: .endif
1427:
1428: .if !target(configure)
1429: configure: patch ${CONFIGURE_COOKIE}
1430: .endif
1431:
1432: .if !target(build)
1433: build: configure ${BUILD_COOKIE}
1434: .endif
1435:
1436: .if !target(install)
1437: install: build ${INSTALL_COOKIE}
1438: .endif
1439:
1440: .if !target(package)
1441: package: install ${PACKAGE_COOKIE}
1442: .endif
1443:
1444: ${EXTRACT_COOKIE}:
1.6 niklas 1445: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-extract
1.1 niklas 1446: ${PATCH_COOKIE}:
1.6 niklas 1447: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-patch
1.1 niklas 1448: ${CONFIGURE_COOKIE}:
1.6 niklas 1449: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-configure
1.1 niklas 1450: ${BUILD_COOKIE}:
1.6 niklas 1451: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-build
1.1 niklas 1452: ${INSTALL_COOKIE}:
1.32 marc 1453: @touch ${INSTALL_PRE_COOKIE}
1.6 niklas 1454: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-install
1.1 niklas 1455: ${PACKAGE_COOKIE}:
1.6 niklas 1456: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-package
1.1 niklas 1457:
1458: # And call the macros
1459:
1460: real-fetch: _PORT_USE
1461: real-extract: _PORT_USE
1462: @${ECHO_MSG} "===> Extracting for ${PKGNAME}"
1463: real-patch: _PORT_USE
1464: @${ECHO_MSG} "===> Patching for ${PKGNAME}"
1465: real-configure: _PORT_USE
1466: @${ECHO_MSG} "===> Configuring for ${PKGNAME}"
1467: real-build: _PORT_USE
1468: @${ECHO_MSG} "===> Building for ${PKGNAME}"
1469: real-install: _PORT_USE
1470: @${ECHO_MSG} "===> Installing for ${PKGNAME}"
1471: real-package: _PORT_USE
1472:
1473: # Empty pre-* and post-* targets, note we can't use .if !target()
1474: # in the _PORT_USE macro
1475:
1476: .for name in fetch extract patch configure build install package
1477:
1478: .if !target(pre-${name})
1479: pre-${name}:
1480: @${DO_NADA}
1481: .endif
1482:
1483: .if !target(post-${name})
1484: post-${name}:
1485: @${DO_NADA}
1486: .endif
1487:
1488: .endfor
1489:
1490: # Checkpatch
1491: #
1492: # Special target to verify patches
1493:
1494: .if !target(checkpatch)
1495: checkpatch:
1.6 niklas 1496: @cd ${.CURDIR} && ${MAKE} PATCH_CHECK_ONLY=yes ${.MAKEFLAGS} patch
1.1 niklas 1497: .endif
1498:
1499: # Reinstall
1500: #
1501: # Special target to re-run install
1502:
1503: .if !target(reinstall)
1.13 imp 1504: reinstall:
1.32 marc 1505: @${RM} -f ${INSTALL_PRE_COOKIE} ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
1.13 imp 1506: @DEPENDS_TARGET=${DEPENDS_TARGET} ${MAKE} install
1.1 niklas 1507: .endif
1508:
1.44 ! marc 1509: # Deinstall
! 1510: #
! 1511: # Special target to remove installation
! 1512:
! 1513: .if !target(deinstall)
! 1514: uninstall deinstall:
! 1515: @${ECHO_MSG} "===> Deinstalling for ${PKGNAME}"
! 1516: @pkg_delete -f ${PKGNAME}
! 1517: @${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
! 1518: .endif
! 1519:
! 1520:
1.1 niklas 1521: ################################################################
1522: # Some more targets supplied for users' convenience
1523: ################################################################
1524:
1525: # Cleaning up
1526:
1527: .if !target(pre-clean)
1528: pre-clean:
1529: @${DO_NADA}
1530: .endif
1531:
1532: .if !target(clean)
1533: clean: pre-clean
1.9 imp 1534: .if !defined(NOCLEANDEPENDS)
1535: @${MAKE} clean-depends
1536: .endif
1.1 niklas 1537: @${ECHO_MSG} "===> Cleaning for ${PKGNAME}"
1.6 niklas 1538: .if !defined(NO_WRKDIR)
1.44 ! marc 1539: .if defined(WRKOBJDIR)
! 1540: @${RM} -rf ${WRKOBJDIR}/${PORTSUBDIR}
! 1541: @${RM} -f ${WRKDIR}
! 1542: .else
1.9 imp 1543: @if [ -d ${WRKDIR} ]; then \
1544: if [ -w ${WRKDIR} ]; then \
1545: ${RM} -rf ${WRKDIR}; \
1546: else \
1547: ${ECHO_MSG} "===> ${WRKDIR} not writable, skipping"; \
1548: fi; \
1549: fi
1.44 ! marc 1550: .endif
1.6 niklas 1551: .else
1.1 niklas 1552: @${RM} -f ${WRKDIR}/.*_done
1553: .endif
1554: .endif
1555:
1.9 imp 1556: .if !target(pre-distclean)
1557: pre-distclean:
1558: @${DO_NADA}
1559: .endif
1560:
1561: .if !target(distclean)
1562: distclean: pre-distclean clean
1563: @${ECHO_MSG} "===> Dist cleaning for ${PKGNAME}"
1.13 imp 1564: @(if [ -d ${_DISTDIR} ]; then \
1565: cd ${_DISTDIR}; \
1566: ${RM} -f ${DISTFILES} ${PATCHFILES}; \
1567: fi)
1.9 imp 1568: .if defined(DIST_SUBDIR)
1.13 imp 1569: -@${RMDIR} ${_DISTDIR}
1.9 imp 1570: .endif
1571: .endif
1572:
1.1 niklas 1573: # Prints out a list of files to fetch (useful to do a batch fetch)
1574:
1.44 ! marc 1575: # are we called from bsd.port.subdir.mk (i.e. do we scan all dirs anyways)? XXX
! 1576: .ifdef(DIRPRFX)
! 1577: RECURSIVE_FETCH_LIST?= NO
! 1578: .else
! 1579: RECURSIVE_FETCH_LIST?= YES
! 1580: .endif
! 1581:
1.1 niklas 1582: .if !target(fetch-list)
1583: fetch-list:
1.44 ! marc 1584: @${MAKE} fetch-list-recursive RECURSIVE_FETCH_LIST=${RECURSIVE_FETCH_LIST} | sort -u
! 1585: .endif # !target(fetch-list)
! 1586:
! 1587: .if !target(fetch-list-recursive)
! 1588: fetch-list-recursive:
! 1589: @${MAKE} fetch-list-one-pkg
! 1590: .if ${RECURSIVE_FETCH_LIST} != "NO"
! 1591: @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 \
! 1592: (cd $$dir; ${MAKE} fetch-list-recursive; ); \
! 1593: done
! 1594: .endif # ${RECURSIVE_FETCH_LIST} != "NO"
! 1595: .endif # !target(fetch-list-recursive)
! 1596:
! 1597: .if !target(fetch-list-one-pkg)
! 1598: fetch-list-one-pkg:
1.9 imp 1599: @${MKDIR} ${_DISTDIR}
1.44 ! marc 1600: @[ -z "${_DISTDIR}" ] || ${ECHO} "${MKDIR} ${_DISTDIR}"
1.9 imp 1601: @(cd ${_DISTDIR}; \
1.1 niklas 1602: for file in ${DISTFILES}; do \
1603: if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1.44 ! marc 1604: ${ECHO} -n "cd ${_DISTDIR} && [ -f $$file -o -f `${BASENAME} $$file` ] || " ; \
! 1605: for site in ${MASTER_SITES} ; do \
! 1606: ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '|| ' ; \
1.1 niklas 1607: done; \
1608: ${ECHO} "echo $${file} not fetched" ; \
1609: fi \
1610: done)
1611: .if defined(PATCHFILES)
1.9 imp 1612: @(cd ${_DISTDIR}; \
1.1 niklas 1613: for file in ${PATCHFILES}; do \
1614: if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
1.44 ! marc 1615: ${ECHO} -n "cd ${_DISTDIR} && [ -f $$file -o -f `${BASENAME} $$file` ] || " ; \
1.1 niklas 1616: for site in ${PATCH_SITES}; do \
1.44 ! marc 1617: ${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '|| ' ; \
1.1 niklas 1618: done; \
1619: ${ECHO} "echo $${file} not fetched" ; \
1620: fi \
1.44 ! marc 1621: done)
! 1622: .endif # defined(PATCHFILES)
! 1623: .endif # !target(fetch-list-one-pkg)
1.1 niklas 1624:
1625: # Checksumming utilities
1626:
1627: .if !target(makesum)
1628: makesum: fetch
1.9 imp 1629: @${MKDIR} ${FILESDIR}
1.1 niklas 1630: @if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi
1631: @(cd ${DISTDIR}; \
1.9 imp 1632: for file in ${_CKSUMFILES}; do \
1.1 niklas 1633: ${MD5} $$file >> ${MD5_FILE}; \
1634: done)
1.9 imp 1635: @for file in ${_IGNOREFILES}; do \
1636: ${ECHO} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \
1637: done
1.1 niklas 1638: .endif
1639:
1640: .if !target(checksum)
1641: checksum: fetch
1642: @if [ ! -f ${MD5_FILE} ]; then \
1643: ${ECHO_MSG} ">> No MD5 checksum file."; \
1644: else \
1.9 imp 1645: (cd ${DISTDIR}; OK="true"; \
1646: for file in ${_CKSUMFILES}; do \
1.6 niklas 1647: CKSUM=`${MD5} < $$file`; \
1.13 imp 1648: CKSUM2=`${GREP} "^MD5 ($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1.1 niklas 1649: if [ "$$CKSUM2" = "" ]; then \
1.9 imp 1650: ${ECHO_MSG} ">> No checksum recorded for $$file."; \
1651: OK="false"; \
1652: elif [ "$$CKSUM2" = "IGNORE" ]; then \
1653: ${ECHO_MSG} ">> Checksum for $$file is set to IGNORE in md5 file even though"; \
1654: ${ECHO_MSG} " the file is not in the "'$$'"{IGNOREFILES} list."; \
1.1 niklas 1655: OK="false"; \
1.13 imp 1656: elif [ "$$CKSUM" = "$$CKSUM2" ]; then \
1657: ${ECHO_MSG} ">> Checksum OK for $$file."; \
1658: else \
1.9 imp 1659: ${ECHO_MSG} ">> Checksum mismatch for $$file."; \
1.13 imp 1660: OK="false"; \
1.1 niklas 1661: fi; \
1662: done; \
1.9 imp 1663: for file in ${_IGNOREFILES}; do \
1664: CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
1665: if [ "$$CKSUM2" = "" ]; then \
1666: ${ECHO_MSG} ">> No checksum recorded for $$file, file is in "'$$'"{IGNOREFILES} list."; \
1667: OK="false"; \
1668: elif [ "$$CKSUM2" != "IGNORE" ]; then \
1669: ${ECHO_MSG} ">> Checksum for $$file is not set to IGNORE in md5 file even though"; \
1670: ${ECHO_MSG} " the file is in the "'$$'"{IGNOREFILES} list."; \
1671: OK="false"; \
1672: fi; \
1673: done; \
1.13 imp 1674: if [ "$$OK" != "true" ]; then \
1675: ${ECHO_MSG} "Make sure the Makefile and md5 file (${MD5_FILE})"; \
1676: ${ECHO_MSG} "are up to date. If you want to override this check, type"; \
1677: ${ECHO_MSG} "\"make NO_CHECKSUM=yes [other args]\"."; \
1678: exit 1; \
1.1 niklas 1679: fi) ; \
1680: fi
1.32 marc 1681: .endif
1682:
1683: # packing list utilities. This generates a packing list from a recently
1684: # installed port. Not perfect, but pretty close. The generated file
1685: # will have to have some tweaks done by hand.
1.35 marc 1686: # Note: add @comment PACKAGE(arch=${ARCH}, opsys=${OPSYS}, vers=${OPSYS_VER})
1687: # when port is installed or package created.
1.32 marc 1688: #
1689: .if !target(plist)
1690: plist: install
1691: @${MKDIR} ${PKGDIR}
1692: @(dirs=""; \
1693: ld=""; \
1.33 marc 1694: ${ECHO} "@cwd ${PREFIX}"; \
1695: ${ECHO} "@name ${PKGNAME}"; \
1.32 marc 1696: for f in `${MAKE} package-depends|sort -u`; do ${ECHO} "@pkgdep $$f"; done; \
1697: for f in `find ${PREFIX} -newer ${INSTALL_PRE_COOKIE} -print 2> /dev/null`; do \
1698: ff=`${ECHO} $$f | ${SED} -e 's|^${PREFIX}/||'`; \
1699: if [ -d $$f ]; then dirs="$$ff $$dirs"; \
1700: else \
1701: ${ECHO} $$ff; \
1.33 marc 1702: if ${ECHO} $$f | ${GREP} -E -q -e '[^/]+\.a$$'; then \
1703: ${ECHO} '@exec ranlib %D/%F'; \
1704: elif ${ECHO} $$f | ${GREP} -E -q -e '[^/]+\.so\.[0-9]+\.[0-9]+$$'; then \
1.32 marc 1705: ld="$$LDCONFIG `${DIRNAME} $$f`"; \
1706: fi; \
1707: fi; \
1708: done; \
1709: for f in $$dirs; do \
1710: if ${GREP} -q -e `${BASENAME} $$f` ${MTREE_FILE}; then \
1711: :; \
1712: else \
1713: ${ECHO} "@dirrm $$f"; \
1714: fi; \
1715: done; \
1716: for f in $$ld; do ${ECHO} "@exec ${LDCONFIG} -m $$f"; done; \
1717: ) > ${PLIST}-auto
1.1 niklas 1718: .endif
1719:
1720: ################################################################
1721: # The special package-building targets
1722: # You probably won't need to touch these
1723: ################################################################
1724:
1.44 ! marc 1725: HTMLIFY= ${SED} -e 's/&/\&/g' -e 's/>/\>/g' -e 's/</\</g'
! 1726:
! 1727: # Set to YES by the README.html target (and passed via depends-list
! 1728: # and package-depends)
! 1729: .ifndef PACKAGE_NAME_AS_LINK
! 1730: PACKAGE_NAME_AS_LINK=NO
! 1731: .endif # PACKAGE_NAME_AS_LINK
! 1732:
! 1733:
1.1 niklas 1734: # Nobody should want to override this unless PKGNAME is simply bogus.
1735:
1736: .if !target(package-name)
1737: package-name:
1.44 ! marc 1738: .if (${PACKAGE_NAME_AS_LINK} == "YES")
! 1739: @${ECHO} '<A HREF="../../'`${MAKE} package-path | ${HTMLIFY}`'/README.html">'`echo ${PKGNAME} | ${HTMLIFY}`'</A>'
! 1740: .else
! 1741: @${ECHO} '${PKGNAME}'
! 1742: .endif # PACKAGE_NAME_AS_LINK != ""
! 1743: .endif # !target(package-name)
! 1744:
! 1745: .if !target(package-path)
! 1746: package-path:
! 1747: @pwd | sed s@`cd ${PORTSDIR} ; pwd`/@@g
1.1 niklas 1748: .endif
1749:
1750: # Show (recursively) all the packages this package depends on.
1751:
1752: .if !target(package-depends)
1753: package-depends:
1.13 imp 1754: @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 \
1755: if [ -d $$dir ]; then \
1.44 ! marc 1756: (cd $$dir ; ${MAKE} package-name package-depends PACKAGE_NAME_AS_LINK=${PACKAGE_NAME_AS_LINK}); \
1.13 imp 1757: else \
1758: ${ECHO_MSG} "Warning: \"$$dir\" non-existent -- @pkgdep registration incomplete" >&2; \
1759: fi; \
1.1 niklas 1760: done
1761: .endif
1762:
1763: # Build a package but don't check the package cookie
1764:
1765: .if !target(repackage)
1766: repackage: pre-repackage package
1767:
1768: pre-repackage:
1769: @${RM} -f ${PACKAGE_COOKIE}
1770: .endif
1771:
1772: # Build a package but don't check the cookie for installation, also don't
1773: # install package cookie
1774:
1775: .if !target(package-noinstall)
1776: package-noinstall:
1.6 niklas 1777: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package
1.1 niklas 1778: .endif
1779:
1780: ################################################################
1781: # Dependency checking
1782: ################################################################
1783:
1784: .if !target(depends)
1785: depends: lib-depends misc-depends
1.6 niklas 1786: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} fetch-depends
1787: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} build-depends
1788: @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} run-depends
1.1 niklas 1789:
1790: .if make(fetch-depends)
1791: DEPENDS_TMP+= ${FETCH_DEPENDS}
1792: .endif
1793:
1794: .if make(build-depends)
1795: DEPENDS_TMP+= ${BUILD_DEPENDS}
1796: .endif
1797:
1798: .if make(run-depends)
1799: DEPENDS_TMP+= ${RUN_DEPENDS}
1800: .endif
1801:
1802: _DEPENDS_USE: .USE
1803: .if defined(DEPENDS_TMP)
1.13 imp 1804: .if !defined(NO_DEPENDS)
1.44 ! marc 1805: @for i in ${DEPENDS_TMP}; do \
1.1 niklas 1806: prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
1.13 imp 1807: dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
1808: if expr "$$dir" : '.*:' > /dev/null; then \
1809: target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
1810: dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1.1 niklas 1811: else \
1.13 imp 1812: target=${DEPENDS_TARGET}; \
1.1 niklas 1813: fi; \
1.44 ! marc 1814: found=not; \
1.1 niklas 1815: if expr "$$prog" : \\/ >/dev/null; then \
1816: if [ -e "$$prog" ]; then \
1817: ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - found"; \
1.44 ! marc 1818: found=""; \
1.1 niklas 1819: else \
1820: ${ECHO_MSG} "===> ${PKGNAME} depends on file: $$prog - not found"; \
1821: fi; \
1822: else \
1.44 ! marc 1823: for d in `echo $$PATH | tr ':' ' '`; do \
! 1824: if [ -x $$d/$$prog ]; then \
! 1825: found="$$d/$$prog"; \
! 1826: break; \
! 1827: fi \
! 1828: done; \
! 1829: ${ECHO_MSG} "===> ${PKGNAME} depends on executable: $$prog - $$found found"; \
1.1 niklas 1830: fi; \
1.44 ! marc 1831: if [ X"$$found" = Xnot ]; then \
1.13 imp 1832: ${ECHO_MSG} "===> Verifying $$target for $$prog in $$dir"; \
1.1 niklas 1833: if [ ! -d "$$dir" ]; then \
1834: ${ECHO_MSG} ">> No directory for $$prog. Skipping.."; \
1835: else \
1.13 imp 1836: (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1 niklas 1837: ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \
1838: fi; \
1839: fi; \
1840: done
1841: .endif
1842: .else
1843: @${DO_NADA}
1844: .endif
1845:
1846: fetch-depends: _DEPENDS_USE
1847: build-depends: _DEPENDS_USE
1848: run-depends: _DEPENDS_USE
1849:
1850: lib-depends:
1851: .if defined(LIB_DEPENDS)
1.13 imp 1852: .if !defined(NO_DEPENDS)
1.16 niklas 1853: .if (${MACHINE_ARCH} == "alpha")
1854: @for i in ${LIB_DEPENDS}; do \
1.44 ! marc 1855: lib=`${ECHO} $$i | ${SED} -e 's/:.*//' -e 's|\([^\\]\)\.|\1\\\\.|g'`; \
1.16 niklas 1856: dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
1857: if expr "$$dir" : '.*:' > /dev/null; then \
1858: target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
1859: dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1860: else \
1861: target=${DEPENDS_TARGET}; \
1862: fi; \
1.17 niklas 1863: tmp=`mktemp /tmp/bpmXXXXXXXXXX`; \
1.42 marc 1864: if ${LD} -r -o $$tmp -L${LOCALBASE}/lib -L${X11BASE}/lib -l$$lib; then \
1.16 niklas 1865: ${ECHO_MSG} "===> ${PKGNAME} depends on library: $$lib - found"; \
1866: else \
1867: ${ECHO_MSG} "===> ${PKGNAME} depends on library: $$lib - not found"; \
1868: ${ECHO_MSG} "===> Verifying $$target for $$lib in $$dir"; \
1869: if [ ! -d "$$dir" ]; then \
1870: ${ECHO_MSG} ">> No directory for $$lib. Skipping.."; \
1871: else \
1872: (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1873: ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \
1874: fi; \
1875: fi; \
1.17 niklas 1876: ${RM} -f $$tmp; \
1.16 niklas 1877: done
1878: .else
1.1 niklas 1879: @for i in ${LIB_DEPENDS}; do \
1.44 ! marc 1880: lib=`${ECHO} $$i | ${SED} -e 's/:.*//' -e 's|\([^\\]\)\.|\1\\\\.|g'`; \
1.13 imp 1881: dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
1882: if expr "$$dir" : '.*:' > /dev/null; then \
1883: target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
1884: dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1885: else \
1886: target=${DEPENDS_TARGET}; \
1887: fi; \
1.44 ! marc 1888: libname=`${ECHO} $$lib | ${SED} -e 's|\\\\||g'`; \
! 1889: reallib=`${LDCONFIG} -r | ${GREP} -e "-l$$lib" | awk '{ print $$3 }'`; \
! 1890: if [ "X$$reallib" = X"" ]; then \
! 1891: ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$libname - not found"; \
! 1892: ${ECHO_MSG} "===> Verifying $$target for $$libname in $$dir"; \
1.1 niklas 1893: if [ ! -d "$$dir" ]; then \
1.44 ! marc 1894: ${ECHO_MSG} ">> No directory for $$libname. Skipping.."; \
1.1 niklas 1895: else \
1.13 imp 1896: (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1 niklas 1897: ${ECHO_MSG} "===> Returning to build of ${PKGNAME}"; \
1898: fi; \
1.44 ! marc 1899: else \
! 1900: ${ECHO_MSG} "===> ${PKGNAME} depends on shared library: $$libname - $$reallib found"; \
1.1 niklas 1901: fi; \
1902: done
1.16 niklas 1903: .endif
1.1 niklas 1904: .endif
1905: .else
1906: @${DO_NADA}
1907: .endif
1908:
1909: misc-depends:
1910: .if defined(DEPENDS)
1911: .if !defined(NO_DEPENDS)
1.13 imp 1912: @for dir in ${DEPENDS}; do \
1913: if expr "$$dir" : '.*:' > /dev/null; then \
1914: target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
1915: dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
1916: else \
1917: target=${DEPENDS_TARGET}; \
1918: fi; \
1919: ${ECHO_MSG} "===> ${PKGNAME} depends on: $$dir"; \
1920: ${ECHO_MSG} "===> Verifying $$target for $$dir"; \
1921: if [ ! -d $$dir ]; then \
1922: ${ECHO_MSG} ">> No directory for $$dir. Skipping.."; \
1.1 niklas 1923: else \
1.13 imp 1924: (cd $$dir; ${MAKE} ${.MAKEFLAGS} $$target) ; \
1.1 niklas 1925: fi \
1926: done
1927: @${ECHO_MSG} "===> Returning to build of ${PKGNAME}"
1928: .endif
1929: .else
1930: @${DO_NADA}
1931: .endif
1932:
1933: .endif
1934:
1.9 imp 1935: .if !target(clean-depends)
1936: clean-depends:
1937: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || defined(LIB_DEPENDS) \
1938: || defined(RUN_DEPENDS)
1.13 imp 1939: @for dir in `${ECHO} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/^[^:]*://' -e 's/:.*//' | sort -u`; do \
1940: if [ -d $$dir ] ; then \
1941: (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
1942: fi \
1.9 imp 1943: done
1944: .endif
1945: .if defined(DEPENDS)
1.13 imp 1946: @for dir in `${ECHO} ${DEPENDS} | ${TR} '\040' '\012' | ${SED} -e 's/:.*//' | sort -u`; do \
1947: if [ -d $$dir ] ; then \
1948: (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean clean-depends); \
1949: fi \
1.9 imp 1950: done
1951: .endif
1952: .endif
1953:
1.1 niklas 1954: .if !target(depends-list)
1955: depends-list:
1.13 imp 1956: @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 1957: (cd $$dir; ${MAKE} package-name depends-list PACKAGE_NAME_AS_LINK=${PACKAGE_NAME_AS_LINK}; ); \
1.1 niklas 1958: done
1959: .endif
1960:
1961: ################################################################
1962: # Everything after here are internal targets and really
1963: # shouldn't be touched by anybody but the release engineers.
1964: ################################################################
1965:
1966: # This target generates an index entry suitable for aggregation into
1967: # a large index. Format is:
1968: #
1969: # distribution-name|port-path|installation-prefix|comment| \
1.44 ! marc 1970: # description-file|maintainer|categories|build deps|run deps|for arch
1.1 niklas 1971: #
1972: .if !target(describe)
1973: describe:
1.13 imp 1974: @${ECHO} -n "${PKGNAME}|${.CURDIR}|"; \
1975: ${ECHO} -n "${PREFIX}|"; \
1976: if [ -f ${COMMENT} ]; then \
1977: ${ECHO} -n "`${CAT} ${COMMENT}`"; \
1.1 niklas 1978: else \
1979: ${ECHO} -n "** No Description"; \
1.13 imp 1980: fi; \
1981: if [ -f ${DESCR} ]; then \
1982: ${ECHO} -n "|${DESCR}"; \
1.1 niklas 1983: else \
1984: ${ECHO} -n "|/dev/null"; \
1.13 imp 1985: fi; \
1986: ${ECHO} -n "|${MAINTAINER}|${CATEGORIES}|"; \
1987: case "A${FETCH_DEPENDS}B${BUILD_DEPENDS}C${LIB_DEPENDS}D${DEPENDS}E" in \
1988: ABCDE) ;; \
1989: *) cd ${.CURDIR} && ${ECHO} -n `make depends-list|sort -u`;; \
1990: esac; \
1991: ${ECHO} -n "|"; \
1992: case "A${RUN_DEPENDS}B${LIB_DEPENDS}C${DEPENDS}D" in \
1993: ABCD) ;; \
1994: *) cd ${.CURDIR} && ${ECHO} -n `make package-depends|sort -u`;; \
1995: esac; \
1.44 ! marc 1996: ${ECHO} -n "|"; \
! 1997: if [ "${ONLY_FOR_ARCHS}" = "" ]; then \
! 1998: ${ECHO} -n "any"; \
! 1999: else \
! 2000: ${ECHO} -n "${ONLY_FOR_ARCHS}"; \
! 2001: fi; \
1.13 imp 2002: ${ECHO} ""
1.1 niklas 2003: .endif
2004:
2005: .if !target(readmes)
2006: readmes: readme
2007: .endif
2008:
2009: .if !target(readme)
2010: readme:
2011: @rm -f README.html
1.6 niklas 2012: @cd ${.CURDIR} && make README.html
1.1 niklas 2013: .endif
2014:
1.44 ! marc 2015: .if (${OPSYS} == "NetBSD")
! 2016: README_NAME= ${TEMPLATES}/README.pkg
! 2017: .else
! 2018: README_NAME= ${TEMPLATES}/README.port
! 2019: .endif
! 2020:
1.1 niklas 2021: README.html:
2022: @${ECHO_MSG} "===> Creating README.html for ${PKGNAME}"
1.44 ! marc 2023: @${MAKE} depends-list PACKAGE_NAME_AS_LINK=YES >> $@.tmp1
! 2024: @[ -s $@.tmp1 ] || echo "(none)" >> $@.tmp1
! 2025: @${MAKE} package-depends PACKAGE_NAME_AS_LINK=YES >> $@.tmp2
! 2026: @[ -s $@.tmp2 ] || echo "(none)" >> $@.tmp2
! 2027: @${ECHO} ${PKGNAME} | ${HTMLIFY} >> $@.tmp3
! 2028: @${CAT} ${README_NAME} | \
! 2029: ${SED} -e 's|%%PORT%%|'"`${MAKE} package-path | ${HTMLIFY}`"'|g' \
! 2030: -e '/%%PKG%%/r$@.tmp3' \
! 2031: -e '/%%PKG%%/d' \
1.1 niklas 2032: -e '/%%COMMENT%%/r${PKGDIR}/COMMENT' \
2033: -e '/%%COMMENT%%/d' \
1.44 ! marc 2034: -e '/%%BUILD_DEPENDS%%/r$@.tmp1' \
! 2035: -e '/%%BUILD_DEPENDS%%/d' \
! 2036: -e '/%%RUN_DEPENDS%%/r$@.tmp2' \
! 2037: -e '/%%RUN_DEPENDS%%/d' \
1.1 niklas 2038: >> $@
1.44 ! marc 2039: @rm -f $@.tmp1 $@.tmp2 $@.tmp3
1.1 niklas 2040:
2041: .if !target(print-depends-list)
2042: print-depends-list:
2043: .if defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || \
2044: defined(LIB_DEPENDS) || defined(DEPENDS)
2045: @${ECHO} -n 'This port requires package(s) "'
1.9 imp 2046: @${ECHO} -n `make depends-list | sort -u`
1.1 niklas 2047: @${ECHO} '" to build.'
2048: .endif
2049: .endif
2050:
2051: .if !target(print-package-depends)
2052: print-package-depends:
2053: .if defined(RUN_DEPENDS) || defined(LIB_DEPENDS) || defined(DEPENDS)
2054: @${ECHO} -n 'This port requires package(s) "'
1.9 imp 2055: @${ECHO} -n `make package-depends | sort -u`
1.1 niklas 2056: @${ECHO} '" to run.'
2057: .endif
2058: .endif
2059:
2060: # Fake installation of package so that user can pkg_delete it later.
2061: # Also, make sure that an installed port is recognized correctly in
2062: # accordance to the @pkgdep directive in the packing lists
2063:
2064: .if !target(fake-pkg)
2065: fake-pkg:
1.13 imp 2066: @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 2067: @if [ ! -d ${PKG_DBDIR} ]; then ${RM} -f ${PKG_DBDIR}; ${MKDIR} ${PKG_DBDIR}; fi
1.1 niklas 2068: .if defined(FORCE_PKG_REGISTER)
2069: @${RM} -rf ${PKG_DBDIR}/${PKGNAME}
2070: .endif
2071: @if [ ! -d ${PKG_DBDIR}/${PKGNAME} ]; then \
2072: ${ECHO_MSG} "===> Registering installation for ${PKGNAME}"; \
1.9 imp 2073: ${MKDIR} ${PKG_DBDIR}/${PKGNAME}; \
1.1 niklas 2074: ${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
1.13 imp 2075: ${CP} ${DESCR} ${PKG_DBDIR}/${PKGNAME}/+DESC; \
2076: ${CP} ${COMMENT} ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
1.1 niklas 2077: if [ -f ${PKGDIR}/INSTALL ]; then \
2078: ${CP} ${PKGDIR}/INSTALL ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \
2079: fi; \
2080: if [ -f ${PKGDIR}/DEINSTALL ]; then \
2081: ${CP} ${PKGDIR}/DEINSTALL ${PKG_DBDIR}/${PKGNAME}/+DEINSTALL; \
2082: fi; \
2083: if [ -f ${PKGDIR}/REQ ]; then \
2084: ${CP} ${PKGDIR}/REQ ${PKG_DBDIR}/${PKGNAME}/+REQ; \
2085: fi; \
1.44 ! marc 2086: if [ -f ${PKGDIR}/MESSAGE ]; then \
! 2087: ${CP} ${PKGDIR}/MESSAGE ${PKG_DBDIR}/${PKGNAME}/+DISPLAY; \
! 2088: fi; \
! 2089: for dep in `make package-depends ECHO_MSG=${TRUE} | sort -u`; do \
1.13 imp 2090: if [ -d ${PKG_DBDIR}/$$dep ]; then \
2091: if ! ${GREP} ^${PKGNAME}$$ ${PKG_DBDIR}/$$dep/+REQUIRED_BY \
2092: >/dev/null 2>&1; then \
2093: ${ECHO} ${PKGNAME} >> ${PKG_DBDIR}/$$dep/+REQUIRED_BY; \
2094: fi; \
2095: fi; \
2096: done; \
1.1 niklas 2097: fi
2098: .endif
2099:
2100: # Depend is generally meaningless for arbitrary ports, but if someone wants
2101: # one they can override this. This is just to catch people who've gotten into
2102: # the habit of typing `make depend all install' as a matter of course.
2103: #
2104: .if !target(depend)
2105: depend:
2106: .endif
2107:
2108: # Same goes for tags
2109: .if !target(tags)
2110: tags:
1.10 niklas 2111: .endif
2112: