aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2016-06-24 18:47:19 +0200
committerJakub Jirutka <jakub@jirutka.cz>2016-06-24 18:48:22 +0200
commit43ca60853048f2ae6eef58e4e10f237de5625ea4 (patch)
treec3234c63116d8a4e4bf40d66b18be52e5e70cd70
parent0dd1e47e73238e316bc62a94156d10fbc7d462d8 (diff)
downloadaports-43ca60853048f2ae6eef58e4e10f237de5625ea4.tar.bz2
aports-43ca60853048f2ae6eef58e4e10f237de5625ea4.tar.xz
testing/php7: refactor abuild, DRY it and fix minor issues
-rw-r--r--testing/php7/APKBUILD291
1 files changed, 115 insertions, 176 deletions
diff --git a/testing/php7/APKBUILD b/testing/php7/APKBUILD
index 3e1d859844..723279fafe 100644
--- a/testing/php7/APKBUILD
+++ b/testing/php7/APKBUILD
@@ -3,82 +3,20 @@
pkgname=php7
_pkgreal=php
pkgver=7.0.8
-pkgrel=0
+pkgrel=1
pkgdesc="The PHP language runtime engine - 7th branch"
url="http://www.php.net/"
arch="all"
license="PHP-3"
options="textrels"
depends="$pkgname-common"
-install=
makedepends="autoconf bison re2c apache2-dev libxml2-dev libxslt-dev libzip-dev bzip2-dev zlib-dev
xmlrpc-epi-dev aspell-dev enchant-dev expat-dev pcre-dev curl-dev gmp-dev icu-dev imap-dev
libical-dev openssl-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 libmbfl-dev gsoap-dev recode-dev
readline-dev mhash-dev paxmark gettext-dev
-"
-
-subpackages="$pkgname-dev $pkgname-doc
- $pkgname-apache2 $pkgname-phpdbg $pkgname-embed $pkgname-litespeed $pkgname-cgi $pkgname-fpm
- $pkgname-pear
- $pkgname-bcmath
- $pkgname-bz2
- $pkgname-calendar
- $pkgname-ctype
- $pkgname-curl:_curl
- $pkgname-dba
- $pkgname-dom
- $pkgname-enchant
- $pkgname-exif
- $pkgname-ftp
- $pkgname-gd
- $pkgname-gettext
- $pkgname-gmp
- $pkgname-iconv
- $pkgname-imap
- $pkgname-intl
- $pkgname-json
- $pkgname-ldap
- $pkgname-mbstring
- $pkgname-mcrypt
- $pkgname-mysqli
- $pkgname-mysqlnd
- $pkgname-odbc
- $pkgname-opcache
- $pkgname-openssl
- $pkgname-pcntl
- $pkgname-pdo
- $pkgname-pdo_dblib
- $pkgname-pdo_mysql
- $pkgname-pdo_odbc
- $pkgname-pdo_pgsql
- $pkgname-pdo_sqlite
- $pkgname-pgsql
- $pkgname-phar
- $pkgname-posix
- $pkgname-pspell
- $pkgname-readline
- $pkgname-session
- $pkgname-shmop
- $pkgname-snmp
- $pkgname-soap
- $pkgname-sockets
- $pkgname-sqlite3
- $pkgname-sysvmsg
- $pkgname-sysvsem
- $pkgname-sysvshm
- $pkgname-tidy
- $pkgname-wddx
- $pkgname-xml
- $pkgname-xmlreader
- $pkgname-xmlrpc
- $pkgname-xsl
- $pkgname-zip
- $pkgname-zlib
"
-subpackages="$subpackages $pkgname-common"
-
source="http://php.net/distributions/$_pkgreal-$pkgver.tar.bz2
$pkgname-fpm.initd
$pkgname-fpm.logrotate
@@ -88,18 +26,41 @@ source="http://php.net/distributions/$_pkgreal-$pkgver.tar.bz2
includedir.patch
pid_log.patch
"
+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
+ "
+_depends_dom="$pkgname-xml"
+_depends_mysqlnd="$pkgname-mysqli"
+_depends_phar="$pkgname"
+_depends_soap="$pkgname-xml"
+_depends_wddx="$pkgname-xml"
+_depends_xmlreader="$pkgname-dom"
+_depends_xmlrpc="$pkgname-xml"
+_depends_xsl="$pkgname-dom"
+
+subpackages="$pkgname-dev $pkgname-doc $pkgname-apache2 $pkgname-phpdbg $pkgname-embed
+ $pkgname-litespeed $pkgname-cgi $pkgname-fpm $pkgname-pear
+ "
+for _ext in $_exts; do
+ case "$_ext" in
+ *:*) subpackages="$subpackages $pkgname-$_ext";;
+ *) subpackages="$subpackages $pkgname-$_ext:_package_ext";;
+ esac
+done
+subpackages="$subpackages $pkgname-common"
_apiver="20151012"
-_builddir="$srcdir"/$_pkgreal-$pkgver
prepare() {
- cd "$_builddir"
- update_config_sub
- for i in $source; do
- case $i in
- *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
- esac
- done
+ cd "$builddir"
+
+ default_prepare || return 1
+ update_config_sub || return 1
+
local vapi=$(sed -n '/#define PHP_API_VERSION/{s/.* //;p}' main/php.h)
if [ "$vapi" != "$_apiver" ]; then
error "Upstreram API version is now $vapi. Expecting $_apiver"
@@ -180,16 +141,17 @@ _build() {
--enable-wddx=shared \
--enable-zip=shared --with-libzip=shared \
$@ || 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/php)
make || return 1
}
build() {
- cd "$_builddir"
+ cd "$builddir"
+
# phpdbg
_build --enable-phpdbg \
--enable-phpdbg \
- --enable-phpdbg-webhelper \
+ --enable-phpdbg-webhelper \
--enable-phpdbg-debug \
--disable-cgi \
--disable-cli \
@@ -213,14 +175,16 @@ build() {
}
package() {
- cd "$_builddir"
+ cd "$builddir"
+
make -j1 INSTALL_ROOT="$pkgdir" install || return 1
- install -Dm644 php.ini-production "$pkgdir"/etc/$pkgname/php.ini
- 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
+
+ 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
@@ -231,40 +195,50 @@ package() {
dev() {
default_dev
depends="$depends $pkgname $pkgname-pear"
- mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/lib/$pkgname
+
+ mkdir -p "$subpkgdir"/usr/bin \
+ "$subpkgdir"/usr/lib/$pkgname
+
mv "$pkgdir"/usr/bin/php-config7 "$pkgdir"/usr/bin/peardev \
- "$subpkgdir"/usr/bin/
+ "$subpkgdir"/usr/bin/ || return 1
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/
+ cp "$builddir"/$file "$subpkgdir"/usr/share/doc/$pkgname/ || return 1
done
}
apache2() {
pkgdesc="PHP Module for Apache2"
depends="$pkgname-common apache2"
- install -D -m755 "$_builddir"/sapi/apache2handler/mod_php7.so \
+
+ 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 || return 1
+ "$subpkgdir"/etc/apache2/conf.d/php7-module.conf
}
phpdbg() {
pkgdesc="Interactive PHP debugger"
depends="$pkgname-common"
- install -Dm755 "$_builddir"/sapi/phpdbg/phpdbg \
+
+ install -Dm755 "$builddir"/sapi/phpdbg/phpdbg \
"$subpkgdir"/usr/bin/phpdbg7
}
embed() {
pkgdesc="PHP Embedded Library"
depends="$pkgname-common"
+
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/libphp*.so "$subpkgdir"/usr/lib/
}
@@ -272,6 +246,7 @@ embed() {
litespeed() {
pkgdesc="PHP LiteSpeed SAPI"
depends="$pkgname-common"
+
mkdir -p "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/lsphp "$subpkgdir"/usr/bin/lsphp7
}
@@ -279,6 +254,7 @@ litespeed() {
cgi() {
pkgdesc="PHP Common Gateway Interface"
depends="$pkgname-common"
+
mkdir -p "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/bin/php-cgi7 "$subpkgdir"/usr/bin/
}
@@ -286,17 +262,24 @@ cgi() {
fpm() {
pkgdesc="PHP FastCGI Process Manager"
depends="$pkgname-common"
- mkdir -p "$subpkgdir"/etc/$pkgname "$subpkgdir"/usr
- mv "$pkgdir"/var "$subpkgdir"
- mkdir -p "$subpkgdir"/var/lib "$subpkgdir"/var/log/$pkgname
- mv "$pkgdir"/usr/share/$pkgname/fpm "$subpkgdir"/var/lib/$pkgname
- mv "$pkgdir"/usr/sbin "$subpkgdir"/usr/
- mv "$pkgdir"/etc/$pkgname/php-fpm* "$subpkgdir"/etc/$pkgname
- for file in php-fpm.conf php-fpm.d/www.conf; do
+
+ 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
+
+ local file; for file in php-fpm.conf php-fpm.d/www.conf; do
mv "$subpkgdir"/etc/$pkgname/$file.default \
- "$subpkgdir"/etc/$pkgname/$file
+ "$subpkgdir"/etc/$pkgname/$file || return 1
done
- install -D -m755 "$srcdir"/$pkgname-fpm.initd "$subpkgdir"/etc/init.d/php-fpm7
+
+ install -D -m755 "$srcdir"/$pkgname-fpm.initd "$subpkgdir"/etc/init.d/php-fpm7 || return 1
install -D -m755 "$srcdir"/$pkgname-fpm.logrotate "$subpkgdir"/etc/logrotate.d/php-fpm7
}
@@ -304,104 +287,60 @@ pear() {
arch="noarch"
pkgdesc="PHP Extension and Application Repository"
depends="$pkgname $pkgname-xml"
- mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/etc/$pkgname
- for file in phpize7 pecl pear; do
+
+ 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"/etc/$pkgname/pear.conf \
- "$subpkgdir"/etc/$pkgname/ || return 1
- mv "$pkgdir"/usr/share \
- "$subpkgdir"/usr/ || return 1
+ mv "$pkgdir"/etc/$pkgname/pear.conf "$subpkgdir"/etc/$pkgname/ || return 1
+ mv "$pkgdir"/usr/share "$subpkgdir"/usr/
}
common() {
arch="noarch"
pkgdesc="$pkgdesc (common config)"
+
mkdir -p "$subpkgdir"/usr
- mv "$pkgdir"/usr/lib "$subpkgdir"/usr/
- mv "$pkgdir"/etc "$subpkgdir"/
+ mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ || return 1
+ mv "$pkgdir"/etc "$subpkgdir"/ || return 1
+
mkdir "$subpkgdir"/etc/$pkgname/conf.d
}
-_mv_ext() {
- local ext=$1
- local elo=00
- local prefix=
- pkgdesc="PHP7 extension: $ext"
+phar() {
+ _package_ext || return 1
+ mkdir -p "$subpkgdir"/usr/bin
+ mv "$pkgdir"/usr/bin/phar* "$subpkgdir"/usr/bin/
+}
+
+_package_ext() {
+ local extname="${subpkgname#$pkgname-}"
+ local extdepends="$(eval "echo \$_depends_$extname")"
+ pkgdesc="PHP7 extension: $extname"
+ depends="$depends $extdepends"
+
+ case "$extname" in
+ pdo_*) depends="$depends $pkgname-pdo"
+ esac
# extension dependencies and loading order
- if [ -n "${2-}" ]; then
- depends=$2
- elo=01
- fi
+ local elo=00
+ [ -z "$extdepends" ] || elo=01
# extension prefix
- [ "$1" = "opcache" ] && prefix="zend_"
+ local prefix=
+ [ "$extname" != "opcache" ] || prefix="zend_"
- mkdir -p "$subpkgdir"/usr/lib/$pkgname/modules "$subpkgdir"/etc/$pkgname/conf.d
- mv "$pkgdir"/usr/lib/$pkgname/modules/${ext}.so \
+ mkdir -p "$subpkgdir"/usr/lib/$pkgname/modules \
+ "$subpkgdir"/etc/$pkgname/conf.d
+ mv "$pkgdir"/usr/lib/$pkgname/modules/$extname.so \
"$subpkgdir"/usr/lib/$pkgname/modules/ || return 1
- echo "${prefix}extension=${ext}.so" > "$subpkgdir"/etc/$pkgname/conf.d/${elo}_${ext}.ini
-}
-bcmath() { _mv_ext bcmath; }
-bz2() { _mv_ext bz2; }
-calendar() { _mv_ext calendar; }
-ctype() { _mv_ext ctype; }
-_curl() { _mv_ext curl; }
-dba() { _mv_ext dba; }
-dom() { _mv_ext dom $pkgname-xml; }
-enchant() { _mv_ext enchant; }
-exif() { _mv_ext exif; }
-ftp() { _mv_ext ftp; }
-gd() { _mv_ext gd; }
-gettext() { _mv_ext gettext; }
-gmp() { _mv_ext gmp; }
-iconv() { _mv_ext iconv; }
-imap() { _mv_ext imap; }
-intl() { _mv_ext intl; }
-json() { _mv_ext json; }
-ldap() { _mv_ext ldap; }
-mbstring() { _mv_ext mbstring; }
-mcrypt() { _mv_ext mcrypt; }
-mysqli() { _mv_ext mysqli; }
-mysqlnd() { _mv_ext mysqlnd $pkgname-mysqli; }
-odbc() { _mv_ext odbc; }
-opcache() { _mv_ext opcache; }
-openssl() { _mv_ext openssl; }
-pcntl() { _mv_ext pcntl; }
-pdo() { _mv_ext pdo; }
-pdo_dblib() { _mv_ext pdo_dblib $pkgname-pdo; }
-pdo_mysql() { _mv_ext pdo_mysql $pkgname-pdo; }
-pdo_odbc() { _mv_ext pdo_odbc $pkgname-pdo; }
-pdo_pgsql() { _mv_ext pdo_pgsql $pkgname-pdo; }
-pdo_sqlite() { _mv_ext pdo_sqlite $pkgname-pdo; }
-pgsql() { _mv_ext pgsql; }
-phar() {
- _mv_ext phar $pkgname
- mkdir -p "$subpkgdir"/usr/bin
- mv "$pkgdir"/usr/bin/phar* "$subpkgdir"/usr/bin/
- }
-posix() { _mv_ext posix; }
-pspell() { _mv_ext pspell; }
-readline() { _mv_ext readline; }
-session() { _mv_ext session; }
-shmop() { _mv_ext shmop; }
-snmp() { _mv_ext snmp; }
-soap() { _mv_ext soap $pkgname-xml; }
-sockets() { _mv_ext sockets; }
-sqlite3() { _mv_ext sqlite3; }
-sysvmsg() { _mv_ext sysvmsg; }
-sysvsem() { _mv_ext sysvsem; }
-sysvshm() { _mv_ext sysvshm; }
-tidy() { _mv_ext tidy; }
-wddx() { _mv_ext wddx $pkgname-xml; }
-xml() { _mv_ext xml; }
-xmlreader() { _mv_ext xmlreader $pkgname-dom; }
-xmlrpc() { _mv_ext xmlrpc $pkgname-xml; }
-xsl() { _mv_ext xsl $pkgname-dom; }
-zip() { _mv_ext zip; }
-zlib() { _mv_ext zlib; }
+ echo "${prefix}extension=$extname.so" \
+ > "$subpkgdir"/etc/$pkgname/conf.d/${elo}_${extname}.ini
+}
md5sums="d4f67b081a3c1b0b35f729ef8131cdda php-7.0.8.tar.bz2
a340f27e83ed4482d2fbb98658ef71cb php7-fpm.initd