archrelease: copy trunk to extra-x86_64
[arch-packages.git] / php-legacy / trunk / PKGBUILD
blobb8326709b11423f4763a43719b40f2025b43131a
1 # Maintainer: Pierre Schmitz <pierre@archlinux.de>
3 pkgbase=php-legacy
4 pkgname=('php-legacy'
5          'php-legacy-cgi'
6          'php-legacy-apache'
7          'php-legacy-fpm'
8          'php-legacy-embed'
9          'php-legacy-phpdbg'
10          'php-legacy-dblib'
11          'php-legacy-enchant'
12          'php-legacy-gd'
13          'php-legacy-sodium'
14          'php-legacy-odbc'
15          'php-legacy-pgsql'
16          'php-legacy-pspell'
17          'php-legacy-snmp'
18          'php-legacy-sqlite'
19          'php-legacy-tidy'
20          'php-legacy-xsl')
21 pkgver=8.1.18
22 pkgrel=1
23 arch=('x86_64')
24 license=('PHP')
25 url='https://www.php.net/'
26 makedepends=('apache' 'aspell' 'gdbm' 'enchant' 'gd' 'gmp' 'icu' 'libsodium' 'libxslt' 'libzip' 'net-snmp'
27              'postgresql-libs' 'sqlite' 'systemd' 'tidy' 'unixodbc' 'curl' 'libtool' 'postfix' 'freetds' 'pcre2' 'libnsl'
28              'oniguruma' 'patchelf')
29 checkdepends=('procps-ng')
30 source=(
31   "https://php.net/distributions/php-${pkgver}.tar.xz"{,.asc}
32   'apache.conf'
33   'php-fpm.tmpfiles'
34   'apache.patch'
35   'php-fpm.patch'
36   'php.ini.patch'
37   'php-legacy.patch'
39 sha256sums=('f3553370f8ba42729a9ce75eed17a2111d32433a43b615694f6a571b8bad0e39'
40             'SKIP'
41             '2173046ac22ac50c7a6721306d3f79b2086f66a7a6ff5d8af249a474763197a1'
42             'f3236ca866095d5e42e51e3fa600082ccd0afcfb7f1aecbeb286ef9d4f0dd564'
43             '702b163c66c65af92dcad8d79f41bda84bcd5d863235fcf1497c33a86db9e4ca'
44             '7322cc296780908b55fe6d601d403b0e506a2a7ce5359141cb4132f84778243d'
45             '99a8bea56335941a645efce4a22917b7147b070686f34b9f3e56d8c238d785fa'
46             'a1859005c9fad835079470e6fb3c0721b9bd024c8f3ae1f34cb082ec41c63194')
47 validpgpkeys=('F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD'
48               '39B641343D8C104B2B146DC3F9C39DC0B9698544')
49 _interpreter=${pkgver%.*}
51 prepare() {
52         cd "${srcdir}/php-${pkgver}"
54         patch -p0 -i "${srcdir}/apache.patch"
55         patch -p0 -i "${srcdir}/php-fpm.patch"
56         patch -p0 -i "${srcdir}/php.ini.patch"
57         patch -p0 -i "${srcdir}/php-legacy.patch"
58         autoconf
60         # Disable failing tests
61         rm tests/output/stream_isatty_*.phpt
62         rm Zend/tests/arginfo_zpp_mismatch*.phpt
65 build() {
66         local _phpconfig="--srcdir=../php-${pkgver} \
67                 --config-cache \
68                 --prefix=/usr \
69                 --sbindir=/usr/bin \
70                 --sysconfdir=/etc/php-legacy \
71                 --localstatedir=/var \
72                 --with-layout=GNU \
73                 --with-config-file-path=/etc/php-legacy \
74                 --with-config-file-scan-dir=/etc/php-legacy/conf.d \
75                 --disable-rpath \
76                 --mandir=/usr/share/man \
77                 --libdir=/usr/lib/php-legacy \
78                 --datarootdir=/usr/share/php-legacy \
79                 --datadir=/usr/share/php-legacy \
80                 --program-suffix=-legacy \
81                 --includedir=/usr/include/php-legacy \
82                 --disable-gcc-global-regs \
83                 "
85         local _phpextensions="\
86                 --enable-bcmath=shared \
87                 --enable-calendar=shared \
88                 --enable-dba=shared \
89                 --enable-exif=shared \
90                 --enable-ftp=shared \
91                 --enable-gd=shared \
92                 --enable-intl=shared \
93                 --enable-mbstring \
94                 --enable-pcntl \
95                 --enable-shmop=shared \
96                 --enable-soap=shared \
97                 --enable-sockets=shared \
98                 --enable-sysvmsg=shared \
99                 --enable-sysvsem=shared \
100                 --enable-sysvshm=shared \
101                 --with-bz2=shared \
102                 --with-curl=shared \
103                 --with-enchant=shared \
104                 --with-external-gd \
105                 --with-external-pcre \
106                 --with-ffi=shared \
107                 --with-gdbm \
108                 --with-gettext=shared \
109                 --with-gmp=shared \
110                 --with-iconv=shared \
111                 --with-kerberos \
112                 --with-ldap=shared \
113                 --with-ldap-sasl \
114                 --with-mhash \
115                 --with-mysql-sock=/run/mysqld/mysqld.sock \
116                 --with-mysqli=shared,mysqlnd \
117                 --with-openssl \
118                 --with-password-argon2 \
119                 --with-pdo-dblib=shared,/usr \
120                 --with-pdo-mysql=shared,mysqlnd \
121                 --with-pdo-odbc=shared,unixODBC,/usr \
122                 --with-pdo-pgsql=shared \
123                 --with-pdo-sqlite=shared \
124                 --with-pgsql=shared \
125                 --with-pspell=shared \
126                 --with-readline \
127                 --with-snmp=shared \
128                 --with-sodium=shared \
129                 --with-sqlite3=shared \
130                 --with-tidy=shared \
131                 --with-unixODBC=shared \
132                 --with-xsl=shared \
133                 --with-zip=shared \
134                 --with-zlib \
135                 "
137         EXTENSION_DIR=/usr/lib/php-legacy/modules
138         export EXTENSION_DIR
140         mkdir "${srcdir}/build"
141         cd "${srcdir}/build"
142         ln -s "../php-${pkgver}/configure"
143         ./configure ${_phpconfig} \
144                 --enable-cgi \
145                 --enable-fpm \
146                 --with-fpm-systemd \
147                 --with-fpm-acl \
148                 --with-fpm-user=http \
149                 --with-fpm-group=http \
150                 --enable-embed=shared \
151                 ${_phpextensions}
152         make
154         # apache
155         # reuse the previous run; this will save us a lot of time
156         cp -a "${srcdir}/build" "${srcdir}/build-apache"
157         cd "${srcdir}/build-apache"
158         ./configure ${_phpconfig} \
159                 --with-apxs2 \
160                 ${_phpextensions}
161         make
163         # phpdbg
164         cp -a "${srcdir}/build" "${srcdir}/build-phpdbg"
165         cd "${srcdir}/build-phpdbg"
166         ./configure ${_phpconfig} \
167                 --enable-phpdbg \
168                 ${_phpextensions}
169         make
172 check() {
173         cd "${srcdir}/build"
175         # Check if sendmail was configured correctly (FS#47600)
176         sapi/cli/php -n -r 'echo ini_get("sendmail_path");' | grep -q '/usr/bin/sendmail'
178         export REPORT_EXIT_STATUS=1
179         export NO_INTERACTION=1
180         export SKIP_ONLINE_TESTS=1
181         export SKIP_SLOW_TESTS=1
182         export TEST_PHP_ARGS="-j$(nproc)"
183         export TESTS='tests Zend'
185         make test
188 package_php-legacy() {
189         pkgdesc='A general-purpose scripting language that is especially suited to web development'
190         depends=('libxml2' 'curl' 'libzip' 'pcre2' 'argon2' 'oniguruma' 'gdbm')
191         provides=("php-interpreter=${_interpreter}" "php-legacy-intl=${pkgver}")
192         replaces=('php-legacy-intl')
193         conflicts=('php-legacy-intl')
194         backup=('etc/php-legacy/php.ini')
196         cd "${srcdir}/build"
197         make -j1 INSTALL_ROOT="${pkgdir}" install-{modules,cli,build,headers,programs,pharcmd}
198         install -D -m644 "${srcdir}/php-${pkgver}/php.ini-production" "${pkgdir}/etc/php-legacy/php.ini"
199         install -d -m755 "${pkgdir}/etc/php-legacy/conf.d/"
201         # remove static modules
202         rm -f "${pkgdir}/usr/lib/php-legacy/modules/"*.a
203         # remove modules provided by sub packages
204         rm -f "${pkgdir}/usr/lib/php-legacy/modules/"{enchant,gd,sodium,odbc,pdo_dblib,pdo_odbc,pgsql,pdo_pgsql,pspell,snmp,sqlite3,pdo_sqlite,tidy,xsl}.so
205         # remove empty directory
206         rmdir "${pkgdir}/usr/include/php-legacy/php/include"
209 package_php-legacy-cgi() {
210         pkgdesc='CGI and FCGI SAPI for PHP'
211         depends=('php-legacy')
212         provides=("php-cgi-interpreter=${_interpreter}")
214         cd "${srcdir}/build"
215         make -j1 INSTALL_ROOT="${pkgdir}" install-cgi
218 package_php-legacy-apache() {
219         pkgdesc='Apache SAPI for PHP'
220         depends=('php-legacy' 'apache' 'libnsl')
221         backup=('etc/httpd/conf/extra/php-legacy_module.conf')
222         provides=("php-apache-interpreter=${_interpreter}")
224         install -D -m755 "${srcdir}/build-apache/libs/libphp.so" "${pkgdir}/usr/lib/httpd/modules/libphp-legacy.so"
225         patchelf --set-soname "libphp-legacy.so" "${pkgdir}/usr/lib/httpd/modules/libphp-legacy.so"
227         install -D -m644 "${srcdir}/apache.conf" "${pkgdir}/etc/httpd/conf/extra/php-legacy_module.conf"
230 package_php-legacy-fpm() {
231         pkgdesc='FastCGI Process Manager for PHP'
232         depends=('php-legacy' 'systemd')
233         backup=('etc/php-legacy/php-fpm.conf' 'etc/php-legacy/php-fpm.d/www.conf')
234         provides=("php-fpm-interpreter=${_interpreter}")
235         options=('!emptydirs')
237         cd "${srcdir}/build"
238         make -j1 INSTALL_ROOT="${pkgdir}" install-fpm
239         install -D -m644 sapi/fpm/php-fpm.service "${pkgdir}/usr/lib/systemd/system/php-fpm-legacy.service"
240         ln -rs "${pkgdir}/usr/lib/systemd/system/php-fpm-legacy.service" "${pkgdir}/usr/lib/systemd/system/php-legacy-fpm.service"
241         install -D -m644 "${srcdir}/php-fpm.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/php-fpm-legacy.conf"
244 package_php-legacy-embed() {
245         pkgdesc='Embedded PHP SAPI library'
246         depends=('php-legacy' 'systemd-libs' 'libnsl' 'libxcrypt')
247         provides=("php-embed-interpreter=${_interpreter}")
248         options=('!emptydirs')
250         cd "${srcdir}/build"
251         make -j1 INSTALL_ROOT="${pkgdir}" PHP_SAPI=embed install-sapi
252         mv "${pkgdir}/usr/lib/libphp.so" "${pkgdir}/usr/lib/libphp-legacy.so"
254         patchelf --set-soname "libphp-legacy.so" "${pkgdir}/usr/lib/libphp-legacy.so"
257 package_php-legacy-phpdbg() {
258         pkgdesc='Interactive PHP debugger'
259         depends=('php-legacy')
260         provides=("php-phpdbg-interpreter=${_interpreter}")
261         options=('!emptydirs')
263         cd "${srcdir}/build-phpdbg"
264         make -j1 INSTALL_ROOT="${pkgdir}" install-phpdbg
267 package_php-legacy-dblib() {
268         pkgdesc='dblib module for PHP'
269         depends=('php-legacy' 'freetds')
270         provides=("php-dblib-interpreter=${_interpreter}")
272         install -D -m755 "${srcdir}/build/modules/pdo_dblib.so" "${pkgdir}/usr/lib/php-legacy/modules/pdo_dblib.so"
275 package_php-legacy-enchant() {
276         pkgdesc='enchant module for PHP'
277         depends=('php-legacy' 'enchant')
278         provides=("php-enchant-interpreter=${_interpreter}")
280         install -D -m755 "${srcdir}/build/modules/enchant.so" "${pkgdir}/usr/lib/php-legacy/modules/enchant.so"
283 package_php-legacy-gd() {
284         pkgdesc='gd module for PHP'
285         depends=('php-legacy' 'gd')
286         provides=("php-gd-interpreter=${_interpreter}")
288         install -D -m755 "${srcdir}/build/modules/gd.so" "${pkgdir}/usr/lib/php-legacy/modules/gd.so"
291 package_php-legacy-sodium() {
292         pkgdesc='sodium module for PHP'
293         depends=('php-legacy' 'libsodium')
294         provides=("php-sodium-interpreter=${_interpreter}")
296         install -D -m755 "${srcdir}/build/modules/sodium.so" "${pkgdir}/usr/lib/php-legacy/modules/sodium.so"
299 package_php-legacy-odbc() {
300         pkgdesc='ODBC modules for PHP'
301         depends=('php-legacy' 'unixodbc')
302         provides=("php-odbc-interpreter=${_interpreter}")
304         install -D -m755 "${srcdir}/build/modules/odbc.so" "${pkgdir}/usr/lib/php-legacy/modules/odbc.so"
305         install -D -m755 "${srcdir}/build/modules/pdo_odbc.so" "${pkgdir}/usr/lib/php-legacy/modules/pdo_odbc.so"
308 package_php-legacy-pgsql() {
309         pkgdesc='PostgreSQL modules for PHP'
310         depends=('php-legacy' 'postgresql-libs')
311         provides=("php-pgsql-interpreter=${_interpreter}")
313         install -D -m755 "${srcdir}/build/modules/pgsql.so" "${pkgdir}/usr/lib/php-legacy/modules/pgsql.so"
314         install -D -m755 "${srcdir}/build/modules/pdo_pgsql.so" "${pkgdir}/usr/lib/php-legacy/modules/pdo_pgsql.so"
317 package_php-legacy-pspell() {
318         pkgdesc='pspell module for PHP'
319         depends=('php-legacy' 'aspell')
320         provides=("php-pspell-interpreter=${_interpreter}")
322         install -D -m755 "${srcdir}/build/modules/pspell.so" "${pkgdir}/usr/lib/php-legacy/modules/pspell.so"
325 package_php-legacy-snmp() {
326         pkgdesc='snmp module for PHP'
327         depends=('php-legacy' 'net-snmp')
328         provides=("php-snmp-interpreter=${_interpreter}")
330         install -D -m755 "${srcdir}/build/modules/snmp.so" "${pkgdir}/usr/lib/php-legacy/modules/snmp.so"
333 package_php-legacy-sqlite() {
334         pkgdesc='sqlite module for PHP'
335         depends=('php-legacy' 'sqlite')
336         provides=("php-sqlite-interpreter=${_interpreter}")
338         install -D -m755 "${srcdir}/build/modules/sqlite3.so" "${pkgdir}/usr/lib/php-legacy/modules/sqlite3.so"
339         install -D -m755 "${srcdir}/build/modules/pdo_sqlite.so" "${pkgdir}/usr/lib/php-legacy/modules/pdo_sqlite.so"
342 package_php-legacy-tidy() {
343         pkgdesc='tidy module for PHP'
344         depends=('php-legacy' 'tidy')
345         provides=("php-tidy-interpreter=${_interpreter}")
347         install -D -m755 "${srcdir}/build/modules/tidy.so" "${pkgdir}/usr/lib/php-legacy/modules/tidy.so"
350 package_php-legacy-xsl() {
351         pkgdesc='xsl module for PHP'
352         depends=('php-legacy' 'libxslt')
353         provides=("php-xsl-interpreter=${_interpreter}")
355         install -D -m755 "${srcdir}/build/modules/xsl.so" "${pkgdir}/usr/lib/php-legacy/modules/xsl.so"