archrelease: copy trunk to extra-x86_64
[arch-packages.git] / php / trunk / PKGBUILD
blobb4499c38147fcfbc4c7d6280a20ec680d5542d70
1 # Maintainer: Pierre Schmitz <pierre@archlinux.de>
3 pkgbase=php
4 pkgname=('php'
5          'php-cgi'
6          'php-apache'
7          'php-fpm'
8          'php-embed'
9          'php-phpdbg'
10          'php-dblib'
11          'php-enchant'
12          'php-gd'
13          'php-sodium'
14          'php-odbc'
15          'php-pgsql'
16          'php-pspell'
17          'php-snmp'
18          'php-sqlite'
19          'php-tidy'
20          'php-xsl')
21 pkgver=8.2.6
22 pkgrel=1
23 arch=('x86_64')
24 license=('PHP')
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'
28              'oniguruma')
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'
33             'SKIP'
34             '702b163c66c65af92dcad8d79f41bda84bcd5d863235fcf1497c33a86db9e4ca'
35             '4a2add00d93fa991ccdf6356090264c1059c79935642afff6e8d4a2107fa037e'
36             '78b8074461cdfc5d4e0ba428a8387f308d60720c8ad35c6176801e5088f02090'
37             '640dba0d960bfeaae9ad38d2826d3f6b5d6c175a4d3e16664eefff29141faad5'
38             '70cba88753160fe5e7fe8429ea5aa7a9f8327d7a069a8c846e3249bb88f854e1')
39 validpgpkeys=('1198C0117593497A5EC5C199286AF1F9897469DC'
40               '39B641343D8C104B2B146DC3F9C39DC0B9698544'
41               'E60913E4DF209907D8E30D96659A97C9CF2A795A')
42 _interpreter=${pkgver%.*}
44 prepare() {
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"
50         autoconf
52         # Disable failing tests
53         rm tests/output/stream_isatty_*.phpt
54         rm Zend/tests/arginfo_zpp_mismatch*.phpt
57 build() {
58         local _phpconfig="--srcdir=../${pkgbase}-${pkgver} \
59                 --config-cache \
60                 --prefix=/usr \
61                 --sbindir=/usr/bin \
62                 --sysconfdir=/etc/php \
63                 --localstatedir=/var \
64                 --with-layout=GNU \
65                 --with-config-file-path=/etc/php \
66                 --with-config-file-scan-dir=/etc/php/conf.d \
67                 --disable-rpath \
68                 --mandir=/usr/share/man \
69                 --disable-gcc-global-regs \
70                 "
72         local _phpextensions="\
73                 --enable-bcmath=shared \
74                 --enable-calendar=shared \
75                 --enable-dba=shared \
76                 --enable-exif=shared \
77                 --enable-ftp=shared \
78                 --enable-gd=shared \
79                 --enable-intl=shared \
80                 --enable-mbstring \
81                 --enable-pcntl \
82                 --enable-shmop=shared \
83                 --enable-soap=shared \
84                 --enable-sockets=shared \
85                 --enable-sysvmsg=shared \
86                 --enable-sysvsem=shared \
87                 --enable-sysvshm=shared \
88                 --with-bz2=shared \
89                 --with-curl=shared \
90                 --with-enchant=shared \
91                 --with-external-gd \
92                 --with-external-pcre \
93                 --with-ffi=shared \
94                 --with-gdbm \
95                 --with-gettext=shared \
96                 --with-gmp=shared \
97                 --with-iconv=shared \
98                 --with-kerberos \
99                 --with-ldap=shared \
100                 --with-ldap-sasl \
101                 --with-mhash \
102                 --with-mysql-sock=/run/mysqld/mysqld.sock \
103                 --with-mysqli=shared \
104                 --with-openssl \
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 \
113                 --with-readline \
114                 --with-snmp=shared \
115                 --with-sodium=shared \
116                 --with-sqlite3=shared \
117                 --with-tidy=shared \
118                 --with-unixODBC=shared \
119                 --with-xsl=shared \
120                 --with-zip=shared \
121                 --with-zlib \
122                 "
124         EXTENSION_DIR=/usr/lib/php/modules
125         export EXTENSION_DIR
127         mkdir "${srcdir}/build"
128         cd "${srcdir}/build"
129         ln -s "../${pkgbase}-${pkgver}/configure"
130         ./configure ${_phpconfig} \
131                 --enable-cgi \
132                 --enable-fpm \
133                 --with-fpm-systemd \
134                 --with-fpm-acl \
135                 --with-fpm-user=http \
136                 --with-fpm-group=http \
137                 --enable-embed=shared \
138                 ${_phpextensions}
139         make
141         # apache
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} \
146                 --with-apxs2 \
147                 ${_phpextensions}
148         make
150         # phpdbg
151         cp -a "${srcdir}/build" "${srcdir}/build-phpdbg"
152         cd "${srcdir}/build-phpdbg"
153         ./configure ${_phpconfig} \
154                 --enable-phpdbg \
155                 ${_phpextensions}
156         make
159 check() {
160         cd "${srcdir}/build"
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'
172         make test
175 package_php() {
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')
183         cd "${srcdir}/build"
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"
196 package_php-cgi() {
197         pkgdesc='CGI and FCGI SAPI for PHP'
198         depends=('php')
199         provides=("php-cgi-interpreter=${_interpreter}")
201         cd "${srcdir}/build"
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"
215 package_php-fpm() {
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')
222         cd "${srcdir}/build"
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')
234         cd "${srcdir}/build"
235         make -j1 INSTALL_ROOT="${pkgdir}" PHP_SAPI=embed install-sapi
238 package_php-phpdbg() {
239         pkgdesc='Interactive PHP debugger'
240         depends=('php')
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"
264 package_php-gd() {
265         pkgdesc='gd module for PHP'
266         depends=('php' 'gd')
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"
280 package_php-odbc() {
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"
306 package_php-snmp() {
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"
323 package_php-tidy() {
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"
331 package_php-xsl() {
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"