/[gentoo-x86]/eclass/php-common-r1.eclass
Gentoo

Contents of /eclass/php-common-r1.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (hide annotations) (download)
Fri Mar 24 23:05:49 2006 UTC (8 years, 1 month ago) by chtekk
Branch: MAIN
Changes since 1.5: +62 -38 lines
Use phpconfutils, fix bug #120088, fix bug #122379.

1 stuart 1.1 # Copyright 1999-2005 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3 chtekk 1.6 # $Header: /var/cvsroot/gentoo-x86/eclass/php-common-r1.eclass,v 1.5 2006/01/04 09:22:48 chtekk Exp $
4 stuart 1.1
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 chtekk 1.6 # Maintained by the PHP Herd <php-bugs@gentoo.org>
17 stuart 1.1 #
18     # ########################################################################
19    
20     # ########################################################################
21     # CFLAG SANITY
22     # ########################################################################
23    
24     php_check_cflags() {
25 chtekk 1.6 # Filter the following from C[XX]FLAGS regardless, as apache won't be
26     # supporting LFS until 2.2 is released and in the tree. Fixes bug #24373.
27 stuart 1.1 filter-flags "-D_FILE_OFFSET_BITS=64"
28     filter-flags "-D_FILE_OFFSET_BITS=32"
29     filter-flags "-D_LARGEFILE_SOURCE=1"
30     filter-flags "-D_LARGEFILE_SOURCE"
31    
32 chtekk 1.6 # Fixes bug #14067.
33     # Changed order to run it in reverse for bug #32022 and #12021.
34 stuart 1.1 replace-flags "-march=k6-3" "-march=i586"
35     replace-flags "-march=k6-2" "-march=i586"
36     replace-flags "-march=k6" "-march=i586"
37     }
38    
39     # ########################################################################
40     # IMAP SUPPORT
41     # ########################################################################
42    
43     php_check_imap() {
44 chtekk 1.6 if ! useq "imap" && ! phpconfutils_usecheck "imap" ; then
45 stuart 1.1 return
46     fi
47    
48 chtekk 1.6 if useq "ssl" || phpconfutils_usecheck "ssl" ; then
49 stuart 1.1 if ! built_with_use virtual/imap-c-client ssl ; then
50     eerror
51 chtekk 1.6 eerror "IMAP with SSL requested, but your IMAP C-Client libraries are built without SSL!"
52 stuart 1.1 eerror
53 chtekk 1.6 die "Please recompile the IMAP C-Client libraries with SSL support enabled"
54     fi
55     else
56     if built_with_use virtual/imap-c-client ssl ; then
57     eerror
58     eerror "IMAP without SSL requested, but your IMAP C-Client libraries are built with SSL!"
59     eerror
60     die "Please recompile the IMAP C-Client libraries with SSL support disabled"
61 stuart 1.1 fi
62     fi
63     }
64    
65     # ########################################################################
66     # JAVA EXTENSION SUPPORT
67     #
68     # The bundled java extension is unique to PHP4 at the time of writing, but
69     # there is now the PHP-Java-Bridge that works under both PHP4 and PHP5.
70     # ########################################################################
71    
72 hollow 1.2 php_check_java() {
73 chtekk 1.6 if ! useq "java-internal" && ! phpconfutils_usecheck "java-internal" ; then
74     return
75 stuart 1.1 fi
76    
77     JDKHOME="`java-config --jdk-home`"
78 chtekk 1.6 NOJDKERROR="You need to use the 'java-config' utility to set your JVM to a JDK!"
79     if [[ -z "${JDKHOME}" ]] || [[ ! -d "${JDKHOME}" ]] ; then
80 stuart 1.1 eerror "${NOJDKERROR}"
81     die "${NOJDKERROR}"
82     fi
83    
84     # stuart@gentoo.org - 2003/05/18
85     # Kaffe JVM is not a drop-in replacement for the Sun JDK at this time
86     if echo ${JDKHOME} | grep kaffe > /dev/null 2>&1 ; then
87     eerror
88     eerror "PHP will not build using the Kaffe Java Virtual Machine."
89     eerror "Please change your JVM to either Blackdown or Sun's."
90     eerror
91     eerror "To build PHP without Java support, please re-run this emerge"
92     eerror "and place the line:"
93 hollow 1.2 eerror " USE='-java-internal'"
94 chtekk 1.6 eerror "in front of your emerge command, for example:"
95 hollow 1.2 eerror " USE='-java-internal' emerge =dev-lang/php-4*"
96 stuart 1.1 eerror
97 chtekk 1.6 eerror "or edit your USE flags in /etc/make.conf."
98 stuart 1.1 die "Kaffe JVM not supported"
99     fi
100    
101 hollow 1.2 JDKVER=$(java-config --java-version 2>&1 | awk '/^java version/ { print $3 }' | xargs )
102 stuart 1.1 einfo "Active JDK version: ${JDKVER}"
103 chtekk 1.3 case "${JDKVER}" in
104 stuart 1.1 1.4.*) ;;
105     1.5.*) ewarn "Java 1.5 is NOT supported at this time, and might not work." ;;
106 chtekk 1.6 *) eerror "A Java 1.4 JDK is recommended for Java support in PHP." ; die ;;
107 stuart 1.1 esac
108     }
109    
110     php_install_java() {
111 chtekk 1.6 if ! useq "java-internal" && ! phpconfutils_usecheck "java-internal" ; then
112     return
113 stuart 1.1 fi
114    
115 chtekk 1.6 # We put these into /usr/lib so that they cannot conflict with
116 stuart 1.1 # other versions of PHP (e.g. PHP 4 & PHP 5)
117 chtekk 1.6 insinto "${PHPEXTDIR}"
118 stuart 1.1 einfo "Installing JAR for PHP"
119 chtekk 1.6 doins "ext/java/php_java.jar"
120 stuart 1.1
121     einfo "Installing Java test page"
122 chtekk 1.6 newins "ext/java/except.php" "java-test.php"
123 stuart 1.1
124     einfo "Installing Java extension for PHP"
125 chtekk 1.6 doins "modules/java.so"
126 stuart 1.1
127 chtekk 1.6 dosym "${PHPEXTDIR}/java.so" "${PHPEXTDIR}/libphp_java.so"
128 stuart 1.1 }
129    
130 chtekk 1.3 php_install_java_inifile() {
131 chtekk 1.6 if ! useq "java-internal" && ! phpconfutils_usecheck "java-internal" ; then
132     return
133 chtekk 1.4 fi
134    
135 chtekk 1.6 JAVA_LIBRARY="`grep -- '-DJAVALIB' Makefile | sed -e 's,.\+-DJAVALIB=\"\([^"]*\)\".*$,\1,g;' | sort -u`"
136 chtekk 1.3
137     echo "extension = java.so" >> "${D}/${PHP_EXT_INI_DIR}/java.ini"
138     echo "java.library = ${JAVA_LIBRARY}" >> "${D}/${PHP_EXT_INI_DIR}/java.ini"
139     echo "java.class.path = ${PHPEXTDIR}/php_java.jar" >> "${D}/${PHP_EXT_INI_DIR}/java.ini"
140     echo "java.library.path = ${PHPEXTDIR}" >> "${D}/${PHP_EXT_INI_DIR}/java.ini"
141    
142     dosym "${PHP_EXT_INI_DIR}/java.ini" "${PHP_EXT_INI_DIR_ACTIVE}/java.ini"
143     }
144    
145 stuart 1.1 # ########################################################################
146     # MTA SUPPORT
147     # ########################################################################
148    
149     php_check_mta() {
150 chtekk 1.6 if ! [[ -x "${ROOT}/usr/sbin/sendmail" ]] ; then
151     ewarn
152     ewarn "You need a virtual/mta that provides a sendmail compatible binary!"
153     ewarn "All major MTAs provide this, and it's usually some symlink created"
154     ewarn "as '${ROOT}/usr/sbin/sendmail*'. You should also be able to use other"
155     ewarn "MTAs directly, but you'll have to edit the sendmail_path directive"
156     ewarn "in your php.ini for this to work."
157     ewarn
158     fi
159 stuart 1.1 }
160    
161     # ########################################################################
162     # ORACLE SUPPORT
163     # ########################################################################
164    
165 chtekk 1.5 php_check_oracle_all() {
166 chtekk 1.6 if useq "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then
167 stuart 1.1 eerror
168 chtekk 1.6 eerror "You must have the ORACLE_HOME variable set in your environment to"
169     eerror "compile the Oracle extension."
170 stuart 1.1 eerror
171     die "Oracle configuration incorrect; user error"
172     fi
173    
174 chtekk 1.6 if useq "oci8" || useq "oracle7" ; then
175 stuart 1.1 if has_version 'dev-db/oracle-instantclient-basic' ; then
176 chtekk 1.6 ewarn
177 stuart 1.1 ewarn "Please ensure you have a full install of the Oracle client."
178 chtekk 1.6 ewarn "'dev-db/oracle-instantclient-basic' is NOT sufficient."
179     ewarn "Please enable the 'oci8-instant-client' USE flag instead, if you"
180     ewarn "want to use 'dev-db/oracle-instantclient-basic' as Oracle client."
181     ewarn
182 stuart 1.1 fi
183     fi
184     }
185    
186 chtekk 1.5 php_check_oracle_8() {
187 chtekk 1.6 if useq "oci8" && [[ -z "${ORACLE_HOME}" ]] ; then
188 chtekk 1.5 eerror
189 chtekk 1.6 eerror "You must have the ORACLE_HOME variable set in your environment to"
190     eerror "compile the Oracle extension."
191 chtekk 1.5 eerror
192     die "Oracle configuration incorrect; user error"
193     fi
194    
195 chtekk 1.6 if useq "oci8" ; then
196 chtekk 1.5 if has_version 'dev-db/oracle-instantclient-basic' ; then
197 chtekk 1.6 ewarn
198 chtekk 1.5 ewarn "Please ensure you have a full install of the Oracle client."
199 chtekk 1.6 ewarn "'dev-db/oracle-instantclient-basic' is NOT sufficient."
200     ewarn "Please enable the 'oci8-instant-client' USE flag instead, if you"
201     ewarn "want to use 'dev-db/oracle-instantclient-basic' as Oracle client."
202     ewarn
203 chtekk 1.5 fi
204     fi
205     }
206    
207 stuart 1.1 # ########################################################################
208     # END OF ECLASS
209     # ########################################################################

  ViewVC Help
Powered by ViewVC 1.1.20