diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-05-01 15:16:09 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-05-02 01:04:52 +0200 |
commit | 128b0f0e848405a7dc0b9aea560cc809d0b13084 (patch) | |
tree | f29ff7d43dc977dcb655c515c5d33e064942a7b5 /community/php7 | |
parent | e763ccc6cabab59335f50c29fc91f5a990146336 (diff) | |
download | aports-128b0f0e848405a7dc0b9aea560cc809d0b13084.tar.bz2 aports-128b0f0e848405a7dc0b9aea560cc809d0b13084.tar.xz |
community/php7: automatically resolve deps of extensions
This solution is based on https://github.com/alpinelinux/aports/pull/893
by vakartel, but improved, cleaned and fixed to get it actually works.
Diffstat (limited to 'community/php7')
-rw-r--r-- | community/php7/APKBUILD | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/community/php7/APKBUILD b/community/php7/APKBUILD index 8069b29436..59a0f58415 100644 --- a/community/php7/APKBUILD +++ b/community/php7/APKBUILD @@ -28,16 +28,12 @@ arch="all" license="PHP-3 BSD LGPL2 MIT Zend" options="" depends="$pkgname-common" -depends_dom="$pkgname-xml" -depends_mysqli="$pkgname-mysqlnd" depends_mysqlnd="$pkgname-openssl" -depends_pdo_mysql="$pkgname-mysqlnd" +# 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" -depends_soap="$pkgname-xml" -depends_wddx="$pkgname-xml" -depends_xmlreader="$pkgname-dom" -depends_xmlrpc="$pkgname-xml" -depends_xsl="$pkgname-dom" 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 @@ -62,7 +58,7 @@ _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:phar posix pspell recode session shmop simplexml snmp soap + 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 @@ -70,7 +66,7 @@ subpackages="$pkgname-dev $pkgname-doc $pkgname-apache2 $pkgname-phpdbg $pkgname " for _ext in $_exts; do case "$_ext" in - *:*) subpackages="$subpackages $pkgname-$_ext";; + phar) subpackages="$subpackages $pkgname-$_ext:$_ext";; *) subpackages="$subpackages $pkgname-$_ext:_package_ext";; esac done @@ -383,15 +379,14 @@ _package_ext() { local extname="${subpkgname#$pkgname-}" local extdepends="$(eval "echo \$depends_$extname")" pkgdesc="PHP$_suffix extension: $extname" - depends="$depends $extdepends" - case "$extname" in - pdo_*) depends="$depends $pkgname-pdo" - esac + : ${extdepends:=$(_resolve_extension_deps "$extname")} + depends="$depends $extdepends" - # extension dependencies and loading order - local elo=00 - [ -z "$extdepends" ] || elo=01 + # Compute prefix for extension config, so extension depending on other + # extension(s) will be loaded later than those without dependencies. + # This is flawed, but good enough for now. + local index=$(echo "$extdepends" | wc -w) # extension prefix local prefix= @@ -404,7 +399,27 @@ _package_ext() { "$subpkgdir"/$_extension_dir/ || return 1 echo "${prefix}extension=$extname.so" \ - > "$subpkgdir"/$_extension_confd/${elo}_${extname}.ini + > "$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. +_resolve_extension_deps() { + local name="$1" + + # We use config.w32 just because it's more accurate than config.m4. + local config="$builddir/ext/$name/config.w32" + [ -f "$config" ] || return 0 + + cat "$config" \ + | sed -En "s/.*ADD_EXTENSION_DEP\('$name', ([^)]+)\).*/\1/p" \ + | tr -d "'," | tr ' ' '\n' \ + | sort -u \ + | while read dep; do + if echo "$_exts" | grep -qw "$dep"; then + echo "$pkgname-$dep" + fi + done } sha512sums="a1dd5ffd756176e6ba600dd850510033d0d6f07aff314de69fec0c42437e6a006449e3f4f98679146a2f2645caa65ea351e31a8e1da7c14cc5260856ad40eaff php-7.1.4.tar.bz2 |