| 1 |
# Copyright 1999-2005 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: $
|
| 4 |
|
| 5 |
# ########################################################################
|
| 6 |
#
|
| 7 |
# eclass/php-common-r1.eclass
|
| 8 |
# Contains common functions which are shared between the
|
| 9 |
# PHP4 and PHP5 packages
|
| 10 |
#
|
| 11 |
# USE THIS ECLASS FOR THE "CONSOLIDATED" PACKAGES
|
| 12 |
#
|
| 13 |
# Based on robbat2's work on the php4 sapi eclass
|
| 14 |
# Based on stuart's work on the php5 sapi eclass
|
| 15 |
#
|
| 16 |
# Maintainer:
|
| 17 |
# php-bugs@gentoo.org
|
| 18 |
#
|
| 19 |
# ########################################################################
|
| 20 |
|
| 21 |
# ########################################################################
|
| 22 |
# CFLAG SANITY
|
| 23 |
# ########################################################################
|
| 24 |
|
| 25 |
php_check_cflags() {
|
| 26 |
# filter the following from C[XX]FLAGS regardless, as apache won't be
|
| 27 |
# supporting LFS until 2.2 is released and in the tree. Fixes bug #24373.
|
| 28 |
filter-flags "-D_FILE_OFFSET_BITS=64"
|
| 29 |
filter-flags "-D_FILE_OFFSET_BITS=32"
|
| 30 |
filter-flags "-D_LARGEFILE_SOURCE=1"
|
| 31 |
filter-flags "-D_LARGEFILE_SOURCE"
|
| 32 |
|
| 33 |
#fixes bug #14067
|
| 34 |
# changed order to run it in reverse for bug #32022 and #12021
|
| 35 |
replace-flags "-march=k6-3" "-march=i586"
|
| 36 |
replace-flags "-march=k6-2" "-march=i586"
|
| 37 |
replace-flags "-march=k6" "-march=i586"
|
| 38 |
}
|
| 39 |
|
| 40 |
# ########################################################################
|
| 41 |
# IMAP SUPPORT
|
| 42 |
# ########################################################################
|
| 43 |
|
| 44 |
php_check_imap() {
|
| 45 |
if ! useq imap ; then
|
| 46 |
return
|
| 47 |
fi
|
| 48 |
|
| 49 |
if useq ssl ; then
|
| 50 |
if ! built_with_use virtual/imap-c-client ssl ; then
|
| 51 |
eerror
|
| 52 |
eerror "IMAP+SSL requested, but your IMAP libraries are built without SSL!"
|
| 53 |
eerror
|
| 54 |
die "Please recompile IMAP libraries w/ SSL support enabled"
|
| 55 |
fi
|
| 56 |
fi
|
| 57 |
}
|
| 58 |
|
| 59 |
# ########################################################################
|
| 60 |
# JAVA EXTENSION SUPPORT
|
| 61 |
#
|
| 62 |
# The bundled java extension is unique to PHP4 at the time of writing, but
|
| 63 |
# there is now the PHP-Java-Bridge that works under both PHP4 and PHP5.
|
| 64 |
# ########################################################################
|
| 65 |
|
| 66 |
php_check_java() {
|
| 67 |
if ! useq java-internal ; then
|
| 68 |
return 1
|
| 69 |
fi
|
| 70 |
|
| 71 |
JDKHOME="`java-config --jdk-home`"
|
| 72 |
NOJDKERROR="You need to use java-config to set your JVM to a JDK!"
|
| 73 |
if [ -z "${JDKHOME}" ] || [ ! -d "${JDKHOME}" ]; then
|
| 74 |
eerror "${NOJDKERROR}"
|
| 75 |
die "${NOJDKERROR}"
|
| 76 |
fi
|
| 77 |
|
| 78 |
# stuart@gentoo.org - 2003/05/18
|
| 79 |
# Kaffe JVM is not a drop-in replacement for the Sun JDK at this time
|
| 80 |
if echo ${JDKHOME} | grep kaffe > /dev/null 2>&1 ; then
|
| 81 |
eerror
|
| 82 |
eerror "PHP will not build using the Kaffe Java Virtual Machine."
|
| 83 |
eerror "Please change your JVM to either Blackdown or Sun's."
|
| 84 |
eerror
|
| 85 |
eerror "To build PHP without Java support, please re-run this emerge"
|
| 86 |
eerror "and place the line:"
|
| 87 |
eerror " USE='-java-internal'"
|
| 88 |
eerror "in front of your emerge command; e.g."
|
| 89 |
eerror " USE='-java-internal' emerge =dev-lang/php-4*"
|
| 90 |
eerror
|
| 91 |
eerror "or edit your USE flags in /etc/make.conf"
|
| 92 |
die "Kaffe JVM not supported"
|
| 93 |
fi
|
| 94 |
|
| 95 |
JDKVER=$(java-config --java-version 2>&1 | awk '/^java version/ { print $3 }' | xargs )
|
| 96 |
einfo "Active JDK version: ${JDKVER}"
|
| 97 |
case ${JDKVER} in
|
| 98 |
1.4.*) ;;
|
| 99 |
1.5.*) ewarn "Java 1.5 is NOT supported at this time, and might not work." ;;
|
| 100 |
*) eerror "A Java 1.4 JDK is required for Java support in PHP." ; die ;;
|
| 101 |
esac
|
| 102 |
}
|
| 103 |
|
| 104 |
php_install_java() {
|
| 105 |
if ! useq java-internal ; then
|
| 106 |
return 1
|
| 107 |
fi
|
| 108 |
|
| 109 |
# we put these into /usr/lib so that they cannot conflict with
|
| 110 |
# other versions of PHP (e.g. PHP 4 & PHP 5)
|
| 111 |
insinto ${PHPEXTDIR}
|
| 112 |
einfo "Installing JAR for PHP"
|
| 113 |
doins ext/java/php_java.jar
|
| 114 |
|
| 115 |
einfo "Installing Java test page"
|
| 116 |
newins ext/java/except.php java-test.php
|
| 117 |
|
| 118 |
JAVA_LIBRARY="`grep -- '-DJAVALIB' Makefile | sed -e 's,.\+-DJAVALIB=\"\([^"]*\)\".*$,\1,g;'| sort | uniq `"
|
| 119 |
sed -e "s|;java.library .*$|java.library = ${JAVA_LIBRARY}|g" -i ${phpinisrc}
|
| 120 |
sed -e "s|;java.class.path .*$|java.class.path = ${PHPEXTDIR}/php_java.jar|g" -i ${phpinisrc}
|
| 121 |
sed -e "s|;java.library.path .*$|java.library.path = ${PHPEXTDIR}|g" -i ${phpinisrc}
|
| 122 |
sed -e "s|;extension=php_java.dll.*$|extension = java.so|g" -i ${phpinisrc}
|
| 123 |
|
| 124 |
einfo "Installing Java extension for PHP"
|
| 125 |
doins modules/java.so
|
| 126 |
|
| 127 |
dosym ${PHPEXTDIR}/java.so ${PHPEXTDIR}/libphp_java.so
|
| 128 |
}
|
| 129 |
|
| 130 |
# ########################################################################
|
| 131 |
# MTA SUPPORT
|
| 132 |
# ########################################################################
|
| 133 |
|
| 134 |
php_check_mta() {
|
| 135 |
[ -x "${ROOT}/usr/sbin/sendmail" ] || die "You need a virtual/mta that provides /usr/sbin/sendmail!"
|
| 136 |
}
|
| 137 |
|
| 138 |
# ########################################################################
|
| 139 |
# ORACLE SUPPORT
|
| 140 |
# ########################################################################
|
| 141 |
|
| 142 |
php_check_oracle() {
|
| 143 |
if useq oci8 && [ -z "${ORACLE_HOME}" ]; then
|
| 144 |
eerror
|
| 145 |
eerror "You must have the ORACLE_HOME variable in your environment!"
|
| 146 |
eerror
|
| 147 |
die "Oracle configuration incorrect; user error"
|
| 148 |
fi
|
| 149 |
|
| 150 |
if useq oci8 || useq oracle7 ; then
|
| 151 |
if has_version 'dev-db/oracle-instantclient-basic' ; then
|
| 152 |
ewarn "Please ensure you have a full install of the Oracle client."
|
| 153 |
ewarn "dev-db/oracle-instantclient* is NOT sufficient."
|
| 154 |
fi
|
| 155 |
fi
|
| 156 |
}
|
| 157 |
|
| 158 |
# ########################################################################
|
| 159 |
# END OF ECLASS
|
| 160 |
# ########################################################################
|