2010-03-16 16:25:36 +01:00
|
|
|
# $NetBSD: phpversion.mk,v 1.11 2010/03/16 15:25:36 taca Exp $
|
2007-06-18 09:21:09 +02:00
|
|
|
#
|
|
|
|
# This file selects a PHP version, based on the user's preferences and
|
2007-10-11 10:51:43 +02:00
|
|
|
# the installed packages. It does not add a dependency on the PHP
|
|
|
|
# package.
|
2007-06-18 09:21:09 +02:00
|
|
|
#
|
|
|
|
# === User-settable variables ===
|
|
|
|
#
|
|
|
|
# PHP_VERSION_DEFAULT
|
|
|
|
# The PHP version to choose when more than one is acceptable to
|
|
|
|
# the package.
|
|
|
|
#
|
2010-03-16 16:25:36 +01:00
|
|
|
# Possible: 5 53
|
2007-08-13 16:46:30 +02:00
|
|
|
# Default: 5
|
2007-06-18 09:21:09 +02:00
|
|
|
#
|
|
|
|
# === Package-settable variables ===
|
|
|
|
#
|
|
|
|
# PHP_VERSIONS_ACCEPTED
|
|
|
|
# The PHP versions that are accepted by the package.
|
|
|
|
#
|
2010-03-16 16:25:36 +01:00
|
|
|
# Possible: 5 53
|
2010-02-10 18:46:10 +01:00
|
|
|
# Default: 5
|
2007-06-18 09:21:09 +02:00
|
|
|
#
|
|
|
|
# PHP_VERSION_REQD
|
|
|
|
# If the package works only with a specific PHP version, this
|
|
|
|
# variable can be used to force it.
|
|
|
|
#
|
2010-03-16 16:25:36 +01:00
|
|
|
# Possible: (undefined) 5 53
|
2007-06-18 09:21:09 +02:00
|
|
|
# Default: (undefined)
|
|
|
|
#
|
|
|
|
# === Variables defined by this file ===
|
|
|
|
#
|
|
|
|
# PKG_PHP_VERSION
|
|
|
|
# The selected PHP version.
|
|
|
|
#
|
2010-03-16 16:25:36 +01:00
|
|
|
# Possible: 5 53
|
2007-06-18 09:21:09 +02:00
|
|
|
# Default: ${PHP_VERSION_DEFAULT}
|
|
|
|
#
|
2010-03-16 16:25:36 +01:00
|
|
|
# PKG_PHP_MAJOR_VERS
|
|
|
|
# The selected PHP's major version.
|
|
|
|
#
|
|
|
|
# Possible: 5
|
|
|
|
# Default: 5
|
|
|
|
#
|
2007-06-18 09:21:09 +02:00
|
|
|
# PKG_PHP
|
2010-03-16 16:25:36 +01:00
|
|
|
# The same as ${PKG_PHP_VERSION}, prefixed with "php-".
|
2007-06-18 09:21:09 +02:00
|
|
|
#
|
|
|
|
# PHPPKGSRCDIR
|
|
|
|
# The directory of the PHP implementation, relative to the
|
|
|
|
# package directory.
|
|
|
|
#
|
|
|
|
# Example: ../../lang/php5
|
|
|
|
#
|
|
|
|
# PHP_PKG_PREFIX
|
|
|
|
# The prefix that is prepended to the package name.
|
|
|
|
#
|
2010-03-16 16:25:36 +01:00
|
|
|
# Example: php5, php53
|
2007-06-18 09:21:09 +02:00
|
|
|
#
|
|
|
|
# Keywords: php
|
|
|
|
#
|
2004-10-31 20:30:29 +01:00
|
|
|
|
|
|
|
.if !defined(PHPVERSION_MK)
|
|
|
|
PHPVERSION_MK= defined
|
|
|
|
|
2007-09-20 11:11:07 +02:00
|
|
|
_VARGROUPS+= php
|
|
|
|
_USER_VARS.php= PHP_VERSION_DEFAULT
|
|
|
|
_PKG_VARS.php= PHP_VERSIONS_ACCEPTED PHP_VERSION_REQD
|
2010-03-16 16:25:36 +01:00
|
|
|
_SYS_VARS.php= PKG_PHP_VERSION PKG_PHP PHPPKGSRCDIR PHP_PKG_PREFIX \
|
|
|
|
PKG_PHP_MAJOR_VERS
|
2007-09-20 11:11:07 +02:00
|
|
|
|
2004-10-31 20:30:29 +01:00
|
|
|
.include "../../mk/bsd.prefs.mk"
|
|
|
|
|
2006-05-09 12:06:34 +02:00
|
|
|
PHP_VERSION_DEFAULT?= 5
|
2010-03-16 16:25:36 +01:00
|
|
|
PHP_VERSIONS_ACCEPTED?= 5 53
|
2004-10-31 20:30:29 +01:00
|
|
|
|
|
|
|
# transform the list into individual variables
|
|
|
|
.for pv in ${PHP_VERSIONS_ACCEPTED}
|
|
|
|
_PHP_VERSION_${pv}_OK= yes
|
|
|
|
.endfor
|
|
|
|
|
|
|
|
# check what is installed
|
|
|
|
.if exists(${LOCALBASE}/lib/php/20040412)
|
|
|
|
_PHP_VERSION_5_INSTALLED= yes
|
2010-03-16 16:25:36 +01:00
|
|
|
_PHP_VERSION_INSTALLED= 5
|
|
|
|
.elif exists(${LOCALBASE}/lib/php/20090630)
|
|
|
|
_PHP_VERSION_53_INSTALLED= yes
|
|
|
|
_PHP_VERSION_INSTALLED= 53
|
2004-10-31 20:30:29 +01:00
|
|
|
.endif
|
|
|
|
|
|
|
|
# if a version is explicitely required, take it
|
|
|
|
.if defined(PHP_VERSION_REQD)
|
|
|
|
_PHP_VERSION= ${PHP_VERSION_REQD}
|
|
|
|
.endif
|
|
|
|
# if the default is already installed, it is first choice
|
|
|
|
.if !defined(_PHP_VERSION)
|
|
|
|
.if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK)
|
|
|
|
.if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED)
|
|
|
|
_PHP_VERSION= ${PHP_VERSION_DEFAULT}
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
# prefer an already installed version, in order of "accepted"
|
|
|
|
.if !defined(_PHP_VERSION)
|
|
|
|
.for pv in ${PHP_VERSIONS_ACCEPTED}
|
|
|
|
.if defined(_PHP_VERSION_${pv}_INSTALLED)
|
|
|
|
_PHP_VERSION?= ${pv}
|
|
|
|
.else
|
|
|
|
# keep information as last resort - see below
|
|
|
|
_PHP_VERSION_FIRSTACCEPTED?= ${pv}
|
|
|
|
.endif
|
|
|
|
.endfor
|
|
|
|
.endif
|
|
|
|
# if the default is OK for the addon pkg, take this
|
|
|
|
.if !defined(_PHP_VERSION)
|
|
|
|
.if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK)
|
|
|
|
_PHP_VERSION= ${PHP_VERSION_DEFAULT}
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
# take the first one accepted by the package
|
|
|
|
.if !defined(_PHP_VERSION)
|
|
|
|
_PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED}
|
|
|
|
.endif
|
|
|
|
|
2004-11-04 19:40:39 +01:00
|
|
|
# export some of internal variables
|
2005-05-09 21:24:46 +02:00
|
|
|
PKG_PHP_VERSION:= ${_PHP_VERSION}
|
2010-03-16 16:25:36 +01:00
|
|
|
PKG_PHP:= php-${_PHP_VERSION}
|
|
|
|
|
|
|
|
# currently we have only PHP 5.x packages.
|
|
|
|
PKG_PHP_MAJOR_VERS:= 5
|
2004-11-04 19:40:39 +01:00
|
|
|
|
|
|
|
MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \
|
|
|
|
PKG_PHP=${PKG_PHP}
|
2010-03-16 16:25:36 +01:00
|
|
|
PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \
|
|
|
|
PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS}
|
2004-11-04 19:40:39 +01:00
|
|
|
|
2005-05-09 21:24:46 +02:00
|
|
|
# force the selected PHP version for recursive builds
|
|
|
|
PHP_VERSION_REQD:= ${PKG_PHP_VERSION}
|
|
|
|
|
2004-10-31 20:30:29 +01:00
|
|
|
#
|
|
|
|
# set variables for the version we decided to use:
|
|
|
|
#
|
2010-02-10 18:46:10 +01:00
|
|
|
.if ${_PHP_VERSION} == "5"
|
2006-06-02 20:27:54 +02:00
|
|
|
PHPPKGSRCDIR= ../../lang/php5
|
|
|
|
PHP_PKG_PREFIX= php5
|
2010-03-16 16:25:36 +01:00
|
|
|
.elif ${_PHP_VERSION} == "53"
|
|
|
|
PHPPKGSRCDIR= ../../lang/php53
|
|
|
|
PHP_PKG_PREFIX= php53
|
2004-10-31 20:30:29 +01:00
|
|
|
.else
|
|
|
|
# force an error
|
2004-11-04 19:40:39 +01:00
|
|
|
PKG_SKIP_REASON+= "${PKG_PHP} is not a valid package"
|
2004-10-31 20:30:29 +01:00
|
|
|
.endif
|
|
|
|
|
2010-03-16 16:25:36 +01:00
|
|
|
#
|
|
|
|
# check installed version aginst required:
|
|
|
|
#
|
|
|
|
.if defined(_PHP_VERSION_INSTALLED)
|
|
|
|
.if ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED}
|
|
|
|
PKG_SKIP_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is installed."
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2004-10-31 20:30:29 +01:00
|
|
|
.endif # PHPVERSION_MK
|