archrelease: copy trunk to testing-x86_64
[arch-packages.git] / php7 / trunk / PKGBUILD
blob402c793c4be152d41db27cd91d0a06159b3b1095
1 # Maintainer: Pierre Schmitz <pierre@archlinux.de>
2 # Contributor: Matt Harrison <matt@harrison.us.com>
4 pkgbase=php7
5 pkgname=('php7'
6          'php7-cgi'
7          'php7-apache'
8          'php7-fpm'
9          'php7-embed'
10          'php7-phpdbg'
11          'php7-dblib'
12          'php7-enchant'
13          'php7-gd'
14          'php7-imap'
15          'php7-intl'
16          'php7-sodium'
17          'php7-odbc'
18          'php7-pgsql'
19          'php7-pspell'
20          'php7-snmp'
21          'php7-sqlite'
22          'php7-tidy'
23          'php7-xsl')
24 pkgver=7.4.33
25 pkgrel=4
26 arch=('x86_64')
27 license=('PHP')
28 url='https://www.php.net/'
29 makedepends=('apache' 'aspell' 'c-client' 'enchant' 'gd' 'gmp' 'icu' 'libsodium' 'libxslt' 'libzip' 'net-snmp'
30              'postgresql-libs' 'sqlite' 'systemd' 'tidy' 'unixodbc' 'curl' 'libtool' 'postfix' 'freetds' 'pcre2' 'libnsl'
31              'oniguruma')
32 checkdepends=('procps-ng')
33 source=("https://php.net/distributions/php-${pkgver}.tar.xz"{,.asc}
34         'php7-openssl3.patch::https://github.com/php/php-src/commit/a0972deb0f441fc7991001cb51efc994b70a3b51.patch'
35         'php7-openssl3-eof.patch::https://github.com/php/php-src/commit/74f75db0c3665677ec006cd379fd561feacffdc6.patch'
36         'apache.patch' 'apache.conf' 'php-fpm.patch' 'php-fpm.tmpfiles' 'php.ini.patch'
37         'enchant-2.patch' 'php7.patch')
38 sha512sums=('499b63b99e5d8e8082ff89d3a91b4cb9a593ea7553b96e48863414c13d2e50275904ed29070e2232e529ee91160f505e6060a4d129cb5bf098aa5b6ea0928d3d'
39             'SKIP'
40             '07b9ba019221cce6f73ebf1fdc6124f0730e42d19b9e0f846d132423da3b820439d4cba61fff8e65937c955ba985889f0c57ed2f94f380213e7279b0531c6444'
41             '46112bf170c6f1772792c02d6cabd1219aa0d5e3123551cd2bbed480f7cf87743eece89539e3d62eacd312fd025235bb9f5ac1c771bd18ae5b606ae48a7bf222'
42             '284e3c0fe3ded0ff3e7d53f2769ea207b4591ef42abeff2d8604e87fe379929bd3b19ff294a729834f339a9da85ae7d4a7d8605890677222f78601b4f2b22247'
43             'eccbe1a0c7b2757ab3c982c871cc591a66ad70f085aaa0d44f93cacacedc7b8fd21b8d0c66471327ff070db1bab1ab83a802f6fa190f33bdd74c134975e3910e'
44             'bf43a99b464a873986954233e2df4841eeab21a6d359a777b7514a4fa34462c9f0fd85243086122ed50c766d5b60fb83f9f181a9b43ae1b527672a4f3b8d8eed'
45             '7248e9a93faebb86b156130b6ecd8c9733ae8dfa2789c738f9db5a2ab2daee294132b7d8a5a59c860e9e235fdc1bc6a9e9b8b410a23ccc5c6627297d834d3120'
46             '642e9f84d9d0df96e5d9bafcd3aed7aab3b4374e7917be98e9fa386919c64e9a27ac2daace99b4fcaa7256cca60a87d22893c2ef5383e5353926d8869fda376d'
47             '5d7d44d692848fbb952e17e5bd6dffa79b764526e4940fbe0a5138ad62cb41abdb8c9bb8dd64cd1d0b488c74972bcf3f9c6d32a3bbeac90982fdf6321d3ec788'
48             'f8c197fb657958016340db87de3e3427cc692cccc791e88c650362ed89bfd3be6180e430e5c446d19566b7e66225f9fa8cbed46a0909c87d6e046e65135d3031')
49 validpgpkeys=('5A52880781F755608BF815FC910DEB46F53EA312'
50               '42670A7FE4D0441C8E4632349E4FDC074A4EF02D')
51 _interpreter=${pkgver%.*}
53 prepare() {
54         cd "${srcdir}/php-${pkgver}"
56         patch -p1 -i "${srcdir}/php7-openssl3.patch"
57         patch -p1 -i "${srcdir}/php7-openssl3-eof.patch"
59         patch -p0 -i "${srcdir}/apache.patch"
60         patch -p0 -i "${srcdir}/php-fpm.patch"
61         patch -p0 -i "${srcdir}/php.ini.patch"
62         patch -p0 -i "${srcdir}/enchant-2.patch"
63         patch -p0 -i "${srcdir}/php7.patch"
64         autoconf
66         rm tests/output/stream_isatty_*.phpt
69 build() {
70         # http://site.icu-project.org/download/61#TOC-Migration-Issues
71         CPPFLAGS+=' -DU_USING_ICU_NAMESPACE=1'
73         local _phpconfig="--srcdir=../php-${pkgver} \
74                 --config-cache \
75                 --prefix=/usr \
76                 --sbindir=/usr/bin \
77                 --sysconfdir=/etc/php7 \
78                 --localstatedir=/var \
79                 --with-layout=GNU \
80                 --with-config-file-path=/etc/php7 \
81                 --with-config-file-scan-dir=/etc/php7/conf.d \
82                 --disable-rpath \
83                 --mandir=/usr/share/man \
84                 --libdir=/usr/lib/php7 \
85                 --datarootdir=/usr/share/php7 \
86                 --datadir=/usr/share/php7 \
87                 --program-suffix=7 \
88                 --includedir=/usr/include/php7 \
89                 --disable-gcc-global-regs \
90                 "
92         local _phpextensions="\
93                 --enable-bcmath=shared \
94                 --enable-calendar=shared \
95                 --enable-dba=shared \
96                 --enable-exif=shared \
97                 --enable-ftp=shared \
98                 --enable-gd=shared \
99                 --enable-intl=shared \
100                 --enable-mbstring \
101                 --enable-pcntl \
102                 --enable-shmop=shared \
103                 --enable-soap=shared \
104                 --enable-sockets=shared \
105                 --enable-sysvmsg=shared \
106                 --enable-sysvsem=shared \
107                 --enable-sysvshm=shared \
108                 --with-bz2=shared \
109                 --with-curl=shared \
110                 --with-enchant=shared \
111                 --with-external-gd \
112                 --with-external-pcre \
113                 --with-ffi=shared \
114                 --with-gdbm \
115                 --with-gettext=shared \
116                 --with-gmp=shared \
117                 --with-iconv=shared \
118                 --with-imap-ssl \
119                 --with-imap=shared \
120                 --with-kerberos \
121                 --with-ldap=shared \
122                 --with-ldap-sasl \
123                 --with-mhash \
124                 --with-mysql-sock=/run/mysqld/mysqld.sock \
125                 --with-mysqli=shared,mysqlnd \
126                 --with-openssl \
127                 --with-password-argon2 \
128                 --with-pdo-dblib=shared,/usr \
129                 --with-pdo-mysql=shared,mysqlnd \
130                 --with-pdo-odbc=shared,unixODBC,/usr \
131                 --with-pdo-pgsql=shared \
132                 --with-pdo-sqlite=shared \
133                 --with-pgsql=shared \
134                 --with-pspell=shared \
135                 --with-readline \
136                 --with-snmp=shared \
137                 --with-sodium=shared \
138                 --with-sqlite3=shared \
139                 --with-tidy=shared \
140                 --with-unixODBC=shared \
141                 --with-xmlrpc=shared \
142                 --with-xsl=shared \
143                 --with-zip=shared \
144                 --with-zlib \
145                 "
147         EXTENSION_DIR=/usr/lib/php7/modules
148         export EXTENSION_DIR
150         mkdir "${srcdir}/build"
151         cd "${srcdir}/build"
152         ln -s ../php-${pkgver}/configure
153         ./configure ${_phpconfig} \
154                 --enable-cgi \
155                 --enable-fpm \
156                 --with-fpm-systemd \
157                 --with-fpm-acl \
158                 --with-fpm-user=http \
159                 --with-fpm-group=http \
160                 --enable-embed=shared \
161                 ${_phpextensions}
162         make
164         # apache
165         # reuse the previous run; this will save us a lot of time
166         cp -a "${srcdir}/build" "${srcdir}/build-apache"
167         cd "${srcdir}/build-apache"
168         ./configure ${_phpconfig} \
169                 --with-apxs2 \
170                 ${_phpextensions}
171         make
173         # phpdbg
174         cp -a "${srcdir}/build" "${srcdir}/build-phpdbg"
175         cd "${srcdir}/build-phpdbg"
176         ./configure ${_phpconfig} \
177                 --enable-phpdbg \
178                 ${_phpextensions}
179         make
182 check() {
183         cd "${srcdir}/build"
185         # Check if sendmail was configured correctly (FS#47600)
186         sapi/cli/php -n -r 'echo ini_get("sendmail_path");' | grep -q '/usr/bin/sendmail'
188         export REPORT_EXIT_STATUS=1
189         export NO_INTERACTION=1
190         export SKIP_ONLINE_TESTS=1
191         export SKIP_SLOW_TESTS=1
192         export TEST_PHP_ARGS="-j$(nproc)"
193         export TESTS='tests Zend'
195         make test
198 package_php7() {
199         pkgdesc='A general-purpose scripting language that is especially suited to web development'
200         depends=('libxml2' 'curl' 'libzip' 'pcre2' 'argon2' 'oniguruma')
201         provides=(php-interpreter=$_interpreter)
202         backup=('etc/php7/php.ini')
204         cd "${srcdir}/build"
205         make -j1 INSTALL_ROOT="${pkgdir}" install-{modules,cli,build,headers,programs,pharcmd}
206         install -D -m644 "${srcdir}/php-${pkgver}/php.ini-production" "${pkgdir}/etc/php7/php.ini"
207         install -d -m755 "${pkgdir}/etc/php7/conf.d/"
209         # remove static modules
210         rm -f "${pkgdir}/usr/lib/php7/modules/"*.a
211         # remove modules provided by sub packages
212         rm -f "${pkgdir}/usr/lib/php7/modules/"{enchant,gd,imap,intl,sodium,odbc,pdo_dblib,pdo_odbc,pgsql,pdo_pgsql,pspell,snmp,sqlite3,pdo_sqlite,tidy,xsl}.so
213         # remove empty directory
214         rmdir "${pkgdir}/usr/include/php7/php/include"
217 package_php7-cgi() {
218         pkgdesc='CGI and FCGI SAPI for PHP'
219         depends=('php7')
221         cd "${srcdir}/build"
222         make -j1 INSTALL_ROOT="${pkgdir}" install-cgi
225 package_php7-apache() {
226         pkgdesc='Apache SAPI for PHP'
227         depends=('php7' 'apache' 'libnsl')
228         backup=('etc/httpd/conf/extra/php7_module.conf')
230         install -D -m755 "${srcdir}/build-apache/libs/libphp7.so" "${pkgdir}/usr/lib/httpd/modules/libphp7.so"
231         install -D -m644 "${srcdir}/apache.conf" "${pkgdir}/etc/httpd/conf/extra/php7_module.conf"
234 package_php7-fpm() {
235         pkgdesc='FastCGI Process Manager for PHP'
236         depends=('php7' 'systemd')
237         backup=('etc/php7/php-fpm.conf' 'etc/php7/php-fpm.d/www.conf')
238         options=('!emptydirs')
240         cd "${srcdir}/build"
241         make -j1 INSTALL_ROOT="${pkgdir}" install-fpm
242         install -D -m644 sapi/fpm/php-fpm.service "${pkgdir}/usr/lib/systemd/system/php-fpm7.service"
243         install -D -m644 "${srcdir}/php-fpm.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/php-fpm7.conf"
246 package_php7-embed() {
247         pkgdesc='Embedded PHP SAPI library'
248         depends=('php7' 'systemd-libs' 'libnsl' 'libxcrypt')
249         options=('!emptydirs')
251         cd "${srcdir}/build"
252         make -j1 INSTALL_ROOT="${pkgdir}" PHP_SAPI=embed install-sapi
255 package_php7-phpdbg() {
256         pkgdesc='Interactive PHP debugger'
257         depends=('php7')
258         options=('!emptydirs')
260         cd "${srcdir}/build-phpdbg"
261         make -j1 INSTALL_ROOT="${pkgdir}" install-phpdbg
264 package_php7-dblib() {
265         pkgdesc='dblib module for PHP'
266         depends=('php7' 'freetds')
268         install -D -m755 "${srcdir}/build/modules/pdo_dblib.so" "${pkgdir}/usr/lib/php7/modules/pdo_dblib.so"
271 package_php7-enchant() {
272         pkgdesc='enchant module for PHP'
273         depends=('php7' 'enchant')
275         install -D -m755 "${srcdir}/build/modules/enchant.so" "${pkgdir}/usr/lib/php7/modules/enchant.so"
278 package_php7-gd() {
279         pkgdesc='gd module for PHP'
280         depends=('php7' 'gd')
282         install -D -m755 "${srcdir}/build/modules/gd.so" "${pkgdir}/usr/lib/php7/modules/gd.so"
285 package_php7-imap() {
286         pkgdesc='imap module for PHP'
287         depends=('php7' 'c-client' 'libxcrypt')
289         install -D -m755 "${srcdir}/build/modules/imap.so" "${pkgdir}/usr/lib/php7/modules/imap.so"
292 package_php7-intl() {
293         pkgdesc='intl module for PHP'
294         depends=('php7' 'icu')
296         install -D -m755 "${srcdir}/build/modules/intl.so" "${pkgdir}/usr/lib/php7/modules/intl.so"
299 package_php7-sodium() {
300         pkgdesc='sodium module for PHP'
301         depends=('php7' 'libsodium')
304         install -D -m755 "${srcdir}/build/modules/sodium.so" "${pkgdir}/usr/lib/php7/modules/sodium.so"
307 package_php7-odbc() {
308         pkgdesc='ODBC modules for PHP'
309         depends=('php7' 'unixodbc')
311         install -D -m755 "${srcdir}/build/modules/odbc.so" "${pkgdir}/usr/lib/php7/modules/odbc.so"
312         install -D -m755 "${srcdir}/build/modules/pdo_odbc.so" "${pkgdir}/usr/lib/php7/modules/pdo_odbc.so"
315 package_php7-pgsql() {
316         pkgdesc='PostgreSQL modules for PHP'
317         depends=('php7' 'postgresql-libs')
319         install -D -m755 "${srcdir}/build/modules/pgsql.so" "${pkgdir}/usr/lib/php7/modules/pgsql.so"
320         install -D -m755 "${srcdir}/build/modules/pdo_pgsql.so" "${pkgdir}/usr/lib/php7/modules/pdo_pgsql.so"
323 package_php7-pspell() {
324         pkgdesc='pspell module for PHP'
325         depends=('php7' 'aspell')
327         install -D -m755 "${srcdir}/build/modules/pspell.so" "${pkgdir}/usr/lib/php7/modules/pspell.so"
330 package_php7-snmp() {
331         pkgdesc='snmp module for PHP'
332         depends=('php7' 'net-snmp')
334         install -D -m755 "${srcdir}/build/modules/snmp.so" "${pkgdir}/usr/lib/php7/modules/snmp.so"
337 package_php7-sqlite() {
338         pkgdesc='sqlite module for PHP'
339         depends=('php7' 'sqlite')
341         install -D -m755 "${srcdir}/build/modules/sqlite3.so" "${pkgdir}/usr/lib/php7/modules/sqlite3.so"
342         install -D -m755 "${srcdir}/build/modules/pdo_sqlite.so" "${pkgdir}/usr/lib/php7/modules/pdo_sqlite.so"
345 package_php7-tidy() {
346         pkgdesc='tidy module for PHP'
347         depends=('php7' 'tidy')
349         install -D -m755 "${srcdir}/build/modules/tidy.so" "${pkgdir}/usr/lib/php7/modules/tidy.so"
352 package_php7-xsl() {
353         pkgdesc='xsl module for PHP'
354         depends=('php7' 'libxslt')
356         install -D -m755 "${srcdir}/build/modules/xsl.so" "${pkgdir}/usr/lib/php7/modules/xsl.so"