From 81afb45f2912d8a6330ab0ff0c8dee85dd442373 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Tue, 27 Sep 2016 16:32:31 +0000
Subject: php: update to 5.6.26

---
 abs/core/php/PKGBUILD           | 81 ++++++++++++++++++-----------------------
 abs/core/php/__changelog        | 24 +++---------
 abs/core/php/linhes.ini         | 39 ++++++++++++++++++++
 abs/core/php/php-apache.install | 11 ++++++
 abs/core/php/php.ini.patch      | 51 ++++++--------------------
 abs/core/php/php.install        |  4 +-
 6 files changed, 104 insertions(+), 106 deletions(-)
 create mode 100644 abs/core/php/linhes.ini
 create mode 100644 abs/core/php/php-apache.install

diff --git a/abs/core/php/PKGBUILD b/abs/core/php/PKGBUILD
index 7ba2398..fc39bef 100644
--- a/abs/core/php/PKGBUILD
+++ b/abs/core/php/PKGBUILD
@@ -23,19 +23,18 @@ pkgname=('php'
          'php-sqlite'
          'php-tidy'
          'php-xsl')
-pkgver=5.6.17
+pkgver=5.6.26
 pkgrel=1
 arch=('i686' 'x86_64')
 license=('PHP')
 url='http://www.php.net'
 makedepends=('apache' 'c-client' 'postgresql-libs' 'libldap' 'postfix'
              'sqlite' 'unixodbc' 'net-snmp' 'libzip' 'enchant' 'file' 'freetds'
-             'libmcrypt' 'tidyhtml' 'aspell' 'libltdl' 'gd' 'icu'
+             'libmcrypt' 'tidy' 'aspell' 'libltdl' 'gd' 'icu'
              'curl' 'libxslt' 'openssl' 'db' 'gmp' 'systemd')
-checkdepends=('procps-ng')
 source=("http://www.php.net/distributions/${pkgbase}-${pkgver}.tar.xz"
         "http://www.php.net/distributions/${pkgbase}-${pkgver}.tar.xz.asc"
-        'php.ini.patch' 'apache.conf' 'php-fpm.conf.in.patch'
+        'php.ini.patch' 'linhes.ini' 'apache.conf' 'php-fpm.conf.in.patch'
         'logrotate.d.php-fpm' 'php-fpm.service' 'php-fpm.tmpfiles')
 validpgpkeys=('6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3'
               '0BD78B5F97500D450838F95DFE857D9A90D90EC1')
@@ -48,20 +47,25 @@ prepare() {
 	# 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
+
+    # Allow php-tidy to compile with tidy-html5
+    sed 's/buffio\.h/tidybuffio\.h/' -i ext/tidy/tidy.c
 }
 
 build() {
 	local _phpconfig="--srcdir=../${pkgbase}-${pkgver} \
 		--config-cache \
 		--prefix=/usr \
-		--sbindir=/usr/bin \
-		--sysconfdir=/etc/php \
+		--sysconfdir=/etc/${pkgbase} \
 		--localstatedir=/var \
+        --libdir=/usr/lib/${pkgbase} \
+        --datarootdir=/usr/share/${pkgbase} \
+        --datadir=/usr/share/${pkgbase} \
+        --program-suffix=${pkgbase#php} \
 		--with-layout=GNU \
-		--with-config-file-path=/etc/php \
-		--with-config-file-scan-dir=/etc/php/conf.d \
+		--with-config-file-path=/etc/${pkgbase} \
+		--with-config-file-scan-dir=/etc/${pkgbase}/conf.d \
 		--disable-rpath \
-		--mandir=/usr/share/man \
 		--without-pear \
 		"
 
@@ -100,7 +104,7 @@ build() {
 		--with-imap=shared \
 		--with-kerberos=/usr \
 		--with-jpeg-dir=/usr \
-		--with-vpx-dir=/usr \
+		--with-vpx-dir=no \
 		--with-ldap=shared \
 		--with-ldap-sasl \
 		--with-libzip \
@@ -112,6 +116,7 @@ build() {
 		--with-mysqli=shared,mysqlnd \
 		--with-openssl=shared \
 		--with-pcre-regex=/usr \
+        --with-pdo-dblib=shared,/usr \
 		--with-pdo-mysql=shared,mysqlnd \
 		--with-pdo-odbc=shared,unixODBC,/usr \
 		--with-pdo-pgsql=shared \
@@ -128,17 +133,15 @@ build() {
 		--with-zlib \
 		"
 
-	EXTENSION_DIR=/usr/lib/php/modules
-	export EXTENSION_DIR
-	PEAR_INSTALLDIR=/usr/share/pear
-	export PEAR_INSTALLDIR
+    export EXTENSION_DIR=/usr/lib/${pkgbase}/modules
+    export PEAR_INSTALLDIR=/usr/share/${pkgbase}/pear
 
 	cd ${srcdir}/${pkgbase}-${pkgver}
 
 	# php
-	mkdir ${srcdir}/build-php
+	mkdir -p ${srcdir}/build-php
 	cd ${srcdir}/build-php
-	ln -s ../${pkgbase}-${pkgver}/configure
+	ln -sf ../${pkgbase}-${pkgver}/configure
 	./configure ${_phpconfig} \
 		--disable-cgi \
 		--with-readline \
@@ -148,7 +151,7 @@ build() {
 
 	# cgi and fcgi
 	# reuse the previous run; this will save us a lot of time
-	cp -a ${srcdir}/build-php ${srcdir}/build-cgi
+	cp -Ta ${srcdir}/build-php ${srcdir}/build-cgi
 	cd ${srcdir}/build-cgi
 	./configure ${_phpconfig} \
 		--disable-cli \
@@ -157,7 +160,7 @@ build() {
 	make
 
 	# apache
-	cp -a ${srcdir}/build-php ${srcdir}/build-apache
+	cp -Ta ${srcdir}/build-php ${srcdir}/build-apache
 	cd ${srcdir}/build-apache
 	./configure ${_phpconfig} \
 		--disable-cli \
@@ -166,7 +169,7 @@ build() {
 	make
 
 	# fpm
-	cp -a ${srcdir}/build-php ${srcdir}/build-fpm
+	cp -Ta ${srcdir}/build-php ${srcdir}/build-fpm
 	cd ${srcdir}/build-fpm
 	./configure ${_phpconfig} \
 		--disable-cli \
@@ -177,7 +180,7 @@ build() {
 	make
 
 	# embed
-	cp -a ${srcdir}/build-php ${srcdir}/build-embed
+	cp -Ta ${srcdir}/build-php ${srcdir}/build-embed
 	cd ${srcdir}/build-embed
 	./configure ${_phpconfig} \
 		--disable-cli \
@@ -186,7 +189,7 @@ build() {
 	make
 
 	# phpdbg
-	cp -a ${srcdir}/build-php ${srcdir}/build-phpdbg
+	cp -Ta ${srcdir}/build-php ${srcdir}/build-phpdbg
 	cd ${srcdir}/build-phpdbg
 	./configure ${_phpconfig} \
 		--disable-cli \
@@ -197,7 +200,8 @@ build() {
 	make
 
 	# pear
-	cp -a ${srcdir}/build-php ${srcdir}/build-pear
+    sed -i 's#@$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) pear/install-pear-nozlib.phar -d#@$(top_builddir)/sapi/cli/php $(PEAR_INSTALL_FLAGS) pear/install-pear-nozlib.phar -p $(bindir)/php$(program_suffix) -d#' ${srcdir}/php-${pkgver}/pear/Makefile.frag
+	cp -Ta ${srcdir}/build-php ${srcdir}/build-pear
 	cd ${srcdir}/build-pear
 	./configure ${_phpconfig} \
 		--disable-cgi \
@@ -208,24 +212,6 @@ build() {
 	make
 }
 
-check() {
-	# tests on i686 fail
-	[[ $CARCH == 'i686' ]] && return
-
-	cd ${srcdir}/build-php
-
-	export REPORT_EXIT_STATUS=1
-	export NO_INTERACTION=1
-	export SKIP_ONLINE_TESTS=1
-	export SKIP_SLOW_TESTS=1
-
-	sapi/cli/php -n \
-		${srcdir}/${pkgbase}-${pkgver}/run-tests.php -n -P \
-		${srcdir}/${pkgbase}-${pkgver}/{Zend,ext/{date,pcre,spl,standard},sapi/cli}
-
-	echo
-}
-
 package_php() {
 	pkgdesc='An HTML-embedded scripting language'
 	depends=('pcre' 'libxml2' 'curl' 'libzip' 'php-gd' 'php-mcrypt')
@@ -234,19 +220,20 @@ package_php() {
 
 	cd ${srcdir}/build-php
 	make -j1 INSTALL_ROOT=${pkgdir} install
-	install -d -m755 ${pkgdir}/usr/share/pear
+
 	# install php.ini
 	install -D -m644 ${srcdir}/${pkgbase}-${pkgver}/php.ini-production ${pkgdir}/etc/php/php.ini
 	install -d -m755 ${pkgdir}/etc/php/conf.d/
+	install -D -m644 ${srcdir}/linhes.ini ${pkgdir}/etc/php/conf.d/linhes.ini
 
 	# remove static modules
 	rm -f ${pkgdir}/usr/lib/php/modules/*.a
 	# remove modules provided by sub packages
 	rm -f ${pkgdir}/usr/lib/php/modules/{enchant,gd,imap,intl,ldap,mcrypt,mssql,odbc,pdo_odbc,pgsql,pdo_pgsql,pspell,snmp,sqlite3,pdo_sqlite,tidy,xsl}.so
+
 	# remove empty directory
 	rmdir ${pkgdir}/usr/include/php/include
-	# fix broken link
-	ln -sf phar.phar ${pkgdir}/usr/bin/phar
+
 }
 
 package_php-cgi() {
@@ -260,6 +247,7 @@ package_php-apache() {
 	pkgdesc='Apache SAPI for PHP'
 	depends=('php' 'apache')
 	backup=('etc/httpd/conf/extra/php5_module.conf')
+    install='php-apache.install'
 
 	install -D -m755 ${srcdir}/build-apache/libs/libphp5.so ${pkgdir}/usr/lib/httpd/modules/libphp5.so
 	install -D -m644 ${srcdir}/apache.conf ${pkgdir}/etc/httpd/conf/extra/php5_module.conf
@@ -394,7 +382,7 @@ package_php-sqlite() {
 
 package_php-tidy() {
 	pkgdesc='tidy module for PHP'
-	depends=('php' 'tidyhtml')
+	depends=('php' 'tidy')
 
 	install -D -m755 ${srcdir}/build-php/modules/tidy.so ${pkgdir}/usr/lib/php/modules/tidy.so
 }
@@ -405,9 +393,10 @@ package_php-xsl() {
 
 	install -D -m755 ${srcdir}/build-php/modules/xsl.so ${pkgdir}/usr/lib/php/modules/xsl.so
 }
-md5sums=('5e080e4b7df5db24f1b64313f8114bd8'
+md5sums=('c51e9115263b4d63ef8f68935cefd7d4'
          'SKIP'
-         '943f882a55c0a6a7b3e5616c7dbbd7a8'
+         'd425c0a09f7b46814e2695471b38c529'
+         '4ecf586ef1597aa5eb977573954b5d21'
          'dec2cbaad64e3abf4f0ec70e1de4e8e9'
          '16b5e2e4da59f15bea4c2db78a7bc8dc'
          '25bc67ad828e8147a817410b68d8016c'
diff --git a/abs/core/php/__changelog b/abs/core/php/__changelog
index 69c2edd..7419a02 100644
--- a/abs/core/php/__changelog
+++ b/abs/core/php/__changelog
@@ -1,30 +1,16 @@
-PKGBUILD: package_php: add deps 'php-gd' 'php-mcrypt' since we have them in php.ini
+PKGBUILD: package_php: add deps 'php-gd' 'php-mcrypt' since we have them in linhes.ini
 PKGBUILD: package_php: comment out backup=('etc/php/php.ini')
-
-php.ini.patch: short_open_tags = On
+PKGBUILD: change dep tidyhtml to tidy
+PKGBUILD: add linhes.ini and put it in /etc/php/conf.d/
 php.ini.patch: open_basedir  commented out
-php.ini.patch: error_log = syslog  uncommented
-php.ini.patch: max_input_vars = 3000  uncomment and change to 3000
-php.ini.patch:
-==> check and make sure these are uncommented:
-    ==> "extension=ftp.so"
-    ==> "extension=gd.so"
-    ==> "extension=gettext.so"
-    ==> "extension=mcrypt.so"
-    ==> "extension=mysqli.so"
-    ==> "extension=mysql.so"
-    ==> "extension=openssl.so"
-    ==> "extension=sockets.so"
-    ==> "extension=zip.so"
-
 
 PKGBUILD: add php.install:
 post_upgrade & post_install
 if [ -f /etc/systemconfig ]
 then
     . /etc/systemconfig
-    if [ -f /etc/php/php.ini ]
+    if [ -f /etc/php/conf.d/linhes.ini ]
     then
-        sed -i 's|^.*date.timezone.*$|date.timezone='${timezone}'|' /etc/php/php.ini
+        sed -i 's|^.*date.timezone.*$|date.timezone='${timezone}'|' /etc/php/conf.d/linhes.ini
     fi
 fi
diff --git a/abs/core/php/linhes.ini b/abs/core/php/linhes.ini
new file mode 100644
index 0000000..a85a5ef
--- /dev/null
+++ b/abs/core/php/linhes.ini
@@ -0,0 +1,39 @@
+[Date]
+; Defines the default timezone used by the date functions
+; http://php.net/date.timezone
+;date.timezone =
+
+; Log errors to specified file. PHP's default behavior is to leave this value
+; empty.
+; http://php.net/error-log
+; Example:
+;error_log = php_errors.log
+; Log errors to syslog (Event Log on Windows).
+error_log = syslog
+
+; How many GET/POST/COOKIE input variables may be accepted
+max_input_vars = 3000
+
+; This directive determines whether or not PHP will recognize code between
+; <? and ?> tags as PHP source which should be processed as such. It is
+; generally recommended that <?php and ?> should be used and that this feature
+; should be disabled, as enabling it may result in issues when generating XML
+; documents, however this remains supported for backward compatibility reasons.
+; Note that this directive does not control the <?= shorthand tag, which can be
+; used regardless of this directive.
+; Default Value: On
+; Development Value: Off
+; Production Value: Off
+; http://php.net/short-open-tag
+short_open_tag = On
+
+extension=ftp.so
+extension=gd.so
+extension=gettext.so
+extension=mcrypt.so
+extension=mysql.so
+extension=mysqli.so
+extension=openssl.so
+extension=pdo_mysql.so
+extension=sockets.so
+extension=zip.so
diff --git a/abs/core/php/php-apache.install b/abs/core/php/php-apache.install
new file mode 100644
index 0000000..c9b6691
--- /dev/null
+++ b/abs/core/php/php-apache.install
@@ -0,0 +1,11 @@
+post_install() {
+    echo "You will need to add the following line after the existing LoadModule instructions in /etc/httpd/conf/httpd.conf :"
+    echo "LoadModule php5_module modules/libphp56.so"
+    echo
+    echo "Additionally, include this line at the end of /etc/httpd/conf/httpd.conf if you want .php files to be handled by php 5.6 :"
+    echo "Include conf/extra/php56_module.conf"
+    echo
+    echo "Be aware that ONLY A SINGLE PHP MODULE can be loaded into an Apache instance."
+    echo "If you want php 5 and php 7 to cohabitate, you'll have to use another method such as php-fpm, fcgi or cgi for the other PHP version."
+}
+
diff --git a/abs/core/php/php.ini.patch b/abs/core/php/php.ini.patch
index 719de92..4ce7364 100644
--- a/abs/core/php/php.ini.patch
+++ b/abs/core/php/php.ini.patch
@@ -1,47 +1,20 @@
---- php.ini-production.orig	2015-08-10 15:05:42.669490715 +0000
-+++ php.ini-production	2015-08-10 16:19:56.874447768 +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
- 
- ; Allow ASP-style <% %> tags.
- ; http://php.net/asp-tags
+--- php.ini-production	2015-01-21 01:40:37.000000000 +0100
++++ php.ini-production	2015-01-22 16:23:17.311890258 +0100
 @@ -295,7 +295,7 @@
  ; and below.  This directive makes most sense if used in a per-directory
  ; or per-virtualhost web server configuration file.
  ; http://php.net/open-basedir
 -;open_basedir =
-+;open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/
++;open_basedir = /srv/http/:/home/:/tmp/:/usr/share/php/pear/:/usr/share/webapps/
  
  ; This directive allows you to disable certain functions for security reasons.
  ; It receives a comma-delimited list of function names.
-@@ -386,7 +386,7 @@
- ;max_input_nesting_level = 64
- 
- ; How many GET/POST/COOKIE input variables may be accepted
--; max_input_vars = 1000
-+max_input_vars = 3000
- 
- ; Maximum amount of memory a script may consume (128MB)
- ; http://php.net/memory-limit
-@@ -571,7 +571,7 @@
- ; Example:
- ;error_log = php_errors.log
- ; Log errors to syslog (Event Log on Windows).
--;error_log = syslog
-+error_log = syslog
- 
- ;windows.show_crt_warning
- ; Default value: 0
 @@ -708,7 +708,7 @@
  ;;;;;;;;;;;;;;;;;;;;;;;;;
  
  ; UNIX: "/path1:/path2"
 -;include_path = ".:/php/includes"
-+include_path = ".:/usr/share/pear"
++include_path = ".:/usr/share/php/pear"
  ;
  ; Windows: "\path1;\path2"
  ;include_path = ".;c:\php\includes"
@@ -107,21 +80,21 @@
 +;extension=dba.so
 +;extension=enchant.so
 +;extension=exif.so
-+extension=ftp.so
-+extension=gd.so
++;extension=ftp.so
++;extension=gd.so
 +extension=gettext.so
 +;extension=gmp.so
 +;extension=iconv.so
 +;extension=imap.so
 +;extension=intl.so
 +;extension=ldap.so
-+extension=mcrypt.so
++;extension=mcrypt.so
 +;extension=mssql.so
-+extension=mysql.so
-+extension=mysqli.so
++;extension=mysql.so
++;extension=mysqli.so
 +;extension=odbc.so
 +;zend_extension=opcache.so
-+extension=openssl.so
++;extension=openssl.so
 +;extension=pdo_mysql.so
 +;extension=pdo_odbc.so
 +;extension=pdo_pgsql.so
@@ -133,7 +106,7 @@
 +;extension=shmop.so
 +;extension=snmp.so
 +;extension=soap.so
-+extension=sockets.so
++;extension=sockets.so
 +;extension=sqlite3.so
 +;extension=sysvmsg.so
 +;extension=sysvsem.so
@@ -141,7 +114,7 @@
 +;extension=tidy.so
 +;extension=xmlrpc.so
 +;extension=xsl.so
-+extension=zip.so
++;extension=zip.so
  
  ;;;;;;;;;;;;;;;;;;;
  ; Module Settings ;
diff --git a/abs/core/php/php.install b/abs/core/php/php.install
index 49fe408..4f4696b 100755
--- a/abs/core/php/php.install
+++ b/abs/core/php/php.install
@@ -2,9 +2,9 @@ post_install() {
     if [ -f /etc/systemconfig ]
     then
         . /etc/systemconfig
-        if [ -f /etc/php/php.ini ]
+        if [ -f /etc/php/conf.d/linhes.ini ]
         then
-            sed -i 's|^.*date.timezone.*=.*$|date.timezone='${timezone}'|' /etc/php/php.ini
+            sed -i 's|^.*date.timezone.*=.*$|date.timezone='${timezone}'|' /etc/php/conf.d/linhes.ini
         fi
     fi
 }
-- 
cgit v0.12

