Subject: [alpine-aports] [PATCH] community/php5: fix conflict with php7

From: Valery Kartel <[email-masked]>
Date: Thu, 30 Mar 2017 16:29:03 +0300

fix conflict if both php5-dev, php7-dev would be installed
fix php5-dev depends (add autoconf)
fix extension depends
add tidy extension
---
 community/php5/APKBUILD          | 42 ++++++++++++++++++++++++----------------
 community/php5/tidy-buffio.patch | 11 +++++++++++
 2 files changed, 36 insertions(+), 17 deletions(-)
 create mode 100644 community/php5/tidy-buffio.patch

diff --git a/community/php5/APKBUILD b/community/php5/APKBUILD
index c8a9289fe8..cdcbb8f86a 100644
--- a/community/php5/APKBUILD
+++ b/community/php5/APKBUILD
@@ -4,15 +4,16 @@
 # Maintainer: Matt Smith <[email-masked]>
 pkgname=php5
 pkgver=5.6.30
-pkgrel=0
+pkgrel=1
 pkgdesc="The PHP language runtime engine"
 url="http://www.php.net/"
 arch="all"
 license="PHP-3"
 depends="$pkgname-cli"
-depends_dev="$pkgname-cli pcre-dev"
+depends_dev="$pkgname-cli autoconf pcre-dev"
 install="$pkgname.post-upgrade"
 provides="php"
+replaces="php7"
 makedepends="
 	$depends_dev
 	apache2-dev
@@ -26,6 +27,7 @@ makedepends="
 	expat-dev
 	freetds-dev
 	freetype-dev
+	tidyhtml-dev
 	gdbm-dev
 	gettext-dev
 	gmp-dev
@@ -97,6 +99,7 @@ subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc $pkgname-common::noarch $pkg
 	$pkgname-sysvmsg
 	$pkgname-sysvsem
 	$pkgname-sysvshm
+	$pkgname-tidy
 	$pkgname-xml
 	$pkgname-xmlreader
 	$pkgname-xmlrpc
@@ -114,6 +117,7 @@ source="http://php.net/distributions/php-$pkgver.tar.bz2
 	php5-module.conf
 	php-install-pear-xml.patch
 	gd-iconv.patch
+	tidy-buffio.patch
 	"
 
 _apiver="20131106"
@@ -232,6 +236,7 @@ build() {
 		--enable-sysvsem=shared \
 		--enable-sysvshm=shared \
 		  --with-unixODBC=shared,/usr \
+		--with-tidy=shared \
 		--enable-xml=shared \
 		--enable-xmlreader=shared \
 		  --with-xmlrpc=shared \
@@ -311,6 +316,7 @@ package() {
 
 dev() {
 	default_dev || return 1
+	replaces="$replaces-dev"
 
 	mkdir -p "$subpkgdir"/usr/lib/php
 	mv "$pkgdir"/usr/lib/php/build \
@@ -321,6 +327,8 @@ dev() {
 doc() {
 	# man pages
 	default_doc || return 1
+	depends=
+	replaces=
 	cd "$srcdir"/php-$pkgver
 
 	# doc files
@@ -334,8 +342,8 @@ doc() {
 
 common() {
 	pkgdesc="PHP Common Files"
-	depends=""
-
+	depends=
+	replaces=
 	cd "$srcdir"/php-$pkgver
 
 	install -D -m644 php.ini-production "$subpkgdir"$_confdir/php.ini
@@ -348,6 +356,7 @@ common() {
 cgi() {
 	pkgdesc="PHP Common Gateway Interface (CGI)"
 	depends="$pkgname-common"
+	replaces="$replaces-cgi"
 	mkdir -p "$subpkgdir"/usr/bin
 	mv "$pkgdir"/usr/bin/php-cgi* "$subpkgdir"/usr/bin/
 }
@@ -365,6 +374,7 @@ cli() {
 fpm() {
 	pkgdesc="PHP FastCGI Process Manager (FPM)"
 	depends="$pkgname-common"
+	replaces=
 	mkdir -p "$subpkgdir"$_confdir/fpm.d
 	install -D -m755 "$srcdir"/build-fpm/sapi/fpm/php-fpm \
 		"$subpkgdir"/usr/bin/php-fpm || return 1
@@ -384,6 +394,7 @@ fpm() {
 apache2() {
 	pkgdesc="PHP Module for Apache2"
 	depends="$pkgname-common apache2"
+	replaces=
 	install -D -m755 "$srcdir"/build-apache2/libs/libphp5.so \
 		"$subpkgdir"/usr/lib/apache2/libphp5.so || return 1
 	install -D -m644 "$srcdir"/php5-module.conf \
@@ -393,6 +404,7 @@ apache2() {
 embed() {
 	pkgdesc="PHP Embed Library"
 	depends="$pkgname-common"
+	replaces=
 	mkdir -p "$subpkgdir"/usr/lib
 	mv "$pkgdir"/usr/lib/libphp5.so "$subpkgdir"/usr/lib/
 }
@@ -400,6 +412,7 @@ embed() {
 pear() {
 	pkgdesc="PHP Extension and Application Repository (PEAR)"
 	depends="$pkgname-cli $pkgname-xml"
+	replaces="$replaces-pear"
 	mkdir -p "$subpkgdir"/usr/share "$subpkgdir"$_confdir \
 		"$subpkgdir"/usr/bin
 	mv "$pkgdir"/usr/bin/pecl \
@@ -414,6 +427,8 @@ pear() {
 
 phpdbg() {
 	pkgdesc="Interactive PHP debugger"
+	depends="$pkgname-common"
+	replaces="$replaces-phpdbg"
 	mkdir -p "$subpkgdir"/usr/bin
 	mv "$pkgdir"/usr/bin/phpdbg* "$subpkgdir"/usr/bin/
 }
@@ -424,10 +439,11 @@ _mv_ext() {
 	pkgdesc="${ext} extension for PHP"
 
 	# extension dependencies
+	depends="$pkgname-common"
 	if [ -n "${2-}" ]; then
-		depends="${2-}"
+		depends="$depends ${2-}"
 	fi
-	depends="${pkgname} ${depends}"
+	replaces=
 
 	# work around dependency issue
 	# https://bugs.alpinelinux.org/issues/1848
@@ -493,6 +509,7 @@ sqlite3()	{ _mv_ext sqlite3; }
 sysvmsg()	{ _mv_ext sysvmsg; }
 sysvsem()	{ _mv_ext sysvsem; }
 sysvshm()	{ _mv_ext sysvshm; }
+tidy()		{ _mv_ext tidy; }
 xml()		{ _mv_ext xml; }
 xmlreader()	{ _mv_ext xmlreader $pkgname-dom; }
 xmlrpc()	{ _mv_ext xmlrpc $pkgname-xml; }
@@ -504,18 +521,9 @@ pdo_dblib()	{ _mv_ext pdo_dblib "$pkgname-pdo freetds"; }
 wddx()		{ _mv_ext wddx; }
 opcache()	{ _mv_ext opcache; }
 
-md5sums="67566191957b5fcac8567a5a9bbdced7  php-5.6.30.tar.bz2
-63b16caff0d7aa881a31a1e02f3080c3  php-fpm.initd
-67719f428f44ec004da18705cbabe2ee  php5-module.conf
-483bc0a85c50a9a9aedbe14a19ed4526  php-install-pear-xml.patch
-7200972a23adae799921c4ca20ff0074  gd-iconv.patch"
-sha256sums="a105c293fa1dbff118b5b0ca74029e6c461f8c78f49b337a2a98be9e32c27906  php-5.6.30.tar.bz2
-be9bfdab10a994fe553119b181be7015325a7618de454a58bdee06bcfb711454  php-fpm.initd
-ceec4d5b2a128c6a97e49830af604f0bb555bca1a86a9cd0366b828ba392257f  php5-module.conf
-f739ca427a1dd53a388bad0823565299c5d4a5796b1171b892884e4d7d099bab  php-install-pear-xml.patch
-98de37c650a36870a543225f6a6b81813ccd447a484f0881511be4eb6e901844  gd-iconv.patch"
 sha512sums="12734d786cca5767b8b8838affbe1c3d578dd179c8d5339653d905658562c5fdf39a88349213b1340f320320700a5378aed617447b6e15909019788a49ad2da0  php-5.6.30.tar.bz2
 1f5cb18f85a2e279e24344d993f5c51c7bfbcbecc0e9bfcf075bebd1b0b893e2ffb793d95a632c9333033597d4b4f74840bfd00520a6dc700444d1a054225da1  php-fpm.initd
 895e94c791bd82060ad820fef049d366a09c932097faa6b7b9a2c2e9e00a18cb7c0f9b128679c7659b404379266fd0f95dba5c0333f626194cf60f7bf6044102  php5-module.conf
 f1177cbf6b1f44402f421c3d317aab1a2a40d0b1209c11519c1158df337c8945f3a313d689c939768584f3e4edbe52e8bd6103fb6777462326a9d94e8ab1f505  php-install-pear-xml.patch
-6ecd0be2da1dc5b1d7512e46a2a5cd107a8b2a8c364efc9c624a7d6b2ab081685a329c94c22c970dc14c5c1115f702c512e97ae858da1bc69c6423323dbeeba2  gd-iconv.patch"
+6ecd0be2da1dc5b1d7512e46a2a5cd107a8b2a8c364efc9c624a7d6b2ab081685a329c94c22c970dc14c5c1115f702c512e97ae858da1bc69c6423323dbeeba2  gd-iconv.patch
+6894c9cba7752a3406e774d9efc0e058c37433493c1c20101e9563bf247c112157a67e306b06b9517b0422eca521f543d637a6cbd2cea7639e43f13d773b3d2b  tidy-buffio.patch"
diff --git a/community/php5/tidy-buffio.patch b/community/php5/tidy-buffio.patch
new file mode 100644
index 0000000000..c15f9540a4
--- /dev/null
+++ b/community/php5/tidy-buffio.patch
@@ -0,0 +1,11 @@
+--- a/ext/tidy/tidy.c
++++ b/ext/tidy/tidy.c
+@@ -31,7 +31,7 @@
+ #include "ext/standard/info.h"
+ 
+ #include "tidy.h"
+-#include "buffio.h"
++#include "tidybuffio.h"
+ 
+ /* compatibility with older versions of libtidy */
+ #ifndef TIDY_CALL
-- 
2.12.2

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Leonardo Arena <[email-masked]>
Date: Mon, 3 Apr 2017 14:26:37 +0200

Hi,

> +++ b/community/php5/APKBUILD

shouldn't be "conflict" here? We don't want to end up with a PHP
environment with binaries from different versions.

Looks like that only php-xdebug and php-couchbase try to build packages
for both PHP versions (and are currently broken because of this issue)
and needs to be updated to build either with PHP 5 or 7 or make two
separate packages.

Same thing with the other patch for php7.

Thoughts?

|_eo

---

From: Valery Kartel <[email-masked]>
Date: Mon, 3 Apr 2017 17:11:28 +0300

Hi, I made php-xdebug and php-couchbase separated for php5 and php7 in PR
#1061. But @jirutka wants to see it combined as it is. So, I made patches
to remove php5/7 conflict and combine it again in #1061

3 апр. 2017 г. 15:26 пользователь "Leonardo Arena" <[email-masked]>
написал:

> > -sha256sums="a105c293fa1dbff118b5b0ca74029e
> 6c461f8c78f49b337a2a98be9e32c27906  php-5.6.30.tar.bz2
> >  sha512sums="12734d786cca5767b8b8838affbe1c
> 3d578dd179c8d5339653d905658562c5fdf39a88349213b1340f32032070
> 0a5378aed617447b6e15909019788a49ad2da0  php-5.6.30.tar.bz2
> >  1f5cb18f85a2e279e24344d993f5c51c7bfbcbecc0e9bfcf075bebd1b0b8
> 93e2ffb793d95a632c9333033597d4b4f74840bfd00520a6dc700444d1a054225da1
> php-fpm.initd
> >  895e94c791bd82060ad820fef049d366a09c932097faa6b7b9a2c2e9e00a
> 18cb7c0f9b128679c7659b404379266fd0f95dba5c0333f626194cf60f7bf6044102
> php5-module.conf
> >  f1177cbf6b1f44402f421c3d317aab1a2a40d0b1209c11519c1158df337c
> 8945f3a313d689c939768584f3e4edbe52e8bd6103fb6777462326a9d94e8ab1f505
> > -6ecd0be2da1dc5b1d7512e46a2a5cd107a8b2a8c364efc9c624a7d6b2ab0
> 81685a329c94c22c970dc14c5c1115f702c512e97ae858da1bc69c6423323dbeeba2
> gd-iconv.patch"
> > +6ecd0be2da1dc5b1d7512e46a2a5cd107a8b2a8c364efc9c624a7d6b2ab0
> 81685a329c94c22c970dc14c5c1115f702c512e97ae858da1bc69c6423323dbeeba2
> gd-iconv.patch
> > +6894c9cba7752a3406e774d9efc0e058c37433493c1c20101e9563bf247c
> 112157a67e306b06b9517b0422eca521f543d637a6cbd2cea7639e43f13d773b3d2b
> tidy-buffio.patch"