PKGBUILDs/extra/php/PKGBUILD
2009-10-09 21:23:22 -05:00

324 lines
9.1 KiB
Bash

# $Id: PKGBUILD 53281 2009-09-27 20:04:03Z pierre $
# Maintainer: Pierre Schmitz <pierre@archlinux.de>
pkgbase=php
pkgname=('php'
'php-cgi'
'php-apache'
'php-pear'
'php-curl'
'php-enchant'
'php-gd'
'php-gmp'
'php-intl'
'php-ldap'
'php-mcrypt'
'php-odbc'
'php-pgsql'
'php-pspell'
'php-snmp'
'php-sqlite'
'php-tidy'
'php-xsl')
pkgver=5.3.0
pkgrel=5
_suhosinver=${pkgver}-0.9.8
arch=('i686' 'x86_64')
license=('PHP')
url='http://www.php.net'
makedepends=('apache' 'imap' 'postgresql-libs' 'mysql' 'libldap' 'postfix'
'sqlite3' 'unixodbc' 'net-snmp' 'libzip' 'enchant' 'file'
'libmcrypt' 'tidyhtml' 'aspell' 'libtool' 'gd' 'icu'
'curl' 'libxslt' 'openssl' 'bzip2' 'db' 'gmp')
options=('!makeflags')
source=("http://www.php.net/distributions/${pkgbase}-${pkgver}.tar.bz2"
"http://download.suhosin.org/suhosin-patch-${_suhosinver}.patch.gz"
'php.ini.patch' 'apache.conf' 'db-configure.patch' 'gd-info-segfault.patch')
md5sums=('846760cd655c98dfd86d6d97c3d964b0'
'a23a3d54e177ac0ad30f78d928ba8177'
'67c63d2c8a976a333bbd2216cdd60413'
'96ca078be6729b665be8a865535a97bf'
'45ecb6fb0aadfd3462097e3bab951aa5'
'1c1a50aae7207b12d27bdecd8967e7ce')
build() {
phpconfig="--prefix=/usr \
--sysconfdir=/etc/php \
--with-layout=GNU \
--with-config-file-path=/etc/php \
--with-config-file-scan-dir=/etc/php/conf.d \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--disable-static \
--enable-shared \
--mandir=/usr/share/man \
--without-pear \
"
phpextensions="--enable-bcmath=shared \
--enable-calendar=shared \
--enable-dba=shared \
--enable-exif=shared \
--enable-ftp=shared \
--enable-gd-native-ttf \
--enable-intl=shared \
--enable-json=shared \
--enable-mbregex \
--enable-mbstring \
--enable-pdo=shared \
--enable-phar=shared \
--enable-posix=shared \
--enable-session \
--enable-shmop=shared \
--enable-soap=shared \
--enable-sockets=shared \
--enable-sqlite-utf8 \
--enable-sysvmsg=shared \
--enable-sysvsem=shared \
--enable-sysvshm=shared \
--enable-xml \
--enable-zip=shared \
--with-bz2=shared \
--with-curl=shared \
--with-db4=shared \
--with-enchant=shared,/usr \
--with-freetype-dir=shared,/usr \
--with-gd=shared,/usr \
--with-gdbm=shared \
--with-gettext=shared \
--with-gmp=shared \
--with-iconv=shared \
--with-icu-dir=/usr \
--with-imap-ssl=shared \
--with-imap=shared \
--with-jpeg-dir=shared,/usr \
--with-ldap=shared \
--with-mcrypt=shared \
--with-mysql-sock=/tmp/mysql.sock \
--with-mysql=shared,mysqlnd \
--with-mysqli=shared,mysqlnd \
--with-openssl=shared \
--with-pcre-regex=/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-png-dir=shared,/usr \
--with-pspell=shared \
--with-regex=php \
--with-snmp=shared \
--with-sqlite3=shared,/usr \
--with-sqlite=shared \
--with-tidy=shared \
--with-unixODBC=shared,/usr \
--with-xmlrpc=shared \
--with-xsl=shared \
--with-zlib \
--without-db2 \
--without-db3 \
"
EXTENSION_DIR=/usr/lib/php/modules
export EXTENSION_DIR
PEAR_INSTALLDIR=/usr/share/pear
export PEAR_INSTALLDIR
cd ${srcdir}/${pkgbase}-${pkgver}
# avoid linking against old db version
patch -p0 -i ${srcdir}/db-configure.patch || return 1
# apply suhosin patch
patch -p1 -i ${srcdir}/suhosin-patch-${_suhosinver}.patch || return 1
# adjust paths
patch -p0 -i ${srcdir}/php.ini.patch || return 1
# fix gd segfault; http://bugs.php.net/bug.php?id=49193
patch -p0 -i ${srcdir}/gd-info-segfault.patch || return 1
# php
mkdir ${srcdir}/build-php
cd ${srcdir}/build-php
ln -s ../${pkgbase}-${pkgver}/configure
./configure --srcdir=../${pkgbase}-${pkgver} \
${phpconfig} \
--disable-cgi \
--with-readline \
--enable-pcntl \
${phpextensions} || return 1
make || return 1
# cgi and fcgi
# reuse the previous run; this will save us a lot of time
cp -a ${srcdir}/build-php ${srcdir}/build-cgi
cd ${srcdir}/build-cgi
./configure --srcdir=../${pkgbase}-${pkgver} \
${phpconfig} \
--enable-cgi \
--disable-cli \
${phpextensions} || return 1
make || return 1
# apache
cp -a ${srcdir}/build-php ${srcdir}/build-apache
cd ${srcdir}/build-apache
./configure --srcdir=../${pkgbase}-${pkgver} \
${phpconfig} \
--with-apxs2 \
--disable-cli \
${phpextensions} || return 1
make || return 1
# pear
cp -a ${srcdir}/build-php ${srcdir}/build-pear
cd ${srcdir}/build-pear
./configure --srcdir=../${pkgbase}-${pkgver} \
${phpconfig} \
--disable-cgi \
--with-readline \
--enable-pcntl \
--with-pear \
${phpextensions} || return 1
make || return 1
}
package_php() {
pkgdesc='An HTML-embedded scripting language'
depends=('pcre' 'libxml2' 'bzip2' 'openssl')
replaces=('php-fileinfo')
provides=('php-fileinfo')
conflicts=('php-fileinfo')
backup=('etc/php/php.ini')
cd ${srcdir}/build-php
make INSTALL_ROOT=${pkgdir} install || return 1
install -d -m755 ${pkgdir}/usr/share/pear
# fix broken link
ln -sf phar.phar $pkgdir/usr/bin/phar
# install php.ini
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/{curl,enchant,gd,gmp,intl,ldap,mcrypt,odbc,pdo_odbc,pgsql,pdo_pgsql,pspell,snmp,sqlite3,pdo_sqlite,tidy,xsl}.so
}
package_php-cgi() {
pkgdesc='CGI and FCGI SAPI for PHP'
depends=('php' 'pcre' 'libxml2')
install -D -m755 ${srcdir}/build-cgi/sapi/cgi/php-cgi ${pkgdir}/usr/bin/php-cgi
}
package_php-apache() {
pkgdesc='Apache SAPI for PHP'
depends=('php' 'apache' 'pcre' 'libxml2')
backup=('etc/httpd/conf/extra/php5_module.conf')
install -D -m755 ${srcdir}/build-apache/libs/libphp5.so ${pkgdir}/usr/lib/httpd/modules/libphp5.so
install -D -m644 ${srcdir}/apache.conf ${pkgdir}/etc/httpd/conf/extra/php5_module.conf
}
package_php-pear() {
pkgdesc='PHP Extension and Application Repository'
depends=('php' 'bash')
backup=("etc/php/pear.conf")
cd ${srcdir}/build-pear
make install-pear INSTALL_ROOT=${pkgdir}
for i in $(find ${pkgdir}/ -name '.*'); do
[ -e $i ] && rm -rf $i
done
}
package_php-curl() {
depends=('php' 'curl')
pkgdesc="curl module for PHP"
install -D -m755 ${srcdir}/build-php/modules/curl.so ${pkgdir}/usr/lib/php/modules/curl.so
}
package_php-enchant() {
depends=('php' 'enchant')
pkgdesc="enchant module for PHP"
install -D -m755 ${srcdir}/build-php/modules/enchant.so ${pkgdir}/usr/lib/php/modules/enchant.so
}
package_php-gd() {
depends=('php' 'gd')
pkgdesc="gd module for PHP"
install -D -m755 ${srcdir}/build-php/modules/gd.so ${pkgdir}/usr/lib/php/modules/gd.so
}
package_php-gmp() {
depends=('php' 'gmp')
pkgdesc="gmp module for PHP"
install -D -m755 ${srcdir}/build-php/modules/gmp.so ${pkgdir}/usr/lib/php/modules/gmp.so
}
package_php-intl() {
depends=('php' 'icu')
pkgdesc="intl module for PHP"
install -D -m755 ${srcdir}/build-php/modules/intl.so ${pkgdir}/usr/lib/php/modules/intl.so
}
package_php-ldap() {
depends=('php' 'libldap')
pkgdesc="ldap module for PHP"
install -D -m755 ${srcdir}/build-php/modules/ldap.so ${pkgdir}/usr/lib/php/modules/ldap.so
}
package_php-mcrypt() {
depends=('php' 'libmcrypt' 'libtool')
pkgdesc="mcrypt module for PHP"
install -D -m755 ${srcdir}/build-php/modules/mcrypt.so ${pkgdir}/usr/lib/php/modules/mcrypt.so
}
package_php-odbc() {
depends=('php' 'unixodbc')
pkgdesc="ODBC modules for PHP"
install -D -m755 ${srcdir}/build-php/modules/odbc.so ${pkgdir}/usr/lib/php/modules/odbc.so
install -D -m755 ${srcdir}/build-php/modules/pdo_odbc.so ${pkgdir}/usr/lib/php/modules/pdo_odbc.so
}
package_php-pgsql() {
depends=('php' 'postgresql-libs')
pkgdesc="PostgreSQL modules for PHP"
install -D -m755 ${srcdir}/build-php/modules/pgsql.so ${pkgdir}/usr/lib/php/modules/pgsql.so
install -D -m755 ${srcdir}/build-php/modules/pdo_pgsql.so ${pkgdir}/usr/lib/php/modules/pdo_pgsql.so
}
package_php-pspell() {
depends=('php' 'aspell')
pkgdesc="pspell module for PHP"
install -D -m755 ${srcdir}/build-php/modules/pspell.so ${pkgdir}/usr/lib/php/modules/pspell.so
}
package_php-snmp() {
depends=('php' 'net-snmp')
pkgdesc="snmp module for PHP"
install -D -m755 ${srcdir}/build-php/modules/snmp.so ${pkgdir}/usr/lib/php/modules/snmp.so
}
package_php-sqlite() {
depends=('php' 'sqlite3')
pkgdesc="sqlite3 module for PHP"
install -D -m755 ${srcdir}/build-php/modules/sqlite3.so ${pkgdir}/usr/lib/php/modules/sqlite3.so
install -D -m755 ${srcdir}/build-php/modules/pdo_sqlite.so ${pkgdir}/usr/lib/php/modules/pdo_sqlite.so
}
package_php-tidy() {
depends=('php' 'tidyhtml')
pkgdesc="tidy module for PHP"
install -D -m755 ${srcdir}/build-php/modules/tidy.so ${pkgdir}/usr/lib/php/modules/tidy.so
}
package_php-xsl() {
depends=('php' 'libxslt')
pkgdesc="xsl module for PHP"
install -D -m755 ${srcdir}/build-php/modules/xsl.so ${pkgdir}/usr/lib/php/modules/xsl.so
}