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