Annotation of pkgsrc/lang/php/phpversion.mk, revision 1.2
1.2 ! jdolecek 1: # $NetBSD: phpversion.mk,v 1.1.1.1 2004/10/31 19:30:30 jdolecek Exp $
1.1 jdolecek 2: # PHP wrapper, for module builds
3:
4: .if !defined(PHPVERSION_MK)
5: PHPVERSION_MK= defined
6:
7: .include "../../mk/bsd.prefs.mk"
8:
9: PHP_VERSION_DEFAULT?= 4
10: PHP_VERSIONS_ACCEPTED?= 4 5
11:
12: # transform the list into individual variables
13: .for pv in ${PHP_VERSIONS_ACCEPTED}
14: _PHP_VERSION_${pv}_OK= yes
15: .endfor
16:
17: # check what is installed
18: .if exists(${LOCALBASE}/lib/php/20020429)
19: _PHP_VERSION_4_INSTALLED= yes
20: .endif
21: .if exists(${LOCALBASE}/lib/php/20040412)
22: _PHP_VERSION_5_INSTALLED= yes
23: .endif
24:
25: # if a version is explicitely required, take it
26: .if defined(PHP_VERSION_REQD)
27: _PHP_VERSION= ${PHP_VERSION_REQD}
28: .endif
29: # if the default is already installed, it is first choice
30: .if !defined(_PHP_VERSION)
31: .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK)
32: .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_INSTALLED)
33: _PHP_VERSION= ${PHP_VERSION_DEFAULT}
34: .endif
35: .endif
36: .endif
37: # prefer an already installed version, in order of "accepted"
38: .if !defined(_PHP_VERSION)
39: .for pv in ${PHP_VERSIONS_ACCEPTED}
40: .if defined(_PHP_VERSION_${pv}_INSTALLED)
41: _PHP_VERSION?= ${pv}
42: .else
43: # keep information as last resort - see below
44: _PHP_VERSION_FIRSTACCEPTED?= ${pv}
45: .endif
46: .endfor
47: .endif
48: # if the default is OK for the addon pkg, take this
49: .if !defined(_PHP_VERSION)
50: .if defined(_PHP_VERSION_${PHP_VERSION_DEFAULT}_OK)
51: _PHP_VERSION= ${PHP_VERSION_DEFAULT}
52: .endif
53: .endif
54: # take the first one accepted by the package
55: .if !defined(_PHP_VERSION)
56: _PHP_VERSION= ${_PHP_VERSION_FIRSTACCEPTED}
57: .endif
58:
1.2 ! jdolecek 59: # export some of internal variables
! 60: PKG_PHP_VERSION= ${_PHP_VERSION}
! 61: PKG_PHP= PHP${_PHP_VERSION}
! 62:
! 63: MESSAGE_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION} \
! 64: PKG_PHP=${PKG_PHP}
! 65: PLIST_SUBST+= PKG_PHP_VERSION=${PKG_PHP_VERSION}
! 66:
1.1 jdolecek 67: #
68: # set variables for the version we decided to use:
69: #
70: .if ${_PHP_VERSION} == "4"
71: PHPPKGSRCDIR= ../../www/php4
72: .elif ${_PHP_VERSION} == "5"
73: PHPPKGSRCDIR= ../../lang/php5
74: .else
75: # force an error
1.2 ! jdolecek 76: PKG_SKIP_REASON+= "${PKG_PHP} is not a valid package"
1.1 jdolecek 77: .endif
78:
79: .endif # PHPVERSION_MK
CVSweb <webmaster@jp.NetBSD.org>