# $Id$ PNAME="php5" PVER="5.3.2" PBUILD="r2" PCATEGORIE="dev-lang" STATE="unstable" #DESCRIPTION="PHP Hypertext Preprocessor, a scripting language especially suited for web development." HOMEPAGE="http://php.net/" # ToDO: mcrypt, imap, mhash, maintainer-zts, intl SDEPEND=">= net-www/apache2-2.2.14 >= sys-libs/ncurses-5.7 >= sys-libs/readline-6.0 >= sys-libs/zlib-1.2 >= app-arch/bzip2-1 >= dev-libs/libxml2-2.7 >= dev-libs/libxslt-1.1.26 >= dev-libs/openssl-0.9.8 >= dev-libs/libpcre-8.0 >= dev-libs/gmp-4.3 >= media-libs/libjpeg-7 >= media-libs/libpng-1.2.40 >= x11-libs/libXpm-3.5 >= media-libs/gd-2.0.35 >= media-libs/freetype-2.3 >= media-libs/t1lib-5.1 >= net-misc/curl-7.19 >= app-text/aspell-0.60 >= app-text/enchant-1.5 >= app-text/htmltidy-1.46 >= dev-db/db-4.8 >= dev-db/sqlite-3.6 >= dev-db/mysql5-5.1 >= dev-db/unixodbc-2.2 >= net-dns/libidn-1.15 >= dev-libs/cyrus-sasl-2.1.23 >= net-nds/openldap-2.4 >= sys-dev/m4-1.4 >= sys-dev/libtool-1.5 >= sys-dev/gettext-0.17 >= sys-apps/sed-4" SRCFILE="${PNAME/5/}-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/${PNAME/5/}-${PVER}" SUHOSIN_PVER="0.9.9.1" PHP5_EXTENSIONS_DIR="/usr/$(mlibdir)/${PNAME}/extensions" PHP5_PEAR_INSTALLDIR="/usr/share/${PNAME}/pear" SPLIT_PACKAGES="${PNAME} ${PNAME}-cgi ${PNAME}-apache ${PNAME}-embedded ${PNAME}-pear ${PNAME}-bcmath ${PNAME}-curl ${PNAME}-dba ${PNAME}-enchant ${PNAME}-gd ${PNAME}-gmp ${PNAME}-ldap ${PNAME}-mbstring ${PNAME}-pdo ${PNAME}-mysql ${PNAME}-odbc ${PNAME}-process ${PNAME}-pspell ${PNAME}-soap ${PNAME}-sqlite ${PNAME}-tidy ${PNAME}-xml ${PNAME}-xmlrpc" # splits with more then one module: # ${PNAME}-odbc = odbc, pdo_odbc # ${PNAME}-mysql = mysql, mysqli, pdo_mysql # ${PNAME}-xml = xsl, wddx, dom, xmlreader, xmlwriter # ${PNAME}-process = sysvmsg, sysvsem, sysvshm, posix # ${PNAME}-sqlite = sqlite, sqlite3, pdo_sqlite sminclude mtools SRC_URI=( http://de2.php.net/distributions/${SRCFILE} http://us2.php.net/distributions/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/${PNAME}-5.2.4-multilib.patch mirror://${PNAME}/${PNAME}-5.2.3-httpd-config.patch mirror://${PNAME}/${PNAME}-5.2.4-build-dir.patch mirror://${PNAME}/${PNAME}-${PVER}-suhosin-${SUHOSIN_PVER}.patch mirror://${PNAME}/${PNAME}-${PVER}-phar.patch mirror://${PNAME}/php5_module.conf ) # 5.3 stable series UP2TAG="5.3" UP2DATE="updatecmd ${HOMEPAGE} | grep 'Current.*${UP2TAG}.*Stable' | sed 's/.*\:\ \(.*\)/\1/'" # install-helper function install_php5_extensions() { local extensions="$@" [[ -z ${extensions} ]] && die "no extensions given" # set default PHP5_BUILD_DIR, env can override this : ${PHP5_BUILD_DIR="${BUILDDIR}/build-php"} cd ${PHP5_BUILD_DIR} # needed directories minstalldir /etc/php5/conf.d || die minstalldir ${PHP5_EXTENSIONS_DIR} || die local ext for ext in ${extensions} do # install extensions and the config ini minstallexec modules/${ext}.so ${PHP5_EXTENSIONS_DIR} || die "mod ${ext}" echo "extension=${ext}.so" > ${BINDIR}/etc/php5/conf.d/${ext}.ini || die "ini ${ext}" done } split_info_php5() { DESCRIPTION="PHP Hypertext Preprocessor, a scripting language especially suited for web development." DEPEND=">= sys-libs/ncurses-5.7 >= sys-libs/readline-6.0 >= sys-libs/zlib-1.2 >= app-arch/bzip2-1 >= dev-libs/libxml2-2.7 >= dev-libs/openssl-0.9.8 >= dev-libs/libpcre-8.0" } split_info_php5-cgi() { DESCRIPTION="GI and FCGI SAPI for PHP." DEPEND="== dev-lang/php5-${PVER} >= dev-libs/libxml2-2.7 >= dev-libs/libpcre-8" } split_info_php5-apache() { DESCRIPTION="Apache SAPI for PHP." DEPEND="== dev-lang/php5-${PVER} >= dev-libs/libxml2-2.7 >= dev-libs/libpcre-8 >= net-www/apache2-2.2" } split_info_php5-embedded() { DESCRIPTION="PHP library for embedding in applications." DEPEND="== dev-lang/php5-${PVER} >= dev-libs/libxml2-2.7 >= dev-libs/libpcre-8" } split_info_php5-pear() { DESCRIPTION="PHP Extension and Application Repository." DEPEND="== dev-lang/php5-${PVER}" } split_info_php5-bcmath() { DESCRIPTION="A module for PHP applications for using the bcmath library." DEPEND="== dev-lang/php5-${PVER}" } split_info_php5-curl() { DESCRIPTION="A module for PHP applications that use curl." DEPEND="== dev-lang/php5-${PVER} >= net-dns/libidn-1.15 >= net-misc/curl-7 >= net-nds/openldap-2.4" } split_info_php5-dba() { DESCRIPTION="A database abstraction layer module for PHP applications." DEPEND="== dev-lang/php5-${PVER}" } split_info_php5-enchant() { DESCRIPTION="Human Language and Character Encoding Support." DEPEND="== dev-lang/php5-${PVER} >= app-text/enchant-1.5" } split_info_php5-gd() { DESCRIPTION="A module for PHP applications for using the gd graphics library." DEPEND="== dev-lang/php5-${PVER} >= media-libs/libjpeg-7 >= media-libs/libpng-1.2.40 >= x11-libs/libXpm-3.5 >= media-libs/freetype-2.3 >= media-libs/t1lib-5.1 >= media-libs/gd-2.0.35" } split_info_php5-gmp() { DESCRIPTION="A module for PHP applications for using the gmp library." DEPEND="== dev-lang/php5-${PVER} >= dev-libs/gmp-4.3" } split_info_php5-ldap() { DESCRIPTION="A module for PHP applications that use LDAP." DEPEND="== dev-lang/php5-${PVER} >= dev-libs/cyrus-sasl-2.1.23 >= net-nds/openldap-2.4" } split_info_php5-mbstring() { DESCRIPTION="A module for PHP applications which need multi-byte string handling." DEPEND="== dev-lang/php5-${PVER}" } split_info_php5-mysql() { DESCRIPTION="Modules for PHP applications that use MySQL databases." DEPEND="== dev-lang/php5-${PVER} == dev-lang/php5-pdo-${PVER} >= dev-db/mysql5-5.1" } split_info_php5-odbc() { DESCRIPTION="Modules for PHP applications that use ODBC databases." DEPEND="== dev-lang/php5-${PVER} == dev-lang/php5-pdo-${PVER} >= dev-db/unixodbc-2.2" } split_info_php5-pdo() { DESCRIPTION="A database access abstraction module for PHP applications." DEPEND="== dev-lang/php5-${PVER}" } split_info_php5-process() { DESCRIPTION="Modules for PHP script using system process interfaces." DEPEND="== dev-lang/php5-${PVER}" } split_info_php5-pspell() { DESCRIPTION="A module for PHP applications for using pspell interfaces." DEPEND="== dev-lang/php5-${PVER} >= app-text/aspell-0.60" } split_info_php5-soap() { DESCRIPTION="A module for PHP applications that use the SOAP protocol." DEPEND="== dev-lang/php5-${PVER} >= dev-libs/libxml2-2.7" } split_info_php5-sqlite() { DESCRIPTION="Modules for PHP applications that use SQLite databases." DEPEND="== dev-lang/php5-${PVER} == dev-lang/php5-pdo-${PVER} >= dev-db/sqlite-3.6" } split_info_php5-tidy() { DESCRIPTION="Standard PHP module provides tidy library support." DEPEND="== dev-lang/php5-${PVER} >= app-text/htmltidy-1.46" } split_info_php5-xml() { DESCRIPTION="Modules for PHP applications which use XML." DEPEND="== dev-lang/php5-${PVER} >= dev-libs/libxml2-2.7 >= dev-libs/libxslt-1.1.26" } split_info_php5-xmlrpc() { DESCRIPTION="A module for PHP applications which use the XML-RPC protocol." DEPEND="== dev-lang/php5-${PVER} >= dev-libs/libxml2-2.7" } src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # version branding sed -i "s:^\(EXTRA_VERSION=\).*:\1-magellan-${PBUILD}:" configure.in || die # fixes multilib search pathes mpatch ${PNAME}-5.2.4-multilib.patch || die # do not touch the system httpd.conf mpatch ${PNAME}-5.2.3-httpd-config.patch || die # fixes build dir -> /usr/lib/php5/build mpatch ${PNAME}-5.2.4-build-dir.patch || die # hardend php core patch # see: http://www.hardened-php.net/suhosin/index.html mpatch ${PNAME}-${PVER}-suhosin-${SUHOSIN_PVER}.patch || die # fix phar install issues, see http://bugs.php.net/50578 mpatch ${PNAME}-${PVER}-phar.patch || die # fully regenerate aclocal too rm aclocal.m4 || die # rebuild configure autoreconf --force --install --verbose || die # force use of system libtool mlibtoolize || die } src_compile() { local php_base_config local php_extensions local current_run # --with-libdir needed, doesn't honor --libdir php_base_config="--with-libdir=$(mlibdir) \ --with-config-file-path=/etc/php5 \ --with-config-file-scan-dir=/etc/php5/conf.d \ --enable-inline-optimization \ --enable-discard-path \ --disable-debug \ --disable-static \ --enable-shared \ --without-pear" php_extensions="--with-zlib \ --with-bz2=shared \ --enable-bcmath=shared \ --enable-calendar=shared \ --enable-exif=shared \ --enable-ftp=shared \ --with-gettext=shared \ --enable-mbstring=shared \ --enable-mbregex \ --with-ncurses=shared \ --with-openssl=shared \ --with-gd=shared,/usr \ --enable-gd-native-ttf \ --with-freetype-dir=shared,/usr \ --with-ttf \ --with-t1lib=/usr \ --with-pcre-regex \ --with-gmp=shared \ --with-curl=shared \ --with-curlwrappers \ --enable-dba=shared \ --with-db4=shared \ --with-mysql=shared \ --with-mysqli=shared \ --with-unixODBC=shared,/usr \ --with-sqlite=shared \ --with-sqlite3=shared \ --enable-pdo=shared \ --with-pdo-odbc=shared,unixODBC,/usr \ --with-pdo-mysql=shared,/usr \ --with-pdo-sqlite=shared,/usr \ --enable-dbase=shared \ --enable-dom=shared \ --with-xmlrpc=shared \ --enable-xmlreader=shared \ --enable-xmlwriter=shared \ --with-xsl=shared,/usr \ --enable-wddx=shared \ --enable-soap=shared \ --enable-json=shared \ --enable-zip=shared \ --enable-phar=shared \ --enable-posix=shared \ --enable-fileinfo=shared \ --enable-sockets=shared \ --enable-sysvsem=shared \ --enable-sysvshm=shared \ --enable-sysvmsg=shared \ --with-tidy=shared \ --with-ldap=shared \ --with-ldap-sasl \ --with-enchant=shared \ --with-pspell=shared" # ToDo: # --with-mcrypt=shared \ # --with-mhash=shared \ # --with-imap=shared \ # --with-imap-ssl \ # --enable-maintainer-zts <- threaded apache2 support # # build php: # # prepare build outside of the SRCDIR install -d ${BUILDDIR}/build-php cd ${BUILDDIR}/build-php ln -snf ${SRCDIR}/configure mconfigure \ --srcdir=${SRCDIR} \ ${php_base_config} \ --disable-cgi \ --with-readline \ ${php_extensions} \ || die mmake || die # # build cgi/fastcgi # # prepare build with the previous run, to save a lot of time current_run=cgi cp -a ${BUILDDIR}/build-php ${BUILDDIR}/build-${current_run} cd ${BUILDDIR}/build-${current_run} mconfigure \ --srcdir=${SRCDIR} \ ${php_base_config} \ --enable-cgi \ --enable-force-cgi-redirect \ --enable-fastcgi \ --disable-cli \ ${php_extensions} \ || die mmake || die # # build apache mod # # prepare build with the previous run, to save a lot of time current_run=apache cp -a ${BUILDDIR}/build-php ${BUILDDIR}/build-${current_run} cd ${BUILDDIR}/build-${current_run} mconfigure \ --srcdir=${SRCDIR} \ ${php_base_config} \ --with-apxs2 \ --disable-cli \ ${php_extensions} \ || die mmake || die # # build embedded # # prepare build with the previous run, to save a lot of time current_run=embedded cp -a ${BUILDDIR}/build-php ${BUILDDIR}/build-${current_run} cd ${BUILDDIR}/build-${current_run} mconfigure \ --srcdir=${SRCDIR} \ ${php_base_config} \ --enable-embed=shared \ --disable-cli \ ${php_extensions} \ || die mmake || die # # build pear # # prepare build with the previous run, to save a lot of time current_run=pear cp -a ${BUILDDIR}/build-php ${BUILDDIR}/build-${current_run} cd ${BUILDDIR}/build-${current_run} mconfigure \ --srcdir=${SRCDIR} \ ${php_base_config} \ --disable-cgi \ --with-readline \ --enable-pcntl \ --with-pear \ ${php_extensions} \ || die mmake || die } src_install_php5() { cd ${BUILDDIR}/build-php mmake -j1 INSTALL_ROOT=${BINDIR} EXTENSION_DIR=${PHP5_EXTENSIONS_DIR} PEAR_INSTALLDIR=${PHP5_PEAR_INSTALLDIR} install || die # fix a broken symlink mlink phar.phar /usr/bin/phar || die local php_ini=${SRCDIR}/php.ini-production # php config minstalldir /etc/php5/conf.d || die # fix extensions dir location sed -i "s:^\(extension_dir =\).*:\1 ${PHP5_EXTENSIONS_DIR}:" ${php_ini} || die # allow short php open-tags sed -i "s:^\(short_open_tag =\).*:\1 On:" ${php_ini} || die minstallfile ${php_ini} /etc/php5/php.ini || die # fix extension_dir also in phmp-config sed -i "s:^\(extension_dir=\).*:\1${PHP5_EXTENSIONS_DIR}:" ${BINDIR}/usr/bin/php-config || die # remove all extensions provided by other split-packages local ext for ext in curl bcmath dba enchant gd gmp ldap mbstring mysql mysqli \ pdo_mysql odbc pdo_odbc pdo pspell sqlite sqlite3 pdo_sqlite \ soap sysvmsg sysvsem sysvshm posix tidy xsl wddx dom xmlreader \ xmlwriter xmlrpc do rm ${BINDIR}/${PHP5_EXTENSIONS_DIR}/${ext}.so || die ${ext} done # enable all default extensions local i for i in $(ls ${BINDIR}/${PHP5_EXTENSIONS_DIR}/*.so | sort ) do echo "extension=$(basename ${i})" \ > ${BINDIR}/etc/php5/conf.d/$(basename ${i} .so).ini || die done # disable config-protoct for modules conf dir echo 'CONFIG_PROTECT_MASK="/etc/php5/conf.d"' > ${BINDIR}/etc/conf.d/30php5 || die minstalldocs CREDITS CODING_STANDARDS EXTENSIONS LICENSE NEWS README* TODO* || die } src_install_php5-cgi() { cd ${BUILDDIR}/build-cgi minstallexec sapi/cgi/php-cgi || die } src_install_php5-apache() { cd ${BUILDDIR}/build-apache # install apache sapi local APACHE_MOD_DIR="$(apxs -q LIBEXECDIR)" minstalldir ${APACHE_MOD_DIR} || die minstallexec libs/libphp5.so ${APACHE_MOD_DIR} || die # install apache module config local APACHE_SYSCONFDIR="$(apxs -q SYSCONFDIR)" minstalldir ${APACHE_SYSCONFDIR}/modules.d || die minstallfile -s php5_module.conf ${APACHE_SYSCONFDIR}/modules.d/php5.conf || die } src_install_php5-embedded() { cd ${BUILDDIR}/build-embedded # install sapi library minstalldir /usr/$(mlibdir) || die minstallexec libs/libphp5.so /usr/$(mlibdir)/libphp5.so || die # install include minstalldir /usr/include/${PNAME}/sapi/embed || die minstallfile ${SRCDIR}/sapi/embed/php_embed.h /usr/include/${PNAME}/sapi/embed || die } src_install_php5-pear() { cd ${BUILDDIR}/build-pear mmake INSTALL_ROOT=${BINDIR} EXTENSION_DIR=${PHP5_EXTENSIONS_DIR} PEAR_INSTALLDIR=${PHP5_PEAR_INSTALLDIR} install-pear || die local i for i in $(find ${BINDIR}/ -name '.*') do if [[ -e ${i} ]] then rm -rf ${i} || die ${i} fi done } # being a little tricky here: for subpackage in ${SPLIT_PACKAGES} do # exclude all other packages than php5-addon-modules case ${subpackage} in php5) continue ;; php5-cgi) continue ;; php5-apache) continue ;; php5-embedded) continue ;; php5-pear) continue ;; esac eval "src_install_${subpackage}(){ install_php5_extensions ${subpackage#*-} || die; }" done # exceptions src_install_php5-mysql() { install_php5_extensions mysql mysqli pdo_mysql || die } src_install_php5-odbc() { install_php5_extensions odbc pdo_odbc || die } src_install_php5-process() { install_php5_extensions sysvmsg sysvsem sysvshm posix || die } src_install_php5-sqlite() { install_php5_extensions sqlite sqlite3 pdo_sqlite || die } src_install_php5-xml() { install_php5_extensions dom wddx xmlreader xmlwriter xsl || die }