# Contributor: Valery Kartel # Contributor: Jakub Jirutka # Maintainer: Valery Kartel # Bundled libraries # # Name | License | Location | State # ----------+---------+------------------------+--------- # bcmath | LGPL2 | ext/bcmath/libbcmath | used # date | MIT | ext/date/lib | used # gd | BSD | ext/gd/libgd | used # file | BSD | ext/fileinfo/libmagic | used # libmbfl | LGPLv2 | ext/mbstring/libmbfl | used # oniguruma | BSD | ext/mbstring/oniguruma | used # pcre | BSD | ext/pcre/pcrelib | not used # sqlite3 | Public | ext/sqlite3/libsqlite | not used # libzip | BSD | ext/zip/lib | not used # libXMLRPC | BSD | ext/xmlrpc/libxmlrpc | used pkgname=php7 _pkgreal=php pkgver=7.1.4 pkgrel=0 _apiver=20160303 _suffix=${pkgname#php} # Is this package the default (latest) PHP version? _default_php="yes" pkgdesc="The PHP$_suffix language runtime engine" url="http://www.php.net/" arch="all" license="PHP-3 BSD LGPL2 MIT Zend" depends="$pkgname-common" # 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" 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 " provides="$pkgname-cli" # for backward compatibility 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 $pkgname-fpm.logrotate $pkgname-module.conf disabled-tests.list install-pear.patch includedir.patch fix-asm-constraints-in-aarch64-multiply-macro.patch php7-fpm-version-suffix.patch allow-build-recode-and-imap-together.patch fix-tests-devserver.patch " builddir="$srcdir/$_pkgreal-$pkgver" _libdir="/usr/lib/$pkgname" _extension_dir="$_libdir/modules" _extension_confd="/etc/$pkgname/conf.d" _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 " for _ext in $_extensions; do case "$_ext" in phar) subpackages="$subpackages $pkgname-$_ext:$_ext";; *) subpackages="$subpackages $pkgname-$_ext:_extension";; esac done subpackages="$subpackages $pkgname-common::noarch" prepare() { cd "$builddir" 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 # https://bugs.php.net/63362 - Not needed but installed headers. # Drop some Windows specific headers to avoid installation, # before build to ensure they are really not needed. rm -f TSRM/tsrm_win32.h \ TSRM/tsrm_config.w32.h \ Zend/zend_config.w32.h \ ext/mysqlnd/config-win.h \ ext/standard/winver.h \ main/win32_internal_function_disabled.h \ main/win95nt.h # Fix some bogus permissions. find . -name \*.[ch] -exec chmod 644 {} \; # XXX: Delete failing tests. sed -n '/^[^#]/p' "$srcdir"/disabled-tests.list | while read item; do rm -r $item # do it in this way to apply globbing... done autoconf } # Notes: # * gd-jis-conv breaks any non-latin font rendering (vakartel). # * libxml cannot be build as shared. # * 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() { local without_pcre_jit [ "$CARCH" = "s390x" ] && without_pcre_jit="--without-pcre-jit" EXTENSION_DIR=$_extension_dir ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ --program-suffix=$_suffix \ --libdir=$_libdir \ --datadir=/usr/share/$pkgname \ --sysconfdir=/etc/$pkgname \ --localstatedir=/var \ --with-layout=GNU \ --with-pic \ --with-pear=/usr/share/$pkgname \ --with-config-file-path=/etc/$pkgname \ --with-config-file-scan-dir=$_extension_confd \ --disable-short-tags \ \ --enable-bcmath=shared \ --with-bz2=shared \ --enable-calendar=shared \ --enable-ctype=shared \ --with-curl=shared \ --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-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 \ --with-icu-dir=/usr \ --enable-intl=shared \ --enable-json=shared \ --with-kerberos \ --with-ldap=shared \ --with-ldap-sasl \ --with-libedit \ --enable-libxml \ --with-libxml-dir=/usr \ --enable-mbstring=shared \ --with-mcrypt=shared \ --with-mysqli=shared,mysqlnd \ --with-mysql-sock=/run/mysqld/mysqld.sock \ --enable-mysqlnd=shared \ --enable-opcache=shared \ --with-openssl=shared \ --with-system-ciphers \ --enable-pcntl=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-recode=shared \ --enable-session=shared \ --enable-shmop=shared \ --enable-simplexml=shared \ --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-zip=shared \ --with-libzip=/usr \ --with-zlib=shared \ --with-zlib-dir=/usr \ $@ make } build() { cd "$builddir" # phpdbg _build --enable-phpdbg \ --enable-phpdbg \ --enable-phpdbg-webhelper \ --disable-cgi \ --disable-cli # apache2 module _build --disable-phpdbg \ --disable-cgi \ --disable-cli \ --with-apxs2 mv libs/libphp$_suffix.so sapi/apache2handler/mod_php$_suffix.so # cgi, cli, fpm, embed, litespeed _build --disable-phpdbg \ --enable-fpm \ --enable-embed \ --with-litespeed } check() { cd "$builddir" # PHP is so stupid that it's not able to resolve dependencies # between extensions and load them in correct order, so we must # help it... # * opcache is Zend extension, it's handled specially in Makefile # * imap can't be loaded together with recode, so we must omit it local php_modules=$(_extensions_by_deps_order \ | grep -vx opcache \ | grep -vx imap \ | xargs -n 1 printf "'$builddir/modules/%s.la' ") sed -i "/^PHP_TEST_SHARED_EXTENSIONS/,/extension=/ \ s|in \$(PHP_MODULES)\"*|in $php_modules|" Makefile local report_exit_status=1 case "$CARCH" in x86 | armhf) report_exit_status=0;; # allow tests fail esac NO_INTERACTION=1 REPORT_EXIT_STATUS="$report_exit_status" \ SKIP_SLOW_TESTS=1 SKIP_ONLINE_TESTS=1 TEST_TIMEOUT=10 \ TZ= LANG= LC_ALL= \ make test echo 'NOTE: We have skipped quite a lot tests, see disabled-tests.list.' } package() { cd "$builddir" make -j1 INSTALL_ROOT="$pkgdir" install 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 done find "$pkgdir" -name '.*' | xargs rm -rf rmdir "$pkgdir"/var/run [ "$_default_php" = yes ] \ && ln -s php$_suffix "$pkgdir"/usr/bin/php } dev() { default_dev replaces="php-dev" depends="$depends $pkgname=$pkgver-r$pkgrel $pkgname-pear" cd "$pkgdir" _mv usr/bin/php-config$_suffix \ usr/bin/phpize$_suffix \ "$subpkgdir"/usr/bin/ _mv ./$_libdir/build "$subpkgdir"/$_libdir/ if [ "$_default_php" = yes ]; then ln -s phpize$_suffix "$subpkgdir"/usr/bin/phpize ln -s php-config$_suffix "$subpkgdir"/usr/bin/php-config fi } doc() { default_doc cd "$builddir" 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$_suffix Module for Apache2" depends="$depends apache2" install -D -m 755 "$builddir"/sapi/apache2handler/mod_php$_suffix.so \ "$subpkgdir"/usr/lib/apache2/mod_php$_suffix.so install -D -m 644 "$srcdir"/php$_suffix-module.conf \ "$subpkgdir"/etc/apache2/conf.d/php$_suffix-module.conf } phpdbg() { pkgdesc="Interactive PHP$_suffix debugger" install -Dm755 "$builddir"/sapi/phpdbg/phpdbg \ "$subpkgdir"/usr/bin/phpdbg$_suffix [ "$_default_php" = yes ] \ && ln -s phpdbg$_suffix "$subpkgdir"/usr/bin/phpdbg } embed() { pkgdesc="PHP$_suffix Embedded Library" _mv "$pkgdir"/usr/lib/libphp*.so "$subpkgdir"/usr/lib/ } litespeed() { pkgdesc="PHP$_suffix LiteSpeed SAPI" mkdir -p "$subpkgdir"/usr/bin mv "$pkgdir"/usr/bin/lsphp "$subpkgdir"/usr/bin/lsphp$_suffix [ "$_default_php" = yes ] \ && ln -s lsphp$_suffix "$subpkgdir"/usr/bin/lsphp } cgi() { pkgdesc="PHP$_suffix Common Gateway Interface" _mv "$pkgdir"/usr/bin/php-cgi$_suffix "$subpkgdir"/usr/bin/ [ "$_default_php" = yes ] \ && ln -s php-cgi$_suffix "$subpkgdir"/usr/bin/php-cgi } fpm() { pkgdesc="PHP$_suffix FastCGI Process Manager" cd "$pkgdir" _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 done 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$_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/' usr/bin/pecl mkdir -p "$subpkgdir"/usr/bin local file; for file in pecl pear peardev; do mv usr/bin/$file "$subpkgdir"/usr/bin/$file$_suffix [ "$_default_php" = yes ] \ && ln -s $file$_suffix "$subpkgdir"/usr/bin/$file done _mv etc/$pkgname/pear.conf "$subpkgdir"/etc/$pkgname/ _mv usr/share "$subpkgdir"/usr/ } common() { pkgdesc="$pkgdesc (common config)" depends="" cd "$pkgdir" _mv usr/lib "$subpkgdir"/usr/ _mv etc "$subpkgdir"/ mkdir -p "$subpkgdir"/$_extension_confd } phar() { _extension cd "$pkgdir" mkdir -p "$subpkgdir"/usr/bin mv usr/bin/phar.phar "$subpkgdir"/usr/bin/phar.phar$_suffix rm usr/bin/phar ln -s phar.phar$_suffix "$subpkgdir"/usr/bin/phar$_suffix if [ "$_default_php" = yes ]; then ln -s phar.phar$_suffix "$subpkgdir"/usr/bin/phar.phar ln -s phar.phar$_suffix "$subpkgdir"/usr/bin/phar fi } _extension() { local extname="${subpkgname#$pkgname-}" local extdepends="$(eval "echo \$_depends_$extname")" pkgdesc="PHP$_suffix extension: $extname" : ${extdepends:=$(_resolve_extension_deps "$extname")} depends="$depends $extdepends" # 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= [ "$extname" != "opcache" ] || prefix="zend_" _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 $_extensions 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 "$_extensions" | grep -qw "$dep"; then echo "$pkgname-$dep" fi done } # Prints $_extensions sorted by number of dependencies. _extensions_by_deps_order() { local deps list 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 fbf9a1572d37370ec0d126502e1d066e045a992484d8fc4f1e2ede330134c1a15f4029f29fa4daebd48eed78b045dc051ced69fbf1f11efc7ad81d884a639a99 php7-module.conf cd76bd6a6a222e17ba50a11d292925966e30532a464ad2807d8ae5a8c510c63eeb494291f0b0ce1d287f13659d290550d001e77b2fc50c70c3ec175b204a37a7 disabled-tests.list f1177cbf6b1f44402f421c3d317aab1a2a40d0b1209c11519c1158df337c8945f3a313d689c939768584f3e4edbe52e8bd6103fb6777462326a9d94e8ab1f505 install-pear.patch 199aecdbd3b4035aabf5379c215f82412d3c98b79a1ee186944e7fe1f0ed6f40789ea30e2355149491de6be34fc66c5e486e2a79a7e41ab2ae18706ef3ffe79b includedir.patch d93d3fc015580cf5f75c6cbca4cd980e054b61e1068495da81a7e61f1af2c9ae14f09964c04928ad338142de78e4844aed885b1ad1865282072999fb045c8ad7 fix-asm-constraints-in-aarch64-multiply-macro.patch a4c35446745ab0ac806de801f0651fc5d2c98cf60063c3c2d3963a84f1c71ef78e09b7650c08e7231be0fdb93c0c255de38894d7f0e4f4c5a190d17f1a6bc476 php7-fpm-version-suffix.patch f8ecae241a90cbc3e98aa4deb3d5d35ef555f51380e29f4e182a8060dffeb84be74f030a14c6b452668471030d78964f52795ca74275db05543ccad20ef1f2cc allow-build-recode-and-imap-together.patch 01c3c65f153ea92192f2b2694d93a086ffa67c282fe046f877842942692c25666e4154a09aba6c2161f7f2a3b6595f4d79573e9ee74aec774a95f2f9725846f9 fix-tests-devserver.patch"