1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-18 08:02:48 +00:00

Move bsd.php.mk to Uses/php.mk

PR:		210323
Submitted by:	mat
Exp-run by:	antoine
Sponsored by:	Absolight
Differential Revision:	https://reviews.freebsd.org/D6867
This commit is contained in:
Mathieu Arnold 2016-06-23 13:19:17 +00:00
parent d911a04f66
commit 11ca07f4fc
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=417374
6 changed files with 111 additions and 106 deletions

View File

@ -1,15 +1,11 @@
#
# bsd.php.mk - Support for PHP-based ports.
#
# Created by: Alex Dupre <ale@FreeBSD.org>
#
# For FreeBSD committers:
# Please send all suggested changes to the maintainer instead of committing
# them to SVN yourself.
#
# $FreeBSD$
#
# Adding 'USE_PHP=yes' to a port includes this Makefile after bsd.ports.pre.mk.
# Support for PHP-based ports.
#
# Feature: php
# Usage: USES=php
# Valid ARGS: (none)
#
# If the port requires a predefined set of PHP extensions, they can be
# listed in this way:
#
@ -35,125 +31,126 @@
# If you are building PHP-based ports in poudriere(8) with ZTS enabled,
# add WITH_MPM=event to /etc/make.conf to prevent build failures.
.if !defined(_PHPMKINCLUDED)
.if !defined(_INCLUDE_USES_PHP_MK)
PHP_Include_MAINTAINER= ale@FreeBSD.org
_PHPMKINCLUDED= yes
_INCLUDE_USES_PHP_MK= yes
.include "${PORTSDIR}/Mk/bsd.default-versions.mk"
.if defined(DEFAULT_PHP_VER)
. if defined(DEFAULT_PHP_VER)
WARNING+= "DEFAULT_PHP_VER is defined, consider using DEFAULT_VERSIONS=php=${DEFAULT_PHP_VER} instead"
.endif
. endif
PHPBASE?= ${LOCALBASE}
.if exists(${PHPBASE}/etc/php.conf)
. if exists(${PHPBASE}/etc/php.conf)
.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'
.else
. endif
. else
DEFAULT_PHP_VER?= ${PHP_DEFAULT:S/.//}
# When adding a version, please keep the comment in
# Mk/bsd.default-versions.mk in sync.
PHP_VER?= ${DEFAULT_PHP_VER}
.if ${PHP_VER} == 70
. if ${PHP_VER} == 70
PHP_EXT_DIR= 20151012
PHP_EXT_INC= pcre spl
.elif ${PHP_VER} == 56
. elif ${PHP_VER} == 56
PHP_EXT_DIR= 20131226
PHP_EXT_INC= pcre spl
.elif ${PHP_VER} == 55
. elif ${PHP_VER} == 55
PHP_EXT_DIR= 20121212
PHP_EXT_INC= pcre spl
.else
. else
# (rene) default to DEFAULT_VERSIONS
PHP_EXT_DIR= 20131226
PHP_EXT_INC= pcre spl
.endif
. endif
HTTPD?= ${LOCALBASE}/sbin/httpd
.if exists(${HTTPD})
. if exists(${HTTPD})
APACHE_THR!= ${HTTPD} -V | ${GREP} threaded
. if ${APACHE_THR:Myes}
. if ${APACHE_THR:Myes}
PHP_EXT_DIR:= ${PHP_EXT_DIR}-zts
. endif
.elif defined(APACHE_PORT) && (${APACHE_PORT:M*worker*} != "" || ${APACHE_PORT:M*event*} != "")
. endif
. elif defined(APACHE_PORT) && (${APACHE_PORT:M*worker*} != "" || ${APACHE_PORT:M*event*} != "")
PHP_EXT_DIR:= ${PHP_EXT_DIR}-zts
.elif defined(WITH_MPM) && (${WITH_MPM} == "worker" || ${WITH_MPM} == "event")
. elif defined(WITH_MPM) && (${WITH_MPM} == "worker" || ${WITH_MPM} == "event")
PHP_EXT_DIR:= ${PHP_EXT_DIR}-zts
.endif
. endif
.if defined(WITH_DEBUG)
. if defined(WITH_DEBUG)
PHP_EXT_DIR:= ${PHP_EXT_DIR}-debug
.endif
. endif
PHP_SAPI?= ""
.endif # .if exists(${PHPBASE}/etc/php.conf)
. endif # .if exists(${PHPBASE}/etc/php.conf)
PHP_EXT_INC?= ""
.if defined(IGNORE_WITH_PHP)
. for VER in ${IGNORE_WITH_PHP}
. if ${PHP_VER} == "${VER}"
. if defined(IGNORE_WITH_PHP)
. for VER in ${IGNORE_WITH_PHP}
. if ${PHP_VER} == "${VER}"
IGNORE= cannot be installed: doesn't work with lang/php${PHP_VER} port\
(doesn't support PHP ${IGNORE_WITH_PHP:C/^5/5./})
. endif
. endfor
.endif
. endif
. endfor
. endif
.if defined(WANT_PHP_WEB)
. if defined(WANT_PHP_CGI) || defined(WANT_PHP_MOD)
. if defined(WANT_PHP_WEB)
. if defined(WANT_PHP_CGI) || defined(WANT_PHP_MOD)
check-makevars::
@${ECHO_CMD} "If you define WANT_PHP_WEB you cannot set also WANT_PHP_CGI"
@${ECHO_CMD} "or WANT_PHP_MOD. Use only one of them."
@${FALSE}
. endif
.endif
. endif
. endif
.if defined(WANT_PHP_CGI)
. if defined(PHP_VERSION) && ${PHP_SAPI:Mcgi} == "" && ${PHP_SAPI:Mfpm} == ""
. if defined(WANT_PHP_CGI)
. if defined(PHP_VERSION) && ${PHP_SAPI:Mcgi} == "" && ${PHP_SAPI:Mfpm} == ""
check-makevars::
@${ECHO_CMD} "This port requires the CGI version of PHP, but you have already"
@${ECHO_CMD} "installed a PHP port without CGI."
@${FALSE}
. endif
.endif
. endif
. endif
.if defined(WANT_PHP_CLI)
. if defined(PHP_VERSION) && ${PHP_SAPI:Mcli} == ""
. if defined(WANT_PHP_CLI)
. if defined(PHP_VERSION) && ${PHP_SAPI:Mcli} == ""
check-makevars::
@${ECHO_CMD} "This port requires the CLI version of PHP, but you have already"
@${ECHO_CMD} "installed a PHP port without CLI."
@${FALSE}
. endif
.endif
. endif
. endif
.if defined(WANT_PHP_EMB)
. if defined(PHP_VERSION) && ${PHP_SAPI:Membed} == ""
. if defined(WANT_PHP_EMB)
. if defined(PHP_VERSION) && ${PHP_SAPI:Membed} == ""
check-makevars::
@${ECHO_CMD} "This port requires the embedded library version of PHP, but you have already"
@${ECHO_CMD} "installed a PHP port without the embedded library."
@${FALSE}
. endif
.endif
. endif
. endif
PHP_PORT?= lang/php${PHP_VER}
MOD_PHP_PORT?= www/mod_php${PHP_VER}
.if defined(USE_PHP_BUILD)
. if defined(USE_PHP_BUILD)
BUILD_DEPENDS+= ${PHPBASE}/include/php/main/php.h:${PHP_PORT}
.endif
. endif
RUN_DEPENDS+= ${PHPBASE}/include/php/main/php.h:${PHP_PORT}
.if defined(WANT_PHP_MOD) || (defined(WANT_PHP_WEB) && defined(PHP_VERSION) && ${PHP_SAPI:Mcgi} == "" && ${PHP_SAPI:Mfpm} == "")
. if defined(WANT_PHP_MOD) || (defined(WANT_PHP_WEB) && defined(PHP_VERSION) && ${PHP_SAPI:Mcgi} == "" && ${PHP_SAPI:Mfpm} == "")
USE_APACHE_RUN= 22+
.include "${PORTSDIR}/Mk/bsd.apache.mk"
RUN_DEPENDS+= ${PHPBASE}/${APACHEMODDIR}/libphp5.so:${MOD_PHP_PORT}
.endif
. endif
PLIST_SUB+= PHP_EXT_DIR=${PHP_EXT_DIR}
SUB_LIST+= PHP_EXT_DIR=${PHP_EXT_DIR}
.if defined(USE_PHPIZE) || defined(USE_PHPEXT) || defined(USE_ZENDEXT)
. if defined(USE_PHPIZE) || defined(USE_PHPEXT) || defined(USE_ZENDEXT)
BUILD_DEPENDS+= ${PHPBASE}/bin/phpize:${PHP_PORT}
GNU_CONFIGURE= yes
USE_AUTOTOOLS+= autoconf:env
@ -166,11 +163,16 @@ phpize-message:
do-phpize:
@(cd ${WRKSRC}; ${SETENV} ${SCRIPTS_ENV} ${PHPBASE}/bin/phpize)
. endif
_USES_POST+=php
.endif
.endif
.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_PHP_POST_MK)
.if defined(_POSTMKINCLUDED) && (defined(USE_PHPEXT) || defined(USE_ZENDEXT))
_INCLUDE_USES_PHP_POST_MK=yes
. if (defined(USE_PHPEXT) || defined(USE_ZENDEXT))
PHP_MODNAME?= ${PORTNAME}
PHP_HEADER_DIRS?= ""
@ -178,11 +180,11 @@ do-install:
@${MKDIR} ${STAGEDIR}${PREFIX}/lib/php/${PHP_EXT_DIR}
@${INSTALL_LIB} ${WRKSRC}/modules/${PHP_MODNAME}.so \
${STAGEDIR}${PREFIX}/lib/php/${PHP_EXT_DIR}
. for header in . ${PHP_HEADER_DIRS}
. for header in . ${PHP_HEADER_DIRS}
@${MKDIR} ${STAGEDIR}${PREFIX}/include/php/ext/${PHP_MODNAME}/${header}
@${INSTALL_DATA} ${WRKSRC}/${header}/*.h \
${STAGEDIR}${PREFIX}/include/php/ext/${PHP_MODNAME}/${header}
. endfor
. endfor
@${RM} -f ${STAGEDIR}${PREFIX}/include/php/ext/${PHP_MODNAME}/config.h
@${GREP} "#define \(COMPILE\|HAVE\|USE\)_" ${WRKSRC}/config.h \
> ${STAGEDIR}${PREFIX}/include/php/ext/${PHP_MODNAME}/config.h
@ -204,22 +206,22 @@ add-plist-phpext:
>> ${TMPPLIST}
@${ECHO_CMD} "@dir etc/php" \
>> ${TMPPLIST}
.if defined(USE_ZENDEXT)
. if defined(USE_ZENDEXT)
@${ECHO_CMD} "@exec echo zend_extension=%D/lib/php/${PHP_EXT_DIR}/${PHP_MODNAME}.so >> %D/etc/php/extensions.ini" \
>> ${TMPPLIST}
.else
. else
@${ECHO_CMD} "@exec echo extension=${PHP_MODNAME}.so >> %D/etc/php/extensions.ini" \
>> ${TMPPLIST}
.endif
. endif
@${ECHO_CMD} "@unexec cp %D/etc/php/extensions.ini %D/etc/php/extensions.ini.orig" \
>> ${TMPPLIST}
.if defined(USE_ZENDEXT)
. if defined(USE_ZENDEXT)
@${ECHO_CMD} "@unexec grep -v zend_extension=%D/lib/php/${PHP_EXT_DIR}/${PHP_MODNAME}\\\.so %D/etc/php/extensions.ini.orig > %D/etc/php/extensions.ini || true" \
>> ${TMPPLIST}
.else
. else
@${ECHO_CMD} "@unexec grep -v extension=${PHP_MODNAME}\\\.so %D/etc/php/extensions.ini.orig > %D/etc/php/extensions.ini || true" \
>> ${TMPPLIST}
.endif
. endif
@${ECHO_CMD} "@unexec rm %D/etc/php/extensions.ini.orig" \
>> ${TMPPLIST}
@${ECHO_CMD} "@unexec [ -s %D/etc/php/extensions.ini ] || rm %D/etc/php/extensions.ini" \
@ -233,17 +235,17 @@ php-ini:
@${ECHO_CMD} "The following line has been added to your ${PREFIX}/etc/php/extensions.ini"
@${ECHO_CMD} "configuration file to automatically load the installed extension:"
@${ECHO_CMD} ""
.if defined(USE_ZENDEXT)
. if defined(USE_ZENDEXT)
@${ECHO_CMD} "zend_extension=${PREFIX}/lib/php/${PHP_EXT_DIR}/${PHP_MODNAME}.so"
.else
. else
@${ECHO_CMD} "extension=${PHP_MODNAME}.so"
.endif
. endif
@${ECHO_CMD} ""
@${ECHO_CMD} "****************************************************************************"
.endif
. endif
# Extensions
.if defined(_POSTMKINCLUDED) && ${USE_PHP:tl} != "yes"
. if ${USE_PHP:tl} != "yes"
# non-version specific components
_USE_PHP_ALL= apc bcmath bitset bz2 calendar ctype curl dba dom \
exif fileinfo filter ftp gd gettext gmp \
@ -261,11 +263,11 @@ _USE_PHP_VER70= ${_USE_PHP_ALL}
apc_DEPENDS= www/pecl-APC
bcmath_DEPENDS= math/php${PHP_VER}-bcmath
.if ${PHP_VER} == 70
. if ${PHP_VER} == 70
bitset_DEPENDS= math/pecl-bitset
.else
. else
bitset_DEPENDS= math/pecl-bitset2
.endif
. endif
bz2_DEPENDS= archivers/php${PHP_VER}-bz2
calendar_DEPENDS= misc/php${PHP_VER}-calendar
ctype_DEPENDS= textproc/php${PHP_VER}-ctype
@ -285,11 +287,11 @@ iconv_DEPENDS= converters/php${PHP_VER}-iconv
igbinary_DEPENDS= converters/pecl-igbinary
imap_DEPENDS= mail/php${PHP_VER}-imap
interbase_DEPENDS= databases/php${PHP_VER}-interbase
.if ${PHP_VER} == 70
. if ${PHP_VER} == 70
intl_DEPENDS= devel/php${PHP_VER}-intl
.else
. else
intl_DEPENDS= devel/pecl-intl
.endif
. endif
json_DEPENDS= devel/php${PHP_VER}-json
ldap_DEPENDS= net/php${PHP_VER}-ldap
mbstring_DEPENDS= converters/php${PHP_VER}-mbstring
@ -344,26 +346,27 @@ xsl_DEPENDS= textproc/php${PHP_VER}-xsl
zip_DEPENDS= archivers/php${PHP_VER}-zip
zlib_DEPENDS= archivers/php${PHP_VER}-zlib
. for extension in ${USE_PHP}
. if ${_USE_PHP_VER${PHP_VER}:M${extension}} != ""
. if ${PHP_EXT_INC:M${extension}} == ""
. if defined(USE_PHP_BUILD)
. for extension in ${USE_PHP}
. if ${_USE_PHP_VER${PHP_VER}:M${extension}} != ""
. if ${PHP_EXT_INC:M${extension}} == ""
. if defined(USE_PHP_BUILD)
BUILD_DEPENDS+= ${PHPBASE}/lib/php/${PHP_EXT_DIR}/${extension}.so:${${extension}_DEPENDS}
. endif
. endif
RUN_DEPENDS+= ${PHPBASE}/lib/php/${PHP_EXT_DIR}/${extension}.so:${${extension}_DEPENDS}
. endif
. else
. endif
. else
ext= ${extension}
. if ${ext} == "mhash"
. if defined(USE_PHP_BUILD)
. if ${ext} == "mhash"
. if defined(USE_PHP_BUILD)
BUILD_DEPENDS+= ${PHPBASE}/lib/php/${PHP_EXT_DIR}/hash.so:${hash_DEPENDS}
. endif
. endif
RUN_DEPENDS+= ${PHPBASE}/lib/php/${PHP_EXT_DIR}/hash.so:${hash_DEPENDS}
. elif ${ext:tl} != "yes"
. elif ${ext:tl} != "yes"
check-makevars::
@${ECHO_CMD} "Unknown extension ${extension} for PHP ${PHP_VER}."
@${FALSE}
. endif
. endif
. endfor
. endif
. endif
. endfor
. endif
.endif

View File

@ -1359,8 +1359,9 @@ PKGCOMPATDIR?= ${LOCALBASE}/lib/compat/pkg
.include "${PORTSDIR}/Mk/bsd.emacs.mk"
.endif
.if defined(USE_PHP)
.include "${PORTSDIR}/Mk/bsd.php.mk"
.if defined(USE_PHP) && (!defined(USES) || ( defined(USES) && !${USES:Mphp} ))
DEV_WARNING+= "Using USE_PHP alone is deprecated, please use USES=php"
USES+= php
.endif
.if defined(USE_FPC) || defined(WANT_FPC_BASE) || defined(WANT_FPC_ALL)
@ -1919,8 +1920,9 @@ _FORCE_POST_PATTERNS= rmdir kldxref mkfontscale mkfontdir fc-cache \
.include "${PORTSDIR}/Mk/bsd.sdl.mk"
.endif
.if defined(USE_PHP)
.include "${PORTSDIR}/Mk/bsd.php.mk"
.if defined(USE_PHP) && (!defined(USES) || ( defined(USES) && !${USES:Mphp} ))
DEV_WARNING+= "Using USE_PHP alone is deprecated, please use USES=php"
_USES_POST+= php
.endif
.if defined(USE_WX) || defined(USE_WX_NOT)

View File

@ -185,6 +185,8 @@ post-build:
@${ECHO_CMD} "PHP_VERSION=${PORTVERSION}" >> ${WRKDIR}/php.conf
@${ECHO_CMD} "PHP_SAPI=${PHP_SAPI}" >> ${WRKDIR}/php.conf
@${ECHO_CMD} "PHP_EXT_INC=pcre spl" >> ${WRKDIR}/php.conf
@${ECHO_CMD} -n "PHP_EXT_DIR=" >> ${WRKDIR}/php.conf
@${SH} ${WRKSRC}/scripts/php-config --extension-dir | sed -ne 's,^${PREFIX}/lib/php/,,p' >> ${WRKDIR}/php.conf
test: build
@(cd ${WRKSRC} && ${MAKE} test)

View File

@ -188,6 +188,8 @@ post-build:
@${ECHO_CMD} "PHP_VERSION=${PORTVERSION}" >> ${WRKDIR}/php.conf
@${ECHO_CMD} "PHP_SAPI=${PHP_SAPI}" >> ${WRKDIR}/php.conf
@${ECHO_CMD} "PHP_EXT_INC=pcre spl" >> ${WRKDIR}/php.conf
@${ECHO_CMD} -n "PHP_EXT_DIR=" >> ${WRKDIR}/php.conf
@${SH} ${WRKSRC}/scripts/php-config --extension-dir | sed -ne 's,^${PREFIX}/lib/php/,,p' >> ${WRKDIR}/php.conf
test: build
@(cd ${WRKSRC} && ${MAKE} test)

View File

@ -169,19 +169,21 @@ post-patch:
${WRKSRC}/sapi/fpm/php-fpm.conf.in
.endif
# Work around issues with newer (>=2.64) autoconf
pre-configure:
@${REINPLACE_CMD} -E 's:^((m4_)?divert)[(]([0-9]*)[)]:\1(600\3):' \
${WRKSRC}/configure.in `${FIND} ${WRKSRC} -name '*.m4'`
@${RM} ${WRKSRC}/configure
@${CAT} ${WRKSRC}/acinclude.m4 ${WRKSRC}/build/libtool.m4 > ${WRKSRC}/aclocal.m4
.if !defined(PKGNAMEPREFIX)
post-build:
@${ECHO_CMD} "PHP_VER=70" > ${WRKDIR}/php.conf
@${ECHO_CMD} "PHP_VERSION=${PORTVERSION}" >> ${WRKDIR}/php.conf
@${ECHO_CMD} "PHP_SAPI=${PHP_SAPI}" >> ${WRKDIR}/php.conf
@${ECHO_CMD} "PHP_EXT_INC=pcre spl" >> ${WRKDIR}/php.conf
@${ECHO_CMD} -n "PHP_EXT_DIR=" >> ${WRKDIR}/php.conf
@${SH} ${WRKSRC}/scripts/php-config --extension-dir | sed -ne 's,^${PREFIX}/lib/php/,,p' >> ${WRKDIR}/php.conf
test: build
@(cd ${WRKSRC} && ${MAKE} test)

View File

@ -20,7 +20,7 @@ USES= cpe zip:infozip
OPTIONS_DEFINE= APACHE MYSQLS GD
APACHE_DESC= Use Apache (2.2) as http server
APACHE_DESC= Use Apache as http server
MYSQLS_DESC= Use MySQL database server
GD_DESC= Enable Image Manager extension (requires gd)
@ -28,16 +28,10 @@ OPTIONS_DEFAULT= APACHE MYSQLS GD
MYSQLS_USE= MYSQL=server
APACHE_USE= APACHE_RUN=22
APACHE_VARS= WANT_PHP_MOD=yes
GD_USE= PHP=gd
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MAPACHE}
WANT_PHP_MOD= yes
.endif
do-extract:
@${INSTALL} -d ${WRKDIR}
@${UNZIP_CMD} -qo ${DISTDIR}/${DISTFILES} -d ${WRKSRC}