diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2003-10-26 03:32:01 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2003-10-26 03:32:01 +0000 |
commit | a901062875579fd0ab392f28f589754b3cf23028 (patch) | |
tree | 57f18a2016c58c323e86f435d42301651a9f8e80 | |
parent | Initial commit, inspired by Seth Chandler <sethbc@wpi.edu> on bug #12043 and ... (diff) | |
download | historical-a901062875579fd0ab392f28f589754b3cf23028.tar.gz historical-a901062875579fd0ab392f28f589754b3cf23028.tar.bz2 historical-a901062875579fd0ab392f28f589754b3cf23028.zip |
major fixes to php.eclass, fixes lots of bugs, updates freetype behaviour
-rw-r--r-- | eclass/php.eclass | 278 |
1 files changed, 123 insertions, 155 deletions
diff --git a/eclass/php.eclass b/eclass/php.eclass index c3343d9c8664..2702fd45fb16 100644 --- a/eclass/php.eclass +++ b/eclass/php.eclass @@ -1,7 +1,7 @@ # Copyright 2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # Author: Robin H. Johnson <robbat2@gentoo.org> -# $Header: /var/cvsroot/gentoo-x86/eclass/php.eclass,v 1.82 2003/10/19 11:50:36 lanius Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/php.eclass,v 1.83 2003/10/26 03:32:01 robbat2 Exp $ # This EBUILD is totally masked presently. Use it at your own risk. I know it # is severely broken, but I needed to get a copy into CVS to pass around and @@ -27,17 +27,19 @@ if [ -z "${MY_PV}" ]; then MY_PV=${PV/_rc/RC} # maybe do stuff for beta/alpha/pre here too? fi + +# our major ver number +PHPMAJORVER=${MY_PV//\.*} + [ -z "${MY_P}" ] && MY_P=${MY_PN}-${MY_PV} [ -z "${MY_PF}" ] && MY_PF=${MY_P}-${PR} -[ -z "${HOMEPAGE}" ] && HOMEPAGE="http://www.php.net/" +[ -z "${HOMEPAGE}" ] && HOMEPAGE="http://www.php.net/" [ -z "${LICENSE}" ] && LICENSE="PHP" [ -z "${PROVIDE}" ] && PROVIDE="virtual/php" # PHP.net does automatic mirroring from this URI [ -z "${SRC_URI_BASE}" ] && SRC_URI_BASE="http://www.php.net/distributions" if [ -z "${SRC_URI}" ]; then SRC_URI="${SRC_URI_BASE}/${MY_P}.tar.bz2" - #Remove the DB4 stuff temporarily - #mirror://gentoo/${MY_P}-db4.diff.gz fi # A patch for PHP for security SRC_URI="${SRC_URI} mirror://gentoo/php-4.3.2-fopen-url-secure.patch" @@ -57,57 +59,53 @@ RDEPEND="${RDEPEND} berkdb? ( =sys-libs/db-1.* ) )" -# Everything is in this list is dynamically linked agaist or needed at runtime in some other way +# Everything is in this list is dynamically linked agaist or needed at runtime +# in some other way RDEPEND=" - >=sys-libs/cracklib-2.7-r7 - sys-apps/bzip2 - X? ( virtual/x11 ) - crypt? ( >=dev-libs/libmcrypt-2.4 >=app-crypt/mhash-0.8 ) - curl? ( >=net-ftp/curl-7.10.2 ) - firebird? ( >=dev-db/firebird-1.0 ) - freetds? ( >=dev-db/freetds-0.53 ) - gd-external? ( media-libs/libgd >=media-libs/jpeg-6b >=media-libs/libpng-1.2.5 ) - gd? ( >=media-libs/jpeg-6b >=media-libs/libpng-1.2.5 ) - gdbm? ( >=sys-libs/gdbm-1.8.0 ) - java? ( =virtual/jdk-1.4* dev-java/java-config ) - jpeg? ( >=media-libs/jpeg-6b ) - ldap? ( >=net-nds/openldap-1.2.11 ) - mysql? ( >=dev-db/mysql-3.23.26 ) - nls? ( sys-devel/gettext ) - odbc? ( >=dev-db/unixODBC-1.8.13 ) - pam? ( >=sys-libs/pam-0.75 ) - pdflib? ( >=media-libs/pdflib-4.0.3 >=media-libs/jpeg-6b >=media-libs/libpng-1.2.5 >=media-libs/tiff-3.5.5 ) - png? ( >=media-libs/libpng-1.2.5 ) - postgres? ( >=dev-db/postgresql-7.1 ) - qt? ( >=x11-libs/qt-2.3.0 ) - snmp? ( net-analyzer/net-snmp ) - spell? ( app-text/aspell ) - ssl? ( >=dev-libs/openssl-0.9.5 ) - tiff? ( >=media-libs/tiff-3.5.5 ) - xml2? ( dev-libs/libxml2 >=dev-libs/libxslt-1.0.30 ) - >=net-libs/libwww-5.3.2 - >=app-text/sablotron-0.97 - dev-libs/expat - sys-libs/zlib - virtual/mta" + >=sys-libs/cracklib-2.7-r7 + sys-apps/bzip2 + X? ( virtual/x11 ) + crypt? ( >=dev-libs/libmcrypt-2.4 >=app-crypt/mhash-0.8 ) + curl? ( >=net-ftp/curl-7.10.2 ) + firebird? ( >=dev-db/firebird-1.0 ) + freetds? ( >=dev-db/freetds-0.53 ) + gd-external? ( media-libs/libgd >=media-libs/jpeg-6b + >=media-libs/libpng-1.2.5 ) + gd? ( >=media-libs/jpeg-6b >=media-libs/libpng-1.2.5 ) + gdbm? ( >=sys-libs/gdbm-1.8.0 ) + java? ( =virtual/jdk-1.4* dev-java/java-config ) + jpeg? ( >=media-libs/jpeg-6b ) + ldap? ( >=net-nds/openldap-1.2.11 ) + mysql? ( >=dev-db/mysql-3.23.26 ) + nls? ( sys-devel/gettext ) + odbc? ( >=dev-db/unixODBC-1.8.13 ) + pam? ( >=sys-libs/pam-0.75 ) + pdflib? ( >=media-libs/pdflib-4.0.3 >=media-libs/jpeg-6b + >=media-libs/libpng-1.2.5 >=media-libs/tiff-3.5.5 ) + png? ( >=media-libs/libpng-1.2.5 ) + postgres? ( >=dev-db/postgresql-7.1 ) + qt? ( >=x11-libs/qt-2.3.0 ) + snmp? ( net-analyzer/net-snmp ) + spell? ( app-text/aspell ) + ssl? ( >=dev-libs/openssl-0.9.5 ) + tiff? ( >=media-libs/tiff-3.5.5 ) + xml2? ( dev-libs/libxml2 >=dev-libs/libxslt-1.0.30 ) + truetype? ( =media-libs/freetype-2* =media-libs/freetype-1* + media-libs/t1lib ) + >=net-libs/libwww-5.3.2 + >=app-text/sablotron-0.97 + dev-libs/expat + sys-libs/zlib + virtual/mta" # libswf is ONLY available on x86 -RDEPEND="${RDEPEND} - flash? ( x86? ( media-libs/libswf ) >=media-libs/ming-0.2a )" +RDEPEND="${RDEPEND} flash? ( + x86? ( media-libs/libswf ) + >=media-libs/ming-0.2a )" #The new XML extension in PHP5 requires libxml2-2.5.10 -if [ "${PV:0:1}" = "5" ]; then - RDEPEND="${RDEPEND} - >=dev-libs/libxml2-2.5.10" -fi - - # Testing per bug #13382 -if runningunstable; then - RDEPEND="${RDEPEND} - truetype? ( >=media-libs/freetype-2 )" -else - RDEPEND="${RDEPEND} - truetype? ( ~media-libs/freetype-1.3.1 >=media-libs/t1lib-1.3.1 )" +if [ "${PHPMAJORVER}" -ge 5 ]; then + RDEPEND="${RDEPEND} >=dev-libs/libxml2-2.5.10" fi # These are extra bits we need only at compile time @@ -119,49 +117,19 @@ DEPEND="${DEPEND} !dev-libs/9libs" #dev-libs/libiconv causes a compile failure DEPEND="${DEPEND} !dev-libs/libiconv" - #Waiting for somebody to want this: #cyrus? ( net-mail/cyrus-imapd net-mail/cyrus-imap-admin dev-libs/cyrus-imap-dev ) #export this here so we can use it myconf="${myconf}" -## PHP offers a wide range of Server APIs (SAPIs) -#[ -z "${PHP_SAPI}" ] && die "Your ebuild must specify a PHP SAPI to build with!" -#local php_sapi_supported -#php_sapi_supported=0 -#case ${PHP_SAPI} in -#cgi) php_sapi_supported=1 ; PHP_CGI=1 ;; -#cli) php_sapi_supported=1 ; PHP_CLI=1 ;; -#apxs) php_sapi_supported=1 ;; -#apxs2) php_sapi_supported=1 ;; -#apache) ;; -#aolserver) ;; -#mod_charset) ;; -#caudium) ;; -#isapi) ;; -#nsapi) ;; -#phttpd) ;; -#pi3web) ;; -#roxen) ;; -#servlet) ;; -#thttpd) ;; -#tux) ;; -#esac -# -## be nice to other developers ;-) -#if [ "${php_sapi_supported}" -ne "1" ]; then -# ewarn "Your SAPI choice is NOT offically supported in php.eclass yet." -# ewarn "Please contact php-bugs for any issues." -#fi - -# These are the standard targets that we want to for the install stage since we can't do the full 'make install' -# You may need to add your own items here for SAPIs etc. +# These are the standard targets that we want to for the install stage since we +# can't do the full 'make install' You may need to add your own items here for +# SAPIs etc. PHP_INSTALLTARGETS="${PHP_INSTALLTARGETS} install-modules install-pear install-build install-headers install-programs" -#overall recommended order -#install-cli install-sapi install-modules install-pear install-build install-headers install-programs - -PHPMAJORVER=${MY_PV//\.*} +#overall recommended order: +#install-cli install-sapi install-modules install-pear install-build +#install-headers install-programs # These are quick fixups for older ebuilds that didn't have PHPSAPI defined. [ -z "${PHPSAPI}" ] && [ "${PN}" = "php" ] && PHPSAPI="cli" @@ -175,6 +143,7 @@ if [ -z "${PHPSAPI}" ]; then eerror "${msg}" die "${msg}" fi +# build the destination and php.ini details PHPINIDIRECTORY="/etc/php/${PHPSAPI}-php${PHPMAJORVER}" PHPINIFILENAME="php.ini" @@ -214,44 +183,26 @@ php_src_unpack() { unpack ${MY_P}.tar.bz2 cd ${S} - # Configure Patch for wired uname -a - mv configure configure.old - cat configure.old | sed "s/PHP_UNAME=\`uname -a\`/PHP_UNAME=\`uname -s -n -r -v\`/g" > configure + # Configure Patch for hard-wired uname -a + sed "s/PHP_UNAME=\`uname -a\`/PHP_UNAME=\`uname -s -n -r -v\`/g" -i configure + # ensure correct perms on configure chmod 755 configure - # fix PEAR installer + # fix PEAR installer for our packaging + # we keep a backup of it as we need it at the end of the install cp pear/PEAR/Registry.php pear/PEAR/Registry.old - sed "s:\$pear_install_dir\.:\'$D/usr/lib/php/\' . :g" pear/PEAR/Registry.old > pear/PEAR/Registry.php + sed -e "s:\$pear_install_dir\.:\'${D}/usr/lib/php/\' . :g" -i pear/PEAR/Registry.old } php_src_compile() { - # Stuart, test this (just uncomment it): - # use ldap && use kerberos && LIBS="${LIBS} -lkrb4" - - # Control the extra SAPI stuff that can be built in addition to any usual SAPI -# [ -z "${PHP_CGI}" ] && PHP_CGI=0 -# [ -z "${PHP_CLI}" ] && PHP_CLI=0 -# [ -z "${PHP_EMBED}" ] && PHP_EMBED=no -# [ "${PHP_CGI}" -eq "0" ] \ -# && myconf="${myconf} --disable-cgi" \ -# || myconf="${myconf} --enable-cgi --enable-fastcgi" -# [ "${PHP_CLI}" -eq "0" ] \ -# && myconf="${myconf} --disable-cli" \ -# || myconf="${myconf} --enable-cli" -# case "${PHP_EMBED}" in -# shared) myconf="${myconf} --enable-embed=shared" ;; -# static) myconf="${myconf} --enable-embed=static" ;; -# *) myconf="${myconf} --disable-embed" ;; -# esac; - [ -x "/usr/sbin/sendmail" ] || die "You need a virtual/mta that provides /usr/sbin/sendmail!" use java && php_check_java_config if use berkdb; then einfo "Enabling NBDM" - myconf="${myconf} --with-ndbm" + myconf="${myconf} --with-ndbm=/usr" #Hack to use db4 if has_version '=sys-libs/db-4*' && grep -q -- '--with-db4' configure; then einfo "Enabling DB4" @@ -268,7 +219,7 @@ php_src_compile() { myconf="${myconf} --without-db3 --without-db4 --without-db2 --without-ndbm" fi - use crypt && myconf="${myconf} --with-mcrypt=/usr --with-mhash" + use crypt && myconf="${myconf} --with-mcrypt=/usr --with-mhash=/usr" use firebird && myconf="${myconf} --with-interbase=/opt/interbase" use flash && myconf="${myconf} --with-ming=/usr" use flash && use x86 && myconf="${myconf} --with-swf=/usr" @@ -280,33 +231,50 @@ php_src_compile() { use oci8 && [ -n "${ORACLE_HOME}" ] && myconf="${myconf} --with-oci8=${ORACLE_HOME}" use odbc && myconf="${myconf} --with-unixODBC=/usr" use postgres && myconf="${myconf} --with-pgsql=/usr" || myconf="${myconf} --without-pgsql" - use snmp && myconf="${myconf} --with-snmp --enable-ucd-snmp-hack" + use snmp && myconf="${myconf} --with-snmp=/usr --enable-ucd-snmp-hack" use X && myconf="${myconf} --with-xpm-dir=/usr/X11R6" LDFLAGS="${LDFLAGS} -L/usr/X11R6/lib" # This chunk is intended for png/tiff/jpg, as there are several things that need them, indepentandly! REQUIREPNG= REQUIREJPG= REQUIRETIFF= - use pdflib && myconf="${myconf} --with-pdflib=/usr" - use pdflib && REQUIREPNG=1 REQUIREJPG=1 REQUIRETIFF=1 - if [ -n "`use gd-external`" ] ; then + if use pdflib; then + myconf="${myconf} --with-pdflib=/usr" + REQUIREPNG=1 REQUIREJPG=1 REQUIRETIFF=1 + fi + if use gd-external; then myconf="${myconf} --with-gd=/usr" REQUIREPNG=1 - elif [ -n "`use gd`" ] ; then + elif use gd; then myconf="${myconf} --with-gd" - myconf="${myconf} `use_enable truetype gd-native-ttf`" - REQUIREPNG=1 - REQUIREJPG=1 + myconf="${myconf} `use_enable truetype gd-native-ttf`" + REQUIREPNG=1 REQUIREJPG=1 else myconf="${myconf} --without-gd" fi - use png || [ -n "${REQUIREPNG}" ] && myconf="${myconf} --with-png-dir=/usr" || myconf="${myconf} --without-png" - use jpeg || [ -n "${REQUIREJPG}" ] && myconf="${myconf} --with-jpeg --with-jpeg-dir=/usr --enable-exif" || myconf="${myconf} --without-jpeg" - use tiff || [ -n "${REQUIRETIFF}" ] && myconf="${myconf} --with-tiff-dir=/usr" LDFLAGS="${LDFLAGS} -ltiff" || myconf="${myconf} --without-tiff" + use png && REQUIREPNG=1 + use jpeg && REQUIREJPG=1 + use tiff && REQUIRETIFF=1 + if [ -n "${REQUIREPNG}" ]; then + myconf="${myconf} --with-png --with-png-dir=/usr" + else + myconf="${myconf} --without-png" + fi + if [ -n "${REQUIREJPG}" ]; then + myconf="${myconf} --with-jpeg --with-jpeg-dir=/usr --enable-exif" + else + myconf="${myconf} --without-jpeg" + fi + if [ -n "${REQUIRETIFF}" ]; then + myconf="${myconf} --with-tiff --with-tiff-dir=/usr" + LDFLAGS="${LDFLAGS} -ltiff" + else + myconf="${myconf} --without-tiff" + fi - #use mysql && myconf="${myconf} --with-mysql=/usr" || myconf="${myconf} --without-mysql" if use mysql; then - if [ -n "`mysql_config | grep '4.1'`" ] ; then + # check for mysql4.1 and mysql4.1 support in this php + if [ -n "`mysql_config | grep '4.1'`" ] && grep -q -- '--with-mysqli' configure; then myconf="${myconf} --with-mysqli=/usr" else myconf="${myconf} --with-mysql=/usr" @@ -316,23 +284,24 @@ php_src_compile() { myconf="${myconf} --without-mysql" fi - # Testing per bug #13382 - if runningunstable; then - use truetype && myconf="${myconf} --with-freetype-dir=/usr" + if use truetype; then + myconf="${myconf} --with-freetype-dir=/usr" + myconf="${myconf} --with-ttf=/usr" + myconf="${myconf} --with-t1lib=/usr" else - myconf="${myconf} `use_with truetype ttf` `use_with truetype t1lib`" + myconf="${myconf} --without-ttf --without-t1lib" fi - myconf="${myconf} `use_with nls gettext` `use_with qt qtdom`" - myconf="${myconf} `use_with spell pspell` `use_with ssl openssl`" - myconf="${myconf} `use_with imap` `use_with ldap`" - myconf="${myconf} `use_with xml2 dom` `use_with xml2 dom-xslt`" - myconf="${myconf} `use_with xml2 dom-exslt`" - myconf="${myconf} `use_with kerberos` `use_with pam`" + myconf="${myconf} `use_with nls gettext` `use_with qt qtdom /usr/qt/3`" + myconf="${myconf} `use_with spell pspell /usr` `use_with ssl openssl /usr`" + myconf="${myconf} `use_with imap imap /usr` `use_with ldap ldap /usr`" + myconf="${myconf} `use_with xml2 dom /usr` `use_with xml2 dom-xslt /usr`" + myconf="${myconf} `use_with xml2 dom-exslt /usr`" + myconf="${myconf} `use_with kerberos kerberos /usr` `use_with pam`" myconf="${myconf} `use_enable memlimit memory-limit`" myconf="${myconf} `use_enable ipv6`" if use curl; then - myconf="${myconf} --with-curlwrappers --with-curl" + myconf="${myconf} --with-curlwrappers --with-curl=/usr" else myconf="${myconf} --without-curl" fi @@ -357,7 +326,7 @@ php_src_compile() { # These were previously optional, but are now included directly as PEAR needs them. # Zlib is needed for XML - myconf="${myconf} --with-zlib --with-zlib-dir=/usr/lib" + myconf="${myconf} --with-zlib --with-zlib-dir=/usr" LIBS="${LIBS} -lxmlparse -lxmltok" myconf="${myconf} --with-sablot=/usr" myconf="${myconf} --enable-xslt" @@ -376,9 +345,9 @@ php_src_compile() { # throw them in for functionality. Somebody could turn them off if their # heart so desired # DEPEND - sys-apps/bzip2 - myconf="${myconf} --with-bz2" + myconf="${myconf} --with-bz2=/usr" # DEPEND - sys-libs/cracklib - myconf="${myconf} --with-crack" + myconf="${myconf} --with-crack=/usr" # DEPEND - nothing myconf="${myconf} --with-cdb" @@ -461,11 +430,9 @@ php_src_install() { # 2. edit the php.ini file ready for installation # - stuart@gentoo.org local phpinisrc=php.ini-dist - if [ "`use java`" ] ; then - + if use java; then # we put these into /usr/lib so that they cannot conflict with # other versions of PHP (e.g. PHP 4 & PHP 5) - insinto ${PHPEXTDIR} einfo "Installing JAR for PHP" doins ext/java/php_java.jar @@ -474,23 +441,19 @@ php_src_install() { newins ext/java/except.php java-test.php JAVA_LIBRARY="`grep -- '-DJAVALIB' Makefile | sed -e 's,.\+-DJAVALIB=\"\([^"]*\)\".*$,\1,g;'| sort | uniq `" - cat ${phpinisrc} | sed -e "s|;java.library .*$|java.library = ${JAVA_LIBRARY}|g" > php.ini-1 - cat php.ini-1 | sed -e "s|;java.class.path .*$|java.class.path = ${PHPEXTDIR}/php_java.jar|g" > php.ini-2 - cat php.ini-2 | sed -e "s|extension_dir .*$|extension_dir = ${PHPEXTDIR}|g" > php.ini-3 - cat php.ini-3 | sed -e "s|;extension=php_java.dll.*$|extension = java.so|g" > php.ini-4 - cat php.ini-4 | sed -e "s|;java.library.path .*$|java.library.path = ${PHPEXTDIR}|g" > php.ini-5 - phpinisrc=php.ini-5 + sed -e "s|;java.library .*$|java.library = ${JAVA_LIBRARY}|g" -i ${phpinisrc} + sed -e "s|;java.class.path .*$|java.class.path = ${PHPEXTDIR}/php_java.jar|g" -i ${phpinisrc} + sed -e "s|extension_dir .*$|extension_dir = ${PHPEXTDIR}|g" -i ${phpinisrc} + sed -e "s|;extension=php_java.dll.*$|extension = java.so|g" -i ${phpinisrc} + sed -e "s|;java.library.path .*$|java.library.path = ${PHPEXTDIR}|g" -i ${phpinisrc} dosym ${PHPEXTDIR}/java.so ${PHPEXTDIR}/libphp_java.so - #( cd ${D} ; ln -snf ${PHPEXTDIR}/java.so ${D}/${PHPEXTDIR}/libphp_java.so ) fi #url_fopen patch ${phpinisrc} <${DISTDIR}/php-4.3.2-fopen-url-secure.patch #prevent bugs with php-ext eclasses - mv $phpinisrc $phpinisrc.orig - sed 's:extension_dir = "./"::' $phpinisrc.orig > $phpinisrc - + sed -e 's:extension_dir = "./"::' -i ${phpinisrc} # A lot of ini file funkiness insinto ${PHPINIDIRECTORY} @@ -500,9 +463,14 @@ php_src_install() { } php_pkg_preinst() { - einfo "Preserving old php.ini if needed" - mkdir -p ${PHPINIDIRECTORY} - [ -e /etc/php4/php.ini ] && [ -f /etc/php4/php.ini ] && mv -f /etc/php4/php.ini ${PHPINIDIRECTORY}/${PHPINIFILENAME} + einfo "Checking if we need to preserve a really old /etc/php4/php.ini file" + if [ -e /etc/php4/php.ini ] && [ ! -L /etc/php4/php.ini ]; then + ewarn "Old setup /etc/php4/php.ini file detected, moving to new location (${PHPINIDIRECTORY}/${PHPINIFILENAME})" + mkdir -p ${PHPINIDIRECTORY} + mv -f /etc/php4/php.ini ${PHPINIDIRECTORY}/${PHPINIFILENAME} + else + einfo "/etc/php4/php.ini doesn't exist or is a symlink, nothing wrong here" + fi } php_pkg_postinst() { |