Annotation of pkgsrc/lang/php/phpversion.mk, revision 1.37
1.37 ! taca 1: # $NetBSD: phpversion.mk,v 1.36 2013/07/12 00:09:14 taca Exp $
1.6 rillig 2: #
3: # This file selects a PHP version, based on the user's preferences and
1.9 rillig 4: # the installed packages. It does not add a dependency on the PHP
5: # package.
1.6 rillig 6: #
7: # === User-settable variables ===
8: #
9: # PHP_VERSION_DEFAULT
10: # The PHP version to choose when more than one is acceptable to
1.18 taca 11: # the package.
1.6 rillig 12: #
1.19 taca 13: # Possible: 53 54
1.31 taca 14: # Default: 54
1.6 rillig 15: #
1.24 cheusov 16: # === Infrastructure variables ===
17: #
1.23 cheusov 18: # PHP_VERSION_REQD
1.24 cheusov 19: # PHP version to use. This variable should not be set in
20: # packages. Normally it is used by bulk build tools.
1.23 cheusov 21: #
22: # Possible: ${PHP_VERSIONS_ACCEPTED}
23: # Default: ${PHP_VERSION_DEFAULT}
24: #
1.6 rillig 25: # === Package-settable variables ===
26: #
27: # PHP_VERSIONS_ACCEPTED
28: # The PHP versions that are accepted by the package.
29: #
1.19 taca 30: # Possible: 53 54
1.31 taca 31: # Default: 54 53
1.6 rillig 32: #
1.37 ! taca 33: # PHP_CHECK_INSTALLED
! 34: # Check installed version of PHP. Should be used lang/php53,
! 35: # and lang/php54 only.
! 36: #
! 37: # Possible: Yes No
! 38: # Default: Yes
! 39: #
1.6 rillig 40: # === Variables defined by this file ===
41: #
42: # PKG_PHP_VERSION
43: # The selected PHP version.
44: #
1.19 taca 45: # Possible: 53 54
1.11 taca 46: # Default: ${PHP_VERSION_DEFAULT}
47: #
1.18 taca 48: # PHP_BASE_VERS
49: # The selected PHP's full version depends on PKG_PHP_VERSION
50: #
1.11 taca 51: # PKG_PHP_MAJOR_VERS
52: # The selected PHP's major version.
53: #
1.10 joerg 54: # Possible: 5
1.11 taca 55: # Default: 5
1.6 rillig 56: #
57: # PKG_PHP
1.11 taca 58: # The same as ${PKG_PHP_VERSION}, prefixed with "php-".
1.6 rillig 59: #
60: # PHPPKGSRCDIR
61: # The directory of the PHP implementation, relative to the
62: # package directory.
63: #
1.31 taca 64: # Example: ../../lang/php54
1.6 rillig 65: #
66: # PHP_PKG_PREFIX
67: # The prefix that is prepended to the package name.
68: #
1.19 taca 69: # Example: php53, php54
1.6 rillig 70: #
1.37 ! taca 71: # PHP_EXTENSION_DIR
! 72: # Relative path to ${PREFIX} for PHP's extensions. It is derived from
! 73: # initial release of major version.
! 74: #
! 75: # Example: lib/php/20090630
! 76: #
1.6 rillig 77: # Keywords: php
78: #
1.1 jdolecek 79:
80: .if !defined(PHPVERSION_MK)
81: PHPVERSION_MK= defined
82:
1.37 ! taca 83: # Define each PHP's version.
! 84: PHP53_VERSION= 5.3.27
! 85: PHP54_VERSION= 5.4.17
! 86: PHP55_VERSION= 5.5.1
! 87:
! 88: # Define initial release of major version.
! 89: PHP53_RELDATE= 20090630
! 90: PHP54_RELDATE= 20120301
! 91: PHP55_RELDATE= 20130620
! 92:
1.8 rillig 93: _VARGROUPS+= php
94: _USER_VARS.php= PHP_VERSION_DEFAULT
95: _PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD
1.11 taca 96: _SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX \
97: PKG_PHP_MAJOR_VERS
1.8 rillig 98:
1.1 jdolecek 99: .include "../../mk/bsd.prefs.mk"
100:
1.31 taca 101: PHP_VERSION_DEFAULT?= 54
102: PHP_VERSIONS_ACCEPTED?= 54 53
1.1 jdolecek 103:
104: # transform the list into individual variables
105: .for pv in ${PHP_VERSIONS_ACCEPTED}
106: _PHP_VERSION_${pv}_OK= yes
107: .endfor
108:
109: # check what is installed
1.18 taca 110: .if exists(${LOCALBASE}/lib/php/20120301)
111: _PHP_VERSION_54_INSTALLED= yes
112: _PHP_INSTALLED= yes
113: .elif exists(${LOCALBASE}/lib/php/20090626) || exists(${LOCALBASE}/include/php/Zend/zend_gc.h)
114: _PHP_VERSION_53_INSTALLED= yes
115: _PHP_INSTALLED= yes
1.1 jdolecek 116: .endif
117:
118: # if a version is explicitely required, take it
119: .if defined(PHP_VERSION_REQD)
120: _PHP_VERSION= ${PHP_VERSION_REQD}
121: .endif
122: # if the default is already installed, it is first choice
123: .if !defined(_PHP_VERSION)
124: .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK)
125: .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED)
126: _PHP_VERSION= ${PHP_VERSION_DEFAULT}
127: .endif
128: .endif
129: .endif
130: # prefer an already installed version, in order of "accepted"
131: .if !defined(_PHP_VERSION)
132: .for pv in ${PHP_VERSIONS_ACCEPTED}
133: .if defined(_PHP_VERSION_${pv}_INSTALLED)
134: _PHP_VERSION?= ${pv}
135: .else
136: # keep information as last resort - see below
137: _PHP_VERSION_FIRSTACCEPTED?= ${pv}
138: .endif
139: .endfor
140: .endif
141: # if the default is OK for the addon pkg, take this
142: .if !defined(_PHP_VERSION)
143: .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK)
144: _PHP_VERSION= ${PHP_VERSION_DEFAULT}
145: .endif
146: .endif
147: # take the first one accepted by the package
148: .if !defined(_PHP_VERSION)
149: _PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED}
150: .endif
151:
1.14 wiz 152: #
153: # Variable assignment for multi-PHP packages
154: MULTI+= PHP_VERSION_REQD=${_PHP_VERSION}
155:
1.2 jdolecek 156: # export some of internal variables
1.12 jdolecek 157: PKG_PHP_VERSION:= ${_PHP_VERSION:C/\.[0-9]//}
1.37 ! taca 158: PKG_PHP:= php-${_PHP_VERSION:C/([0-9])([0-9])/\1.\2/}
1.11 taca 159:
160: # currently we have only PHP 5.x packages.
161: PKG_PHP_MAJOR_VERS:= 5
1.2 jdolecek 162:
1.37 ! taca 163: PHP_CHECK_INSTALLED?= Yes
! 164:
1.12 jdolecek 165: # if installed PHP isn't compatible with required PHP, bail out
1.37 ! taca 166: .if !empty(PHP_CHECK_INSTALLED:M[nN][oO])
1.12 jdolecek 167: .if defined(_PHP_INSTALLED) && !defined(_PHP_VERSION_${_PHP_VERSION}_INSTALLED)
168: PKG_SKIP_REASON+= "Package accepts ${PKG_PHP}, but different version is installed"
169: .endif
1.37 ! taca 170: .endif
1.12 jdolecek 171:
1.2 jdolecek 172: MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \
173: PKG_PHP=${PKG_PHP}
1.11 taca 174: PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \
1.18 taca 175: PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS} \
176: PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR}
1.2 jdolecek 177:
1.3 jdolecek 178: # force the selected PHP version for recursive builds
179: PHP_VERSION_REQD:= ${PKG_PHP_VERSION}
180:
1.1 jdolecek 181: #
182: # set variables for the version we decided to use:
183: #
1.19 taca 184: .if ${_PHP_VERSION} == "53"
1.11 taca 185: PHPPKGSRCDIR= ../../lang/php53
1.18 taca 186: PHP_BASE_VERS= ${PHP53_VERSION}
1.11 taca 187: PHP_PKG_PREFIX= php53
1.37 ! taca 188: PHP_EXTENSION_DIR= lib/php/${PHP53_RELDATE}
1.18 taca 189: .elif ${_PHP_VERSION} == "54"
190: PHPPKGSRCDIR= ../../lang/php54
191: PHP_BASE_VERS= ${PHP54_VERSION}
192: PHP_PKG_PREFIX= php54
1.37 ! taca 193: PHP_EXTENSION_DIR= lib/php/${PHP54_RELDATE}
1.1 jdolecek 194: .else
195: # force an error
1.2 jdolecek 196: PKG_SKIP_REASON+= "${PKG_PHP} is not a valid package"
1.1 jdolecek 197: .endif
198:
1.11 taca 199: #
200: # check installed version aginst required:
201: #
1.37 ! taca 202: .if !empty(PHP_CHECK_INSTALLED:M[nN][oO])
! 203: .if defined(_PHP_VERSION_INSTALLED) && ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED}
1.13 taca 204: PKG_SKIP_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is already installed."
1.11 taca 205: .endif
206: .endif
207:
1.1 jdolecek 208: .endif # PHPVERSION_MK
CVSweb <webmaster@jp.NetBSD.org>