diff options
-rw-r--r-- | .SRCINFO | 488 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | PKGBUILD | 1746 | ||||
-rw-r--r-- | apache.conf | 13 | ||||
-rw-r--r-- | apache.patch | 10 | ||||
-rw-r--r-- | debian-php-7.4.patch | 274 | ||||
-rwxr-xr-x | generate_patches | 64 | ||||
-rw-r--r-- | make-tests.patch | 11 | ||||
-rw-r--r-- | mysql-socket-php7.1.patch | 26 | ||||
-rw-r--r-- | openssl-sslv3-consts.patch | 12 | ||||
-rw-r--r-- | pear-config-patcher.php | 42 | ||||
-rw-r--r-- | php-apache.conf | 13 | ||||
-rw-r--r-- | php-fpm.install | 31 | ||||
-rw-r--r-- | php-fpm.patch | 74 | ||||
-rw-r--r-- | php-fpm.tmpfiles | 1 | ||||
-rw-r--r-- | php-libxml.patch | 23 | ||||
-rw-r--r-- | php-makefile-patcher.php | 47 | ||||
-rw-r--r-- | php-phpinfo.patch | 22 | ||||
-rw-r--r-- | php.ini.patch | 77 | ||||
-rw-r--r-- | php74-enchant.patch (renamed from enchant-2.patch) | 8 | ||||
-rw-r--r-- | phpize.m4.patch | 13 | ||||
-rw-r--r-- | timezonedb-guess.patch | 27 | ||||
-rw-r--r-- | timezonedb-php7.4.patch | 625 |
23 files changed, 3008 insertions, 640 deletions
@@ -1,158 +1,436 @@ +# Generated by makepkg 6.1.0 +# Wed Mar 27 14:55:17 UTC 2024 pkgbase = php74 - pkgver = 7.4.19 - pkgrel = 1 - url = https://www.php.net/ + pkgdesc = PHP 7.4.33 compiled as to not conflict with mainline php + pkgver = 7.4.33 + pkgrel = 5 + url = http://www.php.net arch = x86_64 license = PHP checkdepends = procps-ng + checkdepends = smtp-forwarder + makedepends = acl + makedepends = libtool + makedepends = autoconf + makedepends = automake + makedepends = patchelf + makedepends = gawk + makedepends = sed + makedepends = bash + makedepends = python + makedepends = libxml2 + makedepends = pam + makedepends = krb5 + makedepends = zlib + makedepends = libedit + makedepends = smtp-forwarder + makedepends = pcre makedepends = apache - makedepends = aspell - makedepends = c-client - makedepends = db - makedepends = enchant - makedepends = gd - makedepends = gmp - makedepends = icu - makedepends = libsodium + makedepends = ncurses + makedepends = libxcrypt + makedepends = systemd + makedepends = systemd-libs + makedepends = coreutils + makedepends = findutils + makedepends = argon2 makedepends = libxslt - makedepends = libzip - makedepends = net-snmp + makedepends = e2fsprogs + makedepends = openssl-1.1 + makedepends = lmdb + makedepends = db5.3 makedepends = postgresql-libs - makedepends = sqlite - makedepends = systemd - makedepends = tidy makedepends = unixodbc - makedepends = curl - makedepends = libtool - makedepends = smtp-forwarder + makedepends = libfbclient makedepends = freetds - makedepends = pcre2 - makedepends = libnsl + makedepends = sqlite + makedepends = gd + makedepends = tidy + makedepends = gmp + makedepends = libzip makedepends = oniguruma - source = https://php.net/distributions/php-7.4.19.tar.xz - source = https://php.net/distributions/php-7.4.19.tar.xz.asc - source = apache.patch - source = apache.conf - source = php-fpm.patch - source = php-fpm.tmpfiles - source = php.ini.patch - source = phpize.m4.patch - source = enchant-2.patch - validpgpkeys = 5A52880781F755608BF815FC910DEB46F53EA312 - validpgpkeys = 42670A7FE4D0441C8E4632349E4FDC074A4EF02D - sha256sums = 6c17172c4a411ccb694d9752de899bb63c72a0a3ebe5089116bc13658a1467b2 - sha256sums = SKIP - sha256sums = b4ea038f2863801175d6c4e74c685913feecdd5be3d49aff7d9b3fa92d8c4159 - sha256sums = ebc0af1ef3a6baccb013d0ccb29923895a7b22ff2d032e3bba802dc6328301ce - sha256sums = 299c6495f276b51cb05a3ffbdf365f8d40307fba748646998b0eea61af4eb827 - sha256sums = 696c2cfda2b10de542e4267d3ed245711e3eb6c7f4c7c4d1878e4d5de6f3140b - sha256sums = 3a6d101962db9d311d9bba3b561b9dfd417701d9d2b607b70b9df218f6e029d7 - sha256sums = 354b1d5fd83e9902c6a4f7ca5d2101631bd67404f3c55a7194d9a6862656b479 - sha256sums = d94d22ad8bcd13829addda84e9de6b73fa04be9bc6da8622086c7e19c97ab724 + makedepends = aspell + makedepends = enchant + makedepends = libvoikko + makedepends = hspell + makedepends = hunspell + makedepends = nuspell + makedepends = aspell + makedepends = icu + makedepends = curl + makedepends = net-snmp + makedepends = libsasl + makedepends = libldap + makedepends = c-client + makedepends = pam + makedepends = libsodium + makedepends = libffi + options = !lto + source = make-tests.patch + source = pear-config-patcher.php + source = php-makefile-patcher.php + source = php-apache.conf + source = https://php.net/distributions/php-7.4.33.tar.xz + source = php-libxml.patch + source = mysql-socket-php7.1.patch + source = php74-enchant.patch + source = debian-php-7.4.patch + source = php-phpinfo.patch + source = timezonedb-guess.patch + source = timezonedb-php7.4.patch + sha256sums = e6b8530d747000eebb0089249ec70a3b14add7b501337046700544883f62b17b + sha256sums = 0b7e98dca9c996ec10cb9b3f6296bb7547c68797fd5f35006fdfd3e97700672d + sha256sums = ba72fc64f77822755a469314160d5889d5298f4eb5758dd7939dac9b811afe52 + sha256sums = 6d0ad9becb5470ce8e5929d7d45660b0f32579038978496317544c5310281a91 + sha256sums = 924846abf93bc613815c55dd3f5809377813ac62a9ec4eb3778675b82a27b927 + sha256sums = e757f84d2d72ea39259450c32f3a83c72262da4294152ae3e9fbc0cada622bba + sha256sums = 0a3a6e8ff04ff1e0869befcf2c7bca4e886d94065da6d7a10b809a4750b961a0 + sha256sums = 8fb103438fe12875dbe7c1f5b0899a81a76b4ce1456f16960e23e287d273df14 + sha256sums = c30ff6fcf75b0c0068f3d49fde8024719b3677f104d93232e52c5358c840c0f5 + sha256sums = 558e780e93dfa861a366c49b4d156d8fc43f17898f001ae6033ec63c33d5d41c + sha256sums = 40bcc1e5058602302198d0925e431495391d8469499593af477f59d84d32f764 + sha256sums = 6ef318bf8d53a2288d037e3284f4dbfc26c36fd2ecc7d62e3d5036c19ec0a707 pkgname = php74 - pkgdesc = A general-purpose scripting language that is especially suited to web development + pkgdesc = PHP. A general-purpose scripting language that is especially suited to web development + depends = zlib + depends = pcre + depends = libedit + backup = etc/php74/php.ini + +pkgname = php74-cli + pkgdesc = cli (command-line executable) version for php74 + depends = php74=7.4.33 depends = libxml2 - depends = curl - depends = libzip depends = pcre2 + depends = libedit depends = argon2 - depends = oniguruma backup = etc/php74/php.ini pkgname = php74-cgi - pkgdesc = CGI and FCGI SAPI for PHP - depends = php74 - -pkgname = php74-apache - pkgdesc = Apache SAPI for PHP - depends = php74 - depends = apache - depends = libnsl - backup = etc/httpd/conf/extra/php74_module.conf + pkgdesc = CGI and FCGI SAPI for php74 + depends = php74=7.4.33 + depends = libxml2 + depends = pcre2 + depends = libedit + depends = argon2 + backup = etc/php74/php.ini pkgname = php74-fpm - pkgdesc = FastCGI Process Manager for PHP - depends = php74 - depends = systemd + pkgdesc = FastCGI Process Manager for php74 + install = php-fpm.install + depends = php74=7.4.33 + depends = systemd-libs + depends = acl + depends = libxml2 + depends = pcre2 + depends = libedit + depends = argon2 options = !emptydirs backup = etc/php74/php-fpm.conf backup = etc/php74/php-fpm.d/www.conf + backup = etc/php74/php.ini pkgname = php74-embed - pkgdesc = Embedded PHP SAPI library - depends = php74 + pkgdesc = Embedded PHP SAPI library for php74 + depends = php74=7.4.33 + depends = ncurses depends = systemd-libs - depends = libnsl + depends = libxcrypt + depends = acl + depends = ncurses + depends = libxml2 + depends = pcre2 + depends = libedit + depends = argon2 options = !emptydirs + backup = etc/php74/php.ini + +pkgname = php74-apache + pkgdesc = Apache SAPI for php74 + depends = php74=7.4.33 + depends = apache + depends = libxml2 + depends = pcre2 + depends = libedit + depends = argon2 + depends = libxcrypt + depends = ncurses + backup = etc/httpd/conf/extra/ + backup = etc/php74/php.ini + +pkgname = php74-litespeed + pkgdesc = LiteSpeed SAPI for php74 + depends = php74=7.4.33 + depends = libxml2 + depends = pcre2 + depends = libedit + depends = argon2 + backup = etc/php74/php.ini + +pkgname = php74-pear + pkgdesc = PHP Extension and Application Repository (PEAR) for php74 + depends = php74=7.4.33 + depends = php74-xml=7.4.33 + depends = php74-cli=7.4.33 + depends = php74-phar=7.4.33 + +pkgname = php74-pecl + pkgdesc = PHP Extension Community Library (PECL) for php74 + depends = php74-pear=7.4.33 pkgname = php74-phpdbg - pkgdesc = Interactive PHP debugger - depends = php74 + pkgdesc = Interactive PHP debugger for php74 () + depends = php74=7.4.33 + depends = libxml2 + depends = pcre2 + depends = libedit + depends = argon2 options = !emptydirs + backup = etc/php74/php.ini + +pkgname = php74-xml + pkgdesc = xml modules for php74 + depends = php74=7.4.33 + depends = libxml2 + +pkgname = php74-xsl + pkgdesc = xsl module for php74 + depends = php74-xml=7.4.33 + depends = php74-dom=7.4.33 + depends = libxslt + +pkgname = php74-xmlreader + pkgdesc = xmlreader module for php74 + depends = php74-xml=7.4.33 + +pkgname = php74-xmlwriter + pkgdesc = xmlwriter module for php74 + depends = php74-xml=7.4.33 + +pkgname = php74-dom + pkgdesc = dom module for php74 + depends = php74-xml=7.4.33 + +pkgname = php74-simplexml + pkgdesc = simplexml module for php74 + depends = php74-xml=7.4.33 + +pkgname = php74-openssl + pkgdesc = OpenSSL module for php74 + depends = php74=7.4.33 + depends = krb5 + depends = e2fsprogs + depends = openssl-1.1 + +pkgname = php74-pdo + pkgdesc = pdo module for php74 + depends = php74=7.4.33 + +pkgname = php74-mysql + pkgdesc = MySQL modules for php74 + depends = php74=7.4.33 + depends = php74-pdo=7.4.33 + depends = php74-openssl=7.4.33 + +pkgname = php74-phar + pkgdesc = phar module for php74 + depends = php74=7.4.33 + +pkgname = php74-pcntl + pkgdesc = pcntl module for php74 + depends = php74=7.4.33 + +pkgname = php74-posix + pkgdesc = posix module for php74 + depends = php74=7.4.33 + +pkgname = php74-shmop + pkgdesc = shmop module for php74 + depends = php74=7.4.33 + +pkgname = php74-sockets + pkgdesc = sockets module for php74 + depends = php74=7.4.33 + +pkgname = php74-sysvmsg + pkgdesc = sysvmsg module for php74 + depends = php74=7.4.33 + +pkgname = php74-sysvsem + pkgdesc = sysvsem module for php74 + depends = php74=7.4.33 + +pkgname = php74-sysvshm + pkgdesc = sysvshm module for php74 + depends = php74=7.4.33 + +pkgname = php74-tokenizer + pkgdesc = tokenizer module for php74 + depends = php74=7.4.33 + +pkgname = php74-dba + pkgdesc = dba module for php74 + depends = php74=7.4.33 + depends = db5.3 + depends = lmdb + +pkgname = php74-pgsql + pkgdesc = PostgreSQL modules for php74 + depends = php74=7.4.33 + depends = postgresql-libs + depends = php74-pdo=7.4.33 + +pkgname = php74-odbc + pkgdesc = ODBC modules for php74 + depends = php74=7.4.33 + depends = unixodbc + depends = php74-pdo=7.4.33 + +pkgname = php74-firebird + pkgdesc = pdo_firebird module for php74 + depends = php74=7.4.33 + depends = libfbclient + depends = php74-pdo=7.4.33 pkgname = php74-dblib - pkgdesc = dblib module for PHP - depends = php74 + pkgdesc = pdo_dblib module for php74 + depends = php74=7.4.33 depends = freetds -pkgname = php74-enchant - pkgdesc = enchant module for PHP - depends = php74 - depends = enchant +pkgname = php74-sqlite + pkgdesc = sqlite module for php74 + depends = php74=7.4.33 + depends = sqlite + depends = php74-pdo=7.4.33 pkgname = php74-gd - pkgdesc = gd module for PHP - depends = php74 + pkgdesc = gd module for php74 + depends = php74=7.4.33 depends = gd -pkgname = php74-imap - pkgdesc = imap module for PHP - depends = php74 - depends = c-client +pkgname = php74-exif + pkgdesc = exif module for php74 + depends = php74=7.4.33 -pkgname = php74-intl - pkgdesc = intl module for PHP - depends = php74 - depends = icu +pkgname = php74-tidy + pkgdesc = tidy module for php74 + depends = php74=7.4.33 + depends = tidy -pkgname = php74-sodium - pkgdesc = sodium module for PHP - depends = php74 - depends = libsodium +pkgname = php74-iconv + pkgdesc = iconv module for php74 + depends = php74=7.4.33 -pkgname = php74-odbc - pkgdesc = ODBC modules for PHP +pkgname = php74-bcmath + pkgdesc = bcmath module for php74 depends = php74 - depends = unixodbc -pkgname = php74-pgsql - pkgdesc = PostgreSQL modules for PHP - depends = php74 - depends = postgresql-libs +pkgname = php74-gmp + pkgdesc = gmp module for php74 + depends = php74=7.4.33 + depends = gmp + +pkgname = php74-zip + pkgdesc = zip module for php74 + depends = php74=7.4.33 + depends = libzip + +pkgname = php74-bz2 + pkgdesc = bz2 module for php74 + depends = php74=7.4.33 + depends = bzip2 + +pkgname = php74-json + pkgdesc = json module for php74 + depends = php74=7.4.33 + +pkgname = php74-fileinfo + pkgdesc = fileinfo module for php74 + depends = php74=7.4.33 + +pkgname = php74-ctype + pkgdesc = ctype module for php74 + depends = php74=7.4.33 + +pkgname = php74-mbstring + pkgdesc = mbstring module for php74 + depends = php74=7.4.33 + depends = oniguruma pkgname = php74-pspell - pkgdesc = pspell module for PHP - depends = php74 + pkgdesc = pspell module for php74 + depends = php74=7.4.33 + depends = aspell + +pkgname = php74-enchant + pkgdesc = enchant module for php74 + depends = php74=7.4.33 + depends = enchant + depends = libvoikko + depends = hspell + depends = hunspell + depends = nuspell depends = aspell +pkgname = php74-intl + pkgdesc = intl module for php74 + depends = php74=7.4.33 + depends = icu + +pkgname = php74-calendar + pkgdesc = calendar module for php74 + depends = php74=7.4.33 + +pkgname = php74-gettext + pkgdesc = gettext module for php74 + depends = php74=7.4.33 + +pkgname = php74-soap + pkgdesc = soap module for php74 + depends = php74=7.4.33 + depends = libxml2 + +pkgname = php74-ftp + pkgdesc = FTP module for php74 + depends = php74=7.4.33 + depends = openssl-1.1 + +pkgname = php74-curl + pkgdesc = curl module for php74 + depends = php74=7.4.33 + depends = curl + pkgname = php74-snmp - pkgdesc = snmp module for PHP - depends = php74 + pkgdesc = snmp module for php74 + depends = php74=7.4.33 depends = net-snmp + depends = openssl-1.1 -pkgname = php74-sqlite - pkgdesc = sqlite module for PHP - depends = php74 - depends = sqlite +pkgname = php74-ldap + pkgdesc = ldap module for php74 + depends = php74=7.4.33 + depends = libldap + depends = libsasl -pkgname = php74-tidy - pkgdesc = tidy module for PHP - depends = php74 - depends = tidy +pkgname = php74-imap + pkgdesc = imap module for php74 + depends = php74=7.4.33 + depends = pam + depends = krb5 + depends = c-client + depends = libxcrypt + depends = openssl-1.1 -pkgname = php74-xsl - pkgdesc = xsl module for PHP - depends = php74 - depends = libxslt +pkgname = php74-sodium + pkgdesc = sodium (libsodium) module for php74 + depends = php74=7.4.33 + depends = libsodium + +pkgname = php74-ffi + pkgdesc = ffi module for php74 + depends = php74=7.4.33 + depends = libffi +pkgname = php74-opcache + pkgdesc = opcache zend module for php74 + depends = php74=7.4.33 diff --git a/.gitignore b/.gitignore index 553161727b30..37cc946bb7c2 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ /src /pkg *.kate-swp +*.tar.* @@ -1,361 +1,1549 @@ -# Maintainer: Tomasz Gruszka <tompear79@gmail.com> -# Contributor: Pierre Schmitz <pierre@archlinux.de> -# Contributor: Matt Harrison <matt@harrison.us.com> - -pkgbase=php74 -_pkgbase=${pkgbase%74} -pkgname=("${pkgbase}" - "${pkgbase}-cgi" - "${pkgbase}-apache" - "${pkgbase}-fpm" - "${pkgbase}-embed" - "${pkgbase}-phpdbg" - "${pkgbase}-dblib" - "${pkgbase}-enchant" - "${pkgbase}-gd" - "${pkgbase}-imap" - "${pkgbase}-intl" - "${pkgbase}-sodium" - "${pkgbase}-odbc" - "${pkgbase}-pgsql" - "${pkgbase}-pspell" - "${pkgbase}-snmp" - "${pkgbase}-sqlite" - "${pkgbase}-tidy" - "${pkgbase}-xsl") -pkgver=7.4.19 -pkgrel=1 -arch=('x86_64') +############################################################################### +# Generated by arch-phpbs: https://github.com/lamskoy/arch-phpbs +# +# Maintaining/co-maintaining on AUR: all packages from php53 up to php82 +# +# Thanks to: +# +# AUR php80 Co-maintainer: Timo Sarawinski +# AUR php70 and php71 Co-maintainer: William Gathoye <william@gathoye.be> +# AUR php74 Co-maintainer: Tomasz Gruszka <tompear79@gmail.com> +# AUR php73 Co-maintainer: Matt Harrison <matt@harrison.us.com> +# AUR php73 and php56 Contributor: Pierre Schmitz <pierre@archlinux.de> +# AUR php56 Contributor: Chris Severance aur.severach aATt spamgourmet dott com +# AUR php56 Contributor: Thore Bödecker <me@foxxx0.de> +# AUR php56 Contributor: Jörg Schuck <joerg_schuck [at] web.de> +# AUR php55 Contributor: Raphaël Doursenaud <rdoursenaud@gmail.com> +# AUR php53 Contriburor: Felix Yan <felixonmars@archlinux.org> +############################################################################### +_phpbase="74" +_suffix="" +pkgver="7.4.33" +pkgrel="5" +pkgbase="php74" +pkgdesc="PHP 7.4.33 compiled as to not conflict with mainline php" +_cppflags=" -DU_USING_ICU_NAMESPACE=1 -DU_DEFINE_FALSE_AND_TRUE=1 " +_build_apache_cfg="etc/httpd/conf/extra" +_build_bundled_gd="0" +_build_conf_d="etc/php74/conf.d" +_build_forced_openssl_11="1" +_build_fpm_name="php-fpm74" +_build_fpm_service_name="php74-fpm" +_build_icu_src_dir="icu/source" +_build_ini_per_sapi="0" +_build_mysql_socket="/run/mysqld/mysqld.sock" +_build_openssl_v10_patch="0" +_build_openssl_v11_patch="0" +_build_per_sapi="0" +_build_phpdbg="1" +_build_sapi_ini_apache="etc/php74" +_build_sapi_ini_cgi="etc/php74" +_build_sapi_ini_cli="etc/php74" +_build_sapi_ini_embed="etc/php74" +_build_sapi_ini_fpm="etc/php74" +_build_sapi_ini_litespeed="etc/php74" +_build_sapi_ini_phpdbg="etc/php74" +_build_sapi_litespeed="--enable-litespeed" +_build_shared_gd="1" +_build_shared_json="1" +_build_shared_libedit="0" +_build_shared_mysqlnd="1" +_build_shared_openssl="1" +_build_shared_pdo="1" +_build_system_timezonedb="1" +_build_update_sqlite="0" +_build_uses_argon="1" +_build_uses_lmdb="1" +_build_with_custom_icu="0" +_pkgver_icu="64-1" +_priority_default="20" +_priority_dom="16" +_priority_json="15" +_priority_mysqlnd="10" +_priority_opcache="10" +_priority_openssl="05" +_priority_pdo="10" +_priority_xml="15" +_suffix="" +_suffix_so="7" +pkgname=( + "php74" + "php74-cli" + "php74-cgi" + "php74-fpm" + "php74-embed" + "php74-apache" + "php74-litespeed" + "php74-pear" + "php74-pecl" + "php74-phpdbg" + "php74-xml" + "php74-xsl" + "php74-xmlreader" + "php74-xmlwriter" + "php74-dom" + "php74-simplexml" + "php74-openssl" + "php74-pdo" + "php74-mysql" + "php74-phar" + "php74-pcntl" + "php74-posix" + "php74-shmop" + "php74-sockets" + "php74-sysvmsg" + "php74-sysvsem" + "php74-sysvshm" + "php74-tokenizer" + "php74-dba" + "php74-pgsql" + "php74-odbc" + "php74-firebird" + "php74-dblib" + "php74-sqlite" + "php74-gd" + "php74-exif" + "php74-tidy" + "php74-iconv" + "php74-bcmath" + "php74-gmp" + "php74-zip" + "php74-bz2" + "php74-json" + "php74-fileinfo" + "php74-ctype" + "php74-mbstring" + "php74-pspell" + "php74-enchant" + "php74-intl" + "php74-calendar" + "php74-gettext" + "php74-soap" + "php74-ftp" + "php74-curl" + "php74-snmp" + "php74-ldap" + "php74-imap" + "php74-sodium" + "php74-ffi" + "php74-opcache" +) +source=( + "make-tests.patch" + "pear-config-patcher.php" + "php-makefile-patcher.php" + "php-apache.conf" + "https://php.net/distributions/php-${pkgver}.tar.xz" + "php-libxml.patch" + "mysql-socket-php7.1.patch" + "php74-enchant.patch" + "debian-php-7.4.patch" + "php-phpinfo.patch" + "timezonedb-guess.patch" + "timezonedb-php7.4.patch" +) +depends=( +) +makedepends=( + "acl" + "libtool" + "autoconf" + "automake" + "patchelf" + "gawk" + "sed" + "bash" + "python" + "libxml2" + "pam" + "krb5" + "zlib" + "libedit" + "smtp-forwarder" + "pcre" + "apache" + "ncurses" + "libxcrypt" + "systemd" + "systemd-libs" + "coreutils" + "findutils" + "argon2" + "libxslt" + "e2fsprogs" + "openssl-1.1" + "lmdb" + "db5.3" + "postgresql-libs" + "unixodbc" + "libfbclient" + "freetds" + "sqlite" + "gd" + "tidy" + "gmp" + "libzip" + "oniguruma" + "aspell" + "enchant" + "libvoikko" + "hspell" + "hunspell" + "nuspell" + "aspell" + "icu" + "curl" + "net-snmp" + "libsasl" + "libldap" + "c-client" + "pam" + "libsodium" + "libffi" +) +arch=( +) +_patches=( + "php-libxml.patch" + "mysql-socket-php7.1.patch" + "php74-enchant.patch" + "debian-php-7.4.patch" + "php-phpinfo.patch" + "timezonedb-guess.patch" + "timezonedb-php7.4.patch" +) +_sapi_depends=( + "libxml2" + "pcre2" + "libedit" + "argon2" +) +_ext_depends_snmp=( + "php74=7.4.33" + "net-snmp" + "openssl-1.1" +) +_ext_depends_ftp=( + "php74=7.4.33" + "openssl-1.1" +) +_ext_depends_intl=( + "php74=7.4.33" + "icu" +) +_ext_depends_imap=( + "php74=7.4.33" + "pam" + "krb5" + "c-client" + "libxcrypt" + "openssl-1.1" +) +_ext_depends_gd=( + "php74=7.4.33" + "gd" +) +_ext_depends_mysql=( + "php74=7.4.33" + "php74-pdo=7.4.33" + "php74-openssl=7.4.33" +) +_ext_depends_dba=( + "php74=7.4.33" + "db5.3" + "lmdb" +) +_ext_depends_odbc=( + "php74=7.4.33" + "unixodbc" + "php74-pdo=7.4.33" +) +_ext_depends_pgsql=( + "php74=7.4.33" + "postgresql-libs" + "php74-pdo=7.4.33" +) +_ext_depends_firebird=( + "php74=7.4.33" + "libfbclient" + "php74-pdo=7.4.33" +) +_ext_depends_sqlite=( + "php74=7.4.33" + "sqlite" + "php74-pdo=7.4.33" +) +_ext_depends_mbstring=( + "php74=7.4.33" + "oniguruma" +) +_ext_depends_openssl=( + "php74=7.4.33" + "krb5" + "e2fsprogs" + "openssl-1.1" +) +_phpconfig="\ + --prefix=/usr \ + --sbindir=/usr/bin \ + --localstatedir=/var \ + --with-layout=GNU \ + --disable-debug \ + --mandir=/usr/share/man \ + --srcdir=../php-${pkgver} \ + --libdir=/usr/lib/php${_phpbase}${_suffix} \ + --datadir=/usr/share/php${_phpbase}${_suffix} \ + --program-suffix=${_phpbase}${_suffix} \ + --with-config-file-scan-dir=/${_build_conf_d} \ + --enable-filter \ + --with-pear \ + --enable-session \ + --with-mhash=/usr \ + --with-kerberos \ + --with-mysql-sock=${_build_mysql_socket} \ + --enable-mysqlnd-compression-support \ + --datarootdir=/usr/share/php${_phpbase}${_suffix} \ + --with-zlib \ + --with-libxml \ + --with-pcre-jit \ + --with-external-pcre=/usr \ + --with-password-argon2=/usr \ + --disable-rpath \ + --config-cache \ + --with-system-tzdata \ + --enable-phpdbg-readline \ + --with-libedit" +_phpextensions="\ + --enable-xml=shared \ + --with-xsl=shared \ + --enable-xmlreader=shared \ + --enable-xmlwriter=shared \ + --enable-dom=shared \ + --enable-simplexml=shared \ + --with-openssl=shared \ + --enable-pdo=shared \ + --enable-mysqlnd=shared \ + --with-mysqli=shared,mysqlnd \ + --with-pdo-mysql=shared,mysqlnd \ + --enable-phar=shared \ + --enable-pcntl=shared \ + --enable-posix=shared \ + --enable-shmop=shared \ + --enable-sockets=shared \ + --enable-sysvmsg=shared \ + --enable-sysvsem=shared \ + --enable-sysvshm=shared \ + --enable-tokenizer=shared + --enable-dba=shared \ + --with-db4=/usr \ + --without-gdbm \ + --with-cdb \ + --with-lmdb=/usr \ + --with-pgsql=shared,/usr \ + --with-pdo-pgsql=shared,/usr \ + --with-unixODBC=shared \ + --with-pdo-odbc=shared,unixODBC,/usr \ + --with-pdo-firebird=shared,/usr \ + --with-pdo-dblib=shared,/usr \ + --with-pdo-sqlite=shared,/usr \ + --with-sqlite3=shared \ + --enable-gd=shared \ + --with-external-gd=/usr \ + --with-jpeg \ + --with-xpm \ + --with-webp \ + --with-freetype \ + --enable-exif=shared \ + --with-tidy=shared,/usr \ + --with-iconv=shared \ + --enable-bcmath=shared \ + --with-gmp=shared,/usr \ + --with-zip=shared \ + --with-bz2=shared,/usr \ + --enable-json=shared \ + --enable-fileinfo=shared \ + --enable-ctype=shared \ + --enable-mbstring=shared \ + --with-onig=/usr \ + --enable-mbregex \ + --with-pspell=shared,/usr \ + --with-enchant=shared \ + --enable-intl=shared \ + --enable-calendar=shared \ + --with-gettext=shared,/usr \ + --enable-soap=shared \ + --enable-ftp=shared \ + --with-curl=shared \ + --with-snmp=shared,/usr \ + --with-ldap=shared,/usr \ + --with-ldap-sasl \ + --with-imap=shared,/usr \ + --with-imap-ssl=yes \ + --with-sodium=shared \ + --with-ffi=shared \ + --enable-opcache \ + --enable-huge-code-pages" +_phpextensions_fpm="\ + --with-fpm-user=http \ + --with-fpm-group=http \ + --with-fpm-systemd \ + --with-fpm-acl" + + +options=('!lto') +arch=("$CARCH") +checkdepends=('procps-ng' 'smtp-forwarder') license=('PHP') -url='https://www.php.net/' -makedepends=('apache' 'aspell' 'c-client' 'db' 'enchant' 'gd' 'gmp' 'icu' 'libsodium' 'libxslt' 'libzip' 'net-snmp' - 'postgresql-libs' 'sqlite' 'systemd' 'tidy' 'unixodbc' 'curl' 'libtool' 'smtp-forwarder' 'freetds' 'pcre2' 'libnsl' - 'oniguruma') -checkdepends=('procps-ng') -source=("https://php.net/distributions/${_pkgbase}-${pkgver}.tar.xz"{,.asc} - 'apache.patch' 'apache.conf' 'php-fpm.patch' 'php-fpm.tmpfiles' 'php.ini.patch' - 'phpize.m4.patch' 'enchant-2.patch') -sha256sums=('6c17172c4a411ccb694d9752de899bb63c72a0a3ebe5089116bc13658a1467b2' - 'SKIP' - 'b4ea038f2863801175d6c4e74c685913feecdd5be3d49aff7d9b3fa92d8c4159' - 'ebc0af1ef3a6baccb013d0ccb29923895a7b22ff2d032e3bba802dc6328301ce' - '299c6495f276b51cb05a3ffbdf365f8d40307fba748646998b0eea61af4eb827' - '696c2cfda2b10de542e4267d3ed245711e3eb6c7f4c7c4d1878e4d5de6f3140b' - '3a6d101962db9d311d9bba3b561b9dfd417701d9d2b607b70b9df218f6e029d7' - '354b1d5fd83e9902c6a4f7ca5d2101631bd67404f3c55a7194d9a6862656b479' - 'd94d22ad8bcd13829addda84e9de6b73fa04be9bc6da8622086c7e19c97ab724') - -validpgpkeys=('5A52880781F755608BF815FC910DEB46F53EA312' - '42670A7FE4D0441C8E4632349E4FDC074A4EF02D') +url='http://www.php.net' + +################################################################################ +# Prepare it +################################################################################ prepare() { - cd ${srcdir}/${_pkgbase}-${pkgver} + pushd "php-${pkgver}" + + echo "[SED] scripts/phpize.in" + sed -E "s|(includedir[\t ]*=.*/php)|\1${_phpbase}${_suffix}|g" \ + -i scripts/phpize.in + + echo "[SED] scripts/phpize.m4" + sed -e "s|\[php-config\]|\[php-config${_phpbase}${_suffix}\]|g" \ + -e "s|\(PHP_ARG_WITH(\[php-config\)${_phpbase}${_suffix}\]|\1]|g" \ + -e "s|php-config, no|php-config${_phpbase}${_suffix}, no|g" \ + -i "scripts/phpize.m4" + + echo "[SED] scripts/Makefile.frag" + sed -E "s|(phpincludedir[\t ]*=.*/php)|\1${_phpbase}${_suffix}|g" \ + -i scripts/Makefile.frag + + echo "[SED] scripts/php-config.in" + sed -E "s|(include_dir[\t ]*=.*php)|\1${_phpbase}${_suffix}|g" \ + -i scripts/php-config.in + + echo "[SED] sapi/apache2handler/config.m4" + sed -e '/APACHE_THREADED_MPM=/d' \ + -i sapi/apache2handler/config.m4 + + echo "[SED] sapi/fpm/Makefile.frag" + # sed -e 's#php-fpm\$(program_suffix)#php\$(program_suffix)-fpm#' + sed -e 's/.conf.default/.conf/g' \ + -i sapi/fpm/Makefile.frag + + echo "[SED] sapi/fpm/php-fpm.service.in" + sed -E "s|ExecStart[\s]?=[\s]?@([a-zA-Z_]+)@/php-fpm|ExecStart=@\1@/${_build_fpm_name}|g; \ + s|PIDFile[\s]?=[\s]?@([a-zA-Z_]+)@/run/php-fpm.pid|PIDFile=/run/${_build_fpm_service_name}/php-fpm.pid|g" \ + -i sapi/fpm/php-fpm.service.in - patch -p0 -i ${srcdir}/apache.patch - patch -p0 -i ${srcdir}/php-fpm.patch - patch -p0 -i ${srcdir}/php.ini.patch - patch -p0 -i ${srcdir}/phpize.m4.patch - patch -p0 -i ${srcdir}/enchant-2.patch - autoconf + local _check_files=("sapi/fpm/www.conf.in" "sapi/fpm/php-fpm.conf.in"); + for file_conf in "${_check_files[@]}"; do + if [[ ! -f $file_conf ]]; then + continue; + fi + echo "[SED] ${file_conf}" + sed -e "s#^listen =.*#listen = /run/${_build_fpm_service_name}/php-fpm.sock#" \ + -e "s#run/php-fpm.pid#/run/${_build_fpm_service_name}/php-fpm.pid#" \ + -e 's#^;*[ \t]*listen.owner =#listen.owner =#' \ + -e 's#^;*[ \t]*listen.group =#listen.group =#' \ + -e 's#^;*[ \t]*error_log =.*#error_log = syslog#' \ + -e 's#^;*[ \t]*chdir =.*#;chdir = /srv/http#' \ + -i "${file_conf}" + done - rm tests/output/stream_isatty_*.phpt + echo "[SED] php.ini-production" + sed -e 's#^;*[ \t]*extension_dir[\t ]*=.*/.*$#extension_dir = "___EXTENSIONDIR___"#' \ + -e "s#___EXTENSIONDIR___#/usr/lib/${pkgbase}/modules#g" \ + -e "s#^;*[ \t]*extension=#;extension=#g" \ + -e "s#^;*[ \t]*session.save_path[\t ]*=.*#session.save_path=___SESSIONS___#g" \ + -e "s#___SESSIONS___#/var/lib/${pkgbase}/sessions#g" \ + -i php.ini-production + + for patch_name in "${_patches[@]}"; do + echo "[PATCH] Applying source patch ${patch_name}"; + patch -p1 -i "../${patch_name}" + done + + if ((_phpbase <= 53)); then + PHP_AUTOCONF="/usr/bin/autoconf-2.13" ./buildconf --force + else + ./buildconf --force + fi + rm -f tests/output/stream_isatty_*.phpt + rm -f Zend/tests/arginfo_zpp_mismatch*.phpt + rm -f Zend/tests/bug79919.phpt + popd +} + +_build_sapi() { + _sapi="${1}" + _commands="${2}" + if (( _sapi == "cli" )); then + if [[ ! -d "build-${_sapi}" ]]; then + mkdir "build-${_sapi}" + fi + pushd "build-${_sapi}" + if [[ -L configure ]]; then + rm configure + fi + ln -s "../php-${pkgver}/configure" + popd + else + cp -Ta "build-cli" "build-${_sapi}" + fi + + pushd "build-${_sapi}" + ./configure ${_phpconfig} ${_commands} + patch -p1 -i "${srcdir}/make-tests.patch" + + if (($_sapi != "cli")); then + make clean + fi + if ((! _build_with_custom_icu)); then + sed -i -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \ + -e 's|^runpath_var=LD_RUN_PATH|runpath_var=LIBTOOL_IS_BROKED|g' \ + libtool + fi + make + popd } +################################################################################ +# BUILD them all +################################################################################ build() { - # http://site.icu-project.org/download/61#TOC-Migration-Issues - CPPFLAGS+=' -DU_USING_ICU_NAMESPACE=1' - - local _phpconfig="--srcdir=../${_pkgbase}-${pkgver} \ - --config-cache \ - --prefix=/usr \ - --sbindir=/usr/bin \ - --sysconfdir=/etc/${pkgbase} \ - --localstatedir=/var \ - --libdir=/usr/lib/${pkgbase} \ - --datarootdir=/usr/share/${pkgbase} \ - --datadir=/usr/share/${pkgbase} \ - --program-suffix=${pkgbase#php} \ - --with-layout=GNU \ - --with-config-file-path=/etc/${pkgbase} \ - --with-config-file-scan-dir=/etc/${pkgbase}/conf.d \ - --disable-rpath \ - --mandir=/usr/share/man \ - --without-pear \ - " - - local _phpextensions="\ - --enable-bcmath=shared \ - --enable-calendar=shared \ - --enable-dba=shared \ - --enable-exif=shared \ - --enable-ftp=shared \ - --enable-gd=shared \ - --enable-intl=shared \ - --enable-mbstring \ - --enable-pcntl \ - --enable-shmop=shared \ - --enable-soap=shared \ - --enable-sockets=shared \ - --enable-sysvmsg=shared \ - --enable-sysvsem=shared \ - --enable-sysvshm=shared \ - --with-bz2=shared \ - --with-curl=shared \ - --with-db4=/usr \ - --with-enchant=shared,/usr \ - --with-external-gd \ - --with-external-pcre \ - --with-ffi=shared,/usr \ - --with-gdbm \ - --with-gettext=shared \ - --with-gmp=shared \ - --with-iconv=shared \ - --with-imap-ssl \ - --with-imap=shared \ - --with-kerberos=/usr \ - --with-ldap=shared \ - --with-ldap-sasl \ - --with-mhash \ - --with-mysql-sock=/run/mysqld/mysqld.sock \ - --with-mysqli=shared,mysqlnd \ - --with-openssl \ - --with-password-argon2 \ - --with-pdo-dblib=shared,/usr \ - --with-pdo-mysql=shared,mysqlnd \ - --with-pdo-odbc=shared,unixODBC,/usr \ - --with-pdo-pgsql=shared \ - --with-pdo-sqlite=shared,/usr \ - --with-pgsql=shared \ - --with-pspell=shared \ - --with-readline \ - --with-snmp=shared \ - --with-sodium=shared \ - --with-sqlite3=shared,/usr \ - --with-tidy=shared \ - --with-unixODBC=shared,/usr \ - --with-xmlrpc=shared \ - --with-xsl=shared \ - --with-zip=shared \ - --with-zlib \ - " - - EXTENSION_DIR=/usr/lib/${pkgbase}/modules - export EXTENSION_DIR - - mkdir ${srcdir}/build - cd ${srcdir}/build - ln -s ../${_pkgbase}-${pkgver}/configure - ./configure ${_phpconfig} \ - --enable-cgi \ - --enable-fpm \ - --with-fpm-systemd \ - --with-fpm-acl \ - --with-fpm-user=http \ - --with-fpm-group=http \ - --enable-embed=shared \ - ${_phpextensions} - make - - # apache - # reuse the previous run; this will save us a lot of time - cp -a ${srcdir}/build ${srcdir}/build-apache - cd ${srcdir}/build-apache - ./configure ${_phpconfig} \ - --with-apxs2 \ - ${_phpextensions} - make - - # phpdbg - cp -a ${srcdir}/build ${srcdir}/build-phpdbg - cd ${srcdir}/build-phpdbg - ./configure ${_phpconfig} \ - --enable-phpdbg \ - ${_phpextensions} - make + export CFLAGS="${CFLAGS} -fPIC" + export CXXFLAGS="${CXXFLAGS} -fPIC" + export EXTENSION_DIR="/usr/lib/${pkgbase}/modules" + if ((_build_openssl_v10_patch)); then + export PHP_OPENSSL_DIR="/usr/lib/openssl-1.0" + export PKG_CONFIG_PATH="/usr/lib/openssl-1.0/pkgconfig" + elif ((_build_forced_openssl_11)); then + export PHP_OPENSSL_DIR="/usr/lib/openssl-1.1" + export PKG_CONFIG_PATH="/usr/lib/openssl-1.1/pkgconfig" + fi + if [[ ! -z "${_cppflags}" ]]; then + CPPFLAGS+=" $_cppflags " + fi + if ((_build_with_custom_icu )); then + local _php5_icu_first="${srcdir}/${_build_icu_src_dir}/php${_phpbase}${suffix}-icu${_pkgver_icu}" + LDFLAGS+="-Wl,-rpath=$ORIGIN/usr/lib/${pkgbase}/icu${_pkgver_icu}/lib" + _phpextensions+=" --with-icu-dir=${_php5_icu_first} " + if [[ ! -d $_php5_icu_first ]]; then + mkdir -p "${_php5_icu_first}" + fi + pushd "${_build_icu_src_dir}" + ./configure --prefix="${_php5_icu_first}" \ + --sysconfdir="${_php5_icu_first}/etc" \ + --mandir="${_php5_icu_first}/share/man" \ + --sbindir="${_php5_icu_first}/bin" \ + --libdir="${_php5_icu_first}/lib" \ + --includedir="${_php5_icu_first}/include" \ + --disable-tests \ + --disable-debug + make -j$(nproc) + make install + ./configure --prefix="/usr/lib/${pkgbase}/icu${_pkgver_icu}" \ + --sysconfdir="/usr/lib/${pkgbase}/icu${_pkgver_icu}/etc" \ + --mandir="/usr/lib/${pkgbase}/icu${_pkgver_icu}/share/man" \ + --sbindir="/usr/lib/${pkgbase}/icu${_pkgver_icu}/bin" \ + --libdir="/usr/lib/${pkgbase}/icu${_pkgver_icu}/lib" \ + --includedir="/usr/lib/${pkgbase}/icu${_pkgver_icu}/include" \ + --disable-tests \ + --disable-debug + make -j$(nproc) + popd + fi + + if ((_build_ini_per_sapi || _build_per_sapi)); then + + # CLI + _cli_addons='' + if (( ! _build_per_sapi )); then + # CGI enabled here only for tests passing, then overriden later by cgi build + _cli_addons+=" --enable-cgi " + fi + _build_sapi "cli" "\ + --sysconfdir=/${_build_sapi_ini_cli} \ + --with-config-file-path=/${_build_sapi_ini_cli} \ + --enable-cli \ + ${_phpextensions} \ + ${_cli_addons} \ + --disable-fpm \ + --disable-embed \ + --disable-phpdbg \ + " + + # phpdbg + if ((_build_phpdbg)); then + _sapi="phpdbg" + _build_sapi "phpdbg" "\ + --sysconfdir=/${_build_sapi_ini_phpdbg} \ + --with-config-file-path=/${_build_sapi_ini_phpdbg} \ + --disable-all \ + --enable-phpdbg \ + --disable-cgi \ + --disable-cli \ + --disable-fpm \ + --disable-embed \ + " + fi + + # embed + _build_sapi "embed" "\ + --sysconfdir=/${_build_sapi_ini_embed} \ + --with-config-file-path=/${_build_sapi_ini_embed} \ + --disable-all \ + --enable-embed=shared \ + --disable-cgi \ + --disable-cli \ + --disable-fpm \ + --disable-phpdbg \ + " + + # cgi + _build_sapi "cgi" "\ + --sysconfdir=/${_build_sapi_ini_cgi} \ + --with-config-file-path=/${_build_sapi_ini_cgi} \ + --disable-all \ + --enable-cgi \ + --disable-cli \ + --disable-fpm \ + --disable-embed \ + --disable-phpdbg \ + " + + # litespeed + _cflags="${CFLAGS}" + export CFLAGS="${CFLAGS} -Wno-error=format-security" + _build_sapi "litespeed" "\ + --sysconfdir=/${_build_sapi_ini_litespeed} \ + --with-config-file-path=/${_build_sapi_ini_litespeed} \ + --disable-all \ + --disable-cgi \ + --disable-cli \ + --disable-fpm \ + --disable-embed \ + --disable-phpdbg \ + ${_build_sapi_litespeed} \ + " + export CFLAGS="${_cflags}" + + # fpm + _build_sapi "fpm" "\ + --sysconfdir=/${_build_sapi_ini_fpm} \ + --with-config-file-path=/${_build_sapi_ini_fpm} \ + --disable-all \ + --enable-fpm \ + ${_phpextensions_fpm} \ + --disable-cli \ + --disable-cgi \ + --disable-embed \ + --disable-phpdbg \ + " + else + + # CLI + if ((_build_phpdbg)); then + _cli_addons+=" --enable-phpdbg " + fi + _build_sapi "cli" "\ + --sysconfdir=/${_build_sapi_ini_cli} \ + --with-config-file-path=/${_build_sapi_ini_cli} \ + --enable-cli \ + ${_phpextensions} \ + ${_cli_addons} \ + --enable-fpm \ + --enable-cgi \ + --enable-embed=shared \ + --enable-fpm \ + ${_phpextensions_fpm} \ + ${_build_sapi_litespeed} \ + " + fi + + # apache + _build_sapi "apache" "\ + --disable-all \ + --disable-cli \ + --disable-cgi \ + --disable-fpm \ + --disable-embed \ + --disable-phpdbg \ + --with-apxs2 \ + --sysconfdir=/${_build_sapi_ini_apache} \ + --with-config-file-path=/${_build_sapi_ini_apache} \ + " + } check() { - cd ${srcdir}/${_pkgbase}-${pkgver} + export CFLAGS="${CFLAGS} -fPIC" + export CXXFLAGS="${CXXFLAGS} -fPIC" + pushd "build-cli" + # Check if sendmail was configured correctly (FS#47600) + export REPORT_EXIT_STATUS=1 + export NO_INTERACTION=1 + export SKIP_ONLINE_TESTS=1 + export SKIP_SLOW_TESTS=1 + export TESTS='tests Zend' + if ((_phpbase > 73)); then + export TEST_PHP_ARGS="-j$(nproc)" + fi + # Patch tests to run PHP modules in needed order + sapi/cli/php -n ../php-makefile-patcher.php Makefile + make test + popd +} - # Check if sendmail was configured correctly (FS#47600) - ${srcdir}/build/sapi/cli/php -n -r 'echo ini_get("sendmail_path");' | grep -q '/usr/bin/sendmail' +################################################################################ +# Custom code +################################################################################ +_install_module_ini() { + local extension=$(echo "${1}" | sed 's/\.so//') + local priority="${_priority_default}" + case "${extension}" in + "json") + priority="${_priority_json}" + ;; + "xml") + priority="${_priority_xml}" + ;; + "openssl") + priority="${_priority_openssl}" + ;; + "mysqlnd") + priority="${_priority_mysqlnd}" + ;; + "pdo") + priority="${_priority_pdo}" + ;; + "opcache") + priority="${_priority_opcache}" + ;; + "dom") + priority="${_priority_dom}" + ;; + esac + local extension_type="extension" + case "${extension}" in + "opcache" | "xdebug") + extension_type="zend_extension" + ;; + "recode") + extension_type=";extension" + ;; + esac - export REPORT_EXIT_STATUS=1 - export NO_INTERACTION=1 - export SKIP_ONLINE_TESTS=1 - export SKIP_SLOW_TESTS=1 - export TEST_PHP_ARGS="-j$(nproc)" - export TESTS='tests Zend' + if [[ ! -d "${pkgdir}/${_build_conf_d}" ]]; then + mkdir -p "${pkgdir}/${_build_conf_d}" + fi + echo "${extension_type}=${extension}.so" > "${pkgdir}/${_build_conf_d}/${priority}-${extension}.ini" + chmod 0644 "$pkgdir/${_build_conf_d}/${priority}-${extension}.ini" + _last_priority=${priority} + _last_extension=${extension} +} - ${srcdir}/build/sapi/cli/php -n run-tests.php -n -P {tests,Zend} +_install_module() { + if [[ -f "build-cli/modules/${1}.so" ]]; then + install -D -m755 "build-cli/modules/${1}.so" "${pkgdir}/usr/lib/${pkgbase}/modules/${1}.so"; + _install_module_ini "${1}" + else + echo "[DEBUG]: Install_module can't find ${1}.so, skipped" + fi } +############################################################################### +# PHP: SAPI's +############################################################################### + +# Main package package_php74() { - pkgdesc='A general-purpose scripting language that is especially suited to web development' - depends=('libxml2' 'curl' 'libzip' 'pcre2' 'argon2' 'oniguruma') - backup=("etc/${pkgbase}/php.ini") + # Binary names + pkgdesc='PHP. A general-purpose scripting language that is especially suited to web development' + depends=('zlib' 'pcre' 'libedit') + if ((_build_with_custom_icu)); then + pushd "${_build_icu_src_dir}" + make DESTDIR="${pkgdir}" install + popd + pushd "${pkgdir}/usr/lib/${pkgbase}/icu${_pkgver_icu}" + rm -rf bin include share + popd + fi - cd ${srcdir}/build - make -j1 INSTALL_ROOT=${pkgdir} install-{modules,cli,build,headers,programs,pharcmd} - install -D -m644 ${srcdir}/${_pkgbase}-${pkgver}/php.ini-production ${pkgdir}/etc/${pkgbase}/php.ini - install -d -m755 ${pkgdir}/etc/${pkgbase}/conf.d/ + # Install session dir + install -d -m1733 "${pkgdir}/var/lib/${pkgbase}/sessions" - # remove static modules - rm -f ${pkgdir}/usr/lib/${pkgbase}/modules/*.a - # remove modules provided by sub packages - rm -f ${pkgdir}/usr/lib/${pkgbase}/modules/{enchant,gd,imap,intl,sodium,odbc,pdo_dblib,pdo_odbc,pgsql,pdo_pgsql,pspell,snmp,sqlite3,pdo_sqlite,tidy,xsl}.so - # remove empty directory - rmdir ${pkgdir}/usr/include/php/include + # conf.d dir with shared modules + install -d -m755 "${pkgdir}/${_build_conf_d}/" - # move include directory - mv ${pkgdir}/usr/include/php ${pkgdir}/usr/include/${pkgbase} + pushd "build-cli" + make -j1 INSTALL_ROOT=${pkgdir} install-{modules,build,headers,programs} + # Cleanup for CGI" + rm -rf "${pkgdir}/usr/bin/${pkgbase}-cgi" + popd - # create phar74 symlink - ln -sf phar74.phar ${pkgdir}/usr/bin/phar74 + pushd "${pkgdir}/usr/lib/${pkgbase}/modules/" + # remove static modules + rm -f *.a + # remove modules provided by subpackages + rm -f {enchant,imap,intl,pspell,snmp,tidy,curl,ldap,bz2,bcmath,soap,zip,gmp,dba,opcache,json,gd,mcrypt,sodium,recode}.so + rm -f {pdo_dblib,mssql}.so + rm -f {dom,simplexml,xml,xmlreader,xmlwriter,xsl,wddx,xmlrpc}.so + rm -f {pgsql,pdo_pgsql}.so + rm -f {odbc,pdo_odbc}.so + rm -f {pdo_sqlite,sqlite3}.so + rm -f {pdo_firebird.so,interbase.so} + rm -f {mysqli,pdo_mysql,mysqlnd,mysql}.so + rm -f {openssl,ffi,pcntl,ftp,calendar,ctype,fileinfo,iconv,mbstring,exif,pdo,phar,posix,shmop}.so + rm -f {sockets,tokenizer,gettext,sysvmsg,sysvsem,sysvshm}.so + popd + pushd build-cli + if (( ! _build_ini_per_sapi )); then + backup=("${_build_sapi_ini_cli}/php.ini") + install -d -m755 "${pkgdir}/${_build_sapi_ini_cli}" + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_cli}/php.ini" + fi + popd +} - # fix paths in executables - sed -i "/^includedir=/c \includedir=/usr/include/${pkgbase}" ${pkgdir}/usr/bin/phpize74 - sed -i "/^include_dir=/c \include_dir=/usr/include/${pkgbase}" ${pkgdir}/usr/bin/php-config74 +# Cli + phar +package_php74-cli() { + _sapi="cli" + pkgdesc="cli (command-line executable) version for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + depends+=("${_sapi_depends[@]}") + pushd "build-${_sapi}" + make -j1 INSTALL_ROOT="${pkgdir}" install-cli + make -j1 INSTALL_ROOT="${pkgdir}" install-pharcmd + if ((_build_ini_per_sapi)); then + backup=("${_build_sapi_ini_cli}/php.ini") + install -d -m755 "${pkgdir}/${_build_sapi_ini_cli}" + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_cli}/php.ini" + fi + # Cleanup for CGI + rm -rf "${pkgdir}/usr/bin/${pkgbase}-cgi" + popd } +# End cli +# CGI package_php74-cgi() { - pkgdesc='CGI and FCGI SAPI for PHP' - depends=("${pkgbase}") - - cd ${srcdir}/build - make -j1 INSTALL_ROOT=${pkgdir} install-cgi + _sapi="cgi" + pkgdesc="CGI and FCGI SAPI for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + depends+=("${_sapi_depends[@]}") + if ((_build_ini_per_sapi || _build_per_sapi)); then + pushd "build-${_sapi}" + else + pushd "build-cli" + fi + if ((_build_ini_per_sapi)); then + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_cgi}/php.ini" + backup=("${_build_sapi_ini_cgi}/php.ini") + fi + case "${_phpbase}" in + 53 | 54) + install -D -m755 sapi/cgi/php-cgi "${pkgdir}/usr/bin/${pkgbase}-cgi" + ;; + *) + make -j1 INSTALL_ROOT="${pkgdir}" install-cgi + ;; + esac + popd } +# CGI end +# Apache package_php74-apache() { - pkgdesc='Apache SAPI for PHP' - depends=("${pkgbase}" 'apache' 'libnsl') - backup=("etc/httpd/conf/extra/${pkgbase}_module.conf") + _sapi="apache" + _build_mod_php_so="libphp${_suffix_so}.so" + _build_mod_php_module="php${_suffix_so}_module" + _build_build_php_script_name="php${_suffix_so}-script" + _apache_module_conf="${pkgbase}-module.conf" + pkgdesc="Apache SAPI for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'apache') + depends+=("${_sapi_depends[@]}") + depends+=('libxcrypt'); + depends+=('ncurses'); + backup=("${_build_apache_cfg}/${_apache_module_conf}") + echo "# End of LoadModule in httpd.conf - see ArchWiki Apache HTTP Server" + echo "LoadModule ${_build_mod_php_module} modules/lib${pkgbase}.so" + echo "AddHandler ${_build_php_script_name} .php" + echo "# End of Include List" + echo "Include conf/extra/${_apache_module_conf}" + + pushd "build-${_sapi}" + if ((_build_ini_per_sapi)); then + backup+=("${_build_sapi_ini_apache}/php.ini") + install -d -m755 "${pkgdir}/${_build_sapi_ini_apache}" + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_apache}/php.ini" + fi + install -D -m755 "libs/${_build_mod_php_so}" "${pkgdir}/usr/lib/httpd/modules/lib${pkgbase}.so" + patchelf --set-soname \ + "lib${pkgbase}.so" \ + "${pkgdir}/usr/lib/httpd/modules/lib${pkgbase}.so" + popd - install -D -m755 ${srcdir}/build-apache/libs/libphp7.so ${pkgdir}/usr/lib/httpd/modules/lib${pkgbase}.so - install -D -m644 ${srcdir}/apache.conf ${pkgdir}/etc/httpd/conf/extra/${pkgbase}_module.conf + install -D -m644 "php-apache.conf" "${pkgdir}/${_build_apache_cfg}/${_apache_module_conf}" + echo "[SED] ${pkgdir}/${_build_apache_cfg}/${_apache_module_conf}" + sed -e "s#@MODULE@#${_build_mod_php_module}#" \ + -i "${pkgdir}/${_build_apache_cfg}/${_apache_module_conf}" } +# Apache end +# FPM package_php74-fpm() { - pkgdesc='FastCGI Process Manager for PHP' - depends=("${pkgbase}" 'systemd') - backup=("etc/${pkgbase}/php-fpm.conf" "etc/${pkgbase}/php-fpm.d/www.conf") - options=('!emptydirs') - - cd ${srcdir}/build - make -j1 INSTALL_ROOT=${pkgdir} install-fpm - install -D -m644 sapi/fpm/php-fpm.service ${pkgdir}/usr/lib/systemd/system/${pkgbase}-fpm.service - install -D -m644 ${srcdir}/php-fpm.tmpfiles ${pkgdir}/usr/lib/tmpfiles.d/${pkgbase}-fpm.conf + _sapi="fpm" + install="php-fpm.install" + pkgdesc="FastCGI Process Manager for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'systemd-libs' 'acl') + depends+=("${_sapi_depends[@]}") + backup=("${_build_sapi_ini_fpm}/php-fpm.conf") + if ((_phpbase >= 70)); then + backup+=("${_build_sapi_ini_fpm}/php-fpm.d/www.conf") + fi + options=('!emptydirs') + if ((_build_ini_per_sapi || _build_per_sapi)); then + pushd "build-${_sapi}" + else + pushd "build-cli" + fi + if ((_build_ini_per_sapi)); then + backup+=("${_build_sapi_ini_fpm}/php.ini") + install -d -m755 "${pkgdir}/${_build_sapi_ini_fpm}/" + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_fpm}/php.ini" + fi + make -j1 INSTALL_ROOT="${pkgdir}" install-fpm + install -D -m644 "sapi/fpm/php-fpm.service" "${pkgdir}/usr/lib/systemd/system/${_build_fpm_service_name}.service" + echo "d /run/${_build_fpm_service_name} 755 root root" > php-fpm.tmpfiles + install -D -m644 "php-fpm.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/${_build_fpm_service_name}.conf" + popd } +# FPM end +# embed sapi package_php74-embed() { - pkgdesc='Embedded PHP SAPI library' - depends=("${pkgbase}" 'systemd-libs' 'libnsl') - options=('!emptydirs') - - cd ${srcdir}/build - make -j1 INSTALL_ROOT=${pkgdir} PHP_SAPI=embed install-sapi - mv ${pkgdir}/usr/lib/libphp7.so ${pkgdir}/usr/lib/libphp-74.so + _sapi="embed" + pkgdesc="Embedded PHP SAPI library for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'ncurses' 'systemd-libs' 'libxcrypt' 'acl' 'ncurses') + depends+=("${_sapi_depends[@]}") + options=('!emptydirs') + if ((_build_ini_per_sapi || _build_per_sapi)); then + pushd "build-${_sapi}" + else + pushd "build-cli" + fi + install -d -m755 "${pkgdir}/${_build_sapi_ini_embed}" + if ((_build_ini_per_sapi)); then + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_embed}/php.ini" + backup=("${_build_sapi_ini_embed}/php.ini") + fi + make -j1 INSTALL_ROOT="${pkgdir}" PHP_SAPI=embed install-sapi + mv "${pkgdir}/usr/lib/libphp${_suffix_so}.so" "${pkgdir}/usr/lib/lib${pkgbase}.so" + popd + patchelf --set-soname "lib${pkgbase}.so" "${pkgdir}/usr/lib/lib${pkgbase}.so" } +# embed sapi end +# phpdbg sapi package_php74-phpdbg() { - pkgdesc='Interactive PHP debugger' - depends=("${pkgbase}") - options=('!emptydirs') + _sapi="phpdbg" + options=('!emptydirs') + pkgdesc="Interactive PHP debugger for ${pkgbase} ($_sapi)" + depends=("${pkgbase}=${pkgver}") + depends+=("${_sapi_depends[@]}") + if ((_build_ini_per_sapi || _build_per_sapi)); then + pushd "build-${_sapi}" + else + pushd "build-cli" + fi + if ((_build_ini_per_sapi)); then + backup=("${_build_sapi_ini_phpdbg}/php.ini") + install -d -m755 "${pkgdir}/${_build_sapi_ini_phpdbg}" + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_phpdbg}/php.ini" + fi + make -j1 INSTALL_ROOT="${pkgdir}" "install-${_sapi}" + popd +} +# phpdbg sapi end - cd ${srcdir}/build-phpdbg - make -j1 INSTALL_ROOT=${pkgdir} install-phpdbg +# litespeed sapi +package_php74-litespeed() { + _sapi="litespeed" + pkgdesc="LiteSpeed SAPI for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + depends+=("${_sapi_depends[@]}") + if ((_build_ini_per_sapi || _build_per_sapi)); then + pushd "build-${_sapi}" + else + pushd "build-cli" + fi + if ((_build_ini_per_sapi)); then + install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/${_build_sapi_ini_cgi}/php.ini" + backup=("${_build_sapi_ini_cgi}/php.ini") + fi + case "${_phpbase}" in + *) + install -D -m755 sapi/litespeed/php "${pkgdir}/usr/bin/ls${pkgbase}" + ;; + esac + popd } +# litespeed sapi end -package_php74-dblib() { - pkgdesc='dblib module for PHP' - depends=("${pkgbase}" 'freetds') +############################################################################### +# PEAR + PECL +############################################################################### + +# PEAR +package_php74-pear() { + pkgdesc="PHP Extension and Application Repository (PEAR) for ${pkgbase}" + depends=( + "${pkgbase}=${pkgver}" + "php${_phpbase}-xml${_suffix}=${pkgver}" + "php${_phpbase}-cli${_suffix}=${pkgver}" + "php${_phpbase}-phar${_suffix}=${pkgver}" + ) + #backup=("${_build_sapi_ini_cli}/pear.conf") + install -d "${pkgdir}/usr/share/${pkgbase}/pear/htdocs" + install -d "${pkgdir}/usr/share/${pkgbase}/pear/data" + install -d "${pkgdir}/usr/share/${pkgbase}/pear/doc" + install -d "${pkgdir}/usr/share/${pkgbase}/pear/test" + install -d "${pkgdir}/usr/share/${pkgbase}/pear/cfg" + install -d "${pkgdir}/var/lib/${pkgbase}/pear/cache" + install -d "${pkgdir}/var/lib/${pkgbase}/pear/metadata" + install -d "${pkgdir}/var/lib/${pkgbase}/pear/download" + install -d "${pkgdir}/var/lib/${pkgbase}/pear/temp" + export PHP_PEAR_SYSCONF_DIR="${_build_sapi_ini_cli}" + pushd build-cli + + cp "${srcdir}/php-${pkgver}/pear/install-pear-nozlib.phar" "pear/install-pear-nozlib.phar" - install -D -m755 ${srcdir}/build/modules/pdo_dblib.so ${pkgdir}/usr/lib/${pkgbase}/modules/pdo_dblib.so + INSTALL_ROOT="${pkgdir}/" ./sapi/cli/php -n \ + -d extension=modules/xml.so \ + -d extension=modules/phar.so \ + -d date.timezone=UTC -d memory_limit=64M -d short_open_tag=0 -d safe_mode=0 \ + -d 'error_reporting=E_ALL&~E_DEPRECATED' -d detect_unicode=0 "pear/install-pear-nozlib.phar" \ + -ds "${_phpbase}${_suffix}" \ + --php "/usr/bin/${pkgbase}" \ + --bin "/usr/bin" \ + --man "/usr/share/man" \ + --dir "/usr/share/${pkgbase}/pear" \ + --data "/usr/share/${pkgbase}/pear/data" \ + --doc "/usr/share/${pkgbase}/pear/doc" \ + --test "/usr/share/${pkgbase}/pear/test" \ + --www "/usr/share/${pkgbase}/pear/htdocs" \ + --config "/usr/share/${pkgbase}/pear/cfg" \ + --force + # fix pear.conf with unserialize + # first arg: path to pear.conf + # second arg: PEAR base /var path + ./sapi/cli/php -n ../pear-config-patcher.php \ + "${pkgdir}/${_build_sapi_ini_cli}/pear.conf" \ + "/var/lib/${pkgbase}/pear" + popd + # remove unneeded files + rm -rf "${pkgdir}"/.{channels,depdb,depdblock,filemap,lock,registry} + #rename binaries + for i in pear peardev pecl; do + _target="${pkgbase/php/$i}" + # fix hardcoded paths + sed "s|PHP=php|PHP=\"/usr/bin/${pkgbase}\"|g; s|\"/usr/bin/php\"|\"/usr/bin/${pkgbase}\"|g; s| -n | |g" \ + -i "${pkgdir}/usr/bin/${i}" + if [[ "$i" == "pecl" ]]; then + echo "Moving ${pkgdir}/usr/bin/${i} => ${srcdir}/${pkgbase}-pecl-bin/" + mkdir -p "${srcdir}/${pkgbase}-pecl-bin/" + mv "${pkgdir}/usr/bin/pecl" "${srcdir}/${pkgbase}-pecl-bin/" + else + echo "Moving ${pkgdir}/usr/bin/${i} => ${pkgdir}/usr/bin/${_target}" + mv "${pkgdir}/usr/bin/${i}" "${pkgdir}/usr/bin/${_target}" + fi + done } +# PEAR end -package_php74-enchant() { - pkgdesc='enchant module for PHP' - depends=("${pkgbase}" 'enchant') +# PECL +package_php74-pecl() { + pkgdesc="PHP Extension Community Library (PECL) for ${pkgbase}" + depends=("php${_phpbase}-pear${_suffix}=${pkgver}") + _target="${pkgbase/php/pecl}" + install -D -m755 "${srcdir}/${pkgbase}-pecl-bin/pecl" "${pkgdir}/usr/bin/${_target}" +} +# PECL end - install -D -m755 ${srcdir}/build/modules/enchant.so ${pkgdir}/usr/lib/${pkgbase}/modules/enchant.so +############################################################################### +# PHP Modules: First need +############################################################################### + +# OpenSSL +package_php74-openssl() { + pkgdesc="OpenSSL module for ${pkgbase}" + depends=("${_ext_depends_openssl[@]}") + _install_module openssl } -package_php74-gd() { - pkgdesc='gd module for PHP' - depends=("${pkgbase}" 'gd') +# Json +package_php74-json() { + pkgdesc="json module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module json +} - install -D -m755 ${srcdir}/build/modules/gd.so ${pkgdir}/usr/lib/${pkgbase}/modules/gd.so +# pdo +package_php74-pdo() { + pkgdesc="pdo module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module pdo } -package_php74-imap() { - pkgdesc='imap module for PHP' - depends=("${pkgbase}" 'c-client') - install -D -m755 ${srcdir}/build/modules/imap.so ${pkgdir}/usr/lib/${pkgbase}/modules/imap.so +# mbstring +package_php74-mbstring() { + pkgdesc="mbstring module for ${pkgbase}" + depends=("${_ext_depends_mbstring[@]}") + _install_module mbstring } -package_php74-intl() { - pkgdesc='intl module for PHP' - depends=("${pkgbase}" 'icu') - install -D -m755 ${srcdir}/build/modules/intl.so ${pkgdir}/usr/lib/${pkgbase}/modules/intl.so +# phar +package_php74-phar() { + pkgdesc="phar module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module phar } -package_php74-sodium() { - pkgdesc='sodium module for PHP' - depends=("${pkgbase}" 'libsodium') - install -D -m755 ${srcdir}/build/modules/sodium.so ${pkgdir}/usr/lib/${pkgbase}/modules/sodium.so +############################################################################### +# PHP modules: XML +############################################################################### + +# XML modules combined package +package_php74-xml() { + pkgdesc="xml modules for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libxml2') + _install_module xml } -package_php74-odbc() { - pkgdesc='ODBC modules for PHP' - depends=("${pkgbase}" 'unixodbc') +package_php74-wddx() { + pkgdesc="wddx module for ${pkgbase}" + depends=("php${_phpbase}-xml${_suffix}=${pkgver}") + _install_module wddx +} + +package_php74-simplexml() { + pkgdesc="simplexml module for ${pkgbase}" + depends=("php${_phpbase}-xml${_suffix}=${pkgver}") + _install_module simplexml +} + +package_php74-dom() { + pkgdesc="dom module for ${pkgbase}" + depends=("php${_phpbase}-xml${_suffix}=${pkgver}") + _install_module dom +} + +package_php74-xmlreader() { + pkgdesc="xmlreader module for ${pkgbase}" + depends=("php${_phpbase}-xml${_suffix}=${pkgver}") + _install_module xmlreader +} - install -D -m755 ${srcdir}/build/modules/odbc.so ${pkgdir}/usr/lib/${pkgbase}/modules/odbc.so - install -D -m755 ${srcdir}/build/modules/pdo_odbc.so ${pkgdir}/usr/lib/${pkgbase}/modules/pdo_odbc.so +package_php74-xmlwriter() { + pkgdesc="xmlwriter module for ${pkgbase}" + depends=("php${_phpbase}-xml${_suffix}=${pkgver}") + _install_module xmlwriter } +# Tidy +package_php74-tidy() { + pkgdesc="tidy module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'tidy') + _install_module tidy +} + +# XSL +package_php74-xsl() { + pkgdesc="xsl module for ${pkgbase}" + depends=("php${_phpbase}-xml${_suffix}=${pkgver}" "php${_phpbase}-dom${_suffix}=${pkgver}") + depends+=('libxslt') + _install_module xsl +} + +############################################################################### +# PHP modules: Databases +############################################################################### + +# MySQL +package_php74-mysql() { + pkgdesc="MySQL modules for ${pkgbase}" + depends=("${_ext_depends_mysql[@]}") + _install_module mysqlnd + _install_module mysql + _install_module mysqli + _install_module pdo_mysql +} + +# pdo_sqlite + sqlite3 +package_php74-sqlite() { + pkgdesc="sqlite module for ${pkgbase}" + depends=("${_ext_depends_sqlite[@]}") + _install_module sqlite3 + _install_module pdo_sqlite +} + +# ODBC +package_php74-odbc() { + pkgdesc="ODBC modules for ${pkgbase}" + depends=("${_ext_depends_odbc[@]}") + _install_module odbc + _install_module pdo_odbc +} + +# PostgreSQL package_php74-pgsql() { - pkgdesc='PostgreSQL modules for PHP' - depends=("${pkgbase}" 'postgresql-libs') + pkgdesc="PostgreSQL modules for ${pkgbase}" + depends=("${_ext_depends_pgsql[@]}") + _install_module pgsql + _install_module pdo_pgsql +} + +# interbase +package_php74-interbase() { + pkgdesc="interbase module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" "libfbclient") + _install_module interbase +} + +# firebird +package_php74-firebird() { + pkgdesc="pdo_firebird module for ${pkgbase}" + depends=("${_ext_depends_firebird[@]}") + _install_module pdo_firebird +} + +# pdo_dblib +package_php74-dblib() { + depends=("${pkgbase}=${pkgver}" 'freetds') + pkgdesc="pdo_dblib module for ${pkgbase}" + _install_module pdo_dblib +} + +# mssql +package_php74-mssql() { + depends=("${pkgbase}=${pkgver}" 'freetds') + pkgdesc="mssql module for ${pkgbase}" + _install_module mssql +} + +# Dba +package_php74-dba() { + pkgdesc="dba module for ${pkgbase}" + depends=("${_ext_depends_dba[@]}") + _install_module dba +} + +############################################################################### +# PHP Modules: internationalization, text, datetime +############################################################################### + +# Intl +package_php74-intl() { + pkgdesc="intl module for ${pkgbase}" + depends=("${_ext_depends_intl[@]}") + if ((_build_with_custom_icu)); then + # Patch to proper path inside intl.so + patchelf --set-rpath "/usr/lib/${pkgbase}/icu${_pkgver_icu}/lib" "build-cli/modules/intl.so" + fi + _install_module intl +} + +# Recode +package_php74-recode() { + pkgdesc="recode module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'recode') + _install_module recode +} + +# gettext +package_php74-gettext() { + pkgdesc="gettext module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module gettext +} + +# iconv +package_php74-iconv() { + pkgdesc="iconv module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module iconv +} + +# calendar +package_php74-calendar() { + pkgdesc="calendar module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module calendar +} + + +############################################################################### +# PHP Modules: multimedia +############################################################################### + +# GD +package_php74-gd() { + pkgdesc="gd module for ${pkgbase}" + depends=("${_ext_depends_gd[@]}") + _install_module gd +} - install -D -m755 ${srcdir}/build/modules/pgsql.so ${pkgdir}/usr/lib/${pkgbase}/modules/pgsql.so - install -D -m755 ${srcdir}/build/modules/pdo_pgsql.so ${pkgdir}/usr/lib/${pkgbase}/modules/pdo_pgsql.so +# exif +package_php74-exif() { + pkgdesc="exif module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module exif } +# fileinfo +package_php74-fileinfo() { + pkgdesc="fileinfo module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module fileinfo +} + + +############################################################################### +# PHP modules: math +############################################################################### + +# bcmath +package_php74-bcmath() { + pkgdesc="bcmath module for ${pkgbase}" + depends=("${pkgbase}") + _install_module bcmath +} + +# gmp +package_php74-gmp() { + pkgdesc="gmp module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'gmp') + _install_module gmp +} + +############################################################################### +# PHP modules: spell checking +############################################################################### + +# Enchant +package_php74-enchant() { + pkgdesc="enchant module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'enchant' 'libvoikko' 'hspell' 'hunspell' 'nuspell' 'aspell') + _install_module enchant +} + +# Pspell package_php74-pspell() { - pkgdesc='pspell module for PHP' - depends=("${pkgbase}" 'aspell') + pkgdesc="pspell module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'aspell') + _install_module pspell +} + +############################################################################### +# PHP modules: compression +############################################################################### + +# bz2 +package_php74-bz2() { + pkgdesc="bz2 module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'bzip2') + _install_module bz2 +} - install -D -m755 ${srcdir}/build/modules/pspell.so ${pkgdir}/usr/lib/${pkgbase}/modules/pspell.so +# Zip +package_php74-zip() { + pkgdesc="zip module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libzip') + _install_module zip } +############################################################################### +# PHP modules: network client/servers +############################################################################### + +# curl +package_php74-curl() { + pkgdesc="curl module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" "curl") + _install_module curl +} + +# SOAP +package_php74-soap() { + pkgdesc="soap module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libxml2') + _install_module soap +} + +# FTP +package_php74-ftp() { + pkgdesc="FTP module for ${pkgbase}" + depends=("${_ext_depends_ftp[@]}") + _install_module ftp +} + +# ldap +package_php74-ldap() { + pkgdesc="ldap module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libldap' 'libsasl') + _install_module ldap +} + +# SNMP package_php74-snmp() { - pkgdesc='snmp module for PHP' - depends=("${pkgbase}" 'net-snmp') + pkgdesc="snmp module for ${pkgbase}" + depends=("${_ext_depends_snmp[@]}") + _install_module snmp +} - install -D -m755 ${srcdir}/build/modules/snmp.so ${pkgdir}/usr/lib/${pkgbase}/modules/snmp.so +# XML-RPC +package_php74-xmlrpc() { + pkgdesc="xmlrpc module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libxml2') + _install_module xmlrpc } -package_php74-sqlite() { - pkgdesc='sqlite module for PHP' - depends=("${pkgbase}" 'sqlite') +# Imap +package_php74-imap() { + pkgdesc="imap module for ${pkgbase}" + depends=("${_ext_depends_imap[@]}") + _install_module imap +} - install -D -m755 ${srcdir}/build/modules/sqlite3.so ${pkgdir}/usr/lib/${pkgbase}/modules/sqlite3.so - install -D -m755 ${srcdir}/build/modules/pdo_sqlite.so ${pkgdir}/usr/lib/${pkgbase}/modules/pdo_sqlite.so +# sockets +package_php74-sockets() { + pkgdesc="sockets module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module sockets } -package_php74-tidy() { - pkgdesc='tidy module for PHP' - depends=("${pkgbase}" 'tidy') +############################################################################### +# PHP Modules: cryptography +############################################################################### - install -D -m755 ${srcdir}/build/modules/tidy.so ${pkgdir}/usr/lib/${pkgbase}/modules/tidy.so +# Sodium +package_php74-sodium() { + pkgdesc="sodium (libsodium) module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" "libsodium") + _install_module sodium } -package_php74-xsl() { - pkgdesc='xsl module for PHP' - depends=("${pkgbase}" 'libxslt') +# Mcrypt +package_php74-mcrypt() { + pkgdesc="mcrypt module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libmcrypt') + _install_module mcrypt +} + + +############################################################################### +# PHP Zend modules: opcache/jit +############################################################################### + +# Opcache +package_php74-opcache() { + pkgdesc="opcache zend module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module opcache +} + +############################################################################### +# PHP posix, pcntl, shmop and System V modules +############################################################################### + +# posix +package_php74-posix() { + pkgdesc="posix module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module posix +} - install -D -m755 ${srcdir}/build/modules/xsl.so ${pkgdir}/usr/lib/${pkgbase}/modules/xsl.so +# pcntl +package_php74-pcntl() { + pkgdesc="pcntl module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module pcntl } + +# shmop +package_php74-shmop() { + pkgdesc="shmop module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module shmop +} + +# sysvmsg +package_php74-sysvmsg() { + pkgdesc="sysvmsg module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module sysvmsg +} + +# sysvsem +package_php74-sysvsem() { + pkgdesc="sysvsem module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module sysvsem +} + +# sysvshm +package_php74-sysvshm() { + pkgdesc="sysvshm module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module sysvshm +} + +############################################################################### +# PHP Misc modules +############################################################################### + +# Ffi +package_php74-ffi() { + pkgdesc="ffi module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libffi') + _install_module ffi +} + +# ctype +package_php74-ctype() { + pkgdesc="ctype module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module ctype +} + +# tokenizer +package_php74-tokenizer() { + pkgdesc="tokenizer module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}") + _install_module tokenizer +} + +# libedit/readline +package_php74-readline() { + pkgdesc="readline (libedit version) module for ${pkgbase}" + depends=("${pkgbase}=${pkgver}" 'libedit') + _install_module readline +} + + +sha256sums=('e6b8530d747000eebb0089249ec70a3b14add7b501337046700544883f62b17b' + '0b7e98dca9c996ec10cb9b3f6296bb7547c68797fd5f35006fdfd3e97700672d' + 'ba72fc64f77822755a469314160d5889d5298f4eb5758dd7939dac9b811afe52' + '6d0ad9becb5470ce8e5929d7d45660b0f32579038978496317544c5310281a91' + '924846abf93bc613815c55dd3f5809377813ac62a9ec4eb3778675b82a27b927' + 'e757f84d2d72ea39259450c32f3a83c72262da4294152ae3e9fbc0cada622bba' + '0a3a6e8ff04ff1e0869befcf2c7bca4e886d94065da6d7a10b809a4750b961a0' + '8fb103438fe12875dbe7c1f5b0899a81a76b4ce1456f16960e23e287d273df14' + 'c30ff6fcf75b0c0068f3d49fde8024719b3677f104d93232e52c5358c840c0f5' + '558e780e93dfa861a366c49b4d156d8fc43f17898f001ae6033ec63c33d5d41c' + '40bcc1e5058602302198d0925e431495391d8469499593af477f59d84d32f764' + '6ef318bf8d53a2288d037e3284f4dbfc26c36fd2ecc7d62e3d5036c19ec0a707') diff --git a/apache.conf b/apache.conf deleted file mode 100644 index b516b5e66ffa..000000000000 --- a/apache.conf +++ /dev/null @@ -1,13 +0,0 @@ -# Required modules: dir_module, php7_module - -<IfModule dir_module> - <IfModule php7_module> - DirectoryIndex index.php index.html - <FilesMatch "\.php$"> - SetHandler application/x-httpd-php - </FilesMatch> - <FilesMatch "\.phps$"> - SetHandler application/x-httpd-php-source - </FilesMatch> - </IfModule> -</IfModule> diff --git a/apache.patch b/apache.patch deleted file mode 100644 index c64021b8fbcd..000000000000 --- a/apache.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- sapi/apache2handler/config.m4.orig -+++ sapi/apache2handler/config.m4 -@@ -111,7 +111,6 @@ - PHP_BUILD_THREAD_SAFE - fi - else -- APACHE_THREADED_MPM=`$APXS_HTTPD -V 2>/dev/null | grep 'threaded:.*yes'` - if test -n "$APACHE_THREADED_MPM"; then - PHP_BUILD_THREAD_SAFE - fi diff --git a/debian-php-7.4.patch b/debian-php-7.4.patch new file mode 100644 index 000000000000..74ca1cf5f48a --- /dev/null +++ b/debian-php-7.4.patch @@ -0,0 +1,274 @@ + +diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c +index 25a5f7f..93c47af 100644 +--- a/ext/standard/proc_open.c ++++ b/ext/standard/proc_open.c +@@ -55,7 +55,7 @@ + * */ + #ifdef PHP_CAN_SUPPORT_PROC_OPEN + +-#if 0 && HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_SYS_IOCTL_H && HAVE_TERMIOS_H ++#if HAVE_PTSNAME && HAVE_GRANTPT && HAVE_UNLOCKPT && HAVE_SYS_IOCTL_H && HAVE_TERMIOS_H + # include <sys/ioctl.h> + # include <termios.h> + # define PHP_CAN_DO_PTS 1 +diff --git a/php.ini-development b/php.ini-development +index 23a35a2..0292501 100644 +--- a/php.ini-development ++++ b/php.ini-development +@@ -304,6 +304,12 @@ + ; or per-virtualhost web server configuration file. + ; Note: disables the realpath cache + ; http://php.net/open-basedir ++ ++; NOTE: this is considered a "broken" security measure. ++; Applications relying on this feature will not receive full ++; support by the security team. For more information please ++; see /usr/share/doc/php-common/README.Debian.security ++; + ;open_basedir = + + ; This directive allows you to disable certain functions. +diff --git a/ext/dba/dba.c b/ext/dba/dba.c +index 9581a57..21d3f11 100644 +--- a/ext/dba/dba.c ++++ b/ext/dba/dba.c +@@ -51,6 +51,10 @@ + #include "php_tcadb.h" + #include "php_lmdb.h" + ++#ifdef DB4_INCLUDE_FILE ++#include DB4_INCLUDE_FILE ++#endif ++ + /* {{{ arginfo */ + ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2) + ZEND_ARG_INFO(0, path) +@@ -558,6 +562,10 @@ + + php_info_print_table_start(); + php_info_print_table_row(2, "DBA support", "enabled"); ++#ifdef DB_VERSION_STRING ++ php_info_print_table_row(2, "libdb header version", DB_VERSION_STRING); ++ php_info_print_table_row(2, "libdb library version", db_version(NULL, NULL, NULL)); ++#endif + if (handlers.s) { + smart_str_0(&handlers); + php_info_print_table_row(2, "Supported handlers", ZSTR_VAL(handlers.s)); +--- /dev/null ++++ b/tests/func/null-new_val.phpt +@@ -0,0 +1,10 @@ ++--TEST-- ++ini_restore strcmp NULL new_val ++--FILE-- ++<?php ++ ++ini_set('error_log','ini_set_works'); ++ini_restore('error_log'); ++ ++?> ++--EXPECT-- +diff --git a/ext/dba/config.m4 b/ext/dba/config.m4 +index 51bdd84..79136d5 100644 +diff --git a/sapi/fpm/php-fpm.8.in b/sapi/fpm/php-fpm.8.in +index 972c242..002c44b 100644 +--- a/sapi/fpm/php-fpm.8.in ++++ b/sapi/fpm/php-fpm.8.in +@@ -139,22 +139,8 @@ + .TP + .B php.ini + The standard php configuration file. +-.SH EXAMPLES +-For any unix systems which use init.d for their main process manager, you should use the init script provided to start and stop the php-fpm daemon. +-.P +-.PD 1 +-.RS +-sudo /etc/init.d/php-fpm start +-.RE +-.TP +-For any unix systems which use systemd for their main process manager, you should use the unit file provided to start and stop the php-fpm daemon. +-.P +-.PD 1 +-.RS +-sudo systemctl start php-fpm.service +-.RE +-.TP +-If your installation has no appropriate init script, launch php-fpm with no arguments. It will launch as a daemon (background process) by default. The file @php_fpm_localstatedir@/run/php-fpm.pid determines whether php-fpm is already up and running. Once started, php-fpm then responds to several POSIX signals: ++.SH SIGNAL ++Once started, php-fpm then responds to several POSIX signals: + .P + .PD 0 + .RS +@@ -168,10 +154,6 @@ + .RE + .PD 1 + .P +-.SH TIPS +-The PHP-FPM CGI daemon will work well with most popular webservers, including Apache2, lighttpd and nginx. +-.PD 1 +-.P + .SH SEE ALSO + The PHP-FPM website: + .PD 0 +diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c +index 4d10e68..f74a936 100644 +--- a/main/streams/plain_wrapper.c ++++ b/main/streams/plain_wrapper.c +@@ -713,7 +713,13 @@ + + switch (value) { + case PHP_STREAM_MMAP_SUPPORTED: +- return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK; ++ if (fd == -1) ++ return PHP_STREAM_OPTION_RETURN_ERR; ++ /* Don't mmap large files */ ++ do_fstat(data, 1); ++ if (data->sb.st_size > 4 * 1024 * 1024) ++ return PHP_STREAM_OPTION_RETURN_ERR; ++ return PHP_STREAM_OPTION_RETURN_OK; + + case PHP_STREAM_MMAP_MAP_RANGE: + if (do_fstat(data, 1) != 0) { +diff --git a/ext/dba/dba.c b/ext/dba/dba.c +index 21d3f11..ac2d212 100644 +--- a/ext/dba/dba.c ++++ b/ext/dba/dba.c +@@ -999,7 +999,7 @@ + } + } + +- if (error || hptr->open(info, &error) != SUCCESS) { ++ if (error || (hptr->open)(info, &error) != SUCCESS) { + dba_close(info); + php_error_docref2(NULL, Z_STRVAL(args[0]), Z_STRVAL(args[1]), E_WARNING, "Driver initialization failed for handler: %s%s%s", hptr->name, error?": ":"", error?error:""); + FREENOW; +diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c +index bc0fdac..1b1b5c9 100644 +--- a/ext/dba/dba_db3.c ++++ b/ext/dba/dba_db3.c +@@ -93,9 +93,9 @@ + dbp->set_errcall(dbp, php_dba_db3_errcall_fcn); + if( + #if (DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)) +- (err=dbp->open(dbp, 0, info->path, NULL, type, gmode, filemode)) == 0) { ++ (err=(dbp->open)(dbp, 0, info->path, NULL, type, gmode, filemode)) == 0) { + #else +- (err=dbp->open(dbp, info->path, NULL, type, gmode, filemode)) == 0) { ++ (err=(dbp->open)(dbp, info->path, NULL, type, gmode, filemode)) == 0) { + #endif + dba_db3_data *data; + +diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c +index ee296b9..22ca32d 100644 +--- a/ext/dba/dba_db4.c ++++ b/ext/dba/dba_db4.c +@@ -122,9 +122,9 @@ + dbp->set_errcall(dbp, php_dba_db4_errcall_fcn); + if ( + #if (DB_VERSION_MAJOR > 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)) +- (err=dbp->open(dbp, 0, info->path, NULL, type, gmode, filemode)) == 0) { ++ (err=(dbp->open)(dbp, 0, info->path, NULL, type, gmode, filemode)) == 0) { + #else +- (err=dbp->open(dbp, info->path, NULL, type, gmode, filemode)) == 0) { ++ (err=(dbp->open)(dbp, info->path, NULL, type, gmode, filemode)) == 0) { + #endif + dba_db4_data *data; + +diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c +index 9060dcb..2678751 100644 +--- a/ext/zlib/zlib.c ++++ b/ext/zlib/zlib.c +@@ -47,6 +47,18 @@ + int le_deflate; + int le_inflate; + ++/* ++ * zlib include files can define the following preprocessor defines which rename ++ * the corresponding PHP functions to gzopen64, gzseek64 and gztell64 and thereby ++ * breaking some software, most notably PEAR's Archive_Tar, which halts execution ++ * without error message on gzip compressed archivesa. ++ * ++ * This only seems to happen on 32bit systems with large file support. ++ */ ++#undef gzopen ++#undef gzseek ++#undef gztell ++ + ZEND_DECLARE_MODULE_GLOBALS(zlib); + + /* {{{ Memory management wrappers */ +diff --git a/ext/standard/tests/strings/setlocale_variation2.phpt b/ext/standard/tests/strings/setlocale_variation2.phpt +index 6fd6f4d..9be9dc6 100644 +--- a/ext/standard/tests/strings/setlocale_variation2.phpt ++++ b/ext/standard/tests/strings/setlocale_variation2.phpt +@@ -59,6 +59,7 @@ + //try different locale names + $failure_locale = array(); + $success_count = 0; ++$expected = 0; + + echo "-- Test setlocale() with all available locale in the system --\n"; + // gather all locales installed in the system(stored $all_system_locales), +@@ -68,6 +69,10 @@ + if(setlocale(LC_ALL,$value )){ + $success_count++; + } ++ else if ($value == 'no_NO.ISO-8859-1') { ++ // ignore this one, see rhbz #971416 ++ $expected++; ++ } + else{ + //failure values are put in to an array $failure_locale + $failure_locale[] = $value; +@@ -76,11 +81,11 @@ + + echo "No of locales found on the machine = ".count($all_system_locales)."\n"; + echo "No of setlocale() success = ".$success_count."\n"; +-echo "Expected no of failures = 0\n"; ++echo "Expected no of failures = $expected\n"; + echo "Test "; + // check if there were any failure of setlocale() function earlier, if any + // failure then dump the list of failing locales +-if($success_count != count($all_system_locales)){ ++if(($success_count + $expected) != count($all_system_locales)){ + echo "FAILED\n"; + echo "Names of locale() for which setlocale() failed ...\n"; + var_dump($failure_locale); +@@ -96,6 +101,6 @@ + -- Test setlocale() with all available locale in the system -- + No of locales found on the machine = %d + No of setlocale() success = %d +-Expected no of failures = 0 ++Expected no of failures = %d + Test PASSED + Done +diff --git a/ext/pcre/tests/grep2.phpt b/ext/pcre/tests/grep2.phpt +index 4c6f9b1..a6247cc 100644 +--- a/ext/pcre/tests/grep2.phpt ++++ b/ext/pcre/tests/grep2.phpt +@@ -44,12 +44,6 @@ + string(1) "1" + } + bool(true) +-array(3) { +- [5]=> +- string(1) "a" +- ["xyz"]=> +- string(2) "q6" +- [6]=> +- string(3) "h20" ++array(0) { + } +-bool(false) ++bool(true) +diff --git a/ext/pcre/tests/match_flags3.phpt b/ext/pcre/tests/match_flags3.phpt +index 6511c71..05c62a0 100644 +--- a/ext/pcre/tests/match_flags3.phpt ++++ b/ext/pcre/tests/match_flags3.phpt +@@ -41,5 +41,5 @@ + } + } + +-Warning: preg_match(): Compilation failed: %s name must start with a non-digit at offset %d in %smatch_flags3.php on line %d ++Warning: preg_match(): Numeric named subpatterns are not allowed in %smatch_flags3.php on line %d + bool(false) diff --git a/generate_patches b/generate_patches deleted file mode 100755 index b814d9c0e604..000000000000 --- a/generate_patches +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -. PKGBUILD - -makepkg -o --nodeps --noprepare --skipinteg - -pushd src/${_pkgbase}-${pkgver} - -sed '/APACHE_THREADED_MPM=/d' -i.orig sapi/apache2handler/config.m4 - -sed 's/.conf.default/.conf/g' -i.orig sapi/fpm/Makefile.frag - -sed \ - -e 's#run/php-fpm.pid#/run/php74-fpm/php-fpm.pid#' \ - -e 's#^;error_log =.*#error_log = syslog#' \ - -i.orig sapi/fpm/php-fpm.conf.in - -sed \ - -e 's#^listen =.*#listen = /run/php74-fpm/php-fpm.sock#' \ - -e 's#^;listen.owner =#listen.owner =#' \ - -e 's#^;listen.group =#listen.group =#' \ - -e 's#^;chdir =.*#;chdir = /srv/http#' \ - -i.orig sapi/fpm/www.conf.in - -sed \ - -e 's#^PIDFile=.*#PIDFile=/run/php74-fpm/php-fpm.pid#' \ - -e 's#^ExecStart=@EXPANDED_SBINDIR@/php-fpm --nodaemonize#ExecStart=@EXPANDED_SBINDIR@/php-fpm74 --nodaemonize#' \ - -i.orig sapi/fpm/php-fpm.service.in - -extensions=";extension=bcmath\n;extension=bz2\n;extension=calendar\nextension=curl\n;extension=dba\n;extension=enchant\n;extension=exif\n;extension=ffi\n;extension=ftp\n;extension=gd\n;extension=gettext\n;extension=gmp\n;extension=iconv\n;extension=imap\n;extension=intl\n;extension=ldap\n;extension=mysqli\n;extension=odbc\n;zend_extension=opcache\n;extension=pdo_dblib\n;extension=pdo_mysql\n;extension=pdo_odbc\n;extension=pdo_pgsql\n;extension=pdo_sqlite\n;extension=pgsql\n;extension=pspell\n;extension=shmop\n;extension=snmp\n;extension=soap\n;extension=sockets\n;extension=sodium\n;extension=sqlite3\n;extension=sysvmsg\n;extension=sysvsem\n;extension=sysvshm\n;extension=tidy\n;extension=xmlrpc\n;extension=xsl\nextension=zip\n" - -sed \ - -r ":a;N;\$!ba;s/; Notes for Windows environments :\n.+;?extension=\w+\n/${extensions}/g" \ - -i.orig php.ini-production -sed \ - -e 's#^;extension_dir = "\./"$#extension_dir = "/usr/lib/php74/modules/"#g' \ - -i php.ini-production - -sed \ - -r 's#PKG_CHECK_MODULES\(\[ENCHANT\], \[enchant\]\)#PKG_CHECK_MODULES([ENCHANT], [enchant-2])#g' \ - -i.orig ext/enchant/config.m4 -sed \ - -r 's#enchant_dict_free_suggestions\(pdict->pdict, suggs\)#enchant_dict_free_string_list(pdict->pdict, suggs)#g' \ - -i.orig ext/enchant/enchant.c -sed \ - -r 's#enchant_dict_add_to_personal\(pdict->pdict, word, wordlen\)#enchant_dict_add(pdict->pdict, word, wordlen)#g' \ - -i ext/enchant/enchant.c -sed \ - -r 's#enchant_dict_is_in_session\(pdict->pdict, word, wordlen\)#enchant_dict_is_added(pdict->pdict, word, wordlen)#g' \ - -i ext/enchant/enchant.c - -diff -u sapi/apache2handler/config.m4.orig sapi/apache2handler/config.m4 | filterdiff --clean --remove-timestamps > ../../apache.patch - -diff -u sapi/fpm/Makefile.frag.orig sapi/fpm/Makefile.frag | filterdiff --clean --remove-timestamps > ../../php-fpm.patch -diff -u sapi/fpm/php-fpm.conf.in.orig sapi/fpm/php-fpm.conf.in | filterdiff --clean --remove-timestamps >> ../../php-fpm.patch -diff -u sapi/fpm/www.conf.in.orig sapi/fpm/www.conf.in | filterdiff --clean --remove-timestamps >> ../../php-fpm.patch -diff -u sapi/fpm/php-fpm.service.in.orig sapi/fpm/php-fpm.service.in | filterdiff --clean --remove-timestamps >> ../../php-fpm.patch - -diff -u php.ini-production.orig php.ini-production | filterdiff --clean --remove-timestamps > ../../php.ini.patch - -diff -u ext/enchant/config.m4.orig ext/enchant/config.m4 | filterdiff --clean --remove-timestamps > ../../enchant-2.patch -diff -u ext/enchant/enchant.c.orig ext/enchant/enchant.c | filterdiff --clean --remove-timestamps >> ../../enchant-2.patch - -popd diff --git a/make-tests.patch b/make-tests.patch new file mode 100644 index 000000000000..fe7d21ea5aab --- /dev/null +++ b/make-tests.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -213,7 +213,7 @@ + fi; \ + TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \ + TEST_PHP_SRCDIR=$(top_srcdir) \ +- CC="$(CC)" \ ++ REPORT_EXIT_STATUS=1 NO_INTERACTION=1 SKIP_ONLINE_TESTS=1 SKIP_SLOW_TESTS=1 CC="$(CC)" \ + $(PHP_EXECUTABLE) -n -c $(top_builddir)/tmp-php.ini $(PHP_TEST_SETTINGS) $(top_srcdir)/run-tests.php -n -c $(top_builddir)/tmp-php.ini -d extension_dir=$(top_builddir)/modules/ $(PHP_TEST_SHARED_EXTENSIONS) $(TESTS); \ + TEST_RESULT_EXIT_CODE=$$?; \ + rm $(top_builddir)/tmp-php.ini; \ diff --git a/mysql-socket-php7.1.patch b/mysql-socket-php7.1.patch new file mode 100644 index 000000000000..580a53572980 --- /dev/null +++ b/mysql-socket-php7.1.patch @@ -0,0 +1,26 @@ +diff --git a/ext/mysqlnd/mysqlnd_connection.c b/ext/mysqlnd/mysqlnd_connection.c +index 8897038..6121317 100644 +--- a/ext/mysqlnd/mysqlnd_connection.c ++++ b/ext/mysqlnd/mysqlnd_connection.c +@@ -554,7 +554,7 @@ + if (hostname.l == sizeof("localhost") - 1 && !strncasecmp(hostname.s, "localhost", hostname.l)) { + DBG_INF_FMT("socket=%s", socket_or_pipe->s? socket_or_pipe->s:"n/a"); + if (!socket_or_pipe->s) { +- socket_or_pipe->s = "/tmp/mysql.sock"; ++ socket_or_pipe->s = "/run/mysqld/mysqld.sock"; + socket_or_pipe->l = strlen(socket_or_pipe->s); + } + transport.l = mnd_sprintf(&transport.s, 0, "unix://%s", socket_or_pipe->s); +diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c +index 54e1c93..b355a83 100644 +--- a/ext/pdo_mysql/pdo_mysql.c ++++ b/ext/pdo_mysql/pdo_mysql.c +@@ -51,7 +51,7 @@ + # define PDO_MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR + # else + # if !PHP_WIN32 +-# define PDO_MYSQL_UNIX_ADDR "/tmp/mysql.sock" ++# define PDO_MYSQL_UNIX_ADDR "/run/mysqld/mysqld.sock" + # else + # define PDO_MYSQL_UNIX_ADDR NULL + # endif diff --git a/openssl-sslv3-consts.patch b/openssl-sslv3-consts.patch new file mode 100644 index 000000000000..f8075216683b --- /dev/null +++ b/openssl-sslv3-consts.patch @@ -0,0 +1,12 @@ +--- a/ext/openssl/openssl.c ++++ b/ext/openssl/openssl.c +@@ -1482,7 +1482,9 @@ + REGISTER_LONG_CONSTANT("PKCS7_NOSIGS", PKCS7_NOSIGS, CONST_CS|CONST_PERSISTENT); + + REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_PADDING", RSA_PKCS1_PADDING, CONST_CS|CONST_PERSISTENT); ++#ifdef RSA_SSLV23_PADDING + REGISTER_LONG_CONSTANT("OPENSSL_SSLV23_PADDING", RSA_SSLV23_PADDING, CONST_CS|CONST_PERSISTENT); ++#endif + REGISTER_LONG_CONSTANT("OPENSSL_NO_PADDING", RSA_NO_PADDING, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("OPENSSL_PKCS1_OAEP_PADDING", RSA_PKCS1_OAEP_PADDING, CONST_CS|CONST_PERSISTENT); + diff --git a/pear-config-patcher.php b/pear-config-patcher.php new file mode 100644 index 000000000000..ac6a1254282b --- /dev/null +++ b/pear-config-patcher.php @@ -0,0 +1,42 @@ +<?php +if (!isset($argv, $argc)) { + echo "No command line args provided\n"; + exit(1); +} +if ($argc < 3) { + echo "Not all command line args provided\n"; + exit(2); +} +$targetFile = $confFile = $argv[1]; +$varPath = $argv[2]; + +$data = ''; +$file = fopen($confFile, "r"); + +if ($file !== false) { + while(!feof($file)) { + $line = fgets($file); + $serialized = @unserialize($line); + if (is_array($serialized)) { + $serialized['temp_dir'] = "{$varPath}/temp"; + $serialized['cache_dir'] = "{$varPath}/cache"; + $serialized['download_dir'] = "{$varPath}/download"; + $serialized['metadata_dir'] = "{$varPath}/metadata"; + $data .= @serialize($serialized); + $data .= "\n"; + } else { + $data .= $line; + } + } + fclose($file); + if (false !== file_put_contents($targetFile, $data)) { + echo "Written to $targetFile\n"; + } else { + echo "Failed to write to $targetFile\n"; + exit(3); + } +} else { + echo "File was not found {$confFile}\n"; + exit(4); +} +exit(0); diff --git a/php-apache.conf b/php-apache.conf new file mode 100644 index 000000000000..e74ae8d9b7a8 --- /dev/null +++ b/php-apache.conf @@ -0,0 +1,13 @@ +# Required modules: dir_module, @MODULE@ + +<IfModule dir_module> + <IfModule @MODULE@> + DirectoryIndex index.php index.html + <FilesMatch "\.php$"> + SetHandler application/x-httpd-php + </FilesMatch> + <FilesMatch "\.phps$"> + SetHandler application/x-httpd-php-source + </FilesMatch> + </IfModule> +</IfModule> diff --git a/php-fpm.install b/php-fpm.install new file mode 100644 index 000000000000..90fa868cd1da --- /dev/null +++ b/php-fpm.install @@ -0,0 +1,31 @@ +pre_install() { + echo "php-fpm pre_install hook" + echo "1=$1" +} + +post_install() { + echo "php-fpm post_install hook" + echo "1=$1" +} + +pre_upgrade() { + echo "php-fpm pre_upgrade hook" + echo "1=$1" + echo "2=$2" +} + +post_upgrade() { + echo "php-fpm post_upgrade hook" + echo "1=$1" + echo "2=$2" +} + +pre_remove() { + echo "php-fpm pre_remove hook" + echo "1=$1" +} + +post_remove() { + echo "php-fpm post_remove hook" + echo "1=$1" +} diff --git a/php-fpm.patch b/php-fpm.patch deleted file mode 100644 index f8a3d87b4851..000000000000 --- a/php-fpm.patch +++ /dev/null @@ -1,74 +0,0 @@ ---- sapi/fpm/Makefile.frag.orig -+++ sapi/fpm/Makefile.frag -@@ -15,8 +15,8 @@ - else \ - echo "Installing PHP FPM defconfig: $(INSTALL_ROOT)$(sysconfdir)/" && \ - $(mkinstalldirs) $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d; \ -- $(INSTALL_DATA) sapi/fpm/php-fpm.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.conf.default; \ -- $(INSTALL_DATA) sapi/fpm/www.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d/www.conf.default; \ -+ $(INSTALL_DATA) sapi/fpm/php-fpm.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.conf; \ -+ $(INSTALL_DATA) sapi/fpm/www.conf $(INSTALL_ROOT)$(sysconfdir)/php-fpm.d/www.conf; \ - fi - - @echo "Installing PHP FPM man page: $(INSTALL_ROOT)$(mandir)/man8/" ---- sapi/fpm/php-fpm.conf.in.orig -+++ sapi/fpm/php-fpm.conf.in -@@ -14,14 +14,14 @@ - ; Pid file - ; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@ - ; Default Value: none --;pid = run/php-fpm.pid -+;pid = /run/php74-fpm/php-fpm.pid - - ; Error log file - ; If it's set to "syslog", log is sent to syslogd instead of being written - ; into a local file. - ; Note: the default prefix is @EXPANDED_LOCALSTATEDIR@ - ; Default Value: log/php-fpm.log --;error_log = log/php-fpm.log -+error_log = syslog - - ; syslog_facility is used to specify what type of program is logging the - ; message. This lets syslogd specify that messages from different facilities ---- sapi/fpm/www.conf.in.orig -+++ sapi/fpm/www.conf.in -@@ -33,7 +33,7 @@ - ; (IPv6 and IPv4-mapped) on a specific port; - ; '/path/to/unix/socket' - to listen on a unix socket. - ; Note: This value is mandatory. --listen = 127.0.0.1:9000 -+listen = /run/php74-fpm/php-fpm.sock - - ; Set listen(2) backlog. - ; Default Value: 511 (-1 on FreeBSD and OpenBSD) -@@ -45,8 +45,8 @@ - ; and group can be specified either by name or by their numeric IDs. - ; Default Values: user and group are set as the running user - ; mode is set to 0660 --;listen.owner = @php_fpm_user@ --;listen.group = @php_fpm_group@ -+listen.owner = @php_fpm_user@ -+listen.group = @php_fpm_group@ - ;listen.mode = 0660 - ; When POSIX Access Control Lists are supported you can set them using - ; these options, value is a comma separated list of user/group names. -@@ -371,7 +371,7 @@ - ; Chdir to this directory at the start. - ; Note: relative path can be used. - ; Default Value: current directory or / when chroot --;chdir = /var/www -+;chdir = /srv/http - - ; Redirect worker stdout and stderr into main error log. If not set, stdout and - ; stderr will be redirected to /dev/null according to FastCGI specs. ---- sapi/fpm/php-fpm.service.in.orig -+++ sapi/fpm/php-fpm.service.in -@@ -8,7 +8,7 @@ - - [Service] - Type=@php_fpm_systemd@ --PIDFile=@EXPANDED_LOCALSTATEDIR@/run/php-fpm.pid --ExecStart=@EXPANDED_SBINDIR@/php-fpm --nodaemonize --fpm-config @EXPANDED_SYSCONFDIR@/php-fpm.conf -+PIDFile=/run/php74-fpm/php-fpm.pid -+ExecStart=@EXPANDED_SBINDIR@/php-fpm74 --nodaemonize --fpm-config @EXPANDED_SYSCONFDIR@/php-fpm.conf - ExecReload=/bin/kill -USR2 $MAINPID diff --git a/php-fpm.tmpfiles b/php-fpm.tmpfiles deleted file mode 100644 index d8a07e841433..000000000000 --- a/php-fpm.tmpfiles +++ /dev/null @@ -1 +0,0 @@ -d /run/php74-fpm 755 root root diff --git a/php-libxml.patch b/php-libxml.patch new file mode 100644 index 000000000000..7a9c2fe20bdf --- /dev/null +++ b/php-libxml.patch @@ -0,0 +1,23 @@ +diff --git a/ext/dom/document.c b/ext/dom/document.c +index 64da4f051b..3c71f03ba3 100644 +--- a/ext/dom/document.c ++++ b/ext/dom/document.c +@@ -26,6 +26,7 @@ + #ifdef LIBXML_SCHEMAS_ENABLED + #include <libxml/relaxng.h> + #include <libxml/xmlschemas.h> ++#include <libxml/xmlsave.h> + #endif + + typedef struct _idsIterator idsIterator; +diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h +index af1cc7d6ac..b484568bb1 100644 +--- a/ext/libxml/php_libxml.h ++++ b/ext/libxml/php_libxml.h +@@ -35,6 +35,7 @@ extern zend_module_entry libxml_module_entry; + + #include "zend_smart_str.h" + #include <libxml/tree.h> ++#include <libxml/parser.h> + + #define LIBXML_SAVE_NOEMPTYTAG 1<<2 diff --git a/php-makefile-patcher.php b/php-makefile-patcher.php new file mode 100644 index 000000000000..7a071eeba66d --- /dev/null +++ b/php-makefile-patcher.php @@ -0,0 +1,47 @@ +<?php +if (!isset($argv, $argc)) { + echo "No command line args provided\n"; + exit(1); +} +if ($argc < 2) { + echo "Not all command line args provided\n"; + exit(2); +} +$filename = $argv[1]; +$fileContent = @file_get_contents($filename); +if (!strlen($fileContent)) { + echo "No file contents of $filename\n"; + exit(3); +} +$matches = array(); +$match = preg_match("/^(?P<line>(?P<definition>PHP_MODULES[\s\t]+=[\s\t]+)(?P<expression>.*)$)/m", $fileContent, $matches); +if (!$match) { + echo "No PHP_MODULES in $filename\n"; + exit (4); +} +$expression = explode(' ', $matches['expression']); +function sortByPrio($a, $b) { + $aPrio = 999; + $bPrio = 999; + $priorities = array('/openssl/i'=> 0, '@\/xml\.@i'=>1, '@\/pdo\.@i'=>2, '@\/dom\.@i'=>3, '/mysqlnd/i'=>4); + foreach ($priorities as $regex => $prio) { + if (preg_match($regex, $a) && $prio < $aPrio) { + $aPrio = $prio; + } + if (preg_match($regex, $b) && $prio < $bPrio) { + $bPrio = $prio; + } + } + if ($aPrio == $bPrio) { + return 0; + } + return $aPrio > $bPrio ? 1: -1; +} +usort($expression, 'sortByPrio'); +$expression = $matches['definition'].join (' ', $expression)."\n"; +$fileContent = str_replace($matches['line'], $expression, $fileContent); +if (!file_put_contents($filename, $fileContent)) { + echo "Failed to write to $filename\n"; + exit(5); +} +exit(0); diff --git a/php-phpinfo.patch b/php-phpinfo.patch new file mode 100644 index 000000000000..72d0beaea4bd --- /dev/null +++ b/php-phpinfo.patch @@ -0,0 +1,22 @@ +--- a/ext/standard/info.c ++++ b/ext/standard/info.c +@@ -810,9 +810,6 @@ PHPAPI ZEND_COLD void php_print_info(int flag) + #ifdef ARCHITECTURE + php_info_print_table_row(2, "Architecture", ARCHITECTURE); + #endif +-#ifdef CONFIGURE_COMMAND +- php_info_print_table_row(2, "Configure Command", CONFIGURE_COMMAND ); +-#endif + + if (sapi_module.pretty_name) { + php_info_print_table_row(2, "Server API", sapi_module.pretty_name ); +--- a/ext/standard/tests/general_functions/phpinfo.phpt ++++ b/ext/standard/tests/general_functions/phpinfo.phpt +@@ -20,7 +20,6 @@ PHP Version => %s + + System => %s + Build Date => %s%a +-Configure Command => %s + Server API => Command Line Interface + Virtual Directory Support => %s + Configuration File (php.ini) Path => %s diff --git a/php.ini.patch b/php.ini.patch deleted file mode 100644 index e88d50df6018..000000000000 --- a/php.ini.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- php.ini-production.orig -+++ php.ini-production -@@ -756,7 +756,7 @@ - - ; Directory in which the loadable extensions (modules) reside. - ; http://php.net/extension-dir --;extension_dir = "./" -+extension_dir = "/usr/lib/php74/modules/" - ; On windows: - ;extension_dir = "ext" - -@@ -904,49 +904,45 @@ - ; deprecated in a future PHP major version. So, when it is possible, please - ; move to the new ('extension=<ext>) syntax. - ; --; Notes for Windows environments : --; --; - Many DLL files are located in the extensions/ (PHP 4) or ext/ (PHP 5+) --; extension folders as well as the separate PECL DLL download (PHP 5+). --; Be sure to appropriately set the extension_dir directive. --; -+;extension=bcmath - ;extension=bz2 --;extension=curl -+;extension=calendar -+extension=curl -+;extension=dba -+;extension=enchant -+;extension=exif - ;extension=ffi - ;extension=ftp --;extension=fileinfo --;extension=gd2 -+;extension=gd - ;extension=gettext - ;extension=gmp --;extension=intl -+;extension=iconv - ;extension=imap -+;extension=intl - ;extension=ldap --;extension=mbstring --;extension=exif ; Must be after mbstring as it depends on it - ;extension=mysqli --;extension=oci8_12c ; Use with Oracle Database 12c Instant Client - ;extension=odbc --;extension=openssl --;extension=pdo_firebird -+;zend_extension=opcache -+;extension=pdo_dblib - ;extension=pdo_mysql --;extension=pdo_oci - ;extension=pdo_odbc - ;extension=pdo_pgsql - ;extension=pdo_sqlite - ;extension=pgsql -+;extension=pspell - ;extension=shmop -- --; The MIBS data available in the PHP distribution must be installed. --; See http://www.php.net/manual/en/snmp.installation.php - ;extension=snmp -- - ;extension=soap - ;extension=sockets - ;extension=sodium - ;extension=sqlite3 -+;extension=sysvmsg -+;extension=sysvsem -+;extension=sysvshm - ;extension=tidy - ;extension=xmlrpc - ;extension=xsl -+extension=zip - - ;;;;;;;;;;;;;;;;;;; - ; Module Settings ; diff --git a/enchant-2.patch b/php74-enchant.patch index 5aee2f7294bb..3d995bec0149 100644 --- a/enchant-2.patch +++ b/php74-enchant.patch @@ -1,5 +1,5 @@ ---- ext/enchant/config.m4.orig -+++ ext/enchant/config.m4 +--- a/ext/enchant/config.m4 ++++ b/ext/enchant/config.m4 @@ -4,7 +4,7 @@ [Include Enchant support])]) @@ -9,8 +9,8 @@ PHP_EVAL_INCLINE($ENCHANT_CFLAGS) PHP_EVAL_LIBLINE($ENCHANT_LIBS, ENCHANT_SHARED_LIBADD) ---- ext/enchant/enchant.c.orig -+++ ext/enchant/enchant.c +--- a/ext/enchant/enchant.c ++++ b/ext/enchant/enchant.c @@ -738,7 +738,7 @@ for (i = 0; i < n_sugg; i++) { add_next_index_string(sugg, suggs[i]); diff --git a/phpize.m4.patch b/phpize.m4.patch deleted file mode 100644 index 365f52d84c42..000000000000 --- a/phpize.m4.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- scripts/phpize.m4.orig 2021-01-05 11:45:07.000000000 +0100 -+++ scripts/phpize.m4 2021-01-31 12:03:46.869682067 +0100 -@@ -50,8 +50,8 @@ - dnl Find php-config script. - PHP_ARG_WITH([php-config],, - [AS_HELP_STRING([--with-php-config=PATH], -- [Path to php-config [php-config]])], -- [php-config], -+ [Path to php-config74 [php-config74]])], -+ [php-config74], - [no]) - - dnl For BC. diff --git a/timezonedb-guess.patch b/timezonedb-guess.patch new file mode 100644 index 000000000000..10c057e40799 --- /dev/null +++ b/timezonedb-guess.patch @@ -0,0 +1,27 @@ +index cf4a11b..f2ea919 100644 +--- a/ext/date/php_date.c ++++ b/ext/date/php_date.c +@@ -545,6 +545,23 @@ static char* guess_timezone(const timelib_tzdb *tzdb) + DATEG(timezone_valid) = 1; + return DATEG(default_timezone); + } ++ /* Try to guess timezone from system information */ ++ { ++ struct tm *ta, tmbuf; ++ time_t the_time; ++ char *tzid = NULL; ++ ++ the_time = time(NULL); ++ ta = php_localtime_r(&the_time, &tmbuf); ++ if (ta) { ++ tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst); ++ } ++ if (! tzid) { ++ tzid = "UTC"; ++ } ++ ++ return tzid; ++ } + /* Fallback to UTC */ + return "UTC"; + } diff --git a/timezonedb-php7.4.patch b/timezonedb-php7.4.patch new file mode 100644 index 000000000000..011d81674f31 --- /dev/null +++ b/timezonedb-php7.4.patch @@ -0,0 +1,625 @@ +--- a/ext/date/config0.m4 ++++ b/ext/date/config0.m4 +@@ -4,6 +4,19 @@ AC_CHECK_HEADERS([io.h]) + dnl Check for strtoll, atoll + AC_CHECK_FUNCS(strtoll atoll) + ++PHP_ARG_WITH(system-tzdata, for use of system timezone data, ++[ --with-system-tzdata[=DIR] to specify use of system timezone data], ++no, no) ++ ++if test "$PHP_SYSTEM_TZDATA" != "no"; then ++ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used]) ++ ++ if test "$PHP_SYSTEM_TZDATA" != "yes"; then ++ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA", ++ [Define for location of system timezone data]) ++ fi ++fi ++ + PHP_DATE_CFLAGS="-I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1" + timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c + lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c lib/parse_iso_intervals.c lib/interval.c" +diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c +index 020da31..9b39c6e 100644 +--- a/ext/date/lib/parse_tz.c ++++ b/ext/date/lib/parse_tz.c +@@ -26,8 +26,21 @@ + #include "timelib.h" + #include "timelib_private.h" + ++#ifdef HAVE_SYSTEM_TZDATA ++#include <sys/mman.h> ++#include <sys/stat.h> ++#include <limits.h> ++#include <fcntl.h> ++#include <unistd.h> ++ ++#include "php_scandir.h" ++ ++#else + #define TIMELIB_SUPPORTS_V2DATA + #include "timezonedb.h" ++#endif ++ ++#include <ctype.h> + + #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__)) + # if defined(__LITTLE_ENDIAN__) +@@ -88,6 +101,11 @@ static int read_php_preamble(const unsigned char **tzf, timelib_tzinfo *tz) + { + uint32_t version; + ++ if (memcmp(*tzf, "TZif", 4) == 0) { ++ *tzf += 20; ++ return 0; ++ } ++ + /* read ID */ + version = (*tzf)[3] - '0'; + *tzf += 4; +@@ -412,7 +430,429 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz) + } + } + +-static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) ++#ifdef HAVE_SYSTEM_TZDATA ++ ++#ifdef HAVE_SYSTEM_TZDATA_PREFIX ++#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX ++#else ++#define ZONEINFO_PREFIX "/usr/share/zoneinfo" ++#endif ++ ++/* System timezone database pointer. */ ++static const timelib_tzdb *timezonedb_system; ++ ++/* Hash table entry for the cache of the zone.tab mapping table. */ ++struct location_info { ++ char code[2]; ++ double latitude, longitude; ++ char name[64]; ++ char *comment; ++ struct location_info *next; ++}; ++ ++/* Cache of zone.tab. */ ++static struct location_info **system_location_table; ++ ++/* Size of the zone.tab hash table; a random-ish prime big enough to ++ * prevent too many collisions. */ ++#define LOCINFO_HASH_SIZE (1021) ++ ++/* Compute a case insensitive hash of str */ ++static uint32_t tz_hash(const char *str) ++{ ++ const unsigned char *p = (const unsigned char *)str; ++ uint32_t hash = 5381; ++ int c; ++ ++ while ((c = tolower(*p++)) != '\0') { ++ hash = (hash << 5) ^ hash ^ c; ++ } ++ ++ return hash % LOCINFO_HASH_SIZE; ++} ++ ++/* Parse an ISO-6709 date as used in zone.tab. Returns end of the ++ * parsed string on success, or NULL on parse error. On success, ++ * writes the parsed number to *result. */ ++static char *parse_iso6709(char *p, double *result) ++{ ++ double v, sign; ++ char *pend; ++ size_t len; ++ ++ if (*p == '+') ++ sign = 1.0; ++ else if (*p == '-') ++ sign = -1.0; ++ else ++ return NULL; ++ ++ p++; ++ for (pend = p; *pend >= '0' && *pend <= '9'; pend++) ++ ;; ++ ++ /* Annoying encoding used by zone.tab has no decimal point, so use ++ * the length to determine the format: ++ * ++ * 4 = DDMM ++ * 5 = DDDMM ++ * 6 = DDMMSS ++ * 7 = DDDMMSS ++ */ ++ len = pend - p; ++ if (len < 4 || len > 7) { ++ return NULL; ++ } ++ ++ /* p => [D]DD */ ++ v = (p[0] - '0') * 10.0 + (p[1] - '0'); ++ p += 2; ++ if (len == 5 || len == 7) ++ v = v * 10.0 + (*p++ - '0'); ++ /* p => MM[SS] */ ++ v += (10.0 * (p[0] - '0') ++ + p[1] - '0') / 60.0; ++ p += 2; ++ /* p => [SS] */ ++ if (len > 5) { ++ v += (10.0 * (p[0] - '0') ++ + p[1] - '0') / 3600.0; ++ p += 2; ++ } ++ ++ /* Round to five decimal place, not because it's a good idea, ++ * but, because the builtin data uses rounded data, so, match ++ * that. */ ++ *result = trunc(v * sign * 100000.0) / 100000.0; ++ ++ return p; ++} ++ ++/* This function parses the zone.tab file to build up the mapping of ++ * timezone to country code and geographic location, and returns a ++ * hash table. The hash table is indexed by the function: ++ * ++ * tz_hash(timezone-name) ++ */ ++static struct location_info **create_location_table(void) ++{ ++ struct location_info **li, *i; ++ char zone_tab[PATH_MAX]; ++ char line[512]; ++ FILE *fp; ++ ++ strncpy(zone_tab, ZONEINFO_PREFIX "/zone.tab", sizeof zone_tab); ++ ++ fp = fopen(zone_tab, "r"); ++ if (!fp) { ++ return NULL; ++ } ++ ++ li = calloc(LOCINFO_HASH_SIZE, sizeof *li); ++ ++ while (fgets(line, sizeof line, fp)) { ++ char *p = line, *code, *name, *comment; ++ uint32_t hash; ++ double latitude, longitude; ++ ++ while (isspace(*p)) ++ p++; ++ ++ if (*p == '#' || *p == '\0' || *p == '\n') ++ continue; ++ ++ if (!isalpha(p[0]) || !isalpha(p[1]) || p[2] != '\t') ++ continue; ++ ++ /* code => AA */ ++ code = p; ++ p[2] = 0; ++ p += 3; ++ ++ /* coords => [+-][D]DDMM[SS][+-][D]DDMM[SS] */ ++ p = parse_iso6709(p, &latitude); ++ if (!p) { ++ continue; ++ } ++ p = parse_iso6709(p, &longitude); ++ if (!p) { ++ continue; ++ } ++ ++ if (!p || *p != '\t') { ++ continue; ++ } ++ ++ /* name = string */ ++ name = ++p; ++ while (*p != '\t' && *p && *p != '\n') ++ p++; ++ ++ *p++ = '\0'; ++ ++ /* comment = string */ ++ comment = p; ++ while (*p != '\t' && *p && *p != '\n') ++ p++; ++ ++ if (*p == '\n' || *p == '\t') ++ *p = '\0'; ++ ++ hash = tz_hash(name); ++ i = malloc(sizeof *i); ++ memcpy(i->code, code, 2); ++ strncpy(i->name, name, sizeof i->name); ++ i->comment = strdup(comment); ++ i->longitude = longitude; ++ i->latitude = latitude; ++ i->next = li[hash]; ++ li[hash] = i; ++ /* printf("%s [%u, %f, %f]\n", name, hash, latitude, longitude); */ ++ } ++ ++ fclose(fp); ++ ++ return li; ++} ++ ++/* Return location info from hash table, using given timezone name. ++ * Returns NULL if the name could not be found. */ ++const struct location_info *find_zone_info(struct location_info **li, ++ const char *name) ++{ ++ uint32_t hash = tz_hash(name); ++ const struct location_info *l; ++ ++ if (!li) { ++ return NULL; ++ } ++ ++ for (l = li[hash]; l; l = l->next) { ++ if (timelib_strcasecmp(l->name, name) == 0) ++ return l; ++ } ++ ++ return NULL; ++} ++ ++/* Filter out some non-tzdata files and the posix/right databases, if ++ * present. */ ++static int index_filter(const struct dirent *ent) ++{ ++ return strcmp(ent->d_name, ".") != 0 ++ && strcmp(ent->d_name, "..") != 0 ++ && strcmp(ent->d_name, "posix") != 0 ++ && strcmp(ent->d_name, "posixrules") != 0 ++ && strcmp(ent->d_name, "right") != 0 ++ && strstr(ent->d_name, ".list") == NULL ++ && strstr(ent->d_name, ".tab") == NULL; ++} ++ ++static int sysdbcmp(const void *first, const void *second) ++{ ++ const timelib_tzdb_index_entry *alpha = first, *beta = second; ++ ++ return timelib_strcasecmp(alpha->id, beta->id); ++} ++ ++ ++/* Create the zone identifier index by trawling the filesystem. */ ++static void create_zone_index(timelib_tzdb *db) ++{ ++ size_t dirstack_size, dirstack_top; ++ size_t index_size, index_next; ++ timelib_tzdb_index_entry *db_index; ++ char **dirstack; ++ ++ /* LIFO stack to hold directory entries to scan; each slot is a ++ * directory name relative to the zoneinfo prefix. */ ++ dirstack_size = 32; ++ dirstack = malloc(dirstack_size * sizeof *dirstack); ++ dirstack_top = 1; ++ dirstack[0] = strdup(""); ++ ++ /* Index array. */ ++ index_size = 64; ++ db_index = malloc(index_size * sizeof *db_index); ++ index_next = 0; ++ ++ do { ++ struct dirent **ents; ++ char name[PATH_MAX], *top; ++ int count; ++ ++ /* Pop the top stack entry, and iterate through its contents. */ ++ top = dirstack[--dirstack_top]; ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top); ++ ++ count = php_scandir(name, &ents, index_filter, php_alphasort); ++ ++ while (count > 0) { ++ struct stat st; ++ const char *leaf = ents[count - 1]->d_name; ++ ++ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s", ++ top, leaf); ++ ++ if (strlen(name) && stat(name, &st) == 0) { ++ /* Name, relative to the zoneinfo prefix. */ ++ const char *root = top; ++ ++ if (root[0] == '/') root++; ++ ++ snprintf(name, sizeof name, "%s%s%s", root, ++ *root ? "/": "", leaf); ++ ++ if (S_ISDIR(st.st_mode)) { ++ if (dirstack_top == dirstack_size) { ++ dirstack_size *= 2; ++ dirstack = realloc(dirstack, ++ dirstack_size * sizeof *dirstack); ++ } ++ dirstack[dirstack_top++] = strdup(name); ++ } ++ else { ++ if (index_next == index_size) { ++ index_size *= 2; ++ db_index = realloc(db_index, ++ index_size * sizeof *db_index); ++ } ++ ++ db_index[index_next++].id = strdup(name); ++ } ++ } ++ ++ free(ents[--count]); ++ } ++ ++ if (count != -1) free(ents); ++ free(top); ++ } while (dirstack_top); ++ ++ qsort(db_index, index_next, sizeof *db_index, sysdbcmp); ++ ++ db->index = db_index; ++ db->index_size = index_next; ++ ++ free(dirstack); ++} ++ ++#define FAKE_HEADER "1234\0??\1??" ++#define FAKE_UTC_POS (7 - 4) ++ ++/* Create a fake data segment for database 'sysdb'. */ ++static void fake_data_segment(timelib_tzdb *sysdb, ++ struct location_info **info) ++{ ++ size_t n; ++ char *data, *p; ++ ++ data = malloc(3 * sysdb->index_size + 7); ++ ++ p = mempcpy(data, FAKE_HEADER, sizeof(FAKE_HEADER) - 1); ++ ++ for (n = 0; n < sysdb->index_size; n++) { ++ const struct location_info *li; ++ timelib_tzdb_index_entry *ent; ++ ++ ent = (timelib_tzdb_index_entry *)&sysdb->index[n]; ++ ++ /* Lookup the timezone name in the hash table. */ ++ if (strcmp(ent->id, "UTC") == 0) { ++ ent->pos = FAKE_UTC_POS; ++ continue; ++ } ++ ++ li = find_zone_info(info, ent->id); ++ if (li) { ++ /* If found, append the BC byte and the ++ * country code; set the position for this ++ * section of timezone data. */ ++ ent->pos = (p - data) - 4; ++ *p++ = '\1'; ++ *p++ = li->code[0]; ++ *p++ = li->code[1]; ++ } ++ else { ++ /* If not found, the timezone data can ++ * point at the header. */ ++ ent->pos = 0; ++ } ++ } ++ ++ sysdb->data = (unsigned char *)data; ++} ++ ++/* Returns true if the passed-in stat structure describes a ++ * probably-valid timezone file. */ ++static int is_valid_tzfile(const struct stat *st, int fd) ++{ ++ if (fd) { ++ char buf[20]; ++ if (read(fd, buf, 20)!=20) { ++ return 0; ++ } ++ lseek(fd, SEEK_SET, 0); ++ if (memcmp(buf, "TZif", 4)) { ++ return 0; ++ } ++ } ++ return S_ISREG(st->st_mode) && st->st_size > 20; ++} ++ ++/* To allow timezone names to be used case-insensitively, find the ++ * canonical name for this timezone, if possible. */ ++static const char *canonical_tzname(const char *timezone) ++{ ++ if (timezonedb_system) { ++ timelib_tzdb_index_entry *ent, lookup; ++ ++ lookup.id = (char *)timezone; ++ ++ ent = bsearch(&lookup, timezonedb_system->index, ++ timezonedb_system->index_size, sizeof lookup, ++ sysdbcmp); ++ if (ent) { ++ return ent->id; ++ } ++ } ++ ++ return timezone; ++} ++ ++/* Return the mmap()ed tzfile if found, else NULL. On success, the ++ * length of the mapped data is placed in *length. */ ++static char *map_tzfile(const char *timezone, size_t *length) ++{ ++ char fname[PATH_MAX]; ++ struct stat st; ++ char *p; ++ int fd; ++ ++ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { ++ return NULL; ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); ++ ++ fd = open(fname, O_RDONLY); ++ if (fd == -1) { ++ return NULL; ++ } else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st, fd)) { ++ close(fd); ++ return NULL; ++ } ++ ++ *length = st.st_size; ++ p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0); ++ close(fd); ++ ++ return p != MAP_FAILED ? p : NULL; ++} ++ ++#endif ++ ++static int inmem_seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb) + { + int left = 0, right = tzdb->index_size - 1; + +@@ -438,9 +878,48 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const + return 0; + } + ++static int seek_to_tz_position(const unsigned char **tzf, char *timezone, ++ char **map, size_t *maplen, ++ const timelib_tzdb *tzdb) ++{ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (tzdb == timezonedb_system) { ++ char *orig; ++ ++ orig = map_tzfile(timezone, maplen); ++ if (orig == NULL) { ++ return 0; ++ } ++ ++ (*tzf) = (unsigned char *)orig; ++ *map = orig; ++ return 1; ++ } ++ else ++#endif ++ { ++ return inmem_seek_to_tz_position(tzf, timezone, tzdb); ++ } ++} ++ + const timelib_tzdb *timelib_builtin_db(void) + { ++#ifdef HAVE_SYSTEM_TZDATA ++ if (timezonedb_system == NULL) { ++ timelib_tzdb *tmp = malloc(sizeof *tmp); ++ ++ tmp->version = "0.system"; ++ tmp->data = NULL; ++ create_zone_index(tmp); ++ system_location_table = create_location_table(); ++ fake_data_segment(tmp, system_location_table); ++ timezonedb_system = tmp; ++ } ++ ++ return timezonedb_system; ++#else + return &timezonedb_builtin; ++#endif + } + + const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(const timelib_tzdb *tzdb, int *count) +@@ -452,7 +931,30 @@ const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(const timelib_ + int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb) + { + const unsigned char *tzf; +- return (seek_to_tz_position(&tzf, timezone, tzdb)); ++ ++#ifdef HAVE_SYSTEM_TZDATA ++ if (tzdb == timezonedb_system) { ++ char fname[PATH_MAX]; ++ struct stat st; ++ ++ if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) { ++ return 0; ++ } ++ ++ if (system_location_table) { ++ if (find_zone_info(system_location_table, timezone) != NULL) { ++ /* found in cache */ ++ return 1; ++ } ++ } ++ ++ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone)); ++ ++ return stat(fname, &st) == 0 && is_valid_tzfile(&st, 0); ++ } ++#endif ++ ++ return (inmem_seek_to_tz_position(&tzf, timezone, tzdb)); + } + + static int skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz) +@@ -494,12 +996,14 @@ static timelib_tzinfo* timelib_tzinfo_ctor(char *name) + timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, int *error_code) + { + const unsigned char *tzf; ++ char *memmap = NULL; ++ size_t maplen; + timelib_tzinfo *tmp; + int version; + int transitions_result, types_result; + unsigned int type; /* TIMELIB_TZINFO_PHP or TIMELIB_TZINFO_ZONEINFO */ + +- if (seek_to_tz_position(&tzf, timezone, tzdb)) { ++ if (seek_to_tz_position(&tzf, timezone, &memmap, &maplen, tzdb)) { + tmp = timelib_tzinfo_ctor(timezone); + + version = read_preamble(&tzf, tmp, &type); +@@ -534,11 +1038,36 @@ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, i + } + skip_posix_string(&tzf, tmp); + ++#ifdef HAVE_SYSTEM_TZDATA ++ if (memmap) { ++ const struct location_info *li; ++ ++ /* TZif-style - grok the location info from the system database, ++ * if possible. */ ++ ++ if ((li = find_zone_info(system_location_table, timezone)) != NULL) { ++ tmp->location.comments = timelib_strdup(li->comment); ++ strncpy(tmp->location.country_code, li->code, 2); ++ tmp->location.longitude = li->longitude; ++ tmp->location.latitude = li->latitude; ++ tmp->bc = 1; ++ } ++ else { ++ set_default_location_and_comments(&tzf, tmp); ++ } ++ ++ /* Now done with the mmap segment - discard it. */ ++ munmap(memmap, maplen); ++ } else { ++#endif + if (type == TIMELIB_TZINFO_PHP) { + read_location(&tzf, tmp); + } else { + set_default_location_and_comments(&tzf, tmp); + } ++#ifdef HAVE_SYSTEM_TZDATA ++ } ++#endif + } else { + *error_code = TIMELIB_ERROR_NO_SUCH_TIMEZONE; + tmp = NULL; |