Annotation of pkgsrc/lang/php/phpversion.mk, revision 1.1
1.1 ! jdolecek 1: # $NetBSD$
! 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:
! 59: #
! 60: # set variables for the version we decided to use:
! 61: #
! 62: .if ${_PHP_VERSION} == "4"
! 63: PHPPKGSRCDIR= ../../www/php4
! 64: .elif ${_PHP_VERSION} == "5"
! 65: PHPPKGSRCDIR= ../../lang/php5
! 66: .else
! 67: # force an error
! 68: PKG_SKIP_REASON+= "PHP${_PHP_VERSION} is not a valid package"
! 69: .endif
! 70:
! 71: .endif # PHPVERSION_MK
CVSweb <webmaster@jp.NetBSD.org>