summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Lamskoy2021-12-16 16:39:49 +0200
committerEugene Lamskoy2021-12-16 16:40:03 +0200
commit13eb9b35a781fb4e78bfbffcab3a9335c806541b (patch)
treef5009967ab6221a0ac2608ab8ac6622c2dd9fce7
parent659f2a36bd29cbf8ecfe516417012f7c58a048a9 (diff)
downloadaur-13eb9b35a781fb4e78bfbffcab3a9335c806541b.tar.gz
Reworked PKGBUILD. Chroot-tested with packages. Added Debian patches. Added more packages. Reorganized ini directory
-rw-r--r--.SRCINFO216
-rw-r--r--PKGBUILD1173
-rw-r--r--apache.conf13
-rw-r--r--apache.patch10
-rw-r--r--debian-php-8.1.0.patch328
-rwxr-xr-xgenerate_patches74
-rw-r--r--pear-config-patcher.php43
-rw-r--r--php-apache.conf13
-rw-r--r--php-fpm.patch76
-rw-r--r--php-fpm.tmpfiles1
-rw-r--r--php-phpinfo.patch22
-rw-r--r--php.ini.patch79
-rw-r--r--timezonedb-guess.patch27
-rw-r--r--timezonedb-php8.1.patch629
14 files changed, 2102 insertions, 602 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 0f6a61627eaa..9f24066b25e4 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,152 +1,254 @@
+# Generated by makepkg 6.0.1
+# Thu Dec 16 14:05:10 UTC 2021
pkgbase = php81
- pkgdesc = php 8.1.0 compiled as to not conflict with mainline php
+ pkgdesc = PHP 8.1.0 compiled as to not conflict with mainline php
pkgver = 8.1.0
- pkgrel = 4
- url = https://www.php.net/
- arch = x86_64
+ pkgrel = 5
+ url = http://www.php.net
arch = i686
+ arch = x86_64
license = PHP
checkdepends = procps-ng
+ makedepends = libtool
+ makedepends = autoconf
+ makedepends = automake
+ makedepends = patchelf
+ makedepends = awk
+ makedepends = sed
+ makedepends = sh
+ makedepends = python
+ makedepends = libxml2
+ makedepends = pam
+ makedepends = openssl
+ makedepends = openssl-1.0
+ makedepends = argon2
+ makedepends = libmcrypt
+ makedepends = libsodium
+ makedepends = libldap
+ makedepends = libsasl
+ makedepends = krb5
+ makedepends = libxslt
+ makedepends = libzip
+ makedepends = freetds
makedepends = apache
makedepends = aspell
makedepends = c-client
makedepends = db
makedepends = enchant
- makedepends = gd
+ makedepends = readline
makedepends = gmp
makedepends = icu
- makedepends = libsodium
- makedepends = libxslt
- makedepends = libzip
makedepends = net-snmp
makedepends = postgresql-libs
makedepends = sqlite
- makedepends = systemd
- makedepends = tidy
+ makedepends = systemd-libs
makedepends = unixodbc
makedepends = curl
- makedepends = libtool
- makedepends = postfix
+ makedepends = ncurses
makedepends = freetds
- makedepends = pcre2
- makedepends = libnsl
+ makedepends = pcre
+ makedepends = tidy
+ makedepends = libfbclient
makedepends = oniguruma
- makedepends = patchutils
+ makedepends = gd
+ makedepends = recode
+ makedepends = bzip2
+ makedepends = gdbm
+ makedepends = zlib
source = https://php.net/distributions/php-8.1.0.tar.xz
- source = apache.patch
- source = apache.conf
- source = php-fpm.patch
- source = php-fpm.tmpfiles
- source = php.ini.patch
+ source = pear-config-patcher.php
+ source = php-apache.conf
+ source = debian-php-8.1.0.patch
+ source = php-phpinfo.patch
+ source = timezonedb-guess.patch
+ source = timezonedb-php8.1.patch
sha256sums = a1317eff0723a2b3d3122bbfe107a1158570ea2822dc35a5fb360086db0f6bbc
- sha256sums = 702b163c66c65af92dcad8d79f41bda84bcd5d863235fcf1497c33a86db9e4ca
- sha256sums = 4a2add00d93fa991ccdf6356090264c1059c79935642afff6e8d4a2107fa037e
- sha256sums = 96e0b05a5ec72ee0f907d29fbb9612414d9dfebeee1249cbf2f2318bacf2d37c
- sha256sums = eb0c0aec5b5fb282df0bfefd4d5bbc229ee80a5c5da6760ecf52697a23cc7175
- sha256sums = cc17f28807c63c49c6047fbaf19384f348af51bb0e737b364b9780e7b3cd4050
+ sha256sums = 0201d0fa811b80614737424a72c7bb127125807e5d7eeec5e1578a0a58f77d2f
+ sha256sums = 6d0ad9becb5470ce8e5929d7d45660b0f32579038978496317544c5310281a91
+ sha256sums = 0df807d84bc0cf948a6ed0cf453e98213d47fbc7fdedc2747855a619dc616b3c
+ sha256sums = 558e780e93dfa861a366c49b4d156d8fc43f17898f001ae6033ec63c33d5d41c
+ sha256sums = 40bcc1e5058602302198d0925e431495391d8469499593af477f59d84d32f764
+ sha256sums = e2b4bad971ed569e9e898dcb2c7451d53e9b55f473123bbd4765d126efea6466
pkgname = php81
pkgdesc = A general-purpose scripting language that is especially suited to web development
- depends = libxml2
- depends = hspell
- depends = nuspell
- depends = libvoikko
- depends = curl
- depends = libzip
- depends = pcre2
+ depends = zlib
+ depends = pcre
+ depends = oniguruma
+ depends = readline
depends = argon2
+ depends = openssl-1.0
+ depends = openssl
backup = etc/php81/php.ini
+pkgname = php81-cli
+ pkgdesc = cli (command-line executable) version for php81
+ depends = php81
+
pkgname = php81-cgi
- pkgdesc = CGI and FCGI SAPI for PHP
+ pkgdesc = CGI and FCGI SAPI for php81
depends = php81
pkgname = php81-apache
- pkgdesc = Apache SAPI for PHP
+ pkgdesc = Apache SAPI for php81
depends = php81
depends = apache
- backup = etc/httpd/conf/extra/php81_module.conf
+ backup = etc/httpd/conf/extra/
pkgname = php81-fpm
- pkgdesc = FastCGI Process Manager for PHP
+ pkgdesc = FastCGI Process Manager for php81
depends = php81
- depends = systemd
+ depends = systemd-libs
options = !emptydirs
backup = etc/php81/php-fpm.conf
backup = etc/php81/php-fpm.d/www.conf
pkgname = php81-embed
- pkgdesc = Embedded PHP SAPI library
+ pkgdesc = Embedded PHP SAPI library for php81
depends = php81
- depends = libsystemd
+ depends = ncurses
+ depends = systemd-libs
options = !emptydirs
-pkgname = php81-phpdbg
- pkgdesc = Interactive PHP debugger
+pkgname = php81-bz2
+ pkgdesc = bz2 module for php81
depends = php81
- options = !emptydirs
+ depends = bzip2
+
+pkgname = php81-bcmath
+ pkgdesc = bcmath module for php81
+ depends = php81
+
+pkgname = php81-curl
+ pkgdesc = curl module for php81
+ depends = php81
+ depends = curl
pkgname = php81-dblib
- pkgdesc = dblib module for PHP
+ pkgdesc = 81
depends = php81
depends = freetds
+ provides = php81-sybase=8.1.0
+
+pkgname = php81-dba
+ pkgdesc = dba module for php81
+ depends = php81
+ depends = gdbm
+ depends = db
pkgname = php81-enchant
- pkgdesc = enchant module for PHP
+ pkgdesc = enchant module for php81
depends = php81
depends = enchant
pkgname = php81-gd
- pkgdesc = gd module for PHP
+ pkgdesc = gd module for php81
depends = php81
depends = gd
+ depends = libxpm
+ depends = libpng
+ depends = libjpeg
+
+pkgname = php81-gmp
+ pkgdesc = gmp module for php81
+ depends = php81
+ depends = gmp
pkgname = php81-imap
- pkgdesc = imap module for PHP
+ pkgdesc = imap module for php81
depends = php81
+ depends = pam
+ depends = krb5
depends = c-client
pkgname = php81-intl
- pkgdesc = intl module for PHP
+ pkgdesc = intl module for php81
depends = php81
depends = icu
+pkgname = php81-interbase
+ pkgdesc = Interbase modules for php81
+ depends = php81
+ depends = libfbclient
+
+pkgname = php81-ldap
+ pkgdesc = ldap module for php81
+ depends = php81
+ depends = libldap
+ depends = libsasl
+
+pkgname = php81-mysql
+ pkgdesc = MySQL modules for php81
+ depends = php81
+
pkgname = php81-odbc
- pkgdesc = ODBC modules for PHP
+ pkgdesc = ODBC modules for php81
depends = php81
depends = unixodbc
pkgname = php81-pgsql
- pkgdesc = PostgreSQL modules for PHP
+ pkgdesc = PostgreSQL modules for php81
depends = php81
depends = postgresql-libs
pkgname = php81-pspell
- pkgdesc = pspell module for PHP
+ pkgdesc = pspell module for php81
depends = php81
depends = aspell
pkgname = php81-snmp
- pkgdesc = snmp module for PHP
+ pkgdesc = snmp module for php81
depends = php81
depends = net-snmp
-pkgname = php81-sqlite
- pkgdesc = sqlite module for PHP
+pkgname = php81-soap
+ pkgdesc = soap module for php81
depends = php81
- depends = sqlite
+ depends = libxml2
pkgname = php81-tidy
- pkgdesc = tidy module for PHP
+ pkgdesc = tidy module for php81
depends = php81
depends = tidy
+pkgname = php81-sqlite
+ pkgdesc = sqlite module for php81
+ depends = php81
+ depends = sqlite
+
+pkgname = php81-xml
+ pkgdesc = xml modules for php81
+ depends = php81
+ depends = libxml2
+
pkgname = php81-xsl
- pkgdesc = xsl module for PHP
+ pkgdesc = xsl module for php81
depends = php81
+ depends = php81-xml=8.1.0
depends = libxslt
+ depends = libxml2
+
+pkgname = php81-zip
+ pkgdesc = zip module for php81
+ depends = php81
+ depends = libzip
+
+pkgname = php81-phpdbg
+ pkgdesc = Interactive PHP debugger for php81
+ depends = php81
+ options = !emptydirs
+
+pkgname = php81-pear
+ pkgdesc = PHP Extension and Application Repository for php81
+ depends = php81
+ depends = php81-xml
+ backup = etc/php81/pear.conf
+
+pkgname = php81-opcache
+ pkgdesc = opcache zend module for php81
+ depends = php81
pkgname = php81-sodium
- pkgdesc = sodium module for PHP
+ pkgdesc = sodium (libsodium) module for php81
depends = php81
depends = libsodium
diff --git a/PKGBUILD b/PKGBUILD
index 58b32f119461..4df54f904f6f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,399 +1,988 @@
-# Build props
-phpbase=81
-pkgver=8.1.0
-pkgrel=4
-# Custom suffix
-suffix=
-
-arch=('x86_64' 'i686')
+_phpbase="81"
+_suffix=""
+pkgver="8.1.0"
+pkgrel="5"
+pkgbase="php${_phpbase}${_suffix}"
+pkgdesc="PHP ${pkgver} compiled as to not conflict with mainline php"
+_cppflags=" -DU_USING_ICU_NAMESPACE=1 "
+
+_pkgver_icu="64-1"
+_suffix=""
+_suffix_so=""
+
+pkgname=(
+ "${pkgbase}"
+ "php${_phpbase}-cli${_suffix}"
+ "php${_phpbase}-cgi${_suffix}"
+ "php${_phpbase}-apache${_suffix}"
+ "php${_phpbase}-fpm${_suffix}"
+ "php${_phpbase}-embed${_suffix}"
+ "php${_phpbase}-bz2${_suffix}"
+ "php${_phpbase}-bcmath${_suffix}"
+ "php${_phpbase}-curl${_suffix}"
+ "php${_phpbase}-dblib${_suffix}"
+ "php${_phpbase}-dba${_suffix}"
+ "php${_phpbase}-enchant${_suffix}"
+ "php${_phpbase}-gd${_suffix}"
+ "php${_phpbase}-gmp${_suffix}"
+ "php${_phpbase}-imap${_suffix}"
+ "php${_phpbase}-intl${_suffix}"
+ "php${_phpbase}-interbase${_suffix}"
+ "php${_phpbase}-ldap${_suffix}"
+ "php${_phpbase}-mysql${_suffix}"
+ "php${_phpbase}-odbc${_suffix}"
+ "php${_phpbase}-pgsql${_suffix}"
+ "php${_phpbase}-pspell${_suffix}"
+ "php${_phpbase}-snmp${_suffix}"
+ "php${_phpbase}-soap${_suffix}"
+ "php${_phpbase}-tidy${_suffix}"
+ "php${_phpbase}-sqlite${_suffix}"
+ "php${_phpbase}-xml${_suffix}"
+ "php${_phpbase}-xsl${_suffix}"
+ "php${_phpbase}-zip${_suffix}"
+ "php${_phpbase}-phpdbg${_suffix}"
+ "php${_phpbase}-pear${_suffix}"
+ "php${_phpbase}-opcache${_suffix}"
+ "php${_phpbase}-sodium${_suffix}"
+)
+
+source=(
+ "https://php.net/distributions/php-${pkgver}.tar.xz"
+ "pear-config-patcher.php"
+ "php-apache.conf"
+ "debian-php-8.1.0.patch"
+ "php-phpinfo.patch"
+ "timezonedb-guess.patch"
+ "timezonedb-php8.1.patch"
+)
+
+depends=(
+)
+
+checkdepends=(
+ "procps-ng"
+)
+
+arch=(
+ "i686"
+ "x86_64"
+)
+
+_patches=(
+ "debian-php-8.1.0.patch"
+ "php-phpinfo.patch"
+ "timezonedb-guess.patch"
+ "timezonedb-php8.1.patch"
+)
+
+_build_apache_cfg="etc/httpd/conf/extra"
+_build_bundled_gd="0"
+_build_ffi="1"
+_build_fpm_group="http"
+_build_fpm_user="http"
+_build_icu_src_dir="icu/source"
+_build_interbase="0"
+_build_json="0"
+_build_mcrypt="0"
+_build_mssql="0"
+_build_opcache="1"
+_build_openssl_v10_patch="0"
+_build_openssl_v11_patch="0"
+_build_outdated_mysql="0"
+_build_pear="1"
+_build_per_sapi="0"
+_build_phpdbg="1"
+_build_recode="0"
+_build_shared_gd="1"
+_build_sodium="1"
+_build_static_pdo="0"
+_build_uses_autoconf="1"
+_build_wddx="0"
+_build_with_custom_icu="0"
+_build_xmlrpc="0"
+_priority_default="20"
+_priority_json="15"
+_priority_mysqlnd="10"
+_priority_opcache="10"
+_priority_pdo="10"
+_priority_xml="15"
+_phpextensions="\
+ --enable-bcmath=shared \
+ --with-bz2=shared,/usr \
+ --with-gmp=shared,/usr \
+ --enable-intl=shared \
+ --with-pspell=shared,/usr \
+ --with-snmp=shared,/usr \
+ --with-tidy=shared,/usr \
+ --enable-filter \
+ --with-readline \
+ --enable-pcntl \
+ --enable-calendar=shared \
+ --enable-ctype=shared \
+ --enable-exif=shared \
+ --enable-fileinfo=shared \
+ --enable-ftp=shared \
+ --with-gettext=shared,/usr \
+ --with-iconv=shared \
+ --enable-phar=shared \
+ --enable-posix=shared \
+ --enable-shmop=shared \
+ --enable-sockets=shared \
+ --enable-sysvmsg=shared \
+ --enable-sysvsem=shared \
+ --enable-sysvshm=shared \
+ --enable-tokenizer=shared \
+ --enable-mysqlnd=shared \
+ --enable-mysqlnd-compression-support \
+ --with-mysqli=shared,mysqlnd \
+ --with-pdo-mysql=shared,mysqlnd \
+ --with-mysql-sock=/run/mysqld/mysqld.sock \
+ --enable-dom=shared \
+ --enable-simplexml=shared \
+ --enable-xml=shared \
+ --enable-xmlreader=shared \
+ --enable-xmlwriter=shared \
+ --with-xsl=shared \
+ --enable-dba=shared \
+ --with-db4=/usr \
+ --with-gdbm \
+ --enable-inifile \
+ --enable-flatfile \
+ --with-imap=shared,/usr \
+ --with-kerberos \
+ --with-imap-ssl=yes \
+ --with-password-argon2 \
+ --with-ffi=shared \
+ --with-zip=shared \
+ --with-curl=shared \
+ --with-enchant=shared \
+ --with-pcre-jit \
+ --with-external-pcre=/usr \
+ --with-openssl \
+ --with-unixODBC=shared \
+ --with-pdo-odbc=shared,unixODBC,/usr \
+ --with-ldap=shared,/usr \
+ --with-ldap-sasl \
+ --with-pdo-sqlite=shared,/usr \
+ --with-sqlite3=shared \
+ --enable-gd=shared \
+ --with-external-gd=/usr \
+ --with-jpeg \
+ --with-xpm \
+ --with-webp \
+ --with-freetype \
+ --enable-pdo=shared \
+ --with-zlib \
+ --with-pdo-firebird=shared,/usr \
+ --with-pgsql=shared,/usr \
+ --with-pdo-pgsql=shared,/usr \
+ --enable-soap=shared \
+ --enable-opcache \
+ --enable-huge-code-pages \
+ --with-sodium=shared \
+ --enable-mbstring=shared \
+ --enable-mbregex \
+ --with-pdo-dblib=shared,/usr"
+
+_phpconfig="\
+ --prefix=/usr \
+ --sbindir=/usr/bin \
+ --localstatedir=/var \
+ --with-layout=GNU \
+ --disable-debug \
+ --mandir=/usr/share/man \
+ --srcdir=../php-${pkgver} \
+ --sysconfdir=/etc/php${_phpbase}${_suffix} \
+ --libdir=/usr/lib/php${_phpbase}${_suffix} \
+ --datadir=/usr/share/php${_phpbase}${_suffix} \
+ --program-suffix=${_phpbase}${_suffix} \
+ --with-config-file-path=/etc/php${_phpbase}${_suffix} \
+ --with-config-file-scan-dir=/etc/php${_phpbase}${_suffix}/conf.d \
+ --without-pear \
+ --datarootdir=/usr/share/php${_phpbase}${_suffix} \
+ --disable-rpath \
+ --config-cache \
+ --with-system-tzdata"
+
+_phpextensions_fpm="\
+ --with-fpm-user=${_build_fpm_user} \
+ --with-fpm-group=${_build_fpm_group} \
+ --with-fpm-systemd \
+ --with-fpm-acl"
+
+
+
+makedepends=(
+ 'libtool' 'autoconf' 'automake' 'patchelf' 'awk' 'sed' 'sh' 'python' 'libxml2' 'pam'
+ 'openssl' 'openssl-1.0' 'argon2' 'libmcrypt' 'libsodium' 'libldap' 'libsasl' 'krb5'
+ 'libxslt' 'libzip' 'freetds' 'apache' 'aspell' 'c-client' 'db' 'enchant' 'readline'
+ 'gmp' 'icu' 'net-snmp' 'postgresql-libs' 'sqlite' 'systemd-libs' 'unixodbc' 'curl' 'ncurses'
+ 'freetds' 'pcre' 'tidy' 'libfbclient' 'oniguruma' 'gd' 'recode' 'bzip2' 'gdbm' 'zlib'
+)
+arch=('i686' 'x86_64')
+checkdepends=('procps-ng')
license=('PHP')
-url='https://www.php.net/'
+url='http://www.php.net'
-# Has php string
-_base="php"
-# Calculated
-pkgdesc="${_base} ${pkgver} compiled as to not conflict with mainline ${_base}"
-pkgbase="${_base}${phpbase}${suffix}"
-pkgname=("${pkgbase}" "${_base}${phpbase}-"{cgi,apache,fpm,embed,phpdbg,dblib,enchant,gd,imap,intl,odbc,pgsql,pspell,snmp,sqlite,tidy,xsl,sodium}${suffix})
+# Prepare it
+prepare() {
+ pushd "php-${pkgver}"
+ echo "[SED] sapi/apache2handler/config.m4 and configure"
+ sed -e '/APACHE_THREADED_MPM=/d' \
+ -i sapi/apache2handler/config.m4 \
+ -i configure
+
+ echo "[SED] sapi/fpm/Makefile.frag"
+ sed -e 's#php-fpm\$(program_suffix)#php\$(program_suffix)-fpm#' \
+ -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@/php${_phpbase}${_suffix}-fpm|g; \
+ s|PIDFile[\s]?=[\s]?@([a-zA-Z_]+)@/run/php-fpm.pid|PIDFile=/run/php${_phpbase}${_suffix}-fpm/php-fpm.pid|g" \
+ -i sapi/fpm/php-fpm.service.in
+
+ 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/php${_phpbase}${_suffix}-fpm/php-fpm.sock#" \
+ -e "s#run/php-fpm.pid#/run/php${_phpbase}${_suffix}-fpm/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
+
+ echo "[SED] php.ini-production"
+ sed -e 's#^;*[ \t]*extension_dir[\t ]*=.*/.*$#extension_dir = "___EXTENSIONDIR___"#' \
+ -e "s#___EXTENSIONDIR___#/usr/lib/php${_phpbase}${_suffix}/modules#g" \
+ -e "s#^;*[ \t]*extension=#;extension=#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 ((_build_uses_autoconf)); then
+ autoconf
+ fi
+ echo "[SED] Sed for ${pkgdir}/usr/lib/php${_phpbase}${_suffix}/scripts/phpize.m4"
+ sed -i "/^\[ --with-php-config=/c \[ --with-php-config=PATH Path to php-config [php-config${_phpbase}${_suffix}]], php-config${_phpbase}${_suffix}, no)" "scripts/phpize.m4"
+ rm -f tests/output/stream_isatty_*.phpt
+ rm -f Zend/tests/arginfo_zpp_mismatch*.phpt
+ popd
+}
-makedepends=('apache' 'aspell' 'c-client' 'db' 'enchant' 'gd' 'gmp' 'icu' 'libsodium' 'libxslt' 'libzip' 'net-snmp'
- 'postgresql-libs' 'sqlite' 'systemd' 'tidy' 'unixodbc' 'curl' 'libtool' 'postfix' 'freetds' 'pcre2' 'libnsl'
- 'oniguruma' 'patchutils')
-checkdepends=('procps-ng')
+# BUILD them all
+build() {
+ export EXTENSION_DIR="/usr/lib/php${_phpbase}${_suffix}/modules"
+ if ((_build_openssl_v10_patch)); then
+ export PHP_OPENSSL_DIR="/usr/lib/openssl-1.0"
+ fi
-source=("https://php.net/distributions/${_base}-${pkgver}.tar.xz"
- 'apache.patch' 'apache.conf' 'php-fpm.patch' 'php-fpm.tmpfiles' 'php.ini.patch')
+ 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/php${_phpbase}${_suffix}/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
+ make install
+ ./configure --prefix="/usr/lib/php${_phpbase}${_suffix}/icu${_pkgver_icu}" \
+ --sysconfdir="/usr/lib/php${_phpbase}${_suffix}/icu${_pkgver_icu}/etc" \
+ --mandir="/usr/lib/php${_phpbase}${_suffix}/icu${_pkgver_icu}/share/man" \
+ --sbindir="/usr/lib/php${_phpbase}${_suffix}/icu${_pkgver_icu}/bin" \
+ --libdir="/usr/lib/php${_phpbase}${_suffix}/icu${_pkgver_icu}/lib" \
+ --includedir="/usr/lib/php${_phpbase}${_suffix}/icu${_pkgver_icu}/include" \
+ --disable-tests \
+ --disable-debug
+ make
+ popd
+ fi
-# Version specific"
-name_libapache_source="libphp.so"
-name_libembed_source="libphp.so"
+ if [[ ! -z "${_cppflags}" ]]; then
+ CPPFLAGS+=" $_cppflags "
+ fi
+ if [[ ! -z "${_ldflags}" ]]; then
+ LDFLAGS+=" $_ldflags "
+ fi
-# Path
-path_prefix="usr"
-path_config="etc/${pkgbase}"
-path_extensions="${path_prefix}/lib/${pkgbase}/modules"
-# Binary names
-name_phpconfig="php-config${phpbase}${suffix}"
-name_phpize="phpize${phpbase}${suffix}"
-name_phar="phar${phpbase}${suffix}"
+ echo "[DEBUG] CPPFLAGS ${_cppflags}"
+ echo "[DEBUG] LDGFLAGS ${_ldflags}"
+ echo "[DEBUG] PHPCONF ${_phpconfig}" | sed -E 's|[ \t]+|\n|g';
+ echo "[DEBUG] PHPEXT ${_phpextensions}" | sed -E 's|[ \t]+|\n |g';
+ echo "[DEBUG] FPMEXT ${_phpextensions_fpm}" | sed -E 's|[ \t]+|\n|g';
-# Conf names
-name_apache_module_conf="${pkgbase/-/_}_module.conf"
+ if [[ ! -d "build" ]]; then
+ mkdir "build"
+ fi
-prepare() {
- cd "${_base}-${pkgver}"
- patch -p0 -i ${srcdir}/apache.patch
- patch -p0 -i ${srcdir}/php-fpm.patch
- patch -p0 -i ${srcdir}/php.ini.patch
- autoconf
- rm tests/output/stream_isatty_*.phpt
- rm Zend/tests/arginfo_zpp_mismatch*.phpt
-}
+ pushd "build"
+ if [[ -L configure ]]; then
+ rm configure
+ fi
-build() {
- # http://site.icu-project.org/download/61#TOC-Migration-Issues
- #unset CPPFLAGS
- CPPFLAGS+=' -DU_USING_ICU_NAMESPACE=1'
- CPPFLAGS+=' -DEL_BUILD=1'
- export EXTENSION_DIR="/${path_extensions}"
-
- local _phpconfig="--srcdir=../${_base}-${pkgver} \
- --config-cache \
- --cache-file=config-${pkgbase}-${pkgver}-${pkgrel}.cache
- --prefix=/${path_prefix} \
- --sbindir=/${path_prefix}/bin \
- --sysconfdir=/${path_config} \
- --localstatedir=/var \
- --libdir=/${path_prefix}/lib/${pkgbase} \
- --datarootdir=/${path_prefix}/share/${pkgbase} \
- --datadir=/${path_prefix}/share/${pkgbase} \
- --program-suffix=${phpbase}${suffix} \
- --with-layout=GNU \
- --with-config-file-path=/${path_config} \
- --with-config-file-scan-dir=/${path_config}/conf.d \
- --disable-rpath \
- --mandir=/${path_prefix}/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=/${path_prefix} \
- --with-enchant=shared \
- --with-external-gd \
- --with-external-pcre \
- --with-ffi=shared \
- --with-gdbm \
- --with-gettext=shared \
- --with-gmp=shared \
- --with-iconv=shared \
- --with-imap-ssl \
- --with-imap=shared \
- --with-kerberos \
- --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,/${path_prefix} \
- --with-pdo-mysql=shared,mysqlnd \
- --with-pdo-odbc=shared,unixODBC,/${path_prefix} \
- --with-pdo-pgsql=shared \
- --with-pdo-sqlite=shared \
- --with-pgsql=shared \
- --with-pspell=shared \
- --with-readline \
- --with-snmp=shared \
- --with-sodium=shared \
- --with-sqlite3=shared \
- --with-tidy=shared \
- --with-unixODBC=shared \
- --with-xsl=shared \
- --with-zlib \
- --with-zip=shared \
- "
-
-
- # php
- if [ ! -d "${srcdir}/build" ]; then
- mkdir "${srcdir}/build"
+ ln -s "../php-${pkgver}/configure"
+ popd
+ if (( ! _build_per_sapi )); then
+ # SAPIs: cli+cgi+fpm+embed
+ pushd "build"
+ ./configure ${_phpconfig} \
+ --enable-cgi \
+ --enable-fpm \
+ ${_phpextensions_fpm} \
+ --enable-embed=shared \
+ ${_phpextensions}
+ make
+ popd
+ else
+ # Per sapi build: cli,cgi,fpm,embed
+
+ # cli
+ pushd "build"
+ ./configure ${_phpconfig} \
+ --disable-cgi \
+ ${_phpextensions}
+ make
+ popd
+ # cgi
+ cp -Ta build build-cgi
+ pushd build-cgi
+ ./configure ${_phpconfig} \
+ --disable-cli \
+ --enable-cgi \
+ ${_phpextensions}
+ make
+ popd
+
+ # fpm
+ cp -Ta build build-fpm
+ pushd build-fpm
+ ./configure ${_phpconfig} \
+ --disable-cli \
+ --enable-fpm \
+ ${_phpextensions_fpm} \
+ ${_phpextensions}
+ make
+ popd
+
+
+ # embed
+ cp -Ta build build-embed
+ pushd build-embed
+ ./configure ${_phpconfig} \
+ --disable-cli \
+ --enable-embed=shared \
+ ${_phpextensions}
+ make
+ popd
fi
- cd "${srcdir}/build"
- if [ -L configure ]; then
- rm configure
+
+ # apache build
+ cp -a "build" "build-apache"
+ pushd "build-apache"
+ ./configure ${_phpconfig} \
+ --with-apxs2 \
+ ${_phpextensions}
+ make
+ popd
+
+ # phpdbg build
+ if ((_build_phpdbg)); then
+ cp -a "build" "build-phpdbg"
+ pushd "build-phpdbg"
+ ./configure ${_phpconfig} \
+ --enable-phpdbg \
+ ${_phpextensions}
+ make
+ popd
fi
- ln -s ../${_base}-${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
+
+ # PEAR build
+ if ((_build_pear)); then
+ cp -a "build" "build-pear"
+ # Pear can't be built properly with shared xml
+ local _ext_pear=$(echo ${_phpextensions} | sed 's/--enable-xml=shared/--enable-xml/g')
+ export PEAR_INSTALLDIR="/usr/share/php${_phpbase}${_suffix}/pear"
+ pushd "build-pear"
+ ./configure ${_phpconfig} \
+ --disable-cgi \
+ --with-pear \
+ ${_ext_pear}
+ make
+ popd
+ fi
+ unset EXTENSION_DIR
}
check() {
- #unset CPPFLAGS
- cd ${srcdir}/build
-
+ pushd "php-${pkgver}"
# Check if sendmail was configured correctly (FS#47600)
- sapi/cli/php -n -r 'echo ini_get("sendmail_path");' | grep -q '/usr/bin/sendmail'
+ ../build/sapi/cli/php -n -r 'echo ini_get("sendmail_path");' | grep -q '/usr/bin/sendmail'
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'
- make test
+
+ if ((_phpbase <= 54)); then
+ TEST_PHP_EXECUTABLE="../build/sapi/cli/php" \
+ ../build/sapi/cli/php -n run-tests.php -n {tests,Zend}
+ elif ((_phpbase >= 55 && _phpbase < 73)); then
+ ../build/sapi/cli/php -n run-tests.php -n -P {tests,Zend}
+ elif ((73 == _phpbase)); then
+ export TESTS='tests Zend'
+ make test
+ elif ((_phpbase > 73)); then
+ export TEST_PHP_ARGS="-j$(nproc)"
+ export TESTS='tests Zend'
+ make test
+ fi
+ popd
}
+# 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}"
+ ;;
+ "mysqlnd")
+ priority="${_priority_mysqlnd}"
+ ;;
+ "pdo")
+ priority="${_priority_pdo}"
+ ;;
+ "opcache")
+ priority="${_priority_opcache}"
+ ;;
+ esac
+ local extension_type="extension"
+ case "${extension}" in
+ "opcache" | "xdebug")
+ extension_type="zend_extension"
+ ;;
+ "recode")
+ extension_type=";extension"
+ ;;
+ esac
+
+ if [[ ! -d "${pkgdir}/etc/php${_phpbase}${_suffix}/conf.d" ]]; then
+ mkdir -p "${pkgdir}/etc/php${_phpbase}${_suffix}/conf.d"
+ fi
+ echo "${extension_type}=${extension}.so" > "${pkgdir}/etc/php${_phpbase}${_suffix}/conf.d/${priority}-${extension}.ini"
+ chmod 0644 "$pkgdir/etc/php${_phpbase}${_suffix}/conf.d/${priority}-${extension}.ini"
+ _last_priority=${priority}
+ _last_extension=${extension}
+}
+
+_install_module() {
+ install -D -m755 "build/modules/${1}.so" "${pkgdir}/usr/lib/php${_phpbase}${_suffix}/modules/${1}.so";
+ _install_module_ini "${1}"
+}
+# Custom code end
+
package_php81() {
+ # Binary names
pkgdesc='A general-purpose scripting language that is especially suited to web development'
- depends=('libxml2' 'hspell' 'nuspell' 'libvoikko' 'curl' 'libzip' 'pcre2' 'argon2')
- backup=("etc/${pkgbase}/php.ini")
- #provides=("${pkgbase}=${pkgver}")
+ depends=('zlib' 'pcre' 'oniguruma' 'readline' 'argon2')
+ if ((_build_openssl_v10_patch)); then
+ depends+=("openssl-1.0")
+ else
+ depends+=("openssl")
+ fi
+ backup=("etc/php${_phpbase}${_suffix}/php.ini")
+ if ((_build_with_custom_icu)); then
+ pushd "${_build_icu_src_dir}"
+ make DESTDIR="${pkgdir}" install
+ make clean
+ popd
+ pushd "${pkgdir}/usr/lib/php${_phpbase}${_suffix}/icu${_pkgver_icu}"
+ rm -rf bin include share
+ popd
+ fi
+ pushd "build"
+ make -j1 INSTALL_ROOT=${pkgdir} install-{modules,build,headers,programs,pharcmd}
- cd ${srcdir}/build
- make -j1 INSTALL_ROOT=${pkgdir} install-{modules,cli,build,headers,programs,pharcmd}
- install -D -m644 ${srcdir}/${_base}-${pkgver}/php.ini-production ${pkgdir}/${path_config}/php.ini
- install -d -m755 ${pkgdir}/${path_config}/conf.d/
+ install -D -m644 "../php-${pkgver}/php.ini-production" "${pkgdir}/etc/php${_phpbase}${_suffix}/php.ini"
+ install -d -m755 "${pkgdir}/etc/php${_phpbase}${_suffix}/conf.d/"
+ pushd "${pkgdir}/usr/lib/php${_phpbase}${_suffix}/modules/"
# remove static modules
- rm -f ${pkgdir}/${path_extensions}/*.a
+ rm -f *.a
+
# remove modules provided by sub packages
- rm -f ${pkgdir}/${path_extensions}/{enchant,gd,imap,intl,sodium,odbc,pdo_dblib,pdo_odbc,pgsql,pdo_pgsql,pspell,snmp,sqlite3,pdo_sqlite,tidy,xsl}.so
+ rm -f {enchant,imap,intl,pspell,snmp,tidy,curl,ldap,bz2,bcmath,soap,zip,gmp,dba,opcache,json,gd,mcrypt,sodium,recode}.so
+ # dblib package
+ rm -rf {pdo_dblib,mssql}.so
+ # xml package
+ rm -f {dom,simplexml,xml,xmlreader,xmlwriter,xsl,wddx,xmlrpc}.so
+ # PostgreSQL
+ rm -f {pgsql,pdo_pgsql}.so
+ # ODBC
+ rm -f {odbc,pdo_odbc}.so
+ # SQLite
+ rm -f {pdo_sqlite,sqlite3}.so
+ # pdo_firebird
+ rm -f {pdo_firebird.so,interbase.so}
+ # MySQL modules
+ rm -f {mysqli,pdo_mysql,mysqlnd,mysql}.so
+
+ # Install COMMON modules
+ for i in *.so; do
+ _install_module_ini "${i}"
+ done
+ popd
+
# remove empty directory
- rmdir ${pkgdir}/${path_prefix}/include/php/include
+ rmdir "${pkgdir}/usr/include/php/include"
# move include directory
- mv ${pkgdir}/${path_prefix}/include/php ${pkgdir}/${path_prefix}/include/${pkgbase}
+ mv "${pkgdir}/usr/include/php" "${pkgdir}/usr/include/php${_phpbase}${_suffix}"
- # fix phar symlink
- #rm ${pkgdir}/${path_prefix}/bin/phar
- ln -sf ${name_phar}.phar ${pkgdir}/${path_prefix}/bin/${name_phar}
+ # Link to phar
+ ln -sf "phar${_phpbase}${_suffix}.phar" "${pkgdir}/usr/bin/phar${_phpbase}${_suffix}"
# rename executables
- #mv ${pkgdir}/${path_prefix}/bin/phar.phar ${pkgdir}/${path_prefix}/bin/${name_phar}.phar
-
+ if [[ -f "${pkgdir}/usr/bin/phar.phar" ]]; then
+ mv "${pkgdir}/usr/bin/phar.phar" "${pkgdir}/usr/bin/phar${_phpbase}${_suffix}.phar"
+ fi
# rename man pages
- #mv ${pkgdir}/${path_prefix}/share/man/man1/{phar,${name_phar}}.1
- #mv ${pkgdir}/${path_prefix}/share/man/man1/phar.{phar,${name_phar}}.1
+ if [[ -f "${pkgdir}/usr/share/man/man1/phar.1" ]]; then
+ mv "${pkgdir}/usr/share/man/man1/phar.1" \
+ "${pkgdir}/usr/share/man/man1/phar${_phpbase}${_suffix}.1"
+ fi
- # fix paths in executables
- sed -i "/^includedir=/c \includedir=/${path_prefix}/include/${pkgbase}" ${pkgdir}/${path_prefix}/bin/${name_phpize}
- sed -i "/^include_dir=/c \include_dir=/${path_prefix}/include/${pkgbase}" ${pkgdir}/${path_prefix}/bin/${name_phpconfig}
+ if [[ -f "${pkgdir}/usr/share/man/man1/phar.phar.1" ]]; then
+ mv "${pkgdir}/usr/share/man/man1/phar.phar.1" \
+ "${pkgdir}/usr/share/man/man1/phar.phar${_phpbase}${_suffix}.1"
+ fi
+
+ # kill phar symlink in old php builds
+ rm -f "${pkgdir}/usr/bin/phar"
- # make phpize use php-config${phpbase}
- sed -i "/^\[ --with-php-config=/c \[ --with-php-config=PATH Path to php-config [${name_phpconfig}]], ${name_phpconfig}, no)" ${pkgdir}/${path_prefix}/lib/${pkgbase}/build/phpize.m4
+ # fix paths in executables
+ echo "[SED] ${pkgdir}/usr/bin/phpize${_phpbase}${_suffix}"
+ sed -i "/^includedir=/c \includedir=/usr/include/php${_phpbase}${_suffix}" "${pkgdir}/usr/bin/phpize${_phpbase}${_suffix}"
+ echo "[SED] ${pkgdir}/usr/bin/php-config${_phpbase}${_suffix}"
+ sed -i "/^include_dir=/c \include_dir=/usr/include/php${_phpbase}${_suffix}" "${pkgdir}/usr/bin/php-config${_phpbase}${_suffix}"
+
+ #sed -i "/^php_cli_binary=/c \include_dir=/usr/bin/php${_phpbase}${_suffix}" "${pkgdir}/usr/bin/php-config${_phpbase}${_suffix}"
+ #sed -i "/^php_cgi_binary=/c \include_dir=/usr/bin/php-cgi${_phpbase}${_suffix}" "${pkgdir}/usr/bin/php-config${_phpbase}${_suffix}"
+
+ echo "[SED] Sed for ${pkgdir}/usr/lib/php${_phpbase}${_suffix}/build/phpize.m4"
+ sed -i "/^\[ --with-php-config=/c \[ --with-php-config=PATH Path to php-config [php-config${_phpbase}${_suffix}]], php-config${_phpbase}${_suffix}, no)" \
+ "${pkgdir}/usr/lib/php${_phpbase}${_suffix}/build/phpize.m4"
+ # popd
+ popd
+}
+# End install common
+
+# Cli
+package_php81-cli() {
+ pkgdesc="cli (command-line executable) version for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}")
+ pushd "build"
+ make -j1 INSTALL_ROOT="${pkgdir}" install-cli
+ popd
}
+# End cli
+# CGI
package_php81-cgi() {
- pkgdesc='CGI and FCGI SAPI for PHP'
- depends=("${pkgbase}")
- #provides=("${pkgbase}-cgi=${pkgver}")
-
- cd ${srcdir}/build
- make -j1 INSTALL_ROOT=${pkgdir} install-cgi
+ pkgdesc="CGI and FCGI SAPI for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}")
+ if ((_build_per_sapi)); then
+ pushd "build-cgi"
+ else
+ pushd "build"
+ fi
+ case "${_phpbase}" in
+ 53)
+ install -D -m755 sapi/cgi/php-cgi "${pkgdir}/usr/bin/php${_phpbase}${_suffix}-cgi"
+ ;;
+ *)
+ make -j1 INSTALL_ROOT="${pkgdir}" install-cgi
+ ;;
+ esac
+ popd
}
+# End CGI
package_php81-apache() {
- pkgdesc='Apache SAPI for PHP'
- depends=("${pkgbase}" 'apache')
- backup=("etc/httpd/conf/extra/${name_apache_module_conf}")
- #provides=("${pkgbase}-apache=${pkgver}")
+ _build_mod_php_so="libphp${_suffix_so}.so"
+ _build_mod_php_module="php_module${_suffix_so}"
+ _build_build_php_script_name="php${_suffix_so}-script"
+ _apache_module_conf="${pkgbase}-module.conf"
+ pkgdesc="Apache SAPI for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'apache')
+ backup=("${_build_apache_cfg}/${_apache_module_conf}")
echo "# End of LoadModule in httpd.conf - see ArchWiki Apache HTTP Server"
- echo "LoadModule php_module modules/lib${pkgbase}.so"
- echo "AddHandler php-script .php"
+ echo "LoadModule ${_build_mod_php_module} modules/libphp${_phpbase}${_suffix}.so"
+ echo "AddHandler ${_build_php_script_name} .php"
echo "# End of Include List"
- echo "Include conf/extra/${name_apache_module_conf}"
- install -D -m755 ${srcdir}/build-apache/libs/${name_libapache_source} ${pkgdir}/${path_prefix}/lib/httpd/modules/lib${pkgbase}.so
- install -D -m644 ${srcdir}/apache.conf ${pkgdir}/etc/httpd/conf/extra/${name_apache_module_conf}
+ echo "Include conf/extra/${_apache_module_conf}"
+ install -D -m755 "build-apache/libs/${_build_mod_php_so}" "${pkgdir}/usr/lib/httpd/modules/libphp${_phpbase}${_suffix}.so"
+ install -D -m644 "php-apache.conf" "${pkgdir}/${_build_apache_cfg}/${_apache_module_conf}"
+ echo "Sed for ${pkgdir}/${_build_apache_cfg}/${_apache_module_conf}"
+ sed -e "s#@MODULE@#${_build_mod_php_module}#" \
+ -i "${pkgdir}/${_build_apache_cfg}/${_apache_module_conf}"
}
package_php81-fpm() {
- pkgdesc='FastCGI Process Manager for PHP'
- depends=("${pkgbase}" 'systemd')
- backup=("etc/${pkgbase}/php-fpm.conf" "etc/${pkgbase}/php-fpm.d/www.conf")
+ pkgdesc="FastCGI Process Manager for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'systemd-libs')
+ backup=("etc/php${_phpbase}${_suffix}/php-fpm.conf")
+ if ((_phpbase>=70)); then
+ backup+=("etc/php${_phpbase}${_suffix}/php-fpm.d/www.conf")
+ fi
options=('!emptydirs')
- #provides=("${pkgbase}-fpm=${pkgver}")
- cd ${srcdir}/build
- make -j1 INSTALL_ROOT=${pkgdir} install-fpm
- install -D -m644 sapi/fpm/php-fpm.service ${pkgdir}/${path_prefix}/lib/systemd/system/${pkgbase}-fpm.service
- install -D -m644 ${srcdir}/php-fpm.tmpfiles ${pkgdir}/${path_prefix}/lib/tmpfiles.d/${pkgbase}-fpm.conf
+ if ((_build_per_sapi)); then
+ pushd "build-fpm"
+ else
+ pushd "build"
+ fi
+ case "${_phpbase}" in
+ 53)
+ install -d -m755 "${pkgdir}/usr/bin"
+ install -D -m755 sapi/fpm/php-fpm "${pkgdir}/usr/bin/php${_phpbase}${_suffix}-fpm"
+ install -D -m644 sapi/fpm/php-fpm.8 "${pkgdir}/usr/share/man/man8/php${_phpbase}${_suffix}-fpm.8"
+ install -D -m644 sapi/fpm/php-fpm.conf "${pkgdir}/etc/php${_phpbase}${_suffix}/php-fpm.conf"
+ install -d -m755 "${pkgdir}/etc/php${_phpbase}${_suffix}/fpm.d"
+ ;;
+ *)
+ make -j1 INSTALL_ROOT="${pkgdir}" install-fpm
+ ;;
+ esac
+
+ install -D -m644 "sapi/fpm/php-fpm.service" "${pkgdir}/usr/lib/systemd/system/php${_phpbase}${_suffix}-fpm.service"
+ echo "d /run/php${_phpbase}${_suffix}-fpm 755 root root" > php-fpm.tmpfiles
+ install -D -m644 "php-fpm.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/php${_phpbase}${_suffix}-fpm.conf"
+ popd
}
package_php81-embed() {
- pkgdesc='Embedded PHP SAPI library'
- depends=("${pkgbase}" 'libsystemd')
+ pkgdesc="Embedded PHP SAPI library for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'ncurses' 'systemd-libs')
options=('!emptydirs')
- #provides=("${pkgbase}-embed=${pkgver}")
-
- cd ${srcdir}/build
- make -j1 INSTALL_ROOT=${pkgdir} PHP_SAPI=embed install-sapi
- mv ${pkgdir}/${path_prefix}/lib/${name_libembed_source} ${pkgdir}/${path_prefix}/lib/libphp${phpbase}${suffix}.so
+ if ((_build_per_sapi)); then
+ pushd "build-embed"
+ else
+ pushd "build"
+ fi
+ patchelf --set-soname "libphp${_phpbase}${_suffix}.so" "libs/libphp${_suffix_so}.so"
+ case "${_phpbase}" in
+ 53)
+ install -D -m755 "libs/libphp${_suffix_so}.so" "${pkgdir}/usr/lib/libphp${_phpbase}${_suffix}.so"
+ install -D -m644 "../php-${pkgver}/sapi/embed/php_embed.h" "${pkgdir}/usr/include/php${_phpbase}${_suffix}/sapi/embed/php_embed.h"
+ ;;
+ *)
+ make -j1 INSTALL_ROOT="${pkgdir}" PHP_SAPI=embed install-sapi
+ mv "${pkgdir}/usr/lib/libphp${_suffix_so}.so" "${pkgdir}/usr/lib/libphp${_phpbase}${_suffix}.so"
+ ;;
+ esac
+ popd
}
package_php81-phpdbg() {
- pkgdesc='Interactive PHP debugger'
- depends=("${pkgbase}")
+ pkgdesc="Interactive PHP debugger for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}")
options=('!emptydirs')
- #provides=("${pkgbase}-phpdbg=${pkgver}")
+ pushd "build-phpdbg"
+ make -j1 INSTALL_ROOT="${pkgdir}" install-phpdbg
+ popd
+}
- cd ${srcdir}/build-phpdbg
- make -j1 INSTALL_ROOT=${pkgdir} install-phpdbg
+package_php81-pear() {
+ pkgdesc="PHP Extension and Application Repository for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" "php${_phpbase}-xml${_suffix}")
+ backup=("etc/php${_phpbase}${_suffix}/pear.conf")
+ #
+ pushd "build-pear"
+
+ make install-pear INSTALL_ROOT="${pkgdir}"
+
+ # remove unneeded files
+ rm -rf "${pkgdir}"/.{channels,depdb,depdblock,filemap,lock,registry}
+
+ # rename binaries
+ for i in pear peardev pecl; do
+ echo "Moving ${pkgdir}/usr/bin/${i} => ${pkgdir}/usr/bin/${pkgbase/php/$i}"
+ mv "${pkgdir}/usr/bin/${i}" "${pkgdir}/usr/bin/${pkgbase/php/$i}"
+ # fix hardcoded php paths in pear
+ sed -i "s|/usr/bin/php|/usr/bin/php${_phpbase}${_suffix}|g" "${pkgdir}/usr/bin/${pkgbase/php/$i}"
+ sed -i "s|PHP=php|PHP=${_phpbase}${_suffix}|g" "${pkgdir}/usr/bin/${pkgbase/php/$i}"
+ done
+ # fix pear.conf with unserialize
+ ./sapi/cli/php ../pear-config-patcher.php "${pkgdir}/etc/php${_phpbase}${_suffix}/pear.conf" "/usr/bin/php${_phpbase}${_suffix}" "${_phpbase}${_suffix}"
+
+ #popd
+ popd
}
package_php81-dblib() {
- pkgdesc='dblib module for PHP'
- depends=("${pkgbase}" 'freetds')
- #provides=("${pkgbase}-dblib=${pkgver}")
-
- install -D -m755 ${srcdir}/build/modules/pdo_dblib.so ${pkgdir}/${path_extensions}/pdo_dblib.so
+ depends=("php${_phpbase}${_suffix}" 'freetds')
+ provides=(
+ "php${_phpbase}${_suffix}-sybase=${pkgver}"
+ )
+ _install_module pdo_dblib
+ if ((_build_mssql)); then
+ _install_module mssql
+ provided+=("php${_phpbase}${_suffix}-mssql=${pkgver}")
+ _desc="pdo_dblib module for php${_phpbase}${_suffix}"
+ else
+ _desc="mssql and pdo_dblib modules for php${_phpbase}${_suffix}"
+ fi
+ pkgdesc="${_desc}${_phpbase}${_suffix}"
}
package_php81-enchant() {
- pkgdesc='enchant module for PHP'
- depends=("${pkgbase}" 'enchant')
- #provides=("${pkgbase}-enchant=${pkgver}")
-
- install -D -m755 ${srcdir}/build/modules/enchant.so ${pkgdir}/${path_extensions}/enchant.so
+ pkgdesc="enchant module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'enchant')
+ _install_module enchant
}
package_php81-gd() {
- pkgdesc='gd module for PHP'
- depends=("${pkgbase}" 'gd')
- #provides=("${pkgbase}-gd=${pkgver}")
-
- install -D -m755 ${srcdir}/build/modules/gd.so ${pkgdir}/${path_extensions}/gd.so
+ pkgdesc="gd module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'gd')
+ if ((_build_bundled_gd)); then
+ depends+=('libxpm' 'libpng' 'libjpeg')
+ fi
+ _install_module gd
}
-package_php81-imap() {
- pkgdesc='imap module for PHP'
- depends=("${pkgbase}" 'c-client')
- #provides=("${pkgbase}-imap=${pkgver}")
- install -D -m755 ${srcdir}/build/modules/imap.so ${pkgdir}/${path_extensions}/imap.so
+package_php81-imap() {
+ pkgdesc="imap module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'pam' 'krb5' 'c-client')
+ _install_module imap
}
package_php81-intl() {
- pkgdesc='intl module for PHP'
- depends=("${pkgbase}" 'icu')
- #provides=("${pkgbase}-intl=${pkgver}")
+ pkgdesc="intl module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}")
+ if ((_build_with_custom_icu)); then
+ # Patch to proper path inside intl.so
+ patchelf --set-rpath "/usr/lib/php${_phpbase}${_suffix}/icu${_pkgver_icu}/lib" "build/modules/intl.so"
+ else
+ depends+=('icu')
+ fi
+ _install_module intl
+}
- install -D -m755 ${srcdir}/build/modules/intl.so ${pkgdir}/${path_extensions}/intl.so
+package_php81-mcrypt() {
+ pkgdesc="mcrypt module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'libmcrypt')
+ _install_module mcrypt
}
package_php81-odbc() {
- pkgdesc='ODBC modules for PHP'
- depends=("${pkgbase}" 'unixodbc')
- #provides=("${pkgbase}-odbc=${pkgver}")
-
- install -D -m755 ${srcdir}/build/modules/odbc.so ${pkgdir}/${path_extensions}/odbc.so
- install -D -m755 ${srcdir}/build/modules/pdo_odbc.so ${pkgdir}/${path_extensions}/pdo_odbc.so
+ pkgdesc="ODBC modules for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'unixodbc')
+ _install_module odbc
+ _install_module pdo_odbc
}
package_php81-pgsql() {
- pkgdesc='PostgreSQL modules for PHP'
- depends=("${pkgbase}" 'postgresql-libs')
- #provides=("${pkgbase}-pgsql=${pkgver}")
-
- install -D -m755 ${srcdir}/build/modules/pgsql.so ${pkgdir}/${path_extensions}/pgsql.so
- install -D -m755 ${srcdir}/build/modules/pdo_pgsql.so ${pkgdir}/${path_extensions}/pdo_pgsql.so
+ pkgdesc="PostgreSQL modules for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'postgresql-libs')
+ _install_module pgsql
+ _install_module pdo_pgsql
}
package_php81-pspell() {
- pkgdesc='pspell module for PHP'
- depends=("${pkgbase}" 'aspell')
- #provides=("${pkgbase}-pspell=${pkgver}")
-
- install -D -m755 ${srcdir}/build/modules/pspell.so ${pkgdir}/${path_extensions}/pspell.so
+ pkgdesc="pspell module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'aspell')
+ _install_module pspell
}
package_php81-snmp() {
- pkgdesc='snmp module for PHP'
- depends=("${pkgbase}" 'net-snmp')
- #provides=("${pkgbase}-snmp=${pkgver}")
-
- install -D -m755 ${srcdir}/build/modules/snmp.so ${pkgdir}/${path_extensions}/snmp.so
+ pkgdesc="snmp module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'net-snmp')
+ _install_module snmp
}
package_php81-sqlite() {
- pkgdesc='sqlite module for PHP'
- depends=("${pkgbase}" 'sqlite')
- #provides=("${pkgbase}-sqlite=${pkgver}")
- install -D -m755 ${srcdir}/build/modules/sqlite3.so ${pkgdir}/${path_extensions}/sqlite3.so
- install -D -m755 ${srcdir}/build/modules/pdo_sqlite.so ${pkgdir}/${path_extensions}/pdo_sqlite.so
+ pkgdesc="sqlite module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'sqlite')
+ _install_module sqlite3
+ _install_module pdo_sqlite
}
package_php81-tidy() {
- pkgdesc='tidy module for PHP'
- depends=("${pkgbase}" 'tidy')
- #provides=("${pkgbase}-tidy=${pkgver}")
- install -D -m755 ${srcdir}/build/modules/tidy.so ${pkgdir}/${path_extensions}/tidy.so
+ pkgdesc="tidy module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'tidy')
+ _install_module tidy
+}
+
+package_php81-xml() {
+ pkgdesc="xml modules for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'libxml2')
+ _install_module dom
+ _install_module simplexml
+ if ((_build_wddx)); then
+ _install_module wddx
+ fi
+ _install_module xml
+ _install_module xmlreader
+ _install_module xmlwriter
}
package_php81-xsl() {
- pkgdesc='xsl module for PHP'
- depends=("${pkgbase}" 'libxslt')
- #provides=("${pkgbase}-xsl=${pkgver}")
- install -D -m755 ${srcdir}/build/modules/xsl.so ${pkgdir}/${path_extensions}/xsl.so
+ pkgdesc="xsl module for php${_phpbase}${_suffix}"
+ depends=(
+ "php${_phpbase}${_suffix}"
+ "php${_phpbase}-xml${_suffix}=${pkgver}"
+ 'libxslt'
+ 'libxml2'
+ )
+ _install_module xsl
+}
+
+package_php81-xmlrpc() {
+ pkgdesc="xmlrpc module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}")
+ _install_module xmlrpc
+}
+
+package_php81-soap() {
+ pkgdesc="soap module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'libxml2')
+ _install_module soap
+}
+
+package_php81-zip() {
+ pkgdesc="zip module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'libzip')
+ _install_module zip
}
+
+package_php81-bcmath() {
+ pkgdesc="bcmath module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}")
+ _install_module bcmath
+}
+
+package_php81-bz2() {
+ pkgdesc="bz2 module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'bzip2')
+ _install_module bz2
+}
+
+package_php81-ldap() {
+ pkgdesc="ldap module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'libldap' 'libsasl')
+ _install_module ldap
+}
+
+package_php81-curl() {
+ pkgdesc="curl module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" "curl")
+ _install_module curl
+}
+
+# gmp
+package_php81-gmp() {
+ pkgdesc="gmp module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'gmp')
+ _install_module gmp
+}
+# End gmp
+
+# Dba
+package_php81-dba() {
+ pkgdesc="dba module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'gdbm' 'db')
+ _install_module dba
+}
+# End dba
+
+# Json
+package_php81-json() {
+ pkgdesc="json module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}")
+ _install_module json
+}
+# End json
+
+# Recode
+package_php81-recode() {
+ pkgdesc="recode module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" 'recode')
+ _install_module recode
+}
+# End recode
+
+# Recode
package_php81-sodium() {
- pkgdesc='sodium module for PHP'
- depends=("${pkgbase}" 'libsodium')
- #provides=("${pkgbase}-sodium=${pkgver}")
- install -D -m755 ${srcdir}/build/modules/sodium.so ${pkgdir}/${path_extensions}/sodium.so
+ pkgdesc="sodium (libsodium) module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" "libsodium")
+ _install_module sodium
}
+# End recode
+# Opcache
+package_php81-opcache() {
+ pkgdesc="opcache zend module for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}")
+ _install_module opcache
+}
+# End opcache
+
+# Interbase modules
+package_php81-interbase() {
+ pkgdesc="Interbase modules for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}" "libfbclient")
+ #backup=()
+ if ((_build_interbase)); then
+ _install_module interbase
+ fi
+ _install_module pdo_firebird
+}
+# End interbase
+
+# MySQL modules
+package_php81-mysql() {
+ pkgdesc="MySQL modules for php${_phpbase}${_suffix}"
+ depends=("php${_phpbase}${_suffix}")
+ _install_module mysqlnd
+ _install_module mysqli
+ _install_module pdo_mysql
+ if ((_build_outdated_mysql)); then
+ _install_module mysql
+ fi
+}
+# End mysql
sha256sums=('a1317eff0723a2b3d3122bbfe107a1158570ea2822dc35a5fb360086db0f6bbc'
- '702b163c66c65af92dcad8d79f41bda84bcd5d863235fcf1497c33a86db9e4ca'
- '4a2add00d93fa991ccdf6356090264c1059c79935642afff6e8d4a2107fa037e'
- '96e0b05a5ec72ee0f907d29fbb9612414d9dfebeee1249cbf2f2318bacf2d37c'
- 'eb0c0aec5b5fb282df0bfefd4d5bbc229ee80a5c5da6760ecf52697a23cc7175'
- 'cc17f28807c63c49c6047fbaf19384f348af51bb0e737b364b9780e7b3cd4050')
+ '0201d0fa811b80614737424a72c7bb127125807e5d7eeec5e1578a0a58f77d2f'
+ '6d0ad9becb5470ce8e5929d7d45660b0f32579038978496317544c5310281a91'
+ '0df807d84bc0cf948a6ed0cf453e98213d47fbc7fdedc2747855a619dc616b3c'
+ '558e780e93dfa861a366c49b4d156d8fc43f17898f001ae6033ec63c33d5d41c'
+ '40bcc1e5058602302198d0925e431495391d8469499593af477f59d84d32f764'
+ 'e2b4bad971ed569e9e898dcb2c7451d53e9b55f473123bbd4765d126efea6466')
diff --git a/apache.conf b/apache.conf
deleted file mode 100644
index bc57ba73dbcd..000000000000
--- a/apache.conf
+++ /dev/null
@@ -1,13 +0,0 @@
-# Required modules: dir_module, php_module
-
-<IfModule dir_module>
- <IfModule php_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 d46aceef4e4a..000000000000
--- a/apache.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- sapi/apache2handler/config.m4.orig
-+++ sapi/apache2handler/config.m4
-@@ -114,7 +114,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-8.1.0.patch b/debian-php-8.1.0.patch
new file mode 100644
index 000000000000..8e78ee953046
--- /dev/null
+++ b/debian-php-8.1.0.patch
@@ -0,0 +1,328 @@
+
+diff --git a/php.ini-development b/php.ini-development
+index 7564350..dda3c3a 100644
+--- a/php.ini-development
++++ b/php.ini-development
+@@ -315,6 +315,12 @@
+ ; or per-virtualhost web server configuration file.
+ ; Note: disables the realpath cache
+ ; https://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.
+@@ -1350,7 +1356,7 @@
+ ; where MODE is the octal representation of the mode. Note that this
+ ; does not overwrite the process's umask.
+ ; https://php.net/session.save-path
+-;session.save_path = "/tmp"
++;session.save_path = "/var/lib/php/sessions"
+
+ ; Whether to use strict session mode.
+ ; Strict session mode does not accept an uninitialized session ID, and
+diff --git a/ext/dba/config.m4 b/ext/dba/config.m4
+index 1e80319..51bdd84 100644
+--- a/ext/dba/config.m4
++++ b/ext/dba/config.m4
+@@ -375,61 +375,13 @@
+ dbdp4="/usr/local/BerkeleyDB.4."
+ dbdp5="/usr/local/BerkeleyDB.5."
+ for i in $PHP_DB4 ${dbdp5}1 ${dbdp5}0 ${dbdp4}8 ${dbdp4}7 ${dbdp4}6 ${dbdp4}5 ${dbdp4}4 ${dbdp4}3 ${dbdp4}2 ${dbdp4}1 ${dbdp}0 /usr/local /usr; do
+- if test -f "$i/db5/db.h"; then
+- THIS_PREFIX=$i
+- THIS_INCLUDE=$i/db5/db.h
+- break
+- elif test -f "$i/db4/db.h"; then
+- THIS_PREFIX=$i
+- THIS_INCLUDE=$i/db4/db.h
+- break
+- elif test -f "$i/include/db5.3/db.h"; then
+- THIS_PREFIX=$i
+- THIS_INCLUDE=$i/include/db5.3/db.h
+- break
+- elif test -f "$i/include/db5.1/db.h"; then
+- THIS_PREFIX=$i
+- THIS_INCLUDE=$i/include/db5.1/db.h
+- break
+- elif test -f "$i/include/db5.0/db.h"; then
+- THIS_PREFIX=$i
+- THIS_INCLUDE=$i/include/db5.0/db.h
+- break
+- elif test -f "$i/include/db4.8/db.h"; then
+- THIS_PREFIX=$i
+- THIS_INCLUDE=$i/include/db4.8/db.h
+- break
+- elif test -f "$i/include/db4.7/db.h"; then
+- THIS_PREFIX=$i
+- THIS_INCLUDE=$i/include/db4.7/db.h
+- break
+- elif test -f "$i/include/db4.6/db.h"; then
+- THIS_PREFIX=$i
+- THIS_INCLUDE=$i/include/db4.6/db.h
+- break
+- elif test -f "$i/include/db4.5/db.h"; then
+- THIS_PREFIX=$i
+- THIS_INCLUDE=$i/include/db4.5/db.h
+- break
+- elif test -f "$i/include/db4/db.h"; then
+- THIS_PREFIX=$i
+- THIS_INCLUDE=$i/include/db4/db.h
+- break
+- elif test -f "$i/include/db/db4.h"; then
+- THIS_PREFIX=$i
+- THIS_INCLUDE=$i/include/db/db4.h
+- break
+- elif test -f "$i/include/db4.h"; then
+- THIS_PREFIX=$i
+- THIS_INCLUDE=$i/include/db4.h
+- break
+- elif test -f "$i/include/db.h"; then
++ if test -f "$i/include/db.h"; then
+ THIS_PREFIX=$i
+ THIS_INCLUDE=$i/include/db.h
+ break
+ fi
+ done
+- PHP_DBA_DB_CHECK(4, db-5.3 db-5.1 db-5.0 db-4.8 db-4.7 db-4.6 db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db-4.0 db-4 db4 db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
++ PHP_DBA_DB_CHECK(4, db, [(void)db_create((DB**)0, (DB_ENV*)0, 0)])
+ fi
+ PHP_DBA_STD_RESULT(db4,Berkeley DB4)
+
+diff --git a/ext/dba/dba.c b/ext/dba/dba.c
+index 57bfb5e..2bfc368 100644
+--- a/ext/dba/dba.c
++++ b/ext/dba/dba.c
+@@ -50,6 +50,10 @@
+ #include "php_lmdb.h"
+ #include "dba_arginfo.h"
+
++#ifdef DB4_INCLUDE_FILE
++#include DB4_INCLUDE_FILE
++#endif
++
+ PHP_MINIT_FUNCTION(dba);
+ PHP_MSHUTDOWN_FUNCTION(dba);
+ PHP_MINFO_FUNCTION(dba);
+@@ -452,6 +456,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
+--- a/ext/dba/config.m4
++++ b/ext/dba/config.m4
+@@ -145,6 +145,10 @@
+ THIS_PREFIX=$i
+ THIS_INCLUDE=$i/include/qdbm/depot.h
+ break
++ elif test -f "$i/include/qdbm/depot.h"; then
++ THIS_PREFIX=$i
++ THIS_INCLUDE=$i/include/qdbm/depot.h
++ break
+ fi
+ done
+
+diff --git a/sapi/fpm/php-fpm.8.in b/sapi/fpm/php-fpm.8.in
+index 905946e..a4cf632 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 f8c3d89..24aec33 100644
+--- a/main/streams/plain_wrapper.c
++++ b/main/streams/plain_wrapper.c
+@@ -750,7 +750,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 2bfc368..6face3d 100644
+--- a/ext/dba/dba.c
++++ b/ext/dba/dba.c
+@@ -890,7 +890,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 2f05901..f440d34 100644
+--- a/ext/dba/dba_db3.c
++++ b/ext/dba/dba_db3.c
+@@ -91,9 +91,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 93dd36d..41e8f23 100644
+--- a/ext/dba/dba_db4.c
++++ b/ext/dba/dba_db4.c
+@@ -120,9 +120,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/standard/tests/strings/setlocale_variation2.phpt b/ext/standard/tests/strings/setlocale_variation2.phpt
+index 6f62f71..d8666ba 100644
+--- a/ext/standard/tests/strings/setlocale_variation2.phpt
++++ b/ext/standard/tests/strings/setlocale_variation2.phpt
+@@ -47,6 +47,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),
+@@ -56,6 +57,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;
+@@ -64,11 +69,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);
+@@ -84,6 +89,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 9721dfb..4c35ec3 100644
+--- a/ext/pcre/tests/grep2.phpt
++++ b/ext/pcre/tests/grep2.phpt
+@@ -36,12 +36,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 7b51e2ee7a66..000000000000
--- a/generate_patches
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/bash
-
-. PKGBUILD
-
-makepkg -o --nodeps --noprepare --skipinteg
-
-pushd src/php-${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/php${phpbase}${suffix}-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/php${phpbase}${suffix}-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/php${phpbase}${suffix}-fpm/php-fpm.pid#" \
- -e "s#^ExecStart=@EXPANDED_SBINDIR@/php-fpm --nodaemonize#ExecStart=@EXPANDED_SBINDIR@/php-fpm${phpbase}${suffix} --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 = "BIG_BAD_MODULES"#g' \
- -i php.ini-production
-
-sed \
- -e 's#^;extension_dir = "\./"$#extension_dir = "BIG_BAD_MODULES"#g' \
- -i php.ini-production
-
-sed \
- -e "s#BIG_BAD_MODULES#/usr/lib/php${phpbase}${suffix}/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
-
-echo "d /run/php${phpbase}${suffix}-fpm 755 root root" > php-fpm.tmpfiles
diff --git a/pear-config-patcher.php b/pear-config-patcher.php
new file mode 100644
index 000000000000..3c724c2e196e
--- /dev/null
+++ b/pear-config-patcher.php
@@ -0,0 +1,43 @@
+<?php
+if (!isset($argv, $argc)) {
+ echo "No command line args provided\n";
+ exit(1);
+}
+if ($argc < 4) {
+ echo "Not all command line args provided\n";
+ exit(2);
+}
+$targetFile = $confFile = $argv[1];
+$phpBin = $argv[2];
+$pearSuffix = $argv[3];
+
+$data = '';
+$file = fopen($confFile, "r");
+
+if ($file !== false) {
+ while(!feof($file)) {
+ $line = fgets($file);
+ $serialized = @unserialize($line);
+ if (is_array($serialized)) {
+ $serialized['cache_dir'] = "/tmp/pear{$pearSuffix}/cache";
+ $serialized['temp_dir'] = "/tmp/pear{$pearSuffix}";
+ $serialized['download_dir'] = "/tmp/pear{$pearSuffix}/download";
+ $serialized['php_bin'] = $phpBin;
+ $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.patch b/php-fpm.patch
deleted file mode 100644
index d5fade4a2422..000000000000
--- a/php-fpm.patch
+++ /dev/null
@@ -1,76 +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/php81-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/php81-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.
-@@ -395,7 +395,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,8 +8,8 @@
-
- [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/php81-fpm/php-fpm.pid
-+ExecStart=@EXPANDED_SBINDIR@/php-fpm81 --nodaemonize --fpm-config @EXPANDED_SYSCONFDIR@/php-fpm.conf
- ExecReload=/bin/kill -USR2 $MAINPID
-
- # Set up a new file system namespace and mounts private /tmp and /var/tmp directories
diff --git a/php-fpm.tmpfiles b/php-fpm.tmpfiles
deleted file mode 100644
index b5020aa49929..000000000000
--- a/php-fpm.tmpfiles
+++ /dev/null
@@ -1 +0,0 @@
-d /run/php81-fpm 755 root root
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 92937b196338..000000000000
--- a/php.ini.patch
+++ /dev/null
@@ -1,79 +0,0 @@
---- php.ini-production.orig
-+++ php.ini-production
-@@ -760,7 +760,7 @@
-
- ; Directory in which the loadable extensions (modules) reside.
- ; https://php.net/extension-dir
--;extension_dir = "./"
-+extension_dir = "/usr/lib/php81/modules"
- ; On windows:
- ;extension_dir = "ext"
-
-@@ -908,51 +908,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=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=oci8_19 ; Use with Oracle Database 19 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 https://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
--
--;zend_extension=opcache
-+extension=zip
-
- ;;;;;;;;;;;;;;;;;;;
- ; Module Settings ;
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-php8.1.patch b/timezonedb-php8.1.patch
new file mode 100644
index 000000000000..c6625c13522c
--- /dev/null
+++ b/timezonedb-php8.1.patch
@@ -0,0 +1,629 @@
+index 18b8106..3d1f63c 100644
+--- 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="-Wno-implicit-fallthrough -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/parse_posix.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 e41315e..ba01fab 100644
+--- a/ext/date/lib/parse_tz.c
++++ b/ext/date/lib/parse_tz.c
+@@ -26,9 +26,22 @@
+ #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
+ #define TIMELIB_SUPPORT_SLIM_FILE
+ #include "timezonedb.h"
++#endif
++
++#include <ctype.h>
+
+ #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
+ # if defined(__LITTLE_ENDIAN__)
+@@ -95,6 +108,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;
+@@ -577,7 +595,429 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
+ }
+ }
+
+-static int seek_to_tz_position(const unsigned char **tzf, const 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, const char *timezone, const timelib_tzdb *tzdb)
+ {
+ int left = 0, right = tzdb->index_size - 1;
+
+@@ -603,9 +1043,48 @@ static int seek_to_tz_position(const unsigned char **tzf, const char *timezone,
+ return 0;
+ }
+
++static int seek_to_tz_position(const unsigned char **tzf, const 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)
+@@ -617,7 +1096,30 @@ const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(const timelib_
+ int timelib_timezone_id_is_valid(const 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)
+@@ -662,6 +1164,8 @@ static timelib_tzinfo* timelib_tzinfo_ctor(const char *name)
+ timelib_tzinfo *timelib_parse_tzfile(const 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;
+@@ -669,7 +1173,7 @@ timelib_tzinfo *timelib_parse_tzfile(const char *timezone, const timelib_tzdb *t
+
+ *error_code = TIMELIB_ERROR_NO_ERROR;
+
+- 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);
+@@ -712,11 +1216,36 @@ timelib_tzinfo *timelib_parse_tzfile(const char *timezone, const timelib_tzdb *t
+ return NULL;
+ }
+
++#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;