/[ports]/head/Mk/bsd.port.mk
ViewVC logotype

Contents of /head/Mk/bsd.port.mk

Parent Directory Parent Directory | Revision Log Revision Log


Revision 468917 - (show annotations) (download)
Thu May 3 09:16:30 2018 UTC (6 years, 2 months ago) by mat
File MIME type: text/plain
File size: 182175 byte(s)
Add a warning about setting DISTNAME and USE_GITHUB=yes

Sponsored by:	Absolight

1 #-*- tab-width: 4; -*-
2 # ex:ts=4
3 #
4 # $FreeBSD$
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 # This is the master file for the most common elements to all port
13 # Makefile in the ports system. For a more general overview of its
14 # use and importance, see the Porter's Handbook.
15
16 # There are two different types of "maintainers" in the ports framework.
17 # The maintainer alias of the bsd.port.mk file is listed below in the
18 # FreeBSD_MAINTAINER entry. You should consult them if you have any
19 # questions/suggestions regarding this file.
20 #
21 # DO NOT COMMIT CHANGES TO THIS FILE BY YOURSELF, EVEN IF YOU DID NOT GET
22 # A RESPONSE FROM THE MAINTAINER(S) WITHIN A REASONABLE TIMEFRAME! ALL
23 # UNAUTHORISED CHANGES WILL BE UNCONDITIONALLY REVERTED!
24
25 FreeBSD_MAINTAINER= portmgr@FreeBSD.org
26
27 # For each port, the MAINTAINER variable is what you should consult for
28 # contact information on the person(s) to contact if you have questions/
29 # suggestions about that specific port. By default (if no MAINTAINER
30 # is listed), a port is maintained by the subscribers of the ports@FreeBSD.org
31 # mailing list, and any correspondence should be directed there.
32 #
33 # MAINTAINER - The e-mail address of the contact person for this port.
34 # Default: ports@FreeBSD.org
35 #
36 # These are meta-variables that are automatically set to the system
37 # you are running on. These are provided in case you need to take
38 # different actions for different values.
39 #
40 # ARCH - The architecture of the target machine, such as would be
41 # returned by "uname -p".
42 # OPSYS - Portability clause. This is the operating system the
43 # makefile is being used on. Automatically set to
44 # "FreeBSD," "NetBSD," or "OpenBSD" as appropriate.
45 # OSREL - The release version (numeric) of the operating system.
46 # OSVERSION - The value of __FreeBSD_version.
47 #
48 # This is the beginning of the list of all variables that need to be
49 # defined in a port, listed in order that they should be included
50 # to fit in with existing conventions. (Exception: MAINTAINER actually
51 # should appear after EXTRACT_ONLY and before MASTER_SITE_BACKUP).
52 #
53 # These variables are used to identify your port.
54 #
55 # PORTNAME - Name of software. Mandatory.
56 # PORTVERSION - Version of software. Mandatory when no DISTVERSION is given.
57 # PORTREVISION - Version of port. Optional. Commonly used to indicate
58 # that an update has happened that affects the port
59 # framework itself, but not the distributed software
60 # (e.g., local patches or Makefile changes).
61 # PORTEPOCH - Optional. In certain odd cases, the PORTREVISION logic
62 # can be fooled by ports that appear to go backwards
63 # numerically (e.g. if port-0.3 is newer than port-1998).
64 # In this case, incrementing PORTEPOCH forces the revision.
65 # Default: 0 (no effect).
66 # PKGNAME - Always defined as
67 # ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PORTVERSION}.
68 # Do not define this in your Makefile.
69 # PKGNAMEPREFIX - Prefix to specify that port is language-specific, etc.
70 # Optional.
71 # PKGNAMESUFFIX - Suffix to specify compilation options or a version
72 # designator (in case there are different versions of
73 # one port as is the case for Tcl).
74 # Optional.
75 # PKGVERSION - Always defined as ${PORTVERSION}.
76 # Do not define this in your Makefile.
77 # DISTVERSION - Vendor version of the distribution.
78 # Default: ${PORTVERSION}
79 # DISTNAME - Name of port or distribution used in generating
80 # WRKSRC and DISTFILES below.
81 # Default:
82 # ${PORTNAME}-${DISTVERSIONPREFIX}${DISTVERSION}${DISTVERSIONSUFFIX}
83 # CATEGORIES - A list of descriptive categories into which this port falls.
84 # Mandatory.
85 #
86 # These variable describe how to fetch files required for building the port.
87 #
88 # DISTFILES - Name(s) of archive file(s) containing distribution.
89 # Set this to an empty string if the port doesn't require it.
90 # Default: ${DISTNAME}${EXTRACT_SUFX}
91 # EXTRACT_SUFX - Suffix for archive names
92 # You never have to set both DISTFILES and EXTRACT_SUFX.
93 # Default: .tar.bz2 if USES=tar:bzip2 is set, .tar.xz if
94 # USES=tar:xz USE_XZ is set, .tar.gz otherwise).
95 # MASTER_SITES - Primary location(s) for distribution files if not found
96 # locally. See bsd.sites.mk for common choices for
97 # MASTER_SITES.
98 # MASTER_SITE_SUBDIR
99 # - Subdirectory of MASTER_SITES. Will sometimes need to be
100 # set to ${PORTNAME} for (e.g.) MASTER_SITE_SOURCEFORGE.
101 # Only guaranteed to work for choices of ${MASTER_SITES}
102 # defined in bsd.sites.mk.
103 # Default: not set.
104 # PATCHFILES - Name(s) of additional files that contain distribution
105 # patches. Make will look for them at PATCH_SITES (see below).
106 # They will automatically be uncompressed before patching if
107 # the names end with ".gz", ".bz2" or ".Z".
108 # For each file you can optionally specify a strip
109 # flag of patch(1) after a colon if it has a different
110 # base directory, e.g. "file1 file2:-p1 file3".
111 # You can also use a :group at the end for matching up to
112 # dist file groups. See Porters Handbook for more information.
113 # Syntax: PATCHFILES= patch[:-pX][:group]
114 # Default: not set.
115 # PATCH_SITES - Primary location(s) for distribution patch files
116 # if not found locally.
117 # DIST_SUBDIR - Suffix to ${DISTDIR}. If set, all ${DISTFILES} and
118 # ${PATCHFILES} will be put in this subdirectory of
119 # ${DISTDIR} (see below). Also they will be fetched in this
120 # subdirectory from FreeBSD mirror sites.
121 # ALLFILES - All of ${DISTFILES} and ${PATCHFILES}.
122 # NOFETCHFILES - If set, don't download these files from the ${MASTER_SITES}
123 # or ${MASTER_SITE_BACKUP} (but do from
124 # ${MASTER_SITE_OVERRIDE})
125 # EXTRACT_ONLY - If set, a subset of ${DISTFILES} you want to
126 # actually extract.
127 #
128 # (NOTE: by convention, the MAINTAINER entry (see above) should go here.)
129 #
130 # These variables are typically set in /etc/make.conf to indicate
131 # the user's preferred location to fetch files from. You should
132 # rarely need to set these.
133 #
134 # MASTER_SITE_BACKUP
135 # - Backup location(s) for distribution files and patch
136 # files if not found locally and ${MASTER_SITES}/${PATCH_SITES}.
137 # This should *not* be changed.
138 # Default:
139 # http://distcache.FreeBSD.org/ports-distfiles/${DIST_SUBDIR}/
140 # MASTER_SITE_OVERRIDE
141 # - If set, prepend the MASTER_SITES setting with this value.
142 # MASTER_SITE_FREEBSD
143 # - If set, prepend ${MASTER_SITE_BACKUP} in MASTER_SITES.
144 #
145 # Set these if your port should not be built under certain circumstances.
146 # These are string variables; you should set them to the reason why
147 # they are necessary.
148 #
149 # RESTRICTED - Prevent the distribution of distfiles and packages to
150 # the FTP sites or on CDROM (e.g. forbidden by license
151 # considerations).
152 # NO_CDROM - Packages and distfiles may not go on CDROM (e.g. must
153 # not be re-sold) but can go on FTP sites.
154 # NO_PACKAGE - Port should not be packaged for ftp sites or CDROMs,
155 # but distfiles can be put on ftp sites and CDROMs.
156 # FORBIDDEN - Package build should not be attempted because of
157 # security vulnerabilities.
158 # LEGAL_TEXT - Port has legal issues (e.g., special permission to distribute, lacks a license).
159 # LEGAL_PACKAGE - Port has no legal issues but defines NO_PACKAGE
160 # IGNORE - Package build should be skipped entirely (e.g.
161 # because of serious unfixable problems in the build,
162 # because it cannot be manually fetched, etc). Error
163 # logs will not appear on pointyhat, so this should be
164 # used sparingly.
165 # IGNORE_${ARCH} - Port should be ignored on ${ARCH}.
166 # IGNORE_${OPSYS} - Port should be ignored on ${OPSYS}.
167 # IGNORE_${OPSYS}_${OSREL:R} - Port should be ignored on a single
168 # release of ${OPSYS}, e.g IGNORE_FreeBSD_8
169 # would affect all point releases of FreeBSD 8.
170 # IGNORE_${OPSYS}_${OSREL:R}_${ARCH} - Port should be ignored on a
171 # single release of ${OPSYS} and specific architecture,
172 # e.g IGNORE_FreeBSD_8_i386 would affect all point
173 # releases of FreeBSD 8 in i386.
174 # BROKEN - Port is believed to be broken. Package builds can
175 # still be attempted using TRYBROKEN to test this
176 # assumption.
177 # BROKEN_${ARCH} - Port is believed to be broken on ${ARCH}. Package builds
178 # can still be attempted using TRYBROKEN to
179 # test this assumption.
180 # BROKEN_${OPSYS} - Port is believed to be broken on ${OPSYS}. Package builds
181 # can still be attempted using TRYBROKEN to
182 # test this assumption.
183 # BROKEN_${OPSYS}_${OSREL:R} - Port is believed to be broken on a single
184 # release of ${OPSYS}, e.g BROKEN_FreeBSD_8
185 # would affect all point releases of FreeBSD 8
186 # unless TRYBROKEN is also set.
187 # BROKEN_${OPSYS}_${OSREL:R}_${ARCH} - Port is believed to be broken on a
188 # single release of ${OPSYS} and specific architecture,
189 # e.g BROKEN_FreeBSD_8_i386 would affect all point
190 # releases of FreeBSD 8 in i386
191 # unless TRYBROKEN is also set.
192 # DEPRECATED - Port is deprecated to install. Advisory only.
193 # EXPIRATION_DATE
194 # - If DEPRECATED is set, determines a date when
195 # the port is planed to remove. The date format is
196 # ISO 8601 (YYYY-MM-DD).
197 #
198 # DISABLE_VULNERABILITIES
199 # - If set, do not check if the port is listed in the
200 # vulnerabilities database.
201 #
202 # In addition to RESTRICTED or NO_CDROM, if only a subset of distfiles
203 # or patchfiles have redistribution restrictions, set the following
204 # to the list of such files.
205 #
206 # RESTRICTED_FILES
207 # - List of files that cannot be redistributed.
208 # Default: "${DISTFILES} ${PATCHFILES}" if RESTRICTED
209 # or NO_CDROM is set, empty otherwise.
210 #
211 # These variables are booleans, so you don't need to set them to the reason.
212 #
213 # IS_INTERACTIVE
214 # - Set this if your port needs to interact with the user
215 # during any step in a package build. User can then decide
216 # to skip this port by setting ${BATCH}, or compiling only
217 # the interactive ports by setting ${INTERACTIVE}.
218 # Default: not set.
219 # USE_SUBMAKE - Set this if you want that each of the port's main 7 targets
220 # (extract, patch, configure, build, stage, install and
221 # package) to be executed in a separate make(1) process.
222 # Useful when one of the stages needs to influence make(1)
223 # variables of the later stages using ${WRKDIR}/Makefile.inc
224 # generated on the fly.
225 # Default: not set.
226 #
227 # NO_ARCH - Set this if port is architecture neutral.
228 #
229 # NO_ARCH_IGNORE - Set this to a list files to ignore when NO_ARCH is checked
230 # in stage-qa (i.e. architecture specific files that are
231 # 'bundled' with the port).
232 #
233 # Set these if your port only makes sense to certain architectures.
234 # They are lists containing names for them (e.g., "amd64 i386").
235 # (Defaults: not set.)
236 #
237 # ONLY_FOR_ARCHS
238 # - Only build ports if ${ARCH} matches one of these.
239 # NOT_FOR_ARCHS - Only build ports if ${ARCH} doesn't match one of these.
240 # ONLY_FOR_ARCHS_REASON
241 # ONLY_FOR_ARCHS_REASON_${ARCH}
242 # - Reason why it's only for ${ONLY_FOR_ARCHS}s
243 # NOT_FOR_ARCHS_REASON
244 # NOT_FOR_ARCHS_REASON_${ARCH}
245 # - Reason why it's not for ${NOT_FOR_ARCHS}s
246 # IA32_BINARY_PORT
247 # - Set this instead of ONLY_FOR_ARCHS if the given port
248 # fetches and installs compiled i386 binaries.
249 #
250 # Dependency checking. Use these if your port requires another port
251 # not in the list below. (Default: empty.)
252 #
253 # EXTRACT_DEPENDS
254 # - A list of "path:dir[:target]" tuples of other ports this
255 # package depends on in the "extract" stage. "path" is
256 # the name of a file if it starts with a slash (/), an
257 # executable otherwise. make will test for the existence
258 # (if it is a full pathname) or search for it in your
259 # $PATH (if it is an executable) and go into "dir" to do
260 # a "make all install" if it's not found. If the third
261 # field ("target") exists, it will be used instead of
262 # ${DEPENDS_TARGET}. The first field also supports a
263 # package name with a version range, in the form package>=1.2
264 # if a particular version is desired.
265 # PATCH_DEPENDS - A list of "path:dir[:target]" tuples of other ports this
266 # package depends on in the "patch" stage. "path" is the
267 # name of a file if it starts with a slash (/), an
268 # executable otherwise. make will test for the existence
269 # (if it is a full pathname) or search for it in your
270 # $PATH (if it is an executable) and go into "dir" to do
271 # a "make all install" if it's not found. If the third
272 # field ("target") exists, it will be used instead of
273 # ${DEPENDS_TARGET}. The first field also supports a
274 # package name with a version range, in the form package>=1.2
275 # if a particular version is desired.
276 # FETCH_DEPENDS - A list of "path:dir[:target]" tuples of other ports this
277 # package depends in the "fetch" stage. "path" is the
278 # name of a file if it starts with a slash (/), an
279 # executable otherwise. make will test for the
280 # existence (if it is a full pathname) or search for
281 # it in your $PATH (if it is an executable) and go
282 # into "dir" to do a "make all install" if it's not
283 # found. If the third field ("target") exists, it will
284 # be used instead of ${DEPENDS_TARGET}. The first field
285 # also supports a package name with a version range, in
286 # the form package>=1.2 if a particular version is desired.
287 # BUILD_DEPENDS - A list of "path:dir[:target]" tuples of other ports this
288 # package depends to build (between the "extract" and
289 # "build" stages, inclusive). The test done to
290 # determine the existence of the dependency is the
291 # same as FETCH_DEPENDS. If the third field ("target")
292 # exists, it will be used instead of ${DEPENDS_TARGET}.
293 # RUN_DEPENDS - A list of "path:dir[:target]" tuples of other ports this
294 # package depends to run. The test done to determine
295 # the existence of the dependency is the same as
296 # FETCH_DEPENDS. This will be checked during the
297 # "install" stage and the name of the dependency will
298 # be put into the package as well. If the third field
299 # ("target") exists, it will be used instead of
300 # ${DEPENDS_TARGET}. The first field also supports a
301 # package name with a version range, in the form package>=1.2
302 # if a particular version is desired.
303 # LIB_DEPENDS - A list of "lib:dir[:target]" tuples of other ports this
304 # package depends on. "lib" is the name of a shared library.
305 # TEST_DEPENDS - A list of "path:dir[:target]" tuples of other ports this
306 # package depends on in the "test" stage. "path" is the
307 # name of a file if it starts with a slash (/), an
308 # executable otherwise. make will test for the existence
309 # (if it is a full pathname) or search for it in your
310 # $PATH (if it is an executable) and go into "dir" to do
311 # a "make all install" if it's not found. If the third
312 # field ("target") exists, it will be used instead of
313 # ${DEPENDS_TARGET}. The first field also supports a
314 # package name with a version range, in the form package>=1.2
315 # if a particular version is desired.
316 # DEPENDS_TARGET
317 # - The default target to execute when a port is calling a
318 # dependency.
319 # Default: install
320 #
321 # These variables control options about how a port gets built and/or
322 # are shorthand notations for common sets of dependencies.
323 # Use these if your port uses some of the common software packages. By
324 # convention these should be set to 'yes', although they only need to be
325 # defined. Defaults: not set, unless explicitly indicated below.
326 #
327 # Note: the distinction between the USE_* and WANT_* variables, and the
328 # WITH_* and WITHOUT_* variables, are that the former are restricted to
329 # usage inside the ports framework, and the latter are reserved for user-
330 # settable options. (Setting USE_* in /etc/make.conf is always wrong).
331 #
332 # WITH_DEBUG - If set, debugging flags are added to CFLAGS and the
333 # binaries don't get stripped by INSTALL_PROGRAM or
334 # INSTALL_LIB. Besides, individual ports might
335 # add their specific to produce binaries for debugging
336 # purposes. You can override the debug flags that are
337 # passed to the compiler by setting DEBUG_FLAGS. It is
338 # set to "-g" at default.
339 #
340 # NOTE: to override a globally defined WITH_DEBUG at a
341 # later time ".undef WITH_DEBUG" can be used
342 #
343 # WITH_DEBUG_PORTS - A list of origins for which WITH_DEBUG will be set
344 #
345 # WITHOUT_SSP - Disable SSP.
346 #
347 # SSP_CFLAGS - Defaults to -fstack-protector. This value
348 # is added to CFLAGS and the necessary flags
349 # are added to LDFLAGS. Note that SSP_UNSAFE
350 # can be used in Makefiles by port maintainers
351 # if a port breaks with it (it should be
352 # extremely rare).
353 ##
354 # USE_LOCALE - LANG and LC_ALL are set to the value of this variable in
355 # CONFIGURE_ENV and MAKE_ENV. Example: USE_LOCALE=en_US.UTF-8
356 ##
357 # USE_GCC - If set, this port requires this version of gcc, either in
358 # the system or installed from a port.
359 # USE_CSTD - Override the default C language standard (gnu89, gnu99)
360 # USE_CXXSTD Override the default C++ language standard
361 # USE_BINUTILS - Use binutils suite from port instead of the version in base.
362 # CFLAGS_${ARCH} Append the cflags to CFLAGS only on the specified architecture
363 # CXXFLAGS_${ARCH}
364 # Append the cxxflags to CXXFLAGS only on the specified architecture
365 ##
366 # USE_GL - A list of Mesa or GL related dependencies needed by the port.
367 # Supported components are: egl, glesv2, glut, glu, glw, and gl.
368 # If set to "yes", this is equivalent to "glu". Note that
369 # glew and glut depend on glu, glw and glu depend on gl.
370 ##
371 # USE_SDL - If set, this port uses the sdl libraries.
372 # See bsd.sdl.mk for more information.
373 ##
374 # USE_OPENLDAP - If set, this port uses the OpenLDAP libraries.
375 # Implies: WANT_OPENLDAP_VER?=24
376 # WANT_OPENLDAP_VER
377 # - Legal values are: 23, 24
378 # If set to an unknown value, the port is marked BROKEN.
379 # WANT_OPENLDAP_SASL
380 # - If set, the system should use OpenLDAP libraries
381 # with SASL support.
382 ##
383 # USE_JAVA - If set, this port relies on the Java language.
384 # Implies inclusion of bsd.java.mk. (Also see
385 # that file for more information on USE_JAVA_*).
386 # USE_OCAML - If set, this port relies on the OCaml language.
387 # Implies inclusion of bsd.ocaml.mk. (Also see
388 # that file for more information on USE_OCAML*).
389 # USE_RUBY - If set, this port relies on the Ruby language.
390 # Implies inclusion of bsd.ruby.mk. (Also see
391 # that file for more information on USE_RUBY_*).
392 ##
393 # USE_GECKO - If set, this port uses the Gecko/Mozilla product.
394 # See bsd.gecko.mk for more details.
395 ##
396 # USE_WX - If set, this port uses the WxWidgets library and related
397 # components. See bsd.wx.mk for more details.
398 ##
399 #
400 # USE_QT4 - A list of the Qt 4 dependencies the port has (e.g,
401 # corelib, webkit). Implies that the port needs Qt.
402 # Implies the inclusion of bsd.qt.mk. See bsd.qt.mk
403 # for more details.
404 #
405 # USE_QT5 - A list of the Qt 5 dependencies the port has (e.g,
406 # core, webkit). Implies that the port needs Qt.
407 # Implies the inclusion of bsd.qt.mk. See bsd.qt.mk
408 # for more details.
409 ##
410 # USE_LINUX_PREFIX
411 # - Controls the action of PREFIX (see above). Only use this
412 # if the port is a Linux infrastructure port (e.g. contains libs
413 # or a sound server which supports the FreeBSD native one),
414 # use the default prefix if it's a leaf port (e.g. a game or
415 # program).
416 # Implies NO_LICENSES_INSTALL=yes, NO_MTREE=yes, and causes
417 # Linux ldconfig to be used when USE_LDCONFIG is defined.
418 ##
419 # USE_XORG - Set to a list of X.org module dependencies.
420 # Implies inclusion of bsd.xorg.mk.
421 ##
422 # USE_TEX - A list of the TeX dependencies the port has.
423 #
424 ##
425 # USE_RC_SUBR - If set, the ports startup/shutdown script uses the common
426 # routines found in /etc/rc.subr.
427 # If this is set to a list of files, these files will be
428 # automatically added to ${SUB_FILES}, some %%VAR%%'s will
429 # automatically be expanded, they will be installed in
430 # ${PREFIX}/etc/rc.d if ${PREFIX} is not /usr, otherwise they
431 # will be installed in /etc/rc.d/ and added to the packing list.
432 ##
433 # Conflict checking. Use if your port cannot be installed at the same time as
434 # another package.
435 #
436 # CONFLICTS - A list of package name patterns that the port conflicts
437 # with, separated by blanks. The names may include shell
438 # pattern meta-characters "*", "?", "[", "]", and "!".
439 # Example: apache*-1.2* apache*-1.3.[012345] apache-*+ssl_*
440 #
441 # CONFLICTS_BUILD
442 # - Check conflict prior to the build.
443 #
444 # CONFLICTS_INSTALL
445 # - Check conflict prior to the installation stage.
446 #
447 # Various directory definitions and variables to control them.
448 # You rarely need to redefine any of these except WRKSRC and NO_WRKSUBDIR.
449 #
450 # LOCALBASE - Where ports install things.
451 # Default: /usr/local
452 # LINUXBASE - Where Linux ports install things.
453 # Default: /compat/linux
454 # PREFIX - Where *this* port installs its files.
455 # Default: ${LINUXBASE} if USE_LINUX_PREFIX is set,
456 # otherwise ${LOCALBASE}
457 #
458 # IGNORE_PATH_CHECKS
459 # - There are some sanity checks against PREFIX.
460 # You can disable these checks with defining
461 # this variable, but this is not recommended!
462 # Only do this if you really know what you are
463 # doing. These sanity checks are the following:
464 # - PREFIX has to be an absolute path.
465 # - PREFIX can't have a trailing slash.
466 #
467 # BUNDLE_LIBS Teach pkg(8) to not automatically add all shared libraries
468 # installed by a port as shared libraries "provided" for
469 # other packages (i.e., do not expose them in the solver).
470 # This has to be used for ports that bundle third party
471 # libraries for internal usage.
472 # MASTERDIR - Where the port finds patches, package files, etc. Define
473 # this is you have two or more ports that share most of the
474 # files.
475 # Default: ${.CURDIR}
476 # PORTSDIR - The root of the ports tree.
477 # Default: /usr/ports
478 # DISTDIR - Where to search for and store copies of original sources
479 # Default: ${PORTSDIR}/distfiles
480 # PACKAGES - A top level directory where all packages go (rather than
481 # going locally to each port).
482 # Default: ${PORTSDIR}/packages
483 # WRKDIRPREFIX - The place to root the temporary working directory
484 # hierarchy. This path must *not* end in '/'.
485 # Default: none
486 # WRKDIR - A temporary working directory that gets *clobbered* on clean
487 # Default: ${WRKDIRPREFIX}${.CURDIR}/work
488 # WRKSRC - A subdirectory of ${WRKDIR} where the distribution actually
489 # unpacks to.
490 # Default: ${WRKDIR}/${DISTNAME}
491 # WRKSRC_SUBDIR - A subdirectory of ${WRKSRC} where the distribution actually
492 # builds in.
493 # Default: not set
494 # NO_WRKSUBDIR - Assume port unpacks without a subdirectory, and extract it in
495 # ${WRKSRC} instead of ${WRKDIR}.
496 # PATCHDIR - A directory containing any additional patches you made
497 # to port this software to FreeBSD.
498 # Default: ${MASTERDIR}/files
499 # SCRIPTDIR - A directory containing any auxiliary scripts
500 # Default: ${MASTERDIR}/scripts
501 # FILESDIR - A directory containing any miscellaneous additional files.
502 # Default: ${MASTERDIR}/files
503 # PKGDIR - A directory containing any package creation files.
504 # Default: ${MASTERDIR}
505 # SRC_BASE - The root of the src tree. (Some ports require this to get
506 # kernel sources). Default: /usr/src
507 # UID_FILES - A list of files containing information about registered UIDs.
508 # Note that files have decreasing priority.
509 # GID_FILES - A list of files containing information about registered GIDs.
510 # Note that files have decreasing priority.
511 #
512 # Variables that serve as convenient "aliases" for your *-install targets.
513 # Use these like: "${INSTALL_PROGRAM} ${WRKSRC}/prog ${PREFIX}/bin".
514 #
515 # INSTALL_PROGRAM
516 # - A command to install binary executables. (By
517 # default, also strips them, unless ${STRIP} is
518 # overridden to be the empty string).
519 # INSTALL_KLD - As INSTALL_PROGRAM, but without the STRIP.
520 # INSTALL_LIB - As INSTALL_DATA, but also strips the file.
521 # INSTALL_SCRIPT
522 # - A command to install executable scripts.
523 # INSTALL_DATA - A command to install sharable data and static libs.
524 # INSTALL_MAN - A command to install manpages and documentation.
525 # COPYTREE_BIN
526 # COPYTREE_SHARE
527 # - Similiar to INSTALL_PROGRAM and INSTALL_DATA commands but
528 # working on whole trees of directories, takes 3 arguments,
529 # last one is find(1) arguments and optional.
530 # Example use:
531 # cd ${WRKSRC}/doc && ${COPYTREE_SHARE} . ${DOCSDIR} "! -name *\.bak"
532 #
533 # Installs all directories and files from ${WRKSRC}/doc
534 # to ${DOCSDIR} except sed(1) backup files.
535 #
536 # MANPREFIX - The directory prefix for ${MAN<sect>} and ${MLINKS}.
537 # Default: ${PREFIX}
538 # MAN<sect>PREFIX
539 # - If manual pages of some sections install in different
540 # locations than others, use these.
541 # Default: ${MANPREFIX}
542 #
543 # Set the following to specify all .info files your port installs.
544 #
545 # INFO - A list of .info files (omitting the trailing ".info");
546 # only one entry per document! These files are listed in
547 # the path relative to ${INFO_PATH}.
548 # INFO_PATH - Path, where all .info files will be installed by your
549 # port, relative to ${PREFIX}
550 # Default: "share/info" if ${PREFIX} is equal to /usr
551 # and "info" otherwise.
552 #
553 # Set the following to specify all documentation your port installs into
554 # ${DOCSDIR}
555 #
556 # PORTDOCS - A list of files and directories relative to DOCSDIR.
557 # Shell glob patterns can be used, directories include
558 # the entire subtree of contained files and directories.
559 # Should not be set when no documentation files are
560 # installed.
561 # Useful for dynamically generated documentation.
562 #
563 # Set the following to specify all documentation your port installs into
564 # ${EXAMPLESDIR}
565 #
566 # PORTEXAMPLES - A list of files and directories relative to EXAMPLESDIR.
567 # Shell glob patterns can be used, directories include
568 # the entire subtree of contained files and directories.
569 # Should not be set when no examples files are
570 # installed.
571 # Useful for dynamically generated examples.
572 #
573 # Set the following to specify all files and directories your port installs into
574 # ${DATADIR}
575 #
576 # PORTDATA - A list of files and directories relative to DATADIR.
577 # Shell glob patterns can be used, directories include
578 # the entire subtree of contained files and directories.
579 # Should not be set when no data files are
580 # installed.
581 # Useful for dynamically generated data files.
582 #
583 # Default targets and their behaviors:
584 #
585 # fetch - Retrieves missing ${DISTFILES} and ${PATCHFILES} for this
586 # port.
587 # fetch-list - Show list of commands to retrieve missing ${DISTFILES} and
588 # ${PATCHFILES} for this port.
589 # fetch-recursive
590 # - Retrieves missing ${DISTFILES} and ${PATCHFILES} for this
591 # port and dependencies.
592 # fetch-recursive-list
593 # - Show list of commands to retrieve missing ${DISTFILES} and
594 # ${PATCHFILES} for this port and dependencies.
595 # fetch-required
596 # - Retrieves missing ${DISTFILES} and ${PATCHFILES} for this
597 # port and dependencies.
598 # fetch-required-list
599 # - Show list of commands to retrieve missing ${DISTFILES} and
600 # ${PATCHFILES} for this port and dependencies.
601 # fetch-url-list
602 # - Show list of URLS to retrieve missing ${DISTFILES} and
603 # ${PATCHFILES} for this port.
604 # fetch-urlall-list
605 # - Show list of URLS to retrieve ${DISTFILES} and
606 # ${PATCHFILES} for this port.
607 #
608 # all-depends-list
609 # - Show all directories which are dependencies
610 # for this port.
611 # build-depends-list
612 # - Show all directories which are build-dependencies
613 # for this port.
614 # package-depends-list
615 # - Show all directories which are package-dependencies
616 # for this port. This is based upon the dependency
617 # tree as recorded in the Makefiles of the ports
618 # collection, not as recorded in the currently
619 # installed ports.
620 # actual-package-depends
621 # - Like package-depends-list but with the difference
622 # that the dependencies of the currently installed
623 # ports are used instead of the dependencies as
624 # recorded in the ports collection.
625 # run-depends-list
626 # - Show all directories which are run-dependencies
627 # for this port.
628 # test-depends-list
629 # - Show all directories which are test-dependencies
630 # for this port.
631 #
632 # extract - Unpacks ${DISTFILES} into ${WRKDIR}.
633 # patch - Apply any provided patches to the source.
634 # configure - Runs either GNU configure, one or more local configure
635 # scripts or nothing, depending on what's available.
636 # build - Actually compile the sources.
637 # install - Install the results of a build.
638 # reinstall - Install the results of a build, ignoring "already installed"
639 # flag.
640 # deinstall - Remove the installation.
641 # deinstall-all - Remove all installations with the same PKGORIGIN.
642 # test - Run tests for the port.
643 # package - Create a package from an _installed_ port.
644 # package-recursive
645 # - Create a package for a port and _all_ of its dependencies.
646 # describe - Try to generate a one-line description for each port for
647 # use in INDEX files and the like.
648 # check-plist - Checks for files missing from the plist, and files in the plist
649 # that are not installed by the port.
650 # check-sanity - Perform some basic checks of the port layout.
651 # checkpatch - Do a "patch -C" instead of a "patch". Note that it may
652 # give incorrect results if multiple patches deal with
653 # the same file.
654 # checksum - Use distinfo to ensure that your distfiles are valid.
655 # checksum-recursive
656 # - Run checksum in this port and all dependencies.
657 # makesum - Generate distinfo (only do this for your own ports!).
658 # clean - Remove ${WRKDIR} and other temporary files used for building.
659 # clean-depends - Do a "make clean" for all dependencies.
660 # config - Configure options for this port (using ${DIALOG}).
661 # Automatically run prior to extract, patch, configure, build,
662 # install, and package.
663 # config-recursive
664 # - Configure options for this port for a port and all its
665 # dependencies.
666 # showconfig - Display options config for this port.
667 # showconfig-recursive
668 # - Display options config for this port and all its
669 # dependencies.
670 # rmconfig - Remove the options config for this port.
671 # rmconfig-recursive
672 # - Remove the options config for this port and all its
673 # dependencies.
674 #
675 # Default sequence for "all" is:
676 #
677 # check-sanity fetch checksum extract patch configure build
678 #
679 # Please read the comments in the targets section below; you
680 # should be able to use the pre-* or post-* targets/scripts
681 # (which are available for every stage except checksum) or
682 # override the do-* targets to do pretty much anything you want.
683 #
684 # The TARGET_ORDER_OVERRIDE variable can be set to multiple <priority>:<target>
685 # to change the ordering of targets, have a look at the _SEQ variables at the
686 # end of this file for the default order and priorities.
687 #
688 # NEVER override the "regular" targets unless you want to open
689 # a major can of worms.
690 #
691 # Set these variables if your port doesn't need some of the steps.
692 # Note that there are no NO_PATCH or NO_CONFIGURE variables because
693 # those steps are empty by default. NO_EXTRACT is not allowed anymore
694 # since we need to at least create ${WRKDIR}. Also, NO_CHECKSUM is a user
695 # variable and is not to be set in a port's Makefile. See above for NO_PACKAGE.
696 #
697 # NO_BUILD - Use a dummy (do-nothing) build target.
698 # NO_INSTALL - Use a dummy (do-nothing) install target.
699 # NO_TEST - Use a dummy (do-nothing) test target.
700 #
701 # Here are some variables used in various stages.
702 #
703 # For options see bsd.options.mk
704 #
705 # For fetch:
706 #
707 # FETCH_BINARY - Path to ftp/http fetch command if not in $PATH.
708 # Default: "/usr/bin/fetch"
709 # FETCH_ARGS - Arguments to ftp/http fetch command.
710 # Default: "-Fpr"
711 # FETCH_CMD - ftp/http fetch command.
712 # Default: ${FETCH_BINARY} ${FETCH_ARGS}
713 # FETCH_BEFORE_ARGS
714 # - Arguments to ${FETCH_CMD} before filename.
715 # Default: none
716 # FETCH_AFTER_ARGS
717 # - Arguments to ${FETCH_CMD} following filename.
718 # Default: none
719 # FETCH_ENV - Environment to pass to ${FETCH_CMD}.
720 # Default: none
721 # FETCH_REGET - Times to retry fetching of files on checksum errors.
722 # Default: 1
723 # CLEAN_FETCH_ENV
724 # - Disable package dependency in fetch target for mass
725 # fetching. User settable.
726 #
727 # For extract:
728 #
729 # EXTRACT_CMD - Command for extracting archive
730 # Default: ${TAR}
731 # EXTRACT_BEFORE_ARGS
732 # - Arguments to ${EXTRACT_CMD} before filename.
733 # Default: "-xf"
734 # EXTRACT_AFTER_ARGS
735 # - Arguments to ${EXTRACT_CMD} following filename.
736 # Default: "--no-same-owner --no-same-permissions"
737 # For patch:
738 #
739 # EXTRA_PATCHES - Define this variable if you have patches not in
740 # ${PATCHDIR}. This usually happens when you need to
741 # do some pre-processing before some distribution
742 # patches can be applied. In that case, fetch them as
743 # extra distfiles, put the processed results in
744 # ${WRKDIR}, then point EXTRA_PATCHES to them.
745 # The patches specified by this variable will be
746 # applied after the normal distribution patches but
747 # before those in ${PATCHDIR}. This can also contain
748 # directories, all the files named patch-* in those directories
749 # will be applied.
750 # EXTRA_PATCH_TREE - where to find extra 'out-of-tree' patches
751 # Points to a directory hierarchy with the same layout
752 # as the ports tree, where local patches can be found.
753 # This allows a third party to keep their patches in
754 # some other source control system if needed.
755 # PATCH_WRKSRC - Directory to apply patches in.
756 # Default: ${WRKSRC}
757 #
758 # For configure:
759 #
760 # HAS_CONFIGURE - If set, this port has its own configure script. The
761 # configure stage will not do anything if this is not set.
762 # GNU_CONFIGURE - If set, you are using GNU configure (optional). Implies
763 # HAS_CONFIGURE.
764 # CONFIGURE_OUTSOURCE - If set, this port builds in an empty ${CONFIGURE_WRKSRC}
765 # not being under ${WRKSRC}.
766 # CONFIGURE_WRKSRC
767 # - Directory to run configure in.
768 # Default: ${WRKSRC}
769 # CONFIGURE_SCRIPT
770 # - Name of configure script, relative to ${CONFIGURE_WRKSRC}.
771 # Default: "Makefile.PL" if USES=perl5 and USE_PERL5=configure
772 # are set, "configure" otherwise.
773 # CONFIGURE_TARGET
774 # - The name of target to call when GNU_CONFIGURE is
775 # defined.
776 # Default: ${ARCH}-portbld-${OPSYS:tl}${OSREL}
777 # GNU_CONFIGURE_PREFIX
778 # - The directory passed as prefix to the configure script if
779 # GNU_CONFIGURE is set.
780 # Default: ${PREFIX}
781 # CONFIGURE_ARGS
782 # - Pass these args to configure if ${HAS_CONFIGURE} is set.
783 # Default: "--prefix=${GNU_CONFIGURE_PREFIX}
784 # --infodir=${PREFIX}/${INFO_PATH} --localstatedir=/var
785 # --mandir=${MANPREFIX}/man --build=${CONFIGURE_TARGET}" if
786 # GNU_CONFIGURE is set, "CC=${CC} CFLAGS=${CFLAGS}
787 # PREFIX=${PREFIX} INSTALLPRIVLIB=${PREFIX}/lib
788 # INSTALLARCHLIB=${PREFIX}/lib" if USES=perl5 and
789 # USE_PERL5=configure are set, empty otherwise.
790 # CONFIGURE_ENV - Pass these env (shell-like) to configure if
791 # ${HAS_CONFIGURE} is set.
792 # CONFIGURE_LOG - The name of configure log file. It will be printed to
793 # the screen if configure fails.
794 # Default: config.log
795 # CONFIGURE_FAIL_MESSAGE
796 # - A message displayed to users when configure
797 # fails (note: this assumes the do-configure
798 # target has not been overwritten). This message
799 # will be passed through /usr/bin/fmt before
800 # being shown to the user.
801 #
802 # WITHOUT_FBSD10_FIX Disable FreeBSD 10.0 autotools workaround.
803 #
804 # For build and install:
805 #
806 # MAKEFILE - Name of the makefile.
807 # Default: Makefile
808 # ALL_TARGET - Default target for sub-make in build stage.
809 # Default: all
810 # BUILD_WRKSRC - Directory to do build in (default: ${WRKSRC}).
811 # MAKE_ENV - Additional environment vars passed to sub-make in build
812 # and install stages.
813 # Default: see below
814 # MAKE_ARGS - Any extra arguments to sub-make in build and install stages.
815 # Default: none
816 ##
817 # MAKE_JOBS_UNSAFE
818 # - Disallow multiple jobs even when user set a global override.
819 # To be used with known bad ports.
820 # DISABLE_MAKE_JOBS
821 # - Set to disable the multiple jobs feature. User settable.
822 # MAKE_JOBS_NUMBER
823 # - Override the number of make jobs to be used. User settable.
824 # MAKE_JOBS_NUMBER_LIMIT
825 # - Set a limit for maximum number of make jobs allowed to be
826 # used.
827 ## cacche
828 #
829 # WITH_CCACHE_BUILD
830 # - Enable CCACHE support (devel/ccache). User settable.
831 # CCACHE_DIR
832 # - Which directory to use for ccache (default: $HOME/.ccache)
833 # NO_CCACHE
834 # - Disable CCACHE support for example for certain ports if
835 # CCACHE is enabled. User settable.
836 #
837 # For test:
838 #
839 # TEST_TARGET - Target for sub-make in test stage. If not defined,
840 # no default test target is provided.
841 # Default: (none)
842 # TEST_WRKSRC - Directory to do test in (default: ${WRKSRC}).
843 # TEST_ENV - Additional environment vars passed to sub-make in test
844 # stage
845 # Default: ${MAKE_ENV}
846 # TEST_ARGS - Any extra arguments to sub-make in test stage
847 # Default: ${MAKE_ARGS}
848 #
849 # For install:
850 #
851 # INSTALL_TARGET
852 # - Default target for sub-make in install stage.
853 # Default: install
854 # INSTALL_WRKSRC
855 # - Directory to install from
856 # Default: ${WRKSRC}
857 # NO_MTREE - If set, will not invoke mtree from bsd.port.mk from
858 # the "install" target.
859 # MTREE_FILE - The name of the mtree file.
860 # Default: ${PORTSDIR}/Templates/BSD.local.dist or
861 # /etc/mtree/BSD.usr.dist if ${PREFIX} == "/usr".
862 # PLIST_DIRS - Directories to be added to packing list
863 # PLIST_FILES - Files and symbolic links to be added to packing list
864 #
865 # PLIST - Name of the `packing list' file.
866 # Change this to ${WRKDIR}/PLIST or something if you
867 # need to write to it. (It is not a good idea for a port
868 # to write to any file outside ${WRKDIR} during a normal
869 # build.)
870 # Default: ${PKGDIR}/pkg-plist
871 # TMPPLIST - Name of the `packing list' file after processing
872 # Default: ${WRKDIR}/.PLIST.mktmp
873 # PLIST_SUB - List of "variable=value" pair for substitution in ${PLIST}
874 # Default: see below
875 #
876 # SUB_FILES - Files that should be passed through sed(1) and redirected to
877 # ${WRKDIR}.
878 # - For each file specified in SUB_FILES, there must be a
879 # corresponding file in ${FILESDIR} whose suffix is ".in". For
880 # instance, if the Makefile specifies "SUB_FILES= pkg-message"
881 # then there must be a file called pkg-message.in in
882 # ${FILESDIR}.
883 # - The substitution process is the same as PLIST_FILES, as
884 # described below except that any line beginning with @comment
885 # is deleted.
886 # SUB_LIST - List of "variable=value" pair for substitution in ${SUB_FILES}
887 # Some pairs are added by default: eg. PREFIX=${PREFIX}
888 #
889 # USE_LDCONFIG - If set to "yes", this adds ${PREFIX}/lib to the list of
890 # directories to be searched for shared libraries.
891 # Otherwise, this is a list of directories to be added to that
892 # list. The directory names are written to
893 # ${LOCALBASE}/libdata/ldconfig/${PKGBASE} which is then
894 # used by the ldconfig startup script.
895 # This mechanism replaces ldconfig scripts installed by some
896 # ports, often under such names as 000.${UNQUENAME}.sh.
897 # If USE_LINUX_PREFIX is defined, the Linux version of
898 # ldconfig will be used instead of the native FreeBSD
899 # version, and the directory list given will be ignored.
900 # USE_LDCONFIG32
901 # - Same as USE_LDCONFIG but the target file is
902 # ${LOCALBASE}/libdata/ldconfig32/${PKGBASE} instead.
903 # Note: that should only be used on 64-bit architectures.
904 #
905 # DOCSDIR - Name of the directory to install the packages docs in.
906 # Default: ${PREFIX}/share/doc/${PORTNAME}
907 # DOCSDIR_REL - The DOCSDIR relative to ${PREFIX}
908 # EXAMPLESDIR - Name of the directory to install the packages examples in.
909 # Default: ${PREFIX}/share/examples/${PORTNAME}
910 # EXAMPLESDIR_REL
911 # - The EXAMPLESDIR relative to ${PREFIX}
912 # DATADIR - Name of the directory to install the packages shared data in.
913 # Default: ${PREFIX}/share/${PORTNAME}
914 # DATADIR_REL - The DATADIR relative to ${PREFIX}
915 #
916 # WWWDIR - Name of the directory to install the packages www data in.
917 # Default: ${PREFIX}/www/${PORTNAME}
918 # WWWDIR_REL - The WWWDIR relative to ${PREFIX}
919 #
920 # USERS - List of users to create at install time. Each login must
921 # have a corresponding entry in ${UID_FILES}.
922 # GROUPS - List of groups to create at install time. Each group must
923 # have a corresponding entry in ${GID_FILES}.
924 #
925 # DESKTOPDIR - Name of the directory to install ${DESKTOP_ENTRIES} in.
926 # Default: ${PREFIX}/share/applications
927 # DESKTOP_ENTRIES
928 # - List of desktop entry files to generate and install in
929 # ${DESKTOPDIR}. The format is
930 # "Name" "Comment" "Icon" "Exec" "Categories" StartupNotify
931 # Rules:
932 # * Only add desktop entries for applications which do not
933 # require a terminal (ie. X applications).
934 # * If the upstream distribution already installs .desktop
935 # files, you do not need to use this.
936 # * If you require a more elaborate .desktop file than this
937 # variable permits, write it yourself and install it
938 # in ${DESKTOPDIR}.
939 # Notes:
940 # * Comment, Icon and StartupNotify may be empty
941 # strings (""). Categories may be an empty string in some
942 # cases (see below). The other fields are mandatory.
943 # * If Comment is an empty string, port ${COMMENT} will be
944 # used.
945 # * If set, Icon must be either absolute path (usually
946 # ${PREFIX}/share/pixmaps/${PORTNAME}.png) or icon name
947 # without extension if installed icons follow Icon Theme
948 # Specification.
949 # * If Categories is an empty string, bsd.port.mk will try
950 # to deduce a default value using the CATEGORIES variable.
951 # If the deduction fails, you will have to set Categories
952 # manually. You should check the generated value using
953 # "make desktop-categories", and override it if necessary.
954 # * Exec will also be used to name the .desktop file.
955 # * StartupNotify may be true, false or empty (see Desktop
956 # Entry Specification for details).
957 # * The files will be automatically added to ${PLIST}.
958 # Example:
959 # "X Window Information" \
960 # "Get information about X windows" \
961 # "${PREFIX}/share/pixmaps/wininfo.png" \
962 # "${PREFIX}/bin/wininfo" \
963 # "System;" \
964 # ""
965 # See http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
966 # for an explanation of the fields. If you need to create more
967 # than one file, just chain them into a single variable.
968 #
969 # Note that the install target will automatically add manpages (see
970 # above) and also substitute special sequences of characters (delimited
971 # by "%%") as defined in PLIST_SUB to generate ${TMPPLIST}. For
972 # instance, "OSREL=${OSREL}" in PLIST_SUB causes all occurrences of
973 # "%%OSREL%%" in ${PLIST} to be substituted by the value of OSREL.
974 # ${TMPPLIST} is generated before the do-install stage. If you are
975 # generating the packing list on-the-fly, make sure it's generated before
976 # do-install is called!
977 #
978 # This is used in all stages:
979 #
980 # SCRIPTS_ENV - Additional environment vars passed to scripts in
981 # ${SCRIPTDIR} executed by bsd.port.mk.
982 # Default: see below
983 #
984 # Finally, variables to change if you want a special behavior. These
985 # are for debugging purposes. Don't set them in your Makefile.
986 #
987 # ECHO_MSG - Used to print all the '===>' style prompts - override this
988 # to turn them off.
989 # Default: ${ECHO_CMD}
990 # PATCH_DEBUG - If set, print out more information about the patches as
991 # it attempts to apply them.
992 # PKG_DBDIR - Where package installation is recorded; this directory
993 # must not contain anything else.
994 # Default: /var/db/pkg
995 # PORT_DBDIR - Where port configuration options are recorded.
996 # Default: /var/db/ports
997 # NO_PKG_REGISTER
998 # - Don't register a port installation as a package.
999 # FORCE_PKG_REGISTER
1000 # - If set, it will overwrite any existing package
1001 # registration information in ${PKG_DBDIR}/${PKGNAME}.
1002 # NO_DEPENDS - Don't verify build of dependencies.
1003 # STRICT_DEPENDS
1004 # - Verify dependencies but consider missing dependencies as
1005 # fatal.
1006 # CHECKSUM_ALGORITHMS
1007 # - Different checksum algorithms to check for verifying the
1008 # integrity of the distfiles. The absence of the algorithm
1009 # in distinfo doesn't make it fail.
1010 # Default: sha256
1011 # NO_CHECKSUM - Don't verify the checksum. Typically used when
1012 # when you noticed the distfile you just fetched has
1013 # a different checksum and you intend to verify if
1014 # the port still works with it.
1015 # USE_PACKAGE_DEPENDS
1016 # - Try to install dependencies from existing packages instead
1017 # of building the port from scratch. Fallback on source
1018 # if an existing package is not present.
1019 # USE_PACKAGE_DEPENDS_ONLY
1020 # - Like USE_PACKAGE_DEPENDS, but do not fallback on source.
1021 # INSTALL_AS_USER
1022 # - Define this to install as the current user, intended
1023 # for systems where you have no root access.
1024 # DISABLE_SIZE - Do not check the size of a distfile even if the SIZE field
1025 # has been specified in distinfo. This is useful
1026 # when using an alternate FETCH_CMD.
1027 #
1028 # PKG_CREATE_VERBOSE - If set, pass the -v option to pkg create which
1029 # ensures periodic output during packaging and
1030 # will help prevent timeouts by build monitors
1031 #
1032 # End of the list of all variables that need to be defined in a port.
1033 # Most port authors should not need to understand anything after this point.
1034 #
1035
1036 LANG= C
1037 LC_ALL= C
1038 .export LANG LC_ALL
1039
1040 # These need to be absolute since we don't know how deep in the ports
1041 # tree we are and thus can't go relative. They can, of course, be overridden
1042 # by individual Makefiles or local system make configuration.
1043 PORTSDIR?= /usr/ports
1044 LOCALBASE?= /usr/local
1045 LINUXBASE?= /compat/linux
1046 DISTDIR?= ${PORTSDIR}/distfiles
1047 _DISTDIR?= ${DISTDIR}/${DIST_SUBDIR}
1048 INDEXDIR?= ${PORTSDIR}
1049 SRC_BASE?= /usr/src
1050 USESDIR?= ${PORTSDIR}/Mk/Uses
1051 SCRIPTSDIR?= ${PORTSDIR}/Mk/Scripts
1052 LIB_DIRS?= /lib /usr/lib ${LOCALBASE}/lib
1053 STAGEDIR?= ${WRKDIR}/stage
1054 NOTPHONY?=
1055 FLAVORS?=
1056 FLAVOR?=
1057 # Disallow forced FLAVOR as make argument since we cannot change it to the
1058 # proper default.
1059 .if empty(FLAVOR) && !empty(.MAKEOVERRIDES:MFLAVOR)
1060 .error FLAVOR may not be passed empty as a make argument.
1061 .endif
1062 # Store env FLAVOR for later
1063 .if !defined(_FLAVOR)
1064 _FLAVOR:= ${FLAVOR}
1065 .endif
1066 PORTS_FEATURES+= FLAVORS
1067 MINIMAL_PKG_VERSION= 1.6.0
1068
1069 _PORTS_DIRECTORIES+= ${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR} \
1070 ${STAGEDIR}${PREFIX} ${WRKDIR}/pkg ${BINARY_LINKDIR}
1071
1072 # Ensure .CURDIR contains an absolute path without a trailing slash. Failed
1073 # builds can occur when PORTSDIR is a symbolic link, or with something like
1074 # make -C /usr/ports/category/port/.
1075 .CURDIR:= ${.CURDIR:tA}
1076
1077 # make sure bmake treats -V as expected
1078 .MAKE.EXPAND_VARIABLES= yes
1079
1080 .include "${PORTSDIR}/Mk/bsd.commands.mk"
1081
1082 # Do not leak flavors to childs make
1083 .MAKEOVERRIDES:= ${.MAKEOVERRIDES:NFLAVOR}
1084
1085 .if defined(CROSS_TOOLCHAIN)
1086 .if !defined(CROSS_SYSROOT)
1087 IGNORE= CROSS_SYSROOT should be defined
1088 .endif
1089 .include "${LOCALBASE}/share/toolchains/${CROSS_TOOLCHAIN}.mk"
1090 # Do not define CPP on purpose
1091 .if !defined(HOSTCC)
1092 HOSTCC:= ${CC}
1093 HOSTCXX:= ${CXX}
1094 .endif
1095 .if !defined(CC_FOR_BUILD)
1096 CC_FOR_BUILD:= ${HOSTCC}
1097 CXX_FOR_BUILD:= ${HOSTCXX}
1098 .endif
1099 CONFIGURE_ENV+= HOSTCC="${HOSTCC}" HOSTCXX="${HOSTCXX}" CC_FOR_BUILD="${CC_FOR_BUILD}" CXX_FOR_BUILD="${CXX_FOR_BUILD}"
1100
1101 CC= ${XCC}
1102 CXX= ${XCXX}
1103 CFLAGS+= --sysroot=${CROSS_SYSROOT} -isystem ${CROSS_SYSROOT}/usr/include
1104 CXXFLAGS+= --sysroot=${CROSS_SYSROOT} -isystem ${CROSS_SYSROOT}/usr/include -isystem ${CROSS_SYSROOT}/usr/include/c++/v1 -nostdinc++
1105 CPPFLAGS+= --sysroot=${CROSS_SYSROOT} -isystem ${CROSS_SYSROOT}/usr/include
1106 LDFLAGS+= --sysroot=${CROSS_SYSROOT}
1107 .for _tool in AS AR LD NM OBJCOPY RANLIB SIZE STRINGS
1108 ${_tool}= ${CROSS_BINUTILS_PREFIX}${tool:tl}
1109 .endfor
1110 STRIP_CMD= ${CROSS_BINUTILS_PREFIX}strip
1111 # only bmake support the below
1112 STRIPBIN= ${STRIP_CMD}
1113 .export.env STRIPBIN
1114 .endif
1115
1116 #
1117 # DESTDIR section to start a chrooted process if invoked with DESTDIR set
1118 #
1119
1120 .if defined(DESTDIR) && !empty(DESTDIR) && !defined(CHROOTED) && \
1121 !defined(BEFOREPORTMK) && !defined(INOPTIONSMK)
1122
1123 .include "${PORTSDIR}/Mk/bsd.destdir.mk"
1124
1125 .else
1126
1127 .if !target(makepatch)
1128 makepatch:
1129 @${SETENV} WRKDIR=${WRKDIR} PATCHDIR=${PATCHDIR} \
1130 PATCH_WRKSRC=${PATCH_WRKSRC} \
1131 STRIP_COMPONENTS="${PATCH_STRIP:S/-p//}" \
1132 ${SH} ${SCRIPTSDIR}/smart_makepatch.sh
1133 .endif
1134
1135
1136 # Start of options section
1137 .if defined(INOPTIONSMK) || ( !defined(USEOPTIONSMK) && !defined(AFTERPORTMK) )
1138
1139
1140 # Get the default maintainer
1141 MAINTAINER?= ports@FreeBSD.org
1142
1143 # Get the architecture
1144 .if !defined(ARCH)
1145 ARCH!= ${UNAME} -p
1146 .endif
1147 _EXPORTED_VARS+= ARCH
1148
1149 # Get the operating system type
1150 .if !defined(OPSYS)
1151 OPSYS!= ${UNAME} -s
1152 .endif
1153 _EXPORTED_VARS+= OPSYS
1154
1155 .if !defined(_OSRELEASE)
1156 _OSRELEASE!= ${UNAME} -r
1157 .endif
1158 _EXPORTED_VARS+= _OSRELEASE
1159
1160 # Get the operating system revision
1161 OSREL?= ${_OSRELEASE:C/-.*//}
1162 _EXPORTED_VARS+= OSREL
1163
1164 # Get __FreeBSD_version
1165 .if !defined(OSVERSION)
1166 .if exists(/usr/include/sys/param.h)
1167 OSVERSION!= ${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3}' < /usr/include/sys/param.h
1168 .elif exists(${SRC_BASE}/sys/sys/param.h)
1169 OSVERSION!= ${AWK} '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3}' < ${SRC_BASE}/sys/sys/param.h
1170 .else
1171 .error Unable to determine OS version. Either define OSVERSION, install /usr/include/sys/param.h or define SRC_BASE.
1172 .endif
1173 .endif
1174 _EXPORTED_VARS+= OSVERSION
1175
1176 .if (${OPSYS} == FreeBSD && (${OSVERSION} < 1004000 || (${OSVERSION} >= 1100000 && ${OSVERSION} < 1101001))) || \
1177 (${OPSYS} == DragonFly && ${DFLYVERSION} < 400400)
1178 _UNSUPPORTED_SYSTEM_MESSAGE= Ports Collection support for your ${OPSYS} version has ended, and no ports\
1179 are guaranteed to build on this system. Please upgrade to a supported release.
1180 . if defined(ALLOW_UNSUPPORTED_SYSTEM)
1181 WARNING+= "${_UNSUPPORTED_SYSTEM_MESSAGE}"
1182 . else
1183 show-unsupported-system-error:
1184 @${ECHO_MSG} "/!\\ ERROR: /!\\"
1185 @${ECHO_MSG}
1186 @${ECHO_MSG} "${_UNSUPPORTED_SYSTEM_MESSAGE}" | ${FMT_80}
1187 @${ECHO_MSG}
1188 @${ECHO_MSG} "No support will be provided if you silence this message by defining ALLOW_UNSUPPORTED_SYSTEM." | ${FMT_80}
1189 @${ECHO_MSG}
1190 @${FALSE}
1191 . endif
1192 .endif
1193
1194 # Convert OSVERSION to major release number
1195 _OSVERSION_MAJOR= ${OSVERSION:C/([0-9]?[0-9])([0-9][0-9])[0-9]{3}/\1/}
1196 # Sanity checks for chroot/jail building.
1197 # Skip if OSVERSION specified on cmdline for testing. Only works for bmake.
1198 .if !defined(.MAKEOVERRIDES) || !${.MAKEOVERRIDES:MOSVERSION}
1199 .if ${_OSVERSION_MAJOR} != ${_OSRELEASE:R}
1200 .error UNAME_r (${_OSRELEASE}) and OSVERSION (${OSVERSION}) do not agree on major version number.
1201 .elif ${_OSVERSION_MAJOR} != ${OSREL:R}
1202 .error OSREL (${OSREL}) and OSVERSION (${OSVERSION}) do not agree on major version number.
1203 .endif
1204 .endif
1205
1206 # Only define tools here (for transition period with between pkg tools)
1207 .include "${PORTSDIR}/Mk/bsd.commands.mk"
1208
1209 .if !defined(_PKG_CHECKED) && !defined(PACKAGE_BUILDING) && exists(${PKG_BIN})
1210 .if !defined(_PKG_VERSION)
1211 _PKG_VERSION!= ${PKG_BIN} -v
1212 .endif
1213 _PKG_STATUS!= ${PKG_BIN} version -t ${_PKG_VERSION:C/-.*//g} ${MINIMAL_PKG_VERSION}
1214 .if ${_PKG_STATUS} == "<"
1215 IGNORE= pkg(8) must be version ${MINIMAL_PKG_VERSION} or greater, but you have ${_PKG_VERSION}. You must upgrade the ${PKG_ORIGIN} port first
1216 .endif
1217 _PKG_CHECKED= 1
1218 .endif
1219 _EXPORTED_VARS+= _PKG_CHECKED
1220
1221 MASTERDIR?= ${.CURDIR}
1222
1223 .if ${MASTERDIR} != ${.CURDIR}
1224 SLAVE_PORT?= yes
1225 MASTER_PORT?=${MASTERDIR:C/[^\/]+\/\.\.\///:C/[^\/]+\/\.\.\///:C/^.*\/([^\/]+\/[^\/]+)$/\\1/}
1226 .else
1227 SLAVE_PORT?= no
1228 MASTER_PORT?=
1229 .endif
1230
1231 # If they exist, include Makefile.inc, then architecture/operating
1232 # system specific Makefiles, then local Makefile.local.
1233
1234 .if ${MASTERDIR} != ${.CURDIR} && exists(${.CURDIR}/../Makefile.inc)
1235 .include "${.CURDIR}/../Makefile.inc"
1236 USE_SUBMAKE= yes
1237 .endif
1238
1239 .if exists(${MASTERDIR}/../Makefile.inc)
1240 .include "${MASTERDIR}/../Makefile.inc"
1241 USE_SUBMAKE= yes
1242 .endif
1243
1244 .if exists(${MASTERDIR}/Makefile.${ARCH}-${OPSYS})
1245 .include "${MASTERDIR}/Makefile.${ARCH}-${OPSYS}"
1246 USE_SUBMAKE= yes
1247 .elif exists(${MASTERDIR}/Makefile.${OPSYS})
1248 .include "${MASTERDIR}/Makefile.${OPSYS}"
1249 USE_SUBMAKE= yes
1250 .elif exists(${MASTERDIR}/Makefile.${ARCH})
1251 .include "${MASTERDIR}/Makefile.${ARCH}"
1252 USE_SUBMAKE= yes
1253 .endif
1254
1255 .if exists(${MASTERDIR}/Makefile.local)
1256 .include "${MASTERDIR}/Makefile.local"
1257 USE_SUBMAKE= yes
1258 .elif ${MASTERDIR} != ${.CURDIR} && exists(${.CURDIR}/Makefile.local)
1259 .include "${.CURDIR}/Makefile.local"
1260 USE_SUBMAKE= yes
1261 .endif
1262
1263 .for _CATEGORY in ${CATEGORIES}
1264 PKGCATEGORY?= ${_CATEGORY}
1265 .endfor
1266 _PORTDIRNAME= ${.CURDIR:T}
1267 PORTDIRNAME?= ${_PORTDIRNAME}
1268 PKGORIGIN?= ${PKGCATEGORY}/${PORTDIRNAME}
1269
1270 # where 'make config' records user configuration options
1271 PORT_DBDIR?= /var/db/ports
1272
1273 UID_FILES?= ${PORTSDIR}/UIDs
1274 GID_FILES?= ${PORTSDIR}/GIDs
1275 UID_OFFSET?= 0
1276 GID_OFFSET?= 0
1277
1278 # predefined accounts from src/etc/master.passwd
1279 # alpha numeric sort order
1280 USERS_BLACKLIST= _dhcp _pflogd _ypldap auditdistd bin bind daemon games hast kmem mailnull man news nobody operator pop proxy root smmsp sshd toor tty unbound uucp www
1281
1282 # predefined accounts from src/etc/group
1283 # alpha numeric sort order
1284 GROUPS_BLACKLIST= _dhcp _pflogd _ypldap audit authpf bin bind daemon dialer ftp games guest hast kmem mail mailnull man network news nobody nogroup operator proxy smmsp sshd staff sys tty unbound uucp wheel www
1285
1286 LDCONFIG_DIR= libdata/ldconfig
1287 LDCONFIG32_DIR= libdata/ldconfig32
1288
1289 # At least KDE needs TMPDIR for the package building,
1290 # so we're setting it to the known default value.
1291 .if defined(PACKAGE_BUILDING)
1292 TMPDIR?= /tmp
1293 .endif # defined(PACKAGE_BUILDING)
1294
1295 .if defined(WITH_DEBUG_PORTS)
1296 .if ${WITH_DEBUG_PORTS:M${PKGORIGIN}}
1297 WITH_DEBUG= yes
1298 .endif
1299 .endif
1300
1301 .include "${PORTSDIR}/Mk/bsd.default-versions.mk"
1302 .include "${PORTSDIR}/Mk/bsd.options.mk"
1303
1304 .endif
1305 # End of options section.
1306
1307 # Start of pre-makefile section.
1308 .if !defined(AFTERPORTMK) && !defined(INOPTIONSMK)
1309
1310 .if defined(PORTNAME)
1311 .include "${PORTSDIR}/Mk/bsd.sanity.mk"
1312 .endif
1313
1314 _PREMKINCLUDED= yes
1315
1316 .if defined(PORTVERSION)
1317 .if ${PORTVERSION:M*[-_,]*}x != x
1318 IGNORE= PORTVERSION ${PORTVERSION} may not contain '-' '_' or ','
1319 .endif
1320 .if defined(DISTVERSION)
1321 DEV_ERROR+= "Defining both PORTVERSION and DISTVERSION is wrong, only set one, if necessary, set DISTNAME"
1322 .endif
1323 DISTVERSION?= ${PORTVERSION:S/:/::/g}
1324 .elif defined(DISTVERSION)
1325 PORTVERSION= ${DISTVERSION:tl:C/([a-z])[a-z]+/\1/g:C/([0-9])([a-z])/\1.\2/g:C/:(.)/\1/g:C/[^a-z0-9+]+/./g}
1326 .endif
1327
1328 PORTREVISION?= 0
1329 .if ${PORTREVISION} != 0
1330 _SUF1= _${PORTREVISION}
1331 .endif
1332
1333 PORTEPOCH?= 0
1334 .if ${PORTEPOCH} != 0
1335 _SUF2= ,${PORTEPOCH}
1336 .endif
1337
1338 PKGVERSION= ${PORTVERSION:C/[-_,]/./g}${_SUF1}${_SUF2}
1339 PKGNAME= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PKGVERSION}
1340 DISTVERSIONFULL= ${DISTVERSIONPREFIX}${DISTVERSION:C/:(.)/\1/g}${DISTVERSIONSUFFIX}
1341 .if defined(USE_GITHUB) && empty(MASTER_SITES:MGHC) && empty(USE_GITHUB:Mnodefault)
1342 . if empty(DISTNAME)
1343 _GITHUB_MUST_SET_DISTNAME= yes
1344 . else
1345 DEV_WARNING+= "You are using USE_GITHUB and DISTNAME is set which is wrong. Set GH_ACCOUNT/GH_PROJECT/GH_TAGNAME correctly and remove WRKSRC entirely."
1346 . endif
1347 .else
1348 DISTNAME?= ${PORTNAME}-${DISTVERSIONFULL}
1349 .endif
1350
1351 INDEXFILE?= INDEX-${OSVERSION:C/([0-9]*)[0-9]{5}/\1/}
1352
1353 .if defined(USE_XORG) || defined(XORG_CAT)
1354 .include "${PORTSDIR}/Mk/bsd.xorg.mk"
1355 .endif
1356
1357 PACKAGES?= ${PORTSDIR}/packages
1358 TEMPLATES?= ${PORTSDIR}/Templates
1359 KEYWORDS?= ${PORTSDIR}/Keywords
1360
1361 PATCHDIR?= ${MASTERDIR}/files
1362 FILESDIR?= ${MASTERDIR}/files
1363 SCRIPTDIR?= ${MASTERDIR}/scripts
1364 PKGDIR?= ${MASTERDIR}
1365
1366 PREFIX?= ${LOCALBASE}
1367
1368 PKGCOMPATDIR?= ${LOCALBASE}/lib/compat/pkg
1369
1370 .if defined(USE_LOCAL_MK)
1371 .include "${PORTSDIR}/Mk/bsd.local.mk"
1372 .endif
1373
1374 .if defined(USE_PHP) && (!defined(USES) || ( defined(USES) && !${USES:Mphp*} ))
1375 DEV_WARNING+= "Using USE_PHP alone is deprecated, please use USES=php"
1376 USES+= php
1377 .endif
1378
1379 .if defined(USE_JAVA)
1380 .include "${PORTSDIR}/Mk/bsd.java.mk"
1381 .endif
1382
1383 .if defined(USE_RUBY) || defined(USE_LIBRUBY)
1384 .include "${PORTSDIR}/Mk/bsd.ruby.mk"
1385 .endif
1386
1387 .if defined(USE_OCAML)
1388 .include "${PORTSDIR}/Mk/bsd.ocaml.mk"
1389 .endif
1390
1391 .if defined(USE_APACHE_BUILD)
1392 USES+= apache:build,${USE_APACHE_BUILD:C/2([0-9])/2.\1/g}
1393 .elif defined(USE_APACHE_RUN)
1394 USES+= apache:run,${USE_APACHE_RUN:C/2([0-9])/2.\1/g}
1395 .elif defined(USE_APACHE)
1396 USE_APACHE:= ${USE_APACHE:S/common/server,/}
1397 USES+= apache:${USE_APACHE:C/2([0-9])/2.\1/g}
1398 .endif
1399
1400 .if defined(USE_QT4) || defined(USE_QT5)
1401 .include "${PORTSDIR}/Mk/bsd.qt.mk"
1402 .endif
1403
1404 .if defined(USE_TEX)
1405 .include "${PORTSDIR}/Mk/bsd.tex.mk"
1406 .endif
1407
1408 .if defined(USE_GECKO)
1409 .include "${PORTSDIR}/Mk/bsd.gecko.mk"
1410 .endif
1411
1412 .if defined(USE_GNOME) || defined(INSTALLS_ICONS)
1413 USES+= gnome
1414 .endif
1415
1416 .if defined(USE_MATE)
1417 USES+= mate
1418 .endif
1419
1420 .if defined(USE_MYSQL)
1421 USE_MYSQL:= ${USE_MYSQL:N[yY][eE][sS]:Nclient}
1422 .if defined(WANT_MYSQL_VER)
1423 .if empty(USE_MYSQL)
1424 USE_MYSQL:=${WANT_MYSQL_VER}
1425 .else
1426 USE_MYSQL:=${USE_MYSQL},${WANT_MYSQL_VER}
1427 .endif
1428 .endif
1429 USES+=mysql:${USE_MYSQL}
1430 .endif
1431
1432 .if defined(WANT_WX) || defined(USE_WX) || defined(USE_WX_NOT)
1433 .include "${PORTSDIR}/Mk/bsd.wx.mk"
1434 .endif
1435
1436 .if defined(WANT_GSTREAMER) || defined(USE_GSTREAMER) || defined(USE_GSTREAMER1)
1437 .include "${PORTSDIR}/Mk/bsd.gstreamer.mk"
1438 .endif
1439
1440 .if defined(USE_SDL)
1441 .include "${PORTSDIR}/Mk/bsd.sdl.mk"
1442 .endif
1443
1444 .if !defined(UID)
1445 UID!= ${ID} -u
1446 .endif
1447
1448 DESTDIRNAME?= DESTDIR
1449
1450 # setup empty variables for USES targets
1451 .for target in sanity fetch extract patch configure build install test package stage
1452 _USES_${target}?=
1453 .endfor
1454
1455 # Loading features
1456 .for f in ${USES}
1457 _f:= ${f:C/\:.*//}
1458 .if !defined(${_f}_ARGS)
1459 ${_f}_ARGS:= ${f:C/^[^\:]*(\:|\$)//:S/,/ /g}
1460 .endif
1461 .endfor
1462 .for f in ${USES}
1463 .include "${USESDIR}/${f:C/\:.*//}.mk"
1464 .endfor
1465
1466 .if !empty(FLAVORS)
1467 . if ${FLAVORS:Mall}
1468 DEV_ERROR+= "FLAVORS cannot contain 'all', it is a reserved value"
1469 . endif
1470 . for f in ${FLAVORS}
1471 . if ${f:C/[[:lower:][:digit:]_]//g}
1472 _BAD_FLAVOR_NAMES+= ${f}
1473 . endif
1474 . endfor
1475 . if !empty(_BAD_FLAVOR_NAMES)
1476 DEV_ERROR+= "FLAVORS contains flavors that are not all [a-z0-9_]: ${_BAD_FLAVOR_NAMES}"
1477 . endif
1478 .endif
1479
1480 .if !empty(FLAVOR)
1481 . if empty(FLAVORS)
1482 IGNORE= FLAVOR is defined (to ${FLAVOR}) while this port does not have FLAVORS.
1483 . elif ! ${FLAVORS:M${FLAVOR}}
1484 IGNORE= Unknown flavor '${FLAVOR}', possible flavors: ${FLAVORS}.
1485 . endif
1486 .endif
1487
1488 .if !empty(FLAVORS) && empty(FLAVOR)
1489 FLAVOR= ${FLAVORS:[1]}
1490 .endif
1491
1492 # Reorder FLAVORS so the default is first if set by the port.
1493 .if empty(_FLAVOR) && !empty(FLAVORS) && !empty(FLAVOR)
1494 FLAVORS:= ${FLAVOR} ${FLAVORS:N${FLAVOR}}
1495 .endif
1496
1497 .if !empty(FLAVOR) && !defined(_DID_FLAVORS_HELPERS)
1498 _DID_FLAVORS_HELPERS= yes
1499 _FLAVOR_HELPERS_OVERRIDE= DESCR PLIST PKGNAMEPREFIX PKGNAMESUFFIX
1500 _FLAVOR_HELPERS_APPEND= CONFLICTS CONFLICTS_BUILD CONFLICTS_INSTALL \
1501 PKG_DEPENDS EXTRACT_DEPENDS PATCH_DEPENDS \
1502 FETCH_DEPENDS BUILD_DEPENDS LIB_DEPENDS \
1503 RUN_DEPENDS TEST_DEPENDS
1504 # These overwrite the current value
1505 .for v in ${_FLAVOR_HELPERS_OVERRIDE}
1506 .if defined(${FLAVOR}_${v})
1507 ${v}= ${${FLAVOR}_${v}}
1508 .endif
1509 .endfor
1510
1511 # These append to the current value
1512 .for v in ${_FLAVOR_HELPERS_APPEND}
1513 .if defined(${FLAVOR}_${v})
1514 ${v}+= ${${FLAVOR}_${v}}
1515 .endif
1516 .endfor
1517
1518 .for v in BROKEN IGNORE
1519 .if defined(${FLAVOR}_${v})
1520 ${v}= flavor "${FLAVOR}" ${${FLAVOR}_${v}}
1521 .endif
1522 .endfor
1523 .endif # defined(${FLAVOR})
1524
1525
1526 EXTRACT_SUFX?= .tar.gz
1527
1528 .if defined(USE_LINUX_PREFIX)
1529 PREFIX= ${LINUXBASE}
1530 DATADIR?= ${PREFIX}/usr/share/${PORTNAME}
1531 DOCSDIR?= ${PREFIX}/usr/share/doc/${PORTNAME}-${PORTVERSION}
1532 NO_LICENSES_INSTALL= yes
1533 NO_MTREE= yes
1534 .endif
1535
1536 # You can force skipping these test by defining IGNORE_PATH_CHECKS
1537 .if !defined(IGNORE_PATH_CHECKS)
1538 .if ! ${PREFIX:M/*}
1539 .BEGIN:
1540 @${ECHO_MSG} "PREFIX must be defined as an absolute path so that when 'make'"
1541 @${ECHO_MSG} "is invoked in the work area PREFIX points to the right place."
1542 @${FALSE}
1543 .endif
1544 .endif
1545
1546 DATADIR?= ${PREFIX}/share/${PORTNAME}
1547 DOCSDIR?= ${PREFIX}/share/doc/${PORTNAME}
1548 ETCDIR?= ${PREFIX}/etc/${PORTNAME}
1549 EXAMPLESDIR?= ${PREFIX}/share/examples/${PORTNAME}
1550 WWWDIR?= ${PREFIX}/www/${PORTNAME}
1551
1552 # Owner and group of the WWW user
1553 WWWOWN?= www
1554 WWWGRP?= www
1555
1556 # Keep PKGNG_ORIGIN/WITH_PKGNG for compat with scripts which are looking for it
1557 PKG_ORIGIN?= ports-mgmt/pkg
1558 PKGNG_ORIGIN= ${PKG_ORIGIN}
1559 WITH_PKGNG?= yes
1560 WITH_PKG?= ${WITH_PKGNG}
1561
1562 .endif
1563 # End of pre-makefile section.
1564
1565 # Start of post-makefile section.
1566 .if !defined(BEFOREPORTMK) && !defined(INOPTIONSMK)
1567
1568 .if defined(_POSTMKINCLUDED)
1569 DEV_ERROR+= "${PKGNAME}: Makefile error: you cannot include bsd.port[.post].mk twice"
1570 @${FALSE}
1571 .endif
1572
1573 _POSTMKINCLUDED= yes
1574
1575 .if defined(BUNDLE_LIBS)
1576 PKG_NOTES+= no_provide_shlib
1577 PKG_NOTE_no_provide_shlib= yes
1578 .endif
1579
1580 .if defined(DEPRECATED)
1581 PKG_NOTES+= deprecated
1582 PKG_NOTE_deprecated=${DEPRECATED}
1583 .endif
1584
1585 .if defined(EXPIRATION_DATE)
1586 PKG_NOTES+= expiration_date
1587 PKG_NOTE_expiration_date= ${EXPIRATION_DATE}
1588 .endif
1589
1590 .if !empty(FLAVOR)
1591 PKG_NOTES+= flavor
1592 PKG_NOTE_flavor= ${FLAVOR}
1593 .endif
1594
1595 TEST_ARGS?= ${MAKE_ARGS}
1596 TEST_ENV?= ${MAKE_ENV}
1597
1598 PKG_ENV+= PORTSDIR=${PORTSDIR}
1599 CONFIGURE_ENV+= XDG_DATA_HOME=${WRKDIR} \
1600 XDG_CONFIG_HOME=${WRKDIR} \
1601 HOME=${WRKDIR}
1602 MAKE_ENV+= XDG_DATA_HOME=${WRKDIR} \
1603 XDG_CONFIG_HOME=${WRKDIR} \
1604 HOME=${WRKDIR}
1605 # Respect TMPDIR passed via make.conf or similar and pass it down
1606 # to configure and make.
1607 .if defined(TMPDIR)
1608 MAKE_ENV+= TMPDIR="${TMPDIR}"
1609 CONFIGURE_ENV+= TMPDIR="${TMPDIR}"
1610 .endif # defined(TMPDIR)
1611
1612 QA_ENV+= STAGEDIR=${STAGEDIR} \
1613 PREFIX=${PREFIX} \
1614 LINUXBASE=${LINUXBASE} \
1615 LOCALBASE=${LOCALBASE} \
1616 "STRIP=${STRIP}" \
1617 TMPPLIST=${TMPPLIST} \
1618 CURDIR='${.CURDIR}' \
1619 FLAVOR=${FLAVOR} \
1620 FLAVORS='${FLAVORS}' \
1621 BUNDLE_LIBS=${BUNDLE_LIBS} \
1622 LDCONFIG_DIR="${LDCONFIG_DIR}" \
1623 PKGORIGIN=${PKGORIGIN} \
1624 LIB_RUN_DEPENDS='${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,}' \
1625 UNIFIED_DEPENDS=${_UNIFIED_DEPENDS:C,([^:]*:[^:]*):?.*,\1,:O:u:Q} \
1626 PKGBASE=${PKGBASE} \
1627 PORTNAME=${PORTNAME} \
1628 NO_ARCH=${NO_ARCH} \
1629 "NO_ARCH_IGNORE=${NO_ARCH_IGNORE}" \
1630 USE_RUBY=${USE_RUBY}
1631 .if !empty(USES:Mssl)
1632 QA_ENV+= USESSSL=yes
1633 .endif
1634 .if !empty(USES:Mdesktop-file-utils)
1635 QA_ENV+= USESDESKTOPFILEUTILS=yes
1636 .endif
1637 .if !empty(USES:Mlibtool*)
1638 QA_ENV+= USESLIBTOOL=yes
1639 .endif
1640 .if !empty(USES:Mshared-mime-info)
1641 QA_ENV+= USESSHAREDMIMEINFO=yes
1642 .endif
1643 .if !empty(USES:Mterminfo)
1644 QA_ENV+= USESTERMINFO=yes
1645 .endif
1646
1647 CO_ENV+= STAGEDIR=${STAGEDIR} \
1648 PREFIX=${PREFIX} \
1649 LOCALBASE=${LOCALBASE} \
1650 WRKDIR=${WRKDIR} \
1651 WRKSRC=${WRKSRC} \
1652 MTREE_FILE=${MTREE_FILE} \
1653 TMPPLIST=${TMPPLIST} \
1654 SCRIPTSDIR=${SCRIPTSDIR} \
1655 PLIST_SUB_SED="${PLIST_SUB_SED}" \
1656 PORT_OPTIONS="${PORT_OPTIONS}" \
1657 PORTSDIR="${PORTSDIR}"
1658
1659 .if defined(CROSS_SYSROOT)
1660 PKG_ENV+= ABI_FILE=${CROSS_SYSROOT}/bin/sh
1661 MAKE_ENV+= NM=${NM} \
1662 STRIPBIN=${STRIPBIN} \
1663 PKG_CONFIG_SYSROOT_DIR="${CROSS_SYSROOT}"
1664 CONFIGURE_ENV+= PKG_CONFIG_SYSROOT_DIR="${CROSS_SYSROOT}"
1665 .endif
1666
1667 .if empty(FLAVOR)
1668 _WRKDIR= work
1669 .else
1670 _WRKDIR= work-${FLAVOR}
1671 .endif
1672
1673 WRKDIR?= ${WRKDIRPREFIX}${.CURDIR}/${_WRKDIR}
1674 BINARY_LINKDIR= ${WRKDIR}/.bin
1675 PATH:= ${BINARY_LINKDIR}:${PATH}
1676 .if !${MAKE_ENV:MPATH=*} && !${CONFIGURE_ENV:MPATH=*}
1677 MAKE_ENV+= PATH=${PATH}
1678 CONFIGURE_ENV+= PATH=${PATH}
1679 .endif
1680
1681 .if !defined(IGNORE_MASTER_SITE_GITHUB) && defined(USE_GITHUB) && empty(USE_GITHUB:Mnodefault)
1682 .if defined(WRKSRC)
1683 DEV_WARNING+= "You are using USE_GITHUB and WRKSRC is set which is wrong. Set GH_PROJECT correctly, set WRKSRC_SUBDIR or remove WRKSRC entirely."
1684 .endif
1685 WRKSRC?= ${WRKDIR}/${GH_PROJECT}-${GH_TAGNAME_EXTRACT}
1686 .endif
1687
1688 .if !default(IGNORE_MASTER_SITE_GITLAB) && defined(USE_GITLAB) && empty(USE_GITLAB:Mnodefault)
1689 WRKSRC?= ${WRKDIR}/${GL_PROJECT}-${GL_COMMIT}-${GL_COMMIT}
1690 .endif
1691
1692 # If the distname is not extracting into a specific subdirectory, have the
1693 # ports framework force extract into a subdirectory so that metadata files
1694 # do not get in the way of the build, and vice-versa.
1695 .if defined(NO_WRKSUBDIR)
1696 # Some ports have DISTNAME=PORTNAME, and USE_RC_SUBR=PORTNAME, in those case,
1697 # the rc file will conflict with WRKSRC, as WRKSRC is artificial, make it the
1698 # most unlikely to conflict as we can.
1699 WRKSRC?= ${WRKDIR}/${PKGNAME}
1700 EXTRACT_WRKDIR:= ${WRKSRC}
1701 .else
1702 WRKSRC?= ${WRKDIR}/${DISTNAME}
1703 EXTRACT_WRKDIR:= ${WRKDIR}
1704 .endif
1705 .if defined(WRKSRC_SUBDIR)
1706 WRKSRC:= ${WRKSRC}/${WRKSRC_SUBDIR}
1707 .endif
1708
1709 .if defined(CONFIGURE_OUTSOURCE)
1710 CONFIGURE_CMD?= ${WRKSRC}/${CONFIGURE_SCRIPT}
1711 CONFIGURE_WRKSRC?= ${WRKDIR}/.build
1712 BUILD_WRKSRC?= ${CONFIGURE_WRKSRC}
1713 INSTALL_WRKSRC?= ${CONFIGURE_WRKSRC}
1714 TEST_WRKSRC?= ${CONFIGURE_WRKSRC}
1715 .endif
1716
1717 PATCH_WRKSRC?= ${WRKSRC}
1718 CONFIGURE_WRKSRC?= ${WRKSRC}
1719 BUILD_WRKSRC?= ${WRKSRC}
1720 INSTALL_WRKSRC?=${WRKSRC}
1721 TEST_WRKSRC?= ${WRKSRC}
1722
1723 PLIST_SUB+= OSREL=${OSREL} PREFIX=%D LOCALBASE=${LOCALBASE} \
1724 RESETPREFIX=${PREFIX}
1725 SUB_LIST+= PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} \
1726 DATADIR=${DATADIR} DOCSDIR=${DOCSDIR} EXAMPLESDIR=${EXAMPLESDIR} \
1727 WWWDIR=${WWWDIR} ETCDIR=${ETCDIR}
1728 # This is used for check-stagedir.sh and check_leftover.sh to replace
1729 # directories/files with PLIST_SUB %%KEYS%%.
1730 # Remove VARS which values are PLIST_SUB_SED_MIN long or shorter
1731 PLIST_SUB_SED_MIN?= 2
1732 PLIST_SUB_SED_tmp1= ${PLIST_SUB:C/.*=.{1,${PLIST_SUB_SED_MIN}}$//g}
1733 # Remove VARS that are too generic
1734 # Remove empty values
1735 # Remove @comment values
1736 PLIST_SUB_SED_tmp2= ${PLIST_SUB_SED_tmp1:NEXTRACT_SUFX=*:NOSREL=*:NLIB32DIR=*:NPREFIX=*:NLOCALBASE=*:NRESETPREFIX=*:N*="":N*="@comment*}
1737 # Handle VARS for which there is a _regex entry
1738 PLIST_SUB_SED_tmp3?= ${PLIST_SUB_SED_tmp2:C/(${PLIST_SUB:M*_regex=*:C/_regex=.*/=.*/:Q:S/\\ /|/g:S/\\//g})//:C/(.*)_regex=(.*)/\1=\2/}
1739 # Remove quotes
1740 # Replace . with \. for later sed(1) usage
1741 PLIST_SUB_SED?= ${PLIST_SUB_SED_tmp3:C/([^=]*)="?([^"]*)"?/s!\2!%%\1%%!g;/g:C/\./\\./g}
1742
1743 # kludge to strip trailing whitespace from CFLAGS;
1744 # sub-configure will not # survive double space
1745 CFLAGS:= ${CFLAGS:C/ $//}
1746
1747 .if defined(WITHOUT_CPU_CFLAGS)
1748 .if defined(_CPUCFLAGS)
1749 .if !empty(_CPUCFLAGS)
1750 CFLAGS:= ${CFLAGS:C/${_CPUCFLAGS}//}
1751 .endif
1752 .endif
1753 .endif
1754
1755 # Reset value from bsd.own.mk.
1756 .if defined(WITH_DEBUG)
1757 .if !defined(INSTALL_STRIPPED)
1758 STRIP= #none
1759 MAKE_ENV+= DONTSTRIP=yes
1760 STRIP_CMD= ${TRUE}
1761 .endif
1762 DEBUG_FLAGS?= -g
1763 CFLAGS:= ${CFLAGS:N-O*:N-fno-strict*} ${DEBUG_FLAGS}
1764 .if defined(INSTALL_TARGET)
1765 INSTALL_TARGET:= ${INSTALL_TARGET:S/^install-strip$/install/g}
1766 .endif
1767 .endif
1768
1769 .if !defined(WITHOUT_SSP)
1770 .include "${PORTSDIR}/Mk/bsd.ssp.mk"
1771 .endif
1772
1773 # XXX PIE support to be added here
1774 MAKE_ENV+= NO_PIE=yes
1775 # We prefer to pass MK_*=no but it was only supported after a certain
1776 # revision. Passing WITHOUT_* may conflict with a make.conf or src.conf's
1777 # WITH_* value. Note that ports *do* pull in src.conf.
1778 .if ${OSVERSION} >= 1003503
1779 # We will control debug files. Don't let builds that use /usr/share/mk
1780 # split out debug symbols since the plist won't know to expect it.
1781 MAKE_ENV+= MK_DEBUG_FILES=no
1782 MAKE_ENV+= MK_KERNEL_SYMBOLS=no
1783 .else
1784 MAKE_ENV+= WITHOUT_DEBUG_FILES=yes
1785 MAKE_ENV+= WITHOUT_KERNEL_SYMBOLS=yes
1786 .endif
1787
1788 CONFIGURE_SHELL?= ${SH}
1789 MAKE_SHELL?= ${SH}
1790
1791 CONFIGURE_ENV+= SHELL=${CONFIGURE_SHELL} CONFIG_SHELL=${CONFIGURE_SHELL}
1792 MAKE_ENV+= SHELL=${MAKE_SHELL} NO_LINT=YES
1793
1794 .if defined(PATCHFILES) && ${PATCHFILES:M*.zip}
1795 PATCH_DEPENDS+= ${LOCALBASE}/bin/unzip:archivers/unzip
1796 .endif
1797
1798 # Check the compatibility layer for amd64/ia64
1799
1800 .if ${ARCH} == "amd64" || ${ARCH} =="ia64"
1801 .if exists(/usr/lib32)
1802 HAVE_COMPAT_IA32_LIBS?= YES
1803 .endif
1804 .if !defined(HAVE_COMPAT_IA32_KERN)
1805 HAVE_COMPAT_IA32_KERN!= if ${SYSCTL} -n compat.ia32.maxvmem >/dev/null 2>&1; then echo YES; fi; echo
1806 .if empty(HAVE_COMPAT_IA32_KERN)
1807 .undef HAVE_COMPAT_IA32_KERN
1808 .endif
1809 .endif
1810 .endif
1811 _EXPORTED_VARS+= HAVE_COMPAT_IA32_KERN
1812
1813 .if defined(IA32_BINARY_PORT) && ${ARCH} != "i386"
1814 .if ${ARCH} == "amd64" || ${ARCH} == "ia64"
1815 .if !defined(HAVE_COMPAT_IA32_KERN)
1816 IGNORE= requires a kernel with compiled-in IA32 compatibility
1817 .elif !defined(HAVE_COMPAT_IA32_LIBS)
1818 IGNORE= requires 32-bit libraries installed under /usr/lib32
1819 .endif
1820 _LDCONFIG_FLAGS=-32
1821 LIB32DIR= lib32
1822 .else
1823 IGNORE= requires i386 (or compatible) platform to run
1824 .endif
1825 .else
1826 LIB32DIR= lib
1827 .endif
1828 PLIST_SUB+= LIB32DIR=${LIB32DIR}
1829
1830 .if ${WITH_PKG} == devel
1831 PKG_ORIGIN= ports-mgmt/pkg-devel
1832 .endif
1833
1834 .if !defined(PKG_DEPENDS) && !defined(CLEAN_FETCH_ENV)
1835 PKG_DEPENDS+= ${LOCALBASE}/sbin/pkg:${PKG_ORIGIN}
1836 .endif
1837
1838 .if defined(USE_GCC)
1839 .include "${PORTSDIR}/Mk/bsd.gcc.mk"
1840 .endif
1841
1842 .if defined(LLD_UNSAFE) && ${/usr/bin/ld:L:tA} == /usr/bin/ld.lld
1843 LDFLAGS+= -fuse-ld=bfd
1844 BINARY_ALIAS+= ld=${LD}
1845 . if !defined(USE_BINUTILS)
1846 . if exists(/usr/bin/ld.bfd)
1847 LD= /usr/bin/ld.bfd
1848 CONFIGURE_ENV+= LD=${LD}
1849 MAKE_ENV+= LD=${LD}
1850 . else
1851 USE_BINUTILS= yes
1852 . endif
1853 . endif
1854 .endif
1855
1856 .if defined(USE_BINUTILS) && !defined(DISABLE_BINUTILS)
1857 BUILD_DEPENDS+= ${LOCALBASE}/bin/as:devel/binutils
1858 BINUTILS?= ADDR2LINE AR AS CPPFILT GPROF LD NM OBJCOPY OBJDUMP RANLIB \
1859 READELF SIZE STRINGS
1860 BINUTILS_NO_MAKE_ENV?=
1861 . for b in ${BINUTILS}
1862 ${b}= ${LOCALBASE}/bin/${b:C/PP/++/:tl}
1863 . if defined(GNU_CONFIGURE) || defined(BINUTILS_CONFIGURE)
1864 CONFIGURE_ENV+= ${b}="${${b}}"
1865 . endif
1866 . if ${BINUTILS_NO_MAKE_ENV:M${b}} == ""
1867 MAKE_ENV+= ${b}="${${b}}"
1868 . endif
1869 . endfor
1870 .endif
1871
1872 .if defined(USE_OPENLDAP) || defined(WANT_OPENLDAP_VER)
1873 .include "${PORTSDIR}/Mk/bsd.ldap.mk"
1874 .endif
1875
1876 .if defined(USE_RC_SUBR)
1877 SUB_FILES+= ${USE_RC_SUBR}
1878 .endif
1879
1880 .if defined(USE_LDCONFIG) && ${USE_LDCONFIG:tl} == "yes"
1881 USE_LDCONFIG= ${PREFIX}/lib
1882 .endif
1883 .if defined(USE_LDCONFIG32) && ${USE_LDCONFIG32:tl} == "yes"
1884 IGNORE= has USE_LDCONFIG32 set to yes, which is not correct
1885 .endif
1886
1887 PKG_IGNORE_DEPENDS?= 'this_port_does_not_exist'
1888
1889 _GL_gbm_LIB_DEPENDS= libgbm.so:graphics/mesa-libs
1890 _GL_glesv2_BUILD_DEPENDS= ${LOCALBASE}/lib/libGLESv2.so:graphics/mesa-libs
1891 _GL_glesv2_RUN_DEPENDS= ${LOCALBASE}/lib/libGLESv2.so:graphics/mesa-libs
1892 _GL_egl_BUILD_DEPENDS= ${LOCALBASE}/lib/libEGL.so:graphics/mesa-libs
1893 _GL_egl_RUN_DEPENDS= ${LOCALBASE}/lib/libEGL.so:graphics/mesa-libs
1894 _GL_gl_BUILD_DEPENDS= ${LOCALBASE}/lib/libGL.so:graphics/mesa-libs
1895 _GL_gl_RUN_DEPENDS= ${LOCALBASE}/lib/libGL.so:graphics/mesa-libs
1896 _GL_gl_USE_XORG= glproto dri2proto dri3proto
1897 _GL_glew_LIB_DEPENDS= libGLEW.so:graphics/glew
1898 _GL_glu_LIB_DEPENDS= libGLU.so:graphics/libGLU
1899 _GL_glu_USE_XORG= glproto dri2proto dri3proto
1900 _GL_glw_LIB_DEPENDS= libGLw.so:graphics/libGLw
1901 _GL_glut_LIB_DEPENDS= libglut.so:graphics/freeglut
1902 .if defined(USE_GL)
1903 . if ${USE_GL:tl} == "yes"
1904 USE_GL= glu
1905 . endif
1906 . for _component in ${USE_GL}
1907 . if !defined(_GL_${_component}_LIB_DEPENDS) && \
1908 !defined(_GL_${_component}_RUN_DEPENDS)
1909 IGNORE= uses unknown GL component
1910 . else
1911 USE_XORG+= ${_GL_${_component}_USE_XORG}
1912 BUILD_DEPENDS+= ${_GL_${_component}_BUILD_DEPENDS}
1913 LIB_DEPENDS+= ${_GL_${_component}_LIB_DEPENDS}
1914 RUN_DEPENDS+= ${_GL_${_component}_RUN_DEPENDS}
1915 . endif
1916 . endfor
1917 .endif
1918
1919 .if defined(_DESTDIR_VIA_ENV)
1920 MAKE_ENV+= ${DESTDIRNAME}=${STAGEDIR}
1921 .else
1922 MAKE_ARGS+= ${DESTDIRNAME}=${STAGEDIR}
1923 .endif
1924
1925 .if defined(NO_PREFIX_RMDIR)
1926 CO_ENV+= NO_PREFIX_RMDIR=1
1927 .else
1928 CO_ENV+= NO_PREFIX_RMDIR=0
1929 .endif
1930
1931
1932 METADIR= ${WRKDIR}/.metadir
1933
1934 PKGPREINSTALL?= ${PKGDIR}/pkg-pre-install
1935 PKGPOSTINSTALL?= ${PKGDIR}/pkg-post-install
1936 PKGPREDEINSTALL?= ${PKGDIR}/pkg-pre-deinstall
1937 PKGPOSTDEINSTALL?= ${PKGDIR}/pkg-post-deinstall
1938 PKGPREUPGRADE?= ${PKGDIR}/pkg-pre-upgrade
1939 PKGPOSTUPGRADE?= ${PKGDIR}/pkg-post-upgrade
1940 PKGUPGRADE?= ${PKGDIR}/pkg-upgrade
1941
1942 _FORCE_POST_PATTERNS= rmdir kldxref mkfontscale mkfontdir fc-cache \
1943 fonts.dir fonts.scale gtk-update-icon-cache \
1944 gio-querymodules \
1945 gtk-query-immodules \
1946 ldconfig \
1947 load-octave-pkg \
1948 ocamlfind \
1949 update-desktop-database update-mime-database \
1950 gdk-pixbuf-query-loaders catalog.ports \
1951 glib-compile-schemas \
1952 ccache-update-links
1953
1954 .if defined(USE_LOCAL_MK)
1955 .include "${PORTSDIR}/Mk/bsd.local.mk"
1956 .endif
1957
1958 .if defined(USE_XORG) || defined(XORG_CAT)
1959 .include "${PORTSDIR}/Mk/bsd.xorg.mk"
1960 .endif
1961
1962 .if defined(WANT_GSTREAMER) || defined(USE_GSTREAMER) || defined(USE_GSTREAMER1)
1963 .include "${PORTSDIR}/Mk/bsd.gstreamer.mk"
1964 .endif
1965
1966 .if defined(USE_JAVA)
1967 .include "${PORTSDIR}/Mk/bsd.java.mk"
1968 .endif
1969
1970 .if defined(USE_OCAML)
1971 .include "${PORTSDIR}/Mk/bsd.ocaml.mk"
1972 .endif
1973
1974 .if defined(USE_QT4) || defined(USE_QT5)
1975 .include "${PORTSDIR}/Mk/bsd.qt.mk"
1976 .endif
1977
1978 .if defined(USE_SDL)
1979 .include "${PORTSDIR}/Mk/bsd.sdl.mk"
1980 .endif
1981
1982 .if defined(USE_PHP) && (!defined(USES) || ( defined(USES) && !${USES:Mphp*} ))
1983 DEV_WARNING+= "Using USE_PHP alone is deprecated, please use USES=php"
1984 _USES_POST+= php
1985 .endif
1986
1987 .if defined(USE_WX) || defined(USE_WX_NOT)
1988 .include "${PORTSDIR}/Mk/bsd.wx.mk"
1989 .endif
1990
1991 .if defined(USE_GECKO)
1992 .include "${PORTSDIR}/Mk/bsd.gecko.mk"
1993 .endif
1994
1995 .if exists(${PORTSDIR}/Makefile.inc)
1996 .include "${PORTSDIR}/Makefile.inc"
1997 USE_SUBMAKE= yes
1998 .endif
1999
2000 # Loading features
2001 .for f in ${_USES_POST}
2002 _f:= ${f:C/\:.*//}
2003 .if !defined(${_f}_ARGS)
2004 ${_f}_ARGS:= ${f:C/^[^\:]*(\:|\$)//:S/,/ /g}
2005 .endif
2006 .endfor
2007 .for f in ${_USES_POST}
2008 .include "${USESDIR}/${f:C/\:.*//}.mk"
2009 .endfor
2010
2011 .if defined(USE_LOCALE)
2012 CONFIGURE_ENV+= LANG=${USE_LOCALE} LC_ALL=${USE_LOCALE}
2013 MAKE_ENV+= LANG=${USE_LOCALE} LC_ALL=${USE_LOCALE}
2014 .endif
2015
2016 .if defined(USE_XORG)
2017 # Add explicit X options to avoid problems with false positives in configure
2018 .if defined(GNU_CONFIGURE)
2019 CONFIGURE_ARGS+=--x-libraries=${LOCALBASE}/lib --x-includes=${LOCALBASE}/include
2020 .endif
2021 .endif
2022
2023 # Macro for doing in-place file editing using regexps
2024 REINPLACE_ARGS?= -i.bak
2025 REINPLACE_CMD?= ${SED} ${REINPLACE_ARGS}
2026
2027 # Names of cookies used to skip already completed stages
2028 EXTRACT_COOKIE?= ${WRKDIR}/.extract_done.${PORTNAME}.${PREFIX:S/\//_/g}
2029 CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done.${PORTNAME}.${PREFIX:S/\//_/g}
2030 INSTALL_COOKIE?= ${WRKDIR}/.install_done.${PORTNAME}.${PREFIX:S/\//_/g}
2031 BUILD_COOKIE?= ${WRKDIR}/.build_done.${PORTNAME}.${PREFIX:S/\//_/g}
2032 PATCH_COOKIE?= ${WRKDIR}/.patch_done.${PORTNAME}.${PREFIX:S/\//_/g}
2033 PACKAGE_COOKIE?= ${WRKDIR}/.package_done.${PORTNAME}.${PREFIX:S/\//_/g}
2034 STAGE_COOKIE?= ${WRKDIR}/.stage_done.${PORTNAME}.${PREFIX:S/\//_/g}
2035
2036 # How to do nothing. Override if you, for some strange reason, would rather
2037 # do something.
2038 DO_NADA?= ${TRUE}
2039
2040 # Use this as the first operand to always build dependency.
2041 NONEXISTENT?= /nonexistent
2042
2043 CHECKSUM_ALGORITHMS?= sha256
2044
2045 DISTINFO_FILE?= ${MASTERDIR}/distinfo
2046
2047 MAKE_FLAGS?= -f
2048 MAKEFILE?= Makefile
2049 MAKE_CMD?= ${BSDMAKE}
2050 MAKE_ENV+= PREFIX=${PREFIX} \
2051 LOCALBASE=${LOCALBASE} \
2052 LIBDIR="${LIBDIR}" \
2053 CC="${CC}" CFLAGS="${CFLAGS}" \
2054 CPP="${CPP}" CPPFLAGS="${CPPFLAGS}" \
2055 LDFLAGS="${LDFLAGS}" LIBS="${LIBS}" \
2056 CXX="${CXX}" CXXFLAGS="${CXXFLAGS}" \
2057 MANPREFIX="${MANPREFIX}"
2058
2059 # Add -fno-strict-aliasing to CFLAGS with optimization level -O2 or higher.
2060 # gcc 4.x enable strict aliasing optimization with -O2 which is known to break
2061 # a lot of ports.
2062 .if !defined(WITHOUT_NO_STRICT_ALIASING)
2063 .if ${CC} != "icc"
2064 .if empty(CFLAGS:M-fno-strict-aliasing)
2065 CFLAGS+= -fno-strict-aliasing
2066 .endif
2067 .endif
2068 .endif
2069
2070 .for lang in C CXX
2071 .if defined(USE_${lang}STD)
2072 ${lang}FLAGS:= ${${lang}FLAGS:N-std=*} -std=${USE_${lang}STD}
2073 .endif
2074
2075 .if defined(${lang}FLAGS_${ARCH})
2076 ${lang}FLAGS+= ${${lang}FLAGS_${ARCH}}
2077 .endif
2078 .endfor
2079
2080 # Multiple make jobs support
2081 .if defined(DISABLE_MAKE_JOBS) || defined(MAKE_JOBS_UNSAFE)
2082 _MAKE_JOBS?= #
2083 MAKE_JOBS_NUMBER= 1
2084 .else
2085 .if defined(MAKE_JOBS_NUMBER)
2086 _MAKE_JOBS_NUMBER:= ${MAKE_JOBS_NUMBER}
2087 .else
2088 .if !defined(_SMP_CPUS)
2089 _SMP_CPUS!= ${SYSCTL} -n kern.smp.cpus
2090 .endif
2091 _EXPORTED_VARS+= _SMP_CPUS
2092 _MAKE_JOBS_NUMBER= ${_SMP_CPUS}
2093 .endif
2094 .if defined(MAKE_JOBS_NUMBER_LIMIT) && ( ${MAKE_JOBS_NUMBER_LIMIT} < ${_MAKE_JOBS_NUMBER} )
2095 MAKE_JOBS_NUMBER= ${MAKE_JOBS_NUMBER_LIMIT}
2096 .else
2097 MAKE_JOBS_NUMBER= ${_MAKE_JOBS_NUMBER}
2098 .endif
2099 _MAKE_JOBS?= -j${MAKE_JOBS_NUMBER}
2100 BUILD_FAIL_MESSAGE+= Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to the maintainer.
2101 .endif
2102
2103 .include "${PORTSDIR}/Mk/bsd.ccache.mk"
2104
2105 .if !make(makesum)
2106 FETCH_ENV?= SSL_NO_VERIFY_PEER=1 SSL_NO_VERIFY_HOSTNAME=1
2107 .endif
2108 FETCH_BINARY?= /usr/bin/fetch
2109 FETCH_ARGS?= -Fpr
2110 FETCH_REGET?= 1
2111 FETCH_CMD?= ${FETCH_BINARY} ${FETCH_ARGS}
2112
2113 .if defined(RANDOMIZE_MASTER_SITES)
2114 .if exists(/usr/games/random)
2115 RANDOM_CMD?= /usr/games/random
2116 .elif exists(/usr/bin/random)
2117 RANDOM_CMD?= /usr/bin/random
2118 .endif
2119 .if defined(RANDOM_CMD) && !empty(RANDOM_CMD)
2120 RANDOM_ARGS?= -w -f -
2121 _RANDOMIZE_SITES= ${RANDOM_CMD} ${RANDOM_ARGS}
2122 .endif
2123 .endif
2124
2125 TOUCH?= /usr/bin/touch
2126 TOUCH_FLAGS?= -f
2127
2128 DISTORIG?= .bak.orig
2129 PATCH?= /usr/bin/patch
2130 PATCH_STRIP?= -p0
2131 PATCH_DIST_STRIP?= -p0
2132 .if defined(PATCH_DEBUG)
2133 PATCH_DEBUG_TMP= yes
2134 PATCH_ARGS?= -E ${PATCH_STRIP}
2135 PATCH_DIST_ARGS?= --suffix ${DISTORIG} -E ${PATCH_DIST_STRIP}
2136 .else
2137 PATCH_ARGS?= --forward --quiet -E ${PATCH_STRIP}
2138 PATCH_DIST_ARGS?= --suffix ${DISTORIG} --forward --quiet -E ${PATCH_DIST_STRIP}
2139 .endif
2140 .if !defined(QUIET)
2141 PATCH_SILENT= PATCH_SILENT=yes
2142 .endif
2143 .if defined(BATCH)
2144 PATCH_ARGS+= --batch
2145 PATCH_DIST_ARGS+= --batch
2146 .endif
2147
2148 # Prevent breakage with VERSION_CONTROL=numbered
2149 PATCH_ARGS+= -V simple
2150 PATCH_DIST_ARGS+= -V simple
2151
2152 .if defined(PATCH_CHECK_ONLY)
2153 PATCH_ARGS+= -C
2154 PATCH_DIST_ARGS+= -C
2155 .endif
2156
2157 .if ${PATCH} == "/usr/bin/patch"
2158 PATCH_ARGS+= --suffix .orig
2159 PATCH_DIST_ARGS+= --suffix .orig
2160 .endif
2161
2162 TAR?= /usr/bin/tar
2163
2164 # EXTRACT_SUFX is defined in .pre.mk section
2165 EXTRACT_CMD?= ${TAR}
2166 EXTRACT_BEFORE_ARGS?= -xf
2167 EXTRACT_AFTER_ARGS?= --no-same-owner --no-same-permissions
2168
2169 # Figure out where the local mtree file is
2170 .if !defined(MTREE_FILE) && !defined(NO_MTREE)
2171 .if ${PREFIX} == /usr
2172 MTREE_FILE= /etc/mtree/BSD.usr.dist
2173 .else
2174 MTREE_FILE= ${PORTSDIR}/Templates/BSD.local.dist
2175 .endif
2176 .endif
2177 MTREE_CMD?= /usr/sbin/mtree
2178 MTREE_ARGS?= -U ${MTREE_FOLLOWS_SYMLINKS} -f ${MTREE_FILE} -d -e -p
2179
2180 _SHAREMODE?= 0644
2181
2182 # A few aliases for *-install targets
2183 INSTALL_PROGRAM= ${INSTALL} ${COPY} ${STRIP} -m ${BINMODE}
2184 INSTALL_KLD= ${INSTALL} ${COPY} -m ${BINMODE}
2185 INSTALL_LIB= ${INSTALL} ${COPY} ${STRIP} -m ${_SHAREMODE}
2186 INSTALL_SCRIPT= ${INSTALL} ${COPY} -m ${BINMODE}
2187 INSTALL_DATA= ${INSTALL} ${COPY} -m ${_SHAREMODE}
2188 INSTALL_MAN= ${INSTALL} ${COPY} -m ${MANMODE}
2189
2190 INSTALL_MACROS= BSD_INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
2191 BSD_INSTALL_LIB="${INSTALL_LIB}" \
2192 BSD_INSTALL_SCRIPT="${INSTALL_SCRIPT}" \
2193 BSD_INSTALL_DATA="${INSTALL_DATA}" \
2194 BSD_INSTALL_MAN="${INSTALL_MAN}"
2195 MAKE_ENV+= ${INSTALL_MACROS}
2196 SCRIPTS_ENV+= ${INSTALL_MACROS}
2197
2198 # Macro for copying entire directory tree with correct permissions
2199 # In the -exec shell commands, we add add a . as the first argument, it would
2200 # end up being $0 aka the script name, which is not part of $@, so we force it
2201 # to be able to use $@ directly.
2202 COPYTREE_BIN= ${SH} -c '(${FIND} -Ed $$1 $$3 | ${CPIO} -dumpl $$2 >/dev/null 2>&1) && \
2203 ${FIND} -Ed $$1 $$3 \( -type d -exec ${SH} -c '\''cd '\''$$2'\'' && chmod 755 "$$@"'\'' . {} + \
2204 -o -type f -exec ${SH} -c '\''cd '\''$$2'\'' && chmod ${BINMODE} "$$@"'\'' . {} + \)' COPYTREE_BIN
2205 COPYTREE_SHARE= ${SH} -c '(${FIND} -Ed $$1 $$3 | ${CPIO} -dumpl $$2 >/dev/null 2>&1) && \
2206 ${FIND} -Ed $$1 $$3 \( -type d -exec ${SH} -c '\''cd '\''$$2'\'' && chmod 755 "$$@"'\'' . {} + \
2207 -o -type f -exec ${SH} -c '\''cd '\''$$2'\'' && chmod ${_SHAREMODE} "$$@"'\'' . {} + \)' COPYTREE_SHARE
2208
2209 # The user can override the NO_PACKAGE by specifying this from
2210 # the make command line
2211 .if defined(FORCE_PACKAGE)
2212 .undef NO_PACKAGE
2213 .endif
2214
2215 DESCR?= ${PKGDIR}/pkg-descr
2216 PLIST?= ${PKGDIR}/pkg-plist
2217 PKGHELP?= ${PKGDIR}/pkg-help
2218 PKGINSTALL?= ${PKGDIR}/pkg-install
2219 PKGDEINSTALL?= ${PKGDIR}/pkg-deinstall
2220 PKGREQ?= ${PKGDIR}/pkg-req
2221 PKGMESSAGE?= ${PKGDIR}/pkg-message
2222 _PKGMESSAGES+= ${PKGMESSAGE}
2223
2224 TMPPLIST?= ${WRKDIR}/.PLIST.mktmp
2225
2226 .if defined(PKG_NOCOMPRESS)
2227 PKG_SUFX?= .tar
2228 .else
2229 PKG_SUFX?= .txz
2230 .endif
2231 # where pkg_add records its dirty deeds.
2232 PKG_DBDIR?= /var/db/pkg
2233
2234 ALL_TARGET?= all
2235 INSTALL_TARGET?= install
2236 INSTALL_TARGET+= ${LATE_INSTALL_ARGS}
2237
2238 # Integrate with the license auditing framework
2239 .if !defined (DISABLE_LICENSES)
2240 .include "${PORTSDIR}/Mk/bsd.licenses.mk"
2241 .endif
2242
2243 # Popular master sites
2244 .include "${PORTSDIR}/Mk/bsd.sites.mk"
2245
2246 # Empty declaration to avoid "variable MASTER_SITES recursive" error
2247 MASTER_SITES?=
2248 PATCH_SITES?=
2249 _MASTER_SITES_DEFAULT?=
2250 _PATCH_SITES_DEFAULT?=
2251
2252 # Feed internal _{MASTER,PATCH}_SITES_n where n is a group designation
2253 # as per grouping rules (:something)
2254 # Organize _{MASTER,PATCH}_SITES_{DEFAULT,[^/:]+} according to grouping
2255 # rules (:something)
2256 .for _S in ${MASTER_SITES}
2257 _S_TEMP= ${_S:S/^${_S:C@/?:[^/:]+$@/@}//:S/^://}
2258 . if !empty(_S_TEMP)
2259 . for _group in ${_S_TEMP:S/,/ /g}
2260 _G_TEMP= ${_group}
2261 . if ${_G_TEMP:C/[a-zA-Z0-9_]//g}
2262 check-makevars::
2263 @${ECHO_MSG} "The ${_S} MASTER_SITES line has"
2264 @${ECHO_MSG} "a group with invalid characters, only use [a-zA-Z0-9_]"
2265 @${FALSE}
2266 . endif
2267 . if ${_G_TEMP} == all || ${_G_TEMP} == ALL || ${_G_TEMP} == default
2268 check-makevars::
2269 @${ECHO_MSG} "Makefile error: the words all, ALL and default are reserved and cannot be"
2270 @${ECHO_MSG} "used in group definitions. Please fix your MASTER_SITES"
2271 @${FALSE}
2272 . endif
2273 _MASTER_SITES_${_group}+= ${_S:C@^(.*/):[^/:]+$@\1@}
2274 . endfor
2275 . else
2276 _MASTER_SITES_DEFAULT+= ${_S:C@^(.*/):[^/:]+$@\1@}
2277 . endif
2278 .endfor
2279 .for _S in ${PATCH_SITES}
2280 _S_TEMP= ${_S:S/^${_S:C@/:[^/:]+$@/@}//:S/^://}
2281 . if !empty(_S_TEMP)
2282 . for _group in ${_S_TEMP:S/,/ /g}
2283 _G_TEMP= ${_group}
2284 . if ${_G_TEMP:C/[a-zA-Z0-9_]//g}
2285 check-makevars::
2286 @${ECHO_MSG} "The ${_S} PATCH_SITES line has"
2287 @${ECHO_MSG} "a group with invalid characters, only use [a-zA-Z0-9_]"
2288 @${FALSE}
2289 . endif
2290 . if ${_G_TEMP} == all || ${_G_TEMP} == ALL || ${_G_TEMP} == default
2291 check-makevars::
2292 @${ECHO_MSG} "The words all, ALL and default are reserved and cannot be"
2293 @${ECHO_MSG} "used in group definitions. Please fix your PATCH_SITES"
2294 @${FALSE}
2295 . endif
2296 _PATCH_SITES_${_group}+= ${_S:C@^(.*/):[^/:]+$@\1@}
2297 . endfor
2298 . else
2299 _PATCH_SITES_DEFAULT+= ${_S:C@^(.*/):[^/:]+$@\1@}
2300 . endif
2301 .endfor
2302
2303 # Feed internal _{MASTER,PATCH}_SITE_SUBDIR_n where n is a group designation
2304 # as per grouping rules (:something)
2305 # Organize _{MASTER,PATCH}_SITE_SUBDIR_{DEFAULT,[^/:]+} according to grouping
2306 # rules (:something)
2307 .for _S in ${MASTER_SITE_SUBDIR}
2308 _S_TEMP= ${_S:S/^${_S:C@/:[^/:]+$@/@}//:S/^://}
2309 . if !empty(_S_TEMP)
2310 . for _group in ${_S_TEMP:S/,/ /g}
2311 _G_TEMP= ${_group}
2312 . if ${_G_TEMP} == all || ${_G_TEMP} == ALL || ${_G_TEMP} == default
2313 check-makevars::
2314 @${ECHO_MSG} "Makefile error: the words all, ALL and default are reserved and cannot be"
2315 @${ECHO_MSG} "used in group definitions. Please fix your MASTER_SITE_SUBDIR"
2316 @${FALSE}
2317 . endif
2318 . if defined(_MASTER_SITES_${_group})
2319 _MASTER_SITE_SUBDIR_${_group}+= ${_S:C@^(.*)/:[^/:]+$@\1@}
2320 . endif
2321 . endfor
2322 . else
2323 . if defined(_MASTER_SITES_DEFAULT)
2324 _MASTER_SITE_SUBDIR_DEFAULT+= ${_S:C@^(.*)/:[^/:]+$@\1@}
2325 . endif
2326 . endif
2327 .endfor
2328 .for _S in ${PATCH_SITE_SUBDIR}
2329 _S_TEMP= ${_S:S/^${_S:C@/:[^/:]+$@/@}//:S/^://}
2330 . if !empty(_S_TEMP)
2331 . for _group in ${_S_TEMP:S/,/ /g}
2332 _G_TEMP= ${_group}
2333 . if ${_G_TEMP} == all || ${_G_TEMP} == ALL || ${_G_TEMP} == default
2334 check-makevars::
2335 @${ECHO_MSG} "Makefile error: the words all, ALL and default are reserved and cannot be"
2336 @${ECHO_MSG} "used in group definitions. Please fix your PATCH_SITE_SUBDIR"
2337 @${FALSE}
2338 . endif
2339 . if defined(_PATCH_SITES_${_group})
2340 _PATCH_SITE_SUBDIR_${_group}+= ${_S:C@^(.*)/:[^/:]+$@\1@}
2341 . endif
2342 . endfor
2343 . else
2344 . if defined(_PATCH_SITES_DEFAULT)
2345 _PATCH_SITE_SUBDIR_DEFAULT+= ${_S:C@^(.*)/:[^/:]+$@\1@}
2346 . endif
2347 . endif
2348 .endfor
2349
2350 # Substitute subdirectory names
2351 # XXX simpler/faster solution but not the best space wise, suggestions please
2352 .for _S in ${MASTER_SITES}
2353 _S_TEMP= ${_S:S/^${_S:C@/:[^/:]+$@/@}//:S/^://}
2354 . if !empty(_S_TEMP)
2355 . for _group in ${_S_TEMP:S/,/ /g}
2356 . if !defined(_MASTER_SITE_SUBDIR_${_group})
2357 MASTER_SITES_TMP= ${_MASTER_SITES_${_group}:S^%SUBDIR%/^^}
2358 . else
2359 _S_TEMP_TEMP= ${_MASTER_SITES_${_group}:M*%SUBDIR%/*}
2360 . if empty(_S_TEMP_TEMP)
2361 MASTER_SITES_TMP= ${_MASTER_SITES_${_group}}
2362 . else
2363 MASTER_SITES_TMP=
2364 . for site in ${_MASTER_SITES_${_group}}
2365 _S_TEMP_TEMP= ${site:M*%SUBDIR%/*}
2366 . if empty(_S_TEMP_TEMP)
2367 MASTER_SITES_TMP+= ${site}
2368 . else
2369 . for dir in ${_MASTER_SITE_SUBDIR_${_group}}
2370 MASTER_SITES_TMP+= ${site:S^%SUBDIR%^\${dir}^}
2371 . endfor
2372 . endif
2373 . endfor
2374 . endif
2375 . endif
2376 _MASTER_SITES_${_group}:= ${MASTER_SITES_TMP}
2377 . endfor
2378 . endif
2379 .endfor
2380 .if defined(_MASTER_SITE_SUBDIR_DEFAULT)
2381 _S_TEMP= ${_MASTER_SITES_DEFAULT:M*%SUBDIR%/*}
2382 . if empty(_S_TEMP)
2383 MASTER_SITES_TMP= ${_MASTER_SITES_DEFAULT}
2384 . else
2385 MASTER_SITES_TMP=
2386 . for site in ${_MASTER_SITES_DEFAULT}
2387 _S_TEMP_TEMP= ${site:M*%SUBDIR%/*}
2388 . if empty(_S_TEMP_TEMP)
2389 MASTER_SITES_TMP+= ${site}
2390 . else
2391 . for dir in ${_MASTER_SITE_SUBDIR_DEFAULT}
2392 MASTER_SITES_TMP+= ${site:S^%SUBDIR%^\${dir}^}
2393 . endfor
2394 . endif
2395 . endfor
2396 . endif
2397 .else
2398 MASTER_SITES_TMP= ${_MASTER_SITES_DEFAULT:S^%SUBDIR%/^^}
2399 .endif
2400 _MASTER_SITES_DEFAULT:= ${MASTER_SITES_TMP}
2401 MASTER_SITES_TMP=
2402 .for _S in ${PATCH_SITES}
2403 _S_TEMP= ${_S:S/^${_S:C@/:[^/:]+$@/@}//:S/^://}
2404 . if !empty(_S_TEMP)
2405 . for _group in ${_S_TEMP:S/,/ /g}
2406 . if !defined(_PATCH_SITE_SUBDIR_${_group})
2407 PATCH_SITES_TMP= ${_PATCH_SITES_${_group}:S^%SUBDIR%/^^}
2408 . else
2409 _S_TEMP_TEMP= ${_PATCH_SITES_${_group}:M*%SUBDIR%/*}
2410 . if empty(_S_TEMP_TEMP)
2411 PATCH_SITES_TMP= ${_PATCH_SITES_${_group}}
2412 . else
2413 PATCH_SITES_TMP=
2414 . for site in ${_PATCH_SITES_${_group}}
2415 _S_TEMP_TEMP= ${site:M*%SUBDIR%/*}
2416 . if empty(_S_TEMP_TEMP)
2417 PATCH_SITES_TMP+= ${site}
2418 . else
2419 . for dir in ${_PATCH_SITE_SUBDIR_${_group}}
2420 PATCH_SITES_TMP+= ${site:S^%SUBDIR%^\${dir}^}
2421 . endfor
2422 . endif
2423 . endfor
2424 . endif
2425 . endif
2426 _PATCH_SITES_${_group}:= ${PATCH_SITES_TMP}
2427 . endfor
2428 . endif
2429 .endfor
2430 .if defined(_PATCH_SITE_SUBDIR_DEFAULT)
2431 _S_TEMP= ${_PATCH_SITES_DEFAULT:M*%SUBDIR%/*}
2432 . if empty(_S_TEMP)
2433 PATCH_SITES_TMP= ${_PATCH_SITES_DEFAULT}
2434 . else
2435 PATCH_SITES_TMP=
2436 . for site in ${_PATCH_SITES_DEFAULT}
2437 _S_TEMP_TEMP= ${site:M*%SUBDIR%/*}
2438 . if empty(_S_TEMP_TEMP)
2439 PATCH_SITES_TMP+= ${site}
2440 . else
2441 . for dir in ${_PATCH_SITE_SUBDIR_DEFAULT}
2442 PATCH_SITES_TMP+= ${site:S^%SUBDIR%^\${dir}^}
2443 . endfor
2444 . endif
2445 . endfor
2446 . endif
2447 .else
2448 PATCH_SITES_TMP= ${_PATCH_SITES_DEFAULT:S^%SUBDIR%/^^}
2449 .endif
2450 _PATCH_SITES_DEFAULT:= ${PATCH_SITES_TMP}
2451 PATCH_SITES_TMP=
2452
2453 # The primary backup site.
2454 MASTER_SITE_BACKUP?= \
2455 http://distcache.FreeBSD.org/ports-distfiles/${DIST_SUBDIR}/
2456 MASTER_SITE_BACKUP:= ${MASTER_SITE_BACKUP:S^\${DIST_SUBDIR}/^^}
2457
2458 # If the user has MASTER_SITE_FREEBSD set, go to the FreeBSD repository
2459 # for everything, but don't search it twice by appending it to the end.
2460 .if defined(MASTER_SITE_FREEBSD)
2461 _MASTER_SITE_OVERRIDE:= ${MASTER_SITE_BACKUP}
2462 _MASTER_SITE_BACKUP:= # empty
2463 .else
2464 _MASTER_SITE_OVERRIDE= ${MASTER_SITE_OVERRIDE}
2465 _MASTER_SITE_BACKUP= ${MASTER_SITE_BACKUP}
2466 .endif
2467
2468 NOFETCHFILES?=
2469
2470 # Organize DISTFILES, PATCHFILES, _MASTER_SITES_ALL, _PATCH_SITES_ALL
2471 # according to grouping rules (:something)
2472 DISTFILES?= ${DISTNAME}${EXTRACT_SUFX}
2473 _MASTER_SITES_ALL= ${_MASTER_SITES_DEFAULT}
2474 _PATCH_SITES_ALL= ${_PATCH_SITES_DEFAULT}
2475 _G_TEMP= DEFAULT
2476 .for _D in ${DISTFILES}
2477 _D_TEMP= ${_D:S/^${_D:C/:[^:]+$//}//}
2478 . if !empty(_D_TEMP)
2479 . for _group in ${_D_TEMP:S/^://:S/,/ /g}
2480 . if !defined(_MASTER_SITES_${_group})
2481 _G_TEMP_TEMP= ${_G_TEMP:M/${_group}/}
2482 . if empty(_G_TEMP_TEMP)
2483 _G_TEMP+= ${_group}
2484 _MASTER_SITES_ALL+= ${_MASTER_SITES_${_group}}
2485 . endif
2486 . endif
2487 . endfor
2488 _DISTFILES+= ${_D:C/:[^:]+$//}
2489 . else
2490 _DISTFILES+= ${_D}
2491 . endif
2492 .endfor
2493 _G_TEMP= DEFAULT
2494 .for _P in ${PATCHFILES}
2495 _P_TEMP= ${_P:C/:[^-:][^:]*$//}
2496 _P_groups= ${_P:S/^${_P:C/:[^:]+$//}//:S/^://}
2497 _P_file= ${_P_TEMP:C/:-[^:]+$//}
2498 _P_strip= ${_P_TEMP:S/^${_P_TEMP:C/:-[^:]*$//}//:S/^://}
2499 . if !empty(_P_groups)
2500 . for _group in ${_P_groups:S/,/ /g}
2501 . if !defined(_PATCH_SITES_${_group})
2502 _G_TEMP_TEMP= ${_G_TEMP:M/${_group}/}
2503 . if empty(_G_TEMP_TEMP)
2504 _G_TEMP+= ${_group}
2505 _PATCH_SITES_ALL+= ${_PATCH_SITES_${_group}}
2506 . endif
2507 . endif
2508 . endfor
2509 . endif
2510 _PATCHFILES:= ${_PATCHFILES} ${_P_file}
2511 . if empty(_P_strip)
2512 _PATCHFILES2:= ${_PATCHFILES2} ${_P_file}
2513 . else
2514 _PATCHFILES2:= ${_PATCHFILES2} ${_P_file}:${_P_strip}
2515 . endif
2516 .endfor
2517 _P_groups=
2518 _P_file=
2519 _P_strip=
2520 _G_TEMP=
2521 _G_TEMP_TEMP=
2522 ALLFILES?= ${_DISTFILES} ${_PATCHFILES}
2523
2524 #
2525 # Sort the master site list according to the patterns in MASTER_SORT
2526 #
2527 MASTER_SORT?=
2528 MASTER_SORT_REGEX?=
2529 MASTER_SORT_REGEX+= ${MASTER_SORT:S|.|\\.|g:S|^|://[^/]*|:S|$|/|}
2530
2531 MASTER_SORT_AWK= BEGIN { RS = " "; ORS = " "; IGNORECASE = 1 ; gl = "${MASTER_SORT_REGEX:S|\\|\\\\|g}"; }
2532 .for srt in ${MASTER_SORT_REGEX}
2533 MASTER_SORT_AWK+= /${srt:S|/|\\/|g}/ { good["${srt:S|\\|\\\\|g}"] = good["${srt:S|\\|\\\\|g}"] " " $$0 ; next; }
2534 .endfor
2535 MASTER_SORT_AWK+= { rest = rest " " $$0; } END { n=split(gl, gla); for(i=1;i<=n;i++) { print good[gla[i]]; } print rest; }
2536
2537 #
2538 # Hackery to enable simple fetch targets with several dynamic MASTER_SITES
2539 #
2540 _MASTER_SITES_ENV= _MASTER_SITES_DEFAULT=${_MASTER_SITES_DEFAULT:Q}
2541 .for _F in ${DISTFILES}
2542 _F_TEMP= ${_F:S/^${_F:C/:[^:]+$//}//:S/^://}
2543 . if !empty(_F_TEMP)
2544 . for _group in ${_F_TEMP:S/,/ /g}
2545 . if defined(_MASTER_SITES_${_group})
2546 _MASTER_SITES_ENV+= _MASTER_SITES_${_group}=${_MASTER_SITES_${_group}:Q}
2547 . endif
2548 . endfor
2549 . endif
2550 .endfor
2551 _PATCH_SITES_ENV= _PATCH_SITES_DEFAULT=${_PATCH_SITES_DEFAULT:Q}
2552 .for _F in ${PATCHFILES}
2553 _F_TEMP= ${_F:S/^${_F:C/:[^-:][^:]*$//}//:S/^://}
2554 . if !empty(_F_TEMP)
2555 . for _group in ${_F_TEMP:S/,/ /g}
2556 . if defined(_PATCH_SITES_${_group})
2557 _PATCH_SITES_ENV+= _PATCH_SITES_${_group}=${_PATCH_SITES_${_group}:Q}
2558 . endif
2559 . endfor
2560 . endif
2561 .endfor
2562
2563 CKSUMFILES= ${ALLFILES}
2564
2565 # List of all files, with ${DIST_SUBDIR} in front. Used for checksum.
2566 .if defined(DIST_SUBDIR)
2567 .if defined(CKSUMFILES) && ${CKSUMFILES}!=""
2568 _CKSUMFILES?= ${CKSUMFILES:S/^/${DIST_SUBDIR}\//}
2569 .endif
2570 .else
2571 _CKSUMFILES?= ${CKSUMFILES}
2572 .endif
2573
2574 # This is what is actually going to be extracted, and is overridable
2575 # by user.
2576 EXTRACT_ONLY?= ${_DISTFILES}
2577
2578 .if !target(maintainer)
2579 maintainer:
2580 @${ECHO_CMD} "${MAINTAINER}"
2581 .endif
2582
2583 .if !defined(CATEGORIES)
2584 check-categories:
2585 @${ECHO_MSG} "${PKGNAME}: Makefile error: CATEGORIES is mandatory."
2586 @${FALSE}
2587 .else
2588
2589 VALID_CATEGORIES+= accessibility afterstep arabic archivers astro audio \
2590 benchmarks biology cad chinese comms converters databases \
2591 deskutils devel docs dns editors elisp emulators enlightenment finance french ftp \
2592 games geography german gnome gnustep graphics hamradio haskell hebrew hungarian \
2593 ipv6 irc japanese java kde ${_KDE_CATEGORIES_SUPPORTED} kld korean lang linux lisp \
2594 mail mate math mbone misc multimedia net net-im net-mgmt net-p2p news \
2595 palm parallel pear perl5 plan9 polish portuguese ports-mgmt \
2596 print python ruby rubygems russian \
2597 scheme science security shells spanish sysutils \
2598 tcl textproc tk \
2599 ukrainian vietnamese windowmaker wayland www \
2600 x11 x11-clocks x11-drivers x11-fm x11-fonts x11-servers x11-themes \
2601 x11-toolkits x11-wm xfce zope base
2602
2603 check-categories:
2604 .for cat in ${CATEGORIES}
2605 . if empty(VALID_CATEGORIES:M${cat})
2606 @${ECHO_MSG} "${PKGNAME}: Makefile error: category ${cat} not in list of valid categories."; \
2607 ${FALSE};
2608 . endif
2609 .endfor
2610 .endif
2611
2612 PKGREPOSITORYSUBDIR?= All
2613 PKGREPOSITORY?= ${PACKAGES}/${PKGREPOSITORYSUBDIR}
2614 .if exists(${PACKAGES})
2615 PACKAGES:= ${PACKAGES:S/:/\:/g}
2616 _HAVE_PACKAGES= yes
2617 PKGFILE?= ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
2618 .else
2619 PKGFILE?= ${.CURDIR}/${PKGNAME}${PKG_SUFX}
2620 .endif
2621 WRKDIR_PKGFILE= ${WRKDIR}/pkg/${PKGNAME}${PKG_SUFX}
2622
2623 # The "latest version" link -- ${PKGNAME} minus everthing after the last '-'
2624 PKGLATESTREPOSITORY?= ${PACKAGES}/Latest
2625 PKGBASE?= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
2626 PKGLATESTFILE= ${PKGLATESTREPOSITORY}/${PKGBASE}${PKG_SUFX}
2627
2628 CONFIGURE_SCRIPT?= configure
2629 CONFIGURE_CMD?= ./${CONFIGURE_SCRIPT}
2630 CONFIGURE_TARGET?= ${ARCH}-portbld-${OPSYS:tl}${OSREL}
2631 CONFIGURE_TARGET:= ${CONFIGURE_TARGET:S/--build=//}
2632 CONFIGURE_LOG?= config.log
2633
2634 # A default message to print if do-configure fails.
2635 CONFIGURE_FAIL_MESSAGE?= "Please report the problem to ${MAINTAINER} [maintainer] and attach the \"${CONFIGURE_WRKSRC}/${CONFIGURE_LOG}\" including the output of the failure of your make command. Also, it might be a good idea to provide an overview of all packages installed on your system (e.g. a ${PKG_INFO} -Ea)."
2636
2637 CONFIG_SITE?= ${PORTSDIR}/Templates/config.site
2638 .if defined(GNU_CONFIGURE)
2639 # Maximum command line length
2640 .if !defined(CONFIGURE_MAX_CMD_LEN)
2641 CONFIGURE_MAX_CMD_LEN!= ${SYSCTL} -n kern.argmax
2642 .endif
2643 _EXPORTED_VARS+= CONFIGURE_MAX_CMD_LEN
2644 GNU_CONFIGURE_PREFIX?= ${PREFIX}
2645 GNU_CONFIGURE_MANPREFIX?= ${MANPREFIX}
2646 CONFIGURE_ARGS+= --prefix=${GNU_CONFIGURE_PREFIX} $${_LATE_CONFIGURE_ARGS}
2647 .if defined(CROSS_TOOLCHAIN)
2648 CROSS_HOST= ${CROSS_TOOLCHAIN:C,-.*$,,}-unknown-${OPSYS:tl}${OSREL}
2649 CONFIGURE_ARGS+= --host=${CROSS_HOST}
2650 .endif
2651 CONFIGURE_ENV+= CONFIG_SITE=${CONFIG_SITE} lt_cv_sys_max_cmd_len=${CONFIGURE_MAX_CMD_LEN}
2652 HAS_CONFIGURE= yes
2653
2654 SET_LATE_CONFIGURE_ARGS= \
2655 _LATE_CONFIGURE_ARGS="" ; \
2656 if [ -z "${CONFIGURE_ARGS:M--localstatedir=*:Q}" ] && \
2657 ${CONFIGURE_CMD} --help 2>&1 | ${GREP} -- --localstatedir > /dev/null; then \
2658 _LATE_CONFIGURE_ARGS="$${_LATE_CONFIGURE_ARGS} --localstatedir=/var" ; \
2659 fi ; \
2660 if [ ! -z "`${CONFIGURE_CMD} --help 2>&1 | ${GREP} -- '--mandir'`" ]; then \
2661 _LATE_CONFIGURE_ARGS="$${_LATE_CONFIGURE_ARGS} --mandir=${GNU_CONFIGURE_MANPREFIX}/man" ; \
2662 fi ; \
2663 if [ ! -z "`${CONFIGURE_CMD} --help 2>&1 | ${GREP} -- '--disable-silent-rules'`" ]; then \
2664 _LATE_CONFIGURE_ARGS="$${_LATE_CONFIGURE_ARGS} --disable-silent-rules" ; \
2665 fi ; \
2666 if [ ! -z "`${CONFIGURE_CMD} --help 2>&1 | ${GREP} -- '--enable-jobserver\[.*\#\]'`" ]; then \
2667 _LATE_CONFIGURE_ARGS="$${_LATE_CONFIGURE_ARGS} --enable-jobserver=${MAKE_JOBS_NUMBER}" ; \
2668 fi ; \
2669 if [ ! -z "`${CONFIGURE_CMD} --help 2>&1 | ${GREP} -- '--infodir'`" ]; then \
2670 _LATE_CONFIGURE_ARGS="$${_LATE_CONFIGURE_ARGS} --infodir=${GNU_CONFIGURE_PREFIX}/${INFO_PATH}/${INFO_SUBDIR}" ; \
2671 fi ; \
2672 if [ -z "`${CONFIGURE_CMD} --version 2>&1 | ${EGREP} -i '(autoconf.*2\.13|Unrecognized option)'`" ]; then \
2673 _LATE_CONFIGURE_ARGS="$${_LATE_CONFIGURE_ARGS} --build=${CONFIGURE_TARGET}" ; \
2674 else \
2675 _LATE_CONFIGURE_ARGS="$${_LATE_CONFIGURE_ARGS} ${CONFIGURE_TARGET}" ; \
2676 fi ;
2677 .endif
2678
2679 # Passed to most of script invocations
2680 SCRIPTS_ENV+= CURDIR=${MASTERDIR} DISTDIR=${DISTDIR} \
2681 WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} PATCHDIR=${PATCHDIR} \
2682 SCRIPTDIR=${SCRIPTDIR} FILESDIR=${FILESDIR} \
2683 PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} LOCALBASE=${LOCALBASE}
2684
2685 .if defined(BATCH)
2686 SCRIPTS_ENV+= BATCH=yes
2687 .endif
2688
2689 .if ${PREFIX} == /usr
2690 MANPREFIX?= /usr/share
2691 .else
2692 MANPREFIX?= ${PREFIX}
2693 .endif
2694
2695 MANDIRS+= ${MANPREFIX}/man
2696 .for sect in 1 2 3 4 5 6 7 8 9
2697 MAN${sect}PREFIX?= ${MANPREFIX}
2698 .endfor
2699 MANLPREFIX?= ${MANPREFIX}
2700 MANNPREFIX?= ${MANPREFIX}
2701
2702 .if ${PREFIX} == /usr
2703 INFO_PATH?= share/info
2704 .else
2705 INFO_PATH?= info
2706 .endif
2707
2708 .if defined(INFO)
2709 RUN_DEPENDS+= indexinfo:print/indexinfo
2710
2711 . for D in ${INFO:H}
2712 RD:= ${D}
2713 . if ${RD} != "."
2714 . if !defined(INFO_SUBDIR)
2715 INFO_SUBDIR:= ${RD}
2716 . elif ${INFO_SUBDIR} != ${RD}
2717 BROKEN= only one subdirectory in INFO is allowed
2718 . endif
2719 . endif
2720 .undef RD
2721 . endfor
2722 .endif
2723
2724 DOCSDIR_REL?= ${DOCSDIR:S,^${PREFIX}/,,}
2725 EXAMPLESDIR_REL?= ${EXAMPLESDIR:S,^${PREFIX}/,,}
2726 DATADIR_REL?= ${DATADIR:S,^${PREFIX}/,,}
2727 WWWDIR_REL?= ${WWWDIR:S,^${PREFIX}/,,}
2728 ETCDIR_REL?= ${ETCDIR:S,^${PREFIX}/,,}
2729
2730 PLIST_SUB+= DOCSDIR="${DOCSDIR_REL}" \
2731 EXAMPLESDIR="${EXAMPLESDIR_REL}" \
2732 DATADIR="${DATADIR_REL}" \
2733 WWWDIR="${WWWDIR_REL}" \
2734 ETCDIR="${ETCDIR_REL}"
2735
2736 DESKTOPDIR?= ${PREFIX}/share/applications
2737
2738 .MAIN: all
2739
2740 ################################################################
2741 # Many ways to disable a port.
2742 #
2743 # If we're in BATCH mode and the port is interactive, or we're
2744 # in interactive mode and the port is non-interactive, skip all
2745 # the important targets. The reason we have two modes is that
2746 # one might want to leave a build in BATCH mode running
2747 # overnight, then come back in the morning and do _only_ the
2748 # interactive ones that required your intervention.
2749 #
2750 # Ignore ports that can't be resold if building for a CDROM.
2751 #
2752 # Don't build a port if it's restricted and we don't want to get
2753 # into that.
2754 #
2755 # Don't build a port if it's broken, unless we're running a parallel
2756 # build (in case it's fixed).
2757 #
2758 # Don't build a port if it's forbidden for whatever reason.
2759 #
2760 # Don't build a port if the system is too old.
2761 ################################################################
2762
2763 # Check the machine architectures
2764 .if defined(ONLY_FOR_ARCHS)
2765 .for __ARCH in ${ONLY_FOR_ARCHS}
2766 .if ${ARCH:M${__ARCH}} != ""
2767 __ARCH_OK?= 1
2768 .endif
2769 .endfor
2770 .else
2771 __ARCH_OK?= 1
2772 .endif
2773
2774 .if defined(NOT_FOR_ARCHS)
2775 .for __NARCH in ${NOT_FOR_ARCHS}
2776 .if ${ARCH:M${__NARCH}} != ""
2777 .undef __ARCH_OK
2778 .endif
2779 .endfor
2780 .endif
2781
2782 .if !defined(__ARCH_OK)
2783 .if defined(ONLY_FOR_ARCHS)
2784 IGNORE= is only for ${ONLY_FOR_ARCHS},
2785 .else # defined(NOT_FOR_ARCHS)
2786 IGNORE= does not run on ${NOT_FOR_ARCHS},
2787 .endif
2788 IGNORE+= while you are running ${ARCH}
2789
2790 .if defined(ONLY_FOR_ARCHS_REASON_${ARCH})
2791 IGNORE+= (reason: ${ONLY_FOR_ARCHS_REASON_${ARCH}})
2792 .elif defined(ONLY_FOR_ARCHS_REASON)
2793 IGNORE+= (reason: ${ONLY_FOR_ARCHS_REASON})
2794 .endif
2795
2796 .if defined(NOT_FOR_ARCHS_REASON_${ARCH})
2797 IGNORE+= (reason: ${NOT_FOR_ARCHS_REASON_${ARCH}})
2798 .elif defined(NOT_FOR_ARCHS_REASON)
2799 IGNORE+= (reason: ${NOT_FOR_ARCHS_REASON})
2800 .endif
2801
2802 .endif
2803
2804 # Check the user interaction and legal issues
2805 .if !defined(NO_IGNORE)
2806 .if (defined(IS_INTERACTIVE) && defined(BATCH))
2807 IGNORE= is an interactive port
2808 .elif (!defined(IS_INTERACTIVE) && defined(INTERACTIVE))
2809 IGNORE= is not an interactive port
2810 .elif (defined(NO_CDROM) && defined(FOR_CDROM))
2811 IGNORE= may not be placed on a CDROM: ${NO_CDROM}
2812 .elif (defined(RESTRICTED) && defined(NO_RESTRICTED))
2813 IGNORE= is restricted: ${RESTRICTED}
2814 .elif (defined(NO_PACKAGE) && defined(PACKAGE_BUILDING))
2815 IGNORE= may not be packaged: ${NO_PACKAGE}
2816 .elif defined(IGNORE_${ARCH})
2817 IGNORE= ${IGNORE_${ARCH}}
2818 .elif defined(IGNORE_${OPSYS}_${OSREL:R}_${ARCH})
2819 IGNORE= ${IGNORE_${OPSYS}_${OSREL:R}_${ARCH}}
2820 .elif defined(IGNORE_${OPSYS}_${OSREL:R})
2821 IGNORE= ${IGNORE_${OPSYS}_${OSREL:R}}
2822 .elif defined(IGNORE_${OPSYS})
2823 IGNORE= ${IGNORE_${OPSYS}}
2824 .elif defined(BROKEN)
2825 .if !defined(TRYBROKEN)
2826 IGNORE= is marked as broken: ${BROKEN}
2827 .endif
2828 .elif defined(BROKEN_${ARCH})
2829 .if !defined(TRYBROKEN)
2830 IGNORE= is marked as broken on ${ARCH}: ${BROKEN_${ARCH}}
2831 .endif
2832 .elif defined(BROKEN_${OPSYS}_${OSREL:R}_${ARCH})
2833 .if !defined(TRYBROKEN)
2834 IGNORE= is marked as broken on ${OPSYS} ${OSREL} ${ARCH}: ${BROKEN_${OPSYS}_${OSREL:R}_${ARCH}}
2835 .endif
2836 .elif defined(BROKEN_${OPSYS}_${OSREL:R})
2837 .if !defined(TRYBROKEN)
2838 IGNORE= is marked as broken on ${OPSYS} ${OSREL}: ${BROKEN_${OPSYS}_${OSREL:R}}
2839 .endif
2840 .elif defined(BROKEN_${OPSYS})
2841 .if !defined(TRYBROKEN)
2842 IGNORE= is marked as broken on ${OPSYS}: ${BROKEN_${OPSYS}}
2843 .endif
2844 .elif defined(FORBIDDEN)
2845 IGNORE= is forbidden: ${FORBIDDEN}
2846 .endif
2847
2848 # Define the text to be output to LEGAL
2849 .if defined(LEGAL_TEXT)
2850 LEGAL= ${LEGAL_TEXT}
2851 .elif defined(RESTRICTED)
2852 LEGAL= ${RESTRICTED}
2853 .elif defined(NO_CDROM)
2854 LEGAL= ${NO_CDROM}
2855 .elif defined(NO_PACKAGE) && ! defined(LEGAL_PACKAGE)
2856 LEGAL= ${NO_PACKAGE}
2857 .endif
2858
2859 .if (defined(MANUAL_PACKAGE_BUILD) && defined(PACKAGE_BUILDING))
2860 IGNORE= has to be built manually: ${MANUAL_PACKAGE_BUILD}
2861 clean:
2862 @${IGNORECMD}
2863 .endif
2864
2865 .if defined(IGNORE)
2866 .if defined(IGNORE_SILENT)
2867 IGNORECMD= ${DO_NADA}
2868 .else
2869 IGNORECMD= ${ECHO_MSG} "===> ${PKGNAME} "${IGNORE:Q}. | ${FMT_80} ; exit 1
2870 .endif
2871
2872 _TARGETS= check-sanity fetch checksum extract patch configure all build \
2873 install reinstall test package stage restage
2874
2875 .for target in ${_TARGETS}
2876 .if !target(${target})
2877 ${target}:
2878 @${IGNORECMD}
2879 .if defined(INSTALLS_DEPENDS)
2880 @${FALSE}
2881 .endif
2882 .endif
2883 .endfor
2884
2885 .endif
2886
2887 .endif # !defined(NO_IGNORE)
2888
2889 ignorelist:
2890 .if defined(IGNORE) || defined(NO_PACKAGE)
2891 ignorelist: package-name
2892 .endif
2893
2894 ignorelist-verbose:
2895 .if defined(IGNORE)
2896 @${ECHO_CMD} "${PKGNAME}|IGNORE: "${IGNORE:Q}
2897 .elif defined(NO_PACKAGE)
2898 @${ECHO_CMD} "${PKGNAME}|NO_PACKAGE: "${NO_PACKAGE:Q}
2899 .endif
2900
2901 ################################################################
2902 # Clean directories for ftp or CDROM.
2903 ################################################################
2904
2905 .if !defined(LICENSE)
2906
2907 .if defined(RESTRICTED)
2908 clean-restricted: delete-distfiles delete-package
2909 clean-restricted-list: delete-distfiles-list delete-package-list
2910 RESTRICTED_FILES?= ${_DISTFILES} ${_PATCHFILES}
2911 .else
2912 clean-restricted:
2913 clean-restricted-list:
2914 .endif
2915
2916 .if defined(NO_CDROM)
2917 clean-for-cdrom: delete-distfiles delete-package
2918 clean-for-cdrom-list: delete-distfiles-list delete-package-list
2919 RESTRICTED_FILES?= ${_DISTFILES} ${_PATCHFILES}
2920 .else
2921 clean-for-cdrom:
2922 clean-for-cdrom-list:
2923 .endif
2924
2925 .endif # !defined(LICENSE)
2926
2927 .if defined(ALL_HOOK)
2928 all:
2929 @cd ${.CURDIR} && ${SETENV} CURDIR=${.CURDIR} DISTNAME=${DISTNAME} \
2930 DISTDIR=${DISTDIR} WRKDIR=${WRKDIR} WRKSRC=${WRKSRC} \
2931 PATCHDIR=${PATCHDIR} SCRIPTDIR=${SCRIPTDIR} \
2932 FILESDIR=${FILESDIR} PORTSDIR=${PORTSDIR} PREFIX=${PREFIX} \
2933 BUILD_DEPENDS="${BUILD_DEPENDS}" RUN_DEPENDS="${RUN_DEPENDS}" \
2934 CONFLICTS="${CONFLICTS}" \
2935 ${ALL_HOOK}
2936 .endif
2937
2938 .if !target(all)
2939 all: stage
2940 .endif
2941
2942 .if !defined(DEPENDS_TARGET)
2943 .if defined(DEPENDS_PRECLEAN)
2944 DEPENDS_TARGET= clean
2945 DEPENDS_ARGS= NOCLEANDEPENDS=yes
2946 .endif
2947 .if make(reinstall)
2948 DEPENDS_TARGET+= reinstall
2949 .else
2950 DEPENDS_TARGET+= install
2951 .endif
2952 .if defined(DEPENDS_CLEAN)
2953 DEPENDS_TARGET+= clean
2954 DEPENDS_ARGS+= NOCLEANDEPENDS=yes
2955 .endif
2956 .endif
2957
2958 .if defined(USE_GITLAB) && !${USE_GITLAB:Mnodefault} && empty(GL_COMMIT_DEFAULT)
2959 check-makevars::
2960 @${ECHO_MSG} "GL_COMMIT is a required 40 character hash for use USE_GITLAB"
2961 @${FALSE}
2962 .endif
2963
2964 ################################################################
2965 #
2966 # Do preliminary work to detect if we need to run the config
2967 # target or not.
2968 #
2969 ################################################################
2970 .if ((!defined(OPTIONS_DEFINE) && !defined(OPTIONS_SINGLE) && !defined(OPTIONS_MULTI)) \
2971 && !defined(OPTIONS_GROUP) && !defined(OPTIONS_RADIO) \
2972 || defined(CONFIG_DONE_${PKGBASE:tu}) || \
2973 defined(PACKAGE_BUILDING) || defined(BATCH))
2974 _OPTIONS_OK=yes
2975 .endif
2976
2977 ################################################################
2978 # The following are used to create easy dummy targets for
2979 # disabling some bit of default target behavior you don't want.
2980 # They still check to see if the target exists, and if so don't
2981 # do anything, since you might want to set this globally for a
2982 # group of ports in a Makefile.inc, but still be able to
2983 # override from an individual Makefile.
2984 ################################################################
2985
2986 # Disable build
2987 .if defined(NO_BUILD) && !target(build)
2988 build: configure
2989 @${TOUCH} ${TOUCH_FLAGS} ${BUILD_COOKIE}
2990 .endif
2991
2992 # Disable package
2993 .if defined(NO_PACKAGE) && !target(package)
2994 package:
2995 .if !defined(IGNORE_SILENT)
2996 @${ECHO_MSG} "===> ${PKGNAME} may not be packaged: "${NO_PACKAGE:Q}.
2997 .endif
2998 .endif
2999
3000 ################################################################
3001 # More standard targets start here.
3002 #
3003 # These are the body of the build/install framework. If you are
3004 # not happy with the default actions, and you can't solve it by
3005 # adding pre-* or post-* targets/scripts, override these.
3006 ################################################################
3007
3008 .if defined(TRYBROKEN) && defined(BROKEN)
3009 buildanyway-message:
3010 @${ECHO_MSG} "Trying build of ${PKGNAME} even though it is marked BROKEN."
3011 .endif
3012
3013 # Warn user about deprecated packages. Advisory only.
3014
3015 .if !target(check-deprecated)
3016 # Try and keep these messages in sync with the ones in Mk/Scripts/create-manifest.sh
3017 check-deprecated:
3018 .if ${MAINTAINER} == "ports@FreeBSD.org"
3019 @${ECHO_MSG} "===> NOTICE:"
3020 @${ECHO_MSG}
3021 @${ECHO_MSG} "The ${PORTNAME} port currently does not have a maintainer. As a result, it is"
3022 @${ECHO_MSG} "more likely to have unresolved issues, not be up-to-date, or even be removed in"
3023 @${ECHO_MSG} "the future. To volunteer to maintain this port, please create an issue at:"
3024 @${ECHO_MSG}
3025 @${ECHO_MSG} "https://bugs.freebsd.org/bugzilla"
3026 @${ECHO_MSG}
3027 @${ECHO_MSG} "More information about port maintainership is available at:"
3028 @${ECHO_MSG}
3029 @${ECHO_MSG} "https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port"
3030 @${ECHO_MSG}
3031 .endif
3032 .if defined(DEPRECATED)
3033 @${ECHO_MSG} "===> NOTICE:"
3034 @${ECHO_MSG}
3035 @${ECHO_MSG} "This port is deprecated; you may wish to reconsider installing it:"
3036 @${ECHO_MSG}
3037 @${ECHO_MSG} ${DEPRECATED:Q}.
3038 @${ECHO_MSG}
3039 .if defined(EXPIRATION_DATE)
3040 @${ECHO_MSG} "It is scheduled to be removed on or after ${EXPIRATION_DATE}."
3041 @${ECHO_MSG}
3042 .endif
3043 .endif
3044 .endif
3045
3046 # Check if the port is listed in the vulnerability database
3047
3048 AUDITFILE?= ${PKG_DBDIR}/vuln.xml
3049
3050 check-vulnerable:
3051 .if !defined(DISABLE_VULNERABILITIES) && !defined(PACKAGE_BUILDING) \
3052 && exists(${AUDITFILE})
3053 @${SETENV} \
3054 dp_ECHO_MSG="${ECHO_MSG}" \
3055 dp_PKG_BIN="${PKG_BIN}" \
3056 dp_PORTNAME="${PORTNAME}" \
3057 dp_PKGNAME="${PKGNAME}" \
3058 dp_SCRIPTSDIR="${SCRIPTSDIR}" \
3059 ${SH} ${SCRIPTSDIR}/check-vulnerable.sh
3060 .endif
3061
3062 # Quote simply quote all variables, except FETCH_ENV, some ports are creative
3063 # with it, and it needs to be quoted twice to pass through the echo/eval in
3064 # do-fetch.
3065 _DO_FETCH_ENV= \
3066 dp_DISABLE_SIZE='${DISABLE_SIZE}' \
3067 dp_DISTDIR='${_DISTDIR}' \
3068 dp_DISTINFO_FILE='${DISTINFO_FILE}' \
3069 dp_DIST_SUBDIR='${DIST_SUBDIR}' \
3070 dp_ECHO_MSG='${ECHO_MSG}' \
3071 dp_FETCH_AFTER_ARGS='${FETCH_AFTER_ARGS}' \
3072 dp_FETCH_BEFORE_ARGS='${FETCH_BEFORE_ARGS}' \
3073 dp_FETCH_CMD='${FETCH_CMD}' \
3074 dp_FETCH_ENV=${FETCH_ENV:Q} \
3075 dp_FORCE_FETCH_ALL='${FORCE_FETCH_ALL}' \
3076 dp_FORCE_FETCH_LIST='${FORCE_FETCH_LIST}' \
3077 dp_MASTER_SITE_BACKUP='${_MASTER_SITE_BACKUP}' \
3078 dp_MASTER_SITE_OVERRIDE='${_MASTER_SITE_OVERRIDE}' \
3079 dp_MASTER_SORT_AWK='${MASTER_SORT_AWK}' \
3080 dp_NO_CHECKSUM='${NO_CHECKSUM}' \
3081 dp_RANDOMIZE_SITES='${_RANDOMIZE_SITES}' \
3082 dp_SCRIPTSDIR='${SCRIPTSDIR}' \
3083 dp_TARGET='${.TARGET}'
3084 .if defined(DEVELOPER)
3085 _DO_FETCH_ENV+= dp_DEVELOPER=yes
3086 .else
3087 _DO_FETCH_ENV+= dp_DEVELOPER=
3088 .endif
3089
3090 # Fetch
3091
3092 .if !target(do-fetch)
3093 do-fetch:
3094 .if !empty(DISTFILES)
3095 @${SETENV} \
3096 ${_DO_FETCH_ENV} ${_MASTER_SITES_ENV} \
3097 dp_SITE_FLAVOR=MASTER \
3098 ${SH} ${SCRIPTSDIR}/do-fetch.sh ${DISTFILES:C/.*/'&'/}
3099 .endif
3100 .if defined(PATCHFILES) && !empty(PATCHFILES)
3101 @${SETENV} \
3102 ${_DO_FETCH_ENV} ${_PATCH_SITES_ENV} \
3103 dp_SITE_FLAVOR=PATCH \
3104 ${SH} ${SCRIPTSDIR}/do-fetch.sh ${PATCHFILES:C/:-p[0-9]//:C/.*/'&'/}
3105 .endif
3106 .endif
3107 #
3108 # Prints out a list of files to fetch (useful to do a batch fetch)
3109
3110 .if !target(fetch-list)
3111 fetch-list:
3112 .if !empty(DISTFILES)
3113 @${SETENV} \
3114 ${_DO_FETCH_ENV} ${_MASTER_SITES_ENV} \
3115 dp_SITE_FLAVOR=MASTER \
3116 ${SH} ${SCRIPTSDIR}/do-fetch.sh ${DISTFILES:C/.*/'&'/}
3117 .endif
3118 .if defined(PATCHFILES) && !empty(PATCHFILES)
3119 @${SETENV} \
3120 ${_DO_FETCH_ENV} ${_PATCH_SITES_ENV} \
3121 dp_SITE_FLAVOR=PATCH \
3122 ${SH} ${SCRIPTSDIR}/do-fetch.sh ${PATCHFILES:C/:-p[0-9]//:C/.*/'&'/}
3123 .endif
3124 .endif
3125
3126 # Used by fetch-urlall-list and fetch-url-list
3127
3128 .if !target(fetch-url-list-int)
3129 fetch-url-list-int:
3130 .if !empty(DISTFILES)
3131 @${SETENV} \
3132 ${_DO_FETCH_ENV} ${_MASTER_SITES_ENV} \
3133 dp_SITE_FLAVOR=MASTER \
3134 ${SH} ${SCRIPTSDIR}/do-fetch.sh ${DISTFILES:C/.*/'&'/}
3135 .endif
3136 .if defined(PATCHFILES) && !empty(PATCHFILES)
3137 @${SETENV} \
3138 ${_DO_FETCH_ENV} ${_PATCH_SITES_ENV} \
3139 dp_SITE_FLAVOR=PATCH \
3140 ${SH} ${SCRIPTSDIR}/do-fetch.sh ${PATCHFILES:C/:-p[0-9]//:C/.*/'&'/}
3141 .endif
3142 .endif
3143
3144 # Prints out all the URL for all the DISTFILES and PATCHFILES.
3145
3146 .if !target(fetch-urlall-list)
3147 fetch-urlall-list:
3148 @cd ${.CURDIR} && ${SETENV} FORCE_FETCH_ALL=yes ${MAKE} fetch-url-list-int
3149 .endif
3150
3151 # Prints the URL for all the DISTFILES and PATCHFILES that are not here
3152
3153 .if !target(fetch-url-list)
3154 fetch-url-list: fetch-url-list-int
3155 .endif
3156
3157
3158 # Extract
3159
3160 clean-wrkdir:
3161 @${RM} -r ${WRKDIR}
3162
3163 .if !target(do-extract)
3164 do-extract: ${EXTRACT_WRKDIR}
3165 @for file in ${EXTRACT_ONLY}; do \
3166 if ! (cd ${EXTRACT_WRKDIR} && ${EXTRACT_CMD} ${EXTRACT_BEFORE_ARGS} ${_DISTDIR}/$$file ${EXTRACT_AFTER_ARGS});\
3167 then \
3168 exit 1; \
3169 fi; \
3170 done
3171 @if [ ${UID} = 0 ]; then \
3172 ${CHMOD} -R ug-s ${WRKDIR}; \
3173 ${CHOWN} -R 0:0 ${WRKDIR}; \
3174 fi
3175 .endif
3176
3177 # Patch
3178
3179 .if !target(do-patch)
3180 do-patch:
3181 @${SETENV} \
3182 dp_BZCAT="${BZCAT}" \
3183 dp_CAT="${CAT}" \
3184 dp_DISTDIR="${_DISTDIR}" \
3185 dp_ECHO_MSG="${ECHO_MSG}" \
3186 dp_EXTRA_PATCHES="${EXTRA_PATCHES}" \
3187 dp_EXTRA_PATCH_TREE="${EXTRA_PATCH_TREE}" \
3188 dp_GZCAT="${GZCAT}" \
3189 dp_OPSYS="${OPSYS}" \
3190 dp_PATCH="${PATCH}" \
3191 dp_PATCHDIR="${PATCHDIR}" \
3192 dp_PATCHFILES="${_PATCHFILES2}" \
3193 dp_PATCH_ARGS=${PATCH_ARGS:Q} \
3194 dp_PATCH_DEBUG_TMP="${PATCH_DEBUG_TMP}" \
3195 dp_PATCH_DIST_ARGS="${PATCH_DIST_ARGS}" \
3196 dp_PATCH_SILENT="${PATCH_SILENT}" \
3197 dp_PATCH_WRKSRC=${PATCH_WRKSRC} \
3198 dp_PKGNAME="${PKGNAME}" \
3199 dp_PKGORIGIN="${PKGORIGIN}" \
3200 dp_SCRIPTSDIR="${SCRIPTSDIR}" \
3201 dp_UNZIP_NATIVE_CMD="${UNZIP_NATIVE_CMD}" \
3202 dp_XZCAT="${XZCAT}" \
3203 ${SH} ${SCRIPTSDIR}/do-patch.sh
3204 .endif
3205
3206 .if !target(run-autotools-fixup)
3207 run-autotools-fixup:
3208 # Work around an issue where FreeBSD 10.0 is detected as FreeBSD 1.x.
3209 .if !defined(WITHOUT_FBSD10_FIX)
3210 -@for f in `${FIND} ${WRKDIR} -type f \( -name config.libpath -o \
3211 -name config.rpath -o -name configure -o -name libtool.m4 -o \
3212 -name ltconfig -o -name libtool -o -name aclocal.m4 -o \
3213 -name acinclude.m4 \)` ; do \
3214 ${SED} -i.fbsd10bak \
3215 -e 's|freebsd1\*)|freebsd1.\*)|g' \
3216 -e 's|freebsd\[12\]\*)|freebsd[12].*)|g' \
3217 -e 's|freebsd\[123\]\*)|freebsd[123].*)|g' \
3218 -e 's|freebsd\[\[12\]\]\*)|freebsd[[12]].*)|g' \
3219 -e 's|freebsd\[\[123\]\]\*)|freebsd[[123]].*)|g' \
3220 $${f} ; \
3221 cmp -s $${f}.fbsd10bak $${f} || \
3222 ${ECHO_MSG} "===> FreeBSD 10 autotools fix applied to $${f}"; \
3223 ${TOUCH} ${TOUCH_FLAGS} -mr $${f}.fbsd10bak $${f} ; \
3224 ${RM} $${f}.fbsd10bak ; \
3225 done
3226 .endif
3227 .endif
3228
3229 # Configure
3230
3231 .if !target(do-configure)
3232 do-configure:
3233 @if [ -f ${SCRIPTDIR}/configure ]; then \
3234 cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
3235 ${SCRIPTDIR}/configure; \
3236 fi
3237 .if defined(GNU_CONFIGURE)
3238 @CONFIG_GUESS_DIRS=$$(${FIND} ${WRKDIR} -name config.guess -o -name config.sub \
3239 | ${XARGS} -n 1 ${DIRNAME}); \
3240 for _D in $${CONFIG_GUESS_DIRS}; do \
3241 ${RM} $${_D}/config.guess; \
3242 ${CP} ${TEMPLATES}/config.guess $${_D}/config.guess; \
3243 ${CHMOD} a+rx $${_D}/config.guess; \
3244 ${RM} $${_D}/config.sub; \
3245 ${CP} ${TEMPLATES}/config.sub $${_D}/config.sub; \
3246 ${CHMOD} a+rx $${_D}/config.sub; \
3247 done
3248 .endif
3249 .if defined(HAS_CONFIGURE)
3250 @${MKDIR} ${CONFIGURE_WRKSRC}
3251 @(cd ${CONFIGURE_WRKSRC} && \
3252 ${SET_LATE_CONFIGURE_ARGS} \
3253 if ! ${SETENV} CC="${CC}" CPP="${CPP}" CXX="${CXX}" \
3254 CFLAGS="${CFLAGS}" CPPFLAGS="${CPPFLAGS}" CXXFLAGS="${CXXFLAGS}" \
3255 LDFLAGS="${LDFLAGS}" LIBS="${LIBS}" \
3256 INSTALL="/usr/bin/install -c" \
3257 INSTALL_DATA="${INSTALL_DATA}" \
3258 INSTALL_LIB="${INSTALL_LIB}" \
3259 INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
3260 INSTALL_SCRIPT="${INSTALL_SCRIPT}" \
3261 ${CONFIGURE_ENV} ${CONFIGURE_CMD} ${CONFIGURE_ARGS}; then \
3262 ${ECHO_MSG} "===> Script \"${CONFIGURE_SCRIPT}\" failed unexpectedly."; \
3263 (${ECHO_CMD} ${CONFIGURE_FAIL_MESSAGE}) | ${FMT_80} ; \
3264 ${FALSE}; \
3265 fi)
3266 .endif
3267 .endif
3268
3269 # Build
3270 # XXX: ${MAKE_ARGS:N${DESTDIRNAME}=*} would be easier but it is not valid with the old fmake
3271 DO_MAKE_BUILD?= ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${_MAKE_JOBS} ${MAKE_ARGS:C,^${DESTDIRNAME}=.*,,g}
3272 .if !target(do-build)
3273 do-build:
3274 @(cd ${BUILD_WRKSRC}; if ! ${DO_MAKE_BUILD} ${ALL_TARGET}; then \
3275 if [ -n "${BUILD_FAIL_MESSAGE}" ] ; then \
3276 ${ECHO_MSG} "===> Compilation failed unexpectedly."; \
3277 (${ECHO_CMD} "${BUILD_FAIL_MESSAGE}") | ${FMT_80} ; \
3278 fi; \
3279 ${FALSE}; \
3280 fi)
3281 .endif
3282
3283 # Check conflicts
3284
3285 .if !target(check-conflicts)
3286 check-conflicts: check-build-conflicts check-install-conflicts
3287 .endif
3288
3289 .if !target(check-build-conflicts)
3290 check-build-conflicts:
3291 .if ( defined(CONFLICTS) || defined(CONFLICTS_BUILD) ) && !defined(DISABLE_CONFLICTS) && !defined(DEFER_CONFLICTS_CHECK)
3292 @conflicts_with=$$( \
3293 { ${PKG_QUERY} -g "%n-%v %p %o" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_BUILD:C/.+/'&'/} 2>/dev/null || : ; } \
3294 | while read pkgname prfx orgn; do \
3295 if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \
3296 ${ECHO_CMD} -n " $${pkgname}"; \
3297 fi; \
3298 done); \
3299 if [ -n "$${conflicts_with}" ]; then \
3300 ${ECHO_MSG}; \
3301 ${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \
3302 for entry in $${conflicts_with}; do \
3303 ${ECHO_MSG} " $${entry}"; \
3304 done; \
3305 ${ECHO_MSG}; \
3306 ${ECHO_MSG} " They will not build together."; \
3307 ${ECHO_MSG} " Please remove them first with pkg delete."; \
3308 exit 1;\
3309 fi
3310 .endif
3311 .endif
3312
3313 .if !target(identify-install-conflicts)
3314 identify-install-conflicts:
3315 .if ( defined(CONFLICTS) || defined(CONFLICTS_INSTALL) ) && !defined(DISABLE_CONFLICTS)
3316 @conflicts_with=$$( \
3317 { ${PKG_QUERY} -g "%n-%v %p %o" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_INSTALL:C/.+/'&'/} 2>/dev/null || : ; } \
3318 | while read pkgname prfx orgn; do \
3319 if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \
3320 ${ECHO_CMD} -n " $${pkgname}"; \
3321 fi; \
3322 done); \
3323 if [ -n "$${conflicts_with}" ]; then \
3324 ${ECHO_MSG}; \
3325 ${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \
3326 for entry in $${conflicts_with}; do \
3327 ${ECHO_MSG} " $${entry}"; \
3328 done; \
3329 ${ECHO_MSG}; \
3330 ${ECHO_MSG} " They install files into the same place."; \
3331 ${ECHO_MSG} " You may want to stop build with Ctrl + C."; \
3332 sleep 10; \
3333 fi
3334 .endif
3335 .endif
3336
3337 .if !target(check-install-conflicts)
3338 check-install-conflicts:
3339 .if ( defined(CONFLICTS) || defined(CONFLICTS_INSTALL) || ( defined(CONFLICTS_BUILD) && defined(DEFER_CONFLICTS_CHECK) ) ) && !defined(DISABLE_CONFLICTS)
3340 .if defined(DEFER_CONFLICTS_CHECK)
3341 @conflicts_with=$$( \
3342 { ${PKG_QUERY} -g "%n-%v %p %o" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_BUILD:C/.+/'&'/} ${CONFLICTS_INSTALL:C/.+/'&'/} 2>/dev/null || : ; } \
3343 | while read pkgname prfx orgn; do \
3344 if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \
3345 ${ECHO_CMD} -n " $${pkgname}"; \
3346 fi; \
3347 done); \
3348 if [ -n "$${conflicts_with}" ]; then \
3349 ${ECHO_MSG}; \
3350 ${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \
3351 for entry in $${conflicts_with}; do \
3352 ${ECHO_MSG} " $${entry}"; \
3353 done; \
3354 ${ECHO_MSG}; \
3355 ${ECHO_MSG} " Please remove them first with pkg delete."; \
3356 exit 1; \
3357 fi
3358 .else
3359 @conflicts_with=$$( \
3360 { ${PKG_QUERY} -g "%n-%v %p %o" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_INSTALL:C/.+/'&'/} 2>/dev/null || : ; } \
3361 | while read pkgname prfx orgn; do \
3362 if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \
3363 ${ECHO_CMD} -n " $${pkgname}"; \
3364 fi; \
3365 done); \
3366 if [ -n "$${conflicts_with}" ]; then \
3367 ${ECHO_MSG}; \
3368 ${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \
3369 for entry in $${conflicts_with}; do \
3370 ${ECHO_MSG} " $${entry}"; \
3371 done; \
3372 ${ECHO_MSG}; \
3373 ${ECHO_MSG} " They install files into the same place."; \
3374 ${ECHO_MSG} " Please remove them first with pkg delete."; \
3375 exit 1; \
3376 fi
3377 .endif # defined(DEFER_CONFLICTS_CHECK)
3378 .endif
3379 .endif
3380
3381 # Install
3382
3383 .if !target(do-install) && !defined(NO_INSTALL)
3384 do-install:
3385 @(cd ${INSTALL_WRKSRC} && ${SETENV} ${MAKE_ENV} ${FAKEROOT} ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${INSTALL_TARGET})
3386 .endif
3387
3388 # Test
3389
3390 .if !target(do-test) && defined(TEST_TARGET)
3391 DO_MAKE_TEST?= ${SETENV} ${TEST_ENV} ${MAKE_CMD} ${MAKE_FLAGS} ${MAKEFILE} ${TEST_ARGS:C,^${DESTDIRNAME}=.*,,g}
3392 do-test:
3393 @(cd ${TEST_WRKSRC}; if ! ${DO_MAKE_TEST} ${TEST_TARGET}; then \
3394 if [ -n "${TEST_FAIL_MESSAGE}" ] ; then \
3395 ${ECHO_MSG} "===> Tests failed unexpectedly."; \
3396 (${ECHO_CMD} "${TEST_FAIL_MESSAGE}") | ${FMT_80} ; \
3397 fi; \
3398 ${FALSE}; \
3399 fi)
3400 .endif
3401
3402 # Package
3403
3404 .if defined(_HAVE_PACKAGES)
3405 _EXTRA_PACKAGE_TARGET_DEP+= ${PKGFILE}
3406 _PORTS_DIRECTORIES+= ${PKGREPOSITORY}
3407
3408 ${PKGFILE}: ${WRKDIR_PKGFILE} ${PKGREPOSITORY}
3409 @${LN} -f ${WRKDIR_PKGFILE} ${PKGFILE} 2>/dev/null \
3410 || ${CP} -f ${WRKDIR_PKGFILE} ${PKGFILE}
3411
3412 . if ${PKGORIGIN} == "ports-mgmt/pkg" || ${PKGORIGIN} == "ports-mgmt/pkg-devel"
3413 _EXTRA_PACKAGE_TARGET_DEP+= ${PKGLATESTREPOSITORY}
3414 _PORTS_DIRECTORIES+= ${PKGLATESTREPOSITORY}
3415 _EXTRA_PACKAGE_TARGET_DEP+= ${PKGLATESTFILE}
3416
3417 ${PKGLATESTFILE}: ${PKGFILE} ${PKGLATESTREPOSITORY}
3418 ${INSTALL} -l rs ${PKGFILE} ${PKGLATESTFILE}
3419 . endif
3420
3421 .endif
3422
3423 # from here this will become a loop for subpackages
3424 ${WRKDIR_PKGFILE}: ${TMPPLIST} create-manifest ${WRKDIR}/pkg
3425 @if ! ${SETENV} ${PKG_ENV} FORCE_POST="${_FORCE_POST_PATTERNS}" ${PKG_CREATE} ${PKG_CREATE_ARGS} -m ${METADIR} -p ${TMPPLIST} -f ${PKG_SUFX:S/.//} -o ${WRKDIR}/pkg ${PKGNAME}; then \
3426 cd ${.CURDIR} && eval ${MAKE} delete-package >/dev/null; \
3427 exit 1; \
3428 fi
3429 #
3430 # Temporary will be later dynamically added per subpackages
3431 _EXTRA_PACKAGE_TARGET_DEP+= ${WRKDIR_PKGFILE}
3432 # This will be the end of the loop
3433
3434 .if !target(do-package)
3435 PKG_CREATE_ARGS= -r ${STAGEDIR}
3436 . if defined(PKG_CREATE_VERBOSE)
3437 PKG_CREATE_ARGS+= -v
3438 . endif
3439 do-package: ${_EXTRA_PACKAGE_TARGET_DEP} ${WRKDIR}/pkg
3440 .endif
3441
3442 .if !target(delete-package)
3443 delete-package:
3444 @${ECHO_MSG} "===> Deleting package for ${PKGNAME}"
3445 # When staging, the package may only be in the workdir if not root
3446 @${RM} ${PKGFILE} ${WRKDIR_PKGFILE} 2>/dev/null || :
3447 .endif
3448
3449 .if !target(delete-package-list)
3450 delete-package-list:
3451 @${ECHO_CMD} "[ -f ${PKGFILE} ] && (${ECHO_CMD} deleting ${PKGFILE}; ${RM} ${PKGFILE})"
3452 .endif
3453
3454 # Used by scripts and users to install a package from local repository.
3455 # Poudriere -i uses this, please keep.
3456 .if !target(install-package)
3457 .if defined(FORCE_PKG_REGISTER)
3458 _INSTALL_PKG_ARGS= -f
3459 .endif
3460 .if defined(INSTALLS_DEPENDS)
3461 _INSTALL_PKG_ARGS+= -A
3462 .endif
3463 install-package:
3464 @if [ -f "${WRKDIR}/pkg/${PKGNAME}${PKG_SUFX}" ]; then \
3465 _pkgfile="${WRKDIR_PKGFILE}"; \
3466 else \
3467 _pkgfile="${PKGFILE}"; \
3468 fi; \
3469 ${PKG_ADD} ${_INSTALL_PKG_ARGS} $${_pkgfile}
3470 .endif
3471
3472
3473 # Utility targets follow
3474
3475 .if !target(check-already-installed)
3476 .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER)
3477 check-already-installed:
3478 @${ECHO_MSG} "===> Checking if ${PKGBASE} already installed"; \
3479 pkgname=`${PKG_INFO} -q -O ${PKGBASE}`; \
3480 if [ -n "$${pkgname}" ]; then \
3481 v=`${PKG_VERSION} -t $${pkgname} ${PKGNAME}`; \
3482 if [ "$${v}" = "<" ]; then \
3483 ${ECHO_CMD} "===> An older version of ${PKGBASE} is already installed ($${pkgname})"; \
3484 else \
3485 ${ECHO_CMD} "===> ${PKGNAME} is already installed"; \
3486 fi; \
3487 ${ECHO_MSG} " You may wish to \`\`make deinstall'' and install this port again"; \
3488 ${ECHO_MSG} " by \`\`make reinstall'' to upgrade it properly."; \
3489 ${ECHO_MSG} " If you really wish to overwrite the old port of ${PKGBASE}"; \
3490 ${ECHO_MSG} " without deleting it first, set the variable \"FORCE_PKG_REGISTER\""; \
3491 ${ECHO_MSG} " in your environment or the \"make install\" command line."; \
3492 exit 1; \
3493 fi
3494 .endif
3495 .endif
3496
3497 .if !target(check-umask)
3498 check-umask:
3499 @if [ `${SH} -c umask` != 0022 ]; then \
3500 ${ECHO_MSG} "===> Warning: your umask is \"`${SH} -c umask`"\".; \
3501 ${ECHO_MSG} " If this is not desired, set it to an appropriate value"; \
3502 ${ECHO_MSG} " and install this port again by \`\`make reinstall''."; \
3503 fi
3504 .endif
3505
3506 # Needed for poudriere wait for at least a year before removing
3507 # XXX 2017-04-09
3508 .if !target(install-mtree)
3509 install-mtree:
3510 .endif
3511
3512 .if !target(install-ldconfig-file)
3513 install-ldconfig-file:
3514 . if defined(USE_LDCONFIG) || defined(USE_LDCONFIG32)
3515 . if defined(USE_LDCONFIG)
3516 . if !defined(USE_LINUX_PREFIX)
3517 . if ${USE_LDCONFIG} != "${LOCALBASE}/lib" && !defined(INSTALL_AS_USER)
3518 @${ECHO_MSG} "===> Installing ldconfig configuration file"
3519 . if defined(NO_MTREE) || ${PREFIX} != ${LOCALBASE}
3520 @${MKDIR} ${STAGEDIR}${LOCALBASE}/${LDCONFIG_DIR}
3521 . endif
3522 @${ECHO_CMD} ${USE_LDCONFIG} | ${TR} ' ' '\n' \
3523 > ${STAGEDIR}${LOCALBASE}/${LDCONFIG_DIR}/${PKGBASE}
3524 @${ECHO_CMD} ${LOCALBASE}/${LDCONFIG_DIR}/${PKGBASE} >> ${TMPPLIST}
3525 . if ${PREFIX} != ${LOCALBASE}
3526 @${ECHO_CMD} "@dir ${LOCALBASE}/${LDCONFIG_DIR}" >> ${TMPPLIST}
3527 . endif
3528 . endif
3529 . endif
3530 . endif
3531 . if defined(USE_LDCONFIG32)
3532 . if !defined(INSTALL_AS_USER)
3533 @${ECHO_MSG} "===> Installing 32-bit ldconfig configuration file"
3534 . if defined(NO_MTREE) || ${PREFIX} != ${LOCALBASE}
3535 @${MKDIR} ${STAGEDIR}${LOCALBASE}/${LDCONFIG32_DIR}
3536 . endif
3537 @${ECHO_CMD} ${USE_LDCONFIG32} | ${TR} ' ' '\n' \
3538 > ${STAGEDIR}${LOCALBASE}/${LDCONFIG32_DIR}/${PKGBASE}
3539 @${ECHO_CMD} ${LOCALBASE}/${LDCONFIG32_DIR}/${PKGBASE} >> ${TMPPLIST}
3540 . if ${PREFIX} != ${LOCALBASE}
3541 @${ECHO_CMD} "@dir ${LOCALBASE}/${LDCONFIG32_DIR}" >> ${TMPPLIST}
3542 . endif
3543 . endif
3544 . endif
3545 . endif
3546 .endif
3547
3548 .if !defined(USE_LINUX_PREFIX)
3549 . if !target(fixup-lib-pkgconfig)
3550 fixup-lib-pkgconfig:
3551 @if [ -d ${STAGEDIR}${PREFIX}/lib/pkgconfig ]; then \
3552 if [ -z "$$(${FIND} ${STAGEDIR}${PREFIX}/lib/pkgconfig -maxdepth 0 -empty)" ]; then \
3553 ${MKDIR} ${STAGEDIR}${PREFIX}/libdata/pkgconfig; \
3554 ${MV} ${STAGEDIR}${PREFIX}/lib/pkgconfig/* ${STAGEDIR}${PREFIX}/libdata/pkgconfig; \
3555 fi; \
3556 ${RMDIR} ${STAGEDIR}${PREFIX}/lib/pkgconfig; \
3557 fi
3558 . endif
3559 .endif
3560
3561 .if !target(create-users-groups)
3562 .if defined(GROUPS) || defined(USERS)
3563 _UG_INSTALL= ${WRKDIR}/users-groups-install.sh
3564 _UG_DEINSTALL= ${WRKDIR}/users-groups-deinstall.sh
3565 PKGPREINSTALL+= ${_UG_INSTALL}
3566 PKGPOSTDEINSTALL+= ${_UG_DEINSTALL}
3567 create-users-groups:
3568 @${SETENV} \
3569 dp_ECHO_MSG="${ECHO_MSG}" \
3570 dp_GID_FILES="${GID_FILES}" \
3571 dp_GID_OFFSET="${GID_OFFSET}" \
3572 dp_GROUPS_BLACKLIST="${GROUPS_BLACKLIST}" \
3573 dp_INSTALL="${INSTALL}" \
3574 dp_OPSYS="${OPSYS}" \
3575 dp_OSVERSION="${OSVERSION}" \
3576 dp_PREFIX="${PREFIX}" \
3577 dp_PW="${PW}" \
3578 dp_SCRIPTSDIR="${SCRIPTSDIR}" \
3579 dp_UG_DEINSTALL="${_UG_DEINSTALL}" \
3580 dp_UG_INSTALL="${_UG_INSTALL}" \
3581 dp_UID_FILES="${UID_FILES}" \
3582 dp_UID_OFFSET="${UID_OFFSET}" \
3583 dp_USERS_BLACKLIST="${USERS_BLACKLIST}" \
3584 ${SH} ${SCRIPTSDIR}/do-users-groups.sh "${USERS}" "${GROUPS}"
3585 .endif
3586 .endif
3587
3588 .if !defined(DISABLE_SECURITY_CHECK)
3589 .if !target(security-check)
3590 security-check: ${TMPPLIST}
3591 # Scan PLIST for:
3592 # 1. setugid files
3593 # 2. accept()/recvfrom() which indicates network listening capability
3594 # 3. insecure functions (gets/mktemp/tempnam/[XXX])
3595 # 4. startup scripts, in conjunction with 2.
3596 # 5. world-writable files/dirs
3597 #
3598 -@${RM} ${WRKDIR}/.PLIST.setuid ${WRKDIR}/.PLIST.writable ${WRKDIR}/.PLIST.objdump; \
3599 ${AWK} -v prefix='${PREFIX}' ' \
3600 match($$0, /^@cwd /) { prefix = substr($$0, RSTART + RLENGTH); if (prefix == "/") prefix=""; next; } \
3601 /^@/ { next; } \
3602 /^\// { print; next; } \
3603 { print prefix "/" $$0; } \
3604 ' ${TMPPLIST} > ${WRKDIR}/.PLIST.flattened; \
3605 ${TR} '\n' '\0' < ${WRKDIR}/.PLIST.flattened \
3606 | ${XARGS} -0 -J % ${FIND} % -prune ! -type l -type f \( -perm -4000 -o -perm -2000 \) \( -perm -0010 -o -perm -0001 \) 2> /dev/null > ${WRKDIR}/.PLIST.setuid; \
3607 ${TR} '\n' '\0' < ${WRKDIR}/.PLIST.flattened \
3608 | ${XARGS} -0 -J % ${FIND} % -prune -perm -0002 \! -type l 2> /dev/null > ${WRKDIR}/.PLIST.writable; \
3609 ${TR} '\n' '\0' < ${WRKDIR}/.PLIST.flattened \
3610 | ${XARGS} -0 -J % ${FIND} % -prune ! -type l -type f -print0 2> /dev/null \
3611 | ${XARGS} -0 -n 1 ${OBJDUMP} -R 2> /dev/null > ${WRKDIR}/.PLIST.objdump; \
3612 if \
3613 ! ${AWK} -v audit="$${PORTS_AUDIT}" -f ${SCRIPTSDIR}/security-check.awk \
3614 ${WRKDIR}/.PLIST.flattened ${WRKDIR}/.PLIST.objdump ${WRKDIR}/.PLIST.setuid ${WRKDIR}/.PLIST.writable; \
3615 then \
3616 www_site=$$(cd ${.CURDIR} && ${MAKE} www-site); \
3617 if [ ! -z "$${www_site}" ]; then \
3618 ${ECHO_MSG}; \
3619 ${ECHO_MSG} " For more information, and contact details about the security"; \
3620 ${ECHO_MSG} " status of this software, see the following webpage: "; \
3621 ${ECHO_MSG} "$${www_site}"; \
3622 fi; \
3623 fi
3624 .endif
3625 .else # i.e. defined(DISABLE_SECURITY_CHECK)
3626 security-check:
3627 @${ECHO_MSG} " WARNING: Security check has been disabled."
3628 .endif # !defined(DISABLE_SECURITY_CHECK)
3629
3630 ################################################################
3631 # Skeleton targets start here
3632 #
3633 # You shouldn't have to change these. Either add the pre-* or
3634 # post-* targets/scripts or redefine the do-* targets. These
3635 # targets don't do anything other than checking for cookies and
3636 # call the necessary targets/scripts.
3637 ################################################################
3638
3639 extract-message:
3640 @${ECHO_MSG} "===> Extracting for ${PKGNAME}"
3641 patch-message:
3642 @${ECHO_MSG} "===> Patching for ${PKGNAME}"
3643 configure-message:
3644 @${ECHO_MSG} "===> Configuring for ${PKGNAME}"
3645 build-message:
3646 @${ECHO_MSG} "===> Building for ${PKGNAME}"
3647 stage-message:
3648 @${ECHO_MSG} "===> Staging for ${PKGNAME}"
3649 install-message:
3650 @${ECHO_MSG} "===> Installing for ${PKGNAME}"
3651 test-message:
3652 @${ECHO_MSG} "===> Testing for ${PKGNAME}"
3653 package-message:
3654 @${ECHO_MSG} "===> Building package for ${PKGNAME}"
3655
3656 # Empty pre-* and post-* targets
3657
3658 .if exists(${SCRIPTDIR})
3659 .for stage in pre post
3660 .for name in pkg check-sanity fetch extract patch configure build stage install package
3661
3662 .if !target(${stage}-${name}-script)
3663 .if exists(${SCRIPTDIR}/${stage}-${name})
3664 ${stage}-${name}-script:
3665 @ cd ${.CURDIR} && ${SETENV} ${SCRIPTS_ENV} ${SH} \
3666 ${SCRIPTDIR}/${.TARGET:S/-script$//}
3667 .endif
3668 .endif
3669
3670 .endfor
3671 .endfor
3672 .endif
3673
3674 .if !target(pretty-print-www-site)
3675 pretty-print-www-site:
3676 @www_site=$$(cd ${.CURDIR} && ${MAKE} www-site); \
3677 if [ -n "$${www_site}" ]; then \
3678 ${ECHO_MSG} -n " and/or visit the "; \
3679 ${ECHO_MSG} -n "<a href=\"$${www_site}\">web site</a>"; \
3680 ${ECHO_MSG} " for further information"; \
3681 fi
3682 .endif
3683
3684 ################################################################
3685 # Some more targets supplied for users' convenience
3686 ################################################################
3687
3688 # Checkpatch
3689 #
3690 # Special target to verify patches
3691
3692 .if !target(checkpatch)
3693 checkpatch:
3694 @cd ${.CURDIR} && ${MAKE} ${PATCH_SILENT} PATCH_CHECK_ONLY=yes ${_PATCH_DEP} ${_PATCH_REAL_SEQ}
3695 .endif
3696
3697 # Reinstall
3698 #
3699 # Special target to re-run install
3700
3701 .if !target(reinstall)
3702 reinstall:
3703 @${RM} ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
3704 @cd ${.CURDIR} && DEPENDS_TARGET="${DEPENDS_TARGET}" ${MAKE} -DFORCE_PKG_REGISTER install
3705 .endif
3706
3707 .if !target(restage)
3708 restage:
3709 @${RM} -r ${STAGEDIR} ${STAGE_COOKIE} ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
3710 @cd ${.CURDIR} && ${MAKE} stage
3711 .endif
3712
3713 # Deinstall
3714 #
3715 # Special target to remove installation
3716
3717 .if !target(deinstall)
3718 deinstall:
3719 .if defined(UID) && ${UID} != 0 && !defined(INSTALL_AS_USER)
3720 @${ECHO_MSG} "===> Switching to root credentials for '${.TARGET}' target"
3721 @cd ${.CURDIR} && \
3722 ${SU_CMD} "${MAKE} ${.TARGET}"
3723 @${ECHO_MSG} "===> Returning to user credentials"
3724 .else
3725 @${ECHO_MSG} "===> Deinstalling for ${PKGBASE}"
3726 @if ${PKG_INFO} -e ${PKGBASE}; then \
3727 p=`${PKG_INFO} -q -O ${PKGBASE}`; \
3728 ${ECHO_MSG} "===> Deinstalling $${p}"; \
3729 ${PKG_DELETE} -f ${PKGBASE} ; \
3730 else \
3731 ${ECHO_MSG} "===> ${PKGBASE} not installed, skipping"; \
3732 fi
3733 @${RM} ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
3734 .endif
3735 .endif
3736
3737 # Deinstall-all
3738 #
3739 # Special target to remove installation of all ports of the same origin
3740
3741 .if !target(deinstall-all)
3742 deinstall-all:
3743 .if ${UID} != 0 && !defined(INSTALL_AS_USER)
3744 @${ECHO_MSG} "===> Switching to root credentials for '${.TARGET}' target"
3745 @cd ${.CURDIR} && \
3746 ${SU_CMD} "${MAKE} ${.TARGET}"
3747 @${ECHO_MSG} "===> Returning to user credentials"
3748 .else
3749 @${ECHO_MSG} "===> Deinstalling for ${PKGORIGIN}"
3750 @deinstall_names=`${PKG_INFO} -q -O ${PKGORIGIN}`; \
3751 for oldpkgorigin in $$(${GREP} "|${PKGORIGIN}|" ${PORTSDIR}/MOVED | ${CUT} -f 1 -d '|' | ${SORT} -u); do \
3752 deinstall_names="$${deinstall_names} $$(${PKG_INFO} -q -O $${oldpkgorigin})"; \
3753 done; \
3754 if [ -n "$${deinstall_names}" ]; then \
3755 for d in $${deinstall_names}; do \
3756 ${ECHO_MSG} "===> Deinstalling $${d}"; \
3757 ${PKG_DELETE} -f $${d}; \
3758 done; \
3759 else \
3760 ${ECHO_MSG} "===> ${PKGORIGIN} not installed, skipping"; \
3761 fi; \
3762 ${RM} ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
3763 .endif
3764 .endif
3765
3766 # Cleaning up
3767
3768 .if !target(do-clean)
3769 do-clean:
3770 @if [ -d ${WRKDIR} ]; then \
3771 if [ -w ${WRKDIR} ]; then \
3772 ${RM} -r ${WRKDIR}; \
3773 else \
3774 ${ECHO_MSG} "===> ${WRKDIR} not writable, skipping"; \
3775 fi; \
3776 fi
3777 .endif
3778
3779 .if !target(clean)
3780 pre-clean: clean-msg
3781 clean-msg:
3782 @${ECHO_MSG} "===> Cleaning for ${PKGNAME}"
3783
3784 .if empty(FLAVORS)
3785 CLEAN_DEPENDENCIES=
3786 .if !defined(NOCLEANDEPENDS)
3787 CLEAN_DEPENDENCIES+= limited-clean-depends-noflavor
3788 limited-clean-depends-noflavor:
3789 @cd ${.CURDIR} && ${MAKE} limited-clean-depends
3790 .endif
3791 .if target(pre-clean)
3792 CLEAN_DEPENDENCIES+= pre-clean-noflavor
3793 pre-clean-noflavor:
3794 @cd ${.CURDIR} && ${SETENV} ${MAKE} pre-clean
3795 .endif
3796 CLEAN_DEPENDENCIES+= do-clean-noflavor
3797 do-clean-noflavor:
3798 @cd ${.CURDIR} && ${SETENV} ${MAKE} do-clean
3799 .if target(post-clean)
3800 CLEAN_DEPENDENCIES+= post-clean-noflavor
3801 post-clean-noflavor:
3802 @cd ${.CURDIR} && ${SETENV} ${MAKE} post-clean
3803 .endif
3804 .ORDER: ${CLEAN_DEPENDENCIES}
3805 clean: ${CLEAN_DEPENDENCIES}
3806 .endif
3807
3808 .if !empty(_FLAVOR)
3809 _CLEANFLAVORS= ${_FLAVOR}
3810 .else
3811 _CLEANFLAVORS= ${FLAVORS}
3812 .endif
3813 .for _f in ${_CLEANFLAVORS}
3814 CLEAN_DEPENDENCIES=
3815 .if !defined(NOCLEANDEPENDS)
3816 CLEAN_DEPENDENCIES+= limited-clean-depends-${_f}
3817 limited-clean-depends-${_f}:
3818 @cd ${.CURDIR} && ${SETENV} FLAVOR=${_f} ${MAKE} limited-clean-depends
3819 .endif
3820 .if target(pre-clean)
3821 CLEAN_DEPENDENCIES+= pre-clean-${_f}
3822 pre-clean-${_f}:
3823 @cd ${.CURDIR} && ${SETENV} FLAVOR=${_f} ${MAKE} pre-clean
3824 .endif
3825 CLEAN_DEPENDENCIES+= do-clean-${_f}
3826 do-clean-${_f}:
3827 @cd ${.CURDIR} && ${SETENV} FLAVOR=${_f} ${MAKE} do-clean
3828 .if target(post-clean)
3829 CLEAN_DEPENDENCIES+= post-clean-${_f}
3830 post-clean-${_f}:
3831 @cd ${.CURDIR} && ${SETENV} FLAVOR=${_f} ${MAKE} post-clean
3832 .endif
3833 .ORDER: ${CLEAN_DEPENDENCIES}
3834 clean: ${CLEAN_DEPENDENCIES}
3835 .endfor
3836 .endif
3837
3838 .if !target(distclean)
3839 distclean: clean
3840 @cd ${.CURDIR} && ${MAKE} delete-distfiles RESTRICTED_FILES="${_DISTFILES:Q} ${_PATCHFILES:Q}"
3841 .endif
3842
3843 .if !target(delete-distfiles)
3844 delete-distfiles:
3845 @${ECHO_MSG} "===> Deleting distfiles for ${PKGNAME}"
3846 @(if [ "X${RESTRICTED_FILES}" != "X" -a -d ${_DISTDIR} ]; then \
3847 cd ${_DISTDIR}; \
3848 for file in ${RESTRICTED_FILES}; do \
3849 ${RM} $${file}; \
3850 dir=$${file%/*}; \
3851 if [ "$${dir}" != "$${file}" ]; then \
3852 ${RMDIR} -p $${dir} >/dev/null 2>&1 || :; \
3853 fi; \
3854 done; \
3855 fi)
3856 .if defined(DIST_SUBDIR)
3857 -@${RMDIR} ${_DISTDIR} >/dev/null 2>&1 || ${TRUE}
3858 .endif
3859 .endif
3860
3861 .if !target(delete-distfiles-list)
3862 delete-distfiles-list:
3863 @${ECHO_CMD} "# ${PKGNAME}"
3864 @if [ "X${RESTRICTED_FILES}" != "X" ]; then \
3865 for file in ${RESTRICTED_FILES}; do \
3866 ${ECHO_CMD} "[ -f ${_DISTDIR}/$$file ] && (${ECHO_CMD} deleting ${_DISTDIR}/$$file; ${RM} ${_DISTDIR}/$$file)"; \
3867 dir=$${file%/*}; \
3868 if [ "$${dir}" != "$${file}" ]; then \
3869 ${ECHO_CMD} "(cd ${_DISTDIR} && ${RMDIR} -p $${dir} 2>/dev/null)"; \
3870 fi; \
3871 done; \
3872 fi
3873 .if defined(DIST_SUBDIR)
3874 @${ECHO_CMD} "${RMDIR} ${_DISTDIR} 2>/dev/null || ${TRUE}"
3875 .endif
3876 .endif
3877
3878 # Generates patches.
3879
3880 update-patches:
3881 @toedit=`PATCH_WRKSRC=${PATCH_WRKSRC} \
3882 PATCHDIR=${PATCHDIR} \
3883 PATCH_LIST=${PATCHDIR}/patch-* \
3884 DIFF_ARGS=${DIFF_ARGS} \
3885 DISTORIG=${DISTORIG} \
3886 ${SH} ${PORTSDIR}/Tools/scripts/update-patches`; \
3887 case $$toedit in "");; \
3888 *) ${ECHO_CMD} -n 'edit patches: '; read i; \
3889 cd ${PATCHDIR} && $${VISUAL:-$${EDIT:-/usr/bin/vi}} $$toedit;; esac
3890
3891 # Checksumming utilities
3892
3893 # List all algorithms here, all the variables name must begin with dp_
3894 _CHECKSUM_INIT_ENV= \
3895 dp_SHA256=${SHA256}
3896
3897 .if !target(makesum)
3898 # Some port change the options with OPTIONS_*_FORCE when make(makesum) to be
3899 # able to add all distfiles in one go.
3900 # For this to work, we need to call the do-fetch script directly here so that
3901 # the options consistent when fetching and when makesum'ing.
3902 # As we're fetching new distfiles, that are not in the distinfo file, disable
3903 # checksum and sizes checks.
3904 makesum:
3905 .if !empty(DISTFILES)
3906 @${SETENV} \
3907 ${_DO_FETCH_ENV} ${_MASTER_SITES_ENV} \
3908 dp_NO_CHECKSUM=yes dp_DISABLE_SIZE=yes \
3909 dp_SITE_FLAVOR=MASTER \
3910 ${SH} ${SCRIPTSDIR}/do-fetch.sh ${DISTFILES:C/.*/'&'/}
3911 .endif
3912 .if defined(PATCHFILES) && !empty(PATCHFILES)
3913 @${SETENV} \
3914 ${_DO_FETCH_ENV} ${_PATCH_SITES_ENV} \
3915 dp_NO_CHECKSUM=yes dp_DISABLE_SIZE=yes \
3916 dp_SITE_FLAVOR=PATCH \
3917 ${SH} ${SCRIPTSDIR}/do-fetch.sh ${PATCHFILES:C/:-p[0-9]//:C/.*/'&'/}
3918 .endif
3919 @${SETENV} \
3920 ${_CHECKSUM_INIT_ENV} \
3921 dp_CHECKSUM_ALGORITHMS='${CHECKSUM_ALGORITHMS:tu}' \
3922 dp_CKSUMFILES='${_CKSUMFILES}' \
3923 dp_DISTDIR='${DISTDIR}' \
3924 dp_DISTINFO_FILE='${DISTINFO_FILE}' \
3925 dp_ECHO_MSG='${ECHO_MSG}' \
3926 dp_SCRIPTSDIR='${SCRIPTSDIR}' \
3927 ${SH} ${SCRIPTSDIR}/makesum.sh ${DISTFILES:C/.*/'&'/}
3928 .endif
3929
3930 .if !target(checksum)
3931 checksum: fetch
3932 .if !empty(_CKSUMFILES) && !defined(NO_CHECKSUM)
3933 @${SETENV} \
3934 ${_CHECKSUM_INIT_ENV} \
3935 dp_CHECKSUM_ALGORITHMS='${CHECKSUM_ALGORITHMS:tu}' \
3936 dp_CURDIR='${.CURDIR}' \
3937 dp_DISTDIR='${DISTDIR}' \
3938 dp_DISTINFO_FILE='${DISTINFO_FILE}' \
3939 dp_DIST_SUBDIR='${DIST_SUBDIR}' \
3940 dp_ECHO_MSG='${ECHO_MSG}' \
3941 dp_FETCH_REGET='${FETCH_REGET}' \
3942 dp_MAKE='${MAKE}' \
3943 dp_MAKEFLAGS='${.MAKEFLAGS}' \
3944 dp_SCRIPTSDIR='${SCRIPTSDIR}' \
3945 dp_DISABLE_SIZE='${DISABLE_SIZE}' \
3946 dp_NO_CHECKSUM='${NO_CHECKSUM}' \
3947 ${SH} ${SCRIPTSDIR}/checksum.sh ${_CKSUMFILES:C/.*/'&'/}
3948 .endif
3949 .endif
3950
3951 # Some port's archives contains files modes that are a bit too restrictive for
3952 # some usage. For example:
3953 # BUILD_DEPENDS= ${NONEXISTENT}:foo/bar:configure
3954 # When building as a regular user, dependencies are installed/built as root, so
3955 # if the archive contains files that have a mode of, say, 600, they will not be
3956 # readable by the port requesting the dependency.
3957 # This will also fix broken distribution files where directories don't have the
3958 # executable bit on.
3959 extract-fixup-modes:
3960 @${CHMOD} -R u+w,a+rX ${WRKDIR}
3961
3962 ################################################################
3963 # The special package-building targets
3964 # You probably won't need to touch these
3965 ################################################################
3966
3967 # Nobody should want to override this unless PKGNAME is simply bogus.
3968
3969 .if !target(package-name)
3970 package-name:
3971 @${ECHO_CMD} ${PKGNAME}
3972 .endif
3973
3974 # Build a package but don't check the package cookie
3975
3976 .if !target(repackage)
3977 repackage: pre-repackage package
3978
3979 pre-repackage:
3980 @${RM} ${PACKAGE_COOKIE}
3981 .endif
3982
3983 # Build a package but don't check the cookie for installation, also don't
3984 # install package cookie
3985
3986 .if !target(package-noinstall)
3987 package-noinstall: package
3988 .endif
3989
3990 ################################################################
3991 # Dependency checking
3992 ################################################################
3993
3994 .if !target(depends)
3995 depends: pkg-depends extract-depends patch-depends lib-depends fetch-depends build-depends run-depends
3996
3997 .for deptype in PKG EXTRACT PATCH FETCH BUILD LIB RUN TEST
3998 ${deptype:tl}-depends:
3999 .if defined(${deptype}_DEPENDS) && !defined(NO_DEPENDS)
4000 @${SETENV} \
4001 dp_RAWDEPENDS="${${deptype}_DEPENDS}" \
4002 dp_DEPTYPE="${deptype}_DEPENDS" \
4003 dp_DEPENDS_TARGET="${DEPENDS_TARGET}" \
4004 dp_DEPENDS_PRECLEAN="${DEPENDS_PRECLEAN}" \
4005 dp_DEPENDS_CLEAN="${DEPENDS_CLEAN}" \
4006 dp_DEPENDS_ARGS="${DEPENDS_ARGS}" \
4007 dp_USE_PACKAGE_DEPENDS="${USE_PACKAGE_DEPENDS}" \
4008 dp_USE_PACKAGE_DEPENDS_ONLY="${USE_PACKAGE_DEPENDS_ONLY}" \
4009 dp_PKG_ADD="${PKG_ADD}" \
4010 dp_PKG_INFO="${PKG_INFO}" \
4011 dp_WRKDIR="${WRKDIR}" \
4012 dp_PKGNAME="${PKGNAME}" \
4013 dp_STRICT_DEPENDS="${STRICT_DEPENDS}" \
4014 dp_LOCALBASE="${LOCALBASE}" \
4015 dp_LIB_DIRS="${LIB_DIRS}" \
4016 dp_SH="${SH}" \
4017 dp_SCRIPTSDIR="${SCRIPTSDIR}" \
4018 PORTSDIR="${PORTSDIR}" \
4019 dp_MAKE="${MAKE}" \
4020 dp_MAKEFLAGS='${.MAKEFLAGS}' \
4021 ${SH} ${SCRIPTSDIR}/do-depends.sh
4022 .endif
4023 .endfor
4024
4025 .endif
4026
4027 # Dependency lists: both build and runtime, recursive. Print out directory names.
4028
4029 _UNIFIED_DEPENDS=${PKG_DEPENDS} ${EXTRACT_DEPENDS} ${PATCH_DEPENDS} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS} ${RUN_DEPENDS} ${TEST_DEPENDS}
4030 _DEPEND_SPECIALS= ${_UNIFIED_DEPENDS:M*\:*\:*:C,^[^:]*:([^:]*):.*$,\1,}
4031
4032 .for d in ${_UNIFIED_DEPENDS:M*\:/*}
4033 _PORTSDIR_STR= $${PORTSDIR}/
4034 DEV_WARNING+= "It looks like the ${d} depends line has an absolute port origin, make sure to remove \$${_PORTSDIR_STR} from it."
4035 .endfor
4036
4037 all-depends-list:
4038 @${ALL-DEPENDS-LIST}
4039
4040 _FLAVOR_RECURSIVE_SH= \
4041 if [ -z "$${recursive_cmd}" ]; then \
4042 ${ECHO_MSG} "_FLAVOR_RECURSIVE_SH requires recursive_cmd to be set to the recursive make target to run." >&2; \
4043 ${FALSE}; \
4044 fi; \
4045 if [ "$${recursive_dirs-null}" = "null" ]; then \
4046 ${ECHO_MSG} "_FLAVOR_RECURSIVE_SH requires recursive_dirs to be set to the directories to recurse." >&2; \
4047 ${FALSE}; \
4048 fi; \
4049 for dir in $${recursive_dirs}; do \
4050 unset flavor; \
4051 case $${dir} in \
4052 *@*) \
4053 flavor=$${dir\#*@}; \
4054 dir=$${dir%@*}; \
4055 ;; \
4056 esac; \
4057 case $$dir in \
4058 /*) ;; \
4059 *) dir=${PORTSDIR}/$$dir ;; \
4060 esac; \
4061 (cd $$dir; ${SETENV} FLAVOR=$${flavor} ${MAKE} $${recursive_cmd}); \
4062 done
4063
4064 # This script is shared among several dependency list variables. See file for
4065 # usage.
4066 DEPENDS-LIST= \
4067 ${SETENV} \
4068 PORTSDIR="${PORTSDIR}" \
4069 dp_MAKE="${MAKE}" \
4070 dp_PKGNAME="${PKGNAME}" \
4071 dp_PKG_INFO="${PKG_INFO}" \
4072 dp_SCRIPTSDIR="${SCRIPTSDIR}" \
4073 ${SH} ${SCRIPTSDIR}/depends-list.sh \
4074 ${DEPENDS_SHOW_FLAVOR:D-f}
4075
4076 ALL-DEPENDS-LIST= ${DEPENDS-LIST} -r ${_UNIFIED_DEPENDS:Q}
4077 ALL-DEPENDS-FLAVORS-LIST= ${DEPENDS-LIST} -f -r ${_UNIFIED_DEPENDS:Q}
4078 MISSING-DEPENDS-LIST= ${DEPENDS-LIST} -m ${_UNIFIED_DEPENDS:Q}
4079 BUILD-DEPENDS-LIST= ${DEPENDS-LIST} "${PKG_DEPENDS} ${EXTRACT_DEPENDS} ${PATCH_DEPENDS} ${FETCH_DEPENDS} ${BUILD_DEPENDS} ${LIB_DEPENDS}"
4080 RUN-DEPENDS-LIST= ${DEPENDS-LIST} "${LIB_DEPENDS} ${RUN_DEPENDS}"
4081 TEST-DEPENDS-LIST= ${DEPENDS-LIST} ${TEST_DEPENDS:Q}
4082 CLEAN-DEPENDS-LIST= ${DEPENDS-LIST} -wr ${_UNIFIED_DEPENDS:Q}
4083 CLEAN-DEPENDS-LIMITED-LIST= ${DEPENDS-LIST} -w ${_UNIFIED_DEPENDS:Q}
4084
4085 .if !target(clean-depends)
4086 clean-depends:
4087 @for dir in $$(${CLEAN-DEPENDS-LIST}); do \
4088 (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean); \
4089 done
4090 .endif
4091
4092 .if !target(limited-clean-depends)
4093 limited-clean-depends:
4094 @for dir in $$(${CLEAN-DEPENDS-LIMITED-LIST}); do \
4095 (cd $$dir; ${MAKE} NOCLEANDEPENDS=yes clean); \
4096 done
4097 .endif
4098
4099 .if !target(deinstall-depends)
4100 deinstall-depends:
4101 @recursive_cmd="deinstall"; \
4102 recursive_dirs="$$(${ALL-DEPENDS-FLAVORS-LIST})"; \
4103 ${_FLAVOR_RECURSIVE_SH}
4104 .endif
4105
4106 .if !target(fetch-specials)
4107 fetch-specials:
4108 @${ECHO_MSG} "===> Fetching all distfiles required by ${PKGNAME} for building"
4109 @recursive_cmd="fetch"; \
4110 recursive_dirs="${_DEPEND_SPECIALS}"; \
4111 ${_FLAVOR_RECURSIVE_SH}
4112 .endif
4113
4114 .if !target(fetch-recursive)
4115 fetch-recursive:
4116 @${ECHO_MSG} "===> Fetching all distfiles for ${PKGNAME} and dependencies"
4117 @recursive_cmd="fetch"; \
4118 recursive_dirs="${.CURDIR} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
4119 ${_FLAVOR_RECURSIVE_SH}
4120 .endif
4121
4122 .if !target(fetch-recursive-list)
4123 fetch-recursive-list:
4124 @recursive_cmd="fetch-list"; \
4125 recursive_dirs="${.CURDIR} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
4126 ${_FLAVOR_RECURSIVE_SH}
4127 .endif
4128
4129 # Used by fetch-required and fetch-required list, this script looks
4130 # at each of the dependencies. If 3 items are specified in the tuple,
4131 # such as foo:graphics/foo:extract, the first item (foo)
4132 # is examined. Only if it begins with a / and does not exist on the
4133 # file-system will ``make targ'' proceed.
4134 # For more usual (dual-item) dependency tuples, the ``make targ''
4135 # proceeds, if the exact package, which the directory WOULD'VE installed,
4136 # is not yet installed.
4137 # This is the exact behaviour of the old code, and it may need
4138 # revisiting. For example, the entire first case seems dubious, and in
4139 # the second case we, probably, should be satisfied with _any_ (earlier)
4140 # package, with the same origin as that of the dir.
4141 #
4142 # -mi
4143 FETCH_LIST?= for i in $$deps; do \
4144 prog=$${i%%:*}; dir=$${i\#*:}; \
4145 case $$dir in \
4146 /*) ;; \
4147 *) dir=${PORTSDIR}/$$dir ;; \
4148 esac; \
4149 case $$dir in \
4150 *:*) if [ $$prog != $${prog\#/} -o ! -e $$prog ]; then \
4151 dir=$${dir%%:*}; \
4152 else \
4153 continue; \
4154 fi;; \
4155 *) if [ -d ${PKG_DBDIR}/$$(cd $$dir; ${MAKE} -V PKGNAME) ]; then \
4156 continue; \
4157 fi;; \
4158 esac; \
4159 echo cd $$dir; cd $$dir; ${MAKE} $$targ; \
4160 done
4161
4162 .if !target(fetch-required)
4163 fetch-required: fetch
4164 .if defined(NO_DEPENDS)
4165 @${ECHO_MSG} "===> NO_DEPENDS is set, not fetching any other distfiles for ${PKGNAME}"
4166 .else
4167 @${ECHO_MSG} "===> Fetching all required distfiles for ${PKGNAME} and dependencies"
4168 .for deptype in PKG EXTRACT PATCH FETCH BUILD RUN
4169 .if defined(${deptype}_DEPENDS)
4170 @targ=fetch; deps="${${deptype}_DEPENDS}"; ${FETCH_LIST}
4171 .endif
4172 .endfor
4173 .endif
4174
4175 .endif
4176
4177 .if !target(fetch-required-list)
4178 fetch-required-list: fetch-list
4179 .if !defined(NO_DEPENDS)
4180 .for deptype in PKG EXTRACT PATCH FETCH BUILD RUN
4181 .if defined(${deptype}_DEPENDS)
4182 @targ=fetch-list; deps="${${deptype}_DEPENDS}"; ${FETCH_LIST}
4183 .endif
4184 .endfor
4185 .endif
4186 .endif
4187
4188 .if !target(checksum-recursive)
4189 checksum-recursive:
4190 @${ECHO_MSG} "===> Fetching and checking checksums for ${PKGNAME} and dependencies"
4191 @recursive_cmd="checksum"; \
4192 recursive_dirs="${.CURDIR} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
4193 ${_FLAVOR_RECURSIVE_SH}
4194 .endif
4195
4196 # Dependency lists: build and runtime. Print out directory names.
4197
4198 build-depends-list:
4199 .if defined(PKG_DEPENDS) || defined(EXTRACT_DEPENDS) || defined(PATCH_DEPENDS) || defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || defined(LIB_DEPENDS)
4200 @${BUILD-DEPENDS-LIST}
4201 .endif
4202
4203 run-depends-list:
4204 .if defined(LIB_DEPENDS) || defined(RUN_DEPENDS)
4205 @${RUN-DEPENDS-LIST}
4206 .endif
4207
4208 test-depends-list:
4209 .if defined(TEST_DEPENDS)
4210 @${TEST-DEPENDS-LIST}
4211 .endif
4212
4213 # Package (recursive runtime) dependency list. Print out both directory names
4214 # and package names.
4215
4216 package-depends-list:
4217 .if defined(CHILD_DEPENDS) || defined(LIB_DEPENDS) || defined(RUN_DEPENDS)
4218 @${PACKAGE-DEPENDS-LIST}
4219 .endif
4220
4221 _LIB_RUN_DEPENDS= ${LIB_DEPENDS} ${RUN_DEPENDS}
4222 PACKAGE-DEPENDS-LIST?= \
4223 if [ "${CHILD_DEPENDS}" ]; then \
4224 installed=$$(${PKG_INFO} -qO ${PKGORIGIN} 2>/dev/null || \
4225 ${TRUE}); \
4226 if [ "$$installed" ]; then \
4227 break; \
4228 fi; \
4229 if [ -z "$$installed" ]; then \
4230 installed="${PKGNAME}"; \
4231 fi; \
4232 for pkgname in $$installed; do \
4233 ${ECHO_CMD} "$$pkgname ${.CURDIR} ${PKGORIGIN}"; \
4234 done; \
4235 fi; \
4236 checked="${PARENT_CHECKED}"; \
4237 for dir in ${_LIB_RUN_DEPENDS:C,[^:]*:([^:]*):?.*,\1,}; do \
4238 unset flavor; \
4239 case $${dir} in \
4240 *@*) \
4241 flavor=$${dir\#*@}; \
4242 dir=$${dir%@*}; \
4243 ;; \
4244 esac; \
4245 case "$$dir" in \
4246 /*) ;; \
4247 *) dir=${PORTSDIR}/$$dir ;; \
4248 esac ; \
4249 dir=$$(${REALPATH} $$dir); \
4250 if [ -d $$dir ]; then \
4251 case $$checked in \
4252 $$dir|$$dir\ *|*\ $$dir|*\ $$dir\ *) continue;; \
4253 esac; \
4254 childout=$$(cd $$dir; ${SETENV} FLAVOR=$${flavor} ${MAKE} CHILD_DEPENDS=yes PARENT_CHECKED="$$checked" package-depends-list); \
4255 set -- $$childout; \
4256 childdir=""; \
4257 while [ $$\# != 0 ]; do \
4258 childdir="$$childdir $$2"; \
4259 ${ECHO_CMD} "$$1 $$2 $$3"; \
4260 shift 3; \
4261 done; \
4262 checked="$$dir $$childdir $$checked"; \
4263 else \
4264 ${ECHO_MSG} "${PKGNAME}: \"$$dir\" non-existent -- dependency list incomplete" >&2; \
4265 fi; \
4266 done
4267
4268 ACTUAL-PACKAGE-DEPENDS?= \
4269 depfiles="" ; \
4270 for lib in ${LIB_DEPENDS:C/\:.*//}; do \
4271 depfiles="$$depfiles `${SETENV} LIB_DIRS="${LIB_DIRS}" LOCALBASE="${LOCALBASE}" ${SH} ${SCRIPTSDIR}/find-lib.sh $${lib}`" ; \
4272 done ; \
4273 ${SETENV} PKG_BIN="${PKG_BIN}" ${SH} ${SCRIPTSDIR}/actual-package-depends.sh $${depfiles} ${RUN_DEPENDS:C/(.*)\:.*/"\1"/}
4274
4275 PKG_NOTES_ENV?=
4276 .for note in ${PKG_NOTES}
4277 PKG_NOTES_ENV+= dp_PKG_NOTE_${note}=${PKG_NOTE_${note}:Q}
4278 .endfor
4279
4280 create-manifest:
4281 @${SETENV} \
4282 dp_SCRIPTSDIR='${SCRIPTSDIR}' \
4283 dp_ACTUAL_PACKAGE_DEPENDS='${ACTUAL-PACKAGE-DEPENDS}' \
4284 dp_CATEGORIES='${CATEGORIES:u:S/$/,/}' \
4285 dp_COMMENT=${COMMENT:Q} \
4286 dp_COMPLETE_OPTIONS_LIST='${COMPLETE_OPTIONS_LIST}' \
4287 dp_DEPRECATED=${DEPRECATED:Q} \
4288 dp_DESCR='${DESCR}' \
4289 dp_EXPIRATION_DATE='${EXPIRATION_DATE}' \
4290 dp_GROUPS='${GROUPS:u:S/$/,/}' \
4291 dp_LICENSE='${LICENSE:u:S/$/,/}' \
4292 dp_LICENSE_COMB='${LICENSE_COMB}' \
4293 dp_MAINTAINER='${MAINTAINER}' \
4294 dp_METADIR='${METADIR}' \
4295 dp_NO_ARCH='${NO_ARCH}' \
4296 dp_PKGBASE='${PKGBASE}' \
4297 dp_PKGDEINSTALL='${PKGDEINSTALL}' \
4298 dp_PKGINSTALL='${PKGINSTALL}' \
4299 dp_PKGMESSAGES='${_PKGMESSAGES}' \
4300 dp_PKGORIGIN='${PKGORIGIN}' \
4301 dp_PKGPOSTDEINSTALL='${PKGPOSTDEINSTALL}' \
4302 dp_PKGPOSTINSTALL='${PKGPOSTINSTALL}' \
4303 dp_PKGPOSTUPGRADE='${PKGPOSTUPGRADE}' \
4304 dp_PKGPREDEINSTALL='${PKGPREDEINSTALL}' \
4305 dp_PKGPREINSTALL='${PKGPREINSTALL}' \
4306 dp_PKGPREUPGRADE='${PKGPREUPGRADE}' \
4307 dp_PKGUPGRADE='${PKGUPGRADE}' \
4308 dp_PKGVERSION='${PKGVERSION}' \
4309 dp_PKG_BIN='${PKG_BIN}' \
4310 dp_PKG_IGNORE_DEPENDS='${PKG_IGNORE_DEPENDS}' \
4311 dp_PKG_NOTES='${PKG_NOTES}' \
4312 dp_PORT_OPTIONS='${PORT_OPTIONS}' \
4313 dp_PREFIX='${PREFIX}' \
4314 dp_USERS='${USERS:u:S/$/,/}' \
4315 dp_WWW='${WWW}' \
4316 ${PKG_NOTES_ENV} \
4317 ${SH} ${SCRIPTSDIR}/create-manifest.sh
4318
4319
4320 # Print out package names.
4321
4322 package-depends:
4323 @${PACKAGE-DEPENDS-LIST} | ${AWK} '{print $$1":"$$3}'
4324
4325 actual-package-depends:
4326 @${ACTUAL-PACKAGE-DEPENDS}
4327
4328 # Build packages for port and dependencies
4329
4330 package-recursive: package
4331 @recursive_cmd="package-noinstall"; \
4332 recursive_dirs="$$(${ALL-DEPENDS-FLAVORS-LIST})"; \
4333 ${_FLAVOR_RECURSIVE_SH}
4334
4335 # Show missing dependencies
4336 missing:
4337 @for dir in $$(${MISSING-DEPENDS-LIST}); do \
4338 echo $${dir#${PORTSDIR}/}; \
4339 done
4340
4341 # Show missing dependencies by name
4342 missing-packages:
4343 @_packages=$$(${PKG_INFO} -aq); \
4344 for dir in $$(${ALL-DEPENDS-LIST}); do \
4345 _p=$$(cd $$dir; ${MAKE} -VPKGNAME); \
4346 if ! $$(${ECHO_CMD} $${_packages} | ${GREP} -q $${_p}); then \
4347 ${ECHO_CMD} $${_p}; \
4348 fi; \
4349 done
4350
4351 ################################################################
4352 # Everything after here are internal targets and really
4353 # shouldn't be touched by anybody but the release engineers.
4354 ################################################################
4355
4356 # This target generates an index entry suitable for aggregation into
4357 # a large index. Format is:
4358 #
4359 # distribution-name|port-path|installation-prefix|comment| \
4360 # description-file|maintainer|categories|extract-depends| \
4361 # patch-depends|fetch-depends|build-depends|run-depends|www site
4362 #
4363 # If this ever changes, portmgr should contact the portsnap maintainer
4364 # first to avoid gratuitous breakage.
4365
4366 . if !target(describe)
4367 _EXTRACT_DEPENDS=${EXTRACT_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,}
4368 _PATCH_DEPENDS=${PATCH_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,}
4369 _FETCH_DEPENDS=${FETCH_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,}
4370 _LIB_DEPENDS=${LIB_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,}
4371 _BUILD_DEPENDS=${BUILD_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,} ${_LIB_DEPENDS}
4372 _RUN_DEPENDS=${RUN_DEPENDS:C/^[^ :]+:([^ :@]+)(@[^ :]+)?(:[^ :]+)?/\1/:O:u:C,(^[^/]),${PORTSDIR}/\1,} ${_LIB_DEPENDS}
4373 . if exists(${DESCR})
4374 _DESCR=${DESCR}
4375 . else
4376 _DESCR=/dev/null
4377 . endif
4378
4379 . if defined(BUILDING_INDEX) && defined(INDEX_PORTS)
4380 INDEX_OUT=${INDEX_TMPDIR}/${INDEXFILE}.desc.aggr
4381 . else
4382 INDEX_OUT=/dev/stdout
4383 . endif
4384
4385 . if empty(FLAVORS) || defined(_DESCRIBE_WITH_FLAVOR)
4386 describe:
4387 @(${ECHO_CMD} -n "${PKGNAME}|${.CURDIR}|${PREFIX}|"; \
4388 ${ECHO_CMD} -n ${COMMENT:Q}; \
4389 ${ECHO_CMD} -n "|${_DESCR}|${MAINTAINER}|${CATEGORIES}|${_EXTRACT_DEPENDS}|${_PATCH_DEPENDS}|${_FETCH_DEPENDS}|${_BUILD_DEPENDS:O:u}|${_RUN_DEPENDS:O:u}|"; \
4390 while read one two discard; do \
4391 case "$$one" in \
4392 WWW:) case "$$two" in \
4393 https://*|http://*|ftp://*) ${ECHO_CMD} -n "$$two" ;; \
4394 *) ${ECHO_CMD} -n "http://$$two" ;; \
4395 esac; \
4396 break; \
4397 ;; \
4398 esac; \
4399 done < ${DESCR}; ${ECHO_CMD}) >>${INDEX_OUT}
4400 . else # empty(FLAVORS)
4401 describe: ${FLAVORS:S/^/describe-/}
4402 . for f in ${FLAVORS}
4403 describe-${f}:
4404 @cd ${.CURDIR} && ${SETENV} FLAVOR=${f} ${MAKE} -B -D_DESCRIBE_WITH_FLAVOR describe
4405 . endfor
4406 . endif # empty(FLAVORS)
4407 . endif
4408
4409 www-site:
4410 .if exists(${DESCR})
4411 @${AWK} '$$1 ~ /^WWW:/ {print $$2}' ${DESCR} | ${HEAD} -1
4412 .else
4413 @${ECHO_CMD}
4414 .endif
4415
4416 .if !target(readmes)
4417 readmes: readme
4418 .endif
4419
4420 .if !target(readme)
4421 readme:
4422 @${RM} ${.CURDIR}/README.html
4423 @cd ${.CURDIR} && ${MAKE} ${.CURDIR}/README.html
4424 .endif
4425
4426 ${.CURDIR}/README.html:
4427 @${ECHO_MSG} "===> Creating README.html for ${PKGNAME}"
4428 @${SED} -e 's|%%PORT%%|'$$(${ECHO_CMD} ${.CURDIR} | \
4429 ${SED} -e 's|.*/\([^/]*/[^/]*\)$$|\1|')'|g' \
4430 -e 's|%%PKG%%|${PKGNAME}|g' \
4431 -e 's|%%COMMENT%%|'"$$(${ECHO_CMD} ${COMMENT:Q})"'|' \
4432 -e '/%%COMMENT%%/d' \
4433 -e 's|%%DESCR%%|'"$$(${ECHO_CMD} ${DESCR} | \
4434 ${SED} -e 's|${.CURDIR}/||')"'|' \
4435 -e 's|%%EMAIL%%|'"$$(${ECHO_CMD} "${MAINTAINER}" | \
4436 ${SED} -e 's/([^)]*)//;s/.*<//;s/>.*//')"'|g' \
4437 -e 's|%%MAINTAINER%%|${MAINTAINER}|g' \
4438 -e 's|%%WEBSITE%%|'"$$(cd ${.CURDIR} && eval ${MAKE} pretty-print-www-site)"'|' \
4439 -e 's|%%BUILD_DEPENDS%%|'"$$(cd ${.CURDIR} && eval ${MAKE} pretty-print-build-depends-list)"'|' \
4440 -e 's|%%RUN_DEPENDS%%|'"$$(cd ${.CURDIR} && eval ${MAKE} pretty-print-run-depends-list)"'|' \
4441 -e 's|%%TOP%%|'"$$(${ECHO_CMD} ${CATEGORIES} | \
4442 ${SED} -e 's| .*||' -e 's|[^/]*|..|g')"'/..|' \
4443 ${TEMPLATES}/README.port >> ${.TARGET}
4444
4445 # The following two targets require an up-to-date INDEX in ${PORTSDIR}
4446
4447 _PRETTY_PRINT_DEPENDS_LIST=\
4448 if [ ! -r ${INDEXDIR}/${INDEXFILE} ] ; then \
4449 ${ECHO_MSG} "${.TARGET} requires an INDEX file (${INDEXFILE}). Please run make index or make fetchindex."; \
4450 else \
4451 target=${.TARGET:C/pretty-print-(.*)-depends-list/\1/} ; \
4452 if [ "$$target" = "build" ] ; then fldnum=8 ; else fldnum=9 ; fi; \
4453 ${ECHO_MSG} -n 'This port requires package(s) "' ; \
4454 ${ECHO_MSG} -n `${AWK} -F\| "\\$$1 ~ /^${PKGNAME}/ {print \\$$$${fldnum};}" ${INDEXDIR}/${INDEXFILE}` ; \
4455 ${ECHO_MSG} "\" to $$target."; \
4456 fi;
4457
4458
4459 .if !target(pretty-print-build-depends-list)
4460 pretty-print-build-depends-list:
4461 .if defined(PKG_DEPENDS) || defined(EXTRACT_DEPENDS) || defined(PATCH_DEPENDS) || \
4462 defined(FETCH_DEPENDS) || defined(BUILD_DEPENDS) || defined(LIB_DEPENDS)
4463 @${_PRETTY_PRINT_DEPENDS_LIST}
4464 .endif
4465 .endif
4466
4467 .if !target(pretty-print-run-depends-list)
4468 pretty-print-run-depends-list:
4469 .if defined(RUN_DEPENDS) || defined(LIB_DEPENDS)
4470 @${_PRETTY_PRINT_DEPENDS_LIST}
4471 .endif
4472 .endif
4473
4474 _SUB_LIST_TEMP= ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/}
4475 .if !target(apply-slist)
4476 apply-slist:
4477 .if defined(SUB_FILES)
4478 .for file in ${SUB_FILES}
4479 .if !exists(${FILESDIR}/${file}.in)
4480 @${ECHO_MSG} "** Missing ${FILESDIR}/${file}.in for ${PKGNAME}."; exit 1
4481 .else
4482 @${SED} ${_SUB_LIST_TEMP} -e '/^@comment /d' ${FILESDIR}/${file}.in > ${WRKDIR}/${file}
4483 .endif
4484 .endfor
4485 .for i in pkg-message pkg-install pkg-deinstall pkg-req
4486 .if ${SUB_FILES:M${i}*}!=""
4487 ${i:S/-//:tu}= ${WRKDIR}/${SUB_FILES:M${i}*}
4488 .endif
4489 .endfor
4490 .endif
4491 .endif
4492
4493 # Generate packing list. Also tests to make sure all required package
4494 # files exist.
4495
4496 .if !target(generate-plist)
4497 generate-plist: ${WRKDIR}
4498 @${ECHO_MSG} "===> Generating temporary packing list"
4499 @${MKDIR} ${TMPPLIST:H}
4500 @if [ ! -f ${DESCR} ]; then ${ECHO_MSG} "** Missing pkg-descr for ${PKGNAME}."; exit 1; fi
4501 @>${TMPPLIST}
4502 @for file in ${PLIST_FILES}; do \
4503 ${ECHO_CMD} $${file} | ${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} >> ${TMPPLIST}; \
4504 done
4505 .if !empty(PLIST)
4506 @if [ -f ${PLIST} ]; then \
4507 ${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} ${PLIST} >> ${TMPPLIST}; \
4508 fi
4509 .endif
4510
4511 .for dir in ${PLIST_DIRS}
4512 @${ECHO_CMD} ${dir} | ${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} -e 's,^,@dir ,' >> ${TMPPLIST}
4513 .endfor
4514
4515 .if defined(USE_LINUX_PREFIX)
4516 .if defined(USE_LDCONFIG)
4517 @${ECHO_CMD} '@preexec [ -n "`/sbin/sysctl -q compat.linux.osrelease`" ] || ( echo "Cannot install package: kernel missing Linux support"; exit 1 )' >> ${TMPPLIST}
4518 @${ECHO_CMD} "@postexec ${LINUXBASE}/sbin/ldconfig" >> ${TMPPLIST}
4519 @${ECHO_CMD} "@postunexec ${LINUXBASE}/sbin/ldconfig" >> ${TMPPLIST}
4520 .endif
4521 .else
4522 .if defined(USE_LDCONFIG)
4523 .if !defined(INSTALL_AS_USER)
4524 @${ECHO_CMD} "@postexec ${LDCONFIG} -m ${USE_LDCONFIG}" >> ${TMPPLIST}
4525 @${ECHO_CMD} "@postunexec ${LDCONFIG} -R" >> ${TMPPLIST}
4526 .else
4527 @${ECHO_CMD} "@postexec ${LDCONFIG} -m ${USE_LDCONFIG} || ${TRUE}" >> ${TMPPLIST}
4528 @${ECHO_CMD} "@postunexec ${LDCONFIG} -R || ${TRUE}" >> ${TMPPLIST}
4529 .endif
4530 .endif
4531 .if defined(USE_LDCONFIG32)
4532 .if !defined(INSTALL_AS_USER)
4533 @${ECHO_CMD} "@postexec ${LDCONFIG} -32 -m ${USE_LDCONFIG32}" >> ${TMPPLIST}
4534 @${ECHO_CMD} "@postunexec ${LDCONFIG} -32 -R" >> ${TMPPLIST}
4535 .else
4536 @${ECHO_CMD} "@postexec ${LDCONFIG} -32 -m ${USE_LDCONFIG32} || ${TRUE}" >> ${TMPPLIST}
4537 @${ECHO_CMD} "@postunexec ${LDCONFIG} -32 -R || ${TRUE}" >> ${TMPPLIST}
4538 .endif
4539 .endif
4540 .endif
4541 .endif
4542
4543 ${TMPPLIST}:
4544 @cd ${.CURDIR} && ${MAKE} generate-plist
4545
4546 .for _type in EXAMPLES DOCS
4547 .if !target(add-plist-${_type:tl})
4548 .if defined(PORT${_type}) && !empty(PORT_OPTIONS:M${_type})
4549 add-plist-${_type:tl}:
4550 .for x in ${PORT${_type}}
4551 @if ${ECHO_CMD} "${x}"| ${AWK} '$$1 ~ /(\*|\||\[|\]|\?|\{|\}|\$$)/ { exit 1};'; then \
4552 if [ ! -e ${STAGEDIR}${${_type}DIR}/${x} ]; then \
4553 ${ECHO_CMD} ${${_type}DIR}/${x} >> ${TMPPLIST}; \
4554 fi;fi
4555 .endfor
4556 @${FIND} -P ${PORT${_type}:S/^/${STAGEDIR}${${_type}DIR}\//} ! -type d 2>/dev/null | \
4557 ${SED} -ne 's,^${STAGEDIR},,p' >> ${TMPPLIST}
4558 .endif
4559 .endif
4560 .endfor
4561
4562 .if !target(add-plist-data)
4563 .if defined(PORTDATA)
4564 add-plist-data:
4565 .for x in ${PORTDATA}
4566 @if ${ECHO_CMD} "${x}"| ${AWK} '$$1 ~ /(\*|\||\[|\]|\?|\{|\}|\$$)/ { exit 1};'; then \
4567 if [ ! -e ${STAGEDIR}${DATADIR}/${x} ]; then \
4568 ${ECHO_CMD} ${DATADIR}/${x} >> ${TMPPLIST}; \
4569 fi;fi
4570 .endfor
4571 @${FIND} -P ${PORTDATA:S/^/${STAGEDIR}${DATADIR}\//} ! -type d 2>/dev/null | \
4572 ${SED} -ne 's,^${STAGEDIR},,p' >> ${TMPPLIST}
4573 .endif
4574 .endif
4575
4576 .if !target(add-plist-info)
4577 .if defined(INFO)
4578 add-plist-info:
4579 .for i in ${INFO}
4580 @${LS} ${STAGEDIR}${PREFIX}/${INFO_PATH}/$i.info* | ${SED} -e s:${STAGEDIR}:@info\ :g >> ${TMPPLIST}
4581 .endfor
4582 .endif
4583 .endif
4584
4585 # If we're installing into a non-standard PREFIX, we need to remove that directory at
4586 # deinstall-time
4587 .if !target(add-plist-post)
4588 .if (${PREFIX} != ${LOCALBASE} && ${PREFIX} != ${LINUXBASE} && \
4589 ${PREFIX} != "/usr" && ${PREFIX} != "/" && !defined(NO_PREFIX_RMDIR))
4590 add-plist-post:
4591 @${ECHO_CMD} "@dir ${PREFIX}" >> ${TMPPLIST}
4592 .endif
4593 .endif
4594
4595 .if !target(install-rc-script)
4596 .if defined(USE_RC_SUBR)
4597 install-rc-script:
4598 @${ECHO_MSG} "===> Staging rc.d startup script(s)"
4599 @for i in ${USE_RC_SUBR}; do \
4600 _prefix=${PREFIX}; \
4601 [ "${PREFIX}" = "/usr" ] && _prefix="" ; \
4602 ${INSTALL_SCRIPT} ${WRKDIR}/$${i} ${STAGEDIR}$${_prefix}/etc/rc.d/$${i%.sh}; \
4603 ${ECHO_CMD} "$${_prefix}/etc/rc.d/$${i%.sh}" >> ${TMPPLIST}; \
4604 done
4605 .endif
4606 .endif
4607
4608 .if !target(check-man)
4609 check-man: stage
4610 @${ECHO_MSG} "====> Checking man pages (check-man)"
4611 @mdirs= ; \
4612 for dir in ${MANDIRS:S/^/${STAGEDIR}/} ; do \
4613 [ -d $$dir ] && mdirs="$$mdirs $$dir" ;\
4614 done ; \
4615 err=0 ; \
4616 for dir in $$mdirs; do \
4617 for f in $$(find $$dir -name "*.gz"); do \
4618 ${ECHO_CMD} "===> Checking $${f##*/}" ; \
4619 gunzip -c $$f | mandoc -Tlint -Werror && continue ; \
4620 err=1 ; \
4621 done ; \
4622 done ; \
4623 exit $$err
4624 .endif
4625
4626 # Compress all manpage not already compressed which are not hardlinks
4627 # Find all manpages which are not compressed and are hadlinks, and only get the list of inodes concerned, for each of them compress the first one found and recreate the hardlinks for the others
4628 # Fixes all dead symlinks left by the previous round
4629 .if !target(compress-man)
4630 compress-man:
4631 @${ECHO_MSG} "====> Compressing man pages (compress-man)"
4632 @mdirs= ; \
4633 for dir in ${MANDIRS:S/^/${STAGEDIR}/} ; do \
4634 [ -d $$dir ] && mdirs="$$mdirs $$dir" ;\
4635 done ; \
4636 for dir in $$mdirs; do \
4637 ${FIND} $$dir -type f \! -name "*.gz" -links 1 -exec ${GZIP_CMD} {} \; ; \
4638 ${FIND} $$dir -type f \! -name "*.gz" \! -links 1 -exec ${STAT} -f '%i' {} \; | \
4639 ${SORT} -u | while read inode ; do \
4640 unset ref ; \
4641 for f in $$(${FIND} $$dir -type f -inum $${inode} -print); do \
4642 if [ -z $$ref ]; then \
4643 ref=$${f}.gz ; \
4644 ${GZIP_CMD} $${f} ; \
4645 continue ; \
4646 fi ; \
4647 ${RM} $${f} ; \
4648 (cd $${f%/*}; ${LN} -f $${ref##*/} $${f##*/}.gz) ; \
4649 done ; \
4650 done ; \
4651 ${FIND} $$dir -type l \! -name "*.gz" | while read link ; do \
4652 ${LN} -sf $$(readlink $$link).gz $$link.gz ;\
4653 ${RM} $$link ; \
4654 done; \
4655 done
4656 .endif
4657
4658 .if !target(stage-dir)
4659 stage-dir: ${STAGEDIR}${PREFIX}
4660 .if !defined(NO_MTREE)
4661 @${MTREE_CMD} ${MTREE_ARGS} ${STAGEDIR}${PREFIX} > /dev/null
4662 .endif
4663 .endif
4664
4665 .if !target(makeplist)
4666 makeplist: stage
4667 @${SETENV} ${CO_ENV} ${SH} ${SCRIPTSDIR}/check-stagedir.sh makeplist
4668 .endif
4669
4670 .if !target(check-plist)
4671 check-plist: stage
4672 @${ECHO_MSG} "====> Checking for pkg-plist issues (check-plist)"
4673 @${SETENV} ${CO_ENV} ${SH} ${SCRIPTSDIR}/check-stagedir.sh checkplist
4674 @${ECHO_MSG} "===> No pkg-plist issues found (check-plist)"
4675 .endif
4676
4677 .if !target(check-orphans)
4678 check-orphans: check-plist
4679 .endif
4680
4681 .if !target(stage-qa)
4682 stage-qa:
4683 @${ECHO_MSG} "====> Running Q/A tests (stage-qa)"
4684 @${SETENV} ${QA_ENV} ${SH} ${SCRIPTSDIR}/qa.sh
4685 .if !defined(DEVELOPER)
4686 @${ECHO_MSG} "/!\\ To run stage-qa automatically add DEVELOPER=yes to your environment /!\\"
4687 .endif
4688 .endif
4689
4690 pretty-flavors-package-names: .PHONY
4691 .if empty(FLAVORS)
4692 @${ECHO_CMD} "no flavor: ${PKGNAME}"
4693 .else
4694 .for f in ${FLAVORS}
4695 @${ECHO_CMD} -n "${f}: "
4696 @cd ${.CURDIR} && ${SETENV} FLAVOR=${f} ${MAKE} -B -V PKGNAME
4697 .endfor
4698 .endif
4699
4700 flavors-package-names: .PHONY
4701 .if empty(FLAVORS)
4702 @${ECHO_CMD} "${PKGNAME}"
4703 .else
4704 .for f in ${FLAVORS}
4705 @cd ${.CURDIR} && ${SETENV} FLAVOR=${f} ${MAKE} -B -V PKGNAME
4706 .endfor
4707 .endif
4708
4709 # Fake installation of package so that user can pkg delete it later.
4710 .if !target(fake-pkg)
4711 STAGE_ARGS= -i ${STAGEDIR}
4712
4713 .if !defined(NO_PKG_REGISTER)
4714 fake-pkg:
4715 .if defined(INSTALLS_DEPENDS)
4716 @${ECHO_MSG} "===> Registering installation for ${PKGNAME} as automatic"
4717 .else
4718 @${ECHO_MSG} "===> Registering installation for ${PKGNAME}"
4719 .endif
4720 .if defined(INSTALLS_DEPENDS)
4721 @${SETENV} ${PKG_ENV} FORCE_POST="${_FORCE_POST_PATTERNS}" ${PKG_REGISTER} -d ${STAGE_ARGS} -m ${METADIR} -f ${TMPPLIST}
4722 .else
4723 @${SETENV} ${PKG_ENV} FORCE_POST="${_FORCE_POST_PATTERNS}" ${PKG_REGISTER} ${STAGE_ARGS} -m ${METADIR} -f ${TMPPLIST}
4724 .endif
4725 @${RM} -r ${METADIR}
4726 .endif
4727 .endif
4728
4729 # Depend is generally meaningless for arbitrary ports, but if someone wants
4730 # one they can override this. This is just to catch people who've gotten into
4731 # the habit of typing `make depend all install' as a matter of course.
4732 # Same goes for tags
4733 .for _t in depend tags
4734 .if !target(${_t})
4735 ${_t}:
4736 .endif
4737 .endfor
4738
4739 .if !defined(NOPRECIOUSMAKEVARS)
4740 # These won't change, so we can pass them through the environment
4741 .for var in ${_EXPORTED_VARS}
4742 .if empty(.MAKEFLAGS:M${var}=*) && !empty(${var})
4743 .MAKEFLAGS: ${var}=${${var}:Q}
4744 .endif
4745 .endfor
4746 .endif
4747 PORTS_ENV_VARS+= ${_EXPORTED_VARS}
4748
4749 .if !target(pre-check-config)
4750 pre-check-config:
4751 _CHECK_OPTIONS_NAMES= OPTIONS_DEFINE
4752 _CHECK_OPTIONS_NAMES+= ${OPTIONS_GROUP:S/^/OPTIONS_GROUP_/}
4753 _CHECK_OPTIONS_NAMES+= ${OPTIONS_MULTI:S/^/OPTIONS_MULTI_/}
4754 _CHECK_OPTIONS_NAMES+= ${OPTIONS_RADIO:S/^/OPTIONS_RADIO_/}
4755 _CHECK_OPTIONS_NAMES+= ${OPTIONS_SINGLE:S/^/OPTIONS_SINGLE_/}
4756 .for var in ${_CHECK_OPTIONS_NAMES}
4757 . if defined(${var})
4758 . for o in ${${var}}
4759 . if ${o:C/[-_[:upper:][:digit:]]//g}
4760 OPTIONS_BAD_NAMES+= ${o}
4761 . endif
4762 . endfor
4763 . endif
4764 .endfor
4765 .if defined(OPTIONS_BAD_NAMES) && !empty(OPTIONS_BAD_NAMES)
4766 DEV_WARNING+= "These options name have characters outside of [-_A-Z0-9]:"
4767 DEV_WARNING+= "${OPTIONS_BAD_NAMES:O:u}"
4768 .endif
4769 .for single in ${OPTIONS_SINGLE}
4770 . for opt in ${OPTIONS_SINGLE_${single}}
4771 . if empty(ALL_OPTIONS:M${single}) || !empty(PORT_OPTIONS:M${single})
4772 . if !empty(PORT_OPTIONS:M${opt})
4773 OPTIONS_WRONG_SINGLE_${single}+= ${opt}
4774 . if defined(OPTFOUND)
4775 OPTIONS_WRONG_SINGLE+= ${single}
4776 . else
4777 OPTFOUND= true
4778 . endif
4779 . endif
4780 . else
4781 # if conditional and if the condition is unchecked, remove opt from the list of
4782 # set options
4783 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
4784 OPTNOCHECK= true
4785 . endif
4786 . endfor
4787 . if !defined(OPTFOUND) && !defined(OPTNOCHECK)
4788 OPTIONS_WRONG_SINGLE+= ${single}
4789 . endif
4790 . undef OPTFOUND
4791 . undef OPTNOCHECK
4792 .endfor
4793 .undef single
4794
4795 .for radio in ${OPTIONS_RADIO}
4796 . for opt in ${OPTIONS_RADIO_${radio}}
4797 . if !empty(PORT_OPTIONS:M${opt})
4798 OPTIONS_WRONG_RADIO_${radio}+= ${opt}
4799 . if defined(OPTFOUND)
4800 OPTIONS_WRONG_RADIO+= ${radio}
4801 . else
4802 OPTFOUND= true
4803 . endif
4804 . endif
4805 . endfor
4806 . undef OPTFOUND
4807 .endfor
4808
4809 .for multi in ${OPTIONS_MULTI}
4810 . for opt in ${OPTIONS_MULTI_${multi}}
4811 . if empty(ALL_OPTIONS:M${multi}) || !empty(PORT_OPTIONS:M${multi})
4812 . if !empty(PORT_OPTIONS:M${opt})
4813 OPTFOUND= true
4814 . endif
4815 . else
4816 # if conditional and if the condition is unchecked, remove opt from the list of
4817 # set options
4818 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
4819 OPTNOCHECK= true
4820 . endif
4821 . endfor
4822 . if !defined(OPTFOUND) && !defined(OPTNOCHECK)
4823 OPTIONS_WRONG_MULTI+= ${multi}
4824 . endif
4825 . undef OPTFOUND
4826 . undef OPTNOCHECK
4827 .endfor
4828 .undef multi
4829
4830 .for opt in ${PORT_OPTIONS}
4831 . for conflict in ${${opt}_PREVENTS}
4832 . if ${PORT_OPTIONS:M${conflict}}
4833 . if empty(OPTIONS_WRONG_PREVENTS:M${opt})
4834 OPTIONS_WRONG_PREVENTS+= ${opt}
4835 . endif
4836 OPTIONS_WRONG_PREVENTS_${opt}+= ${conflict}
4837 . endif
4838 . endfor
4839 .endfor
4840 .undef conflict
4841 .undef opt
4842 .endif #pre-check-config
4843
4844 .if !target(_check-config)
4845 _check-config: pre-check-config
4846 .for multi in ${OPTIONS_WRONG_MULTI}
4847 @${ECHO_MSG} "====> You must check at least one option in the ${multi} multi"
4848 .endfor
4849 .for single in ${OPTIONS_WRONG_SINGLE}
4850 @${ECHO_MSG} "====> You must select one and only one option from the ${single} single"
4851 .if defined(OPTIONS_WRONG_SINGLE_${single})
4852 @${ECHO_MSG} "=====> Only one of these must be defined: ${OPTIONS_WRONG_SINGLE_${single}}"
4853 .else
4854 @${ECHO_MSG} "=====> No option was selected (and one must be)"
4855 .endif
4856 .endfor
4857 .for radio in ${OPTIONS_WRONG_RADIO}
4858 @${ECHO_MSG} "====> You cannot select multiple options from the ${radio} radio"
4859 @${ECHO_MSG} "=====> Only one of these must be defined: ${OPTIONS_WRONG_RADIO_${radio}}"
4860 .endfor
4861 .if defined(OPTIONS_WRONG_PREVENTS)
4862 @${ECHO_MSG} "====> Two or more enabled options conflict with each other"
4863 . for prevents in ${OPTIONS_WRONG_PREVENTS}
4864 @${ECHO_MSG} "=====> Option ${prevents} conflicts with ${OPTIONS_WRONG_PREVENTS_${prevents}} (select only one)"
4865 . if defined(${prevents}_PREVENTS_MSG)
4866 @${ECHO_MSG} "======> ${${prevents}_PREVENTS_MSG}"
4867 . endif
4868 . endfor
4869 .endif
4870 .if !empty(OPTIONS_WRONG_MULTI) || !empty(OPTIONS_WRONG_SINGLE) || !empty(OPTIONS_WRONG_RADIO) || !empty(OPTIONS_WRONG_PREVENTS)
4871 _CHECK_CONFIG_ERROR= true
4872 .endif
4873 .endif # _check-config
4874
4875 .if !target(check-config)
4876 check-config: _check-config
4877 .if !empty(_CHECK_CONFIG_ERROR)
4878 @${FALSE}
4879 .endif
4880 .endif # check-config
4881
4882 .if !target(sanity-config)
4883 sanity-config: _check-config
4884 .if !empty(_CHECK_CONFIG_ERROR)
4885 @echo -n "Config is invalid. Re-edit? [Y/n] "; \
4886 read answer; \
4887 case $$answer in \
4888 [Nn]|[Nn][Oo]) \
4889 exit 0; \
4890 esac; \
4891 cd ${.CURDIR} && ${MAKE} config
4892 .endif
4893 .endif # sanity-config
4894
4895 .if !target(pre-config)
4896 pre-config:
4897 D4P_ENV= PKGNAME="${PKGNAME}" \
4898 PORT_OPTIONS="${PORT_OPTIONS}" \
4899 ALL_OPTIONS="${ALL_OPTIONS}" \
4900 OPTIONS_MULTI="${OPTIONS_MULTI}" \
4901 OPTIONS_SINGLE="${OPTIONS_SINGLE}" \
4902 OPTIONS_RADIO="${OPTIONS_RADIO}" \
4903 OPTIONS_GROUP="${OPTIONS_GROUP}" \
4904 NEW_OPTIONS="${NEW_OPTIONS}" \
4905 DIALOG4PORTS="${DIALOG4PORTS}" \
4906 PREFIX="${PREFIX}" \
4907 LOCALBASE="${LOCALBASE}" \
4908 PORTSDIR="${PORTSDIR}" \
4909 MAKE="${MAKE}" \
4910 D4PHEIGHT="${D4PHEIGHT}" \
4911 D4PWIDTH="${D4PWIDTH}" \
4912 D4PFULLSCREEN="${D4PFULLSCREEN}"
4913 .if exists(${PKGHELP})
4914 D4P_ENV+= PKGHELP="${PKGHELP}"
4915 .endif
4916 .for opt in ${ALL_OPTIONS}
4917 D4P_ENV+= ${opt}_DESC=""${${opt}_DESC:Q}""
4918 .endfor
4919 .for otype in MULTI GROUP SINGLE RADIO
4920 . for m in ${OPTIONS_${otype}}
4921 D4P_ENV+= OPTIONS_${otype}_${m}="${OPTIONS_${otype}_${m}}" \
4922 ${m}_DESC=""${${m}_DESC:Q}""
4923 . for opt in ${OPTIONS_${otype}_${m}}
4924 D4P_ENV+= ${opt}_DESC=""${${opt}_DESC:Q}""
4925 . endfor
4926 . endfor
4927 .endfor
4928 .undef m
4929 .undef otype
4930 .undef opt
4931 .endif # pre-config
4932
4933 .if !target(do-config)
4934 do-config:
4935 .if empty(ALL_OPTIONS) && empty(OPTIONS_SINGLE) && empty(OPTIONS_MULTI) && empty(OPTIONS_RADIO) && empty(OPTIONS_GROUP)
4936 @${ECHO_MSG} "===> No options to configure"
4937 .else
4938 @optionsdir=${OPTIONS_FILE:H}; \
4939 if [ ! -w "${PORT_DBDIR}" -a "`stat -f %u ${PORT_DBDIR:H}`" = 0 ]; \
4940 then \
4941 ${ECHO_MSG} "===> Switching to root credentials to create $${optionsdir}"; \
4942 (${SU_CMD} "${SH} -c \"${MKDIR} $${optionsdir} 2> /dev/null\"") || \
4943 (${ECHO_MSG} "===> Cannot create $${optionsdir}, check permissions"; exit 1); \
4944 ${ECHO_MSG} "===> Returning to user credentials" ; \
4945 else \
4946 ${MKDIR} $${optionsdir} 2> /dev/null || \
4947 (${ECHO_MSG} "===> Cannot create $${optionsdir}, check permissions"; exit 1) ; \
4948 fi
4949 @TMPOPTIONSFILE=$$(mktemp -t portoptions); \
4950 trap "${RM} $${TMPOPTIONSFILE}; exit 1" 1 2 3 5 10 13 15; \
4951 ${SETENV} ${D4P_ENV} ${SH} ${SCRIPTSDIR}/dialog4ports.sh $${TMPOPTIONSFILE} || { \
4952 ${RM} $${TMPOPTIONSFILE}; \
4953 ${ECHO_MSG} "===> Options unchanged"; \
4954 exit 0; \
4955 }; \
4956 ${ECHO_CMD}; \
4957 if [ ! -e $${TMPOPTIONSFILE} ]; then \
4958 ${ECHO_MSG} "===> No user-specified options to save for ${PKGNAME}"; \
4959 exit 0; \
4960 fi; \
4961 SELOPTIONS=$$(${CAT} $${TMPOPTIONSFILE}); \
4962 ${RM} $${TMPOPTIONSFILE}; \
4963 TMPOPTIONSFILE=$$(mktemp -t portoptions); \
4964 trap "${RM} $${TMPOPTIONSFILE}; exit 1" 1 2 3 5 10 13 15; \
4965 ${ECHO_CMD} "# This file is auto-generated by 'make config'." > $${TMPOPTIONSFILE}; \
4966 ${ECHO_CMD} "# Options for ${PKGNAME}" >> $${TMPOPTIONSFILE}; \
4967 ${ECHO_CMD} "_OPTIONS_READ=${PKGNAME}" >> $${TMPOPTIONSFILE}; \
4968 ${ECHO_CMD} "_FILE_COMPLETE_OPTIONS_LIST=${COMPLETE_OPTIONS_LIST}" >> $${TMPOPTIONSFILE}; \
4969 for i in ${COMPLETE_OPTIONS_LIST}; do \
4970 if ${ECHO_CMD} $${SELOPTIONS} | ${GREP} -qw $${i}; then \
4971 ${ECHO_CMD} "OPTIONS_FILE_SET+=$${i}" >> $${TMPOPTIONSFILE}; \
4972 else \
4973 ${ECHO_CMD} "OPTIONS_FILE_UNSET+=$${i}" >> $${TMPOPTIONSFILE}; \
4974 fi; \
4975 done; \
4976 if [ ! -w "${OPTIONS_FILE:H}" -a "`stat -f %u ${OPTIONS_FILE:H}`" != ${UID} ]; \
4977 then \
4978 ${ECHO_MSG} "===> Switching to root credentials to write ${OPTIONS_FILE}"; \
4979 ${SU_CMD} "${CAT} $${TMPOPTIONSFILE} > ${OPTIONS_FILE}"; \
4980 ${ECHO_MSG} "===> Returning to user credentials"; \
4981 else \
4982 ${CAT} $${TMPOPTIONSFILE} > ${OPTIONS_FILE}; \
4983 fi; \
4984 ${RM} $${TMPOPTIONSFILE}
4985 @cd ${.CURDIR} && ${MAKE} sanity-config
4986 .endif
4987 .endif # do-config
4988
4989 .if !target(config)
4990 .if !defined(NO_DIALOG)
4991 config: pre-config do-config
4992 .else
4993 config:
4994 @${ECHO_MSG} "===> Skipping 'config' as NO_DIALOG is defined"
4995 .endif
4996 .endif # config
4997
4998 .if !target(config-recursive)
4999 config-recursive:
5000 @${ECHO_MSG} "===> Setting user-specified options for ${PKGNAME} and dependencies";
5001 @recursive_cmd="config-conditional"; \
5002 recursive_dirs="${.CURDIR} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
5003 ${_FLAVOR_RECURSIVE_SH}
5004 .endif # config-recursive
5005
5006 .if !target(config-conditional)
5007 config-conditional:
5008 .if !empty(NEW_OPTIONS)
5009 @cd ${.CURDIR} && ${MAKE} config;
5010 .endif
5011 .endif # config-conditional
5012
5013 .if !target(showconfig) && (make(*config*) || (!empty(.MAKEFLAGS:M-V) && !empty(.MAKEFLAGS:M*_DESC)))
5014 .include "${PORTSDIR}/Mk/bsd.options.desc.mk"
5015 MULTI_EOL= : you have to choose at least one of them
5016 SINGLE_EOL= : you have to select exactly one of them
5017 RADIO_EOL= : you can only select none or one of them
5018 showconfig: check-config
5019 .if !empty(COMPLETE_OPTIONS_LIST)
5020 @${ECHO_MSG} "===> The following configuration options are available for ${PKGNAME}":
5021 .for opt in ${ALL_OPTIONS}
5022 @[ -z "${PORT_OPTIONS:M${opt}}" ] || match="on" ; ${ECHO_MSG} -n " ${opt}=$${match:-off}"
5023 . if !empty(${opt}_DESC)
5024 @${ECHO_MSG} -n ": "${${opt}_DESC:Q}
5025 . endif
5026 @${ECHO_MSG} ""
5027 .endfor
5028
5029 #multi and conditional multis
5030 .for otype in MULTI GROUP SINGLE RADIO
5031 . for m in ${OPTIONS_${otype}}
5032 . if empty(${m}_DESC)
5033 @${ECHO_MSG} "====> Options available for the ${otype:tl} ${m}${${otype}_EOL}"
5034 . else
5035 @${ECHO_MSG} "====> ${${m}_DESC}${${otype}_EOL}"
5036 . endif
5037 . for opt in ${OPTIONS_${otype}_${m}}
5038 @[ -z "${PORT_OPTIONS:M${opt}}" ] || match="on" ; ${ECHO_MSG} -n " ${opt}=$${match:-off}"
5039 . if !empty(${opt}_DESC)
5040 @${ECHO_MSG} -n ": "${${opt}_DESC:Q}
5041 . endif
5042 @${ECHO_MSG} ""
5043 . endfor
5044 . endfor
5045 .endfor
5046
5047 .undef otype
5048 .undef m
5049 .undef opt
5050 @${ECHO_MSG} "===> Use 'make config' to modify these settings"
5051 .endif
5052 .endif # showconfig
5053
5054 .if !target(showconfig-recursive)
5055 showconfig-recursive:
5056 @${ECHO_MSG} "===> The following configuration options are available for ${PKGNAME} and dependencies";
5057 @recursive_cmd="showconfig"; \
5058 recursive_dirs="${.CURDIR} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
5059 ${_FLAVOR_RECURSIVE_SH}
5060 .endif # showconfig-recursive
5061
5062 .if !target(rmconfig)
5063 rmconfig:
5064 .if exists(${OPTIONS_FILE})
5065 -@${ECHO_MSG} "===> Removing user-configured options for ${PKGNAME}"; \
5066 optionsdir=${OPTIONS_FILE:H}; \
5067 if [ ${UID} != 0 -a "x${INSTALL_AS_USER}" = "x" -a ! -w "${OPTIONS_FILE}" ]; then \
5068 ${ECHO_MSG} "===> Switching to root credentials to remove ${OPTIONS_FILE} and $${optionsdir}"; \
5069 ${SU_CMD} "${RM} ${OPTIONS_FILE} ; \
5070 ${RMDIR} $${optionsdir}"; \
5071 ${ECHO_MSG} "===> Returning to user credentials"; \
5072 else \
5073 ${RM} ${OPTIONS_FILE}; \
5074 ${RMDIR} $${optionsdir} 2>/dev/null || return 0; \
5075 fi
5076 .else
5077 @${ECHO_MSG} "===> No user-specified options configured for ${PKGNAME}"
5078 .endif
5079 .endif # rmconfig
5080
5081 .if !target(rmconfig-recursive)
5082 rmconfig-recursive:
5083 @${ECHO_MSG} "===> Removing user-specified options for ${PKGNAME} and dependencies";
5084 @recursive_cmd="rmconfig"; \
5085 recursive_dirs="${.CURDIR} $$(${ALL-DEPENDS-FLAVORS-LIST})"; \
5086 ${_FLAVOR_RECURSIVE_SH}
5087 .endif # rmconfig-recursive
5088
5089 .if !target(pretty-print-config)
5090 MULTI_START= [
5091 MULTI_END= ]
5092 GROUP_START= [
5093 GROUP_END= ]
5094 SINGLE_START= (
5095 SINGLE_END= )
5096 RADIO_START= (
5097 RADIO_END= )
5098 pretty-print-config:
5099 .for opt in ${ALL_OPTIONS}
5100 @[ -z "${PORT_OPTIONS:M${opt}}" ] || match="+" ; ${ECHO_MSG} -n "$${match:--}${opt} "
5101 .endfor
5102 .for otype in MULTI GROUP SINGLE RADIO
5103 . for m in ${OPTIONS_${otype}}
5104 @${ECHO_MSG} -n "${m}${${otype}_START} "
5105 . for opt in ${OPTIONS_${otype}_${m}}
5106 @[ -z "${PORT_OPTIONS:M${opt}}" ] || match="+" ; ${ECHO_MSG} -n "$${match:--}${opt} "
5107 . endfor
5108 @${ECHO_MSG} -n "${${otype}_END} "
5109 . endfor
5110 .endfor
5111 .undef otype
5112 .undef m
5113 .undef opt
5114 @${ECHO_MSG} ""
5115 .endif # pretty-print-config
5116
5117 desktop-categories:
5118 @${SETENV} \
5119 dp_CATEGORIES="${CATEGORIES}" \
5120 dp_ECHO_CMD=${ECHO_CMD} \
5121 dp_SCRIPTSDIR="${SCRIPTSDIR}" \
5122 dp_SORT="${SORT}" \
5123 dp_TR="${TR}" \
5124 ${SH} ${SCRIPTSDIR}/desktop-categories.sh
5125
5126 .if defined(DESKTOP_ENTRIES)
5127 check-desktop-entries:
5128 @${SETENV} \
5129 dp_CURDIR="${.CURDIR}" \
5130 dp_ECHO_CMD=${ECHO_CMD} \
5131 dp_ECHO_MSG=${ECHO_MSG} \
5132 dp_EXPR="${EXPR}" \
5133 dp_GREP="${GREP}" \
5134 dp_MAKE="${MAKE}" \
5135 dp_PKGNAME="${PKGNAME}" \
5136 dp_SCRIPTSDIR="${SCRIPTSDIR}" \
5137 dp_SED="${SED}" \
5138 dp_VALID_DESKTOP_CATEGORIES="${VALID_DESKTOP_CATEGORIES}" \
5139 dp_TR="${TR}" \
5140 ${SH} ${SCRIPTSDIR}/check-desktop-entries.sh ${DESKTOP_ENTRIES}
5141 .endif
5142
5143 .if !target(install-desktop-entries)
5144 .if defined(DESKTOP_ENTRIES)
5145 install-desktop-entries:
5146 @${SETENV} \
5147 dp_CURDIR="${.CURDIR}" \
5148 dp_ECHO_CMD=${ECHO_CMD} \
5149 dp_SCRIPTSDIR="${SCRIPTSDIR}" \
5150 dp_STAGEDIR="${STAGEDIR}" \
5151 dp_DESKTOPDIR="${DESKTOPDIR}" \
5152 dp_TMPPLIST="${TMPPLIST}" \
5153 dp_MAKE="${MAKE}" \
5154 dp_SED="${SED}" \
5155 ${SH} ${SCRIPTSDIR}/install-desktop-entries.sh ${DESKTOP_ENTRIES}
5156 .endif
5157 .endif
5158
5159 .if !empty(BINARY_ALIAS)
5160 .if !target(create-binary-alias)
5161 create-binary-alias: ${BINARY_LINKDIR}
5162 .for target src in ${BINARY_ALIAS:C/=/ /}
5163 @${RLN} `which ${src}` ${BINARY_LINKDIR}/${target}
5164 .endfor
5165 .endif
5166 .endif
5167
5168 .if defined(WARNING)
5169 WARNING_WAIT?= 10
5170 show-warnings:
5171 @${ECHO_MSG} "/!\\ WARNING /!\\"
5172 @${ECHO_MSG}
5173 .for m in ${WARNING}
5174 @${ECHO_MSG} "${m}" | ${FMT_80}
5175 @${ECHO_MSG}
5176 .endfor
5177 @sleep ${WARNING_WAIT}
5178 .endif
5179
5180 .if defined(ERROR)
5181 show-errors:
5182 @${ECHO_MSG} "/!\\ ERRORS /!\\"
5183 @${ECHO_MSG}
5184 .for m in ${ERROR}
5185 @${ECHO_MSG} "${m}" | ${FMT_80}
5186 @${ECHO_MSG}
5187 .endfor
5188 @${FALSE}
5189 .endif
5190
5191 .if defined(DEVELOPER)
5192 .if defined(DEV_WARNING)
5193 DEV_WARNING_WAIT?= 10
5194 show-dev-warnings:
5195 @${ECHO_MSG} "/!\\ ${PKGNAME}: Makefile warnings, please consider fixing /!\\"
5196 @${ECHO_MSG}
5197 .for m in ${DEV_WARNING}
5198 @${ECHO_MSG} ${m} | ${FMT_80}
5199 @${ECHO_MSG}
5200 .endfor
5201 .if defined(DEV_WARNING_FATAL)
5202 @${FALSE}
5203 .else
5204 @sleep ${DEV_WARNING_WAIT}
5205 .endif
5206 .endif
5207
5208 .if defined(DEV_ERROR)
5209 show-dev-errors:
5210 @${ECHO_MSG} "/!\\ ${PKGNAME}: Makefile errors /!\\"
5211 @${ECHO_MSG}
5212 .for m in ${DEV_ERROR}
5213 @${ECHO_MSG} "${m}" | ${FMT_80}
5214 @${ECHO_MSG}
5215 .endfor
5216 @${FALSE}
5217 .endif
5218 .endif #DEVELOPER
5219
5220 ${_PORTS_DIRECTORIES}:
5221 @${MKDIR} ${.TARGET}
5222
5223 # Please note that the order of the following targets is important, and
5224 # should not be modified.
5225
5226 _TARGETS_STAGES= SANITY PKG FETCH EXTRACT PATCH CONFIGURE BUILD INSTALL TEST PACKAGE STAGE
5227
5228 # Define the SEQ of actions to take when each target is ran, and which targets
5229 # it depends on before running its SEQ.
5230 #
5231 # Main target has a priority of 500, pre-target 300, post-target 700,
5232 # target-depends 150. Other targets are spaced in between those
5233 #
5234 # If you change the pre-foo and post-foo values here, go and keep them in sync
5235 # in _OPTIONS_TARGETS in bsd.options.mk
5236
5237 _SANITY_SEQ= 050:post-chroot 100:pre-everything \
5238 125:show-unsupported-system-error 150:check-makefile \
5239 190:show-errors 200:show-warnings \
5240 210:show-dev-errors 220:show-dev-warnings \
5241 250:check-categories 300:check-makevars \
5242 350:check-desktop-entries 400:check-depends \
5243 450:identify-install-conflicts 500:check-deprecated \
5244 550:check-vulnerable 600:check-license 650:check-config \
5245 700:buildanyway-message 750:options-message ${_USES_sanity}
5246
5247 _PKG_DEP= check-sanity
5248 _PKG_SEQ= 500:pkg-depends
5249 _FETCH_DEP= pkg
5250 _FETCH_SEQ= 150:fetch-depends 300:pre-fetch 450:pre-fetch-script \
5251 500:do-fetch 550:fetch-specials 700:post-fetch \
5252 850:post-fetch-script \
5253 ${_OPTIONS_fetch} ${_USES_fetch}
5254 _EXTRACT_DEP= fetch
5255 _EXTRACT_SEQ= 010:check-build-conflicts 050:extract-message 100:checksum \
5256 150:extract-depends 190:clean-wrkdir 200:${EXTRACT_WRKDIR} \
5257 300:pre-extract 450:pre-extract-script 500:do-extract \
5258 700:post-extract 850:post-extract-script \
5259 999:extract-fixup-modes \
5260 ${_OPTIONS_extract} ${_USES_extract} ${_SITES_extract}
5261 _PATCH_DEP= extract
5262 _PATCH_SEQ= 050:ask-license 100:patch-message 150:patch-depends \
5263 300:pre-patch 450:pre-patch-script 500:do-patch \
5264 700:post-patch 850:post-patch-script \
5265 ${_OPTIONS_patch} ${_USES_patch}
5266 _CONFIGURE_DEP= patch
5267 _CONFIGURE_SEQ= 150:build-depends 151:lib-depends 160:create-binary-alias \
5268 200:configure-message \
5269 300:pre-configure 450:pre-configure-script \
5270 490:run-autotools-fixup 500:do-configure 700:post-configure \
5271 850:post-configure-script \
5272 ${_OPTIONS_configure} ${_USES_configure}
5273 _BUILD_DEP= configure
5274 _BUILD_SEQ= 100:build-message 300:pre-build 450:pre-build-script \
5275 500:do-build 700:post-build 850:post-build-script \
5276 ${_OPTIONS_build} ${_USES_build}
5277 _STAGE_DEP= build
5278 # STAGE is special in its numbering as it has install and stage, so install is
5279 # the main, and stage goes after.
5280 _STAGE_SEQ= 050:stage-message 100:stage-dir 150:run-depends \
5281 200:apply-slist 300:pre-install \
5282 400:generate-plist 450:pre-su-install 475:create-users-groups \
5283 500:do-install 550:kmod-post-install 600:fixup-lib-pkgconfig 700:post-install \
5284 750:post-install-script 800:post-stage 850:compress-man \
5285 860:install-rc-script 870:install-ldconfig-file \
5286 880:install-license 890:install-desktop-entries \
5287 900:add-plist-info 910:add-plist-docs 920:add-plist-examples \
5288 930:add-plist-data 940:add-plist-post ${POST_PLIST:C/^/990:/} \
5289 ${_OPTIONS_install} ${_USES_install} \
5290 ${_OPTIONS_stage} ${_USES_stage}
5291 .if defined(DEVELOPER)
5292 _STAGE_SEQ+= 995:stage-qa
5293 .else
5294 stage-qa: stage
5295 .endif
5296 _TEST_DEP= stage
5297 _TEST_SEQ= 100:test-message 150:test-depends 300:pre-test 500:do-test \
5298 800:post-test \
5299 ${_OPTIONS_test} ${_USES_test}
5300 _INSTALL_DEP= stage
5301 _INSTALL_SEQ= 100:install-message \
5302 200:check-already-installed \
5303 300:create-manifest
5304 _INSTALL_SUSEQ= 400:fake-pkg 500:security-check
5305
5306 _PACKAGE_DEP= stage
5307 _PACKAGE_SEQ= 100:package-message 300:pre-package 450:pre-package-script \
5308 500:do-package 850:post-package-script \
5309 ${_OPTIONS_package} ${_USES_package}
5310
5311 # Enforce order for -jN builds
5312 .for _t in ${_TARGETS_STAGES}
5313 # Check if the port need to change the default order of some targets...
5314 . if defined(TARGET_ORDER_OVERRIDE)
5315 _tmp_seq:=
5316 . for _entry in ${_${_t}_SEQ}
5317 # for _target because :M${_target} does not work with fmake
5318 . for _target in ${_entry:C/^[0-9]+://}
5319 . if ${TARGET_ORDER_OVERRIDE:M*\:${_target}}
5320 _tmp_seq:= ${_tmp_seq} ${TARGET_ORDER_OVERRIDE:M*\:${_target}}
5321 . else
5322 _tmp_seq:= ${_tmp_seq} ${_entry}
5323 . endif
5324 . endfor
5325 . endfor
5326 _${_t}_SEQ:= ${_tmp_seq}
5327 . endif
5328 . for s in ${_${_t}_SEQ:O:C/^[0-9]+://}
5329 . if target(${s})
5330 . if ! ${NOTPHONY:M${s}}
5331 _PHONY_TARGETS+= ${s}
5332 . endif
5333 _${_t}_REAL_SEQ+= ${s}
5334 . endif
5335 . endfor
5336 . for s in ${_${_t}_SUSEQ:O:C/^[0-9]+://}
5337 . if target(${s})
5338 . if ! ${NOTPHONY:M${s}}
5339 _PHONY_TARGETS+= ${s}
5340 . endif
5341 _${_t}_REAL_SUSEQ+= ${s}
5342 . endif
5343 . endfor
5344 .ORDER: ${_${_t}_DEP} ${_${_t}_REAL_SEQ}
5345 .endfor
5346
5347 # Define all of the main targets which depend on a sequence of other targets.
5348 # See above *_SEQ and *_DEP. The _DEP will run before this defined target is
5349 # ran. The _SEQ will run as this target once _DEP is satisfied.
5350
5351 .for target in extract patch configure build stage install package
5352
5353 # Check if config dialog needs to show and execute it if needed. If is it not
5354 # needed (_OPTIONS_OK), then just depend on the cookie which is defined later
5355 # to depend on the *_DEP and execute the *_SEQ.
5356 # If options are required, execute config-conditional and then re-execute the
5357 # target noting that config is no longer needed.
5358 .if !target(${target}) && defined(_OPTIONS_OK)
5359 _PHONY_TARGETS+= ${target}
5360 ${target}: ${${target:tu}_COOKIE}
5361 .elif !target(${target})
5362 ${target}: config-conditional
5363 @cd ${.CURDIR} && ${MAKE} CONFIG_DONE_${PKGBASE:tu}=1 ${${target:tu}_COOKIE}
5364 .elif target(${target}) && defined(IGNORE)
5365 .endif
5366
5367 .if !exists(${${target:tu}_COOKIE})
5368
5369 # Define the real target behavior. Depend on the target's *_DEP. Execute
5370 # the target's *_SEQ. Also handle su and USE_SUBMAKE needs.
5371 .if ${UID} != 0 && defined(_${target:tu}_REAL_SUSEQ) && !defined(INSTALL_AS_USER)
5372 . if defined(USE_SUBMAKE)
5373 ${${target:tu}_COOKIE}: ${_${target:tu}_DEP}
5374 @cd ${.CURDIR} && ${MAKE} ${_${target:tu}_REAL_SEQ}
5375 . else # !USE_SUBMAKE
5376 ${${target:tu}_COOKIE}: ${_${target:tu}_DEP} ${_${target:tu}_REAL_SEQ}
5377 . endif # USE_SUBMAKE
5378 @${ECHO_MSG} "===> Switching to root credentials for '${target}' target"
5379 @cd ${.CURDIR} && \
5380 ${SU_CMD} "${MAKE} ${_${target:tu}_REAL_SUSEQ}"
5381 @${ECHO_MSG} "===> Returning to user credentials"
5382 @${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
5383 .else # No SU needed
5384 . if defined(USE_SUBMAKE)
5385 ${${target:tu}_COOKIE}: ${_${target:tu}_DEP}
5386 @cd ${.CURDIR} && \
5387 ${MAKE} ${_${target:tu}_REAL_SEQ} ${_${target:tu}_REAL_SUSEQ}
5388 @${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
5389 . else # !USE_SUBMAKE
5390 ${${target:tu}_COOKIE}: ${_${target:tu}_DEP} ${_${target:tu}_REAL_SEQ} ${_${target:tu}_REAL_SUSEQ}
5391 @${TOUCH} ${TOUCH_FLAGS} ${.TARGET}
5392 . endif # USE_SUBMAKE
5393 .endif # SU needed
5394
5395 .else # exists(cookie)
5396 ${${target:tu}_COOKIE}::
5397 @if [ ! -e ${.TARGET} ]; then \
5398 cd ${.CURDIR} && ${MAKE} ${.TARGET}; \
5399 fi
5400 .endif # !exists(cookie)
5401
5402 .endfor # foreach(targets)
5403
5404 .PHONY: ${_PHONY_TARGETS} check-sanity fetch pkg
5405
5406 .if !target(check-sanity)
5407 check-sanity: ${_SANITY_REAL_SEQ}
5408 .endif
5409
5410 .if !target(fetch)
5411 fetch: ${_FETCH_DEP} ${_FETCH_REAL_SEQ}
5412 .endif
5413
5414 .if !target(pkg)
5415 pkg: ${_PKG_DEP} ${_PKG_REAL_SEQ}
5416 .endif
5417
5418 .if !target(test)
5419 test: ${_TEST_DEP}
5420 .if !defined(NO_TEST)
5421 test: ${_TEST_REAL_SEQ}
5422 .endif
5423 .endif
5424
5425 .endif
5426 # End of post-makefile section.
5427
5428 .endif
5429 # End of the DESTDIR if statement

Properties

Name Value
svn:eol-style native
svn:keywords FreeBSD=%H
svn:mime-type text/plain

  ViewVC Help
Powered by ViewVC 1.1.27