1 # Maintainer: Pierre Schmitz <pierre@archlinux.de>
27 url='https://www.php.net/'
28 makedepends=('apache' 'aspell' 'c-client' 'db' 'enchant' 'gd' 'gmp' 'icu' 'libsodium' 'libxslt' 'libzip' 'net-snmp'
29 'postgresql-libs' 'sqlite' 'systemd' 'tidy' 'unixodbc' 'curl' 'libtool' 'postfix' 'freetds' 'pcre2' 'libnsl'
31 checkdepends=('procps-ng')
32 source=("https://php.net/distributions/${pkgbase}-${pkgver}.tar.xz"{,.asc}
33 'apache.patch' 'apache.conf' 'php-fpm.patch' 'php-fpm.tmpfiles' 'php.ini.patch')
34 sha256sums=('cd976805ec2e9198417651027dfe16854ba2c2c388151ab9d4d268513d52ed52'
36 '702b163c66c65af92dcad8d79f41bda84bcd5d863235fcf1497c33a86db9e4ca'
37 '4a2add00d93fa991ccdf6356090264c1059c79935642afff6e8d4a2107fa037e'
38 '2228131cc65139bd819b617bba06c2406e559c55fbfb38a29f9853ce48c58eeb'
39 '640dba0d960bfeaae9ad38d2826d3f6b5d6c175a4d3e16664eefff29141faad5'
40 'b538a7c974adde626c35481e4a66d506dc12c598f369dfe79f3fcb9585d8b920')
41 validpgpkeys=('1729F83938DA44E27BA0F4D3DBDB397470D12172'
42 'BFDDD28642824F8118EF77909B67A5C12229118F')
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 \
71 local _phpextensions="\
72 --enable-bcmath=shared \
73 --enable-calendar=shared \
75 --enable-exif=shared \
78 --enable-intl=shared \
81 --enable-shmop=shared \
82 --enable-soap=shared \
83 --enable-sockets=shared \
84 --enable-sysvmsg=shared \
85 --enable-sysvsem=shared \
86 --enable-sysvshm=shared \
90 --with-enchant=shared \
92 --with-external-pcre \
95 --with-gettext=shared \
104 --with-mysql-sock=/run/mysqld/mysqld.sock \
105 --with-mysqli=shared,mysqlnd \
107 --with-password-argon2 \
108 --with-pdo-dblib=shared,/usr \
109 --with-pdo-mysql=shared,mysqlnd \
110 --with-pdo-odbc=shared,unixODBC,/usr \
111 --with-pdo-pgsql=shared \
112 --with-pdo-sqlite=shared \
113 --with-pgsql=shared \
114 --with-pspell=shared \
117 --with-sodium=shared \
118 --with-sqlite3=shared \
120 --with-unixODBC=shared \
126 EXTENSION_DIR=/usr/lib/php/modules
129 mkdir "${srcdir}/build"
131 ln -s "../${pkgbase}-${pkgver}/configure"
132 ./configure ${_phpconfig} \
137 --with-fpm-user=http \
138 --with-fpm-group=http \
139 --enable-embed=shared \
144 # reuse the previous run; this will save us a lot of time
145 cp -a "${srcdir}/build" "${srcdir}/build-apache"
146 cd "${srcdir}/build-apache"
147 ./configure ${_phpconfig} \
153 cp -a "${srcdir}/build" "${srcdir}/build-phpdbg"
154 cd "${srcdir}/build-phpdbg"
155 ./configure ${_phpconfig} \
164 # Check if sendmail was configured correctly (FS#47600)
165 sapi/cli/php -n -r 'echo ini_get("sendmail_path");' | grep -q '/usr/bin/sendmail'
167 export REPORT_EXIT_STATUS=1
168 export NO_INTERACTION=1
169 export SKIP_ONLINE_TESTS=1
170 export SKIP_SLOW_TESTS=1
171 export TEST_PHP_ARGS="-j$(nproc)"
172 export TESTS='tests Zend'
178 pkgdesc='A general-purpose scripting language that is especially suited to web development'
179 depends=('libxml2' 'curl' 'libzip' 'pcre2' 'argon2' 'oniguruma')
180 replaces=('php-ldap')
181 conflicts=('php-ldap')
182 provides=("php-ldap=${pkgver}")
183 backup=('etc/php/php.ini')
186 make -j1 INSTALL_ROOT="${pkgdir}" install-{modules,cli,build,headers,programs,pharcmd}
187 install -D -m644 "${srcdir}/${pkgbase}-${pkgver}/php.ini-production" "${pkgdir}/etc/php/php.ini"
188 install -d -m755 "${pkgdir}/etc/php/conf.d/"
190 # remove static modules
191 rm -f "${pkgdir}/usr/lib/php/modules/"*.a
192 # remove modules provided by sub packages
193 rm -f "${pkgdir}/usr/lib/php/modules/"{enchant,gd,imap,intl,sodium,odbc,pdo_dblib,pdo_odbc,pgsql,pdo_pgsql,pspell,snmp,sqlite3,pdo_sqlite,tidy,xsl}.so
194 # remove empty directory
195 rmdir "${pkgdir}/usr/include/php/include"
199 pkgdesc='CGI and FCGI SAPI for PHP'
203 make -j1 INSTALL_ROOT="${pkgdir}" install-cgi
206 package_php-apache() {
207 pkgdesc='Apache SAPI for PHP'
208 depends=('php' 'apache' 'libnsl')
209 backup=('etc/httpd/conf/extra/php_module.conf')
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 options=('!emptydirs')
222 make -j1 INSTALL_ROOT="${pkgdir}" install-fpm
223 install -D -m644 sapi/fpm/php-fpm.service "${pkgdir}/usr/lib/systemd/system/php-fpm.service"
224 install -D -m644 "${srcdir}/php-fpm.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/php-fpm.conf"
227 package_php-embed() {
228 pkgdesc='Embedded PHP SAPI library'
229 depends=('php' 'systemd-libs' 'libnsl' 'libxcrypt')
230 options=('!emptydirs')
233 make -j1 INSTALL_ROOT="${pkgdir}" PHP_SAPI=embed install-sapi
236 package_php-phpdbg() {
237 pkgdesc='Interactive PHP debugger'
239 options=('!emptydirs')
241 cd "${srcdir}/build-phpdbg"
242 make -j1 INSTALL_ROOT="${pkgdir}" install-phpdbg
245 package_php-dblib() {
246 pkgdesc='dblib module for PHP'
247 depends=('php' 'freetds')
249 install -D -m755 "${srcdir}/build/modules/pdo_dblib.so" "${pkgdir}/usr/lib/php/modules/pdo_dblib.so"
252 package_php-enchant() {
253 pkgdesc='enchant module for PHP'
254 depends=('php' 'enchant')
256 install -D -m755 "${srcdir}/build/modules/enchant.so" "${pkgdir}/usr/lib/php/modules/enchant.so"
260 pkgdesc='gd module for PHP'
263 install -D -m755 "${srcdir}/build/modules/gd.so" "${pkgdir}/usr/lib/php/modules/gd.so"
267 pkgdesc='imap module for PHP'
268 depends=('php' 'c-client' 'libxcrypt')
270 install -D -m755 "${srcdir}/build/modules/imap.so" "${pkgdir}/usr/lib/php/modules/imap.so"
274 pkgdesc='intl module for PHP'
275 depends=('php' 'icu')
277 install -D -m755 "${srcdir}/build/modules/intl.so" "${pkgdir}/usr/lib/php/modules/intl.so"
280 package_php-sodium() {
281 pkgdesc='sodium module for PHP'
282 depends=('php' 'libsodium')
284 install -D -m755 "${srcdir}/build/modules/sodium.so" "${pkgdir}/usr/lib/php/modules/sodium.so"
288 pkgdesc='ODBC modules for PHP'
289 depends=('php' 'unixodbc')
291 install -D -m755 "${srcdir}/build/modules/odbc.so" "${pkgdir}/usr/lib/php/modules/odbc.so"
292 install -D -m755 "${srcdir}/build/modules/pdo_odbc.so" "${pkgdir}/usr/lib/php/modules/pdo_odbc.so"
295 package_php-pgsql() {
296 pkgdesc='PostgreSQL modules for PHP'
297 depends=('php' 'postgresql-libs')
299 install -D -m755 "${srcdir}/build/modules/pgsql.so" "${pkgdir}/usr/lib/php/modules/pgsql.so"
300 install -D -m755 "${srcdir}/build/modules/pdo_pgsql.so" "${pkgdir}/usr/lib/php/modules/pdo_pgsql.so"
303 package_php-pspell() {
304 pkgdesc='pspell module for PHP'
305 depends=('php' 'aspell')
307 install -D -m755 "${srcdir}/build/modules/pspell.so" "${pkgdir}/usr/lib/php/modules/pspell.so"
311 pkgdesc='snmp module for PHP'
312 depends=('php' 'net-snmp')
314 install -D -m755 "${srcdir}/build/modules/snmp.so" "${pkgdir}/usr/lib/php/modules/snmp.so"
317 package_php-sqlite() {
318 pkgdesc='sqlite module for PHP'
319 depends=('php' 'sqlite')
321 install -D -m755 "${srcdir}/build/modules/sqlite3.so" "${pkgdir}/usr/lib/php/modules/sqlite3.so"
322 install -D -m755 "${srcdir}/build/modules/pdo_sqlite.so" "${pkgdir}/usr/lib/php/modules/pdo_sqlite.so"
326 pkgdesc='tidy module for PHP'
327 depends=('php' 'tidy')
329 install -D -m755 "${srcdir}/build/modules/tidy.so" "${pkgdir}/usr/lib/php/modules/tidy.so"
333 pkgdesc='xsl module for PHP'
334 depends=('php' 'libxslt')
336 install -D -m755 "${srcdir}/build/modules/xsl.so" "${pkgdir}/usr/lib/php/modules/xsl.so"