Annotation of pkgsrc/lang/php/phpversion.mk, revision 1.33
1.33 ! taca 1: # $NetBSD: phpversion.mk,v 1.32 2013/04/12 17:01:46 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: #
33: # === Variables defined by this file ===
34: #
35: # PKG_PHP_VERSION
36: # The selected PHP version.
37: #
1.19 taca 38: # Possible: 53 54
1.11 taca 39: # Default: ${PHP_VERSION_DEFAULT}
40: #
1.18 taca 41: # PHP_BASE_VERS
42: # The selected PHP's full version depends on PKG_PHP_VERSION
43: #
1.11 taca 44: # PKG_PHP_MAJOR_VERS
45: # The selected PHP's major version.
46: #
1.10 joerg 47: # Possible: 5
1.11 taca 48: # Default: 5
1.6 rillig 49: #
50: # PKG_PHP
1.11 taca 51: # The same as ${PKG_PHP_VERSION}, prefixed with "php-".
1.6 rillig 52: #
53: # PHPPKGSRCDIR
54: # The directory of the PHP implementation, relative to the
55: # package directory.
56: #
1.31 taca 57: # Example: ../../lang/php54
1.6 rillig 58: #
59: # PHP_PKG_PREFIX
60: # The prefix that is prepended to the package name.
61: #
1.19 taca 62: # Example: php53, php54
1.6 rillig 63: #
64: # Keywords: php
65: #
1.1 jdolecek 66:
67: .if !defined(PHPVERSION_MK)
68: PHPVERSION_MK= defined
69:
1.8 rillig 70: _VARGROUPS+= php
71: _USER_VARS.php= PHP_VERSION_DEFAULT
72: _PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD
1.11 taca 73: _SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX \
74: PKG_PHP_MAJOR_VERS
1.8 rillig 75:
1.1 jdolecek 76: .include "../../mk/bsd.prefs.mk"
77:
1.33 ! taca 78: PHP53_VERSION= 5.3.25
! 79: PHP54_VERSION= 5.4.15
1.18 taca 80:
1.31 taca 81: PHP_VERSION_DEFAULT?= 54
82: PHP_VERSIONS_ACCEPTED?= 54 53
1.1 jdolecek 83:
84: # transform the list into individual variables
85: .for pv in ${PHP_VERSIONS_ACCEPTED}
86: _PHP_VERSION_${pv}_OK= yes
87: .endfor
88:
89: # check what is installed
1.18 taca 90: .if exists(${LOCALBASE}/lib/php/20120301)
91: _PHP_VERSION_54_INSTALLED= yes
92: _PHP_INSTALLED= yes
93: .elif exists(${LOCALBASE}/lib/php/20090626) || exists(${LOCALBASE}/include/php/Zend/zend_gc.h)
94: _PHP_VERSION_53_INSTALLED= yes
95: _PHP_INSTALLED= yes
1.1 jdolecek 96: .endif
97:
98: # if a version is explicitely required, take it
99: .if defined(PHP_VERSION_REQD)
100: _PHP_VERSION= ${PHP_VERSION_REQD}
101: .endif
102: # if the default is already installed, it is first choice
103: .if !defined(_PHP_VERSION)
104: .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK)
105: .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED)
106: _PHP_VERSION= ${PHP_VERSION_DEFAULT}
107: .endif
108: .endif
109: .endif
110: # prefer an already installed version, in order of "accepted"
111: .if !defined(_PHP_VERSION)
112: .for pv in ${PHP_VERSIONS_ACCEPTED}
113: .if defined(_PHP_VERSION_${pv}_INSTALLED)
114: _PHP_VERSION?= ${pv}
115: .else
116: # keep information as last resort - see below
117: _PHP_VERSION_FIRSTACCEPTED?= ${pv}
118: .endif
119: .endfor
120: .endif
121: # if the default is OK for the addon pkg, take this
122: .if !defined(_PHP_VERSION)
123: .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK)
124: _PHP_VERSION= ${PHP_VERSION_DEFAULT}
125: .endif
126: .endif
127: # take the first one accepted by the package
128: .if !defined(_PHP_VERSION)
129: _PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED}
130: .endif
131:
1.14 wiz 132: #
133: # Variable assignment for multi-PHP packages
134: MULTI+= PHP_VERSION_REQD=${_PHP_VERSION}
135:
1.2 jdolecek 136: # export some of internal variables
1.12 jdolecek 137: PKG_PHP_VERSION:= ${_PHP_VERSION:C/\.[0-9]//}
138: PKG_PHP:= PHP${_PHP_VERSION:C/([0-9])([0-9])/\1.\2/}
1.11 taca 139:
140: # currently we have only PHP 5.x packages.
141: PKG_PHP_MAJOR_VERS:= 5
1.2 jdolecek 142:
1.12 jdolecek 143: # if installed PHP isn't compatible with required PHP, bail out
144: .if defined(_PHP_INSTALLED) && !defined(_PHP_VERSION_${_PHP_VERSION}_INSTALLED)
145: PKG_SKIP_REASON+= "Package accepts ${PKG_PHP}, but different version is installed"
146: .endif
147:
1.2 jdolecek 148: MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \
149: PKG_PHP=${PKG_PHP}
1.11 taca 150: PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \
1.18 taca 151: PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS} \
152: PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR}
1.2 jdolecek 153:
1.3 jdolecek 154: # force the selected PHP version for recursive builds
155: PHP_VERSION_REQD:= ${PKG_PHP_VERSION}
156:
1.1 jdolecek 157: #
158: # set variables for the version we decided to use:
159: #
1.19 taca 160: .if ${_PHP_VERSION} == "53"
1.11 taca 161: PHPPKGSRCDIR= ../../lang/php53
1.18 taca 162: PHP_BASE_VERS= ${PHP53_VERSION}
1.11 taca 163: PHP_PKG_PREFIX= php53
1.18 taca 164: .elif ${_PHP_VERSION} == "54"
165: PHPPKGSRCDIR= ../../lang/php54
166: PHP_BASE_VERS= ${PHP54_VERSION}
167: PHP_PKG_PREFIX= php54
1.1 jdolecek 168: .else
169: # force an error
1.2 jdolecek 170: PKG_SKIP_REASON+= "${PKG_PHP} is not a valid package"
1.1 jdolecek 171: .endif
172:
1.11 taca 173: #
174: # check installed version aginst required:
175: #
176: .if defined(_PHP_VERSION_INSTALLED)
177: .if ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED}
1.13 taca 178: PKG_SKIP_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is already installed."
1.11 taca 179: .endif
180: .endif
181:
1.1 jdolecek 182: .endif # PHPVERSION_MK
CVSweb <webmaster@jp.NetBSD.org>