diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-04-29 15:25:46 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-05-02 01:04:51 +0200 |
commit | 5fc0102d15f9d864d7e20616bf849ed5b348a002 (patch) | |
tree | 81e08ed27f73ffc25679c8939f681e4f7f9a29b6 /community/php7/APKBUILD | |
parent | c997492ce9d4070c926df759df94f4bc566a1bbc (diff) | |
download | aports-5fc0102d15f9d864d7e20616bf849ed5b348a002.tar.bz2 aports-5fc0102d15f9d864d7e20616bf849ed5b348a002.tar.xz |
community/php7: parametrize version suffix and some paths
This is based on https://github.com/alpinelinux/aports/pull/893
by vakartel.
Diffstat (limited to 'community/php7/APKBUILD')
-rw-r--r-- | community/php7/APKBUILD | 78 |
1 files changed, 44 insertions, 34 deletions
diff --git a/community/php7/APKBUILD b/community/php7/APKBUILD index 65692a2d3d..cb7af429d7 100644 --- a/community/php7/APKBUILD +++ b/community/php7/APKBUILD @@ -4,7 +4,8 @@ pkgname=php7 _pkgreal=php pkgver=7.1.4 pkgrel=0 -pkgdesc="The PHP language runtime engine - 7th branch" +_suffix=${pkgname#php} +pkgdesc="The PHP$_suffix language runtime engine" url="http://www.php.net/" arch="all" license="PHP-3" @@ -36,6 +37,10 @@ source="http://php.net/distributions/$_pkgreal-$pkgver.tar.bz2 " builddir="$srcdir/$_pkgreal-$pkgver" +_libdir="/usr/lib/$pkgname" +_extension_dir="$_libdir/modules" +_extension_confd="/etc/$pkgname/conf.d" + _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 session shmop snmp soap @@ -70,13 +75,13 @@ prepare() { _build() { [ "$CARCH" = "s390x" ] && _disable_pcre_jit="--without-pcre-jit" - export EXTENSION_DIR=/usr/lib/$pkgname/modules - ./configure \ + + EXTENSION_DIR=$_extension_dir ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ - --program-suffix=7 \ - --libdir=/usr/lib/$pkgname \ + --program-suffix=$_suffix \ + --libdir=$_libdir \ --datadir=/usr/share/$pkgname \ --sysconfdir=/etc/$pkgname \ --localstatedir=/var \ @@ -84,7 +89,7 @@ _build() { --with-pic \ --with-pear=/usr/share/$pkgname \ --with-config-file-path=/etc/$pkgname \ - --with-config-file-scan-dir=/etc/$pkgname/conf.d \ + --with-config-file-scan-dir=$_extension_confd \ --disable-short-tags \ --with-openssl=shared --with-kerberos --with-system-ciphers \ --with-pcre-regex --with-pcre-dir \ @@ -162,7 +167,7 @@ build() { --disable-cli \ --with-apxs2 \ || return 1 - mv libs/libphp7.so sapi/apache2handler/mod_php7.so + mv libs/libphp$_suffix.so sapi/apache2handler/mod_php$_suffix.so # cgi,cli,fpm,embed,litespeed _build --disable-phpdbg \ --enable-fpm \ @@ -179,11 +184,11 @@ package() { 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~" \ + 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 done - paxmark -m "$pkgdir"/usr/bin/php7 + paxmark -m "$pkgdir"/usr/bin/php$_suffix find "$pkgdir" -name '.*' | xargs rm -rf || return 1 rmdir "$pkgdir"/var/run @@ -195,16 +200,18 @@ dev() { depends="$depends $pkgname $pkgname-pear" mkdir -p "$subpkgdir"/usr/bin \ - "$subpkgdir"/usr/lib/$pkgname || return 1 + "$subpkgdir"/$_libdir || return 1 - mv "$pkgdir"/usr/bin/php-config7 \ - "$pkgdir"/usr/bin/phpize7 \ + mv "$pkgdir"/usr/bin/php-config$_suffix \ + "$pkgdir"/usr/bin/phpize$_suffix \ "$pkgdir"/usr/bin/peardev \ "$subpkgdir"/usr/bin/ || return 1 - mv "$pkgdir"/usr/lib/$pkgname/build \ - "$subpkgdir"/usr/lib/$pkgname || return 1 - ln -sf /usr/bin/phpize7 "$subpkgdir"/usr/bin/phpize - ln -sf /usr/bin/php-config7 "$subpkgdir"/usr/bin/php-config + + mv "$pkgdir"/$_libdir/build \ + "$subpkgdir"/$_libdir/ || return 1 + + ln -s phpize$_suffix "$subpkgdir"/usr/bin/phpize + ln -s php-config$_suffix "$subpkgdir"/usr/bin/php-config } doc() { @@ -222,11 +229,11 @@ apache2() { pkgdesc="PHP Module for Apache2" depends="$pkgname-common apache2" - install -D -m755 "$builddir"/sapi/apache2handler/mod_php7.so \ - "$subpkgdir"/usr/lib/apache2/mod_php7.so || return 1 + install -D -m755 "$builddir"/sapi/apache2handler/mod_php$_suffix.so \ + "$subpkgdir"/usr/lib/apache2/mod_php$_suffix.so || return 1 - install -D -m644 "$srcdir"/php7-module.conf \ - "$subpkgdir"/etc/apache2/conf.d/php7-module.conf + install -D -m644 "$srcdir"/php$_suffix-module.conf \ + "$subpkgdir"/etc/apache2/conf.d/php$_suffix-module.conf } phpdbg() { @@ -234,7 +241,7 @@ phpdbg() { depends="$pkgname-common" install -Dm755 "$builddir"/sapi/phpdbg/phpdbg \ - "$subpkgdir"/usr/bin/phpdbg7 + "$subpkgdir"/usr/bin/phpdbg$_suffix } embed() { @@ -250,7 +257,7 @@ litespeed() { depends="$pkgname-common" mkdir -p "$subpkgdir"/usr/bin - mv "$pkgdir"/usr/bin/lsphp "$subpkgdir"/usr/bin/lsphp7 + mv "$pkgdir"/usr/bin/lsphp "$subpkgdir"/usr/bin/lsphp$_suffix } cgi() { @@ -258,8 +265,8 @@ cgi() { depends="$pkgname-common" mkdir -p "$subpkgdir"/usr/bin - mv "$pkgdir"/usr/bin/php-cgi7 "$subpkgdir"/usr/bin/ - ln -s php-cgi7 "$subpkgdir"/usr/bin/php-cgi + mv "$pkgdir"/usr/bin/php-cgi$_suffix "$subpkgdir"/usr/bin/ + ln -s php-cgi$_suffix "$subpkgdir"/usr/bin/php-cgi } fpm() { @@ -282,8 +289,10 @@ fpm() { "$subpkgdir"/etc/$pkgname/$file || return 1 done - install -D -m755 "$srcdir"/$pkgname-fpm.initd "$subpkgdir"/etc/init.d/php-fpm7 || return 1 - install -D -m644 "$srcdir"/$pkgname-fpm.logrotate "$subpkgdir"/etc/logrotate.d/php-fpm7 + install -D -m755 "$srcdir"/$pkgname-fpm.initd \ + "$subpkgdir"/etc/init.d/php-fpm$_suffix || return 1 + install -D -m644 "$srcdir"/$pkgname-fpm.logrotate \ + "$subpkgdir"/etc/logrotate.d/php-fpm$_suffix } pear() { @@ -308,7 +317,7 @@ common() { mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ || return 1 mv "$pkgdir"/etc "$subpkgdir"/ || return 1 - mkdir "$subpkgdir"/etc/$pkgname/conf.d + mkdir -p "$subpkgdir"/$_extension_confd } phar() { @@ -320,7 +329,7 @@ phar() { _package_ext() { local extname="${subpkgname#$pkgname-}" local extdepends="$(eval "echo \$depends_$extname")" - pkgdesc="PHP7 extension: $extname" + pkgdesc="PHP$_suffix extension: $extname" depends="$depends $extdepends" case "$extname" in @@ -335,13 +344,14 @@ _package_ext() { local prefix= [ "$extname" != "opcache" ] || prefix="zend_" - 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 + mkdir -p "$subpkgdir"/$_extension_dir \ + "$subpkgdir"/$_extension_confd + + mv "$pkgdir"/$_extension_dir/$extname.so \ + "$subpkgdir"/$_extension_dir/ || return 1 echo "${prefix}extension=$extname.so" \ - > "$subpkgdir"/etc/$pkgname/conf.d/${elo}_${extname}.ini + > "$subpkgdir"/$_extension_confd/${elo}_${extname}.ini } sha512sums="a1dd5ffd756176e6ba600dd850510033d0d6f07aff314de69fec0c42437e6a006449e3f4f98679146a2f2645caa65ea351e31a8e1da7c14cc5260856ad40eaff php-7.1.4.tar.bz2 |