git: 91fdbed77603 - main - lang/php80: Adding MySQL 8.0 'caching_sha2_password' support

Muhammad Moinur Rahman bofh at FreeBSD.org
Tue Apr 6 10:14:49 UTC 2021


The branch main has been updated by bofh:

URL: https://cgit.FreeBSD.org/ports/commit/?id=91fdbed776033fd4b210135429a171ab5fed549b

commit 91fdbed776033fd4b210135429a171ab5fed549b
Author:     Muhammad Moinur Rahman <bofh at FreeBSD.org>
AuthorDate: 2021-04-06 10:06:56 +0000
Commit:     Muhammad Moinur Rahman <bofh at FreeBSD.org>
CommitDate: 2021-04-06 10:14:41 +0000

    lang/php80: Adding MySQL 8.0 'caching_sha2_password' support
    
    - Pet portlint
    - Add non-default OPTION MYSQL80
    
    This patch adds an OPTION for adding 'caching_sha2_password' (Default
    Password mechanism in MySQL >= 8.0) in php80. If the OPTION MYSQL80 is
    selected it will build openssl module with base PHP including mysqlnd.
    This will also prevent php80-openssl module from being installed in the
    future. php80-mysqli and php80-pdo_mysql will use mysqlnd.
    
    PR:             252420
    Reported by:    sean at rogue-research.com
    Approved by:    tz
    Sponsored by:   Bounce Experts
    Differential Revision:  https://reviews.freebsd.org/D29491
---
 lang/php80/Makefile     | 29 +++++++++++++++++++++++++----
 lang/php80/Makefile.ext | 10 ++++++++++
 2 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/lang/php80/Makefile b/lang/php80/Makefile
index c9b0f4d04d8e..70e4af93259a 100644
--- a/lang/php80/Makefile
+++ b/lang/php80/Makefile
@@ -4,7 +4,7 @@ PORTNAME=	php80
 DISTVERSION=	8.0.3
 PORTREVISION?=	0
 CATEGORIES?=	lang devel www
-MASTER_SITES=   PHP/distributions
+MASTER_SITES=	PHP/distributions
 DISTNAME=	php-${DISTVERSION}
 
 MAINTAINER=	tz at FreeBSD.org
@@ -27,14 +27,14 @@ CONFIGURE_ARGS+=--with-layout=GNU \
 		--with-libxml \
 		--with-password-argon2=${LOCALBASE} \
 		--program-prefix=""
-CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include"
+CPPFLAGS=	-I${LOCALBASE}/include
 USES+=		autoreconf:build
 USE_GNOME=	libxml2
 
 # PR230207 Allow relocations against read-only segments (override lld default)
 LDFLAGS_i386=	-Wl,-z,notext
 
-OPTIONS_DEFINE+=CLI CGI FPM EMBED PHPDBG DEBUG DTRACE IPV6 MYSQLND LINKTHR ZTS
+OPTIONS_DEFINE+=CLI CGI FPM EMBED PHPDBG DEBUG DTRACE IPV6 MYSQLND MYSQL80 LINKTHR ZTS
 OPTIONS_DEFAULT=CLI CGI FPM EMBED MYSQLND LINKTHR DTRACE
 OPTIONS_EXCLUDE_DragonFly=	DTRACE
 # ld(1) fails to link probes: Relocations in generic ELF (EM: 0)
@@ -58,9 +58,17 @@ FPM_DESC=	Build FPM version
 EMBED_DESC=	Build embedded library
 PHPDBG_DESC=	Interactive PHP debugger
 MYSQLND_DESC=	Build with MySQL Native Driver
+MYSQL80_DESC=	Build with MySQL caching password mechanism
 LINKTHR_DESC=	Link thread lib (for threaded extensions)
 ZTS_DESC=	Force Zend Thread Safety (ZTS) build
 
+MYSQL80_CONFIGURE_ON=	--with-openssl
+MYSQL80_CONFIGURE_ENV=	OPENSSL_CFLAGS="-I${OPENSSLINC}" \
+				OPENSSL_LIBS="-L${OPENSSLLIB} -lssl -lcrypto" \
+				PHP_OPENSSL=no
+MYSQL80_LDFLAGS=	-L${OPENSSLLIB} -lcrypto -lssl
+MYSQL80_USES=		ssl
+
 CONFLICTS=	php72-* php73-* php74-*
 
 DESTDIRNAME=	INSTALL_ROOT
@@ -152,6 +160,14 @@ PLIST_SUB+=	DTRACE="@comment "
 CONFIGURE_ARGS+=--disable-ipv6
 .endif
 
+.if ${PORT_OPTIONS:MMYSQL80}
+WARNING=	"PHP is now built with MySQL 8.0 support which has caching password mechanism. \
+	This implies php80-openssl module. Hence php80-openssl can no longer be \
+	installed alongside with php80. If you require php80-openssl module please \
+	rebuild php80 with MYSQL80 OPTION disabled. Otherwise remove php80-openssl \
+	DEPENDENCY from ports."
+.endif
+
 post-patch:
 	@${TOUCH} ${WRKSRC}/ext/php_config.h
 	@${REINPLACE_CMD} "s|^\(extension_dir\)|; \1|" ${WRKSRC}/php.ini-*
@@ -168,10 +184,15 @@ post-build:
 	@${ECHO_CMD} "PHP_VER=80" > ${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=hash json 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
 
+post-build-MYSQL80-off:
+	@${ECHO_CMD} "PHP_EXT_INC=hash json pcre spl" >> ${WRKDIR}/php.conf
+
+post-build-MYSQL80-on:
+	@${ECHO_CMD} "PHP_EXT_INC=hash json openssl pcre spl" >> ${WRKDIR}/php.conf
+
 test: build
 	@(cd ${WRKSRC} && ${MAKE} test)
 
diff --git a/lang/php80/Makefile.ext b/lang/php80/Makefile.ext
index bafb34446ef5..e8764dca70f5 100644
--- a/lang/php80/Makefile.ext
+++ b/lang/php80/Makefile.ext
@@ -534,6 +534,16 @@ CONFIGURE_ARGS+=--disable-mbregex
 .	endif
 .endif
 
+.if ${PHP_MODNAME} == "openssl"
+post-stage:
+	@if ${PREFIX}/bin/php -m | grep openssl 2>/dev/null && ( [ ! -f ${PREFIX}/etc/php/ext-20-openssl.ini ] && [ ! -f ${PREFIX}/etc/php/ext-30-openssl.ini ] ); then \
+		${ECHO_CMD}; \
+		${ECHO_MSG} "===>  ${PKGNAME} "openssl module is already built with php base.; \
+		${ECHO_CMD}; \
+		${FALSE}; \
+	fi
+.endif
+
 .if ${PHP_MODNAME} == "openssl" || ${PHP_MODNAME} == "sqlite3"
 post-extract:
 	@${MV} ${WRKSRC}/config0.m4 ${WRKSRC}/config.m4


More information about the dev-commits-ports-all mailing list