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