From b90e9ef668828634480e31a3286b7e626b8a7bd1 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Wed, 16 Apr 2014 00:03:59 +0000
Subject: php: update to 5.5.11. refs #961

---
 abs/core/php/PKGBUILD              |  87 ++++++++++++----------
 abs/core/php/__changelog           |  22 +++---
 abs/core/php/logrotate.d.php-fpm   |   2 +-
 abs/core/php/php-fpm.conf.in.patch |  14 ++--
 abs/core/php/php-fpm.install       |   2 +-
 abs/core/php/php-fpm.service       |   4 +-
 abs/core/php/php.ini.patch         |  29 +++-----
 abs/core/php/rc.d.php-fpm          | 144 -------------------------------------
 8 files changed, 78 insertions(+), 226 deletions(-)
 mode change 100755 => 100644 abs/core/php/php.ini.patch
 delete mode 100644 abs/core/php/rc.d.php-fpm

diff --git a/abs/core/php/PKGBUILD b/abs/core/php/PKGBUILD
index 122c6ca..b1fad45 100644
--- a/abs/core/php/PKGBUILD
+++ b/abs/core/php/PKGBUILD
@@ -1,4 +1,4 @@
-# $Id: PKGBUILD 169306 2012-10-19 05:27:26Z pierre $
+# $Id$
 # Maintainer: Pierre Schmitz <pierre@archlinux.de>
 
 pkgbase=php
@@ -21,23 +21,36 @@ pkgname=('php'
          'php-sqlite'
          'php-tidy'
          'php-xsl')
-pkgver=5.4.8
+pkgver=5.5.11
 pkgrel=2
 arch=('i686' 'x86_64')
 license=('PHP')
 url='http://www.php.net'
-makedepends=('apache' 'imap' 'postgresql-libs' 'libldap' 'libvpx'
+makedepends=('apache' 'imap' 'postgresql-libs' 'libldap' 'postfix' 'libvpx'
              'sqlite' 'unixodbc' 'net-snmp' 'libzip' 'enchant' 'file' 'freetds'
              'libmcrypt' 'tidyhtml' 'aspell' 'libltdl' 'libpng' 'libjpeg' 'icu'
-             'curl' 'libxslt' 'openssl' 'bzip2' 'db' 'gmp' 'freetype2')
-source=("http://www.php.net/distributions/${pkgbase}-${pkgver}.tar.bz2"
-        'php.ini.patch' 'apache.conf' 'rc.d.php-fpm' 'php-fpm.conf.in.patch'
+             'curl' 'libxslt' 'openssl' 'bzip2' 'db' 'gmp' 'freetype2' 'systemd')
+source=("http://www.php.net/distributions/${pkgbase}-${pkgver}.tar.gz"
+        "http://www.php.net/distributions/${pkgbase}-${pkgver}.tar.gz.asc"
+        'php.ini.patch' 'apache.conf' 'php-fpm.conf.in.patch'
         'logrotate.d.php-fpm' 'php-fpm.service' 'php-fpm.tmpfiles')
 
+
+prepare() {
+	cd ${srcdir}/${pkgbase}-${pkgver}
+
+	patch -p0 -i ${srcdir}/php.ini.patch
+	patch -p0 -i ${srcdir}/php-fpm.conf.in.patch
+	# Just because our Apache 2.4 is configured with a threaded MPM by default does not mean we want to build a ZTS PHP.
+	# Let's supress this behaviour and build a SAPI that works fine with the prefork MPM.
+	sed '/APACHE_THREADED_MPM=/d' -i sapi/apache2handler/config.m4 -i configure
+}
+
 build() {
-	phpconfig="--srcdir=../${pkgbase}-${pkgver} \
+	local _phpconfig="--srcdir=../${pkgbase}-${pkgver} \
 		--config-cache \
 		--prefix=/usr \
+		--sbindir=/usr/bin \
 		--sysconfdir=/etc/php \
 		--localstatedir=/var \
 		--with-layout=GNU \
@@ -48,7 +61,7 @@ build() {
 		--without-pear \
 		"
 
-	phpextensions="--enable-bcmath=shared \
+	local _phpextensions="--enable-bcmath=shared \
 		--enable-calendar=shared \
 		--enable-dba=shared \
 		--enable-exif=shared \
@@ -56,6 +69,7 @@ build() {
 		--enable-gd-native-ttf \
 		--enable-intl=shared \
 		--enable-mbstring \
+		--enable-opcache \
 		--enable-phar=shared \
 		--enable-posix=shared \
 		--enable-shmop=shared \
@@ -69,6 +83,7 @@ build() {
 		--with-curl=shared \
 		--with-db4=/usr \
 		--with-enchant=shared,/usr \
+		--with-fpm-systemd \
 		--with-freetype-dir=/usr \
 		--with-gd=shared \
 		--with-gdbm \
@@ -85,7 +100,7 @@ build() {
 		--with-mcrypt=shared \
 		--with-mhash \
 		--with-mssql=shared \
-		--with-mysql-sock=/var/run/mysqld/mysqld.sock \
+		--with-mysql-sock=/run/mysqld/mysqld.sock \
 		--with-mysql=shared,mysqlnd \
 		--with-mysqli=shared,mysqlnd \
 		--with-openssl=shared \
@@ -113,86 +128,81 @@ build() {
 
 	cd ${srcdir}/${pkgbase}-${pkgver}
 
-	# adjust paths
-
-	patch -p0 -i ${srcdir}/php.ini.patch
-	patch -p0 -i ${srcdir}/php-fpm.conf.in.patch
-
 	# php
 	mkdir ${srcdir}/build-php
 	cd ${srcdir}/build-php
 	ln -s ../${pkgbase}-${pkgver}/configure
-	./configure ${phpconfig} \
+	./configure ${_phpconfig} \
 		--disable-cgi \
 		--with-readline \
 		--enable-pcntl \
-		${phpextensions}
+		${_phpextensions}
 	make
 
 	# cgi and fcgi
 	# reuse the previous run; this will save us a lot of time
 	cp -a ${srcdir}/build-php ${srcdir}/build-cgi
 	cd ${srcdir}/build-cgi
-	./configure ${phpconfig} \
+	./configure ${_phpconfig} \
 		--disable-cli \
 		--enable-cgi \
-		${phpextensions}
+		${_phpextensions}
 	make
 
 	# apache
 	cp -a ${srcdir}/build-php ${srcdir}/build-apache
 	cd ${srcdir}/build-apache
-	./configure ${phpconfig} \
+	./configure ${_phpconfig} \
 		--disable-cli \
 		--with-apxs2 \
-		${phpextensions}
+		${_phpextensions}
 	make
 
 	# fpm
 	cp -a ${srcdir}/build-php ${srcdir}/build-fpm
 	cd ${srcdir}/build-fpm
-	./configure ${phpconfig} \
+	./configure ${_phpconfig} \
 		--disable-cli \
 		--enable-fpm \
 		--with-fpm-user=http \
 		--with-fpm-group=http \
-		${phpextensions}
+		${_phpextensions}
 	make
 
 	# embed
 	cp -a ${srcdir}/build-php ${srcdir}/build-embed
 	cd ${srcdir}/build-embed
-	./configure ${phpconfig} \
+	./configure ${_phpconfig} \
 		--disable-cli \
 		--enable-embed=shared \
-		${phpextensions}
+		${_phpextensions}
 	make
 
 	# pear
 	cp -a ${srcdir}/build-php ${srcdir}/build-pear
 	cd ${srcdir}/build-pear
-	./configure ${phpconfig} \
+	./configure ${_phpconfig} \
 		--disable-cgi \
 		--with-readline \
 		--enable-pcntl \
 		--with-pear \
-		${phpextensions}
+		${_phpextensions}
 	make
 }
 
 # check() {
 # 	cd ${srcdir}/build-php
+# 	export SNMP_TIMEOUT=1
+# 	export SNMP_RETRIES=0
+# 	export NO_INTERACTION=1
 # 	make test
+# 	echo
 # }
 
 package_php() {
 	pkgdesc='An HTML-embedded scripting language'
 	depends=('pcre' 'libxml2' 'bzip2' 'curl' 'php-gd' 'php-mcrypt')
-	replaces=('php-fileinfo' 'php-gmp' 'php-curl')
-	provides=('php-fileinfo' 'php-gmp' 'php-curl')
-	conflicts=('php-fileinfo' 'php-gmp' 'php-curl')
 	backup=('etc/php/php.ini')
-	install='php.install'
 
 	cd ${srcdir}/build-php
 	make -j1 INSTALL_ROOT=${pkgdir} install
@@ -227,14 +237,13 @@ package_php-apache() {
 
 package_php-fpm() {
 	pkgdesc='FastCGI Process Manager for PHP'
-	depends=('php')
+	depends=('php' 'systemd')
 	backup=('etc/php/php-fpm.conf')
 	install='php-fpm.install'
 
-	install -D -m755 ${srcdir}/build-fpm/sapi/fpm/php-fpm ${pkgdir}/usr/sbin/php-fpm
+	install -D -m755 ${srcdir}/build-fpm/sapi/fpm/php-fpm ${pkgdir}/usr/bin/php-fpm
 	install -D -m644 ${srcdir}/build-fpm/sapi/fpm/php-fpm.8 ${pkgdir}/usr/share/man/man8/php-fpm.8
 	install -D -m644 ${srcdir}/build-fpm/sapi/fpm/php-fpm.conf ${pkgdir}/etc/php/php-fpm.conf
-	install -D -m755 ${srcdir}/rc.d.php-fpm ${pkgdir}/etc/rc.d/php-fpm
 	install -D -m644 ${srcdir}/logrotate.d.php-fpm ${pkgdir}/etc/logrotate.d/php-fpm
 	install -d -m755 ${pkgdir}/etc/php/fpm.d
 	install -D -m644 ${srcdir}/php-fpm.tmpfiles ${pkgdir}/usr/lib/tmpfiles.d/php-fpm.conf
@@ -339,11 +348,11 @@ package_php-xsl() {
 	pkgdesc='xsl module for PHP'
 	install -D -m755 ${srcdir}/build-php/modules/xsl.so ${pkgdir}/usr/lib/php/modules/xsl.so
 }
-md5sums=('bb8c816a9299be8995255ef70c63b800'
-         'f62b49e6da4a09a6dd307f82c89e2a43'
+md5sums=('9156fcd4b254cbfa9a7535f931da29d5'
+         'SKIP'
+         '2882de6eb210c826df0872b3ce606765'
          'dec2cbaad64e3abf4f0ec70e1de4e8e9'
-         '3cfde0cc4ed09b55f1ce531437a4eb88'
-         '5c1f4c967b66ce3eaf819b46951dcbf5'
-         'f56b5bb7e93c802ae8519182fbea3387'
-         'f8b206cb8fecb05cb1ded8bee45633ff'
+         '9f8263996836e27f5be1483e86ac2e33'
+         'e036c721e5ad927cd1613c7475a58b3a'
+         'cc2940f5312ba42e7aa1ddfab74b84c4'
          'c60343df74f8e1afb13b084d5c0e47ed')
diff --git a/abs/core/php/__changelog b/abs/core/php/__changelog
index 5e9fead..26c0ff4 100644
--- a/abs/core/php/__changelog
+++ b/abs/core/php/__changelog
@@ -1,26 +1,22 @@
-removed postfix
-openbase_dir  commented out
-short_tags On
-
+PKGBUILD: package_php: add deps 'php-gd' 'php-mcrypt' since we have them in php.ini
+php.ini.patch: short_open_tags = On
+php.ini.patch: open_basedir  commented out
+php.ini.patch: error_log = syslog uncommented
+pho.ini.patch:
 ==> check and make sure these are uncommented:
-    ==> "extension=mysql.so"
+    ==> "extension=ftp.so"
     ==> "extension=gd.so"
     ==> "extension=gettext.so"
     ==> "extension=mcrypt.so"
     ==> "extension=mysqli.so"
-    ==> "extension=session.so"
-    ==> "extension=sockets.so"
+    ==> "extension=mysql.so"
     ==> "extension=openssl.so"
-    ==> "extension=ftp.so"
+    ==> "extension=sockets.so"
     ==> "extension=zip.so"
 
-==> add php-gd and php-mcrypt as depends of php since we have them in php.ini
 
-syslog.error on
-
-php.install
+PKGBUILD: add php.install:
 post_upgrade & post_install
-
 if [ -f /etc/systemconfig ]
 then
     . /etc/systemconfig
diff --git a/abs/core/php/logrotate.d.php-fpm b/abs/core/php/logrotate.d.php-fpm
index ac2d92a..1895c5b 100644
--- a/abs/core/php/logrotate.d.php-fpm
+++ b/abs/core/php/logrotate.d.php-fpm
@@ -3,6 +3,6 @@
 	notifempty
 	delaycompress
 	postrotate
-		kill -USR1 `cat /run/php-fpm/php-fpm.pid 2>/dev/null` 2>/dev/null || true
+		systemctl reload php-fpm.service || true
 	endscript
 }
diff --git a/abs/core/php/php-fpm.conf.in.patch b/abs/core/php/php-fpm.conf.in.patch
index d618fca..4bcdb73 100644
--- a/abs/core/php/php-fpm.conf.in.patch
+++ b/abs/core/php/php-fpm.conf.in.patch
@@ -1,8 +1,8 @@
---- sapi/fpm/php-fpm.conf.in	2012-08-15 06:26:05.000000000 +0200
-+++ sapi/fpm/php-fpm.conf.in	2012-08-16 14:17:41.809663595 +0200
+--- sapi/fpm/php-fpm.conf.in	2013-11-12 15:17:27.000000000 +0100
++++ sapi/fpm/php-fpm.conf.in	2013-11-12 17:27:21.283279538 +0100
 @@ -12,7 +12,7 @@
  ; Relative path can also be used. They will be prefixed by:
- ;  - the global prefix if it's been set (-p arguement)
+ ;  - the global prefix if it's been set (-p argument)
  ;  - @prefix@ otherwise
 -;include=etc/fpm.d/*.conf
 +;include=/etc/php/fpm.d/*.conf
@@ -18,7 +18,7 @@
  
  ; Error log file
  ; If it's set to "syslog", log is sent to syslogd instead of being written
-@@ -148,7 +148,8 @@
+@@ -156,7 +156,8 @@
  ;                            specific port;
  ;   '/path/to/unix/socket' - to listen on a unix socket.
  ; Note: This value is mandatory.
@@ -27,8 +27,8 @@
 +listen = /run/php-fpm/php-fpm.sock
  
  ; Set listen(2) backlog.
- ; Default Value: 128 (-1 on FreeBSD and OpenBSD)
-@@ -159,9 +160,9 @@
+ ; Default Value: 65535 (-1 on FreeBSD and OpenBSD)
+@@ -167,9 +168,9 @@
  ; BSD-derived systems allow connections regardless of permissions. 
  ; Default Values: user and group are set as the running user
  ;                 mode is set to 0666
@@ -41,7 +41,7 @@
   
  ; List of ipv4 addresses of FastCGI clients which are allowed to connect.
  ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
-@@ -458,7 +459,7 @@
+@@ -466,7 +467,7 @@
  ; Chdir to this directory at the start.
  ; Note: relative path can be used.
  ; Default Value: current directory or / when chroot
diff --git a/abs/core/php/php-fpm.install b/abs/core/php/php-fpm.install
index 41fc37c..3572a76 100644
--- a/abs/core/php/php-fpm.install
+++ b/abs/core/php/php-fpm.install
@@ -1,6 +1,6 @@
 post_install() {
 	if [[ ! -d run/php-fpm ]]; then
-		usr/bin/systemd-tmpfiles --create usr/lib/tmpfiles.d/php-fpm.conf
+		usr/bin/systemd-tmpfiles --create php-fpm.conf
 	fi
 }
 
diff --git a/abs/core/php/php-fpm.service b/abs/core/php/php-fpm.service
index fc5ead6..6e2faaf 100644
--- a/abs/core/php/php-fpm.service
+++ b/abs/core/php/php-fpm.service
@@ -3,10 +3,10 @@ Description=The PHP FastCGI Process Manager
 After=syslog.target network.target
 
 [Service]
-Type=forking
+Type=notify
 PIDFile=/run/php-fpm/php-fpm.pid
 PrivateTmp=true
-ExecStart=/usr/sbin/php-fpm --daemonize --pid /run/php-fpm/php-fpm.pid
+ExecStart=/usr/bin/php-fpm --nodaemonize --pid /run/php-fpm/php-fpm.pid
 ExecReload=/bin/kill -USR2 $MAINPID
 
 [Install]
diff --git a/abs/core/php/php.ini.patch b/abs/core/php/php.ini.patch
old mode 100755
new mode 100644
index ed17c00..c27db10
--- a/abs/core/php/php.ini.patch
+++ b/abs/core/php/php.ini.patch
@@ -1,24 +1,15 @@
---- php.ini-production.orig	2012-11-01 00:08:25.365008573 +0000
-+++ php.ini-production	2012-11-01 00:13:48.698332172 +0000
-@@ -208,7 +208,7 @@
+--- php.ini-production.orig	2014-04-15 22:32:53.462733214 +0000
++++ php.ini-production	2014-04-15 23:16:41.483582108 +0000
+@@ -199,7 +199,7 @@
  ; Development Value: Off
  ; Production Value: Off
  ; http://php.net/short-open-tag
 -short_open_tag = Off
-+short_open_tag = On 
++short_open_tag = On
  
  ; Allow ASP-style <% %> tags.
  ; http://php.net/asp-tags
-@@ -305,7 +305,7 @@
- ; or per-virtualhost web server configuration file. This directive is
- ; *NOT* affected by whether Safe Mode is turned On or Off.
- ; http://php.net/open-basedir
--;open_basedir =
-+;open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/
- 
- ; This directive allows you to disable certain functions for security reasons.
- ; It receives a comma-delimited list of function names. This directive is
-@@ -583,7 +583,7 @@
+@@ -574,7 +574,7 @@
  ; Example:
  ;error_log = php_errors.log
  ; Log errors to syslog (Event Log on NT, not valid in Windows 95).
@@ -27,7 +18,7 @@
  
  ;windows.show_crt_warning
  ; Default value: 0
-@@ -702,7 +702,7 @@
+@@ -693,7 +693,7 @@
  ;;;;;;;;;;;;;;;;;;;;;;;;;
  
  ; UNIX: "/path1:/path2"
@@ -36,16 +27,16 @@
  ;
  ; Windows: "\path1;\path2"
  ;include_path = ".;c:\php\includes"
-@@ -725,7 +725,7 @@
+@@ -716,7 +716,7 @@
  
  ; Directory in which the loadable extensions (modules) reside.
  ; http://php.net/extension-dir
 -; extension_dir = "./"
-+extension_dir = "/usr/lib/php/modules/"
++extension_dir = "/usr/lib/php/modules"
  ; On windows:
  ; extension_dir = "ext"
  
-@@ -859,51 +859,47 @@
+@@ -854,50 +854,48 @@
  ; If you only provide the name of the extension, PHP will look for it in its
  ; default extension directory.
  ;
@@ -93,7 +84,6 @@
 -;extension=php_tidy.dll
 -;extension=php_xmlrpc.dll
 -;extension=php_xsl.dll
--;extension=php_zip.dll
 +;extension=bcmath.so
 +;extension=bz2.so
 +;extension=calendar.so
@@ -114,6 +104,7 @@
 +extension=mysqli.so
 +extension=mysql.so
 +;extension=odbc.so
++;zend_extension=opcache.so
 +extension=openssl.so
 +;extension=pdo_mysql.so
 +;extension=pdo_odbc.so
diff --git a/abs/core/php/rc.d.php-fpm b/abs/core/php/rc.d.php-fpm
deleted file mode 100644
index a8cb9ec..0000000
--- a/abs/core/php/rc.d.php-fpm
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/bin/bash
-
-. /etc/rc.conf
-. /etc/rc.d/functions
-
-
-wait_for_pid () {
-	try=0
-	while test $try -lt 35 ; do
-		case "$1" in
-			'created')
-			if [ -f "$2" ] ; then
-				try=''
-				break
-			fi
-			;;
-			'removed')
-			if [ ! -f "$2" ] ; then
-				try=''
-				break
-			fi
-			;;
-		esac
-
-		stat_append '.'
-		try=`expr $try + 1`
-		sleep 1
-	done
-}
-
-test_config() {
-	stat_busy 'Checking configuration'
-	if [ $(id -u) -ne 0 ]; then
-		stat_append '(This script must be run as root)'
-		stat_die
-	fi
-
-	if [ ! -r /etc/php/php-fpm.conf ]; then
-		stat_append '(/etc/php/php-fpm.conf not found)'
-		stat_die
-	fi
-
-	local test=$(/usr/sbin/php-fpm -t 2>&1)
-	if [ $? -gt 0 ]; then
-		stat_append '(error in /etc/php/php-fpm.conf)'
-		stat_die
-	elif echo $test | grep -qi 'error'; then
-		stat_append '(error in /etc/php/php.ini)'
-		stat_die
-	fi
-
-	stat_done
-}
-
-case "$1" in
-	start)
-		test_config
-		stat_busy 'Starting php-fpm'
-
-		/usr/sbin/php-fpm --daemonize --pid /run/php-fpm/php-fpm.pid
-
-		if [ "$?" != 0 ] ; then
-			stat_fail
-			exit 1
-		fi
-
-		wait_for_pid created /run/php-fpm/php-fpm.pid
-
-		if [ -n "$try" ] ; then
-			stat_fail
-			exit 1
-		else
-			add_daemon php-fpm
-			stat_done
-		fi
-	;;
-
-	stop)
-		test_config
-		stat_busy 'Gracefully shutting down php-fpm'
-
-		if [ ! -r /run/php-fpm/php-fpm.pid ] ; then
-			stat_fail
-			exit 1
-		fi
-
-		kill -QUIT `cat /run/php-fpm/php-fpm.pid`
-
-		wait_for_pid removed /run/php-fpm/php-fpm.pid
-
-		if [ -n "$try" ] ; then
-			stat_fail
-			exit 1
-		else
-			rm_daemon php-fpm
-			stat_done
-		fi
-	;;
-
-	force-quit)
-		stat_busy 'Terminating php-fpm'
-
-		if [ ! -r /run/php-fpm/php-fpm.pid ] ; then
-			stat_fail
-			exit 1
-		fi
-
-		kill -TERM `cat /run/php-fpm/php-fpm.pid`
-
-		wait_for_pid removed /run/php-fpm/php-fpm.pid
-
-		if [ -n "$try" ] ; then
-			stat_fail
-			exit 1
-		else
-			rm_daemon php-fpm
-			stat_done
-		fi
-	;;
-
-	restart)
-		$0 stop
-		$0 start
-	;;
-
-	reload)
-		test_config
-		stat_busy 'Reload service php-fpm'
-
-		if [ ! -r /run/php-fpm/php-fpm.pid ] ; then
-			stat_fail
-			exit 1
-		fi
-
-		kill -USR2 `cat /run/php-fpm/php-fpm.pid`
-		stat_done
-	;;
-
-	*)
-		echo "usage: $0 {start|stop|force-quit|restart|reload|logrotate}"
-		exit 1
-	;;
-
-esac
-- 
cgit v0.12

