diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-05-01 18:05:53 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-05-02 01:04:52 +0200 |
commit | 89cd70e777e2328a6ec7f49b36709ffa9f0d66b2 (patch) | |
tree | b7884e4f3daed94f9eec50e8162e45218b55910e /community/php7/APKBUILD | |
parent | 63010da997e7a37df323a7d0343453fde63600ed (diff) | |
download | aports-89cd70e777e2328a6ec7f49b36709ffa9f0d66b2.tar.bz2 aports-89cd70e777e2328a6ec7f49b36709ffa9f0d66b2.tar.xz |
community/php7: cosmetic changes
Some of the changes are based on https://github.com/alpinelinux/aports/pull/893
by vakartel.
Diffstat (limited to 'community/php7/APKBUILD')
-rw-r--r-- | community/php7/APKBUILD | 376 |
1 files changed, 241 insertions, 135 deletions
diff --git a/community/php7/APKBUILD b/community/php7/APKBUILD index f020f70ae1..2fcb595c3e 100644 --- a/community/php7/APKBUILD +++ b/community/php7/APKBUILD @@ -21,24 +21,62 @@ pkgname=php7 _pkgreal=php pkgver=7.1.4 pkgrel=0 +_apiver=20160303 _suffix=${pkgname#php} pkgdesc="The PHP$_suffix language runtime engine" url="http://www.php.net/" arch="all" license="PHP-3 BSD LGPL2 MIT Zend" -options="" depends="$pkgname-common" -depends_mysqlnd="$pkgname-openssl" +# Most dependencies between extensions is auto-discovered (see _extension()). +_depends_mysqlnd="$pkgname-openssl" +_depends_pdo_mysql="$pkgname-pdo $pkgname-mysqlnd" +_depends_phar="$pkgname" # openssl is actually transitive dependency here, but we need to because of # load index based on number of dependencies. -depends_mysqli="$pkgname-mysqlnd $pkgname-openssl" -depends_pdo_mysql="$pkgname-pdo $pkgname-mysqlnd" -depends_phar="$pkgname" -makedepends="autoconf bison re2c apache2-dev libxml2-dev libxslt-dev libzip-dev bzip2-dev zlib-dev - aspell-dev enchant-dev pcre-dev curl-dev gmp-dev icu-dev imap-dev - libical-dev libressl-dev openldap-dev net-snmp-dev db-dev krb5-dev gdbm-dev sqlite-dev - freetds-dev postgresql-dev unixodbc-dev freetype-dev tidyhtml-dev libxpm-dev - libpng-dev libwebp-dev libjpeg-turbo-dev libmcrypt-dev recode-dev libedit-dev gettext-dev +_depends_mysqli="$pkgname-mysqlnd $pkgname-openssl" +makedepends=" + autoconf + apache2-dev + aspell-dev + bison + bzip2-dev + curl-dev + db-dev + enchant-dev + freetds-dev + freetype-dev + gdbm-dev + gettext-dev + gmp-dev + icu-dev + imap-dev + krb5-dev + libedit-dev + libical-dev + libjpeg-turbo-dev + libmcrypt-dev + libpng-dev + libressl-dev + libwebp-dev + libxml2-dev + libxpm-dev + libxslt-dev + libzip-dev + net-snmp-dev + openldap-dev + pcre-dev + postgresql-dev + re2c + recode-dev + sqlite-dev + tidyhtml-dev + unixodbc-dev + zlib-dev + " +subpackages="$pkgname-dev $pkgname-doc $pkgname-apache2 $pkgname-phpdbg + $pkgname-embed $pkgname-litespeed $pkgname-cgi $pkgname-fpm + $pkgname-pear::noarch " source="http://php.net/distributions/$_pkgreal-$pkgver.tar.bz2 $pkgname-fpm.initd @@ -58,33 +96,85 @@ _libdir="/usr/lib/$pkgname" _extension_dir="$_libdir/modules" _extension_confd="/etc/$pkgname/conf.d" -_exts="bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo 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 posix pspell recode session shmop simplexml snmp soap - sockets sqlite3 sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zip zlib +_extensions=" + bcmath + bz2 + calendar + ctype + curl + dba + dom + enchant + exif + fileinfo + 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 + posix + pspell + recode + session + shmop + simplexml + snmp + soap + sockets + sqlite3 + sysvmsg + sysvsem + sysvshm + tidy + tokenizer + wddx + xml + xmlreader + xmlrpc + xmlwriter + xsl + zip + zlib " -subpackages="$pkgname-dev $pkgname-doc $pkgname-apache2 $pkgname-phpdbg $pkgname-embed - $pkgname-litespeed $pkgname-cgi $pkgname-fpm $pkgname-pear::noarch - " -for _ext in $_exts; do +for _ext in $_extensions; do case "$_ext" in - phar) subpackages="$subpackages $pkgname-$_ext:$_ext";; - *) subpackages="$subpackages $pkgname-$_ext:_package_ext";; + phar) subpackages="$subpackages $pkgname-$_ext:$_ext";; + *) subpackages="$subpackages $pkgname-$_ext:_extension";; esac done subpackages="$subpackages $pkgname-common::noarch" -_apiver="20160303" prepare() { cd "$builddir" - default_prepare || return 1 - update_config_sub || return 1 + default_prepare + update_config_sub 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" + error "After updating _apiver, all 3rd-party extensions must be rebuilt." return 1 fi @@ -116,7 +206,8 @@ prepare() { # * Doesn't work with system-provided onigurama, some tests fail (invalid code # point); probably because bundled onigurama is version 5.x, but we have 6.x. _build() { - [ "$CARCH" = "s390x" ] && _disable_pcre_jit="--without-pcre-jit" + local without_pcre_jit + [ "$CARCH" = "s390x" ] && without_pcre_jit="--without-pcre-jit" EXTENSION_DIR=$_extension_dir ./configure \ --build=$CBUILD \ @@ -133,48 +224,65 @@ _build() { --with-config-file-path=/etc/$pkgname \ --with-config-file-scan-dir=$_extension_confd \ --disable-short-tags \ - --with-openssl=shared --with-kerberos --with-system-ciphers \ - --with-pcre-regex=/usr --with-pcre-dir=/usr \ - $_disable_pcre_jit \ - --with-zlib=shared --with-zlib-dir=/usr \ + \ --enable-bcmath=shared \ --with-bz2=shared \ --enable-calendar=shared \ --enable-ctype=shared \ --with-curl=shared \ - --enable-dba=shared --with-gdbm --with-db4 \ + --enable-dba=shared \ + --with-db4 \ + --with-dbmaker=shared \ + --with-gdbm \ --enable-dom=shared \ --with-enchant=shared \ --enable-exif=shared \ --enable-fileinfo=shared \ --enable-ftp=shared \ - --with-gd=shared --with-webp-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr \ - --with-freetype-dir=/usr --enable-gd-native-ttf --disable-gd-jis-conv \ + --with-gd=shared \ + --with-freetype-dir=/usr \ + --disable-gd-jis-conv \ + --enable-gd-native-ttf \ + --with-jpeg-dir=/usr \ + --with-png-dir=/usr \ + --with-webp-dir=/usr \ + --with-xpm-dir=/usr \ --with-gettext=shared \ --with-gmp=shared \ --with-iconv=shared \ - --with-imap=shared --with-imap-ssl \ - --enable-intl=shared --with-icu-dir=/usr \ + --with-imap=shared \ + --with-imap-ssl \ + --with-icu-dir=/usr \ + --enable-intl=shared \ --enable-json=shared \ - --enable-libxml --with-libxml-dir=/usr \ - --with-ldap=shared --with-ldap-sasl \ + --with-kerberos \ + --with-ldap=shared \ + --with-ldap-sasl \ + --with-libedit \ + --enable-libxml \ + --with-libxml-dir=/usr \ --enable-mbstring=shared \ --with-mcrypt=shared \ - --with-sqlite3=shared,/usr --with-pdo-sqlite=shared,/usr \ - --with-pdo-dblib=shared \ --with-mysqli=shared,mysqlnd \ - --enable-mysqlnd=shared --with-pdo-mysql=shared,mysqlnd --with-mysql-sock=/run/mysqld/mysqld.sock \ - --with-pgsql=shared --with-pdo-pgsql=shared \ - --with-unixODBC=shared,/usr --with-pdo-odbc=shared,unixODBC,/usr \ - --with-dbmaker=shared \ + --with-mysql-sock=/run/mysqld/mysqld.sock \ + --enable-mysqlnd=shared \ --enable-opcache=shared \ - --enable-pdo=shared \ + --with-openssl=shared \ + --with-system-ciphers \ --enable-pcntl=shared \ - --enable-posix=shared \ + --with-pcre-regex=/usr \ + $without_pcre_jit \ + --enable-pdo=shared \ + --with-pdo-dblib=shared \ + --with-pdo-mysql=shared,mysqlnd \ + --with-pdo-odbc=shared,unixODBC,/usr \ + --with-pdo-pgsql=shared \ + --with-pdo-sqlite=shared,/usr \ + --with-pgsql=shared \ --enable-phar=shared \ + --enable-posix=shared \ --with-pspell=shared \ --without-readline \ - --with-libedit \ --with-recode=shared \ --enable-session=shared \ --enable-shmop=shared \ @@ -182,20 +290,25 @@ _build() { --with-snmp=shared \ --enable-soap=shared \ --enable-sockets=shared \ + --with-sqlite3=shared,/usr \ --enable-sysvmsg=shared \ --enable-sysvsem=shared \ --enable-sysvshm=shared \ --with-tidy=shared \ --enable-tokenizer=shared \ + --with-unixODBC=shared,/usr \ + --enable-wddx=shared \ --enable-xml=shared \ --enable-xmlreader=shared \ --with-xmlrpc=shared \ --enable-xmlwriter=shared \ --with-xsl=shared \ - --enable-wddx=shared \ - --enable-zip=shared --with-libzip=/usr \ - $@ || return 1 - make || return 1 + --enable-zip=shared \ + --with-libzip=/usr \ + --with-zlib=shared \ + --with-zlib-dir=/usr \ + $@ + make } build() { @@ -206,21 +319,20 @@ build() { --enable-phpdbg \ --enable-phpdbg-webhelper \ --disable-cgi \ - --disable-cli \ - || return 1 + --disable-cli + # apache2 module _build --disable-phpdbg \ --disable-cgi \ --disable-cli \ - --with-apxs2 \ - || return 1 + --with-apxs2 mv libs/libphp$_suffix.so sapi/apache2handler/mod_php$_suffix.so - # cgi,cli,fpm,embed,litespeed + + # cgi, cli, fpm, embed, litespeed _build --disable-phpdbg \ --enable-fpm \ --enable-embed \ - --with-litespeed \ - || return 1 + --with-litespeed } check() { @@ -249,34 +361,32 @@ check() { package() { cd "$builddir" - make -j1 INSTALL_ROOT="$pkgdir" install || return 1 + make -j1 INSTALL_ROOT="$pkgdir" install - install -Dm644 php.ini-production "$pkgdir"/etc/$pkgname/php.ini || return 1 + install -Dm644 php.ini-production "$pkgdir"/etc/$pkgname/php.ini local file; for file in pear peardev pecl; do - sed -i -e "s~/usr/bin/php~/usr/bin/php$_suffix~g" \ - -e "s~PHP=php~PHP=php$_suffix~" \ - "$pkgdir"/usr/bin/$file || return 1 + sed -i -e "s|/usr/bin/php|/usr/bin/php$_suffix|g" \ + -e "s|PHP=php|PHP=php$_suffix|" \ + "$pkgdir"/usr/bin/$file done - find "$pkgdir" -name '.*' | xargs rm -rf || return 1 + find "$pkgdir" -name '.*' | xargs rm -rf rmdir "$pkgdir"/var/run } dev() { default_dev replaces="php-dev" - depends="$depends $pkgname $pkgname-pear" + depends="$depends $pkgname=$pkgver-r$pkgrel $pkgname-pear" - mkdir -p "$subpkgdir"/usr/bin \ - "$subpkgdir"/$_libdir || return 1 + cd "$pkgdir" - mv "$pkgdir"/usr/bin/php-config$_suffix \ - "$pkgdir"/usr/bin/phpize$_suffix \ - "$subpkgdir"/usr/bin/ || return 1 + _mv usr/bin/php-config$_suffix \ + usr/bin/phpize$_suffix \ + "$subpkgdir"/usr/bin/ - mv "$pkgdir"/$_libdir/build \ - "$subpkgdir"/$_libdir/ || return 1 + _mv ./$_libdir/build "$subpkgdir"/$_libdir/ ln -s phpize$_suffix "$subpkgdir"/usr/bin/phpize ln -s php-config$_suffix "$subpkgdir"/usr/bin/php-config @@ -285,129 +395,121 @@ dev() { doc() { default_doc - mkdir -p "$subpkgdir"/usr/share/doc/$pkgname + cd "$builddir" - 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 - done + mkdir -p "$subpkgdir"/usr/share/doc/$pkgname + cp CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS \ + README* UPGRADING* \ + "$subpkgdir"/usr/share/doc/$pkgname/ } apache2() { - pkgdesc="PHP Module for Apache2" - depends="$pkgname-common apache2" + pkgdesc="PHP$_suffix Module for Apache2" + depends="$depends apache2" - install -D -m755 "$builddir"/sapi/apache2handler/mod_php$_suffix.so \ - "$subpkgdir"/usr/lib/apache2/mod_php$_suffix.so || return 1 + install -D -m 755 "$builddir"/sapi/apache2handler/mod_php$_suffix.so \ + "$subpkgdir"/usr/lib/apache2/mod_php$_suffix.so - install -D -m644 "$srcdir"/php$_suffix-module.conf \ + install -D -m 644 "$srcdir"/php$_suffix-module.conf \ "$subpkgdir"/etc/apache2/conf.d/php$_suffix-module.conf } phpdbg() { - pkgdesc="Interactive PHP debugger" - depends="$pkgname-common" + pkgdesc="Interactive PHP$_suffix debugger" install -Dm755 "$builddir"/sapi/phpdbg/phpdbg \ "$subpkgdir"/usr/bin/phpdbg$_suffix } embed() { - pkgdesc="PHP Embedded Library" - depends="$pkgname-common" + pkgdesc="PHP$_suffix Embedded Library" - mkdir -p "$subpkgdir"/usr/lib - mv "$pkgdir"/usr/lib/libphp*.so "$subpkgdir"/usr/lib/ + _mv "$pkgdir"/usr/lib/libphp*.so "$subpkgdir"/usr/lib/ } litespeed() { - pkgdesc="PHP LiteSpeed SAPI" - depends="$pkgname-common" + pkgdesc="PHP$_suffix LiteSpeed SAPI" mkdir -p "$subpkgdir"/usr/bin mv "$pkgdir"/usr/bin/lsphp "$subpkgdir"/usr/bin/lsphp$_suffix } cgi() { - pkgdesc="PHP Common Gateway Interface" - depends="$pkgname-common" + pkgdesc="PHP$_suffix Common Gateway Interface" - mkdir -p "$subpkgdir"/usr/bin - mv "$pkgdir"/usr/bin/php-cgi$_suffix "$subpkgdir"/usr/bin/ + _mv "$pkgdir"/usr/bin/php-cgi$_suffix "$subpkgdir"/usr/bin/ ln -s php-cgi$_suffix "$subpkgdir"/usr/bin/php-cgi } fpm() { - pkgdesc="PHP FastCGI Process Manager" - depends="$pkgname-common" - - mv "$pkgdir"/var "$subpkgdir"/ || return 1 + pkgdesc="PHP$_suffix FastCGI Process Manager" - mkdir -p "$subpkgdir"/etc/$pkgname \ - "$subpkgdir"/usr \ - "$subpkgdir"/var/lib \ - "$subpkgdir"/var/log/$pkgname + cd "$pkgdir" - 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 var "$subpkgdir"/ + _mv usr/share/$pkgname/fpm "$subpkgdir"/var/lib/$pkgname/ + _mv usr/sbin "$subpkgdir"/usr/ + _mv etc/$pkgname/php-fpm* "$subpkgdir"/etc/$pkgname/ 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 + "$subpkgdir"/etc/$pkgname/$file done - install -D -m755 "$srcdir"/$pkgname-fpm.initd \ - "$subpkgdir"/etc/init.d/php-fpm$_suffix || return 1 - install -D -m644 "$srcdir"/$pkgname-fpm.logrotate \ + install -D -m 755 "$srcdir"/$pkgname-fpm.initd \ + "$subpkgdir"/etc/init.d/php-fpm$_suffix + + install -D -m 644 "$srcdir"/$pkgname-fpm.logrotate \ "$subpkgdir"/etc/logrotate.d/php-fpm$_suffix + + mkdir -p "$subpkgdir"/var/log/$pkgname } pear() { - pkgdesc="PHP Extension and Application Repository" + pkgdesc="PHP$_suffix Extension and Application Repository" depends="$pkgname $pkgname-xml" + cd "$pkgdir" + # pecl needs xml extension and since we build it as shared, it must be # explicitly declared to be loaded. - sed -i 's/\$INCARG/& -d extension=xml.so/' \ - "$pkgdir"/usr/bin/pecl || return 1 - - mkdir -p "$subpkgdir"/usr/bin \ - "$subpkgdir"/etc/$pkgname + sed -i 's/\$INCARG/& -d extension=xml.so/' usr/bin/pecl + mkdir -p "$subpkgdir"/usr/bin local file; for file in pecl pear peardev; do - mv "$pkgdir"/usr/bin/$file "$subpkgdir"/usr/bin/$file$_suffix + mv usr/bin/$file "$subpkgdir"/usr/bin/$file$_suffix done - mv "$pkgdir"/etc/$pkgname/pear.conf "$subpkgdir"/etc/$pkgname/ || return 1 - mv "$pkgdir"/usr/share "$subpkgdir"/usr/ + + _mv etc/$pkgname/pear.conf "$subpkgdir"/etc/$pkgname/ + _mv usr/share "$subpkgdir"/usr/ } common() { pkgdesc="$pkgdesc (common config)" depends="" - mkdir -p "$subpkgdir"/usr - mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ || return 1 - mv "$pkgdir"/etc "$subpkgdir"/ || return 1 + cd "$pkgdir" + _mv usr/lib "$subpkgdir"/usr/ + _mv etc "$subpkgdir"/ mkdir -p "$subpkgdir"/$_extension_confd } phar() { - _package_ext || return 1 + _extension - mkdir -p "$subpkgdir"/usr/bin + cd "$pkgdir" - mv "$pkgdir"/usr/bin/phar.phar \ - "$subpkgdir"/usr/bin/phar.phar$_suffix || return 1 + _mv usr/bin/phar.phar \ + "$subpkgdir"/usr/bin/phar.phar$_suffix - rm "$pkgdir"/usr/bin/phar + rm usr/bin/phar ln -s phar.phar$_suffix "$subpkgdir"/usr/bin/phar$_suffix } -_package_ext() { +_extension() { local extname="${subpkgname#$pkgname-}" - local extdepends="$(eval "echo \$depends_$extname")" + local extdepends="$(eval "echo \$_depends_$extname")" pkgdesc="PHP$_suffix extension: $extname" : ${extdepends:=$(_resolve_extension_deps "$extname")} @@ -422,18 +524,16 @@ _package_ext() { local prefix= [ "$extname" != "opcache" ] || prefix="zend_" - mkdir -p "$subpkgdir"/$_extension_dir \ - "$subpkgdir"/$_extension_confd - - mv "$pkgdir"/$_extension_dir/$extname.so \ - "$subpkgdir"/$_extension_dir/ || return 1 + _mv "$pkgdir"/$_extension_dir/$extname.so \ + "$subpkgdir"/$_extension_dir/ + mkdir -p "$subpkgdir"/$_extension_confd echo "${prefix}extension=$extname.so" \ > "$subpkgdir"/$_extension_confd/$(printf %02d $index)_$extname.ini } # Resolves dependencies of the given extension name (without $pkgname- prefix) -# on other extensions in $_exts and prints them with $pkgname- prefix. +# on other extensions in $_extensions and prints them with $pkgname- prefix. _resolve_extension_deps() { local name="$1" @@ -446,24 +546,30 @@ _resolve_extension_deps() { | tr -d "'," | tr ' ' '\n' \ | sort -u \ | while read dep; do - if echo "$_exts" | grep -qw "$dep"; then + if echo "$_extensions" | grep -qw "$dep"; then echo "$pkgname-$dep" fi done } -# Prints _exts sorted by number of dependencies. +# Prints $_extensions sorted by number of dependencies. _extensions_by_deps_order() { local deps list name - for name in $_exts; do - deps=$(eval "echo \$depends_$name") + for name in $_extensions; do + deps=$(eval "echo \$_depends_$name") : ${deps:=$(_resolve_extension_deps $name)} list="$list $(echo "$deps" | wc -w);$name" done printf '%s\n' $list | sort -t ';' -k 1 | sed -E 's/\d+;//' } +_mv() { + local dest; for dest; do true; done # get last argument + mkdir -p "$dest" + mv $@ +} + sha512sums="a1dd5ffd756176e6ba600dd850510033d0d6f07aff314de69fec0c42437e6a006449e3f4f98679146a2f2645caa65ea351e31a8e1da7c14cc5260856ad40eaff php-7.1.4.tar.bz2 1c708de82d1086f272f484faf6cf6d087af7c31750cc2550b0b94ed723961b363f28a947b015b2dfc0765caea185a75f5d2c2f2b099c948b65c290924f606e4f php7-fpm.initd cacce7bf789467ff40647b7319e3760c6c587218720538516e8d400baa75651f72165c4e28056cd0c1dc89efecb4d00d0d7823bed80b29136262c825ce816691 php7-fpm.logrotate |