Tue Mar 16 15:25:36 2010 UTC ()
Prepair for importing PHP 5.3.2.

* Add "53" as PHP 5.3.x for several PHP_VERSION_* and its frends.
* Add PKG_PHP_MAJOR_VERS which currently only takes "5".
* Add "php53" to PHP_PKG_PREFIX.
* Add checking installed PHP's version against required version.


(taca)
diff -r1.10 -r1.11 pkgsrc/lang/php/phpversion.mk

cvs diff -r1.10 -r1.11 pkgsrc/lang/php/phpversion.mk (expand / switch to unified diff)

--- pkgsrc/lang/php/phpversion.mk 2010/02/10 17:46:10 1.10
+++ pkgsrc/lang/php/phpversion.mk 2010/03/16 15:25:36 1.11
@@ -1,90 +1,100 @@ @@ -1,90 +1,100 @@
1# $NetBSD: phpversion.mk,v 1.10 2010/02/10 17:46:10 joerg Exp $ 1# $NetBSD: phpversion.mk,v 1.11 2010/03/16 15:25:36 taca Exp $
2# 2#
3# This file selects a PHP version, based on the user's preferences and 3# This file selects a PHP version, based on the user's preferences and
4# the installed packages. It does not add a dependency on the PHP 4# the installed packages. It does not add a dependency on the PHP
5# package. 5# package.
6# 6#
7# === User-settable variables === 7# === User-settable variables ===
8# 8#
9# PHP_VERSION_DEFAULT 9# PHP_VERSION_DEFAULT
10# The PHP version to choose when more than one is acceptable to 10# The PHP version to choose when more than one is acceptable to
11# the package. 11# the package.
12# 12#
13# Possible: 5 13# Possible: 5 53
14# Default: 5 14# Default: 5
15# 15#
16# === Package-settable variables === 16# === Package-settable variables ===
17# 17#
18# PHP_VERSIONS_ACCEPTED 18# PHP_VERSIONS_ACCEPTED
19# The PHP versions that are accepted by the package. 19# The PHP versions that are accepted by the package.
20# 20#
21# Possible: 5 21# Possible: 5 53
22# Default: 5 22# Default: 5
23# 23#
24# PHP_VERSION_REQD 24# PHP_VERSION_REQD
25# If the package works only with a specific PHP version, this 25# If the package works only with a specific PHP version, this
26# variable can be used to force it. 26# variable can be used to force it.
27# 27#
28# Possible: (undefined) 5 28# Possible: (undefined) 5 53
29# Default: (undefined) 29# Default: (undefined)
30# 30#
31# === Variables defined by this file === 31# === Variables defined by this file ===
32# 32#
33# PKG_PHP_VERSION 33# PKG_PHP_VERSION
34# The selected PHP version. 34# The selected PHP version.
35# 35#
36# Possible: 5 36# Possible: 5 53
37# Default: ${PHP_VERSION_DEFAULT} 37# Default: ${PHP_VERSION_DEFAULT}
38# 38#
 39# PKG_PHP_MAJOR_VERS
 40# The selected PHP's major version.
 41#
 42# Possible: 5
 43# Default: 5
 44#
39# PKG_PHP 45# PKG_PHP
40# The same as ${PKG_PHP_VERSION}, prefixed with "PHP". 46# The same as ${PKG_PHP_VERSION}, prefixed with "php-".
41# XXX: Why is this necessary? 
42# 47#
43# PHPPKGSRCDIR 48# PHPPKGSRCDIR
44# The directory of the PHP implementation, relative to the 49# The directory of the PHP implementation, relative to the
45# package directory. 50# package directory.
46# 51#
47# Example: ../../lang/php5 52# Example: ../../lang/php5
48# 53#
49# PHP_PKG_PREFIX 54# PHP_PKG_PREFIX
50# The prefix that is prepended to the package name. 55# The prefix that is prepended to the package name.
51# 56#
52# Example: php5 57# Example: php5, php53
53# 58#
54# Keywords: php 59# Keywords: php
55# 60#
56 61
57.if !defined(PHPVERSION_MK) 62.if !defined(PHPVERSION_MK)
58PHPVERSION_MK= defined 63PHPVERSION_MK= defined
59 64
60_VARGROUPS+= php 65_VARGROUPS+= php
61_USER_VARS.php= PHP_VERSION_DEFAULT 66_USER_VARS.php= PHP_VERSION_DEFAULT
62_PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD 67_PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD
63_SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX 68_SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX \
 69 PKG_PHP_MAJOR_VERS
64 70
65.include "../../mk/bsd.prefs.mk" 71.include "../../mk/bsd.prefs.mk"
66 72
67PHP_VERSION_DEFAULT?= 5 73PHP_VERSION_DEFAULT?= 5
68PHP_VERSIONS_ACCEPTED?= 5 74PHP_VERSIONS_ACCEPTED?= 5 53
69 75
70# transform the list into individual variables 76# transform the list into individual variables
71.for pv in ${PHP_VERSIONS_ACCEPTED} 77.for pv in ${PHP_VERSIONS_ACCEPTED}
72_PHP_VERSION_${pv}_OK= yes 78_PHP_VERSION_${pv}_OK= yes
73.endfor 79.endfor
74 80
75# check what is installed 81# check what is installed
76.if exists(${LOCALBASE}/lib/php/20040412) 82.if exists(${LOCALBASE}/lib/php/20040412)
77_PHP_VERSION_5_INSTALLED= yes 83_PHP_VERSION_5_INSTALLED= yes
 84_PHP_VERSION_INSTALLED= 5
 85.elif exists(${LOCALBASE}/lib/php/20090630)
 86_PHP_VERSION_53_INSTALLED= yes
 87_PHP_VERSION_INSTALLED= 53
78.endif 88.endif
79 89
80# if a version is explicitely required, take it 90# if a version is explicitely required, take it
81.if defined(PHP_VERSION_REQD) 91.if defined(PHP_VERSION_REQD)
82_PHP_VERSION= ${PHP_VERSION_REQD} 92_PHP_VERSION= ${PHP_VERSION_REQD}
83.endif 93.endif
84# if the default is already installed, it is first choice 94# if the default is already installed, it is first choice
85.if !defined(_PHP_VERSION) 95.if !defined(_PHP_VERSION)
86.if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) 96.if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK)
87.if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED) 97.if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED)
88_PHP_VERSION= ${PHP_VERSION_DEFAULT} 98_PHP_VERSION= ${PHP_VERSION_DEFAULT}
89.endif 99.endif
90.endif 100.endif
@@ -103,34 +113,50 @@ _PHP_VERSION_FIRSTACCEPTED?= ${pv} @@ -103,34 +113,50 @@ _PHP_VERSION_FIRSTACCEPTED?= ${pv}
103# if the default is OK for the addon pkg, take this 113# if the default is OK for the addon pkg, take this
104.if !defined(_PHP_VERSION) 114.if !defined(_PHP_VERSION)
105.if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK) 115.if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK)
106_PHP_VERSION= ${PHP_VERSION_DEFAULT} 116_PHP_VERSION= ${PHP_VERSION_DEFAULT}
107.endif 117.endif
108.endif 118.endif
109# take the first one accepted by the package 119# take the first one accepted by the package
110.if !defined(_PHP_VERSION) 120.if !defined(_PHP_VERSION)
111_PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED} 121_PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED}
112.endif 122.endif
113 123
114# export some of internal variables 124# export some of internal variables
115PKG_PHP_VERSION:= ${_PHP_VERSION} 125PKG_PHP_VERSION:= ${_PHP_VERSION}
116PKG_PHP:= PHP${_PHP_VERSION} 126PKG_PHP:= php-${_PHP_VERSION}
 127
 128# currently we have only PHP 5.x packages.
 129PKG_PHP_MAJOR_VERS:= 5
117 130
118MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \ 131MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \
119 PKG_PHP=${PKG_PHP} 132 PKG_PHP=${PKG_PHP}
120PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} 133PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \
 134 PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS}
121 135
122# force the selected PHP version for recursive builds 136# force the selected PHP version for recursive builds
123PHP_VERSION_REQD:= ${PKG_PHP_VERSION} 137PHP_VERSION_REQD:= ${PKG_PHP_VERSION}
124 138
125# 139#
126# set variables for the version we decided to use: 140# set variables for the version we decided to use:
127# 141#
128.if ${_PHP_VERSION} == "5" 142.if ${_PHP_VERSION} == "5"
129PHPPKGSRCDIR= ../../lang/php5 143PHPPKGSRCDIR= ../../lang/php5
130PHP_PKG_PREFIX= php5 144PHP_PKG_PREFIX= php5
 145.elif ${_PHP_VERSION} == "53"
 146PHPPKGSRCDIR= ../../lang/php53
 147PHP_PKG_PREFIX= php53
131.else 148.else
132# force an error 149# force an error
133PKG_SKIP_REASON+= "${PKG_PHP} is not a valid package" 150PKG_SKIP_REASON+= "${PKG_PHP} is not a valid package"
134.endif 151.endif
135 152
 153#
 154# check installed version aginst required:
 155#
 156.if defined(_PHP_VERSION_INSTALLED)
 157.if ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED}
 158PKG_SKIP_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is installed."
 159.endif
 160.endif
 161
136.endif # PHPVERSION_MK 162.endif # PHPVERSION_MK