Mail archive
alpine-aports

[alpine-aports] [PATCH] community/php7: remove suffix '7', add recode extension, packaging fuxups

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Fri, 25 Nov 2016 16:54:48 +0200

---
 community/php7/APKBUILD           | 139 ++++++++++++++++++--------------------
 community/php7/php7-fpm.initd     |  14 ++--
 community/php7/php7-fpm.logrotate |   2 +-
 community/php7/php7-module.conf   |   2 +-
 community/php7/pid_log.patch      |   8 +--
 5 files changed, 80 insertions(+), 85 deletions(-)
diff --git a/community/php7/APKBUILD b/community/php7/APKBUILD
index c0b1f5c..38589c8 100644
--- a/community/php7/APKBUILD
+++ b/community/php7/APKBUILD
_at_@ -3,7 +3,7 @@
 pkgname=php7
 _pkgreal=php
 pkgver=7.0.13
-pkgrel=1
+pkgrel=2
 pkgdesc="The PHP language runtime engine - 7th branch"
 url="http://www.php.net/"
 arch="all"
_at_@ -23,7 +23,7 @@ makedepends="autoconf bison re2c apache2-dev libxml2-dev libxslt-dev libzip-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 gsoap-dev recode-dev
-	readline-dev paxmark gettext-dev
+	readline-dev gettext-dev
 	"
 source="http://php.net/distributions/$_pkgreal-$pkgver.tar.bz2
 	$pkgname-fpm.initd
_at_@ -38,8 +38,8 @@ builddir="$srcdir/$_pkgreal-$pkgver"
 
 _exts="bcmath bz2 calendar ctype curl dba dom enchant exif ftp gd gettext gmp iconv imap intl json
 	ldap mbstring mcrypt mysqli mysqlnd odbc opcache openssl pcntl pdo pdo_dblib pdo_mysql
-	pdo_odbc pdo_pgsql pdo_sqlite pgsql phar:phar posix pspell readline session shmop snmp soap
-	sockets sqlite3 sysvmsg sysvsem sysvshm tidy wddx xml xmlreader xmlrpc xsl zip zlib
+	pdo_odbc pdo_pgsql pdo_sqlite pgsql phar:phar posix pspell readline recode session shmop snmp
+	soap sockets sqlite3 sysvmsg sysvsem sysvshm tidy wddx xml xmlreader xmlrpc xsl zip zlib
 	"
 subpackages="$pkgname-dev $pkgname-doc $pkgname-apache2 $pkgname-phpdbg $pkgname-embed
 	$pkgname-litespeed $pkgname-cgi $pkgname-fpm $pkgname-pear::noarch
_at_@ -74,7 +74,6 @@ _build() {
 		--build=$CBUILD \
 		--host=$CHOST \
 		--prefix=/usr \
-		--program-suffix=7 \
 		--libdir=/usr/lib/$pkgname \
 		--datadir=/usr/share/$pkgname \
 		--sysconfdir=/etc/$pkgname \
_at_@ -139,13 +138,12 @@ _build() {
 		--enable-wddx=shared \
 		--enable-zip=shared --with-libzip=shared \
 		$_at_ || return 1
-	sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile  # see #183 (from main/php)
+	sed -ri "s/^(EXTRA_LDFLAGS[ ]*\=.*)/\1 -lpthread/" Makefile  # see #183 (from main/php5)
 	make || return 1
 }
 
 build() {
 	cd "$builddir"
-
 	# phpdbg
 	_build --enable-phpdbg \
 		--enable-phpdbg \
_at_@ -161,55 +159,49 @@ build() {
 		--with-apxs2 \
 		--with-readline=shared \
 		|| return 1
-	mv libs/libphp7.so sapi/apache2handler/mod_php7.so
+	mv libs/lib$pkgname.so sapi/apache2handler
 	# cgi,cli,fpm,embed,litespeed
 	_build --disable-phpdbg \
 		--enable-fpm \
 		--enable-embed \
 		--with-litespeed \
 		--with-readline=shared \
+		--without-imap --without-imap-ssl \
+		--with-recode=shared \
+		|| return 1
+	_build --disable-phpdbg \
+		--enable-fpm \
+		--enable-embed \
+		--with-litespeed \
+		--with-readline=shared \
 		|| return 1
 }
 
 package() {
 	cd "$builddir"
-
 	make -j1 INSTALL_ROOT="$pkgdir" install || return 1
-
-	install -Dm644 php.ini-production "$pkgdir"/etc/$pkgname/php.ini || return 1
-
-	local file; for file in pear peardev pecl; do
-		sed -i -e "s~/usr/bin/php~/usr/bin/php7~g" \
-			-e "s~PHP=php~PHP=php7~" \
-			"$pkgdir"/usr/bin/$file || return 1
-	done
-	paxmark -m "$pkgdir"/usr/bin/php7
-
-	find "$pkgdir" -name '.*' | xargs rm -rf || return 1
-	rmdir "$pkgdir"/var/run
+	rm -fr "$pkgdir"/.[[:alpha:]]* "$pkgdir"/var || return 1
+	mv "$pkgdir"/usr/share/man/man1/php-cgi.1 \
+		"$pkgdir"/usr/share/man/man1/$pkgname-cgi.1
+	mv "$pkgdir"/usr/share/man/man8/php-fpm.8 \
+		"$pkgdir"/usr/share/man/man8/$pkgname-fpm.8
 }
 
 dev() {
 	default_dev
-	depends="$depends $pkgname $pkgname-pear"
+	depends="$depends $pkgname-pear"
 
-	mkdir -p "$subpkgdir"/usr/bin \
-		"$subpkgdir"/usr/lib/$pkgname
-
-	mv "$pkgdir"/usr/bin/php-config7 "$pkgdir"/usr/bin/peardev \
-		"$subpkgdir"/usr/bin/ || return 1
-	mv "$pkgdir"/usr/lib/$pkgname/build \
-		"$subpkgdir"/usr/lib/$pkgname/
+	mv "$pkgdir"/usr/bin/phpize "$pkgdir"/usr/bin/peardev \
+		"$subpkgdir"/usr/bin/
+	mv "$pkgdir"/usr/lib/$pkgname/build "$subpkgdir"/usr/lib/$pkgname/
 }
 
 doc() {
 	default_doc
 
-	mkdir -p "$subpkgdir"/usr/share/doc/$pkgname
-
 	local file
 	for file in CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS README* UPGRADING*; do
-		cp "$builddir"/$file "$subpkgdir"/usr/share/doc/$pkgname/ || return 1
+		install -Dm644 "$builddir"/$file "$subpkgdir"/usr/share/doc/$pkgname/$file || return 1
 	done
 }
 
_at_@ -217,11 +209,10 @@ apache2() {
 	pkgdesc="PHP Module for Apache2"
 	depends="$pkgname-common apache2"
 
-	install -D -m755 "$builddir"/sapi/apache2handler/mod_php7.so \
-		"$subpkgdir"/usr/lib/apache2/mod_php7.so || return 1
-
-	install -D -m644 "$srcdir"/php7-module.conf \
-		"$subpkgdir"/etc/apache2/conf.d/php7-module.conf
+	install -Dm755 "$builddir"/sapi/apache2handler/lib$pkgname.so \
+		"$subpkgdir"/usr/lib/apache2/lib$pkgname.so || return 1
+	install -Dm644 "$srcdir"/$pkgname-module.conf \
+		"$subpkgdir"/etc/apache2/conf.d/$pkgname-module.conf
 }
 
 phpdbg() {
_at_@ -229,7 +220,7 @@ phpdbg() {
 	depends="$pkgname-common"
 
 	install -Dm755 "$builddir"/sapi/phpdbg/phpdbg \
-		 "$subpkgdir"/usr/bin/phpdbg7
+		"$subpkgdir"/usr/bin/phpdbg
 }
 
 embed() {
_at_@ -237,7 +228,7 @@ embed() {
 	depends="$pkgname-common"
 
 	mkdir -p "$subpkgdir"/usr/lib
-	mv "$pkgdir"/usr/lib/libphp*.so "$subpkgdir"/usr/lib/
+	mv "$pkgdir"/usr/lib/lib$pkgname.so "$subpkgdir"/usr/lib/
 }
 
 litespeed() {
_at_@ -245,7 +236,7 @@ litespeed() {
 	depends="$pkgname-common"
 
 	mkdir -p "$subpkgdir"/usr/bin
-	mv "$pkgdir"/usr/bin/lsphp "$subpkgdir"/usr/bin/lsphp7
+	mv "$pkgdir"/usr/bin/lsphp "$subpkgdir"/usr/bin/
 }
 
 cgi() {
_at_@ -253,31 +244,28 @@ cgi() {
 	depends="$pkgname-common"
 
 	mkdir -p "$subpkgdir"/usr/bin
-	mv "$pkgdir"/usr/bin/php-cgi7 "$subpkgdir"/usr/bin/
+	mv "$pkgdir"/usr/bin/php-cgi "$subpkgdir"/usr/bin/$pkgname-cgi
 }
 
 fpm() {
 	pkgdesc="PHP FastCGI Process Manager"
 	depends="$pkgname-common"
 
-	mv "$pkgdir"/var "$subpkgdir"/ || return 1
-
 	mkdir -p "$subpkgdir"/etc/$pkgname \
 		"$subpkgdir"/usr \
 		"$subpkgdir"/var/lib \
 		"$subpkgdir"/var/log/$pkgname
 
-	mv "$pkgdir"/usr/share/$pkgname/fpm "$subpkgdir"/var/lib/$pkgname/ || return 1
-	mv "$pkgdir"/usr/sbin "$subpkgdir"/usr/ || return 1
-	mv "$pkgdir"/etc/$pkgname/php-fpm* "$subpkgdir"/etc/$pkgname/ || return 1
+	mv "$pkgdir"/usr/share/$pkgname/fpm "$subpkgdir"/var/lib/$pkgname || return 1
+	mv "$pkgdir"/usr/sbin "$subpkgdir"/usr/
+	mv "$subpkgdir"/usr/sbin/php-fpm "$subpkgdir"/usr/sbin/$pkgname-fpm || return 1
 
-	local file; for file in php-fpm.conf php-fpm.d/www.conf; do
-		mv "$subpkgdir"/etc/$pkgname/$file.default \
-			"$subpkgdir"/etc/$pkgname/$file || return 1
-	done
+	mv "$pkgdir"/etc/$pkgname/php-fpm* "$subpkgdir"/etc/$pkgname/ || return 1
+	find "$subpkgdir"/etc/$pkgname -name *.default \
+		-exec sh -c 'f={}; mv $f ${f%.default}' \;
 
-	install -D -m755 "$srcdir"/$pkgname-fpm.initd "$subpkgdir"/etc/init.d/php-fpm7 || return 1
-	install -D -m644 "$srcdir"/$pkgname-fpm.logrotate "$subpkgdir"/etc/logrotate.d/php-fpm7
+	install -D -m755 "$srcdir"/$pkgname-fpm.initd "$subpkgdir"/etc/init.d/$pkgname-fpm
+	install -D -m644 "$srcdir"/$pkgname-fpm.logrotate "$subpkgdir"/etc/logrotate.d/$pkgname-fpm
 }
 
 pear() {
_at_@ -287,9 +275,9 @@ pear() {
 	mkdir -p "$subpkgdir"/usr/bin \
 		"$subpkgdir"/etc/$pkgname
 
-	local file; for file in phpize7 pecl pear; do
-		mv "$pkgdir"/usr/bin/$file "$subpkgdir"/usr/bin/
-	done
+	mv "$pkgdir"/usr/bin/pecl "$pkgdir"/usr/bin/pear \
+		"$subpkgdir"/usr/bin/
+
 	mv "$pkgdir"/etc/$pkgname/pear.conf "$subpkgdir"/etc/$pkgname/ || return 1
 	mv "$pkgdir"/usr/share "$subpkgdir"/usr/
 }
_at_@ -297,15 +285,19 @@ pear() {
 common() {
 	pkgdesc="$pkgdesc (common config)"
 
-	mkdir -p "$subpkgdir"/usr
-	mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ || return 1
-	mv "$pkgdir"/etc "$subpkgdir"/ || return 1
+	install -Dm644 "$builddir"/php.ini-production \
+		"$subpkgdir"/etc/$pkgname/php.ini || return 1
 
-	mkdir "$subpkgdir"/etc/$pkgname/conf.d
+	# exit with an error if there is any configs
+	# or if some modules were not in subpackages
+	rmdir "$pkgdir"/usr/lib/$pkgname/modules \
+		"$pkgdir"/etc/$pkgname || return 1
+	rm -fr "$pkgdir"/etc "$pkgdir"/usr/lib
 }
 
 phar() {
 	_package_ext || return 1
+
 	mkdir -p "$subpkgdir"/usr/bin
 	mv "$pkgdir"/usr/bin/phar* "$subpkgdir"/usr/bin/
 }
_at_@ -326,7 +318,10 @@ _package_ext() {
 
 	# extension prefix
 	local prefix=
-	[ "$extname" != "opcache" ] || prefix="zend_"
+	[ "$extname" = "opcache" ] && prefix="zend_"
+
+	# fix segfault: make imap to be loaded after recode
+	[ "$extname" = "imap" ] && elo=01
 
 	mkdir -p "$subpkgdir"/usr/lib/$pkgname/modules \
 		"$subpkgdir"/etc/$pkgname/conf.d
_at_@ -338,26 +333,26 @@ _package_ext() {
 }
 
 md5sums="f62d1c9ddb3a791b7eac423c7b2a769c  php-7.0.13.tar.bz2
-4115cbd0843c72adc3bd42fecd6d4540  php7-fpm.initd
-25bde13e7894c2930d97fad68d5dd3b3  php7-fpm.logrotate
-47be6cd1ed92f21579e15bf2003a709f  php7-module.conf
+d3663c0871e62c3adf4a895909bdc885  php7-fpm.initd
+6085eb7854c192b6a533bb18eeaebe2f  php7-fpm.logrotate
+3cea5c5334508dfc43591cd5bb1483c6  php7-module.conf
 483bc0a85c50a9a9aedbe14a19ed4526  install-pear.patch
 66f0037a029f9eed2b31d2e1d50f1860  tidy-buffio.patch
 d872e633c9b33c3c9f629dd2edd2e5c5  includedir.patch
-6ba762ab7a105163b8e5b3913deae109  pid_log.patch"
+7f9b586eceb6b786665e98328fe73432  pid_log.patch"
 sha256sums="d090bb523812117ec0c08d8f0b5c5f0616aa7a29a2eeee0374efe53a7cfe88c1  php-7.0.13.tar.bz2
-a7e4fc0eeba18aec019f62ed966915afd82b6b5fb1e1af93b59f964b5bd66172  php7-fpm.initd
-6e4406f21b69085714cdb9d9a67c08e27a1c737ab353f9813cb2fc268352d2c6  php7-fpm.logrotate
-276c823ee666ea73b36d4e97174eeea05713125b61f7f8681e350453c4123143  php7-module.conf
+c57d381630bb90d8a12b4b0c742312493ca4bf1e164ae305a9c920df25f45100  php7-fpm.initd
+bcd2f0a5caed573e4ac31a0dea6a7cd2584cdb9943f8a390b80ed900180dbb2a  php7-fpm.logrotate
+dc73bb3a3bca94cdf070338ecfed85940548eda978e9392a711226ba62c1ce60  php7-module.conf
 f739ca427a1dd53a388bad0823565299c5d4a5796b1171b892884e4d7d099bab  install-pear.patch
 5dc8f32e5e2b1cd6317ada5a5adb9b5f0802ed6e0dbe065d7bfcc0f55d47e0d5  tidy-buffio.patch
 ea74966a23b1b54548ee35e9ccc2fc8d2b7c2285c385c44d6b23d9e2f25ea1a7  includedir.patch
-0cca8729c64682387a8c44ed74f0966da697f2817152d8d05bb25bedc7eaafec  pid_log.patch"
+61d1b9543d2bb2b02d8a0b0d83fbe6cfb15166dca5fa64c850bae6ad63065271  pid_log.patch"
 sha512sums="53276fbd35855b9337120fd74f6932e70822b8e5508b6bed068a78805049d36960300e781ec5640f4a90f2d4a09e506084a865341d151bc5c87b7777cb5ff6a3  php-7.0.13.tar.bz2
-1c708de82d1086f272f484faf6cf6d087af7c31750cc2550b0b94ed723961b363f28a947b015b2dfc0765caea185a75f5d2c2f2b099c948b65c290924f606e4f  php7-fpm.initd
-cacce7bf789467ff40647b7319e3760c6c587218720538516e8d400baa75651f72165c4e28056cd0c1dc89efecb4d00d0d7823bed80b29136262c825ce816691  php7-fpm.logrotate
-fbf9a1572d37370ec0d126502e1d066e045a992484d8fc4f1e2ede330134c1a15f4029f29fa4daebd48eed78b045dc051ced69fbf1f11efc7ad81d884a639a99  php7-module.conf
+a9bb2a39deab4804627cae72be0bc18e7e189998aa555cee4cd5da7470ff7018cf53bfb4318daaba6709d1e000002bfefaf4e841a94eac132edef5dc20f1845b  php7-fpm.initd
+da404e9d7bb7af484351b6c9d2a2e8f1eff8d44704da3d877bc6af11c638e0a1f7225ea5ac381cada316876dfaaa81254c87fe3867849fb898478f459fdc367b  php7-fpm.logrotate
+ebfa4365c88c745fb27d9271d66daabeaecb26ce31e01716d42c187a0afd06e22e815a66e2aafb29e1e88a23248e3b4182928033294928985c9b8362174738c8  php7-module.conf
 f1177cbf6b1f44402f421c3d317aab1a2a40d0b1209c11519c1158df337c8945f3a313d689c939768584f3e4edbe52e8bd6103fb6777462326a9d94e8ab1f505  install-pear.patch
 6894c9cba7752a3406e774d9efc0e058c37433493c1c20101e9563bf247c112157a67e306b06b9517b0422eca521f543d637a6cbd2cea7639e43f13d773b3d2b  tidy-buffio.patch
 199aecdbd3b4035aabf5379c215f82412d3c98b79a1ee186944e7fe1f0ed6f40789ea30e2355149491de6be34fc66c5e486e2a79a7e41ab2ae18706ef3ffe79b  includedir.patch
-82231c7b27b4d044272857dc713674884715ed8e36e54be06faa5d2a949ba4bca597628958a9c5683ec51c36e05a00f6be811c7e95112b0314c98528f584a8d6  pid_log.patch"
+afc9caf433ea5a1d366c017830413464ba4bb121e37203a59e14e8bfc9577d14387d22613e8b2a04be5e6613c5bc2700b3b854e938cf204cd081fc09b4071d43  pid_log.patch"
diff --git a/community/php7/php7-fpm.initd b/community/php7/php7-fpm.initd
index f56fdb5..6467441 100644
--- a/community/php7/php7-fpm.initd
+++ b/community/php7/php7-fpm.initd
_at_@ -8,16 +8,16 @@
 
 : ${name:="PHP FastCGI Process Manager"}
 
-command="/usr/sbin/php-fpm7"
+command="/usr/sbin/php7-fpm"
 command_background="yes"
 start_stop_daemon_args="--quiet"
-pidfile="/run/$RC_SVCNAME/php-fpm.pid"
+pidfile="/run/$RC_SVCNAME/php7-fpm.pid"
 retry="SIGTERM/20"
 
 # configtest is here only for backward compatibility
 extra_commands="checkconfig configtest"
 extra_started_commands="reload reopen"
-description_checkconfig="Run php-fpm config check"
+description_checkconfig="Run config check"
 description_reload="Gracefully reload workers and config"
 description_reopen="Reopen log files"
 
_at_@ -25,22 +25,22 @@ required_files="$fpm_config"
 
 depend() {
 	need net
-	use apache2 lighttpd nginx
+	before apache2 lighttpd nginx
 }
 
 init_vars() {
 	# Defaults for single master process with multiple pools
-	if [ "$RC_SVCNAME" = "php-fpm7" ]; then
+	if [ "$RC_SVCNAME" = "php7-fpm" ]; then
 		: ${fpm_config:="/etc/php7/php-fpm.conf"}
 		: ${user:="root"}
 	# Defaults for master process per pool
 	else
-		: ${fpm_config="/etc/php7/php-fpm.d/${RC_SVCNAME#php-fpm7.}.conf"}
+		: ${fpm_config="/etc/php7/php-fpm.d/${RC_SVCNAME#php7-fpm.}.conf"}
 		: ${user:="$(conf_get user)"}
 		: ${user:="nobody"}
 		: ${group:="$(conf_get group)"}
 	fi
-	command_args="--nodaemonize --fpm-config $fpm_config"
+	command_args="--nodaemonize --fpm-config $fpm_config --pid $pidfile"
 	start_stop_daemon_args="$start_stop_daemon_args
 		--user $user ${group:+"--group $group"}"
 }
diff --git a/community/php7/php7-fpm.logrotate b/community/php7/php7-fpm.logrotate
index 10e53e4..4273f72 100644
--- a/community/php7/php7-fpm.logrotate
+++ b/community/php7/php7-fpm.logrotate
_at_@ -8,6 +8,6 @@
 	dateext
 	sharedscripts
 	postrotate
-		/etc/init.d/php-fpm7 --ifstarted --quiet reopen
+		/etc/init.d/php7-fpm --ifstarted --quiet reopen
 	endscript
 }
diff --git a/community/php7/php7-module.conf b/community/php7/php7-module.conf
index cf7573b..f0a0b47 100644
--- a/community/php7/php7-module.conf
+++ b/community/php7/php7-module.conf
_at_@ -1,4 +1,4 @@
-LoadModule php7_module modules/mod_php7.so
+LoadModule php7_module modules/libphp7.so
 
 DirectoryIndex index.php index.html
 AddHandler application/x-httpd-php .php
diff --git a/community/php7/pid_log.patch b/community/php7/pid_log.patch
index bc586db..19d98d9 100644
--- a/community/php7/pid_log.patch
+++ b/community/php7/pid_log.patch
_at_@ -14,7 +14,7 @@
  #ifdef HAVE_SYSLOG_H
  	if (!fpm_global_config.syslog_ident) {
 -		fpm_global_config.syslog_ident = strdup("php-fpm");
-+		fpm_global_config.syslog_ident = strdup("php-fpm7");
++		fpm_global_config.syslog_ident = strdup("php7-fpm");
  	}
  
  	if (fpm_global_config.syslog_facility < 0) {
_at_@ -23,7 +23,7 @@
  			spprintf(&tmp, 0, "%s/php-fpm.conf", PHP_SYSCONFDIR);
  		} else {
 -			spprintf(&tmp, 0, "%s/etc/php-fpm.conf", fpm_globals.prefix);
-+			spprintf(&tmp, 0, "%s/etc/php-fpm7.conf", fpm_globals.prefix);
++			spprintf(&tmp, 0, "%s/etc/php7/php-fpm.conf", fpm_globals.prefix);
  		}
  
  		if (!tmp) {
_at_@ -34,7 +34,7 @@
  ; Note: the default prefix is _at_EXPANDED_LOCALSTATEDIR@
  ; Default Value: none
 -;pid = run/php-fpm.pid
-+;pid = run/php-fpm7.pid
++;pid = run/php7-fpm.pid
  
  ; Error log file
  ; If it's set to "syslog", log is sent to syslogd instead of being written
_at_@ -71,6 +71,6 @@
  ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www_at_my.domain.com
  ;php_flag[display_errors] = off
 -;php_admin_value[error_log] = /var/log/fpm-php.www.log
-+;php_admin_value[error_log] = /var/log/php7/www.error.log
++;php_admin_value[error_log] = /var/log/php7/$pool.error.log
  ;php_admin_flag[log_errors] = on
  ;php_admin_value[memory_limit] = 32M
-- 
2.10.2
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Fri Nov 25 2016 - 16:54:48 GMT