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