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