PKGBUILDs/extra/php/PKGBUILD
2016-12-08 02:16:46 +00:00

346 lines
9.7 KiB
Bash

# $Id$
# Maintainer: Pierre Schmitz <pierre@archlinux.de>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - revert upstream commits that break AArch64 build
pkgbase=php
pkgname=('php'
'php-cgi'
'php-apache'
'php-fpm'
'php-embed'
'php-phpdbg'
'php-dblib'
'php-enchant'
'php-gd'
'php-imap'
'php-intl'
'php-mcrypt'
'php-odbc'
'php-pgsql'
'php-pspell'
'php-snmp'
'php-sqlite'
'php-tidy'
'php-xsl')
pkgver=7.0.14
pkgrel=1
arch=('i686' 'x86_64')
license=('PHP')
url='http://www.php.net'
makedepends=('apache' 'aspell' 'c-client' 'db' 'enchant' 'gd' 'gmp' 'icu' 'libmcrypt' 'libxslt' 'libzip' 'net-snmp'
'postgresql-libs' 'sqlite' 'systemd' 'tidy' 'unixodbc' 'curl' 'libtool' 'postfix' 'freetds' 'pcre')
checkdepends=('procps-ng')
source=("https://php.net/distributions/${pkgbase}-${pkgver}.tar.xz"{,.asc}
'apache.patch' 'apache.conf' 'php-fpm.patch' 'php-fpm.tmpfiles' 'php.ini.patch'
'https://github.com/php/php-src/commit/c2173c16d038cf99c5eff12ddc76f99d46a35c57.patch'
'https://github.com/php/php-src/commit/d4b3f89c53f8812cbaede013d7e4000917cf27e1.patch')
sha256sums=('0f1dff6392a1cc2ed126b9695f580a2ed77eb09d2c23b41cabfb41e6f27a8c89'
'SKIP'
'819f05d2fd5a75c96e93c863517ca77dbd021a1224dc2d8096f758fb2937df6a'
'ebc0af1ef3a6baccb013d0ccb29923895a7b22ff2d032e3bba802dc6328301ce'
'136e197384255420c73678aef812e70aa86320f6dbefcc5a952df1a65fdd53fa'
'640dba0d960bfeaae9ad38d2826d3f6b5d6c175a4d3e16664eefff29141faad5'
'd37ce253f1096df1702fe2b0272a0919e8a02cc9e05b868d5f54b506fc6ce0d3'
'31aa9edd0e4b45478f873b1e444204d9014fc5e005c8ecf1da386f6003647cba'
'1d036b2010bb5a957bd69436d854be72f36364f302d85f62092136b860bf04d2')
validpgpkeys=('1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763'
'6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3')
prepare() {
cd ${srcdir}/${pkgbase}-${pkgver}
patch -p0 -i ${srcdir}/apache.patch
patch -p0 -i ${srcdir}/php-fpm.patch
patch -p0 -i ${srcdir}/php.ini.patch
if [[ $CARCH == "aarch64" ]]; then
patch -p1 -R -i ../c2173c16d038cf99c5eff12ddc76f99d46a35c57.patch
patch -p1 -R -i ../d4b3f89c53f8812cbaede013d7e4000917cf27e1.patch
fi
}
build() {
local _phpconfig="--srcdir=../${pkgbase}-${pkgver} \
--config-cache \
--prefix=/usr \
--sbindir=/usr/bin \
--sysconfdir=/etc/php \
--localstatedir=/var \
--with-layout=GNU \
--with-config-file-path=/etc/php \
--with-config-file-scan-dir=/etc/php/conf.d \
--disable-rpath \
--mandir=/usr/share/man \
--without-pear \
--enable-zend-signals \
"
local _phpextensions="\
--enable-bcmath=shared \
--enable-calendar=shared \
--enable-dba=shared \
--enable-exif=shared \
--enable-ftp=shared \
--enable-gd-native-ttf \
--enable-intl=shared \
--enable-mbstring \
--enable-shmop=shared \
--enable-soap=shared \
--enable-sockets=shared \
--enable-sysvmsg=shared \
--enable-sysvsem=shared \
--enable-sysvshm=shared \
--enable-zip=shared \
--with-bz2=shared \
--with-curl=shared \
--with-db4=/usr \
--with-enchant=shared,/usr \
--with-freetype-dir=/usr \
--with-gd=shared,/usr \
--with-gdbm \
--with-gettext=shared \
--with-gmp=shared \
--with-iconv=shared \
--with-imap-ssl \
--with-imap=shared \
--with-kerberos=/usr \
--with-ldap=shared \
--with-ldap-sasl \
--with-libzip \
--with-mcrypt=shared \
--with-mhash \
--with-mysql-sock=/run/mysqld/mysqld.sock \
--with-mysqli=shared,mysqlnd \
--with-openssl \
--with-pcre-regex=/usr \
--with-pdo-dblib=shared,/usr \
--with-pdo-mysql=shared,mysqlnd \
--with-pdo-odbc=shared,unixODBC,/usr \
--with-pdo-pgsql=shared \
--with-pdo-sqlite=shared,/usr \
--with-pgsql=shared \
--with-pspell=shared \
--with-readline \
--with-snmp=shared \
--with-sqlite3=shared,/usr \
--with-tidy=shared \
--with-unixODBC=shared,/usr \
--with-xmlrpc=shared \
--with-xsl=shared \
--with-zlib \
--enable-pcntl \
"
EXTENSION_DIR=/usr/lib/php/modules
export EXTENSION_DIR
mkdir ${srcdir}/build
cd ${srcdir}/build
ln -s ../${pkgbase}-${pkgver}/configure
./configure ${_phpconfig} \
--enable-cgi \
--enable-fpm \
--with-fpm-systemd \
--with-fpm-acl \
--with-fpm-user=http \
--with-fpm-group=http \
--enable-embed=shared \
${_phpextensions}
make
# apache
# reuse the previous run; this will save us a lot of time
cp -a ${srcdir}/build ${srcdir}/build-apache
cd ${srcdir}/build-apache
./configure ${_phpconfig} \
--with-apxs2 \
${_phpextensions}
make
# phpdbg
cp -a ${srcdir}/build ${srcdir}/build-phpdbg
cd ${srcdir}/build-phpdbg
./configure ${_phpconfig} \
--enable-phpdbg \
${_phpextensions}
make
}
check() {
cd ${srcdir}/${pkgbase}-${pkgver}
# Check if sendmail was configured correctly (FS#47600)
${srcdir}/build/sapi/cli/php -n -r 'echo ini_get("sendmail_path");' | grep -q '/usr/bin/sendmail'
export REPORT_EXIT_STATUS=1
export NO_INTERACTION=1
export SKIP_ONLINE_TESTS=1
export SKIP_SLOW_TESTS=1
${srcdir}/build/sapi/cli/php -n run-tests.php -n -P {tests,Zend}
}
package_php() {
pkgdesc='A general-purpose scripting language that is especially suited to web development'
depends=('libxml2' 'curl' 'libzip' 'pcre')
replaces=('php-ldap')
conflicts=('php-ldap')
provides=("php-ldap=${pkgver}")
backup=('etc/php/php.ini')
cd ${srcdir}/build
make -j1 INSTALL_ROOT=${pkgdir} install-{modules,cli,build,headers,programs,pharcmd}
install -D -m644 ${srcdir}/${pkgbase}-${pkgver}/php.ini-production ${pkgdir}/etc/php/php.ini
install -d -m755 ${pkgdir}/etc/php/conf.d/
# remove static modules
rm -f ${pkgdir}/usr/lib/php/modules/*.a
# remove modules provided by sub packages
rm -f ${pkgdir}/usr/lib/php/modules/{enchant,gd,imap,intl,mcrypt,odbc,pdo_dblib,pdo_odbc,pgsql,pdo_pgsql,pspell,snmp,sqlite3,pdo_sqlite,tidy,xsl}.so
# remove empty directory
rmdir ${pkgdir}/usr/include/php/include
}
package_php-cgi() {
pkgdesc='CGI and FCGI SAPI for PHP'
depends=('php')
cd ${srcdir}/build
make -j1 INSTALL_ROOT=${pkgdir} install-cgi
}
package_php-apache() {
pkgdesc='Apache SAPI for PHP'
depends=('php' 'apache')
backup=('etc/httpd/conf/extra/php7_module.conf')
install -D -m755 ${srcdir}/build-apache/libs/libphp7.so ${pkgdir}/usr/lib/httpd/modules/libphp7.so
install -D -m644 ${srcdir}/apache.conf ${pkgdir}/etc/httpd/conf/extra/php7_module.conf
}
package_php-fpm() {
pkgdesc='FastCGI Process Manager for PHP'
depends=('php' 'systemd')
backup=('etc/php/php-fpm.conf' 'etc/php/php-fpm.d/www.conf')
install='php-fpm.install'
options=('!emptydirs')
cd ${srcdir}/build
make -j1 INSTALL_ROOT=${pkgdir} install-fpm
install -D -m644 sapi/fpm/php-fpm.service ${pkgdir}/usr/lib/systemd/system/php-fpm.service
install -D -m644 ${srcdir}/php-fpm.tmpfiles ${pkgdir}/usr/lib/tmpfiles.d/php-fpm.conf
}
package_php-embed() {
pkgdesc='Embedded PHP SAPI library'
depends=('php' 'libsystemd')
options=('!emptydirs')
cd ${srcdir}/build
make -j1 INSTALL_ROOT=${pkgdir} PHP_SAPI=embed install-sapi
}
package_php-phpdbg() {
pkgdesc='Interactive PHP debugger'
depends=('php')
options=('!emptydirs')
cd ${srcdir}/build-phpdbg
make -j1 INSTALL_ROOT=${pkgdir} install-phpdbg
}
package_php-dblib() {
pkgdesc='dblib module for PHP'
depends=('php' 'freetds')
install -D -m755 ${srcdir}/build/modules/pdo_dblib.so ${pkgdir}/usr/lib/php/modules/pdo_dblib.so
}
package_php-enchant() {
pkgdesc='enchant module for PHP'
depends=('php' 'enchant')
install -D -m755 ${srcdir}/build/modules/enchant.so ${pkgdir}/usr/lib/php/modules/enchant.so
}
package_php-gd() {
pkgdesc='gd module for PHP'
depends=('php' 'gd')
install -D -m755 ${srcdir}/build/modules/gd.so ${pkgdir}/usr/lib/php/modules/gd.so
}
package_php-imap() {
pkgdesc='imap module for PHP'
depends=('php' 'c-client')
install -D -m755 ${srcdir}/build/modules/imap.so ${pkgdir}/usr/lib/php/modules/imap.so
}
package_php-intl() {
pkgdesc='intl module for PHP'
depends=('php' 'icu')
install -D -m755 ${srcdir}/build/modules/intl.so ${pkgdir}/usr/lib/php/modules/intl.so
}
package_php-mcrypt() {
pkgdesc='mcrypt module for PHP'
depends=('php' 'libmcrypt' 'libtool')
install -D -m755 ${srcdir}/build/modules/mcrypt.so ${pkgdir}/usr/lib/php/modules/mcrypt.so
}
package_php-odbc() {
pkgdesc='ODBC modules for PHP'
depends=('php' 'unixodbc')
install -D -m755 ${srcdir}/build/modules/odbc.so ${pkgdir}/usr/lib/php/modules/odbc.so
install -D -m755 ${srcdir}/build/modules/pdo_odbc.so ${pkgdir}/usr/lib/php/modules/pdo_odbc.so
}
package_php-pgsql() {
pkgdesc='PostgreSQL modules for PHP'
depends=('php' 'postgresql-libs')
install -D -m755 ${srcdir}/build/modules/pgsql.so ${pkgdir}/usr/lib/php/modules/pgsql.so
install -D -m755 ${srcdir}/build/modules/pdo_pgsql.so ${pkgdir}/usr/lib/php/modules/pdo_pgsql.so
}
package_php-pspell() {
pkgdesc='pspell module for PHP'
depends=('php' 'aspell')
install -D -m755 ${srcdir}/build/modules/pspell.so ${pkgdir}/usr/lib/php/modules/pspell.so
}
package_php-snmp() {
pkgdesc='snmp module for PHP'
depends=('php' 'net-snmp')
install -D -m755 ${srcdir}/build/modules/snmp.so ${pkgdir}/usr/lib/php/modules/snmp.so
}
package_php-sqlite() {
pkgdesc='sqlite module for PHP'
depends=('php' 'sqlite')
install -D -m755 ${srcdir}/build/modules/sqlite3.so ${pkgdir}/usr/lib/php/modules/sqlite3.so
install -D -m755 ${srcdir}/build/modules/pdo_sqlite.so ${pkgdir}/usr/lib/php/modules/pdo_sqlite.so
}
package_php-tidy() {
pkgdesc='tidy module for PHP'
depends=('php' 'tidy')
install -D -m755 ${srcdir}/build/modules/tidy.so ${pkgdir}/usr/lib/php/modules/tidy.so
}
package_php-xsl() {
pkgdesc='xsl module for PHP'
depends=('php' 'libxslt')
install -D -m755 ${srcdir}/build/modules/xsl.so ${pkgdir}/usr/lib/php/modules/xsl.so
}