Index: Mk/Uses/php.mk =================================================================== --- Mk/Uses/php.mk +++ Mk/Uses/php.mk @@ -16,6 +16,11 @@ # - web : Want the Apache Module or the CGI version of PHP. # - embed : Want the embedded library version of PHP. # - pecl : Fetches from PECL. +# - flavors : Generates flavors for supported versions. +# (implied by phpize,ext,zend,pecl) +# - noflavors: Prevents generation of flavor. +# - optsuffix: Adds a -phpXY PKGNAMESUFFIX when the current php is not +# the default one. # # If the port requires a predefined set of PHP extensions, they can be # listed in this way: @@ -43,7 +48,6 @@ # # The port can set these options in its Makefile before bsd.port.pre.mk: # -# DEFAULT_PHP_VER=N - Use PHP version N if PHP is not yet installed. # IGNORE_WITH_PHP=N - The port doesn't work with PHP version N. # # You may combine multiple WANT_PHP_* knobs. @@ -58,10 +62,6 @@ _INCLUDE_USES_PHP_MK= yes -. if defined(DEFAULT_PHP_VER) -WARNING+= "DEFAULT_PHP_VER is defined, consider using DEFAULT_VERSIONS=php=${DEFAULT_PHP_VER} instead" -. endif - . if defined(USE_PHPIZE) && empty(php_ARGS:Mphpize) php_ARGS+= phpize . endif @@ -84,6 +84,9 @@ . if ${php_ARGS:Mbuild} && ( ${php_ARGS:Mphpize} || ${php_ARGS:Mext} || ${php_ARGS:Mzend} ) DEV_WARNING+= "USES=php:build is included in USES=php:phpize, USES=php:ext, and USES=php:zend, so it is not needed" . endif +. if ${php_ARGS:Mflavors} && ( ${php_ARGS:Mphpize} || ${php_ARGS:Mext} || ${php_ARGS:Mzend} || ${php_ARGS:Mpecl} ) +DEV_WARNINGS+= "USES=php:flavors is included in phpize, ext, zend and pecl, so it is not needed." +. endif . if ${php_ARGS:Mphpize} && ( ${php_ARGS:Mext} || ${php_ARGS:Mzend} ) DEV_WARNING+= "USES=php:phpize is included in USES=php:ext and USES=php:zend, so it is not needed" . endif @@ -94,6 +97,14 @@ DEV_WARNING+= "USES=php:ext is included in USES=php:pecl, so it is not needed" . endif +. if ( ${php_ARGS:Mphpize} || ${php_ARGS:Mext} || ${php_ARGS:Mzend} || ${php_ARGS:Mpecl} ) && !${php_ARGS:Mnoflavors} +php_ARGS+= flavors +. endif + +. if ${php_ARGS:Mnoflavors} && ${php_ARGS:Mflavors} +php_ARGS:= ${php_ARGS:Nflavors} +. endif + . if ${php_ARGS:Mpecl} php_ARGS+= ext EXTRACT_SUFX= .tgz @@ -103,13 +114,43 @@ . endif PHPBASE?= ${LOCALBASE} -. if exists(${PHPBASE}/etc/php.conf) + +_ALL_PHP_VERSIONS= 56 70 71 72 + +DEFAULT_PHP_VER?= ${PHP_DEFAULT:S/.//} + +_ALL_FLAVOR_VERSIONS= ${DEFAULT_PHP_VER} ${_ALL_PHP_VERSIONS:N${DEFAULT_PHP_VER}} + +. if ${php_ARGS:Mflavors} +. if empty(FLAVORS) +. if defined(IGNORE_WITH_PHP) +. for _v in ${_ALL_FLAVOR_VERSIONS} +. if empty(IGNORE_WITH_PHP:M${_v}) +FLAVORS+= php${_v} +. endif +. endfor +. else +FLAVORS= ${_ALL_FLAVOR_VERSIONS:S/^/php/} +. endif +. endif +. if empty(FLAVOR) +FLAVOR= ${FLAVORS:[1]} +. endif +. if ${php_ARGS:Moptsuffix} && ${FLAVOR} != ${FLAVORS:[1]} +PKGNAMESUFFIX= ${PHP_PKGNAMESUFFIX} +. endif +. endif + +. if ${FLAVOR:Mphp[0-9][0-9]} +PHP_VER= ${FLAVOR:S/^php//} +. endif + +. if exists(${PHPBASE}/etc/php.conf) && !defined(PHP_VER) .include "${PHPBASE}/etc/php.conf" . if !defined(PHP_EXT_DIR) PHP_EXT_DIR!= ${PHPBASE}/bin/php-config --extension-dir | ${SED} -ne 's,^${PHPBASE}/lib/php/\(.*\),\1,p' . endif . else -DEFAULT_PHP_VER?= ${PHP_DEFAULT:S/.//} # When adding a version, please keep the comment in # Mk/bsd.default-versions.mk in sync. @@ -148,9 +189,12 @@ PHP_EXT_DIR:= ${PHP_EXT_DIR}-debug . endif PHP_SAPI?= "" -. endif # .if exists(${PHPBASE}/etc/php.conf) +. endif # .if exists(${PHPBASE}/etc/php.conf) && !${PHP_VER} PHP_EXT_INC?= "" +PHP_PKGNAMEPREFIX= php${PHP_VER}- +PHP_PKGNAMESUFFIX= -php${PHP_VER} + . if defined(IGNORE_WITH_PHP) . for VER in ${IGNORE_WITH_PHP} . if ${PHP_VER} == "${VER}" @@ -220,7 +264,7 @@ GNU_CONFIGURE= yes CONFIGURE_ARGS+=--with-php-config=${PHPBASE}/bin/php-config -configure-message: phpize-message do-phpize +_USES_configure+= 190:phpize-message 250:do-phpize phpize-message: @${ECHO_MSG} "===> PHPizing for ${PKGNAME}" Index: lang/php56/Makefile.ext =================================================================== --- lang/php56/Makefile.ext +++ lang/php56/Makefile.ext @@ -1,6 +1,6 @@ COMMENT= The ${PHP_MODNAME} shared extension for php -USES+= php:ext +USES+= php:ext,noflavors PHP_MODNAME= ${PKGNAMESUFFIX:S/-//} PHP_VER= 56 IGNORE_WITH_PHP= 70 Index: lang/php70/Makefile.ext =================================================================== --- lang/php70/Makefile.ext +++ lang/php70/Makefile.ext @@ -2,7 +2,7 @@ COMMENT= The ${PHP_MODNAME} shared extension for php -USES+= php:ext +USES+= php:ext,noflavors PHP_MODNAME= ${PKGNAMESUFFIX:S/-//} PHP_VER= 70 IGNORE_WITH_PHP= 56 Index: lang/php71/Makefile.ext =================================================================== --- lang/php71/Makefile.ext +++ lang/php71/Makefile.ext @@ -2,7 +2,7 @@ COMMENT= The ${PHP_MODNAME} shared extension for php -USES+= php:ext +USES+= php:ext,noflavors PHP_MODNAME= ${PKGNAMESUFFIX:S/-//} PHP_VER= 71 IGNORE_WITH_PHP= 55 56 70 Index: lang/php72/Makefile.ext =================================================================== --- lang/php72/Makefile.ext +++ lang/php72/Makefile.ext @@ -2,7 +2,7 @@ COMMENT= The ${PHP_MODNAME} shared extension for php -USES+= php:ext +USES+= php:ext,noflavors PHP_MODNAME= ${PKGNAMESUFFIX:S/-//} PHP_VER= 72 IGNORE_WITH_PHP= 56 70 71 Index: www/php-screw/Makefile =================================================================== --- www/php-screw/Makefile +++ www/php-screw/Makefile @@ -1,11 +1,12 @@ # Created by: Alex Dupre # $FreeBSD$ -PORTNAME= php-screw +PORTNAME= screw PORTVERSION= 1.5 PORTREVISION= 1 CATEGORIES= www security MASTER_SITES= SF/${PORTNAME}/OldFiles +PKGNAMEPREFIX= ${PHP_PKGNAMEPREFIX} DISTNAME= php_screw-${PORTVERSION} EXTRACT_SUFX= .tgz Index: www/php-templates/Makefile =================================================================== --- www/php-templates/Makefile +++ www/php-templates/Makefile @@ -1,12 +1,13 @@ # Created by: vanilla # $FreeBSD$ -PORTNAME= php-templates +PORTNAME= templates PORTVERSION= 1.7.2 PORTREVISION= 2 CATEGORIES= www MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/1.7:ext \ SF/${PORTNAME}/${PORTNAME}-doc/html:doc +PKGNAMEPREFIX= ${PHP_PKGNAMEPREFIX} DISTNAME= php_templates-${PORTVERSION} DISTFILES= ${DISTNAME}${EXTRACT_SUFX}:ext DISTFILES+= php_templates-doc-eng-1.1${EXTRACT_SUFX}:doc Index: www/wordpress/Makefile =================================================================== --- www/wordpress/Makefile +++ www/wordpress/Makefile @@ -16,7 +16,7 @@ NO_ARCH= yes NO_BUILD= yes -USES= php:web cpe +USES= php:web,flavors,optsuffix cpe USE_PHP= curl gd hash mysqli pcre tokenizer xml zip zlib ftp WRKSRC= ${WRKDIR}/${PORTNAME}