Annotation of pkgsrc/lang/php/phpversion.mk, revision 1.148
1.148 ! jdolecek 1: # $NetBSD: phpversion.mk,v 1.147 2016/08/04 14:01:28 jdolecek 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.147 jdolecek 13: # Possible: 55 56 70 71
1.146 jdolecek 14: # Default: 56
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.147 jdolecek 30: # Possible: 55 56 70 71
1.117 taca 31: # Default: 55 56
1.6 rillig 32: #
1.37 taca 33: # PHP_CHECK_INSTALLED
1.117 taca 34: # Check installed version of PHP. Should be used by lang/php55,
1.147 jdolecek 35: # lang/php56, lang/php70, or lang/php71 only.
1.37 taca 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.147 jdolecek 45: # Possible: 55 56 70 71
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.118 taca 54: # Possible: 5 7
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.117 taca 64: # Example: ../../lang/php55
1.6 rillig 65: #
66: # PHP_PKG_PREFIX
67: # The prefix that is prepended to the package name.
68: #
1.147 jdolecek 69: # Example: php55 php56 php70 php71
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.
1.142 taca 84: PHP55_VERSION= 5.5.38
1.143 taca 85: PHP56_VERSION= 5.6.24
1.144 taca 86: PHP70_VERSION= 7.0.9
1.148 ! jdolecek 87: PHP71_VERSION= 7.1.0beta2
1.37 taca 88:
89: # Define initial release of major version.
90: PHP55_RELDATE= 20130620
1.78 taca 91: PHP56_RELDATE= 20140828
1.118 taca 92: PHP70_RELDATE= 20151203
1.147 jdolecek 93: PHP71_RELDATE= 20160303
1.37 taca 94:
1.8 rillig 95: _VARGROUPS+= php
96: _USER_VARS.php= PHP_VERSION_DEFAULT
97: _PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD
1.11 taca 98: _SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX \
99: PKG_PHP_MAJOR_VERS
1.8 rillig 100:
1.1 jdolecek 101: .include "../../mk/bsd.prefs.mk"
102:
1.145 jdolecek 103: PHP_VERSION_DEFAULT?= 56
1.147 jdolecek 104: PHP_VERSIONS_ACCEPTED?= 55 56 70 71
1.1 jdolecek 105:
106: # transform the list into individual variables
107: .for pv in ${PHP_VERSIONS_ACCEPTED}
108: _PHP_VERSION_${pv}_OK= yes
109: .endfor
110:
111: # check what is installed
1.147 jdolecek 112: .if exists(${LOCALBASE}/lib/php/${PHP71_RELDATE})
113: _PHP_VERSION_71_INSTALLED= yes
114: _PHP_INSTALLED= yes
115: .elif exists(${LOCALBASE}/lib/php/${PHP70_RELDATE})
1.132 wiz 116: _PHP_VERSION_70_INSTALLED= yes
117: _PHP_INSTALLED= yes
1.147 jdolecek 118: .elif exists(${LOCALBASE}/lib/php/${PHP56_RELDATE})
1.78 taca 119: _PHP_VERSION_56_INSTALLED= yes
120: _PHP_INSTALLED= yes
1.147 jdolecek 121: .elif exists(${LOCALBASE}/lib/php/${PHP55_RELDATE})
1.38 taca 122: _PHP_VERSION_55_INSTALLED= yes
123: _PHP_INSTALLED= yes
1.1 jdolecek 124: .endif
125:
126: # if a version is explicitely required, take it
127: .if defined(PHP_VERSION_REQD)
128: _PHP_VERSION= ${PHP_VERSION_REQD}
129: .endif
130: # if the default is already installed, it is first choice
131: .if !defined(_PHP_VERSION)
132: .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK)
133: .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED)
134: _PHP_VERSION= ${PHP_VERSION_DEFAULT}
135: .endif
136: .endif
137: .endif
138: # prefer an already installed version, in order of "accepted"
139: .if !defined(_PHP_VERSION)
140: .for pv in ${PHP_VERSIONS_ACCEPTED}
141: .if defined(_PHP_VERSION_${pv}_INSTALLED)
142: _PHP_VERSION?= ${pv}
143: .else
144: # keep information as last resort - see below
145: _PHP_VERSION_FIRSTACCEPTED?= ${pv}
146: .endif
147: .endfor
148: .endif
149: # if the default is OK for the addon pkg, take this
150: .if !defined(_PHP_VERSION)
151: .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK)
152: _PHP_VERSION= ${PHP_VERSION_DEFAULT}
153: .endif
154: .endif
155: # take the first one accepted by the package
156: .if !defined(_PHP_VERSION)
157: _PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED}
158: .endif
159:
1.14 wiz 160: #
161: # Variable assignment for multi-PHP packages
162: MULTI+= PHP_VERSION_REQD=${_PHP_VERSION}
163:
1.2 jdolecek 164: # export some of internal variables
1.12 jdolecek 165: PKG_PHP_VERSION:= ${_PHP_VERSION:C/\.[0-9]//}
1.38 taca 166: PKG_PHP:= PHP${_PHP_VERSION:C/([0-9])([0-9])/\1.\2/}
1.11 taca 167:
1.118 taca 168: # Major version
169: PKG_PHP_MAJOR_VERS:= ${_PHP_VERSION:C/^([0-9]).*/\1/}
1.2 jdolecek 170:
1.37 taca 171: PHP_CHECK_INSTALLED?= Yes
172:
1.12 jdolecek 173: # if installed PHP isn't compatible with required PHP, bail out
1.39 taca 174: .if empty(PHP_CHECK_INSTALLED:M[nN][oO])
1.12 jdolecek 175: .if defined(_PHP_INSTALLED) && !defined(_PHP_VERSION_${_PHP_VERSION}_INSTALLED)
1.82 dholland 176: PKG_FAIL_REASON+= "Package accepts ${PKG_PHP}, but different version is installed"
1.12 jdolecek 177: .endif
1.37 taca 178: .endif
1.12 jdolecek 179:
1.2 jdolecek 180: MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \
181: PKG_PHP=${PKG_PHP}
1.11 taca 182: PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \
1.18 taca 183: PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS} \
184: PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR}
1.2 jdolecek 185:
1.3 jdolecek 186: # force the selected PHP version for recursive builds
187: PHP_VERSION_REQD:= ${PKG_PHP_VERSION}
188:
1.1 jdolecek 189: #
190: # set variables for the version we decided to use:
191: #
1.117 taca 192: .if ${_PHP_VERSION} == "55"
1.38 taca 193: PHPPKGSRCDIR= ../../lang/php55
1.89 taca 194: PHP_VERSION= ${PHP55_VERSION}
195: PHP_INITIAL_TEENY= 1
1.38 taca 196: PHP_PKG_PREFIX= php55
197: PHP_EXTENSION_DIR= lib/php/${PHP55_RELDATE}
1.78 taca 198: .elif ${_PHP_VERSION} == "56"
199: PHPPKGSRCDIR= ../../lang/php56
1.89 taca 200: PHP_VERSION= ${PHP56_VERSION}
201: PHP_INITIAL_TEENY= 3
1.78 taca 202: PHP_PKG_PREFIX= php56
203: PHP_EXTENSION_DIR= lib/php/${PHP56_RELDATE}
1.118 taca 204: .elif ${_PHP_VERSION} == "70"
205: PHPPKGSRCDIR= ../../lang/php70
206: PHP_VERSION= ${PHP70_VERSION}
207: PHP_INITIAL_TEENY= 0
208: PHP_PKG_PREFIX= php70
209: PHP_EXTENSION_DIR= lib/php/${PHP70_RELDATE}
1.147 jdolecek 210: .elif ${_PHP_VERSION} == "71"
211: PHPPKGSRCDIR= ../../lang/php71
212: PHP_VERSION= ${PHP71_VERSION}
213: PHP_INITIAL_TEENY= 0
214: PHP_PKG_PREFIX= php71
215: PHP_EXTENSION_DIR= lib/php/${PHP71_RELDATE}
1.1 jdolecek 216: .else
217: # force an error
1.82 dholland 218: PKG_FAIL_REASON+= "${PKG_PHP} is not a valid package"
1.1 jdolecek 219: .endif
220:
1.89 taca 221: _PHP_VER_MAJOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/}
222: _PHP_VER_MINOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/}
223:
224: PHP_BASE_VERS= ${_PHP_VER_MAJOR}.${_PHP_VER_MINOR}.${PHP_INITIAL_TEENY}
225:
1.11 taca 226: #
227: # check installed version aginst required:
228: #
1.37 taca 229: .if !empty(PHP_CHECK_INSTALLED:M[nN][oO])
230: .if defined(_PHP_VERSION_INSTALLED) && ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED}
1.82 dholland 231: PKG_FAIL_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is already installed."
1.11 taca 232: .endif
233: .endif
234:
1.1 jdolecek 235: .endif # PHPVERSION_MK
CVSweb <webmaster@jp.NetBSD.org>