summaryrefslogtreecommitdiff
path: root/lang/php/phpversion.mk
diff options
context:
space:
mode:
authorjdolecek <jdolecek>2004-10-31 19:30:29 +0000
committerjdolecek <jdolecek>2004-10-31 19:30:29 +0000
commit6c803e23b4734f72875cd236fad2ef1e49791770 (patch)
tree9eebc2a4ea3e6fa6c783e1abb83bc43228266985 /lang/php/phpversion.mk
parent43d39f7ea20ff84e080d74bfb7d3b0d3e773cb8c (diff)
downloadpkgsrc-6c803e23b4734f72875cd236fad2ef1e49791770.tar.gz
new PHP extension module framework, which makes it possible to build
individual PHP extension packages with either PHP 4.x or PHP 5.x convert existing php4-* packages to this framework and import as php-*
Diffstat (limited to 'lang/php/phpversion.mk')
-rw-r--r--lang/php/phpversion.mk71
1 files changed, 71 insertions, 0 deletions
diff --git a/lang/php/phpversion.mk b/lang/php/phpversion.mk
new file mode 100644
index 00000000000..9ff4f5c3d22
--- /dev/null
+++ b/lang/php/phpversion.mk
@@ -0,0 +1,71 @@
+# $NetBSD: phpversion.mk,v 1.1.1.1 2004/10/31 19:30:30 jdolecek Exp $
+# PHP wrapper, for module builds
+
+.if !defined(PHPVERSION_MK)
+PHPVERSION_MK= defined
+
+.include "../../mk/bsd.prefs.mk"
+
+PHP_VERSION_DEFAULT?= 4
+PHP_VERSIONS_ACCEPTED?= 4 5
+
+# 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/20020429)
+_PHP_VERSION_4_INSTALLED= yes
+.endif
+.if exists(${LOCALBASE}/lib/php/20040412)
+_PHP_VERSION_5_INSTALLED= yes
+.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
+
+#
+# set variables for the version we decided to use:
+#
+.if ${_PHP_VERSION} == "4"
+PHPPKGSRCDIR= ../../www/php4
+.elif ${_PHP_VERSION} == "5"
+PHPPKGSRCDIR= ../../lang/php5
+.else
+# force an error
+PKG_SKIP_REASON+= "PHP${_PHP_VERSION} is not a valid package"
+.endif
+
+.endif # PHPVERSION_MK