Annotation of pkgsrc/lang/php/phpversion.mk, revision 1.5

1.5     ! joerg       1: # $NetBSD: phpversion.mk,v 1.4 2006/05/09 10:06:34 tron 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: 
1.4       tron        9: PHP_VERSION_DEFAULT?=          5
1.1       jdolecek   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
1.3       jdolecek   60: PKG_PHP_VERSION:=      ${_PHP_VERSION}
                     61: PKG_PHP:=              PHP${_PHP_VERSION}
1.2       jdolecek   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.3       jdolecek   67: # force the selected PHP version for recursive builds
                     68: PHP_VERSION_REQD:=     ${PKG_PHP_VERSION}
                     69: 
1.1       jdolecek   70: #
                     71: # set variables for the version we decided to use:
                     72: #
                     73: .if ${_PHP_VERSION} == "4"
1.5     ! joerg      74: PHPPKGSRCDIR=          ../../www/php4
        !            75: PHP_PKG_PREFIX=                php4
1.1       jdolecek   76: .elif ${_PHP_VERSION} == "5"
1.5     ! joerg      77: PHPPKGSRCDIR=          ../../lang/php5
        !            78: PHP_PKG_PREFIX=                php5
1.1       jdolecek   79: .else
                     80: # force an error
1.2       jdolecek   81: PKG_SKIP_REASON+=      "${PKG_PHP} is not a valid package"
1.1       jdolecek   82: .endif
                     83: 
                     84: .endif # PHPVERSION_MK

CVSweb <webmaster@jp.NetBSD.org>