Mail archive
alpine-aports

[alpine-aports] [PATCH] testing/php7.1: switch to mysqlnd backendand and some more

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Mon, 6 Mar 2017 00:46:20 +0200

At-last switch to mysqlnd - mysql php native backend.
All this time I thinked it was done. ((

* remove mariadb-dev from makedepends
* mysqlnd:
    - add strict dependency to openssl
* mysqli:
    - switch to use mysqlnd as a backend
    - suppress to send auth data on persistent connection pings
    - increase extension loading index to be load after mysqlnd
* pdo_mysql:
    - switch to use mysqlnd
* global:
    - add support for initial static extension dependency
    - remade loading index calculation.
      now it adds ... initiial+calculated.
    - sort configure flags to _extensions order
    - make configure flags more readable
    - shrink extensions dir to /usr/lib/php{ver}, without "modules"
      subdir. Because this directory for modules only.
    - some cosmetic cleanups.
---
 testing/php7.1/APKBUILD | 120 +++++++++++++++++++++++++++++-------------------
 1 file changed, 72 insertions(+), 48 deletions(-)
diff --git a/testing/php7.1/APKBUILD b/testing/php7.1/APKBUILD
index 2a4cf1a0de..f17ba1237c 100644
--- a/testing/php7.1/APKBUILD
+++ b/testing/php7.1/APKBUILD
_at_@ -2,7 +2,7 @@
 # Maintainer: Valery Kartel <valery.kartel_at_gmail.com>
 pkgname=php7.1
 pkgver=7.1.2
-pkgrel=5
+pkgrel=6
 _apiver=20160303
 _suffix=${pkgname#php}
 _pkgreal=${pkgname%$_suffix}
_at_@ -18,8 +18,8 @@ provides="$replaces $pkgname-cli"
 makedepends="autoconf bison re2c apache2-dev libxml2-dev libxslt-dev libzip-dev bzip2-dev zlib-dev
 	aspell-dev enchant-dev expat-dev pcre-dev curl-dev gmp-dev icu-dev imap-dev gd-dev
 	libical-dev libressl-dev openldap-dev net-snmp-dev db-dev krb5-dev gdbm-dev sqlite-dev
-	freetds-dev mariadb-dev postgresql-dev unixodbc-dev freetype-dev tidyhtml-dev libwebp-dev
-	libpng-dev libjpeg-turbo-dev libmcrypt-dev recode-dev libedit-dev gettext-dev
+	freetds-dev postgresql-dev unixodbc-dev freetype-dev tidyhtml-dev libwebp-dev libpng-dev
+	libjpeg-turbo-dev libmcrypt-dev recode-dev libedit-dev gettext-dev
 	"
 source="http://php.net/distributions/$_pkgreal-$pkgver.tar.bz2
 	$pkgname-module.conf
_at_@ -32,7 +32,7 @@ source="http://php.net/distributions/$_pkgreal-$pkgver.tar.bz2
 	"
 # unimplemented extensions: com_dotnet interbase oci8 pdo_firebird pdo_oci
 _extensions="bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo ftp gd gettext gmp iconv imap:1
-	intl json ldap mbstring mcrypt mysqli mysqlnd odbc opcache openssl pcntl pdo pdo_dblib pdo_mysql
+	intl json ldap mbstring mcrypt mysqli:1 mysqlnd odbc opcache openssl pcntl pdo pdo_dblib pdo_mysql
 	pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell recode session shmop snmp soap sockets
 	sqlite3 sysvmsg sysvsem sysvshm tidy wddx xml xmlreader xmlrpc xmlwriter xsl zip zlib
 	"
_at_@ -42,6 +42,7 @@ for _extension in $_extensions; do
 done
 _prefix_opcache="zend_"
 _pkgdesc_opcache="Zend OPcache"
+_depends_mysqlnd="$pkgname-openssl"
 subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-apache2 $pkgname-phpdbg
 	$pkgname-litespeed $pkgname-cgi $pkgname-fpm $pkgname-pear::noarch $pkgname-pecl::noarch
 	$pkgname-phar-utils:_phar:noarch $subpackages $pkgname-config::noarch"
_at_@ -69,17 +70,18 @@ prepare() {
 }
 
 # Notes to ./configure parameters
+# recode and imap are defined in build function because can't build together
 # --with-libgd -- do not swith to system-wide libgd - runtime bugs.
 # --with-xmlrpc -- do not swith to system-wide xmlrpc - build errors.
 
 _build() {
-	export EXTENSION_DIR=/usr/lib/$pkgname/modules
+	export EXTENSION_DIR=/usr/lib/$pkgname
 	./configure \
 		--build=$CBUILD \
 		--host=$CHOST \
 		--prefix=/usr \
 		--program-suffix=$_suffix \
-		--libdir=/usr/lib/$pkgname \
+		--libdir=$EXTENSION_DIR \
 		--datadir=/usr/share/$pkgname \
 		--sysconfdir=/etc/$pkgname \
 		--localstatedir=/var \
_at_@ -89,64 +91,87 @@ _build() {
 		--with-config-file-path=/etc/$pkgname \
 		--with-config-file-scan-dir=/etc/$pkgname/conf.d \
 		--disable-short-tags \
-		--enable-fileinfo=shared \
-		--with-openssl=shared --with-kerberos --with-system-ciphers \
-		--with-pcre-regex=/usr --with-pcre-dir \
-		--with-zlib=shared --with-zlib-dir \
+		--without-readline \
+		--with-libedit \
 		--enable-bcmath=shared \
 		--with-bz2=shared \
 		--enable-calendar=shared \
 		--enable-ctype=shared \
 		--with-curl=shared \
-		--enable-dba=shared --with-gdbm --with-db4 \
+		--enable-dba=shared \
+			--with-gdbm \
+			--with-db4 \
 		--enable-dom=shared \
+			--with-libxml-dir \
 		--with-enchant=shared \
 		--enable-exif=shared \
+		--enable-fileinfo=shared \
 		--enable-ftp=shared \
-		--with-gd=shared --with-jpeg-dir --with-png-dir --with-webp-dir --with-xpm-dir=no \
-				--with-freetype-dir --enable-gd-native-ttf --disable-gd-jis-conv \
+			--with-openssl-dir \
+		--with-gd=shared \
+			--with-jpeg-dir \
+			--with-png-dir \
+			--with-webp-dir \
+			--with-xpm-dir=no \
+			--with-freetype-dir \
+			--enable-gd-native-ttf \
+			--disable-gd-jis-conv \
 		--with-gettext=shared \
 		--with-gmp=shared \
 		--with-iconv=shared \
-		--enable-intl=shared --with-icu-dir=/usr \
+		--enable-intl=shared \
+			--with-icu-dir=/usr \
 		--enable-json=shared \
-		--enable-libxml=shared --with-libxml-dir=shared --with-libexpat-dir=shared \
-		--with-ldap=shared --with-ldap-sasl \
-		--enable-mbstring=shared --enable-mbregex \
+		--enable-libxml=shared \
+			--with-libxml-dir \
+			--with-libexpat-dir \
+		--with-ldap=shared \
+			--with-ldap-sasl \
+		--enable-mbstring=shared \
+			--enable-mbregex \
 		--with-mcrypt=shared \
-		--with-sqlite3=shared,/usr --with-pdo-sqlite=shared,/usr \
-		--with-pdo-dblib=shared \
-		--with-mysqli=shared,/usr/bin/mysql_config \
-		--enable-mysqlnd=shared --with-pdo-mysql=shared,/usr/bin/mysql_config --with-mysql-sock=/run/mysqld/mysqld.sock \
-		--with-pgsql=shared --with-pdo-pgsql=shared \
-		--with-unixODBC=shared,/usr -with-pdo-odbc=shared,unixODBC,/usr \
-		--with-dbmaker=shared \
+		--with-mysqli=shared,mysqlnd \
+			CFLAGS=-DMYSQLI_NO_CHANGE_USER_ON_PCONNECT \
+		--enable-mysqlnd=shared \
+			--with-zlib-dir \
 		--enable-opcache=shared \
-		--enable-pdo=shared \
+		--with-openssl=shared \
+			--with-kerberos \
+			--with-system-ciphers \
 		--enable-pcntl=shared \
-		--enable-posix=shared \
+		--with-pcre-regex \
+		--enable-pdo=shared \
+		--with-pdo-dblib=shared \
+		--with-pdo-mysql=shared,mysqlnd \
+		--with-pdo-odbc=shared,unixODBC,/usr \
+		--with-pdo-pgsql=shared \
+		--with-pdo-sqlite=shared,/usr \
+		--with-pgsql=shared \
 		--enable-phar=shared \
+		--enable-posix=shared \
 		--with-pspell=shared \
-		--without-readline \
-		--with-libedit \
 		--enable-session=shared \
 		--enable-shmop=shared \
 		--with-snmp=shared \
 		--enable-soap=shared \
 		--enable-sockets=shared \
+		--with-sqlite3=shared,/usr \
 		--enable-sysvmsg=shared \
 		--enable-sysvsem=shared \
 		--enable-sysvshm=shared \
 		--with-tidy=shared \
+		--with-unixODBC=shared,/usr \
+		--enable-wddx=shared \
 		--enable-xml=shared \
 		--enable-xmlreader=shared \
-		--enable-xmlwriter=shared \
 		--with-xmlrpc=shared \
+		--enable-xmlwriter=shared \
 		--with-xsl=shared \
-		--enable-wddx=shared \
-		--enable-zip=shared --with-libzip=shared \
+		--enable-zip=shared \
+			--with-libzip \
+		--with-zlib=shared \
+			--with-zlib-dir \
 		$_at_ || return 1
-	sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile || return 1
 	make
 }
 
_at_@ -171,22 +196,20 @@ build() {
 		--enable-fpm \
 		--enable-embed \
 		--with-litespeed \
-		--with-imap=shared --with-imap-ssl \
+		--with-imap=shared \
+			--with-imap-ssl \
 		|| return 1
 }
 
 check() {
-	:
+	return 0
 }
 
 package() {
 	pkgdesc="$pkgdesc (command line interface)"
-
-	cd "$builddir"
-	make -j1 INSTALL_ROOT="$pkgdir" install || return 1
+	make -C "$builddir" INSTALL_ROOT="$pkgdir" install || return 1
 
 	ln -sf /usr/bin/php$_suffix "$pkgdir"/usr/bin/php
-
 	rm -fr "$pkgdir"/.[[:alpha:]]* || return 1
 }
 
_at_@ -310,7 +333,6 @@ fpm() {
 }
 
 pear() {
-	local file
 	provides=$_pkgreal-pear
 	replaces=$provides
 	pkgdesc="$pkgdesc (php extension and application repository)"
_at_@ -328,6 +350,7 @@ pear() {
 	sed -e "s/\$INCARG/\$INCARG -d extension=xml.so/" \
 		 -i "$pkgdir"/usr/bin/pecl || return 1
 
+	local file
 	for file in pear peardev pecl; do
 		mv "$pkgdir"/usr/bin/$file \
 			"$subpkgdir"/usr/bin/$file$_suffix || return 1
_at_@ -358,13 +381,12 @@ config() {
 		"$subpkgdir"/etc/$pkgname/php.ini || return 1
 
 	# exit with an error if some modules were not in subpackages
-	rmdir "$pkgdir"/usr/lib/$pkgname/modules || return 1
+	rmdir "$pkgdir"/$EXTENSION_DIR || return 1
 
 	rm -fr "$pkgdir"/etc "$pkgdir"/var "$pkgdir"/usr/lib
 }
 
 _phar() {
-	local file
 	provides=$_pkgreal-phar-phar
 	replaces=$provides
 	pkgdesc="$pkgdesc (archive script)"
_at_@ -375,6 +397,8 @@ _phar() {
 	rm "$pkgdir"/usr/bin/phar || return 1
 	mv "$pkgdir"/usr/bin/phar.phar \
 		"$subpkgdir"/usr/bin/phar.phar$_suffix || return 1
+
+	local file
 	for file in phar$_suffix phar phar.phar; do
 		ln -sf /usr/bin/phar.phar$_suffix \
 			"$subpkgdir"/usr/bin/$file || return 1
_at_@ -384,10 +408,10 @@ _phar() {
 _extension() {
 	local dep deps
 	local name=${subpkgname#$pkgname-}
-	local index=$(eval echo \$_index_$name)
+	local index=$(eval echo \${_index_$name:-0})
 	provides="$_pkgreal-$name"
 	replaces=
-	depends=
+	depends=$(eval echo \$_depends_$name)
 
 	pkgdesc=$(eval echo \$_pkgdesc_$name)
 	: ${pkgdesc:=$(head -n1 "$builddir"/ext/$name/CREDITS)}
_at_@ -401,14 +425,14 @@ _extension() {
 		[ -z "${_extensions##*$dep*}" ] && depends="$depends $pkgname-$dep"
 	done
 
-	: ${index:=$(echo $depends | wc -w)}
+	index=$(($(echo $depends | wc -w)+$index))
 	depends="$pkgname-config phpapi$_apiver $depends"
 
-	mkdir -p "$subpkgdir"/usr/lib/$pkgname/modules \
-		"$subpkgdir"/etc/$pkgname/conf.d
+	mkdir -p "$subpkgdir"/usr/lib/$pkgname \
+		"$subpkgdir"/etc/$pkgname/conf.d || return 1
 
-	mv "$pkgdir"/usr/lib/$pkgname/modules/$name.so \
-		"$subpkgdir"/usr/lib/$pkgname/modules/ || return 1
+	mv "$pkgdir"/$EXTENSION_DIR/$name.so \
+		"$subpkgdir"/$EXTENSION_DIR || return 1
 
 	echo $(eval echo \$_prefix_$name)extension=$name.so > \
 		"$subpkgdir"/etc/$pkgname/conf.d/$(printf %02d $index)_$name.ini
-- 
2.11.1
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Mon Mar 06 2017 - 00:46:20 GMT