1 # Maintainer: Pierre Schmitz <pierre@archlinux.de>
25 url='https://www.php.net/'
26 makedepends=('apache' 'aspell' 'enchant' 'gd' 'gmp' 'icu' 'libsodium' 'libxslt' 'libzip' 'net-snmp'
27 'postgresql-libs' 'sqlite' 'systemd' 'tidy' 'unixodbc' 'curl' 'libtool' 'postfix' 'freetds' 'pcre2'
29 checkdepends=('procps-ng')
30 source=("https://php.net/distributions/${pkgbase}-${pkgver}.tar.xz"{,.asc}
31 'apache.patch' 'apache.conf' 'php-fpm.patch' 'php-fpm.tmpfiles' 'php.ini.patch')
32 sha256sums=('10b796f0ed45574229851212b30a596a76e70ae365322bcaaaf9c00fa7d58cca'
34 '702b163c66c65af92dcad8d79f41bda84bcd5d863235fcf1497c33a86db9e4ca'
35 '4a2add00d93fa991ccdf6356090264c1059c79935642afff6e8d4a2107fa037e'
36 '78b8074461cdfc5d4e0ba428a8387f308d60720c8ad35c6176801e5088f02090'
37 '640dba0d960bfeaae9ad38d2826d3f6b5d6c175a4d3e16664eefff29141faad5'
38 '70cba88753160fe5e7fe8429ea5aa7a9f8327d7a069a8c846e3249bb88f854e1')
39 validpgpkeys=('1198C0117593497A5EC5C199286AF1F9897469DC'
40 '39B641343D8C104B2B146DC3F9C39DC0B9698544'
41 'E60913E4DF209907D8E30D96659A97C9CF2A795A')
42 _interpreter=${pkgver%.*}
45 cd "${srcdir}/${pkgbase}-${pkgver}"
47 patch -p0 -i "${srcdir}/apache.patch"
48 patch -p0 -i "${srcdir}/php-fpm.patch"
49 patch -p0 -i "${srcdir}/php.ini.patch"
52 # Disable failing tests
53 rm tests/output/stream_isatty_*.phpt
54 rm Zend/tests/arginfo_zpp_mismatch*.phpt
58 local _phpconfig="--srcdir=../${pkgbase}-${pkgver} \
62 --sysconfdir=/etc/php \
63 --localstatedir=/var \
65 --with-config-file-path=/etc/php \
66 --with-config-file-scan-dir=/etc/php/conf.d \
68 --mandir=/usr/share/man \
69 --disable-gcc-global-regs \
72 local _phpextensions="\
73 --enable-bcmath=shared \
74 --enable-calendar=shared \
76 --enable-exif=shared \
79 --enable-intl=shared \
82 --enable-shmop=shared \
83 --enable-soap=shared \
84 --enable-sockets=shared \
85 --enable-sysvmsg=shared \
86 --enable-sysvsem=shared \
87 --enable-sysvshm=shared \
90 --with-enchant=shared \
92 --with-external-pcre \
95 --with-gettext=shared \
102 --with-mysql-sock=/run/mysqld/mysqld.sock \
103 --with-mysqli=shared \
105 --with-password-argon2 \
106 --with-pdo-dblib=shared,/usr \
107 --with-pdo-mysql=shared \
108 --with-pdo-odbc=shared,unixODBC,/usr \
109 --with-pdo-pgsql=shared \
110 --with-pdo-sqlite=shared \
111 --with-pgsql=shared \
112 --with-pspell=shared \
115 --with-sodium=shared \
116 --with-sqlite3=shared \
118 --with-unixODBC=shared \
124 EXTENSION_DIR=/usr/lib/php/modules
127 mkdir "${srcdir}/build"
129 ln -s "../${pkgbase}-${pkgver}/configure"
130 ./configure ${_phpconfig} \
135 --with-fpm-user=http \
136 --with-fpm-group=http \
137 --enable-embed=shared \
142 # reuse the previous run; this will save us a lot of time
143 cp -a "${srcdir}/build" "${srcdir}/build-apache"
144 cd "${srcdir}/build-apache"
145 ./configure ${_phpconfig} \
151 cp -a "${srcdir}/build" "${srcdir}/build-phpdbg"
152 cd "${srcdir}/build-phpdbg"
153 ./configure ${_phpconfig} \
162 # Check if sendmail was configured correctly (FS#47600)
163 sapi/cli/php -n -r 'echo ini_get("sendmail_path");' | grep -q '/usr/bin/sendmail'
165 export REPORT_EXIT_STATUS=1
166 export NO_INTERACTION=1
167 export SKIP_ONLINE_TESTS=1
168 export SKIP_SLOW_TESTS=1
169 export TEST_PHP_ARGS="-j$(nproc)"
170 export TESTS='tests Zend'
176 pkgdesc='A general-purpose scripting language that is especially suited to web development'
177 depends=('libxml2' 'curl' 'libzip' 'pcre2' 'argon2' 'oniguruma')
178 provides=("php-interpreter=${_interpreter}" "php-intl=${pkgver}")
179 replaces=('php-intl')
180 conflicts=('php-intl')
181 backup=('etc/php/php.ini')
184 make -j1 INSTALL_ROOT="${pkgdir}" install-{modules,cli,build,headers,programs,pharcmd}
185 install -D -m644 "${srcdir}/${pkgbase}-${pkgver}/php.ini-production" "${pkgdir}/etc/php/php.ini"
186 install -d -m755 "${pkgdir}/etc/php/conf.d/"
188 # remove static modules
189 rm -f "${pkgdir}/usr/lib/php/modules/"*.a
190 # remove modules provided by sub packages
191 rm -f "${pkgdir}/usr/lib/php/modules/"{enchant,gd,sodium,odbc,pdo_dblib,pdo_odbc,pgsql,pdo_pgsql,pspell,snmp,sqlite3,pdo_sqlite,tidy,xsl}.so
192 # remove empty directory
193 rmdir "${pkgdir}/usr/include/php/include"
197 pkgdesc='CGI and FCGI SAPI for PHP'
199 provides=("php-cgi-interpreter=${_interpreter}")
202 make -j1 INSTALL_ROOT="${pkgdir}" install-cgi
205 package_php-apache() {
206 pkgdesc='Apache SAPI for PHP'
207 depends=('php' 'apache')
208 backup=('etc/httpd/conf/extra/php_module.conf')
209 provides=("php-apache-interpreter=${_interpreter}")
211 install -D -m755 "${srcdir}/build-apache/libs/libphp.so" "${pkgdir}/usr/lib/httpd/modules/libphp.so"
212 install -D -m644 "${srcdir}/apache.conf" "${pkgdir}/etc/httpd/conf/extra/php_module.conf"
216 pkgdesc='FastCGI Process Manager for PHP'
217 depends=('php' 'systemd')
218 backup=('etc/php/php-fpm.conf' 'etc/php/php-fpm.d/www.conf')
219 provides=("php-fpm-interpreter=${_interpreter}")
220 options=('!emptydirs')
223 make -j1 INSTALL_ROOT="${pkgdir}" install-fpm
224 install -D -m644 sapi/fpm/php-fpm.service "${pkgdir}/usr/lib/systemd/system/php-fpm.service"
225 install -D -m644 "${srcdir}/php-fpm.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/php-fpm.conf"
228 package_php-embed() {
229 pkgdesc='Embedded PHP SAPI library'
230 depends=('php' 'systemd-libs')
231 provides=("php-embed-interpreter=${_interpreter}")
232 options=('!emptydirs')
235 make -j1 INSTALL_ROOT="${pkgdir}" PHP_SAPI=embed install-sapi
238 package_php-phpdbg() {
239 pkgdesc='Interactive PHP debugger'
241 provides=("php-phpdbg-interpreter=${_interpreter}")
242 options=('!emptydirs')
244 cd "${srcdir}/build-phpdbg"
245 make -j1 INSTALL_ROOT="${pkgdir}" install-phpdbg
248 package_php-dblib() {
249 pkgdesc='dblib module for PHP'
250 depends=('php' 'freetds')
251 provides=("php-dblib-interpreter=${_interpreter}")
253 install -D -m755 "${srcdir}/build/modules/pdo_dblib.so" "${pkgdir}/usr/lib/php/modules/pdo_dblib.so"
256 package_php-enchant() {
257 pkgdesc='enchant module for PHP'
258 depends=('php' 'enchant')
259 provides=("php-enchant-interpreter=${_interpreter}")
261 install -D -m755 "${srcdir}/build/modules/enchant.so" "${pkgdir}/usr/lib/php/modules/enchant.so"
265 pkgdesc='gd module for PHP'
267 provides=("php-gd-interpreter=${_interpreter}")
269 install -D -m755 "${srcdir}/build/modules/gd.so" "${pkgdir}/usr/lib/php/modules/gd.so"
272 package_php-sodium() {
273 pkgdesc='sodium module for PHP'
274 depends=('php' 'libsodium')
275 provides=("php-sodium-interpreter=${_interpreter}")
277 install -D -m755 "${srcdir}/build/modules/sodium.so" "${pkgdir}/usr/lib/php/modules/sodium.so"
281 pkgdesc='ODBC modules for PHP'
282 depends=('php' 'unixodbc')
283 provides=("php-odbc-interpreter=${_interpreter}")
285 install -D -m755 "${srcdir}/build/modules/odbc.so" "${pkgdir}/usr/lib/php/modules/odbc.so"
286 install -D -m755 "${srcdir}/build/modules/pdo_odbc.so" "${pkgdir}/usr/lib/php/modules/pdo_odbc.so"
289 package_php-pgsql() {
290 pkgdesc='PostgreSQL modules for PHP'
291 depends=('php' 'postgresql-libs')
292 provides=("php-pgsql-interpreter=${_interpreter}")
294 install -D -m755 "${srcdir}/build/modules/pgsql.so" "${pkgdir}/usr/lib/php/modules/pgsql.so"
295 install -D -m755 "${srcdir}/build/modules/pdo_pgsql.so" "${pkgdir}/usr/lib/php/modules/pdo_pgsql.so"
298 package_php-pspell() {
299 pkgdesc='pspell module for PHP'
300 depends=('php' 'aspell')
301 provides=("php-pspell-interpreter=${_interpreter}")
303 install -D -m755 "${srcdir}/build/modules/pspell.so" "${pkgdir}/usr/lib/php/modules/pspell.so"
307 pkgdesc='snmp module for PHP'
308 depends=('php' 'net-snmp')
309 provides=("php-snmp-interpreter=${_interpreter}")
311 install -D -m755 "${srcdir}/build/modules/snmp.so" "${pkgdir}/usr/lib/php/modules/snmp.so"
314 package_php-sqlite() {
315 pkgdesc='sqlite module for PHP'
316 depends=('php' 'sqlite')
317 provides=("php-sqlite-interpreter=${_interpreter}")
319 install -D -m755 "${srcdir}/build/modules/sqlite3.so" "${pkgdir}/usr/lib/php/modules/sqlite3.so"
320 install -D -m755 "${srcdir}/build/modules/pdo_sqlite.so" "${pkgdir}/usr/lib/php/modules/pdo_sqlite.so"
324 pkgdesc='tidy module for PHP'
325 depends=('php' 'tidy')
326 provides=("php-tidy-interpreter=${_interpreter}")
328 install -D -m755 "${srcdir}/build/modules/tidy.so" "${pkgdir}/usr/lib/php/modules/tidy.so"
332 pkgdesc='xsl module for PHP'
333 depends=('php' 'libxslt')
334 provides=("php-xsl-interpreter=${_interpreter}")
336 install -D -m755 "${srcdir}/build/modules/xsl.so" "${pkgdir}/usr/lib/php/modules/xsl.so"