2016-01-08 04:29:12 +01:00
|
|
|
# $NetBSD: phpversion.mk,v 1.122 2016/01/08 03:29:12 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
|
2012-06-16 04:47:51 +02:00
|
|
|
# the package.
|
2007-06-18 09:21:09 +02:00
|
|
|
#
|
2015-12-06 16:13:02 +01:00
|
|
|
# Possible: 55 56 70
|
2015-09-26 22:02:38 +02:00
|
|
|
# Default: 55
|
2007-06-18 09:21:09 +02:00
|
|
|
#
|
2012-10-04 01:48:00 +02:00
|
|
|
# === Infrastructure variables ===
|
|
|
|
#
|
2012-09-16 22:03:50 +02:00
|
|
|
# PHP_VERSION_REQD
|
2012-10-04 01:48:00 +02:00
|
|
|
# PHP version to use. This variable should not be set in
|
|
|
|
# packages. Normally it is used by bulk build tools.
|
2012-09-16 22:03:50 +02:00
|
|
|
#
|
|
|
|
# Possible: ${PHP_VERSIONS_ACCEPTED}
|
|
|
|
# Default: ${PHP_VERSION_DEFAULT}
|
|
|
|
#
|
2007-06-18 09:21:09 +02:00
|
|
|
# === Package-settable variables ===
|
|
|
|
#
|
|
|
|
# PHP_VERSIONS_ACCEPTED
|
|
|
|
# The PHP versions that are accepted by the package.
|
|
|
|
#
|
2015-12-06 16:13:02 +01:00
|
|
|
# Possible: 55 56 70
|
2015-12-05 06:50:33 +01:00
|
|
|
# Default: 55 56
|
2007-06-18 09:21:09 +02:00
|
|
|
#
|
2013-07-21 19:29:47 +02:00
|
|
|
# PHP_CHECK_INSTALLED
|
2015-12-05 06:50:33 +01:00
|
|
|
# Check installed version of PHP. Should be used by lang/php55,
|
2015-12-06 16:13:02 +01:00
|
|
|
# lang/php56 and lang/php70 only.
|
2013-07-21 19:29:47 +02:00
|
|
|
#
|
|
|
|
# Possible: Yes No
|
|
|
|
# Default: Yes
|
|
|
|
#
|
2007-06-18 09:21:09 +02:00
|
|
|
# === Variables defined by this file ===
|
|
|
|
#
|
|
|
|
# PKG_PHP_VERSION
|
|
|
|
# The selected PHP version.
|
|
|
|
#
|
2015-12-06 16:13:02 +01:00
|
|
|
# Possible: 55 56 70
|
2007-06-18 09:21:09 +02:00
|
|
|
# Default: ${PHP_VERSION_DEFAULT}
|
|
|
|
#
|
2012-06-16 04:47:51 +02:00
|
|
|
# PHP_BASE_VERS
|
|
|
|
# The selected PHP's full version depends on PKG_PHP_VERSION
|
|
|
|
#
|
2010-03-16 16:25:36 +01:00
|
|
|
# PKG_PHP_MAJOR_VERS
|
|
|
|
# The selected PHP's major version.
|
|
|
|
#
|
2015-12-06 16:13:02 +01:00
|
|
|
# Possible: 5 7
|
2010-03-16 16:25:36 +01:00
|
|
|
# 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.
|
|
|
|
#
|
2015-12-05 06:50:33 +01:00
|
|
|
# Example: ../../lang/php55
|
2007-06-18 09:21:09 +02:00
|
|
|
#
|
|
|
|
# PHP_PKG_PREFIX
|
|
|
|
# The prefix that is prepended to the package name.
|
|
|
|
#
|
2015-12-06 16:13:02 +01:00
|
|
|
# Example: php55 php56 php70
|
2007-06-18 09:21:09 +02:00
|
|
|
#
|
2013-07-21 19:29:47 +02:00
|
|
|
# PHP_EXTENSION_DIR
|
|
|
|
# Relative path to ${PREFIX} for PHP's extensions. It is derived from
|
|
|
|
# initial release of major version.
|
|
|
|
#
|
|
|
|
# Example: lib/php/20090630
|
|
|
|
#
|
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
|
|
|
|
|
2013-07-21 19:29:47 +02:00
|
|
|
# Define each PHP's version.
|
2016-01-08 04:27:23 +01:00
|
|
|
PHP55_VERSION= 5.5.31
|
2016-01-08 04:28:20 +01:00
|
|
|
PHP56_VERSION= 5.6.17
|
2016-01-08 04:29:12 +01:00
|
|
|
PHP70_VERSION= 7.0.2
|
2013-07-21 19:29:47 +02:00
|
|
|
|
|
|
|
# Define initial release of major version.
|
|
|
|
PHP55_RELDATE= 20130620
|
2014-11-24 16:36:05 +01:00
|
|
|
PHP56_RELDATE= 20140828
|
2015-12-06 16:13:02 +01:00
|
|
|
PHP70_RELDATE= 20151203
|
2013-07-21 19:29:47 +02:00
|
|
|
|
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"
|
|
|
|
|
2015-09-26 22:02:38 +02:00
|
|
|
PHP_VERSION_DEFAULT?= 55
|
2015-12-06 16:13:02 +01:00
|
|
|
PHP_VERSIONS_ACCEPTED?= 55 56 70
|
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
|
2014-11-24 16:36:05 +01:00
|
|
|
.if exists(${LOCALBASE}/lib/php/20140828)
|
|
|
|
_PHP_VERSION_56_INSTALLED= yes
|
|
|
|
_PHP_INSTALLED= yes
|
|
|
|
.elif exists(${LOCALBASE}/lib/php/20130620)
|
2013-07-29 18:38:12 +02:00
|
|
|
_PHP_VERSION_55_INSTALLED= yes
|
|
|
|
_PHP_INSTALLED= yes
|
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
|
|
|
|
|
2011-03-12 15:07:13 +01:00
|
|
|
#
|
|
|
|
# Variable assignment for multi-PHP packages
|
|
|
|
MULTI+= PHP_VERSION_REQD=${_PHP_VERSION}
|
|
|
|
|
2004-11-04 19:40:39 +01:00
|
|
|
# export some of internal variables
|
2010-03-21 12:07:37 +01:00
|
|
|
PKG_PHP_VERSION:= ${_PHP_VERSION:C/\.[0-9]//}
|
2013-07-29 18:38:12 +02:00
|
|
|
PKG_PHP:= PHP${_PHP_VERSION:C/([0-9])([0-9])/\1.\2/}
|
2010-03-16 16:25:36 +01:00
|
|
|
|
2015-12-06 16:13:02 +01:00
|
|
|
# Major version
|
|
|
|
PKG_PHP_MAJOR_VERS:= ${_PHP_VERSION:C/^([0-9]).*/\1/}
|
2004-11-04 19:40:39 +01:00
|
|
|
|
2013-07-21 19:29:47 +02:00
|
|
|
PHP_CHECK_INSTALLED?= Yes
|
|
|
|
|
2010-03-21 12:07:37 +01:00
|
|
|
# if installed PHP isn't compatible with required PHP, bail out
|
2013-08-14 16:53:03 +02:00
|
|
|
.if empty(PHP_CHECK_INSTALLED:M[nN][oO])
|
2010-03-21 12:07:37 +01:00
|
|
|
.if defined(_PHP_INSTALLED) && !defined(_PHP_VERSION_${_PHP_VERSION}_INSTALLED)
|
2015-01-01 12:51:41 +01:00
|
|
|
PKG_FAIL_REASON+= "Package accepts ${PKG_PHP}, but different version is installed"
|
2010-03-21 12:07:37 +01:00
|
|
|
.endif
|
2013-07-21 19:29:47 +02:00
|
|
|
.endif
|
2010-03-21 12:07:37 +01:00
|
|
|
|
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} \
|
2012-06-16 04:47:51 +02:00
|
|
|
PKG_PHP_MAJOR_VERS=${PKG_PHP_MAJOR_VERS} \
|
|
|
|
PHP_EXTENSION_DIR=${PHP_EXTENSION_DIR}
|
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:
|
|
|
|
#
|
2015-12-05 06:50:33 +01:00
|
|
|
.if ${_PHP_VERSION} == "55"
|
2013-07-29 18:38:12 +02:00
|
|
|
PHPPKGSRCDIR= ../../lang/php55
|
Make PHP_BASE_VERS to initial php{53,54,55,56} version imported.
So, update of php{53,54,55,56} dose not change minimum version of depending
php{53,54,55,56} any more.
Since it relax minimum version, no need to bump PKGREVISION of each pacakge
depending to php{53,54,55,56}. If a package requires specific (and later)
versino of PHP, it should already specify such a version in dependency.
2015-03-15 12:50:53 +01:00
|
|
|
PHP_VERSION= ${PHP55_VERSION}
|
|
|
|
PHP_INITIAL_TEENY= 1
|
2013-07-29 18:38:12 +02:00
|
|
|
PHP_PKG_PREFIX= php55
|
|
|
|
PHP_EXTENSION_DIR= lib/php/${PHP55_RELDATE}
|
2014-11-24 16:36:05 +01:00
|
|
|
.elif ${_PHP_VERSION} == "56"
|
|
|
|
PHPPKGSRCDIR= ../../lang/php56
|
Make PHP_BASE_VERS to initial php{53,54,55,56} version imported.
So, update of php{53,54,55,56} dose not change minimum version of depending
php{53,54,55,56} any more.
Since it relax minimum version, no need to bump PKGREVISION of each pacakge
depending to php{53,54,55,56}. If a package requires specific (and later)
versino of PHP, it should already specify such a version in dependency.
2015-03-15 12:50:53 +01:00
|
|
|
PHP_VERSION= ${PHP56_VERSION}
|
|
|
|
PHP_INITIAL_TEENY= 3
|
2014-11-24 16:36:05 +01:00
|
|
|
PHP_PKG_PREFIX= php56
|
|
|
|
PHP_EXTENSION_DIR= lib/php/${PHP56_RELDATE}
|
2015-12-06 16:13:02 +01:00
|
|
|
.elif ${_PHP_VERSION} == "70"
|
|
|
|
PHPPKGSRCDIR= ../../lang/php70
|
|
|
|
PHP_VERSION= ${PHP70_VERSION}
|
|
|
|
PHP_INITIAL_TEENY= 0
|
|
|
|
PHP_PKG_PREFIX= php70
|
|
|
|
PHP_EXTENSION_DIR= lib/php/${PHP70_RELDATE}
|
2004-10-31 20:30:29 +01:00
|
|
|
.else
|
|
|
|
# force an error
|
2015-01-01 12:51:41 +01:00
|
|
|
PKG_FAIL_REASON+= "${PKG_PHP} is not a valid package"
|
2004-10-31 20:30:29 +01:00
|
|
|
.endif
|
|
|
|
|
Make PHP_BASE_VERS to initial php{53,54,55,56} version imported.
So, update of php{53,54,55,56} dose not change minimum version of depending
php{53,54,55,56} any more.
Since it relax minimum version, no need to bump PKGREVISION of each pacakge
depending to php{53,54,55,56}. If a package requires specific (and later)
versino of PHP, it should already specify such a version in dependency.
2015-03-15 12:50:53 +01:00
|
|
|
_PHP_VER_MAJOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\1/}
|
|
|
|
_PHP_VER_MINOR= ${PHP_VERSION:C/([0-9]+)\.([0-9]+)\.([0-9]+)/\2/}
|
|
|
|
|
|
|
|
PHP_BASE_VERS= ${_PHP_VER_MAJOR}.${_PHP_VER_MINOR}.${PHP_INITIAL_TEENY}
|
|
|
|
|
2010-03-16 16:25:36 +01:00
|
|
|
#
|
|
|
|
# check installed version aginst required:
|
|
|
|
#
|
2013-07-21 19:29:47 +02:00
|
|
|
.if !empty(PHP_CHECK_INSTALLED:M[nN][oO])
|
|
|
|
.if defined(_PHP_VERSION_INSTALLED) && ${_PHP_VERSION} != ${_PHP_VERSION_INSTALLED}
|
2015-01-01 12:51:41 +01:00
|
|
|
PKG_FAIL_REASON+= "${PKGBASE} requires ${PKG_PHP}, but php-${_PHP_VERSION_INSTALLED} is already installed."
|
2010-03-16 16:25:36 +01:00
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
2004-10-31 20:30:29 +01:00
|
|
|
.endif # PHPVERSION_MK
|