Mail archive
alpine-aports

[alpine-aports] [PATCH] testing/php7.1: fixes in extension depends tracking

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Fri, 24 Feb 2017 11:23:32 +0200

--
- rename submodule phar-phar -> phar-utils
- remade APKBUILD and sources from template-based to 7.1
---
v1 -> v2: fix 3rd party extension phpapi hook.
v2 -> v3: add -pecl subpkg. Provides an environment
          for building pecl extensions
v3 -> v4: switch from bundled to system gd library
v4 -> v5: switch to system libpcre
          make fileinfo extension shared
	  rebuild fileinfo data with current /usr/share/misc/magic.mgc
---
 testing/php7.1/APKBUILD                            | 93 +++++++++++-----------
 .../php7.1/{php-fpm.initd.in => php7.1-fpm.initd}  |  8 +-
 .../{php-fpm.logrotate.in => php7.1-fpm.logrotate} |  4 +-
 .../php7.1/{php-fpm.patch.in => php7.1-fpm.patch}  | 22 ++---
 ...includedir.patch.in => php7.1-includedir.patch} |  8 +-
 .../{php-module.conf.in => php7.1-module.conf}     |  2 +-
 6 files changed, 69 insertions(+), 68 deletions(-)
 rename testing/php7.1/{php-fpm.initd.in => php7.1-fpm.initd} (90%)
 rename testing/php7.1/{php-fpm.logrotate.in => php7.1-fpm.logrotate} (56%)
 rename testing/php7.1/{php-fpm.patch.in => php7.1-fpm.patch} (67%)
 rename testing/php7.1/{includedir.patch.in => php7.1-includedir.patch} (83%)
 rename testing/php7.1/{php-module.conf.in => php7.1-module.conf} (67%)
diff --git a/testing/php7.1/APKBUILD b/testing/php7.1/APKBUILD
index 451dc8c42c..3234471035 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=1
+pkgrel=2
 _apiver=20160303
 _suffix=${pkgname#php}
 _pkgreal=${pkgname%$_suffix}
_at_@ -16,25 +16,25 @@ depends_dev="$pkgname"
 replaces="$_pkgreal $_pkgreal-cli"
 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
+	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 libxpm-dev
-	libpng-dev libwebp-dev libjpeg-turbo-dev libmcrypt-dev recode-dev libedit-dev gettext-dev
+	libpng-dev libjpeg-turbo-dev libmcrypt-dev recode-dev libedit-dev gettext-dev file-dev
 	"
 source="http://php.net/distributions/$_pkgreal-$pkgver.tar.bz2
-	$_pkgreal-module.conf.in
-	$_pkgreal-fpm.logrotate.in
-	$_pkgreal-fpm.initd.in
-	$_pkgreal-fpm.patch.in
-	includedir.patch.in
+	$pkgname-module.conf
+	$pkgname-fpm.logrotate
+	$pkgname-fpm.initd
+	$pkgname-fpm.patch
+	$pkgname-includedir.patch
 	install-pear.patch
 	getrandom.patch
 	"
 # unimplemented extensions: com_dotnet interbase oci8 pdo_firebird pdo_oci
-_extensions="bcmath bz2 calendar ctype curl dba dom enchant exif ftp gd gettext gmp iconv imap:1 intl json
-	ldap mbstring mcrypt mysqli 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
+_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
+	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
 	"
 for _extension in $_extensions; do
 	[ -z "${_extension##*:*}" ] && eval _index_${_extension%:*}=${_extension#*:}
_at_@ -43,28 +43,13 @@ done
 _prefix_opcache="zend_"
 _pkgdesc_opcache="Zend OPcache"
 subpackages="$pkgname-dev $pkgname-doc $pkgname-libs $pkgname-apache2 $pkgname-phpdbg
-	$pkgname-litespeed $pkgname-cgi $pkgname-fpm $pkgname-pear::noarch
-	$pkgname-phar-phar:_phar:noarch $subpackages $pkgname-config::noarch"
+	$pkgname-litespeed $pkgname-cgi $pkgname-fpm $pkgname-pear::noarch $pkgname-pecl::noarch
+	$pkgname-phar-utils:_phar:noarch $subpackages $pkgname-config::noarch"
 builddir="$srcdir/$_pkgreal-$pkgver"
 
 prepare() {
 	cd "$builddir"
 
-	local i
-	for i in $source; do
-		case $i in
-			*.patch.in)
-				msg "${i%.in} [$_suffix]"
-				sed "s/_at__suffix@/$_suffix/g" "$srcdir/$i" \
-					| patch "${patch_args:--p1}" || return 1
-				;;
-			*.in)
-				msg "$i -> ${i%.in}"
-				sed "s/_at__suffix@/$_suffix/g" "$srcdir/$i" > ${i%.in}
-				;;
-		esac
-	done
-
 	sed "$(($(grep -n 'Pool Definitions' sapi/fpm/php-fpm.conf.in | cut -d: -f1)+3)),\$d" \
 		-i sapi/fpm/php-fpm.conf.in
 	echo include=_at_php_fpm_sysconfdir@/php-fpm.d/*.conf >> sapi/fpm/php-fpm.conf.in
_at_@ -99,8 +84,9 @@ _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 --with-pcre-dir \
+		--with-pcre-regex=/usr --with-pcre-dir \
 		--with-zlib=shared --with-zlib-dir \
 		--enable-bcmath=shared \
 		--with-bz2=shared \
_at_@ -112,8 +98,7 @@ _build() {
 		--with-enchant=shared \
 		--enable-exif=shared \
 		--enable-ftp=shared \
-		--with-gd=shared --with-webp-dir=shared --with-jpeg-dir=shared --with-png-dir=shared --with-xpm-dir=shared \
-		--with-freetype-dir=shared --enable-gd-native-ttf --disable-gd-jis-conv \
+		--with-gd=shared,/usr --enable-gd-native-ttf --disable-gd-jis-conv \
 		--with-gettext=shared \
 		--with-gmp=shared \
 		--with-iconv=shared \
_at_@ -182,6 +167,10 @@ build() {
 		--with-litespeed \
 		--with-imap=shared --with-imap-ssl \
 		|| return 1
+	# rebuild fileinfo with current /usr/share/misc/magic.mgc
+	sapi/cli/php -n ext/fileinfo/create_data_file.php \
+		/usr/share/misc/magic.mgc > ext/fileinfo/data_file.c || return 1
+	make
 }
 
 package() {
_at_@ -236,7 +225,7 @@ apache2() {
 	cp "$builddir"/sapi/apache2handler/lib$_pkgreal*.so \
 		"$subpkgdir"/usr/lib/apache2/mod_$pkgname.so || return 1
 
-	install -Dm644 "$builddir"/$_pkgreal-module.conf \
+	install -Dm644 "$srcdir"/$pkgname-module.conf \
 		"$subpkgdir"/etc/apache2/conf.d/$pkgname-module.conf
 }
 
_at_@ -308,9 +297,9 @@ fpm() {
 			"$subpkgdir"/etc/$pkgname/$file || return 1
 	done
 
-	install -Dm755 "$builddir"/$_pkgreal-fpm.initd \
+	install -Dm755 "$srcdir"/$pkgname-fpm.initd \
 		"$subpkgdir"/etc/init.d/$_pkgreal-fpm$_suffix || return 1
-	install -Dm644 "$builddir"/$_pkgreal-fpm.logrotate \
+	install -Dm644 "$srcdir"/$pkgname-fpm.logrotate \
 		"$subpkgdir"/etc/logrotate.d/$_pkgreal-fpm$_suffix || return 1
 }
 
_at_@ -318,8 +307,8 @@ pear() {
 	local file
 	provides=$_pkgreal-pear
 	replaces=$provides
-	pkgdesc="$pkgdesc (extension and application repository)"
-	depends="$pkgname-dev $pkgname-xml"
+	pkgdesc="$pkgdesc (php extension and application repository)"
+	depends="$pkgname $pkgname-xml"
 
 	mkdir -p "$subpkgdir"/usr/bin \
 		"$subpkgdir"/etc/$pkgname
_at_@ -343,8 +332,16 @@ pear() {
 	done
 }
 
+pecl() {
+	provides=$_pkgreal-pecl
+	replaces=
+	pkgdesc="$pkgdesc (php extension community library)"
+	depends="$pkgname-pear $pkgname-dev autoconf gcc make musl-dev"
+	mkdir -p "$subpkgdir"
+}
+
 config() {
-	provides="phpapi=$_apiver"
+	provides="phpapi$_apiver"
 	replaces=
 	depends=
 	pkgdesc="$pkgdesc (common config)"
_at_@ -379,7 +376,7 @@ _phar() {
 }
 
 _extension() {
-	local dep
+	local dep deps
 	local name=${subpkgname#$pkgname-}
 	local index=$(eval echo \$_index_$name)
 	provides="$_pkgreal-$name"
_at_@ -390,12 +387,16 @@ _extension() {
 	: ${pkgdesc:=$(head -n1 "$builddir"/ext/$name/CREDITS)}
 	pkgdesc="PHP$_suffix extension: ${pkgdesc:-$name}"
 
-	for dep in $(grep -o "_DEP('$name'.*" "$builddir"/ext/$name/config.w32 | sed "s/[',);]//g"); do
+	[ -f "$builddir"/ext/$name/config.w32 ] && \
+		deps=$(grep -o "_DEP('$name'.*" "$builddir"/ext/$name/config.w32 | sed "s/[',);]//g")
+	[ -f "$builddir"/ext/$name/config.m4 ] && \
+		deps="$deps $(grep -o "_DEP($name,.*" "$builddir"/ext/$name/config.m4 | sed "s/[,)]//g")"
+	for dep in $(echo -e ${deps//[[:space:]]/\\n} | sort -u); do
 		[ -z "${_extensions##*$dep*}" ] && depends="$depends $pkgname-$dep"
 	done
 
 	: ${index:=$(echo $depends | wc -w)}
-	depends="$pkgname-config phpapi=$_apiver $depends"
+	depends="$pkgname-config phpapi$_apiver $depends"
 
 	mkdir -p "$subpkgdir"/usr/lib/$pkgname/modules \
 		"$subpkgdir"/etc/$pkgname/conf.d
_at_@ -408,10 +409,10 @@ _extension() {
 }
 
 sha512sums="b4a3492f4af92facd16e7dfb47ec16b43e4c5b25be193ff6e36418173893edb75ca4ca94767b643a6971d60578727fa1f67f20cc84b9a140cb1b9a367ec34a6f  php-7.1.2.tar.bz2
-e0f24eea250ed6a8c8286b2ed496a3feb1d9a2e399755f822387a4c26b34168bb346109c08d2b827d8230fe3103295d8b7f7b6bc09219e5b3ad4429271ece5d6  php-module.conf.in
-b25c0bcaae4ddc7e001a6484423dec48be8735168dc3ab7471f5a57ce631273f11514c924b368ff846fe9a04bd4e1c7f296f1c8527f6f239a79df84189841983  php-fpm.logrotate.in
-809e584304365412ecf80eb2ebb613439342e9a1faf36d0b04c76e60b1bf1345812799a16ffad76dbd3aa5f00c55329a051b308e451301d6e8d673813e37856b  php-fpm.initd.in
-2b3d60e4c57929a7bc1875c83472a6be1b7695a623893d108f905e742fe72ddf7fec7bf7a42b332ac33304434620a0317fd79d4ad707be886825d4b0fd96b938  php-fpm.patch.in
-c7841eef58e1203cb1eb97efff96427d560c1c8d9945286e95dbecc7ccac20e0a29a333194032af9696961c317876d5b971f282644167ba6fe7135e9ac86447e  includedir.patch.in
+2801d6e0656b0a9eb090c6a3eee711588515a600e1292a6ba5ce24302c57bb7feb128139c0eb7715af0ddc2f40a7a2832c6e4153fe4d3a467297957a4afb3123  php7.1-module.conf
+066db134f9cd4695caf62cbb970bd13cbcf8d074a8e378945e2c6e80d3b8f4125f7cee2ee5b379359881958955d9737eb24cbfdb72d11c19bd432101ee119501  php7.1-fpm.logrotate
+bf8bfbd33134acaa5395336005361519ded1062f461483c18cf69d0395c4fb950802fcfb186c9b54ac382c51e2b634341757ffff9eb7af2dcf017be5af587d1f  php7.1-fpm.initd
+5e5073aca1ac3c4b1163d7c943f059d00faf04f29db766a0fc1ed3aecf9b7260491c5703aff651baa7ca944d750ff0318ce66aaac5b8500f41056b5357d3fa9f  php7.1-fpm.patch
+3f5da2f3b904ceb14f8507b924b046dfbee601e274fd501150a78fe362983ee1209ce596e880ed5481a857c4eb9d3deba26c4c14d04fd58075be93e98436f0cd  php7.1-includedir.patch
 f1177cbf6b1f44402f421c3d317aab1a2a40d0b1209c11519c1158df337c8945f3a313d689c939768584f3e4edbe52e8bd6103fb6777462326a9d94e8ab1f505  install-pear.patch
 da012a82c00f9dfd3b6e446e2c3e7da597079e9b428f53ca61b5e216c304e3c02e953a5fc2759e516580cb98f08e86b0f5b33ea8df99a8003ae33fcb431463b4  getrandom.patch"
diff --git a/testing/php7.1/php-fpm.initd.in b/testing/php7.1/php7.1-fpm.initd
similarity index 90%
rename from testing/php7.1/php-fpm.initd.in
rename to testing/php7.1/php7.1-fpm.initd
index f892559e1b..37e7e02852 100644
--- a/testing/php7.1/php-fpm.initd.in
+++ b/testing/php7.1/php7.1-fpm.initd
_at_@ -8,7 +8,7 @@
 
 : ${name:="PHP FastCGI Process Manager"}
 
-command="/usr/sbin/php-fpm_at__suffix@"
+command="/usr/sbin/php-fpm7.1"
 command_background="yes"
 start_stop_daemon_args="--quiet"
 pidfile="/run/$RC_SVCNAME/php-fpm.pid"
_at_@ -29,12 +29,12 @@ depend() {
 
 init_vars() {
 	# Defaults for single master process with multiple pools
-	if [ "$RC_SVCNAME" = "php-fpm_at__suffix@" ]; then
-		: ${fpm_config:="/etc/php_at__suffix@/php-fpm.conf"}
+	if [ "$RC_SVCNAME" = "php-fpm7.1" ]; then
+		: ${fpm_config:="/etc/php7.1/php-fpm.conf"}
 		: ${user:="root"}
 	# Defaults for master process per pool
 	else
-		: ${fpm_config="/etc/php_at__suffix@/php-fpm.d/${RC_SVCNAME#php-fpm@_suffix@.}.conf"}
+		: ${fpm_config="/etc/php7.1/php-fpm.d/${RC_SVCNAME#php-fpm7.1.}.conf"}
 		: ${user:="$(conf_get user)"}
 		: ${user:="nobody"}
 		: ${group:="$(conf_get group)"}
diff --git a/testing/php7.1/php-fpm.logrotate.in b/testing/php7.1/php7.1-fpm.logrotate
similarity index 56%
rename from testing/php7.1/php-fpm.logrotate.in
rename to testing/php7.1/php7.1-fpm.logrotate
index ac1fcb2b35..aafe126a62 100644
--- a/testing/php7.1/php-fpm.logrotate.in
+++ b/testing/php7.1/php7.1-fpm.logrotate
_at_@ -1,4 +1,4 @@
-/var/log/php_at__suffix@/*.log {
+/var/log/php7.1/*.log {
 	rotate 7
 	daily
 	missingok
_at_@ -8,6 +8,6 @@
 	dateext
 	sharedscripts
 	postrotate
-		/etc/init.d/php-fpm_at__suffix@ --ifstarted --quiet reopen
+		/etc/init.d/php-fpm7.1 --ifstarted --quiet reopen
 	endscript
 }
diff --git a/testing/php7.1/php-fpm.patch.in b/testing/php7.1/php7.1-fpm.patch
similarity index 67%
rename from testing/php7.1/php-fpm.patch.in
rename to testing/php7.1/php7.1-fpm.patch
index b6b5917e74..480c5c4b7a 100644
--- a/testing/php7.1/php-fpm.patch.in
+++ b/testing/php7.1/php7.1-fpm.patch
_at_@ -3,53 +3,53 @@
 _at_@ -1180,3 +1180,3 @@
  	if (!fpm_global_config.error_log) {
 -		fpm_global_config.error_log = strdup("log/php-fpm.log");
-+		fpm_global_config.error_log = strdup("log/php_at__suffix@/error.log");
++		fpm_global_config.error_log = strdup("log/php7.1/error.log");
  	}
 _at_@ -1191,3 +1191,3 @@
  	if (!fpm_global_config.syslog_ident) {
 -		fpm_global_config.syslog_ident = strdup("php-fpm");
-+		fpm_global_config.syslog_ident = strdup("php-fpm_at__suffix@");
++		fpm_global_config.syslog_ident = strdup("php-fpm7.1");
  	}
 _at_@ -1683,3 +1683,3 @@
  		} else {
 -			spprintf(&tmp, 0, "%s/etc/php-fpm.conf", fpm_globals.prefix);
-+			spprintf(&tmp, 0, "%s/etc/php_at__suffix@/php-fpm.conf", fpm_globals.prefix);
++			spprintf(&tmp, 0, "%s/etc/php7.1/php-fpm.conf", fpm_globals.prefix);
  		}
 --- a/sapi/fpm/php-fpm.conf.in
 +++ b/sapi/fpm/php-fpm.conf.in
 _at_@ -16,3 +16,3 @@
  ; Default Value: none
 -;pid = run/php-fpm.pid
-+;pid = run/php-fpm_at__suffix@.pid
++;pid = run/php-fpm7.1.pid
  
 _at_@ -22,4 +22,4 @@
  ; Note: the default prefix is _at_EXPANDED_LOCALSTATEDIR@
 -; Default Value: log/php-fpm.log
 -;error_log = log/php-fpm.log
-+; Default Value: log/php_at__suffix@/error.log
-+;error_log = log/php_at__suffix@/error.log
++; Default Value: log/php7.1/error.log
++;error_log = log/php7.1/error.log
  
 _at_@ -35,4 +35,4 @@
  ; which must suit common needs.
 -; Default Value: php-fpm
 -;syslog.ident = php-fpm
-+; Default Value: php-fpm_at__suffix@
-+;syslog.ident = php-fpm_at__suffix@
++; Default Value: php-fpm7.1
++;syslog.ident = php-fpm7.1
  
 --- a/sapi/fpm/www.conf.in
 +++ b/sapi/fpm/www.conf.in
 _at_@ -252,3 +252,3 @@
  ; Default: not set
 -;access.log = log/$pool.access.log
-+;access.log = log/php_at__suffix@/$pool.access.log
++;access.log = log/php7.1/$pool.access.log
  
 _at_@ -316,3 +316,3 @@
  ; Note: slowlog is mandatory if request_slowlog_timeout is set
 -;slowlog = log/$pool.log.slow
-+;slowlog = log/php_at__suffix@/$pool.slow.log
++;slowlog = log/php7.1/$pool.slow.log
  
 _at_@ -410,3 +410,3 @@
  ;php_flag[display_errors] = off
 -;php_admin_value[error_log] = /var/log/fpm-php.www.log
-+;php_admin_value[error_log] = /var/log/php_at__suffix@/$pool.error.log
++;php_admin_value[error_log] = /var/log/php7.1/$pool.error.log
  ;php_admin_flag[log_errors] = on
diff --git a/testing/php7.1/includedir.patch.in b/testing/php7.1/php7.1-includedir.patch
similarity index 83%
rename from testing/php7.1/includedir.patch.in
rename to testing/php7.1/php7.1-includedir.patch
index 8087b6200d..8075eecb75 100644
--- a/testing/php7.1/includedir.patch.in
+++ b/testing/php7.1/php7.1-includedir.patch
_at_@ -5,7 +5,7 @@
  #
  
 -phpincludedir = $(includedir)/php
-+phpincludedir = $(includedir)/php_at__suffix@
++phpincludedir = $(includedir)/php7.1
  phpbuilddir = $(libdir)/build
  
  BUILD_FILES = \
_at_@ -13,7 +13,7 @@
 +++ b/ext/pdo/Makefile.frag
 _at_@ -1,4 +1,4 @@
 -phpincludedir=$(prefix)/include/php
-+phpincludedir=$(prefix)/include/php_at__suffix@
++phpincludedir=$(prefix)/include/php7.1
  
  PDO_HEADER_FILES= \
  	php_pdo.h \
_at_@ -24,7 +24,7 @@
  version="_at_PHP_VERSION@"
  vernum="_at_PHP_VERSION_ID@"
 -include_dir="_at_includedir@/php"
-+include_dir="_at_includedir@/php@_suffix@"
++include_dir="_at_includedir@/php7.1"
  includes="-I$include_dir -I$include_dir/main -I$include_dir/TSRM -I$include_dir/Zend -I$include_dir/ext -I$include_dir/ext/date/lib"
  ldflags="_at_PHP_LDFLAGS@"
  libs="_at_EXTRA_LIBS@"
_at_@ -35,7 +35,7 @@
  exec_prefix="`eval echo _at_exec_prefix@`"
  phpdir="`eval echo _at_libdir@`/build"
 -includedir="`eval echo _at_includedir@`/php"
-+includedir="`eval echo _at_includedir@`/php@_suffix@"
++includedir="`eval echo _at_includedir@`/php7.1"
  builddir="`pwd`"
  SED="_at_SED@"
  
diff --git a/testing/php7.1/php-module.conf.in b/testing/php7.1/php7.1-module.conf
similarity index 67%
rename from testing/php7.1/php-module.conf.in
rename to testing/php7.1/php7.1-module.conf
index 267ad00e6e..80f2654f63 100644
--- a/testing/php7.1/php-module.conf.in
+++ b/testing/php7.1/php7.1-module.conf
_at_@ -1,4 +1,4 @@
-LoadModule php_at__suffix@_module modules/mod_php@_suffix@.so
+LoadModule php7.1_module modules/mod_php7.1.so
 
 DirectoryIndex index.php index.html
 AddHandler application/x-httpd-php .php
-- 
2.11.1
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Fri Feb 24 2017 - 11:23:32 GMT