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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.20